Diff
Modified: trunk/LayoutTests/ChangeLog (201897 => 201898)
--- trunk/LayoutTests/ChangeLog 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/LayoutTests/ChangeLog 2016-06-10 01:42:05 UTC (rev 201898)
@@ -1,3 +1,17 @@
+2016-06-09 Chris Dumez <[email protected]>
+
+ atob() / btoa() API should be exposed to workers
+ https://bugs.webkit.org/show_bug.cgi?id=158576
+ <rdar://problem/26729340>
+
+ Reviewed by Sam Weinig.
+
+ Add test for atob() / btoa() in workers.
+
+ * fast/workers/atob-btoa-expected.txt: Added.
+ * fast/workers/atob-btoa.html: Added.
+ * fast/workers/resources/worker-atob-btoa.js: Added.
+
2016-06-09 Michael Saboff <[email protected]>
ES6: Reusing function name as a parameter name shouldn't throw Syntax Error
Added: trunk/LayoutTests/fast/workers/atob-btoa-expected.txt (0 => 201898)
--- trunk/LayoutTests/fast/workers/atob-btoa-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/workers/atob-btoa-expected.txt 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,73 @@
+[Worker] tests that atob() / btoa() work in workers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/worker-atob-btoa.js
+PASS [Worker] self.atob("YQ==") is "a"
+PASS [Worker] self.atob("YWI=") is "ab"
+PASS [Worker] self.atob("YWJj") is "abc"
+PASS [Worker] self.atob("YWJjZA==") is "abcd"
+PASS [Worker] self.atob("YWJjZGU=") is "abcde"
+PASS [Worker] self.atob("YWJjZGVm") is "abcdef"
+PASS [Worker] self.btoa("a") is "YQ=="
+PASS [Worker] self.btoa("ab") is "YWI="
+PASS [Worker] self.btoa("abc") is "YWJj"
+PASS [Worker] self.btoa("abcd") is "YWJjZA=="
+PASS [Worker] self.btoa("abcde") is "YWJjZGU="
+PASS [Worker] self.btoa("abcdef") is "YWJjZGVm"
+PASS [Worker] typeof self.btoa is "function"
+PASS [Worker] self.btoa() threw exception TypeError: Not enough arguments.
+PASS [Worker] self.btoa("") is ""
+PASS [Worker] self.btoa(null) is "bnVsbA=="
+PASS [Worker] self.btoa(undefined) is "dW5kZWZpbmVk"
+PASS [Worker] self.btoa(self) is "W29iamVjdCBEZWRpY2F0ZWRXb3JrZXJHbG9iYWxTY29wZV0="
+PASS [Worker] self.btoa("éé") is "6ek="
+PASS [Worker] self.btoa("\u0080\u0081") is "gIE="
+PASS [Worker] self.btoa("тест") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.btoa is 0
+PASS [Worker] typeof self.btoa is "number"
+PASS [Worker] typeof self.atob is "function"
+PASS [Worker] self.atob() threw exception TypeError: Not enough arguments.
+PASS [Worker] self.atob("") is ""
+PASS [Worker] self.atob(null) is "ée"
+PASS [Worker] self.atob(undefined) threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob(" YQ==") is "a"
+PASS [Worker] self.atob("YQ==\u000a") is "a"
+PASS [Worker] self.atob("ab\tcd") is "i·"
+PASS [Worker] self.atob("ab\ncd") is "i·"
+PASS [Worker] self.atob("ab\fcd") is "i·"
+PASS [Worker] self.atob("ab cd") is "i·"
+PASS [Worker] self.atob("ab\t\n\f\r cd") is "i·"
+PASS [Worker] self.atob(" \t\n\f\r ab\t\n\f\r cd\t\n\f\r ") is "i·"
+PASS [Worker] self.atob("ab\t\n\f\r =\t\n\f\r =\t\n\f\r ") is "i"
+PASS [Worker] self.atob(" ") is ""
+PASS [Worker] self.atob(" abcd===") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("abcd=== ") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("abcd ===") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("6ek=") is "éé"
+PASS [Worker] self.atob("6ek") is "éé"
+PASS [Worker] self.atob("gIE=") is ""
+PASS [Worker] self.atob("тест") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("z") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("zz") is "Ï"
+PASS [Worker] self.atob("zzz") is "Ï<"
+PASS [Worker] self.atob("zzz=") is "Ï<"
+PASS [Worker] self.atob("zzz==") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("zzz===") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("zzz====") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("zzz=====") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("zzzz") is "Ï<ó"
+PASS [Worker] self.atob("zzzzz") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("z=zz") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("=") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("==") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("===") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("====") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob("=====") threw exception Error: InvalidCharacterError: DOM Exception 5.
+PASS [Worker] self.atob is 0
+PASS [Worker] typeof self.atob is "number"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/workers/atob-btoa.html (0 => 201898)
--- trunk/LayoutTests/fast/workers/atob-btoa.html (rev 0)
+++ trunk/LayoutTests/fast/workers/atob-btoa.html 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+worker = startWorker('resources/worker-atob-btoa.js');
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js (0 => 201898)
--- trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js (rev 0)
+++ trunk/LayoutTests/fast/workers/resources/worker-atob-btoa.js 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,77 @@
+importScripts('../../../resources/js-test-pre.js');
+
+var global = this;
+global.jsTestIsAsync = true;
+
+description("tests that atob() / btoa() work in workers.");
+
+shouldBe('self.atob("YQ==")', '"a"');
+shouldBe('self.atob("YWI=")', '"ab"');
+shouldBe('self.atob("YWJj")', '"abc"');
+shouldBe('self.atob("YWJjZA==")', '"abcd"');
+shouldBe('self.atob("YWJjZGU=")', '"abcde"');
+shouldBe('self.atob("YWJjZGVm")', '"abcdef"');
+shouldBe('self.btoa("a")', '"YQ=="');
+shouldBe('self.btoa("ab")', '"YWI="');
+shouldBe('self.btoa("abc")', '"YWJj"');
+shouldBe('self.btoa("abcd")', '"YWJjZA=="');
+shouldBe('self.btoa("abcde")', '"YWJjZGU="');
+shouldBe('self.btoa("abcdef")', '"YWJjZGVm"');
+
+shouldBe('typeof self.btoa', '"function"');
+shouldThrow('self.btoa()', '"TypeError: Not enough arguments"');
+shouldBe('self.btoa("")', '""');
+shouldBe('self.btoa(null)', '"bnVsbA=="'); // Gets converted to "null" string.
+shouldBe('self.btoa(undefined)', '"dW5kZWZpbmVk"');
+shouldBe('self.btoa(self)', '"W29iamVjdCBEZWRpY2F0ZWRXb3JrZXJHbG9iYWxTY29wZV0="'); // "[object DedicatedWorkerGlobalScope]"
+shouldBe('self.btoa("éé")', '"6ek="');
+shouldBe('self.btoa("\\u0080\\u0081")', '"gIE="');
+shouldThrow('self.btoa("тест")');
+self.btoa = 0;
+shouldBe('self.btoa', '0');
+shouldBe('typeof self.btoa', '"number"');
+
+shouldBe('typeof self.atob', '"function"');
+shouldThrow('self.atob()', '"TypeError: Not enough arguments"');
+shouldBe('self.atob("")', '""');
+shouldBe('self.atob(null)', '"\x9Eée"'); // Gets converted to "null" string.
+shouldThrow('self.atob(undefined)');
+shouldBe('self.atob(" YQ==")', '"a"');
+shouldBe('self.atob("YQ==\\u000a")', '"a"');
+shouldBe('self.atob("ab\\tcd")', '"i·\x1d"');
+shouldBe('self.atob("ab\\ncd")', '"i·\x1d"');
+shouldBe('self.atob("ab\\fcd")', '"i·\x1d"');
+shouldBe('self.atob("ab cd")', '"i·\x1d"');
+shouldBe('self.atob("ab\\t\\n\\f\\r cd")', '"i·\x1d"');
+shouldBe('self.atob(" \\t\\n\\f\\r ab\\t\\n\\f\\r cd\\t\\n\\f\\r ")', '"i·\x1d"');
+shouldBe('self.atob("ab\\t\\n\\f\\r =\\t\\n\\f\\r =\\t\\n\\f\\r ")', '"i"');
+shouldBe('self.atob(" ")', '""');
+shouldThrow('self.atob(" abcd===")');
+shouldThrow('self.atob("abcd=== ")');
+shouldThrow('self.atob("abcd ===")');
+shouldBe('self.atob("6ek=")', '"éé"');
+shouldBe('self.atob("6ek")', '"éé"');
+shouldBe('self.atob("gIE=")', '"\u0080\u0081"');
+shouldThrow('self.atob("тест")');
+shouldThrow('self.atob("z")');
+shouldBe('self.atob("zz")', '"Ï"');
+shouldBe('self.atob("zzz")', '"Ï\u003C"');
+shouldBe('self.atob("zzz=")', '"Ï\u003C"');
+shouldThrow('self.atob("zzz==")'); // excess pad characters.
+shouldThrow('self.atob("zzz===")'); // excess pad characters.
+shouldThrow('self.atob("zzz====")'); // excess pad characters.
+shouldThrow('self.atob("zzz=====")'); // excess pad characters.
+shouldBe('self.atob("zzzz")', '"Ï\u003Có"');
+shouldThrow('self.atob("zzzzz")');
+shouldThrow('self.atob("z=zz")');
+shouldThrow('self.atob("=")');
+shouldThrow('self.atob("==")');
+shouldThrow('self.atob("===")');
+shouldThrow('self.atob("====")');
+shouldThrow('self.atob("=====")');
+self.atob = 0;
+shouldBe('self.atob', '0');
+shouldBe('typeof self.atob', '"number"');
+
+finishJSTest();
+
Modified: trunk/Source/WebCore/CMakeLists.txt (201897 => 201898)
--- trunk/Source/WebCore/CMakeLists.txt 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-06-10 01:42:05 UTC (rev 201898)
@@ -616,9 +616,8 @@
page/UserMessageHandlersNamespace.idl
page/WebKitNamespace.idl
page/WebKitPoint.idl
- page/WindowBase64.idl
page/WindowEventHandlers.idl
- page/WindowTimers.idl
+ page/WindowOrWorkerGlobalScope.idl
page/WorkerNavigator.idl
plugins/DOMMimeType.idl
@@ -1988,6 +1987,7 @@
page/AutoscrollController.cpp
page/BarProp.cpp
+ page/Base64Utilities.cpp
page/CaptionUserPreferences.cpp
page/Chrome.cpp
page/ContextMenuContext.cpp
Modified: trunk/Source/WebCore/ChangeLog (201897 => 201898)
--- trunk/Source/WebCore/ChangeLog 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/ChangeLog 2016-06-10 01:42:05 UTC (rev 201898)
@@ -1,3 +1,39 @@
+2016-06-09 Chris Dumez <[email protected]>
+
+ atob() / btoa() API should be exposed to workers
+ https://bugs.webkit.org/show_bug.cgi?id=158576
+ <rdar://problem/26729340>
+
+ Reviewed by Sam Weinig.
+
+ Expose atob() / btoa() API to workers as per:
+ https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
+
+ This aligns our behavior with Firefox and Chrome as well.
+
+ Test: fast/workers/atob-btoa.html
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * PlatformMac.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/Base64Utilities.cpp: Added.
+ (WebCore::Base64Utilities::btoa):
+ (WebCore::Base64Utilities::atob):
+ * page/Base64Utilities.h: Added.
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::find): Deleted.
+ (WebCore::DOMWindow::offscreenBuffering): Deleted.
+ (WebCore::DOMWindow::outerHeight): Deleted.
+ (WebCore::DOMWindow::outerWidth): Deleted.
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+ * page/WindowBase64.idl: Removed.
+ * page/WindowOrWorkerGlobalScope.idl: Renamed from Source/WebCore/page/WindowTimers.idl.
+ * workers/WorkerGlobalScope.h:
+ * workers/WorkerGlobalScope.idl:
+
2016-06-09 John Wilander <[email protected]>
Restrict HTTP/0.9 responses to default ports and cancel HTTP/0.9 resource loads if the document was loaded with another HTTP protocol
Modified: trunk/Source/WebCore/DerivedSources.cpp (201897 => 201898)
--- trunk/Source/WebCore/DerivedSources.cpp 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/DerivedSources.cpp 2016-06-10 01:42:05 UTC (rev 201898)
@@ -653,9 +653,8 @@
#include "JSWebKitTransitionEvent.cpp"
#include "JSWebSocket.cpp"
#include "JSWheelEvent.cpp"
-#include "JSWindowBase64.cpp"
#include "JSWindowEventHandlers.cpp"
-#include "JSWindowTimers.cpp"
+#include "JSWindowOrWorkerGlobalScope.cpp"
#include "JSWorker.cpp"
#include "JSWorkerGlobalScope.cpp"
#include "JSWorkerGlobalScopeFetch.cpp"
Modified: trunk/Source/WebCore/DerivedSources.make (201897 => 201898)
--- trunk/Source/WebCore/DerivedSources.make 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/DerivedSources.make 2016-06-10 01:42:05 UTC (rev 201898)
@@ -525,10 +525,9 @@
$(WebCore)/page/WebKitNamespace.idl \
$(WebCore)/page/UserMessageHandlersNamespace.idl \
$(WebCore)/page/UserMessageHandler.idl \
- $(WebCore)/page/WindowBase64.idl \
$(WebCore)/page/WindowEventHandlers.idl \
- $(WebCore)/page/WindowTimers.idl \
$(WebCore)/page/WorkerNavigator.idl \
+ $(WebCore)/page/WindowOrWorkerGlobalScope.idl \
$(WebCore)/plugins/DOMMimeType.idl \
$(WebCore)/plugins/DOMMimeTypeArray.idl \
$(WebCore)/plugins/DOMPlugin.idl \
Modified: trunk/Source/WebCore/PlatformMac.cmake (201897 => 201898)
--- trunk/Source/WebCore/PlatformMac.cmake 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/PlatformMac.cmake 2016-06-10 01:42:05 UTC (rev 201898)
@@ -904,9 +904,8 @@
NonElementParentNode
ParentNode
URLUtils
- WindowBase64
WindowEventHandlers
- WindowTimers
+ WindowOrWorkerGlobalScope
WorkerGlobalScopeIndexedDatabase
WorkerGlobalScopeNotifications
XPathNSResolver
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201897 => 201898)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-10 01:42:05 UTC (rev 201898)
@@ -1658,8 +1658,8 @@
439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
+ 439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E812AF80AC /* MathOperator.cpp */; };
439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
- 439046E912DA25E812AF80AC /* MathOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E812AF80AC /* MathOperator.cpp */; };
439046EA12DA25E812AF80AC /* MathOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E812AF80AC /* MathOperator.h */; };
439046EB12DA25E800AF80A9 /* RenderMathMLToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */; };
439046EC12DA25E800AF80A9 /* RenderMathMLToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D812DA25E800AF80A9 /* RenderMathMLToken.h */; };
@@ -1733,6 +1733,8 @@
458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 460BB6151D0A1BF000221812 /* Base64Utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */; };
+ 460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; };
463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
@@ -9205,8 +9207,8 @@
439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLScripts.cpp; sourceTree = "<group>"; };
439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLScripts.h; sourceTree = "<group>"; };
439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
+ 439046D512DA25E812AF80AC /* MathOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathOperator.cpp; sourceTree = "<group>"; };
439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLUnderOver.h; sourceTree = "<group>"; };
- 439046D512DA25E812AF80AC /* MathOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathOperator.cpp; sourceTree = "<group>"; };
439046D612DA25E812AF80AC /* MathOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathOperator.h; sourceTree = "<group>"; };
439046D712DA25E800AF80A9 /* RenderMathMLToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLToken.cpp; sourceTree = "<group>"; };
439046D812DA25E800AF80A9 /* RenderMathMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLToken.h; sourceTree = "<group>"; };
@@ -9285,6 +9287,8 @@
458FE4081589DF0B005609E6 /* RenderSearchField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSearchField.h; sourceTree = "<group>"; };
45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
+ 460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64Utilities.cpp; sourceTree = "<group>"; };
+ 460BB6141D0A1BEC00221812 /* Base64Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64Utilities.h; sourceTree = "<group>"; };
4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
@@ -17981,6 +17985,8 @@
BC124EE40C2641CD009E2349 /* BarProp.cpp */,
BC124EE50C2641CD009E2349 /* BarProp.h */,
BC124EE60C2641CD009E2349 /* BarProp.idl */,
+ 460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */,
+ 460BB6141D0A1BEC00221812 /* Base64Utilities.h */,
072CA86016CB4DC3008AE131 /* CaptionUserPreferences.cpp */,
079D0867162F20E800DB8658 /* CaptionUserPreferences.h */,
079D086A162F21F900DB8658 /* CaptionUserPreferencesMediaAF.cpp */,
@@ -26281,6 +26287,7 @@
A8EA7D2D0A19385500A8EF5F /* HTMLImageElement.h in Headers */,
A8EA7D2B0A19385500A8EF5F /* HTMLImageLoader.h in Headers */,
A81369CC097374F600D74463 /* HTMLInputElement.h in Headers */,
+ 460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */,
97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */,
93309DE6099E64920056E581 /* HTMLInterchange.h in Headers */,
A81369E4097374F600D74463 /* HTMLKeygenElement.h in Headers */,
@@ -29076,6 +29083,7 @@
CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */,
FD31603D12B0267600C1A359 /* AnalyserNode.cpp in Sources */,
31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */,
+ 460BB6151D0A1BF000221812 /* Base64Utilities.cpp in Sources */,
490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */,
49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */,
Added: trunk/Source/WebCore/page/Base64Utilities.cpp (0 => 201898)
--- trunk/Source/WebCore/page/Base64Utilities.cpp (rev 0)
+++ trunk/Source/WebCore/page/Base64Utilities.cpp 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Base64Utilities.h"
+
+#include <wtf/text/Base64.h>
+
+namespace WebCore {
+
+String Base64Utilities::btoa(const String& stringToEncode, ExceptionCode& ec)
+{
+ if (stringToEncode.isNull())
+ return String();
+
+ if (!stringToEncode.containsOnlyLatin1()) {
+ ec = INVALID_CHARACTER_ERR;
+ return String();
+ }
+
+ return base64Encode(stringToEncode.latin1());
+}
+
+String Base64Utilities::atob(const String& encodedString, ExceptionCode& ec)
+{
+ if (encodedString.isNull())
+ return String();
+
+ if (!encodedString.containsOnlyLatin1()) {
+ ec = INVALID_CHARACTER_ERR;
+ return String();
+ }
+
+ Vector<char> out;
+ if (!base64Decode(encodedString, out, Base64ValidatePadding | Base64IgnoreSpacesAndNewLines)) {
+ ec = INVALID_CHARACTER_ERR;
+ return String();
+ }
+
+ return String(out.data(), out.size());
+}
+
+}
Added: trunk/Source/WebCore/page/Base64Utilities.h (0 => 201898)
--- trunk/Source/WebCore/page/Base64Utilities.h (rev 0)
+++ trunk/Source/WebCore/page/Base64Utilities.h 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ExceptionCode.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class Base64Utilities {
+public:
+ Base64Utilities() = default;
+
+ String btoa(const String& stringToEncode, ExceptionCode&);
+ String atob(const String& encodedString, ExceptionCode&);
+};
+
+}
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (201897 => 201898)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2016-06-10 01:42:05 UTC (rev 201898)
@@ -109,7 +109,6 @@
#include <wtf/MathExtras.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Ref.h>
-#include <wtf/text/Base64.h>
#include <wtf/text/WTFString.h>
#if ENABLE(USER_MESSAGE_HANDLERS)
@@ -1137,38 +1136,6 @@
return String();
}
-String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec)
-{
- if (stringToEncode.isNull())
- return String();
-
- if (!stringToEncode.containsOnlyLatin1()) {
- ec = INVALID_CHARACTER_ERR;
- return String();
- }
-
- return base64Encode(stringToEncode.latin1());
-}
-
-String DOMWindow::atob(const String& encodedString, ExceptionCode& ec)
-{
- if (encodedString.isNull())
- return String();
-
- if (!encodedString.containsOnlyLatin1()) {
- ec = INVALID_CHARACTER_ERR;
- return String();
- }
-
- Vector<char> out;
- if (!base64Decode(encodedString, out, Base64ValidatePadding | Base64IgnoreSpacesAndNewLines)) {
- ec = INVALID_CHARACTER_ERR;
- return String();
- }
-
- return String(out.data(), out.size());
-}
-
bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
{
if (!isCurrentlyDisplayedInFrame())
Modified: trunk/Source/WebCore/page/DOMWindow.h (201897 => 201898)
--- trunk/Source/WebCore/page/DOMWindow.h 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.h 2016-06-10 01:42:05 UTC (rev 201898)
@@ -27,6 +27,7 @@
#ifndef DOMWindow_h
#define DOMWindow_h
+#include "Base64Utilities.h"
#include "ContextDestructionObserver.h"
#include "EventTarget.h"
#include "FrameDestructionObserver.h"
@@ -97,6 +98,7 @@
, public EventTargetWithInlineData
, public ContextDestructionObserver
, public FrameDestructionObserver
+ , public Base64Utilities
, public Supplementable<DOMWindow> {
public:
static Ref<DOMWindow> create(Document* document) { return adoptRef(*new DOMWindow(document)); }
@@ -175,8 +177,6 @@
void alert(const String& message);
bool confirm(const String& message);
String prompt(const String& message, const String& defaultValue);
- String btoa(const String& stringToEncode, ExceptionCode&);
- String atob(const String& encodedString, ExceptionCode&);
bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool wholeWord, bool searchInFrames, bool showDialog) const;
Modified: trunk/Source/WebCore/page/DOMWindow.idl (201897 => 201898)
--- trunk/Source/WebCore/page/DOMWindow.idl 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/DOMWindow.idl 2016-06-10 01:42:05 UTC (rev 201898)
@@ -231,6 +231,5 @@
};
DOMWindow implements GlobalEventHandlers;
-DOMWindow implements WindowBase64;
DOMWindow implements WindowEventHandlers;
-DOMWindow implements WindowTimers;
+DOMWindow implements WindowOrWorkerGlobalScope;
Deleted: trunk/Source/WebCore/page/WindowBase64.idl (201897 => 201898)
--- trunk/Source/WebCore/page/WindowBase64.idl 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/WindowBase64.idl 2016-06-10 01:42:05 UTC (rev 201898)
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
- NoInterfaceObject,
-] interface WindowBase64 {
- [RaisesException] DOMString atob(DOMString string);
- [RaisesException] DOMString btoa(DOMString string);
-};
Copied: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (from rev 201897, trunk/Source/WebCore/page/WindowTimers.idl) (0 => 201898)
--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (rev 0)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl 2016-06-10 01:42:05 UTC (rev 201898)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2006-2009, 2013, 1016 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ NoInterfaceObject,
+] interface WindowOrWorkerGlobalScope {
+ // Timers.
+ [Custom] long setTimeout(any handler, optional long timeout = 0);
+ void clearTimeout(optional long handle = 0);
+ [Custom] long setInterval(any handler, optional long timeout = 0);
+ void clearInterval(optional long handle = 0);
+
+ // Base64 utility methods.
+ [RaisesException] DOMString atob(DOMString string);
+ [RaisesException] DOMString btoa(DOMString string);
+};
+
Deleted: trunk/Source/WebCore/page/WindowTimers.idl (201897 => 201898)
--- trunk/Source/WebCore/page/WindowTimers.idl 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/page/WindowTimers.idl 2016-06-10 01:42:05 UTC (rev 201898)
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2013 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
- NoInterfaceObject,
-] interface WindowTimers {
- [Custom] long setTimeout(any handler, optional long timeout = 0);
- void clearTimeout(optional long handle = 0);
- [Custom] long setInterval(any handler, optional long timeout = 0);
- void clearInterval(optional long handle = 0);
-};
-
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (201897 => 201898)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2016-06-10 01:42:05 UTC (rev 201898)
@@ -26,6 +26,7 @@
#pragma once
+#include "Base64Utilities.h"
#include "EventListener.h"
#include "EventTarget.h"
#include "ScriptExecutionContext.h"
@@ -57,7 +58,7 @@
class IDBConnectionProxy;
}
-class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Supplementable<WorkerGlobalScope>, public ScriptExecutionContext, public EventTargetWithInlineData {
+class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Supplementable<WorkerGlobalScope>, public ScriptExecutionContext, public EventTargetWithInlineData, public Base64Utilities {
public:
virtual ~WorkerGlobalScope();
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.idl (201897 => 201898)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.idl 2016-06-10 01:11:47 UTC (rev 201897)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.idl 2016-06-10 01:42:05 UTC (rev 201898)
@@ -64,4 +64,4 @@
[Conditional=INDEXED_DATABASE_IN_WORKERS, EnabledAtRuntime=IndexedDBWorkers] attribute IDBVersionChangeEventConstructor IDBVersionChangeEvent;
};
-WorkerGlobalScope implements WindowTimers;
+WorkerGlobalScope implements WindowOrWorkerGlobalScope;