mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050104 - Do not return a new console object every time self.console is called on workers; r=baku
This commit is contained in:
parent
368a5b3a15
commit
85c6c5911a
@ -80,17 +80,16 @@ WorkerGlobalScope::WrapObject(JSContext* aCx)
|
||||
MOZ_CRASH("We should never get here!");
|
||||
}
|
||||
|
||||
already_AddRefed<Console>
|
||||
Console*
|
||||
WorkerGlobalScope::GetConsole()
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (!mConsole) {
|
||||
mConsole = new Console(nullptr);
|
||||
MOZ_ASSERT(mConsole);
|
||||
}
|
||||
|
||||
return mConsole.forget();
|
||||
return mConsole;
|
||||
}
|
||||
|
||||
already_AddRefed<WorkerLocation>
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
return nsRefPtr<WorkerGlobalScope>(this).forget();
|
||||
}
|
||||
|
||||
already_AddRefed<Console>
|
||||
Console*
|
||||
GetConsole();
|
||||
|
||||
already_AddRefed<WorkerLocation>
|
||||
|
@ -5,6 +5,12 @@
|
||||
|
||||
onmessage = function(event) {
|
||||
postMessage({event: 'console exists', status: !!console, last : false});
|
||||
var logCalled = false;
|
||||
console.log = function() {
|
||||
logCalled = true;
|
||||
}
|
||||
console.log("foo");
|
||||
postMessage({event: 'console.log is replaceable', status: logCalled, last: false});
|
||||
console = 42;
|
||||
postMessage({event: 'console is replaceable', status: console === 42, last : true});
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ onmessage = function(event) {
|
||||
// TEST: does console exist?
|
||||
postMessage({event: 'console exists', status: !!console, last : false});
|
||||
|
||||
postMessage({event: 'console is the same object', status: console === console, last: false});
|
||||
|
||||
postMessage({event: 'trace without function', status: true, last : false});
|
||||
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user