JavaScriptCore:
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 20:49:39 +0000 (20:49 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 20:49:39 +0000 (20:49 +0000)
2008-05-23  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Oliver Hunt.

        - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com

        SunSpider reports no change.

        This is a reworking of r34073, which I rolled out because it caused
        lots of crashes.

        * VM/CodeGenerator.cpp:
        (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
        properties whose names collide with new functions. (Don't use putWithAttributes
        because that tries to write to the register file, which hasn't grown to
        fit this program yet.)

LayoutTests:

2008-05-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver.

        - test case <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com

        * fast/js/function-redefinition-expected.txt: Added.
        * fast/js/function-redefinition.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34089 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/VM/CodeGenerator.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/function-redefinition-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/function-redefinition.html [new file with mode: 0644]

index 3366ee5f26d2eb0efb0e9f0b3b19b113d5beb7c3..aadff7b8f69a3b7991166b6c1a4efb33e286a349 100644 (file)
@@ -1,3 +1,20 @@
+2008-05-23  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
+        
+        SunSpider reports no change.
+        
+        This is a reworking of r34073, which I rolled out because it caused
+        lots of crashes.
+
+        * VM/CodeGenerator.cpp:
+        (KJS::CodeGenerator::CodeGenerator): Use removeDirect to nix old
+        properties whose names collide with new functions. (Don't use putWithAttributes
+        because that tries to write to the register file, which hasn't grown to
+        fit this program yet.)
+
 2008-05-23  Darin Adler  <darin@apple.com>
 
         Reviewed by Mark Rowe.
index 8bf299c795dd6054d4b4f1b11537944197d339d5..258e3bcb1c2a8386c1fc7622847e02874acb97f6 100644 (file)
@@ -206,6 +206,7 @@ CodeGenerator::CodeGenerator(ProgramNode* programNode, const Debugger* debugger,
     if (canCreateVariables) {
         for (size_t i = 0; i < functionStack.size(); ++i) {
             FuncDeclNode* funcDecl = functionStack[i];
+            globalObject->removeDirect(funcDecl->m_ident); // Make sure our new function is not shadowed by an old property.
             emitNewFunction(addVar(funcDecl->m_ident, false), funcDecl);
         }
         
index b40ee08cd5874f0e7e89903c3d4a10e372525ff5..b89e1da5ee821e63c4ad3cd0ba8886f2c4a0cc49 100644 (file)
@@ -1,3 +1,12 @@
+2008-05-23  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver.
+        
+        - test case <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
+
+        * fast/js/function-redefinition-expected.txt: Added.
+        * fast/js/function-redefinition.html: Added.
+
 2008-05-23  Geoffrey Garen  <ggaren@apple.com>
 
         Rolled out r34073 because it caused lots of layout test crashes.
diff --git a/LayoutTests/fast/js/function-redefinition-expected.txt b/LayoutTests/fast/js/function-redefinition-expected.txt
new file mode 100644 (file)
index 0000000..359a1fe
--- /dev/null
@@ -0,0 +1,8 @@
+PASS typeof test1 == 'function' is true
+PASS typeof test2 == 'function' is true
+PASS typeof test3 == 'function' is true
+PASS test3() is "SUCCESS"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/function-redefinition.html b/LayoutTests/fast/js/function-redefinition.html
new file mode 100644 (file)
index 0000000..9d610bc
--- /dev/null
@@ -0,0 +1,38 @@
+<!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>
+test1 = "FAIL";
+var test2 = "FAIL"
+function test3() {
+     return "FAIL";
+}
+</script> 
+<script>
+function test1() { 
+    return "SUCCESS";
+}
+
+function test2() { 
+    return "SUCCESS";
+}
+
+function test3() { 
+    return "SUCCESS";
+}
+
+shouldBeTrue("typeof test1 == 'function'");
+shouldBeTrue("typeof test2 == 'function'");
+shouldBeTrue("typeof test3 == 'function'");
+shouldBe("test3()", '"SUCCESS"');
+var successfullyParsed = true; 
+</script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>