Title: [244054] trunk
Revision
244054
Author
you...@apple.com
Date
2019-04-08 15:29:47 -0700 (Mon, 08 Apr 2019)

Log Message

Add a test to check for the service worker process name
https://bugs.webkit.org/show_bug.cgi?id=196621

Reviewed by Chris Dumez.

Source/WebCore:

Add a service worker internal API to get process name.
Covered by updated test.

* WebCore.xcodeproj/project.pbxproj:
* testing/ServiceWorkerInternals.cpp:
(WebCore::ServiceWorkerInternals::processName const):
* testing/ServiceWorkerInternals.h:
* testing/ServiceWorkerInternals.idl:
* testing/ServiceWorkerInternals.mm: Added.

LayoutTests:

* http/wpt/service-workers/online-worker.js:
(async.doTest):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244053 => 244054)


--- trunk/LayoutTests/ChangeLog	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/LayoutTests/ChangeLog	2019-04-08 22:29:47 UTC (rev 244054)
@@ -1,3 +1,13 @@
+2019-04-08  Youenn Fablet  <you...@apple.com>
+
+        Add a test to check for the service worker process name
+        https://bugs.webkit.org/show_bug.cgi?id=196621
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/service-workers/online-worker.js:
+        (async.doTest):
+
 2019-04-08  Shawn Roberts  <srobe...@apple.com>
 
         fast/parser/xml-error-adopted.xml is a flaky timeout

Modified: trunk/LayoutTests/http/wpt/service-workers/online-worker.js (244053 => 244054)


--- trunk/LayoutTests/http/wpt/service-workers/online-worker.js	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/LayoutTests/http/wpt/service-workers/online-worker.js	2019-04-08 22:29:47 UTC (rev 244054)
@@ -27,6 +27,11 @@
             return;
         }
 
+        if (self.internals.processName !== "none" && self.internals.processName !== "WebKitTestRunner Service Worker (localhost)") {
+            event.source.postMessage("FAIL: wrong service worker process name: " + self.internals.processName + "'");
+            return;
+        }
+
         internals.setOnline(true);
         var eventName = await waitForOnlineEvent();
         if (!navigator.onLine)

Modified: trunk/Source/WebCore/ChangeLog (244053 => 244054)


--- trunk/Source/WebCore/ChangeLog	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/Source/WebCore/ChangeLog	2019-04-08 22:29:47 UTC (rev 244054)
@@ -1,3 +1,20 @@
+2019-04-08  Youenn Fablet  <you...@apple.com>
+
+        Add a test to check for the service worker process name
+        https://bugs.webkit.org/show_bug.cgi?id=196621
+
+        Reviewed by Chris Dumez.
+
+        Add a service worker internal API to get process name.
+        Covered by updated test.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * testing/ServiceWorkerInternals.cpp:
+        (WebCore::ServiceWorkerInternals::processName const):
+        * testing/ServiceWorkerInternals.h:
+        * testing/ServiceWorkerInternals.idl:
+        * testing/ServiceWorkerInternals.mm: Added.
+
 2019-04-08  Yusuke Suzuki  <ysuz...@apple.com>
 
         Unreviewed, speculative fix for build failure in old macOS after r243887

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (244053 => 244054)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-04-08 22:29:47 UTC (rev 244054)
@@ -1122,6 +1122,7 @@
 		41D129D51F3D0F6900D15E47 /* CacheStorageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129D41F3D0F6600D15E47 /* CacheStorageProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F54F831C50C4F600338488 /* FetchHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41D28D0D2139E05800F4206F /* LibWebRTCStatsCollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D28D0B2139E01D00F4206F /* LibWebRTCStatsCollector.cpp */; };
+		41D41C672256874F00697942 /* ServiceWorkerInternals.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41D41C652256859200697942 /* ServiceWorkerInternals.mm */; };
 		41DE7C7C222DA14300532B65 /* StorageQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DE7C7B222DA13E00532B65 /* StorageQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41DE7C7D222DA14800532B65 /* StorageQuotaUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DE7C78222DA13C00532B65 /* StorageQuotaUser.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		41DEFCB61E56C1BD000D9E5F /* JSDOMMapLike.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DEFCB41E56C1B9000D9E5F /* JSDOMMapLike.h */; };
