diff options
author | Pale Moon <git-repo@palemoon.org> | 2017-11-04 11:03:37 +0100 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2017-11-04 11:03:37 +0100 |
commit | b69d08979bdd1d92baa49f7682694081a8dba7dc (patch) | |
tree | 5e567c20408e3f781f2ff4b270a0a89cc8b72e60 /dom | |
parent | 39bf9f15c9d7597dd5ff83edaade2b6a67500d25 (diff) | |
download | palemoon-gre-b69d08979bdd1d92baa49f7682694081a8dba7dc.tar.gz |
Add no-op methods to Console API.
This adds no-op methods for specific function calls that are supported by various other browsers.
This also removes the (broken) __noSuchMethod__ catch-all from the Console API.
Websites that erroneously try to use development Console API calls on production websites without using proper safeguards for implementation of the optional and non-web API will now no longer throw in their JS.
Dummy calls added: clear(), dirxml(), markTimeline(), timeline(), timelineEnd(), timeStamp()
This resolves #1445.
Diffstat (limited to 'dom')
-rw-r--r-- | dom/base/Console.cpp | 2 | ||||
-rw-r--r-- | dom/base/Console.h | 2 | ||||
-rw-r--r-- | dom/tests/mochitest/general/test_consoleAPI.html | 7 | ||||
-rw-r--r-- | dom/webidl/Console.webidl | 14 | ||||
-rw-r--r-- | dom/workers/test/console_worker.js | 7 |
5 files changed, 23 insertions, 9 deletions
diff --git a/dom/base/Console.cpp b/dom/base/Console.cpp index 88b16b999..20d7b8300 100644 --- a/dom/base/Console.cpp +++ b/dom/base/Console.cpp @@ -858,7 +858,7 @@ Console::Assert(JSContext* aCx, bool aCondition, METHOD(Count, "count") void -Console::__noSuchMethod__() +Console::NoopMethod() { // Nothing to do. } diff --git a/dom/base/Console.h b/dom/base/Console.h index 8b284e109..32d370805 100644 --- a/dom/base/Console.h +++ b/dom/base/Console.h @@ -101,7 +101,7 @@ public: Count(JSContext* aCx, const Sequence<JS::Value>& aData); void - __noSuchMethod__(); + NoopMethod(); private: enum MethodName diff --git a/dom/tests/mochitest/general/test_consoleAPI.html b/dom/tests/mochitest/general/test_consoleAPI.html index 85038a3a9..8d710a51a 100644 --- a/dom/tests/mochitest/general/test_consoleAPI.html +++ b/dom/tests/mochitest/general/test_consoleAPI.html @@ -38,7 +38,12 @@ function doTest() { "assert": "function", "count": "function", "table": "function", - "__noSuchMethod__": "function" + "clear": "function", + "dirxml": "function", + "markTimeline": "function", + "timeline": "function", + "timelineEnd": "function", + "timeStamp": "function", }; var foundProps = 0; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl index e38013076..02342e34d 100644 --- a/dom/webidl/Console.webidl +++ b/dom/webidl/Console.webidl @@ -28,7 +28,19 @@ interface Console { void assert(boolean condition, any... data); void count(any... data); - void ___noSuchMethod__(); + // No-op methods for compatibility with other browsers. + [BinaryName="noopMethod"] + void clear(); + [BinaryName="noopMethod"] + void dirxml(); + [BinaryName="noopMethod"] + void markTimeline(); + [BinaryName="noopMethod"] + void timeline(); + [BinaryName="noopMethod"] + void timelineEnd(); + [BinaryName="noopMethod"] + void timeStamp(); }; // This is used to propagate console events to the observers. diff --git a/dom/workers/test/console_worker.js b/dom/workers/test/console_worker.js index 4e0d68def..7f4b6a5cd 100644 --- a/dom/workers/test/console_worker.js +++ b/dom/workers/test/console_worker.js @@ -12,10 +12,6 @@ onmessage = function(event) { postMessage({event: 'trace without function', status: true, last : false}); for (var i = 0; i < 10; ++i) { - console.what('1', 123, 321); - } - - for (var i = 0; i < 10; ++i) { console.log(i, i, i); } @@ -81,7 +77,6 @@ function nextSteps(event) { namelessTimer(); var str = "Test Message." - console.foobar(str); // if this throws, we don't execute following funcs console.log(str); console.info(str); console.warn(str); @@ -91,6 +86,8 @@ function nextSteps(event) { console.assert(false, str); console.profile(str); console.profileEnd(str); + console.timeStamp(); + console.clear(); postMessage({event: '4 messages', status: true, last : false}); // Recursive: |