Closed Bug 570858 Opened 14 years ago Closed 14 years ago

ChromeWorker doesn't exist from browser.xul/overlay js

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: Mardak, Assigned: bent.mozilla)

References

Details

Attachments

(2 files)

We're trying to get a ChromeWorker object to access ctypes, but the object doesn't exist from the overlay or script loaded from the overlay.

If I create a dummy xul chrome page, both Worker and ChromeWorker are there.

Are these supposed to be accessible from the overlay and/or Error Console? We were going to use nsIWindowMediator to grab a browser window to extract the ChromeWorker object because it's not available from a Cu.import script.
ChromeWorker should definitely be available in all XUL contexts (right now it is only available if you load a XUL page in a browser window, like Mardak says). It would also be cool to have it available in JS modules.
How are you loading the script in question? At first it sounds like this is just a <script> element inside an overlay file, but then you are saying that you are using Components.utils.import.
ChromeWorker isn't available in the context of a <script> in an overlay file. Which means getting a hold of it from JS modules by doing something like Services.wm.getMostRecentWindow(null).ChromeWorker, it doesn't work either.
Please lets focus on one issue at a time. If ChromeWorker isn't available in a XUL overlay that just contains a markup like:

<script>
worker = new ChromeWorker();
if (!worker) {
  alert("It didn't work");
}
</script>

then that seems like a good place to start.

jst, mrbkap, does scripts in overlays execute in a different context than the main xul document? It surprises me if that is the case.
I'm not sure it's main XUL document vs overlay. It seems to be more like window XUL vs XUL loaded within the browser.
Please explain what (In reply to comment #5)
> I'm not sure it's main XUL document vs overlay. It seems to be more like window
> XUL vs XUL loaded within the browser.

Please explain what you mean with "window XUL" vs "XUL loaded within the browser".
Basically our observation is that ChromeWorker is available in XUL documents that are loaded in a browser content window (e.g. about:config) whereas it's not in a Firefox overlay (which I consider "window XUL").
Can someone create a test extension or something that shows this problem?
Attached file Test extension
Here's a test extension. When you start Firefox, it should dump() "ChromeWorker is [object ChromeWorker]" to stdout, but what actually happens is you get an exception in the error console:

  Error: ChromeWorker is not defined
  Source File: chrome://testchromeworker/content/ff-overlay.js
  Line: 1

Now, if you type chrome://testchromeworker/content/ff-overlay.xul into the browser location bar, the dump() message appears just fine.
Ben, can you have a look at this?
Assignee: nobody → bent.mozilla
If this is still an issue, it should block, as this is the last big bit of CPU on the main thread for Sync.
blocking2.0: --- → ?
Ben, can you dig into this a bit?
blocking2.0: ? → betaN+
My impression was that we know what's going on here. Apparently we run overlays in some special type of context. Mrbkap might know more.
Attached patch PatchSplinter Review
This was backwards!
Attachment #462187 - Flags: review?(mrbkap)
Attachment #462187 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/mozilla-central/rev/b9c3b2e1494a
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: