Bug 944847, don't try to compile event handlers for data documents, r=bz

--HG--
extra : rebase_source : 2b4ce65fad2433475f4b50ccd89b4301cee6c8b2
This commit is contained in:
Olli Pettay 2013-12-13 16:36:29 +02:00
Родитель 501e006ac9
Коммит 5477bd6943
3 изменённых файлов: 46 добавлений и 1 удалений

Просмотреть файл

@ -1347,7 +1347,9 @@ nsEventListenerManager::GetScriptGlobalAndDocument(nsIDocument** aDoc)
// XXX sXBL/XBL2 issue -- do we really want the owner here? What
// if that's the XBL document?
doc = node->OwnerDoc();
MOZ_ASSERT(!doc->IsLoadedAsData(), "Should not get in here at all");
if (doc->IsLoadedAsData()) {
return nullptr;
}
// We want to allow compiling an event handler even in an unloaded
// document, so use GetScopeObject here, not GetScriptHandlingObject.

Просмотреть файл

@ -84,6 +84,7 @@ skip-if = true # Disabled due to timeouts.
[test_bug855741.html]
[test_bug864040.html]
[test_bug930374-content.html]
[test_bug944847.html]
skip-if = toolkit == "gonk"
[test_clickevent_on_input.html]
[test_continuous_wheel_events.html]

Просмотреть файл

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=944847
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 944847</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 944847 **/
var e1 = document.createElement("div");
is(e1.onclick, null);
e1.setAttribute("onclick", "");
isnot(e1.onclick, null);
var e2 = document.implementation.createHTMLDocument(null, null).createElement("div");
is(e2.onclick, null);
e2.setAttribute("onclick", "");
is(e2.onclick, null);
var e3 = document.createElement("div");
is(e3.onclick, null);
e3.setAttribute("onclick", "");
e2.ownerDocument.adoptNode(e3);
is(e3.onclick, null);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=944847">Mozilla Bug 944847</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>