Bug 1316141 - Support async function in dis shell function. r=till
authorTooru Fujisawa <arai_a@mac.com>
Wed, 09 Nov 2016 08:10:03 +0900
changeset 351802 8df86e93a057fd7495a8dca8c88e02922b64f950
parent 351801 31fe465d39326229db0d29381b6a088b50fb73df
child 351803 2290c629fff0b239047e3835313e12db82be4772
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1316141
milestone52.0a1
Bug 1316141 - Support async function in dis shell function. r=till
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -79,16 +79,17 @@
 #include "perf/jsperf.h"
 #include "shell/jsoptparse.h"
 #include "shell/jsshell.h"
 #include "shell/OSObject.h"
 #include "threading/ConditionVariable.h"
 #include "threading/LockGuard.h"
 #include "threading/Thread.h"
 #include "vm/ArgumentsObject.h"
+#include "vm/AsyncFunction.h"
 #include "vm/Compression.h"
 #include "vm/Debugger.h"
 #include "vm/HelperThreads.h"
 #include "vm/Monitor.h"
 #include "vm/MutexIDs.h"
 #include "vm/Shape.h"
 #include "vm/SharedArrayObject.h"
 #include "vm/StringBuffer.h"
@@ -2293,16 +2294,20 @@ ValueToScript(JSContext* cx, HandleValue
     while (fun->isBoundFunction()) {
         JSObject* target = fun->getBoundFunctionTarget();
         if (target && target->is<JSFunction>())
             fun = &target->as<JSFunction>();
         else
             break;
     }
 
+    // Get unwrapped async function.
+    if (IsWrappedAsyncFunction(fun))
+        fun = GetUnwrappedAsyncFunction(fun);
+
     if (!fun->isInterpreted()) {
         JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr, JSSMSG_SCRIPTS_ONLY);
         return nullptr;
     }
 
     JSScript* script = fun->getOrCreateScript(cx);
     if (!script)
         return nullptr;