@@ -7362,6 +7363,7 @@
 		41D1A04C213EDDFF0063FB6B /* LibWebRTCUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LibWebRTCUtils.h; path = libwebrtc/LibWebRTCUtils.h; sourceTree = "<group>"; };
 		41D28D0B2139E01D00F4206F /* LibWebRTCStatsCollector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCStatsCollector.cpp; path = libwebrtc/LibWebRTCStatsCollector.cpp; sourceTree = "<group>"; };
 		41D28D0C2139E01E00F4206F /* LibWebRTCStatsCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCStatsCollector.h; path = libwebrtc/LibWebRTCStatsCollector.h; sourceTree = "<group>"; };
+		41D41C652256859200697942 /* ServiceWorkerInternals.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServiceWorkerInternals.mm; sourceTree = "<group>"; };
 		41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCAudioFormat.h; path = libwebrtc/LibWebRTCAudioFormat.h; sourceTree = "<group>"; };
 		41DE7C78222DA13C00532B65 /* StorageQuotaUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageQuotaUser.h; sourceTree = "<group>"; };
 		41DE7C7A222DA13D00532B65 /* StorageQuotaManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageQuotaManager.cpp; sourceTree = "<group>"; };
@@ -17666,6 +17668,7 @@
 				417F0D801FFEE14F008EF303 /* ServiceWorkerInternals.cpp */,
 				417F0D7E1FFEE14E008EF303 /* ServiceWorkerInternals.h */,
 				417F0D811FFEE150008EF303 /* ServiceWorkerInternals.idl */,
+				41D41C652256859200697942 /* ServiceWorkerInternals.mm */,
 				EB081CD81696084400553730 /* TypeConversions.h */,
 				EB081CD91696084400553730 /* TypeConversions.idl */,
 				E1BA67191742BEF400C20251 /* WebCoreTestShimLibrary.cpp */,
@@ -28892,6 +28895,7 @@
 				939885C408B7E3D100E707C4 /* EventNames.h in Headers */,
 				9B714E211C91166900AC0E92 /* EventPath.h in Headers */,
 				8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */,
+				E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
 				E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */,
 				E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */,
 				97AA3CA5145237CC003E1DA6 /* EventTargetHeaders.h in Headers */,
@@ -29785,7 +29789,6 @@
 				E446143A0CD689C800FADA75 /* JSHTMLMediaElement.h in Headers */,
 				1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */,
 				A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */,
-				E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
 				A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */,
 				1AE2AB2A0A1CE63B00B42B25 /* JSHTMLModElement.h in Headers */,
 				BC305C7A0C076BB300CD20F0 /* JSHTMLObjectElement.h in Headers */,
@@ -32523,6 +32526,7 @@
 				A140618B1E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp in Sources */,
 				AA5F3B8F16CC4B3900455EB0 /* PlatformSpeechSynthesizerMock.cpp in Sources */,
 				417F0D821FFEE979008EF303 /* ServiceWorkerInternals.cpp in Sources */,
+				41D41C672256874F00697942 /* ServiceWorkerInternals.mm in Sources */,
 				DE7710861FA2F0D600460016 /* WebArchiveDumpSupport.mm in Sources */,
 				41815C1E138319830057AAA4 /* WebCoreTestSupport.cpp in Sources */,
 			);

Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp (244053 => 244054)


--- trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp	2019-04-08 22:29:47 UTC (rev 244054)
@@ -89,6 +89,13 @@
     return headerNames;
 }
 
+#if !PLATFORM(MAC)
+String ServiceWorkerInternals::processName() const
+{
+    return "none"_s;
+}
+#endif
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.h (244053 => 244054)


--- trunk/Source/WebCore/testing/ServiceWorkerInternals.h	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.h	2019-04-08 22:29:47 UTC (rev 244054)
@@ -49,6 +49,8 @@
 
     Vector<String> fetchResponseHeaderList(FetchResponse&);
 
+    String processName() const;
+
 private:
     explicit ServiceWorkerInternals(ServiceWorkerIdentifier);
 

Modified: trunk/Source/WebCore/testing/ServiceWorkerInternals.idl (244053 => 244054)


--- trunk/Source/WebCore/testing/ServiceWorkerInternals.idl	2019-04-08 22:26:50 UTC (rev 244053)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.idl	2019-04-08 22:29:47 UTC (rev 244054)
@@ -35,4 +35,6 @@
     [CallWith=ScriptExecutionContext] FetchResponse createOpaqueWithBlobBodyResponse();
 
     sequence<ByteString> fetchResponseHeaderList(FetchResponse response);
+
+    readonly attribute DOMString processName;
 };

Copied: trunk/Source/WebCore/testing/ServiceWorkerInternals.mm (from rev 244052, trunk/Source/WebCore/testing/ServiceWorkerInternals.idl) (0 => 244054)


--- trunk/Source/WebCore/testing/ServiceWorkerInternals.mm	                        (rev 0)
+++ trunk/Source/WebCore/testing/ServiceWorkerInternals.mm	2019-04-08 22:29:47 UTC (rev 244054)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 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 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 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 "ServiceWorkerInternals.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#if PLATFORM(MAC)
+
+#import <pal/spi/cocoa/LaunchServicesSPI.h>
+
+namespace WebCore {
+
+String ServiceWorkerInternals::processName() const
+{
+    return adoptCF((CFStringRef)_LSCopyApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey)).get();
+}
+
+} // namespace WebCore
+
+#endif
+
+#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to