Empty dictionary for worker objects

RESOLVED FIXED in mozilla18

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: baku, Assigned: bz)

Tracking

Trunk
mozilla18
x86_64
Linux
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

5 years ago
Created attachment 658061 [details]
test

Applying the attached patch, this is the output that I see:

TEST_PATH=dom/workers/test/test_xhr_params.html  make -C ../build/ mochitest-plain

BAKU CONSTRUCTOR: 1 0
TEST-PASS | unknown test url | XHR exists!
TEST-PASS | unknown test url | mozAnon == true - true should equal true
...

Then, refreshing the page:

BAKU CONSTRUCTOR: 0 0
TEST-PASS | unknown test url | XHR exists!
TEST-UNEXPECTED-FAIL | unknown test url | mozAnon == true - got false, expected true
...

The MozXMLHttpRequestParametersWorkers seems empty:
printf("BAKU CONSTRUCTOR: %d %d\n", aParams.mozAnon, aParams.mozSystem);
(Reporter)

Updated

5 years ago
Blocks: 761227
Stepping through this on the reload, I see:

    JS_HasPropertyById(cx, &val.toObject(), mozAnon_id, &found)

  (gdb) p found
  $1 = 0

I wonder...  We end up with separate jsruntimes for the different workers, don't we?  So we can't actually use jsid here, I bet.  :(
(Reporter)

Comment 2

5 years ago
yep, Any worker has a separated JSRuntime.

Any implication using JS_HasProperty(JSContext *cx, JSObject *obj, const char *name, JSBool *foundp) ?
Well, yes, it's slower.  ;)

Patch coming up to do just that on workers, though.  I'll include a variant of the attached test that fails reliably without requiring a reload.
Actually, maybe it's better to just land the test as part of bug 761227.  I'll just attach a diff against the test patch in this bug.
Created attachment 658075 [details] [diff] [review]
Test that fails reliably
Created attachment 658077 [details] [diff] [review]
Don't use jsids in worker code in bindings, because those are runtime-specific and workers can run on multiple runtimes.
Attachment #658077 - Flags: review?(peterv)
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Attachment #658077 - Flags: review?(peterv) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/73642fc72b2e

Still needs a test, but I assume that will land as part of bug 761227?
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla18
https://hg.mozilla.org/mozilla-central/rev/73642fc72b2e
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.