Bug 1453868. Remove redunant setting of globalObj in binding to-promise conversions. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 13 Apr 2018 19:31:45 -0400
changeset 466882 2117cf060794889f8f0d601c3c5988cff2072b6b
parent 466881 b05199040819b5c49ce1e818e1f7af8a67260ff8
child 466883 a3df33c5d5265805343d5a9a1359a79771112392
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1453868
milestone61.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
Bug 1453868. Remove redunant setting of globalObj in binding to-promise conversions. r=qdot MozReview-Commit-ID: BuykeYqTEoF
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -5374,24 +5374,27 @@ def getJSToNativeConversionInfo(type, de
             getPromiseGlobal = dedent(
                 """
                 // We basically want our entry global here.  Play it safe
                 // and use GetEntryGlobal() to get it, with whatever
                 // principal-clamping it ends up doing.
                 globalObj = GetEntryGlobal()->GetGlobalJSObject();
                 """)
         else:
-            getPromiseGlobal = ""
+            getPromiseGlobal = dedent(
+                """
+                globalObj = JS::CurrentGlobalOrNull(cx);
+                """)
 
         templateBody = fill(
             """
             { // Scope for our GlobalObject, FastErrorResult, JSAutoCompartment,
               // etc.
 
-              JS::Rooted<JSObject*> globalObj(cx, JS::CurrentGlobalOrNull(cx));
+              JS::Rooted<JSObject*> globalObj(cx);
               $*{getPromiseGlobal}
               JSAutoCompartment ac(cx, globalObj);
               GlobalObject promiseGlobal(cx, globalObj);
               if (promiseGlobal.Failed()) {
                 $*{exceptionCode}
               }
 
               JS::Rooted<JS::Value> valueToResolve(cx, $${val});