Closed
Bug 690418
Opened 13 years ago
Closed 13 years ago
ChromeWorker global inaccessible out of DOM scope
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla10
Tracking | Status | |
---|---|---|
firefox7 | --- | unaffected |
firefox8 | + | fixed |
firefox9 | --- | fixed |
firefox10 | --- | fixed |
People
(Reporter: jorgev, Assigned: bent.mozilla)
References
Details
(Keywords: addon-compat, dev-doc-complete, Whiteboard: [inbound])
Attachments
(1 file)
31.20 KB,
patch
|
sicking
:
review+
christian
:
approval-mozilla-aurora+
christian
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
The patch in bug 649537 removed the nsIWorkerFactory interface and replaced it with the ChromeWorker constructor. However, this constructor is only available as a global in the DOM. There's no way to instantiate it from a JSM or a restartless add-on script unless you get a window object. On a (possibly) related note, the XPCOM object (https://developer.mozilla.org/en/DOM/ChromeWorker#Using_the_XPCOM.C2.A0object) is not available to ChromeWorkers in Firefox 8 either. These are major problems for add-on compatibility, so I recommend that this is fixed in Firefox 8.
Reporter | ||
Updated•13 years ago
|
tracking-firefox8:
--- → ?
Comment 1•13 years ago
|
||
(In reply to Jorge Villalobos [:jorgev] from comment #0) > On a (possibly) related note, the XPCOM object > (https://developer.mozilla.org/en/DOM/ChromeWorker#Using_the_XPCOM.C2. > A0object) is not available to ChromeWorkers in Firefox 8 either. for reference, the XPCOM object was added to ChromeWorkers in bug 618484
(In reply to Jorge Villalobos [:jorgev] from comment #0) > The patch in bug 649537 removed the nsIWorkerFactory interface and replaced > it with the ChromeWorker constructor. However, this constructor is only > available as a global in the DOM. There's no way to instantiate it from a > JSM or a restartless add-on script unless you get a window object. We should fix this, for 8, IMO. > On a (possibly) related note, the XPCOM object > (https://developer.mozilla.org/en/DOM/ChromeWorker#Using_the_XPCOM.C2. > A0object) is not available to ChromeWorkers in Firefox 8 either. This is by design. There's no XPConnect on worker threads anymore, so there's no way to get at arbitrary XPCOM objects anymore.
Reporter | ||
Comment 3•13 years ago
|
||
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #2) > > On a (possibly) related note, the XPCOM object > > (https://developer.mozilla.org/en/DOM/ChromeWorker#Using_the_XPCOM.C2. > > A0object) is not available to ChromeWorkers in Firefox 8 either. > > This is by design. There's no XPConnect on worker threads anymore, so > there's no way to get at arbitrary XPCOM objects anymore. Adding dev-doc-needed, since the documentation is out of date in this regard.
Keywords: dev-doc-needed
Comment 4•13 years ago
|
||
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #2) > > On a (possibly) related note, the XPCOM object > > (https://developer.mozilla.org/en/DOM/ChromeWorker#Using_the_XPCOM.C2. > > A0object) is not available to ChromeWorkers in Firefox 8 either. > > This is by design. There's no XPConnect on worker threads anymore, so > there's no way to get at arbitrary XPCOM objects anymore. Is there a reason for this change, and a bug number? This is the kind of change that the add-ons team really needs to know about long before it hits the Aurora branch. That functionality was added to chrome workers to mitigate the breakage of add-ons by the removal of JS threading, after quite a lot of coordination with Jorge and other members of the add-ons team. It's been present for multiple releases already, and people have been relying on it. We really need time to assess and find ways to mitigate the impact of these kinds of changes.
That would be Bug 649537.
Updated•13 years ago
|
Depends on: new-web-workers
Comment 7•13 years ago
|
||
Tracking for 8. We need to either fix this (soon!), or make a conscious decision to ship with this.
status-firefox10:
--- → affected
status-firefox7:
--- → unaffected
status-firefox8:
--- → affected
status-firefox9:
--- → affected
Assignee | ||
Comment 8•13 years ago
|
||
Patch! It's like 5 lines. The tests are beefy.
Attachment #566699 -
Flags: review?(jonas)
Attachment #566699 -
Flags: review?(jonas) → review+
Assignee | ||
Comment 9•13 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/0cf085118da2
Whiteboard: [inbound]
Assignee | ||
Comment 10•13 years ago
|
||
Also needed https://hg.mozilla.org/integration/mozilla-inbound/rev/c6770095945e to fix some other tests that looked for addons with '@tests.mozilla.org' in their id...
Comment 11•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0cf085118da2 https://hg.mozilla.org/mozilla-central/rev/c6770095945e
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Assignee | ||
Comment 13•13 years ago
|
||
Comment on attachment 566699 [details] [diff] [review] Patch, v1 We should definitely put this on the branches too, it corrects a rather bad problem for extensions. The actual code changes are quite small. The tests for this change however can't land on branches unless we want to try to push bug 688300 and bug 688330 as well. Since the worker code is identical on trunk and branches I think tests passing on trunk should be a reasonably good indicator of the patch succeeding on branches too?
Attachment #566699 -
Flags: approval-mozilla-beta?
Attachment #566699 -
Flags: approval-mozilla-aurora?
Comment 14•13 years ago
|
||
Comment on attachment 566699 [details] [diff] [review] Patch, v1 Approved for branches. I don't think we need to port the tests.
Attachment #566699 -
Flags: approval-mozilla-beta?
Attachment #566699 -
Flags: approval-mozilla-beta+
Attachment #566699 -
Flags: approval-mozilla-aurora?
Attachment #566699 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 15•13 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/bd7b78fc45bd https://hg.mozilla.org/releases/mozilla-beta/rev/df9841857c9c
Assignee | ||
Comment 16•13 years ago
|
||
Sheppy, for this change, we need to document that addons must use absolute urls to load their workers, and that those urls have to have a chrome:// or resource:// protocol. file:// is not accepted. Addons that wish to use file:// urls must first register a resource replacement path. I have code for this in the test addon in the patch for this bug, but the relevant bits are: var fileuri = Services.io.newFileURI(file); Services.io.getProtocolHandler("resource"). QueryInterface(Ci.nsIResProtocolHandler). setSubstitution("my-cool-addon", fileuri); var worker = new Worker("resource://my-cool-addon/worker.js"); Make sense?
Comment 17•13 years ago
|
||
The test cases verifying this fix are passing on all OSs: https://tbpl.mozilla.org/php/getParsedLog.php?id=7149042&full=1&branch=services-central https://tbpl.mozilla.org/php/getParsedLog.php?id=7148028&full=1&branch=services-central https://tbpl.mozilla.org/php/getParsedLog.php?id=7150634&full=1&branch=services-central https://tbpl.mozilla.org/php/getParsedLog.php?id=7149633&full=1&branch=services-central
Status: RESOLVED → VERIFIED
Comment 18•9 years ago
|
||
Added a note (including Ben's helpful explanation) to https://developer.mozilla.org/en-US/docs/Web/API/ChromeWorker
Keywords: dev-doc-needed → dev-doc-complete
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•