From b941c0d87cad12edc9c65a116031971137b467cd Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Fri, 31 Jan 2014 09:12:32 -0800 Subject: [PATCH] Bug 966132 - Console is replaceable in workers, r=bz --- dom/webidl/WorkerGlobalScope.webidl | 3 ++ dom/workers/test/consoleReplaceable_worker.js | 10 +++++ dom/workers/test/mochitest.ini | 2 + dom/workers/test/test_consoleReplaceable.html | 44 +++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 dom/workers/test/consoleReplaceable_worker.js create mode 100644 dom/workers/test/test_consoleReplaceable.html diff --git a/dom/webidl/WorkerGlobalScope.webidl b/dom/webidl/WorkerGlobalScope.webidl index 7873d3096fd..a1d9d0600a4 100644 --- a/dom/webidl/WorkerGlobalScope.webidl +++ b/dom/webidl/WorkerGlobalScope.webidl @@ -14,7 +14,10 @@ interface WorkerGlobalScope : EventTarget { readonly attribute WorkerGlobalScope self; + + [Replaceable] readonly attribute WorkerConsole console; + readonly attribute WorkerLocation location; void close(); diff --git a/dom/workers/test/consoleReplaceable_worker.js b/dom/workers/test/consoleReplaceable_worker.js new file mode 100644 index 00000000000..87ae6af6bec --- /dev/null +++ b/dom/workers/test/consoleReplaceable_worker.js @@ -0,0 +1,10 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +onmessage = function(event) { + postMessage({event: 'console exists', status: !!console, last : false}); + console = 42; + postMessage({event: 'console is replaceable', status: console === 42, last : true}); +} diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index 9116f7a8271..1b98fd09ec3 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -8,6 +8,7 @@ support-files = close_worker.js content_worker.js console_worker.js + consoleReplaceable_worker.js csp_worker.js errorPropagation_iframe.html errorPropagation_worker.js @@ -75,6 +76,7 @@ support-files = [test_close.html] [test_closeOnGC.html] [test_console.html] +[test_consoleReplaceable.html] [test_contentWorker.html] [test_csp.html] [test_csp.html^headers^] diff --git a/dom/workers/test/test_consoleReplaceable.html b/dom/workers/test/test_consoleReplaceable.html new file mode 100644 index 00000000000..3886b679d1a --- /dev/null +++ b/dom/workers/test/test_consoleReplaceable.html @@ -0,0 +1,44 @@ + + + + + + Test for DOM Worker Console + + + + +

+ +
+
+
+ +