mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 896535 - Promise: then(console.log)
is not working as expected. r=msucan
This commit is contained in:
parent
c1cfcbff53
commit
dc4f37b699
@ -260,7 +260,17 @@ ConsoleAPI.prototype = {
|
||||
{
|
||||
let [method, args, meta] = aCall;
|
||||
|
||||
let frame = meta.stack[0];
|
||||
let frame;
|
||||
if (meta.stack.length) {
|
||||
frame = meta.stack[0];
|
||||
} else {
|
||||
frame = {
|
||||
filename: "",
|
||||
lineNumber: 0,
|
||||
functionName: "",
|
||||
};
|
||||
}
|
||||
|
||||
let consoleEvent = {
|
||||
ID: this._outerID,
|
||||
innerID: this._innerID,
|
||||
|
@ -77,6 +77,32 @@ function testLocationData(aMessageObject) {
|
||||
is(aMessageObject.arguments[i], a, "correct arg " + i);
|
||||
});
|
||||
|
||||
startNativeCallbackTest();
|
||||
}
|
||||
|
||||
function startNativeCallbackTest() {
|
||||
// Reset the observer function to cope with the fabricated test data.
|
||||
ConsoleObserver.observe = function CO_observe(aSubject, aTopic, aData) {
|
||||
try {
|
||||
testNativeCallback(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
|
||||
let button = gWindow.document.getElementById("test-nativeCallback");
|
||||
ok(button, "found #test-nativeCallback button");
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gWindow);
|
||||
}
|
||||
|
||||
function testNativeCallback(aMessageObject) {
|
||||
is(aMessageObject.level, "log", "expected level received");
|
||||
is(aMessageObject.filename, "", "filename matches");
|
||||
is(aMessageObject.lineNumber, 0, "lineNumber matches");
|
||||
is(aMessageObject.functionName, "", "functionName matches");
|
||||
|
||||
startGroupTest();
|
||||
}
|
||||
|
||||
@ -86,8 +112,8 @@ function startGroupTest() {
|
||||
try {
|
||||
testConsoleGroup(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
@ -149,8 +175,8 @@ function startLocationTest() {
|
||||
try {
|
||||
testLocationData(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
@ -259,8 +285,8 @@ function startTimeTest() {
|
||||
try {
|
||||
testConsoleTime(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
@ -302,8 +328,8 @@ function startTimeEndTest() {
|
||||
try {
|
||||
testConsoleTimeEnd(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
@ -349,8 +375,8 @@ function startEmptyTimerTest() {
|
||||
try {
|
||||
testEmptyTimer(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
};
|
||||
@ -392,8 +418,8 @@ var ConsoleObserver = {
|
||||
try {
|
||||
testConsoleData(aSubject.wrappedJSObject);
|
||||
} catch (ex) {
|
||||
// XXX Exceptions in this function currently aren't reported, because of
|
||||
// some XPConnect weirdness, so report them manually
|
||||
// XXX Bug 906593 - Exceptions in this function currently aren't
|
||||
// reported, because of some XPConnect weirdness, so report them manually
|
||||
ok(false, "Exception thrown in CO_observe: " + ex);
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,12 @@
|
||||
console.group("b", "group");
|
||||
console.groupEnd("b", "group");
|
||||
}
|
||||
|
||||
function nativeCallback() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.promise.enabled", true]]}, function() {
|
||||
new Promise(r => r.resolve(42)).then(console.log);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -53,6 +59,7 @@
|
||||
<button onclick="test();">Log stuff</button>
|
||||
<button id="test-trace" onclick="foobar585956a('omg');">Test trace</button>
|
||||
<button id="test-location" onclick="foobar646025('omg');">Test location</button>
|
||||
<button id="test-nativeCallback" onclick="nativeCallback();">Test nativeCallback</button>
|
||||
<button id="test-groups" onclick="testGroups();">Test groups</button>
|
||||
<button id="test-time" onclick="startTimer('foo');">Test time</button>
|
||||
<button id="test-timeEnd" onclick="stopTimer('foo');">Test timeEnd</button>
|
||||
|
Loading…
Reference in New Issue
Block a user