Bug 209845 - Add SPI to make WKUserScripts wait for a notification
Summary: Add SPI to make WKUserScripts wait for a notification
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-31 20:13 PDT by Alex Christensen
Modified: 2020-04-03 17:44 PDT (History)
16 users (show)

See Also:


Attachments
Patch (58.82 KB, patch)
2020-03-31 20:15 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (64.40 KB, patch)
2020-03-31 21:36 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (64.83 KB, patch)
2020-03-31 21:50 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (67.40 KB, patch)
2020-04-01 09:11 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (68.41 KB, patch)
2020-04-01 10:24 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (68.58 KB, patch)
2020-04-03 16:42 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-03-31 20:13:07 PDT
Add SPI to make WKUserScripts wait for a notification
Comment 1 Alex Christensen 2020-03-31 20:15:58 PDT
Created attachment 395124 [details]
Patch
Comment 2 Alex Christensen 2020-03-31 20:16:01 PDT
<rdar://problem/60342299>
Comment 3 Alex Christensen 2020-03-31 21:36:29 PDT
Created attachment 395126 [details]
Patch
Comment 4 EWS Watchlist 2020-03-31 21:37:28 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 5 Alex Christensen 2020-03-31 21:50:23 PDT
Created attachment 395127 [details]
Patch
Comment 6 Alex Christensen 2020-04-01 09:11:06 PDT
Created attachment 395173 [details]
Patch
Comment 7 Alex Christensen 2020-04-01 10:24:59 PDT
Created attachment 395183 [details]
Patch
Comment 8 Jeff Miller 2020-04-02 11:24:47 PDT
Comment on attachment 395183 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=395183&action=review

> Source/WebKit/UIProcess/API/APIPageConfiguration.h:193
> +    bool m_userScriptsShouldWaitUntilNotification { true };

Shouldn't this default to false?
Comment 9 Alex Christensen 2020-04-02 16:19:17 PDT
Comment on attachment 395183 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=395183&action=review

>> Source/WebKit/UIProcess/API/APIPageConfiguration.h:193
>> +    bool m_userScriptsShouldWaitUntilNotification { true };
> 
> Shouldn't this default to false?

This means that the user script that say to wait until notification should wait for notification.  By default user scripts do not say to wait until notification.
Comment 10 Jeff Miller 2020-04-02 17:39:02 PDT
Comment on attachment 395183 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=395183&action=review

>>> Source/WebKit/UIProcess/API/APIPageConfiguration.h:193
>>> +    bool m_userScriptsShouldWaitUntilNotification { true };
>> 
>> Shouldn't this default to false?
> 
> This means that the user script that say to wait until notification should wait for notification.  By default user scripts do not say to wait until notification.

I see, I was confused by the name. Maybe this should be something like "m_deferredUserScriptsShouldWaitUntilNotification" to emphasize that it only applies to user scripts that have requested to be deferred, with a similar name for the WKWebViewConfiguration property you're adding.

You could also rename the parameter to the new WKUserScript initializer you added, e.g.:

- (instancetype)_initWithSource:(NSString *)source injectionTime:(WKUserScriptInjectionTime)injectionTime forMainFrameOnly:(BOOL)forMainFrameOnly legacyWhitelist:(NSArray<NSString *> *)legacyWhitelist legacyBlacklist:(NSArray<NSString *> *)legacyBlacklist associatedURL:(NSURL *)associatedURL contentWorld:(WKContentWorld *)contentWorld deferRunningUntilNotification:(BOOL)deferRunningUntilNotification WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
Comment 11 Alex Christensen 2020-04-03 16:42:08 PDT
Created attachment 395416 [details]
Patch
Comment 12 EWS 2020-04-03 17:44:37 PDT
Committed r259523: <https://trac.webkit.org/changeset/259523>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395416 [details].