[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

weinig at apple.com weinig at apple.com
Thu Apr 8 02:13:09 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e851f82db7a146a377d4754a23336ff26e47188f
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 8 01:26:57 2010 +0000

    Remove inconsistent "Too few arguments" handling for window.atob() and window.btoa()
    https://bugs.webkit.org/show_bug.cgi?id=35848
    
    Reviewed by Dan Bernstein.
    
    WebCore:
    
    - Take the opportunity to fully autogenerate window.atob() and window.btoa().
    
    * bindings/js/JSDOMWindowCustom.cpp:
    * page/DOMWindow.cpp:
    (WebCore::DOMWindow::btoa):
    (WebCore::DOMWindow::atob):
    * page/DOMWindow.idl:
    
    LayoutTests:
    
    * fast/dom/Window/atob-btoa-expected.txt:
    * fast/dom/Window/atob-btoa.html:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55637 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 560abc4..84f6260 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-07  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Remove inconsistent "Too few arguments" handling for window.atob() and window.btoa()
+        https://bugs.webkit.org/show_bug.cgi?id=35848
+
+        * fast/dom/Window/atob-btoa-expected.txt:
+        * fast/dom/Window/atob-btoa.html:
+
 2010-03-07  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/LayoutTests/fast/dom/Window/atob-btoa-expected.txt b/LayoutTests/fast/dom/Window/atob-btoa-expected.txt
index a2bb315..cef76a7 100644
--- a/LayoutTests/fast/dom/Window/atob-btoa-expected.txt
+++ b/LayoutTests/fast/dom/Window/atob-btoa-expected.txt
@@ -11,9 +11,10 @@ PASS window.btoa("abcd") is "YWJjZA=="
 PASS window.btoa("abcde") is "YWJjZGU="
 PASS window.btoa("abcdef") is "YWJjZGVm"
 PASS typeof window.btoa is "function"
-PASS window.btoa() threw exception SyntaxError: Not enough arguments.
+PASS window.btoa() is "dW5kZWZpbmVk"
 PASS window.btoa("") is ""
 PASS window.btoa(null) is ""
+PASS window.btoa(undefined) is "dW5kZWZpbmVk"
 PASS window.btoa(window) is "W29iamVjdCBET01XaW5kb3dd"
 PASS window.btoa("éé") is "6ek="
 PASS window.btoa("\u0080\u0081") is "gIE="
@@ -21,9 +22,10 @@ PASS window.btoa("тест") threw exception Error: INVALID_CHARACTER_ERR: DOM E
 PASS window.btoa is 0
 PASS typeof window.btoa is "number"
 PASS typeof window.atob is "function"
-PASS window.atob() threw exception SyntaxError: Not enough arguments.
+PASS window.atob() threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5.
 PASS window.atob("") is ""
 PASS window.atob(null) is ""
+PASS window.atob(undefined) threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5.
 PASS window.atob(" YQ==") threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5.
 PASS window.atob("YQ==\u000a") threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5.
 PASS window.atob("6ek=") is "éé"
diff --git a/LayoutTests/fast/dom/Window/atob-btoa.html b/LayoutTests/fast/dom/Window/atob-btoa.html
index f6b50bd..f6abb98 100644
--- a/LayoutTests/fast/dom/Window/atob-btoa.html
+++ b/LayoutTests/fast/dom/Window/atob-btoa.html
@@ -22,9 +22,10 @@ shouldBe('window.btoa("abcde")', '"YWJjZGU="');
 shouldBe('window.btoa("abcdef")', '"YWJjZGVm"');
 
 shouldBe('typeof window.btoa', '"function"');
-shouldThrow('window.btoa()');
+shouldBe('window.btoa()', '"dW5kZWZpbmVk"');
 shouldBe('window.btoa("")', '""');
 shouldBe('window.btoa(null)', '""');
+shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"');
 shouldBe('window.btoa(window)', '"W29iamVjdCBET01XaW5kb3dd"'); // "[object DOMWindow]"
 shouldBe('window.btoa("éé")', '"6ek="');
 shouldBe('window.btoa("\\u0080\\u0081")', '"gIE="');
@@ -34,9 +35,10 @@ shouldBe('window.btoa', '0');
 shouldBe('typeof window.btoa', '"number"');
 
 shouldBe('typeof window.atob', '"function"');
-shouldThrow('window.atob()');
+shouldThrow('window.atob()'); // 'undefined' 
 shouldBe('window.atob("")', '""');
 shouldBe('window.atob(null)', '""');
+shouldThrow('window.atob(undefined)');
 shouldThrow('window.atob(" YQ==")');
 shouldThrow('window.atob("YQ==\\u000a")');
 shouldBe('window.atob("6ek=")', '"éé"');
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index effe09e..bdccee7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-07  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Remove inconsistent "Too few arguments" handling for window.atob() and window.btoa()
+        https://bugs.webkit.org/show_bug.cgi?id=35848
+
+        - Take the opportunity to fully autogenerate window.atob() and window.btoa().
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::btoa):
+        (WebCore::DOMWindow::atob):
+        * page/DOMWindow.idl:
+
 2010-03-07  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 122b92e..9d1d265 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -937,34 +937,6 @@ JSValue JSDOMWindow::setInterval(ExecState* exec, const ArgList& args)
     return jsNumber(exec, result);
 }
 
-JSValue JSDOMWindow::atob(ExecState* exec, const ArgList& args)
-{
-    if (args.size() < 1)
-        return throwError(exec, SyntaxError, "Not enough arguments");
-    if (args.at(0).isNull())
-        return jsEmptyString(exec);
-
-    ExceptionCode ec = 0;
-    String result = impl()->atob(args.at(0).toString(exec), ec);
-    setDOMException(exec, ec);
-
-    return jsString(exec, result);
-}
-
-JSValue JSDOMWindow::btoa(ExecState* exec, const ArgList& args)
-{
-    if (args.size() < 1)
-        return throwError(exec, SyntaxError, "Not enough arguments");
-    if (args.at(0).isNull())
-        return jsEmptyString(exec);
-
-    ExceptionCode ec = 0;
-    String result = impl()->btoa(args.at(0).toString(exec), ec);
-    setDOMException(exec, ec);
-
-    return jsString(exec, result);
-}
-
 JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args)
 {
     Frame* frame = impl()->frame();
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 83eb8d8..9ab89a4 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -839,6 +839,9 @@ static bool isSafeToConvertCharList(const String& string)
 
 String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec)
 {
+    if (stringToEncode.isNull())
+        return String();
+
     if (!isSafeToConvertCharList(stringToEncode)) {
         ec = INVALID_CHARACTER_ERR;
         return String();
@@ -855,6 +858,9 @@ String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec)
 
 String DOMWindow::atob(const String& encodedString, ExceptionCode& ec)
 {
+    if (encodedString.isNull())
+        return String();
+
     if (!isSafeToConvertCharList(encodedString)) {
         ec = INVALID_CHARACTER_ERR;
         return String();
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index c757146..d24d8f5 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -204,9 +204,9 @@ module window {
         void clearInterval(in long handle);
 
         // Base64
-        [Custom] DOMString atob(in DOMString string)
+        DOMString atob(in [ConvertNullToNullString] DOMString string)
             raises(DOMException);
-        [Custom] DOMString btoa(in DOMString string)
+        DOMString btoa(in [ConvertNullToNullString] DOMString string)
             raises(DOMException);
 
         // Events

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list