Index: src/js/promise.js |
diff --git a/src/js/promise.js b/src/js/promise.js |
index 42b772bab1580883b53e8ff6d6ddac255af37da2..f2fcc477996afc47d1954b71504ecd7b48f73943 100644 |
--- a/src/js/promise.js |
+++ b/src/js/promise.js |
@@ -83,14 +83,14 @@ var GlobalPromise = function Promise(resolver) { |
var promise = PromiseInit(%_NewObject(GlobalPromise, new.target)); |
var callbacks = CreateResolvingFunctions(promise); |
- |
+ var debug_is_active = DEBUG_IS_ACTIVE; |
try { |
- %DebugPushPromise(promise, Promise); |
+ if (debug_is_active) %DebugPushPromise(promise, Promise); |
resolver(callbacks.resolve, callbacks.reject); |
} catch (e) { |
%_Call(callbacks.reject, UNDEFINED, e); |
} finally { |
- %DebugPopPromise(); |
+ if (debug_is_active) %DebugPopPromise(); |
} |
return promise; |
@@ -127,14 +127,15 @@ function PromiseDone(promise, status, value, promiseQueue) { |
} |
function PromiseHandle(value, handler, deferred) { |
+ var debug_is_active = DEBUG_IS_ACTIVE; |
try { |
- %DebugPushPromise(deferred.promise, PromiseHandle); |
+ if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle); |
var result = handler(value); |
deferred.resolve(result); |
} catch (exception) { |
try { deferred.reject(exception); } catch (e) { } |
} finally { |
- %DebugPopPromise(); |
+ if (debug_is_active) %DebugPopPromise(); |
} |
} |