Closed Bug 1065452 Opened 11 years ago Closed 11 years ago

Redirect errors that reach addon scope globals to their appropriate DOM window (if any)

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(2 files, 2 obsolete files)

This is causing orange when we try to flip the switch in bug 1030420. Thanks to the recent refactoring work I've done, this fix should be pretty straightforward, if a bit hacky. The hackiness will go away in bug 981187.
Comment on attachment 8487274 [details] [diff] [review] Re-route exceptions directed at addon globals to their associated DOMWindow. v1 >+ // Note that they way we do this right now is sloppy. Error reporters can s/they/the/ >+ if (!JS_GetPrototype(cx, global, &proto)) { Could we have this "get window from addon global" code somewhere nearer the code that sets up the relationship? r=me modulo that.
Attachment #8487274 - Flags: review?(bzbarsky) → review+
Attachment #8488022 - Attachment description: Add an API to access the associated window of addon scopes. v1 → Part 1 - Add an API to access the associated window of addon scopes. v1
Comment on attachment 8488022 [details] [diff] [review] Part 1 - Add an API to access the associated window of addon scopes. v1 Valgrind found something wrong with this. Investigating.
Attachment #8488022 - Flags: review?(wmccloskey)
Attachment #8488022 - Attachment is obsolete: true
Attachment #8489122 - Flags: review?(wmccloskey)
Comment on attachment 8489122 [details] [diff] [review] Part 1 - Add an API to access the associated window of addon scopes. v3 Review of attachment 8489122 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCJSRuntime.cpp @@ +588,5 @@ > + // we pretty much just want to crash if that happens so that we find out > + // about it and get them to change their code. > + MOZ_RELEASE_ASSERT(js::IsCrossCompartmentWrapper(proto)); > + JSObject *mainGlobal = js::UncheckedUnwrap(proto, /* stopAtOuter = */ false); > + MOZ_RELEASE_ASSERT(JS_IsGlobalObject(mainGlobal)); I guess it's too much trouble to iterate over mAddonScopes. That seems fine to me. Perhaps eventually we could change mAddonScopes to a lazily created hashtable rather than a list.
Attachment #8489122 - Flags: review?(wmccloskey) → review+
Depends on: 1068163
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: