Skip to content

Commit

Permalink
Backed out changeset a80fdfc128b0 (bug 911216) for high crash-rate on…
Browse files Browse the repository at this point in the history
… developers - RyanVM request
  • Loading branch information
BavarianTomcat committed Jul 18, 2016
1 parent 8e8f38a commit a405ea6
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 196 deletions.
1 change: 1 addition & 0 deletions devtools/server/actors/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const { ActorClassWithSpec } = require("devtools/shared/protocol");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { assert, dumpn, update, fetch } = DevToolsUtils;
const promise = require("promise");
const PromiseDebugging = require("PromiseDebugging");
const xpcInspector = require("xpcInspector");
const ScriptStore = require("./utils/ScriptStore");
const { DevToolsWorker } = require("devtools/shared/worker/worker");
Expand Down
7 changes: 7 additions & 0 deletions devtools/shared/worker/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ this.WorkerDebuggerLoader = WorkerDebuggerLoader;
// does not provide alternative definitions for them. Consequently, they are
// stubbed out both on the main thread and worker threads.

var PromiseDebugging = {
getState: function () {
throw new Error("PromiseDebugging is not available in workers!");
}
};

var chrome = {
CC: undefined,
Cc: undefined,
Expand Down Expand Up @@ -490,6 +496,7 @@ this.worker = new WorkerDebuggerLoader({
loadSubScript: loadSubScript,
modules: {
"Debugger": Debugger,
"PromiseDebugging": PromiseDebugging,
"Services": Object.create(null),
"chrome": chrome,
"xpcInspector": xpcInspector
Expand Down
12 changes: 2 additions & 10 deletions docshell/test/browser/browser_timelineMarkers-frame-04.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ if (Services.prefs.getBoolPref("javascript.options.asyncstack")) {
ok(frame.asyncParent !== null, "Parent frame has async parent");
is(frame.asyncParent.asyncCause, "promise callback",
"Async parent has correct cause");
let asyncFrame = frame.asyncParent;
// Skip over self-hosted parts of our Promise implementation.
while (asyncFrame.source === 'self-hosted')
asyncFrame = asyncFrame.parent;
is(asyncFrame.functionDisplayName, "do_promise",
is(frame.asyncParent.functionDisplayName, "do_promise",
"Async parent has correct function name");
}
}, {
Expand All @@ -75,11 +71,7 @@ if (Services.prefs.getBoolPref("javascript.options.asyncstack")) {
ok(frame.asyncParent !== null, "Parent frame has async parent");
is(frame.asyncParent.asyncCause, "promise callback",
"Async parent has correct cause");
let asyncFrame = frame.asyncParent;
// Skip over self-hosted parts of our Promise implementation.
while (asyncFrame.source === 'self-hosted')
asyncFrame = asyncFrame.parent;
is(asyncFrame.functionDisplayName, "do_promise_script",
is(frame.asyncParent.functionDisplayName, "do_promise_script",
"Async parent has correct function name");
}
});
Expand Down
20 changes: 4 additions & 16 deletions docshell/test/browser/browser_timelineMarkers-frame-05.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,12 @@ if (Services.prefs.getBoolPref("javascript.options.asyncstack")) {
check: function(markers) {
markers = markers.filter(m => m.name == "ConsoleTime");
ok(markers.length > 0, "Promise marker includes stack");
ok(markers[0].stack.functionDisplayName == "testConsoleTime",
"testConsoleTime is on the stack");
let frame = markers[0].endStack;
ok(frame.functionDisplayName == "testConsoleTimeEnd",
"testConsoleTimeEnd is on the stack");

frame = frame.parent;
ok(frame.functionDisplayName == "makePromise/<",
"makePromise/< is on the stack");
let asyncFrame = frame.asyncParent;
ok(asyncFrame !== null, "Frame has async parent");
is(asyncFrame.asyncCause, "promise callback",
let frame = markers[0].endStack;
ok(frame.parent.asyncParent !== null, "Parent frame has async parent");
is(frame.parent.asyncParent.asyncCause, "promise callback",
"Async parent has correct cause");
// Skip over self-hosted parts of our Promise implementation.
while (asyncFrame.source === 'self-hosted') {
asyncFrame = asyncFrame.parent;
}
is(asyncFrame.functionDisplayName, "makePromise",
is(frame.parent.asyncParent.functionDisplayName, "makePromise",
"Async parent has correct function name");
}
});
Expand Down
57 changes: 24 additions & 33 deletions dom/bindings/test/test_promise_rejections_from_jsimplemented.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"Should have the right message in test " + testNumber);
is(exn.code, code, "Should have the right .code in test " + testNumber);
if (message === "") {
is(exn.name, "InternalError",
is(exn.name, "NS_ERROR_UNEXPECTED",
"Should have one of our synthetic exceptions in test " + testNumber);
}
is(exn.stack, stack, "Should have the right stack in test " + testNumber);
Expand All @@ -41,88 +41,79 @@
var isE10S = !SpecialPowers.isMainProcess();
var asyncStack = SpecialPowers.getBoolPref("javascript.options.asyncstack");
var ourFile = location.href;
var unwrapError = "Promise rejection value is a non-unwrappable cross-compartment wrapper.";
var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:130:3
var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:121:3
` : "";

Promise.all([
t.testPromiseWithThrowingChromePromiseInit().then(
ensurePromiseFail.bind(null, 1),
checkExn.bind(null, 49, "InternalError", unwrapError,
undefined, ourFile, 1,
`doTest@${ourFile}:49:7
checkExn.bind(null, 48, "NS_ERROR_UNEXPECTED", "", undefined,
ourFile, 1,
`doTest@${ourFile}:48:7
` +
parentFrame)),
t.testPromiseWithThrowingContentPromiseInit(function() {
thereIsNoSuchContentFunction1();
}).then(
ensurePromiseFail.bind(null, 2),
checkExn.bind(null, 57, "ReferenceError",
checkExn.bind(null, 56, "ReferenceError",
"thereIsNoSuchContentFunction1 is not defined",
undefined, ourFile, 2,
`doTest/<@${ourFile}:57:11
doTest@${ourFile}:56:7
`doTest/<@${ourFile}:56:11
doTest@${ourFile}:55:7
` +
parentFrame)),
t.testPromiseWithThrowingChromeThenFunction().then(
ensurePromiseFail.bind(null, 3),
checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 3, asyncStack ? (`Async*doTest@${ourFile}:67:7
` +
parentFrame) : "")),
checkExn.bind(null, 0, "NS_ERROR_UNEXPECTED", "", undefined, "", 3, "")),
t.testPromiseWithThrowingContentThenFunction(function() {
thereIsNoSuchContentFunction2();
}).then(
ensurePromiseFail.bind(null, 4),
checkExn.bind(null, 73, "ReferenceError",
checkExn.bind(null, 70, "ReferenceError",
"thereIsNoSuchContentFunction2 is not defined",
undefined, ourFile, 4,
`doTest/<@${ourFile}:73:11
`doTest/<@${ourFile}:70:11
` +
(asyncStack ? `Async*doTest@${ourFile}:72:7
(asyncStack ? `Async*doTest@${ourFile}:69:7
` : "") +
parentFrame)),
t.testPromiseWithThrowingChromeThenable().then(
ensurePromiseFail.bind(null, 5),
checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 5, asyncStack ? (`Async*doTest@${ourFile}:84:7
` +
parentFrame) : "")),
checkExn.bind(null, 0, "NS_ERROR_UNEXPECTED", "", undefined, "", 5, "")),
t.testPromiseWithThrowingContentThenable({
then: function() { thereIsNoSuchContentFunction3(); }
}).then(
ensurePromiseFail.bind(null, 6),
checkExn.bind(null, 90, "ReferenceError",
checkExn.bind(null, 85, "ReferenceError",
"thereIsNoSuchContentFunction3 is not defined",
undefined, ourFile, 6,
`doTest/<.then@${ourFile}:90:32
` + (asyncStack ? `Async*doTest@${ourFile}:89:7\n` + parentFrame : ""))),
`doTest/<.then@${ourFile}:85:32
`)),
t.testPromiseWithDOMExceptionThrowingPromiseInit().then(
ensurePromiseFail.bind(null, 7),
checkExn.bind(null, 98, "NotFoundError",
checkExn.bind(null, 93, "NotFoundError",
"We are a second DOMException",
DOMException.NOT_FOUND_ERR, ourFile, 7,
`doTest@${ourFile}:98:7
`doTest@${ourFile}:93:7
` +
parentFrame)),
t.testPromiseWithDOMExceptionThrowingThenFunction().then(
ensurePromiseFail.bind(null, 8),
checkExn.bind(null, asyncStack ? 106 : 0, "NetworkError",
checkExn.bind(null, asyncStack ? 101 : 0, "NetworkError",
"We are a third DOMException",
DOMException.NETWORK_ERR, asyncStack ? ourFile : "", 8,
(asyncStack ? `Async*doTest@${ourFile}:106:7
(asyncStack ? `Async*doTest@${ourFile}:101:7
` +
parentFrame : ""))),
t.testPromiseWithDOMExceptionThrowingThenable().then(
ensurePromiseFail.bind(null, 9),
checkExn.bind(null, asyncStack ? 114 : 0, "TypeMismatchError",
checkExn.bind(null, 0, "TypeMismatchError",
"We are a fourth DOMException",
DOMException.TYPE_MISMATCH_ERR,
asyncStack ? ourFile : "", 9,
(asyncStack ? `Async*doTest@${ourFile}:114:7
` +
parentFrame : ""))),
DOMException.TYPE_MISMATCH_ERR, "", 9, "")),
]).then(SimpleTest.finish,
function(err) {
ok(false, "One of our catch statements totally failed with err" + err + ', stack: ' + (err ? err.stack : ''));
function() {
ok(false, "One of our catch statements totally failed");
SimpleTest.finish();
});
}
Expand Down
3 changes: 2 additions & 1 deletion dom/tests/mochitest/general/test_interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
{name: "NaN", xbl: false},
"Number",
"Object",
"Promise",
"Proxy",
"RangeError",
"ReferenceError",
Expand Down Expand Up @@ -962,6 +961,8 @@
"ProcessingInstruction",
// IMPORTANT: Do not change this list without review from a DOM peer!
"ProgressEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Promise",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PushManager", b2g: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ var ecmaGlobals =
"NaN",
"Number",
"Object",
"Promise",
"Proxy",
"RangeError",
"ReferenceError",
Expand Down Expand Up @@ -175,6 +174,8 @@ var interfaceNamesInGlobalScope =
{ name: "PerformanceObserver", nightly: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "PerformanceObserverEntryList", nightly: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
"Promise",
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "PushEvent", b2g: false },
// IMPORTANT: Do not change this list without review from a DOM peer!
Expand Down
3 changes: 2 additions & 1 deletion dom/workers/test/test_worker_interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ var ecmaGlobals =
"NaN",
"Number",
"Object",
"Promise",
"Proxy",
"RangeError",
"ReferenceError",
Expand Down Expand Up @@ -167,6 +166,8 @@ var interfaceNamesInGlobalScope =
{ name: "PerformanceObserver", nightly: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "PerformanceObserverEntryList", nightly: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
"Promise",
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "PushManager", b2g: false },
// IMPORTANT: Do not change this list without review from a DOM peer!
Expand Down
3 changes: 1 addition & 2 deletions js/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ set_config('JS_DISABLE_SHELL', js_disable_shell)

# Use SpiderMonkey Promise implementation if it's enabled
# =======================================================
js_option('--enable-sm-promise', default=True,
help='Enable SpiderMonkey promises')
js_option('--enable-sm-promise', help='Enable SpiderMonkey promises')

@depends('--enable-sm-promise')
def sm_promise(value):
Expand Down
16 changes: 7 additions & 9 deletions js/src/jit-test/lib/debuggerNXHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ function testDebuggerHooksNX(dbg, g, testHook) {
testDebuggerHook("onNewGlobalObject",
() => { newGlobal(); });

if ('Promise' in g) {
testDebuggerHook("onNewPromise",
() => { new g.Promise(()=>{}); });
testDebuggerHook("onNewPromise",
() => { g.makeFakePromise(); });

testDebuggerHook("onPromiseSettled",
() => {
var p = new g.Promise(()=>{});
g.settlePromiseNow(p);
});
}
testDebuggerHook("onPromiseSettled",
() => {
var p = g.makeFakePromise();
g.settleFakePromise(p);
});

// Hooks on frames.
var onStepHit = false;
Expand Down
6 changes: 2 additions & 4 deletions js/src/jit-test/tests/debug/Debugger-onNewPromise-01.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Test that the onNewPromise hook gets called when promises are allocated in
// the scope of debuggee globals.
if (!('Promise' in this))
quit(0);

var g = newGlobal();
var dbg = new Debugger();
Expand All @@ -11,9 +9,9 @@ var gw = dbg.addDebuggee(g);
let promisesFound = [];
dbg.onNewPromise = p => { promisesFound.push(p); };

let p1 = new g.Promise(function (){});
let p1 = g.makeFakePromise()
dbg.enabled = false;
let p2 = new g.Promise(function (){});
let p2 = g.makeFakePromise();

assertEq(promisesFound.indexOf(gw.makeDebuggeeValue(p1)) != -1, true);
assertEq(promisesFound.indexOf(gw.makeDebuggeeValue(p2)) == -1, true);
8 changes: 3 additions & 5 deletions js/src/jit-test/tests/debug/Debugger-onNewPromise-02.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
// onNewPromise handlers fire, until they are removed.
if (!('Promise' in this))
quit(0);

var g = newGlobal();
var dbg = new Debugger(g);
var log;

log = '';
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log, '');

dbg.onNewPromise = function (promise) {
Expand All @@ -17,10 +15,10 @@ dbg.onNewPromise = function (promise) {
};

log = '';
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log, 'n');

log = '';
dbg.onNewPromise = undefined;
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log, '');
10 changes: 4 additions & 6 deletions js/src/jit-test/tests/debug/Debugger-onNewPromise-03.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// onNewPromise handlers on different Debugger instances are independent.
if (!('Promise' in this))
quit(0);

var g = newGlobal();
var dbg1 = new Debugger(g);
Expand All @@ -20,24 +18,24 @@ function h2(promise) {
}

log1 = log2 = '';
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log1, '');
assertEq(log2, '');

log1 = log2 = '';
dbg1.onNewPromise = h1;
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log1, 'n');
assertEq(log2, '');

log1 = log2 = '';
dbg2.onNewPromise = h2;
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log1, 'n');
assertEq(log2, 'n');

log1 = log2 = '';
dbg1.onNewPromise = undefined;
new g.Promise(function (){});
g.makeFakePromise();
assertEq(log1, '');
assertEq(log2, 'n');
6 changes: 2 additions & 4 deletions js/src/jit-test/tests/debug/Debugger-onNewPromise-04.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// An onNewPromise handler can disable itself.
if (!('Promise' in this))
quit(0);

var g = newGlobal();
var dbg = new Debugger(g);
Expand All @@ -12,6 +10,6 @@ dbg.onNewPromise = function (promise) {
};

log = '';
new g.Promise(function (){});
new g.Promise(function (){});
g.makeFakePromise();
g.makeFakePromise();
assertEq(log, 'n');
Loading

0 comments on commit a405ea6

Please sign in to comment.