Changeset 55637 in webkit
- Timestamp:
- Mar 7, 2010 5:26:57 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55636 r55637 1 2010-03-07 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Remove inconsistent "Too few arguments" handling for window.atob() and window.btoa() 6 https://bugs.webkit.org/show_bug.cgi?id=35848 7 8 * fast/dom/Window/atob-btoa-expected.txt: 9 * fast/dom/Window/atob-btoa.html: 10 1 11 2010-03-07 Dan Bernstein <mitz@apple.com> 2 12 -
trunk/LayoutTests/fast/dom/Window/atob-btoa-expected.txt
r55619 r55637 12 12 PASS window.btoa("abcdef") is "YWJjZGVm" 13 13 PASS typeof window.btoa is "function" 14 PASS window.btoa() threw exception SyntaxError: Not enough arguments.14 PASS window.btoa() is "dW5kZWZpbmVk" 15 15 PASS window.btoa("") is "" 16 16 PASS window.btoa(null) is "" 17 PASS window.btoa(undefined) is "dW5kZWZpbmVk" 17 18 PASS window.btoa(window) is "W29iamVjdCBET01XaW5kb3dd" 18 19 PASS window.btoa("éé") is "6ek=" … … 22 23 PASS typeof window.btoa is "number" 23 24 PASS typeof window.atob is "function" 24 PASS window.atob() threw exception SyntaxError: Not enough arguments.25 PASS window.atob() threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5. 25 26 PASS window.atob("") is "" 26 27 PASS window.atob(null) is "" 28 PASS window.atob(undefined) threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5. 27 29 PASS window.atob(" YQ==") threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5. 28 30 PASS window.atob("YQ==\u000a") threw exception Error: INVALID_CHARACTER_ERR: DOM Exception 5. -
trunk/LayoutTests/fast/dom/Window/atob-btoa.html
r21931 r55637 23 23 24 24 shouldBe('typeof window.btoa', '"function"'); 25 should Throw('window.btoa()');25 shouldBe('window.btoa()', '"dW5kZWZpbmVk"'); 26 26 shouldBe('window.btoa("")', '""'); 27 27 shouldBe('window.btoa(null)', '""'); 28 shouldBe('window.btoa(undefined)', '"dW5kZWZpbmVk"'); 28 29 shouldBe('window.btoa(window)', '"W29iamVjdCBET01XaW5kb3dd"'); // "[object DOMWindow]" 29 30 shouldBe('window.btoa("éé")', '"6ek="'); … … 35 36 36 37 shouldBe('typeof window.atob', '"function"'); 37 shouldThrow('window.atob()'); 38 shouldThrow('window.atob()'); // 'undefined' 38 39 shouldBe('window.atob("")', '""'); 39 40 shouldBe('window.atob(null)', '""'); 41 shouldThrow('window.atob(undefined)'); 40 42 shouldThrow('window.atob(" YQ==")'); 41 43 shouldThrow('window.atob("YQ==\\u000a")'); -
trunk/WebCore/ChangeLog
r55636 r55637 1 2010-03-07 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Dan Bernstein. 4 5 Remove inconsistent "Too few arguments" handling for window.atob() and window.btoa() 6 https://bugs.webkit.org/show_bug.cgi?id=35848 7 8 - Take the opportunity to fully autogenerate window.atob() and window.btoa(). 9 10 * bindings/js/JSDOMWindowCustom.cpp: 11 * page/DOMWindow.cpp: 12 (WebCore::DOMWindow::btoa): 13 (WebCore::DOMWindow::atob): 14 * page/DOMWindow.idl: 15 1 16 2010-03-07 Dan Bernstein <mitz@apple.com> 2 17 -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r55635 r55637 938 938 } 939 939 940 JSValue JSDOMWindow::atob(ExecState* exec, const ArgList& args)941 {942 if (args.size() < 1)943 return throwError(exec, SyntaxError, "Not enough arguments");944 if (args.at(0).isNull())945 return jsEmptyString(exec);946 947 ExceptionCode ec = 0;948 String result = impl()->atob(args.at(0).toString(exec), ec);949 setDOMException(exec, ec);950 951 return jsString(exec, result);952 }953 954 JSValue JSDOMWindow::btoa(ExecState* exec, const ArgList& args)955 {956 if (args.size() < 1)957 return throwError(exec, SyntaxError, "Not enough arguments");958 if (args.at(0).isNull())959 return jsEmptyString(exec);960 961 ExceptionCode ec = 0;962 String result = impl()->btoa(args.at(0).toString(exec), ec);963 setDOMException(exec, ec);964 965 return jsString(exec, result);966 }967 968 940 JSValue JSDOMWindow::addEventListener(ExecState* exec, const ArgList& args) 969 941 { -
trunk/WebCore/page/DOMWindow.cpp
r55635 r55637 840 840 String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec) 841 841 { 842 if (stringToEncode.isNull()) 843 return String(); 844 842 845 if (!isSafeToConvertCharList(stringToEncode)) { 843 846 ec = INVALID_CHARACTER_ERR; … … 856 859 String DOMWindow::atob(const String& encodedString, ExceptionCode& ec) 857 860 { 861 if (encodedString.isNull()) 862 return String(); 863 858 864 if (!isSafeToConvertCharList(encodedString)) { 859 865 ec = INVALID_CHARACTER_ERR; -
trunk/WebCore/page/DOMWindow.idl
r55635 r55637 205 205 206 206 // Base64 207 [Custom] DOMString atob(inDOMString string)207 DOMString atob(in [ConvertNullToNullString] DOMString string) 208 208 raises(DOMException); 209 [Custom] DOMString btoa(inDOMString string)209 DOMString btoa(in [ConvertNullToNullString] DOMString string) 210 210 raises(DOMException); 211 211
Note: See TracChangeset
for help on using the changeset viewer.