author | Ms2ger <ms2ger@gmail.com> |
Thu, 09 Aug 2012 09:19:53 +0200 | |
changeset 101938 | 0f96a7f073a84bda7e695e48c605efcce5dd1dc8 |
parent 101937 | 0e6e404c6baf3a0b080fc42435dde9789801b1f4 |
child 101939 | 753b39a6e95753f20aeb7ffba717e9c127f9dc0f |
push id | 13237 |
push user | emorley@mozilla.com |
push date | Thu, 09 Aug 2012 11:51:38 +0000 |
treeherder | mozilla-inbound@f799dd180292 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jst |
bugs | 780146 |
milestone | 17.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -7047,78 +7047,76 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp } } return NS_OK; } nsIScriptContext *my_context = win->GetContextInternal(); - nsresult rv = NS_OK; - // Resolve standard classes on my_context's JSContext (or on cx, // if we don't have a my_context yet), in case the two contexts // have different origins. We want lazy standard class // initialization to behave as if it were done eagerly, on each // window's own context (not on some other window-caller's // context). - - JSBool did_resolve = JS_FALSE; - JSContext *my_cx; - - JSBool ok = JS_TRUE; - jsval exn = JSVAL_VOID; if (!ObjectIsNativeWrapper(cx, obj)) { - JSAutoEnterCompartment ac; - - if (!my_context) { - my_cx = cx; - } else { - my_cx = my_context->GetNativeContext(); - - if (my_cx != cx) { - if (!ac.enter(my_cx, obj)) { - return NS_ERROR_UNEXPECTED; + JSBool did_resolve = JS_FALSE; + JSBool ok = JS_TRUE; + JS::Value exn = JSVAL_VOID; + + { + JSAutoEnterCompartment ac; + + JSContext* my_cx; + if (!my_context) { + my_cx = cx; + } else { + my_cx = my_context->GetNativeContext(); + + if (my_cx != cx) { + if (!ac.enter(my_cx, obj)) { + return NS_ERROR_UNEXPECTED; + } } } - } - - JSAutoRequest transfer(my_cx); - - // Don't resolve standard classes on XPCNativeWrapper etc, only - // resolve them if we're resolving on the real global object. - ok = JS_ResolveStandardClass(my_cx, obj, id, &did_resolve); + + JSAutoRequest transfer(my_cx); + + // Don't resolve standard classes on XPCNativeWrapper etc, only + // resolve them if we're resolving on the real global object. + ok = JS_ResolveStandardClass(my_cx, obj, id, &did_resolve); + + if (!ok) { + // Trust the JS engine (or the script security manager) to set + // the exception in the JS engine. + + if (!JS_GetPendingException(my_cx, &exn)) { + return NS_ERROR_UNEXPECTED; + } + + // Return NS_OK to avoid stomping over the exception that was passed + // down from the ResolveStandardClass call. + // Note that the order of the JS_ClearPendingException and + // JS_SetPendingException is important in the case that my_cx == cx. + + JS_ClearPendingException(my_cx); + } + } if (!ok) { - // Trust the JS engine (or the script security manager) to set - // the exception in the JS engine. - - if (!JS_GetPendingException(my_cx, &exn)) { - return NS_ERROR_UNEXPECTED; - } - - // Return NS_OK to avoid stomping over the exception that was passed - // down from the ResolveStandardClass call. - // Note that the order of the JS_ClearPendingException and - // JS_SetPendingException is important in the case that my_cx == cx. - - JS_ClearPendingException(my_cx); - } - } - - if (!ok) { - JS_SetPendingException(cx, exn); - *_retval = JS_FALSE; - return NS_OK; - } - - if (did_resolve) { - *objp = obj; - - return NS_OK; + JS_SetPendingException(cx, exn); + *_retval = JS_FALSE; + return NS_OK; + } + + if (did_resolve) { + *objp = obj; + return NS_OK; + } } if (!(flags & JSRESOLVE_ASSIGNING)) { // We want this code to be before the child frame lookup code // below so that a child frame named 'constructor' doesn't // shadow the window's constructor property. if (sConstructor_id == id) { return ResolveConstructor(cx, obj, objp); @@ -7127,16 +7125,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp if (!my_context || !my_context->IsContextInitialized()) { // The context is not yet initialized so there's nothing we can do // here yet. return NS_OK; } + nsresult rv = NS_OK; if (sLocation_id == id) { // This must be done even if we're just getting the value of // window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING // here) since we must define window.location to prevent the // getter from being overriden (for security reasons). // Note: Because we explicitly don't forward to the inner window // above, we have to ensure here that our window has a current