ArpitB

collection.create example

Jul 24th, 2019
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The Test:
  2.  
  3. add_task(async () => {
  4.   info("URI sent when record is in DB");
  5.  
  6.   const collection = await client.openCollection();
  7.   await collection.clear();
  8.   await collection.create(
  9.     {
  10.       id: "tld-dafsa",
  11.       "commit-hash": "fake-commit-hash",
  12.       attachment: {},
  13.     },
  14.     { synced: true }
  15.   );
  16.   await collection.db.saveLastModified(42); // Prevent from loading JSON dump.
  17.  
  18.   const backup = client.attachments.download;
  19.   client.attachments.download = async rec => {
  20.     return mockedFileURI;
  21.   };
  22.  
  23.   const promiseSignal = TestUtils.topicObserved(SIGNAL);
  24.   PublicSuffixList.init();
  25.   const observed = await promiseSignal;
  26.   Assert.equal(observed[1], mockedFileURI);
  27.  
  28.   await collection.clear();
  29.   client.attachments.download = backup;
  30. });
  31.  
  32.  
  33. The error :
  34.  
  35. 0:00.96 INFO "URI sent when record is in DB"
  36.  0:01.00 pid:21537 JavaScript strict warning: resource://services-common/kinto-http-client.js, line 1796: ReferenceError: reference to undefined property "initializer"
  37.  0:01.00 pid:21537 JavaScript strict warning: resource://services-common/kinto-http-client.js, line 1177: ReferenceError: reference to undefined property "initializer"
  38.  0:01.00 pid:21537 JavaScript strict warning: resource://services-common/kinto-http-client.js, line 323: ReferenceError: reference to undefined property "initializer"
  39.  0:01.00 INFO (xpcshell/head.js) | test run_next_test 0 finished (2)
  40.  0:01.00 INFO "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "ReferenceError: reference to undefined property "initializer"" {file: "resource://services-common/kinto-http-client.js" line: 1796}]"
  41.  0:01.00 INFO "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "ReferenceError: reference to undefined property "initializer"" {file: "resource://services-common/kinto-http-client.js" line: 1177}]"
  42.  0:01.00 INFO "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "ReferenceError: reference to undefined property "initializer"" {file: "resource://services-common/kinto-http-client.js" line: 323}]"
  43.  0:01.01 pid:21537 [21537, IPDL Background] WARNING: '!gBaseDirPath', file /builds/worker/workspace/build/src/dom/quota/ActorsParent.cpp, line 3069
  44.  0:01.01 pid:21537 [21537, IPDL Background] WARNING: profile-do-change must precede QuotaManager::GetOrCreate(): file /builds/worker/workspace/build/src/dom/quota/ActorsParent.cpp, line 3070
  45.  0:01.01 pid:21537 [21537, IPDL Background] WARNING: '!QuotaManager::Get()', file /builds/worker/workspace/build/src/dom/indexedDB/ActorsParent.cpp, line 19703
  46.  0:01.01 pid:21537 [21537, IPDL Background] WARNING: 'NS_FAILED(rv)', file /builds/worker/workspace/build/src/dom/indexedDB/ActorsParent.cpp, line 19859
  47.  0:01.01 pid:21537 [21537, IPDL Background] WARNING: Converting non-IndexedDB error code (0x80004005) to NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR: file /builds/worker/workspace/build/src/dom/indexedDB/ActorsParent.cpp, line 575
  48.  0:01.01 INFO "CONSOLE_MESSAGE: (error) [JavaScript Error: "IndexedDB UnknownErr: ActorsParent.cpp:581"]"
  49.  0:01.01 ERROR Unexpected exception Error: IndexedDB clear() The operation failed for reasons unrelated to the database itself and not covered by any other error code. at resource://services-common/kinto-offline-client.js:579
  50.  
  51.  0:01.01 INFO exiting test
  52.  0:01.05 pid:21537 JavaScript error: resource://testing-common/PromiseTestUtils.jsm, line 110: uncaught exception: Object
  53.  0:01.08 pid:21537 [21537, Main Thread] WARNING: OOPDeinit() without successful OOPInit(): file /builds/worker/workspace/build/src/toolkit/crashreporter/nsExceptionHandler.cpp, line 3037
  54.  0:01.08 pid:21537 [21537, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/workspace/build/src/xpcom/base/nsTraceRefcnt.cpp, line 194
  55.  0:01.08 pid:21537 [21537, Main Thread] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/workspace/build/src/xpcom/base/nsTraceRefcnt.cpp, line 194
  56.  0:01.08 pid:21537 nsStringStats
  57.  0:01.08 pid:21537  => mAllocCount:          11232
  58.  0:01.08 pid:21537  => mReallocCount:            0
  59.  0:01.08 pid:21537  => mFreeCount:           11232
  60.  0:01.08 pid:21537  => mShareCount:          10177
  61.  0:01.08 pid:21537  => mAdoptCount:            173
  62.  0:01.08 pid:21537  => mAdoptFreeCount:        173
  63.  0:01.08 pid:21537  => Process ID: 21537, Thread ID: 139628778361984
  64.  0:01.09 TEST_END: FAIL, expected PASS - xpcshell return code: 0
  65.  0:01.09 INFO INFO | Result summary:
  66.  0:01.09 INFO INFO | Passed: 0
  67.  0:01.09 INFO INFO | Failed: 1
  68.  0:01.09 INFO INFO | Todo: 0
  69.  0:01.09 INFO INFO | Retried: 0
  70.  0:01.09 SUITE_END
Add Comment
Please, Sign In to add comment