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

Changeset 273787 in webkit


Ignore:
Timestamp:
Mar 2, 2021, 7:08:22 PM (6 years ago)
Author:
Alan Coon
Message:

Cherry-pick r273270. rdar://problem/74953268

[macOS] Disabling relaunch on login for the WebContent process is racy
​https://bugs.webkit.org/show_bug.cgi?id=222074
<rdar://problem/74230216>

Reviewed by Geoffrey Garen.

Source/WebCore/PAL:

Declare Launch Services key to disable relaunch on login.

  • pal/spi/cocoa/LaunchServicesSPI.h:

Source/WebKit:

When NSApplication is being intialized, the method -[NSApplication disableRelaunchOnLogin] is dispatched on a non-main thread, which is in a race
with the revocation of the Launch Services sandbox extension. This patch addresses this by setting this information synchronously with Launch
Services while the sandbox extension is being held. Additionally, accessibility related code under WebPage::platformInitialize may reach out to
the Launch Services daemon once during the lifetime of the WebContent process. Make sure that call succeeds by making a synchronous call while
a sandbox extension to the Launch Services daemon is being held.

  • WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess):

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@273270 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.1.5-branch/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.1.5-branch/Source/WebCore/PAL/ChangeLog

    r273214 r273787  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273270. rdar://problem/74953268
     4
     5    [macOS] Disabling relaunch on login for the WebContent process is racy
     6    https://bugs.webkit.org/show_bug.cgi?id=222074
     7    <rdar://problem/74230216>
     8   
     9    Reviewed by Geoffrey Garen.
     10   
     11    Source/WebCore/PAL:
     12   
     13    Declare Launch Services key to disable relaunch on login.
     14   
     15    * pal/spi/cocoa/LaunchServicesSPI.h:
     16   
     17    Source/WebKit:
     18   
     19    When NSApplication is being intialized, the method -[NSApplication disableRelaunchOnLogin] is dispatched on a non-main thread, which is in a race
     20    with the revocation of the Launch Services sandbox extension. This patch addresses this by setting this information synchronously with Launch
     21    Services while the sandbox extension is being held. Additionally, accessibility related code under WebPage::platformInitialize may reach out to
     22    the Launch Services daemon once during the lifetime of the WebContent process. Make sure that call succeeds by making a synchronous call while
     23    a sandbox extension to the Launch Services daemon is being held.
     24   
     25    * WebProcess/cocoa/WebProcessCocoa.mm:
     26    (WebKit::WebProcess::platformInitializeWebProcess):
     27   
     28   
     29    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     30
     31    2021-02-22  Per Arne  <pvollan@apple.com>
     32
     33            [macOS] Disabling relaunch on login for the WebContent process is racy
     34            https://bugs.webkit.org/show_bug.cgi?id=222074
     35            <rdar://problem/74230216>
     36
     37            Reviewed by Geoffrey Garen.
     38
     39            Declare Launch Services key to disable relaunch on login.
     40
     41            * pal/spi/cocoa/LaunchServicesSPI.h:
     42
    1432021-02-20  Chris Fleizach  <cfleizach@apple.com>
    244
  • branches/safari-612.1.5-branch/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h

    r270284 r273787  
    111111
    112112extern const CFStringRef _kLSDisplayNameKey;
     113extern const CFStringRef _kLSPersistenceSuppressRelaunchAtLoginKey;
    113114
    114115LSASNRef _LSGetCurrentApplicationASN();
  • branches/safari-612.1.5-branch/Source/WebKit/ChangeLog

    r273786 r273787  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273270. rdar://problem/74953268
     4
     5    [macOS] Disabling relaunch on login for the WebContent process is racy
     6    https://bugs.webkit.org/show_bug.cgi?id=222074
     7    <rdar://problem/74230216>
     8   
     9    Reviewed by Geoffrey Garen.
     10   
     11    Source/WebCore/PAL:
     12   
     13    Declare Launch Services key to disable relaunch on login.
     14   
     15    * pal/spi/cocoa/LaunchServicesSPI.h:
     16   
     17    Source/WebKit:
     18   
     19    When NSApplication is being intialized, the method -[NSApplication disableRelaunchOnLogin] is dispatched on a non-main thread, which is in a race
     20    with the revocation of the Launch Services sandbox extension. This patch addresses this by setting this information synchronously with Launch
     21    Services while the sandbox extension is being held. Additionally, accessibility related code under WebPage::platformInitialize may reach out to
     22    the Launch Services daemon once during the lifetime of the WebContent process. Make sure that call succeeds by making a synchronous call while
     23    a sandbox extension to the Launch Services daemon is being held.
     24   
     25    * WebProcess/cocoa/WebProcessCocoa.mm:
     26    (WebKit::WebProcess::platformInitializeWebProcess):
     27   
     28   
     29    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     30
     31    2021-02-22  Per Arne  <pvollan@apple.com>
     32
     33            [macOS] Disabling relaunch on login for the WebContent process is racy
     34            https://bugs.webkit.org/show_bug.cgi?id=222074
     35            <rdar://problem/74230216>
     36
     37            Reviewed by Geoffrey Garen.
     38
     39            When NSApplication is being intialized, the method -[NSApplication disableRelaunchOnLogin] is dispatched on a non-main thread, which is in a race
     40            with the revocation of the Launch Services sandbox extension. This patch addresses this by setting this information synchronously with Launch
     41            Services while the sandbox extension is being held. Additionally, accessibility related code under WebPage::platformInitialize may reach out to
     42            the Launch Services daemon once during the lifetime of the WebContent process. Make sure that call succeeds by making a synchronous call while
     43            a sandbox extension to the Launch Services daemon is being held.
     44
     45            * WebProcess/cocoa/WebProcessCocoa.mm:
     46            (WebKit::WebProcess::platformInitializeWebProcess):
     47
    1482021-03-02  Alan Coon  <alancoon@apple.com>
    249
  • branches/safari-612.1.5-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

    r273183 r273787  
    330330
    331331#if ENABLE(SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS)
     332    // Disable relaunch on login. This is also done from -[NSApplication init] by dispatching -[NSApplication disableRelaunchOnLogin] on a non-main thread.
     333    // This will be in a race with the closing of the Launch Services connection, so call it synchronously here.
     334    // The cost of calling this should be small, and it is not expected to have any impact on performance.
     335    _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSPersistenceSuppressRelaunchAtLoginKey, kCFBooleanTrue, nullptr);
     336   
     337    // This is being called under WebPage::platformInitialize(), and may reach out to the Launch Services daemon once in the lifetime of the process.
     338    // Call this synchronously here while a sandbox extension to Launch Services is being held.
     339    [NSAccessibilityRemoteUIElement remoteTokenForLocalUIElement:adoptNS([[WKAccessibilityWebPageObject alloc] init]).get()];
     340
    332341    auto method = class_getInstanceMethod([NSApplication class], @selector(_updateCanQuitQuietlyAndSafely));
    333342    method_setImplementation(method, (IMP)preventAppKitFromContactingLaunchServices);
Note: See TracChangeset for help on using the changeset viewer.