From 09bb5c922476a62c8bea18323f7c5d181a94e8d1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 12 Jun 2013 08:48:38 +0200 Subject: [PATCH] Bug 718923 - Support document.all in standards mode and remove the pref to turn it off; r=smaug --- browser/devtools/webconsole/test/Makefile.in | 3 - ...ebconsole_bug_595934_message_categories.js | 30 +++----- .../test-bug-595934-dom-html-external.html | 14 ---- .../test/test-bug-595934-dom-html-external.js | 9 --- .../test/test-bug-595934-dom-html.html | 16 ----- content/html/document/src/nsHTMLDocument.cpp | 3 +- dom/base/nsDOMClassInfo.cpp | 70 ------------------- dom/base/nsDOMClassInfo.h | 1 - dom/locales/en-US/chrome/dom/dom.properties | 1 - 9 files changed, 11 insertions(+), 136 deletions(-) delete mode 100644 browser/devtools/webconsole/test/test-bug-595934-dom-html-external.html delete mode 100644 browser/devtools/webconsole/test/test-bug-595934-dom-html-external.js delete mode 100644 browser/devtools/webconsole/test/test-bug-595934-dom-html.html diff --git a/browser/devtools/webconsole/test/Makefile.in b/browser/devtools/webconsole/test/Makefile.in index e3d0f127c28b..6a280c65b756 100644 --- a/browser/devtools/webconsole/test/Makefile.in +++ b/browser/devtools/webconsole/test/Makefile.in @@ -173,15 +173,12 @@ MOCHITEST_BROWSER_FILES += \ test-bug-595934-css-loader.html \ test-bug-595934-css-loader.css \ test-bug-595934-css-loader.css^headers^ \ - test-bug-595934-dom-html.html \ test-bug-595934-imagemap.html \ test-bug-595934-html.html \ test-bug-595934-malformedxml.xhtml \ test-bug-595934-svg.xhtml \ test-bug-595934-workers.html \ test-bug-595934-workers.js \ - test-bug-595934-dom-html-external.html \ - test-bug-595934-dom-html-external.js \ test-bug-595934-canvas.html \ test-bug-595934-canvas.js \ test-bug-595934-css-parser.html \ diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js b/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js index 477f49a3df51..8e00c27edeca 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js @@ -16,16 +16,11 @@ const TESTS = [ matchString: "text/css", }, { // #1 - file: "test-bug-595934-dom-html.html", - category: "DOM:HTML", - matchString: "getElementById", - }, - { // #2 file: "test-bug-595934-imagemap.html", category: "ImageMap", matchString: "shape=\"rect\"", }, - { // #3 + { // #2 file: "test-bug-595934-html.html", category: "HTML", matchString: "multipart/form-data", @@ -34,53 +29,48 @@ const TESTS = [ form.submit(); }, }, - { // #4 + { // #3 file: "test-bug-595934-workers.html", category: "Web Worker", matchString: "fooBarWorker", expectError: true, }, - { // #5 + { // #4 file: "test-bug-595934-malformedxml.xhtml", category: "malformed-xml", matchString: "no element found", }, - { // #6 + { // #5 file: "test-bug-595934-svg.xhtml", category: "SVG", matchString: "fooBarSVG", }, - { // #7 - file: "test-bug-595934-dom-html-external.html", - category: "DOM:HTML", - matchString: "document.all", - }, - { // #8 + { // #6 file: "test-bug-595934-canvas.html", category: "Canvas", matchString: "strokeStyle", }, - { // #9 + { // #7 file: "test-bug-595934-css-parser.html", category: "CSS Parser", matchString: "foobarCssParser", }, - { // #10 + { // #8 file: "test-bug-595934-malformedxml-external.html", category: "malformed-xml", matchString: "", }, - { // #11 + { // #9 file: "test-bug-595934-empty-getelementbyid.html", category: "DOM", matchString: "getElementById", }, - { // #12 + { // #10 file: "test-bug-595934-canvas-css.html", category: "CSS Parser", matchString: "foobarCanvasCssParser", }, - { // #13 + { // #11 file: "test-bug-595934-image.html", category: "Image", matchString: "corrupt", diff --git a/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.html b/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.html deleted file mode 100644 index 56fc2f8186c5..000000000000 --- a/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - Web Console test for bug 595934 - category: DOM:HTML - (external script) - - - - -

Web Console test for bug 595934 - category "DOM:HTML" - (external script).

- - diff --git a/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.js b/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.js deleted file mode 100644 index 88f895538941..000000000000 --- a/browser/devtools/webconsole/test/test-bug-595934-dom-html-external.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -window.addEventListener("load", function() { - document.all.foobar.style.color = "#00f"; -}, false); - diff --git a/browser/devtools/webconsole/test/test-bug-595934-dom-html.html b/browser/devtools/webconsole/test/test-bug-595934-dom-html.html deleted file mode 100644 index 76372fcb7f63..000000000000 --- a/browser/devtools/webconsole/test/test-bug-595934-dom-html.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - Web Console test for bug 595934 - category: DOM:HTML - - - - -

Web Console test for bug 595934 - category "DOM:HTML".

- - diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index 99dd9b78a280..246d7e9dac26 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -2310,8 +2310,7 @@ nsHTMLDocument::NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound, nsISupports* supp = ResolveName(aName, &cache); if (!supp) { aFound = false; - if (GetCompatibilityMode() == eCompatibility_NavQuirks && - aName.EqualsLiteral("all")) { + if (aName.EqualsLiteral("all")) { JS::Rooted obj(cx, GetWrapper()); rv = nsHTMLDocumentSH::TryResolveAll(cx, this, obj); } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 46d2592e6b40..0520158f276c 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -865,7 +865,6 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] = nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr; nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nullptr; bool nsDOMClassInfo::sIsInitialized = false; -bool nsDOMClassInfo::sDisableDocumentAllSupport = false; jsid nsDOMClassInfo::sParent_id = JSID_VOID; @@ -918,66 +917,6 @@ FindObjectClass(JSContext* cx, JSObject* aGlobalObject) sObjectClass = js::GetObjectJSClass(obj); } -static void -PrintWarningOnConsole(JSContext *cx, const char *stringBundleProperty) -{ - nsCOMPtr stringService = - mozilla::services::GetStringBundleService(); - if (!stringService) { - return; - } - - nsCOMPtr bundle; - stringService->CreateBundle(kDOMStringBundleURL, getter_AddRefs(bundle)); - if (!bundle) { - return; - } - - nsXPIDLString msg; - bundle->GetStringFromName(NS_ConvertASCIItoUTF16(stringBundleProperty).get(), - getter_Copies(msg)); - - if (msg.IsEmpty()) { - NS_ERROR("Failed to get strings from dom.properties!"); - return; - } - - nsCOMPtr consoleService - (do_GetService(NS_CONSOLESERVICE_CONTRACTID)); - if (!consoleService) { - return; - } - - nsCOMPtr scriptError = - do_CreateInstance(NS_SCRIPTERROR_CONTRACTID); - if (!scriptError) { - return; - } - - unsigned lineno = 0; - JSScript *script; - nsAutoString sourcefile; - - if (JS_DescribeScriptedCaller(cx, &script, &lineno)) { - if (const char *filename = ::JS_GetScriptFilename(cx, script)) { - CopyUTF8toUTF16(nsDependentCString(filename), sourcefile); - } - } - - nsresult rv = scriptError->InitWithWindowID(msg, - sourcefile, - EmptyString(), - lineno, - 0, // column for error is not available - nsIScriptError::warningFlag, - "DOM:HTML", - nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx)); - - if (NS_SUCCEEDED(rv)) { - consoleService->LogMessage(scriptError); - } -} - static inline JSString * IdToString(JSContext *cx, jsid id) { @@ -2036,9 +1975,6 @@ nsDOMClassInfo::Init() RegisterExternalClasses(); - sDisableDocumentAllSupport = - Preferences::GetBool("browser.dom.document.all.disabled"); - // Register new DOM bindings mozilla::dom::Register(nameSpaceManager); @@ -6099,9 +6035,6 @@ ResolveAll(JSContext* cx, nsIDocument* doc, JS::Handle obj) // If we don't already have a helper and "all" isn't already defined on // our prototype, create a helper. if (!helper && !hasAll) { - // Print a warning so developers can stop using document.all - PrintWarningOnConsole(cx, "DocumentAllUsed"); - if (!::JS_GetPrototype(cx, obj, proto.address())) { return NS_ERROR_UNEXPECTED; } @@ -6128,9 +6061,6 @@ nsresult nsHTMLDocumentSH::TryResolveAll(JSContext* cx, nsHTMLDocument* doc, JS::Handle obj) { - if (nsDOMClassInfo::sDisableDocumentAllSupport) { - return NS_OK; - } JSAutoCompartment ac(cx, obj); return ResolveAll(cx, doc, obj); } diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 0d37e7e7314a..231cd7fc67b6 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -189,7 +189,6 @@ protected: static nsresult DefineStaticJSVals(JSContext *cx); static bool sIsInitialized; - static bool sDisableDocumentAllSupport; public: static jsid sParent_id; diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index d362b657c54c..1f1c0b3eb0f3 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -16,7 +16,6 @@ OnBeforeUnloadTitle=Are you sure? OnBeforeUnloadMessage=This page is asking you to confirm that you want to leave - data you have entered may not be saved. OnBeforeUnloadStayButton=Stay on Page OnBeforeUnloadLeaveButton=Leave Page -DocumentAllUsed=Non-standard document.all property was used. Use W3C standard document.getElementById() instead. UseOfDOM3LoadMethodWarning=Use of Document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest UnexpectedCanvasVariantStyle=canvas: an attempt to set strokeStyle or fillStyle to a value that is neither a string, a CanvasGradient, or a CanvasPattern was ignored. EmptyGetElementByIdParam=Empty string passed to getElementById().