Bug 1547923 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Currently some implementations of nsIGlobalObject::GetGlobalJSObject can return a gray object.  This is problematic in places where this is immediately passed into the JS API.

Previously some instances have been fixed by adding JS::ExposeObjectToActiveJS calls (e.g. in bug 1522817) but it would be better if this wasn't required.

It should be possible to do this automatically.  It may be necessary to add a version of this method that doesn't do this if that is useful somewhere, or maybe we could add boolean method to indicate whether the global exists.

There is also a comment in nsIGlobalObject.h describing further work that should be done if we make this change:

  // GetGlobalJSObject may return a gray object.  If this ever changes so that
  // it stops doing that, please simplify the code in FindAssociatedGlobal in
  // BindingUtils.h that does JS::ExposeObjectToActiveJS on the return value of
  // GetGlobalJSObject.  Also, in that case the JS::ExposeObjectToActiveJS in
  // AutoJSAPI::InitInternal can probably be removed.  And also the similar
  // calls in XrayWrapper and nsGlobalWindow.


Back to Bug 1547923 Comment 0