JavaScriptCore:
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 10:43:08 +0000 (10:43 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2008 10:43:08 +0000 (10:43 +0000)
2008-05-23  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Oliver.

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

        * VM/CodeGenerator.cpp:
        (KJS::CodeGenerator::CodeGenerator): Delete any existing
        properties before creating the function (this should really be
        done at execution time not codegen time).

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@34073 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 8cde0ab17321048bd688f98df5fe8247d4fb2416..13c163bc49aa981cb82b219da21383b00c9b117c 100644 (file)
@@ -1,3 +1,14 @@
+2008-05-23  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver.
+        
+        - fixed <rdar://problem/5957662> REGRESSION(r33943-r33980): Can't send email , attach file or save as draft from hotmail.com
+
+        * VM/CodeGenerator.cpp:
+        (KJS::CodeGenerator::CodeGenerator): Delete any existing
+        properties before creating the function (this should really be
+        done at execution time not codegen time).
+
 2008-05-16  Alp Toker  <alp@nuanti.com>
 
         Build fix for gcc 3. Default constructor required in ExecState,
index 8bf299c795dd6054d4b4f1b11537944197d339d5..d622b2dc116646880b20f60a75a486404ab303a1 100644 (file)
@@ -206,6 +206,10 @@ CodeGenerator::CodeGenerator(ProgramNode* programNode, const Debugger* debugger,
     if (canCreateVariables) {
         for (size_t i = 0; i < functionStack.size(); ++i) {
             FuncDeclNode* funcDecl = functionStack[i];
+            if (globalObject->hasProperty(exec, funcDecl->m_ident) || symbolTable->contains(funcDecl->m_ident.ustring().rep())) {
+                globalObject->putWithAttributes(exec, funcDecl->m_ident, jsUndefined(), 0);
+                globalObject->deleteProperty(exec, funcDecl->m_ident);
+            }
             emitNewFunction(addVar(funcDecl->m_ident, false), funcDecl);
         }
         
index 3d384e2b96b2fed9bed2b06667619abe01f014f1..f78ddcb6065057565a31e0a7a4ee9a05ca69d7db 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  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Oliver Hunt.
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>