Commit db5604ca authored by rniwa@webkit.org's avatar rniwa@webkit.org

2010-11-23 Ryosuke Niwa <rniwa@webkit.org>

        Reviewed by Adam Barth.

        XMLDocumentParser::notifyFinished calls ScriptController's executeScript without updating isEvaluated flag
        https://bugs.webkit.org/show_bug.cgi?id=49701

        Fixed the bug by calling ScriptElement's executeScript, which sets isEvaluated flag to true.

        Test: fast/dom/script-clone-rerun-src.xhtml

        * dom/XMLDocumentParser.cpp:
        (WebCore::XMLDocumentParser::notifyFinished):
2010-11-23  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Adam Barth.

        XMLDocumentParser::notifyFinished calls ScriptController's executeScript without updating isEvaluated flag
        https://bugs.webkit.org/show_bug.cgi?id=49701

        Added a test to ensure WebKit doesn't run the script twice when a script element with an external script file
        is cloned in a XML document.

        * fast/dom/resources/script-clone-rerun-src.js: Added.
        * fast/dom/script-clone-rerun-src.xhtml: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72638 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec6bd130
2010-11-23 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Adam Barth.
XMLDocumentParser::notifyFinished calls ScriptController's executeScript without updating isEvaluated flag
https://bugs.webkit.org/show_bug.cgi?id=49701
Added a test to ensure WebKit doesn't run the script twice when a script element with an external script file
is cloned in a XML document.
* fast/dom/resources/script-clone-rerun-src.js: Added.
* fast/dom/script-clone-rerun-src.xhtml: Added.
2010-11-23 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Tony Chang.
This test runs a script that clones and inserts its script element. The script should run exactly once and print PASS:
PASS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<script>
var i = 0;
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var firstLoad = true;
function loaded() {
if (firstLoad) {
firstLoad = false;
return;
}
result = 'PASS';
if (i == 2)
result = 'FAIL: script ran twice';
else if (i > 2)
result = 'FAIL: script ran ' + i + ' times';
document.body.appendChild(document.createTextNode(result));
layoutTestController.notifyDone();
}
</script>
</head>
<body>
<p>This test runs a script that clones and inserts its script element. The script should run exactly once and print PASS:</p>
<div><script src="resources/script-clone-rerun-src.js" onload="loaded()"></script></div>
<script>
var script = document.getElementsByTagName('script')[1];
var div = script.parentNode;
div.removeChild(script);
div.appendChild(script.cloneNode(true));
</script>
</body>
</html>
2010-11-23 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Adam Barth.
XMLDocumentParser::notifyFinished calls ScriptController's executeScript without updating isEvaluated flag
https://bugs.webkit.org/show_bug.cgi?id=49701
Fixed the bug by calling ScriptElement's executeScript, which sets isEvaluated flag to true.
Test: fast/dom/script-clone-rerun-src.xhtml
* dom/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::notifyFinished):
2010-11-23 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r72628.
......@@ -359,7 +359,7 @@ void XMLDocumentParser::notifyFinished(CachedResource* unusedResource)
if (errorOccurred)
scriptElement->dispatchErrorEvent();
else {
m_view->frame()->script()->executeScript(sourceCode);
scriptElement->executeScript(sourceCode);
scriptElement->dispatchLoadEvent();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment