зеркало из https://github.com/mozilla/gecko-dev.git
Bug 718923 - Support document.all in standards mode and remove the pref to turn it off; r=smaug
This commit is contained in:
Родитель
d2252d6788
Коммит
09bb5c9224
|
@ -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 \
|
||||
|
|
|
@ -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: "</html>",
|
||||
},
|
||||
{ // #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",
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Console test for bug 595934 - category: DOM:HTML
|
||||
(external script)</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<script type="text/javascript" src="test-bug-595934-dom-html-external.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="foobar">Web Console test for bug 595934 - category "DOM:HTML"
|
||||
(external script).</p>
|
||||
</body>
|
||||
</html>
|
|
@ -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);
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Console test for bug 595934 - category: DOM:HTML</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<script type="text/javascript"><!--
|
||||
window.addEventListener("load", function() {
|
||||
document.all.foobar.style.color = "#00f";
|
||||
}, false);
|
||||
// --></script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="foobar">Web Console test for bug 595934 - category "DOM:HTML".</p>
|
||||
</body>
|
||||
</html>
|
|
@ -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<JSObject*> obj(cx, GetWrapper());
|
||||
rv = nsHTMLDocumentSH::TryResolveAll(cx, this, obj);
|
||||
}
|
||||
|
|
|
@ -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<nsIStringBundleService> stringService =
|
||||
mozilla::services::GetStringBundleService();
|
||||
if (!stringService) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStringBundle> 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<nsIConsoleService> consoleService
|
||||
(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
if (!consoleService) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptError> 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<JSObject*> 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<JSObject*> obj)
|
||||
{
|
||||
if (nsDOMClassInfo::sDisableDocumentAllSupport) {
|
||||
return NS_OK;
|
||||
}
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
return ResolveAll(cx, doc, obj);
|
||||
}
|
||||
|
|
|
@ -189,7 +189,6 @@ protected:
|
|||
static nsresult DefineStaticJSVals(JSContext *cx);
|
||||
|
||||
static bool sIsInitialized;
|
||||
static bool sDisableDocumentAllSupport;
|
||||
|
||||
public:
|
||||
static jsid sParent_id;
|
||||
|
|
|
@ -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().
|
||||
|
|
Загрузка…
Ссылка в новой задаче