Closed Bug 1878148 Opened 8 months ago Closed 5 months ago

Failing WPT IndexedDB/serialize-sharedarraybuffer-throws.https.html

Categories

(Core :: Storage: IndexedDB, defect)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: twisniewski, Assigned: twisniewski)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Blocks: 1878149
No longer blocks: 1878149
Severity: -- → S3

We do throw an error, but it's not the one the test expects:

assert_throws_dom: function "() => { rq = objStore.put({sab: sab}, "key"); }" threw object
"DataError: Data provided to an operation does not meet requirements."
that is not a DOMException DataCloneError: property "code" is equal to 0, expected 25

And we're getting that NS_ERROR_DOM_INDEXEDDB_DATA_ERR from here:

void IDBObjectStore::GetAddInfo(...) {
  // Return DATA_ERR if a key was passed in and this objectStore uses inline keys.
  if (!aKeyVal.isUndefined() && HasValidKeyPath()) {
    aRv.Throw(NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
    return;
  }

Which seems odd. This is the core of the test:

    let open_rq = createdb(t);
    open_rq.onupgradeneeded = function(e) {
        let db = e.target.result;
        let objStore = db.createObjectStore("test", { keyPath:"pKey" });
        let sab = new SharedArrayBuffer(256);
        let rq;
        assert_throws_dom("DataCloneError", () => {
            rq = objStore.put({sab: sab}, "key");
        });

If I drop the "key" argument on the put so it's just objStore.put({sab: sab}), then we do get a data clone error, it's just still not the "right" one:

assert_throws_dom: function "() => { rq = objStore.put({sab: sab}); }" threw object
"TypeError: The SharedArrayBuffer object cannot be serialized. The Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers can be used to enable this."
that is not a DOMException DataCloneError: property "code" is equal to undefined, expected 25

It becomes the "right" one if I add a JS_ClearPendingException here:

    if (!aValueWrapper.Clone(aCx)) {
      JS_ClearPendingException(aCx);
      aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
      return;
    }

But the real question is: what's going on with the "key" argument in the test. Jarl, any clues?

Flags: needinfo?(jjalkanen)

We should fail on step 13 https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal , which seems to be the one you get by not running first on the key path issues, apart from the unexpectely undefined code. If the object store should use a keypath, there should be an error when data does not provide a key for the path and also when an explicit key is given.

Flags: needinfo?(jjalkanen)

Right, but if I'm not mistaken the spec for add/put says we should do the key checks first (step 8), and then the cloning (step 10). So shouldn't our current behaviour be correct and the test should expect a DataError, not a DataCloneError?

Or should we not be failing on step 8? (which I think is the code here, where it's failing for us).

Flags: needinfo?(jjalkanen)

Yeah, it seems like the test needs to be fixed. In v8 they are checking the value and the key in the order they appear among the arguments. It seems that the test landed to probe the cross-origin isolation and there was no discussion on this question.

Flags: needinfo?(jjalkanen)
Assignee: nobody → twisniewski
Status: NEW → ASSIGNED
Pushed by twisniewski@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a913463932b7 fix the WPT IndexedDB/serialize-sharedarraybuffer-throws.https.html to trigger a data clone error per spec, and send the correct DataCloneError it expects; r=jari,dom-storage-reviewers
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/45913 for changes under testing/web-platform/tests

Backed out for causing failures on key-conversion-exceptions.htm

[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - TEST-PASS | /IndexedDB/key-conversion-exceptions.htm | IDBKeyRange bound() static with throwing/invalid keys 
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - TEST-UNEXPECTED-FAIL | /IndexedDB/key-conversion-exceptions.htm | IDBObjectStore add() method with throwing/invalid keys - assert_throws_exactly: throwing getter should rethrow during clone function "() => {
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO -             in_line[method](value);
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO -         }" threw object "DataCloneError: The object could not be cloned." but we expected it to throw object "getter: throwing from getter"
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - @http://web-platform.test:8000/IndexedDB/key-conversion-exceptions.htm:158:30
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - indexeddb_test/</open.onupgradeneeded<@http://web-platform.test:8000/IndexedDB/resources/support.js:132:19
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2622:25
[task 2024-04-25T16:44:00.825Z] 16:44:00     INFO - Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:2669:35
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - 
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - TEST-UNEXPECTED-FAIL | /IndexedDB/key-conversion-exceptions.htm | IDBObjectStore put() method with throwing/invalid keys - assert_throws_exactly: throwing getter should rethrow during clone function "() => {
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO -             in_line[method](value);
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO -         }" threw object "DataCloneError: The object could not be cloned." but we expected it to throw object "getter: throwing from getter"
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - @http://web-platform.test:8000/IndexedDB/key-conversion-exceptions.htm:158:30
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - indexeddb_test/</open.onupgradeneeded<@http://web-platform.test:8000/IndexedDB/resources/support.js:132:19
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2622:25
[task 2024-04-25T16:44:00.827Z] 16:44:00     INFO - Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:2669:35
[task 2024-04-25T16:44:00.834Z] 16:44:00     INFO - ...............
[task 2024-04-25T16:44:00.835Z] 16:44:00     INFO - TEST-OK | /IndexedDB/key-conversion-exceptions.htm | took 2357ms
Flags: needinfo?(twisniewski)
Upstream PR was closed without merging
Pushed by twisniewski@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/133181fbd1ef fix the WPT IndexedDB/serialize-sharedarraybuffer-throws.https.html to trigger a data clone error per spec, and send the correct DataCloneError it expects; r=jari,dom-storage-reviewers
Flags: needinfo?(twisniewski)
Keywords: leave-open

Backed out for causing xpc crashes @ mozilla::dom::(anonymous namespace)::ensureCorrectDataCloneError

Backout link: https://hg.mozilla.org/integration/autoland/rev/f8a7a562b63a7046491d04971e58f2e39dedde7e

Push with failures

Failure log -> PROCESS-CRASH | application crashed [@ mozilla::dom::(anonymous namespace)::ensureCorrectDataCloneError] | xpcshell.toml:dom/indexedDB/test/unit/test_wasm_put_get_values.js

mozcrash Saved app info as /builds/worker/workspace/build/blobber_upload_dir/46394573-fbf9-4a1b-49d1-e62826879c7d.extra
[task 2024-04-25T21:47:03.096Z] 21:47:03  WARNING -  PROCESS-CRASH | application crashed [@ mozilla::dom::(anonymous namespace)::ensureCorrectDataCloneError] | xpcshell.toml:dom/indexedDB/test/unit/test_wasm_put_get_values.js
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Process type: main
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Process pid: 32505
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Crash dump filename: /tmp/tmp555hp3ct/46394573-fbf9-4a1b-49d1-e62826879c7d.dmp
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Operating system: Android
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -                    0.0.0 Linux 3.10.0+ #260 SMP PREEMPT Fri May 19 12:48:14 PDT 2017 x86_64
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  CPU: amd64
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -       family 6 model 6 stepping 3
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -       4 CPUs
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Crash reason:  SIGSEGV / SEGV_MAPERR
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -  Crash address: 0x000000000000001c **
[task 2024-04-25T21:47:03.096Z] 21:47:03     INFO -      ** Null pointer detected with offset: 0x000000000000001c
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -  Crashing instruction: `mov eax, dword [rax + 0x1c]`
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -  Memory accessed by instruction:
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -    0. Address: 0x000000000000001c
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -       Size: 4
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -  Process uptime: not available
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -  Thread 12 Gecko (crashed)
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -   0  libxul.so!mozilla::dom::(anonymous namespace)::ensureCorrectDataCloneError(JSContext*) [IDBObjectStore.cpp:133181fbd1efe43a038d82c04f0d681a3320f389 : 288 + 0x0]
[task 2024-04-25T21:47:03.097Z] 21:47:03     INFO -       rax = 0x0000000000000000    rdx = 0x00007f83777d9720
Flags: needinfo?(twisniewski)
Upstream PR was closed without merging
Pushed by twisniewski@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/45defed78aaf fix the WPT IndexedDB/serialize-sharedarraybuffer-throws.https.html to trigger a data clone error per spec, and send the correct DataCloneError it expects; r=jari,dom-storage-reviewers

Backed out for causing multiple wpt failures with serialization in summary

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-PASS | /html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.worker.html | SharedArrayBuffer cloning via IndexedDB: basic case - expected FAIL

another wpt failure: https://treeherder.mozilla.org/logviewer?job_id=456090427&repo=autoland

Flags: needinfo?(twisniewski)
Upstream PR was closed without merging
Pushed by twisniewski@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d91e3ed25de4 fix the WPT IndexedDB/serialize-sharedarraybuffer-throws.https.html to trigger a data clone error per spec, and send the correct DataCloneError it expects; r=jari,dom-storage-reviewers,janv
Upstream PR merged by moz-wptsync-bot
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Flags: needinfo?(twisniewski)
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: