Commit da837d15 authored by cwzwarich@webkit.org's avatar cwzwarich@webkit.org
Browse files

2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>

        Reviewed by Oliver Hunt.

        Bug 24350: REGRESSION: Safari 4 breaks SPAW wysiwyg editor multiple instances
        <https://bugs.webkit.org/show_bug.cgi?id=24350>
        <rdar://problem/6674182>

        The SPAW editor's JavaScript assumes that toString() on a function
        constructed with the Function constructor produces a function with
        a newline after the opening brace.

        JavaScriptCore:

        * runtime/FunctionConstructor.cpp:
        (JSC::constructFunction): Add a newline after the opening brace of the
        function's source code.

        LayoutTests:

        * fast/js/function-constructor-newline-after-brace-expected.txt: Added.
        * fast/js/function-constructor-newline-after-brace.html: Added.
        * fast/js/resources/function-constructor-newline-after-brace.js: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2b4ddbe7
2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Bug 24350: REGRESSION: Safari 4 breaks SPAW wysiwyg editor multiple instances
<https://bugs.webkit.org/show_bug.cgi?id=24350>
<rdar://problem/6674182>
The SPAW editor's JavaScript assumes that toString() on a function
constructed with the Function constructor produces a function with
a newline after the opening brace.
* runtime/FunctionConstructor.cpp:
(JSC::constructFunction): Add a newline after the opening brace of the
function's source code.
2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>
 
Reviewed by Geoff Garen.
......@@ -97,12 +97,12 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
if (args.isEmpty())
program = "(function(){})";
else if (args.size() == 1)
program = "(function(){" + args.at(exec, 0).toString(exec) + "\n})";
program = "(function(){\n" + args.at(exec, 0).toString(exec) + "\n})";
else {
program = "(function(" + args.at(exec, 0).toString(exec);
for (size_t i = 1; i < args.size() - 1; i++)
program += "," + args.at(exec, i).toString(exec);
program += "){" + args.at(exec, args.size() - 1).toString(exec) + "\n})";
program += "){\n" + args.at(exec, args.size() - 1).toString(exec) + "\n})";
}
int errLine;
......
2009-03-19 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver Hunt.
Add tests for bug 24350: REGRESSION: Safari 4 breaks SPAW wysiwyg editor multiple instances
<https://bugs.webkit.org/show_bug.cgi?id=24350>
<rdar://problem/6674182>
* fast/js/function-constructor-newline-after-brace-expected.txt: Added.
* fast/js/function-constructor-newline-after-brace.html: Added.
* fast/js/resources/function-constructor-newline-after-brace.js: Added.
2009-03-19 Mark Rowe <mrowe@apple.com>
 
Reviewed by Stephanie Lewis.
......
This test checks that the Function constructor places a newline after the opening brace, for compatibility reasons. It passes if there are no syntax error exceptions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="resources/js-test-style.css">
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/function-constructor-newline-after-brace.js"></script>
<script src="resources/js-test-post.js"></script>
</body>
</html>
description(
"This test checks that the Function constructor places a newline after the opening brace, for compatibility reasons. It passes if there are no syntax error exceptions."
);
function addToFunction(oldFunction, name)
{
var tempString = "";
if (oldFunction != null) {
tempString = oldFunction.toString();
var index = tempString.indexOf("{") + 2;
tempString = tempString.substr(index, tempString.length - index - 2);
}
return new Function(name + '_obj.initialize();' + tempString);
}
var f1 = addToFunction(null, "f1");
addToFunction(f1, "f2");
function addToFunctionWithArgument(oldFunction, name)
{
var tempString = "";
if (oldFunction != null) {
tempString = oldFunction.toString();
var index = tempString.indexOf("{") + 2;
tempString = tempString.substr(index, tempString.length - index - 2);
}
return new Function("arg", name + '_obj.initialize();' + tempString);
}
var g1 = addToFunctionWithArgument(null, "g1");
addToFunctionWithArgument(g1, "g2");
var successfullyParsed = true;
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