⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 244054 in webkit


Ignore:
Timestamp:
Apr 8, 2019, 3:29:47 PM (7 years ago)
Author:
youenn@apple.com
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):

Location:
trunk
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r244047 r244054  
     12019-04-08  Youenn Fablet  <youenn@apple.com>
     2
     3        Add a test to check for the service worker process name
     4        https://bugs.webkit.org/show_bug.cgi?id=196621
     5
     6        Reviewed by Chris Dumez.
     7
     8        * http/wpt/service-workers/online-worker.js:
     9        (async.doTest):
     10
    1112019-04-08  Shawn Roberts  <sroberts@apple.com>
    212
  • trunk/LayoutTests/http/wpt/service-workers/online-worker.js

    r226510 r244054  
    2828        }
    2929
     30        if (self.internals.processName !== "none" && self.internals.processName !== "WebKitTestRunner Service Worker (localhost)") {
     31            event.source.postMessage("FAIL: wrong service worker process name: " + self.internals.processName + "'");
     32            return;
     33        }
     34
    3035        internals.setOnline(true);
    3136        var eventName = await waitForOnlineEvent();
  • trunk/Source/WebCore/ChangeLog

    r244052 r244054  
     12019-04-08  Youenn Fablet  <youenn@apple.com>
     2
     3        Add a test to check for the service worker process name
     4        https://bugs.webkit.org/show_bug.cgi?id=196621
     5
     6        Reviewed by Chris Dumez.
     7
     8        Add a service worker internal API to get process name.
     9        Covered by updated test.
     10
     11        * WebCore.xcodeproj/project.pbxproj:
     12        * testing/ServiceWorkerInternals.cpp:
     13        (WebCore::ServiceWorkerInternals::processName const):
     14        * testing/ServiceWorkerInternals.h:
     15        * testing/ServiceWorkerInternals.idl:
     16        * testing/ServiceWorkerInternals.mm: Added.
     17
    1182019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
    219
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r243962 r244054  
    11231123                41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F54F831C50C4F600338488 /* FetchHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11241124                41D28D0D2139E05800F4206F /* LibWebRTCStatsCollector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D28D0B2139E01D00F4206F /* LibWebRTCStatsCollector.cpp */; };
     1125                41D41C672256874F00697942 /* ServiceWorkerInternals.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41D41C652256859200697942 /* ServiceWorkerInternals.mm */; };
    11251126                41DE7C7C222DA14300532B65 /* StorageQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DE7C7B222DA13E00532B65 /* StorageQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11261127                41DE7C7D222DA14800532B65 /* StorageQuotaUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DE7C78222DA13C00532B65 /* StorageQuotaUser.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    73637364                41D28D0B2139E01D00F4206F /* LibWebRTCStatsCollector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCStatsCollector.cpp; path = libwebrtc/LibWebRTCStatsCollector.cpp; sourceTree = "<group>"; };
    73647365                41D28D0C2139E01E00F4206F /* LibWebRTCStatsCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCStatsCollector.h; path = libwebrtc/LibWebRTCStatsCollector.h; sourceTree = "<group>"; };
     7366                41D41C652256859200697942 /* ServiceWorkerInternals.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServiceWorkerInternals.mm; sourceTree = "<group>"; };
    73657367                41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCAudioFormat.h; path = libwebrtc/LibWebRTCAudioFormat.h; sourceTree = "<group>"; };
    73667368                41DE7C78222DA13C00532B65 /* StorageQuotaUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageQuotaUser.h; sourceTree = "<group>"; };
     
    1766717669                                417F0D7E1FFEE14E008EF303 /* ServiceWorkerInternals.h */,
    1766817670                                417F0D811FFEE150008EF303 /* ServiceWorkerInternals.idl */,
     17671                                41D41C652256859200697942 /* ServiceWorkerInternals.mm */,
    1766917672                                EB081CD81696084400553730 /* TypeConversions.h */,
    1767017673                                EB081CD91696084400553730 /* TypeConversions.idl */,
     
    2889328896                                9B714E211C91166900AC0E92 /* EventPath.h in Headers */,
    2889428897                                8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */,
     28898                                E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
    2889528899                                E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */,
    2889628900                                E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */,
     
    2978629790                                1AE2AE5C0A1D26F200B42B25 /* JSHTMLMenuElement.h in Headers */,
    2978729791                                A80E7A180A19C3D6007FB8C5 /* JSHTMLMetaElement.h in Headers */,
    29788                                 E4A8D21622578DB700A8463C /* EventRegion.h in Headers */,
    2978929792                                A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */,
    2979029793                                1AE2AB2A0A1CE63B00B42B25 /* JSHTMLModElement.h in Headers */,
     
    3252432527                                AA5F3B8F16CC4B3900455EB0 /* PlatformSpeechSynthesizerMock.cpp in Sources */,
    3252532528                                417F0D821FFEE979008EF303 /* ServiceWorkerInternals.cpp in Sources */,
     32529                                41D41C672256874F00697942 /* ServiceWorkerInternals.mm in Sources */,
    3252632530                                DE7710861FA2F0D600460016 /* WebArchiveDumpSupport.mm in Sources */,
    3252732531                                41815C1E138319830057AAA4 /* WebCoreTestSupport.cpp in Sources */,
  • trunk/Source/WebCore/testing/ServiceWorkerInternals.cpp

    r232739 r244054  
    9090}
    9191
     92#if !PLATFORM(MAC)
     93String ServiceWorkerInternals::processName() const
     94{
     95    return "none"_s;
     96}
     97#endif
     98
    9299} // namespace WebCore
    93100
  • trunk/Source/WebCore/testing/ServiceWorkerInternals.h

    r242279 r244054  
    5050    Vector<String> fetchResponseHeaderList(FetchResponse&);
    5151
     52    String processName() const;
     53
    5254private:
    5355    explicit ServiceWorkerInternals(ServiceWorkerIdentifier);
  • trunk/Source/WebCore/testing/ServiceWorkerInternals.idl

    r230365 r244054  
    3636
    3737    sequence<ByteString> fetchResponseHeaderList(FetchResponse response);
     38
     39    readonly attribute DOMString processName;
    3840};
  • trunk/Source/WebCore/testing/ServiceWorkerInternals.mm

    r244052 r244054  
    2424 */
    2525
    26 [
    27     Conditional=SERVICE_WORKER,
    28     ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
    29     ImplementationLacksVTable,
    30     NoInterfaceObject,
    31 ] interface ServiceWorkerInternals {
    32     void setOnline(boolean isOnline);
    33     Promise<Response> waitForFetchEventToFinish(FetchEvent event);
    34     [CallWith=ScriptExecutionContext] FetchEvent createBeingDispatchedFetchEvent();
    35     [CallWith=ScriptExecutionContext] FetchResponse createOpaqueWithBlobBodyResponse();
     26#include "config.h"
     27#include "ServiceWorkerInternals.h"
    3628
    37     sequence<ByteString> fetchResponseHeaderList(FetchResponse response);
    38 };
     29#if ENABLE(SERVICE_WORKER)
     30
     31#if PLATFORM(MAC)
     32
     33#import <pal/spi/cocoa/LaunchServicesSPI.h>
     34
     35namespace WebCore {
     36
     37String ServiceWorkerInternals::processName() const
     38{
     39    return adoptCF((CFStringRef)_LSCopyApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey)).get();
     40}
     41
     42} // namespace WebCore
     43
     44#endif
     45
     46#endif
Note: See TracChangeset for help on using the changeset viewer.