Commit a95c2200 authored by abarth@webkit.org's avatar abarth@webkit.org

2009-08-25 Mads Ager <ager@chromium.org>

        Reviewed by Adam Barth.

        [V8] Exception from JavaScript propagates to main script
        https://bugs.webkit.org/show_bug.cgi?id=26433

        Test that both compile time and runtime exceptions thrown in
        javascript URLs are isolated from the main script.

        * fast/dom/javascript-url-exception-isolation-expected.txt: Added.
        * fast/dom/javascript-url-exception-isolation.html: Added.
        * fast/dom/resources/javascript-url-exception-isolation.js: Added.
2009-08-25  Mads Ager  <ager@chromium.org>

        Reviewed by Adam Barth.

        [V8] Exception from JavaScript propagates to main script
        https://bugs.webkit.org/show_bug.cgi?id=26433

        Make sure that exceptions thrown both at compile time and at
        runtime in javascript URLs are isolated from the main script.

        Test: fast/dom/javascript-url-exception-isolation.html

        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::evaluate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47753 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f493aa2a
2009-08-25 Mads Ager <ager@chromium.org>
Reviewed by Adam Barth.
[V8] Exception from JavaScript propagates to main script
https://bugs.webkit.org/show_bug.cgi?id=26433
Test that both compile time and runtime exceptions thrown in
javascript URLs are isolated from the main script.
* fast/dom/javascript-url-exception-isolation-expected.txt: Added.
* fast/dom/javascript-url-exception-isolation.html: Added.
* fast/dom/resources/javascript-url-exception-isolation.js: Added.
2009-08-25 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser.
......
CONSOLE MESSAGE: line 0: 42
CONSOLE MESSAGE: line 1: SyntaxError: Parse error
Exceptions thrown in javascript URLs should not propagate to the main script.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS caughtException is false
PASS caughtException is false
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/javascript-url-exception-isolation.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
description("Exceptions thrown in javascript URLs should not propagate to the main script.")
var subframe = document.createElement("iframe");
document.body.appendChild(subframe);
var caughtException = false;
// Runtime exception.
try {
subframe.src = 'javascript:throw 42';
} catch(e) {
caughtException = true;
}
shouldBeFalse('caughtException');
// Compile-time exception.
try {
subframe.src = 'javascript:<html></html>';
} catch(e) {
caughtException = true;
}
shouldBeFalse('caughtException');
var successfullyParsed = true;
2009-08-25 Mads Ager <ager@chromium.org>
Reviewed by Adam Barth.
[V8] Exception from JavaScript propagates to main script
https://bugs.webkit.org/show_bug.cgi?id=26433
Make sure that exceptions thrown both at compile time and at
runtime in javascript URLs are isolated from the main script.
Test: fast/dom/javascript-url-exception-isolation.html
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::evaluate):
2009-08-25 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser.
......@@ -338,24 +338,25 @@ v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* nod
{
ASSERT(v8::Context::InContext());
// Compile the script.
v8::Local<v8::String> code = v8ExternalString(source.source());
ChromiumBridge::traceEventBegin("v8.compile", node, "");
// NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
// 1, whereas v8 starts at 0.
v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1);
ChromiumBridge::traceEventEnd("v8.compile", node, "");
ChromiumBridge::traceEventBegin("v8.run", node, "");
v8::Local<v8::Value> result;
{
// Isolate exceptions that occur when executing the code. These
// exceptions should not interfere with javascript code we might
// evaluate from C++ when returning from here.
// Isolate exceptions that occur when compiling and executing
// the code. These exceptions should not interfere with
// javascript code we might evaluate from C++ when returning
// from here.
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
// Compile the script.
v8::Local<v8::String> code = v8ExternalString(source.source());
ChromiumBridge::traceEventBegin("v8.compile", node, "");
// NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
// 1, whereas v8 starts at 0.
v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1);
ChromiumBridge::traceEventEnd("v8.compile", node, "");
ChromiumBridge::traceEventBegin("v8.run", node, "");
// Set inlineCode to true for <a href="javascript:doSomething()">
// and false for <script>doSomething</script>. We make a rough guess at
// this based on whether the script source has a URL.
......
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