WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
192735
Allow clients to set the navigator platform
https://bugs.webkit.org/show_bug.cgi?id=192735
Summary
Allow clients to set the navigator platform
Megan Gardner
Reported
2018-12-14 19:25:16 PST
Allow clients to set the navigator platform
Attachments
Patch
(87.61 KB, patch)
2018-12-14 19:35 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews103 for mac-sierra
(2.42 MB, application/zip)
2018-12-14 20:50 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews104 for mac-sierra-wk2
(3.06 MB, application/zip)
2018-12-14 20:57 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews122 for ios-simulator-wk2
(2.42 MB, application/zip)
2018-12-14 21:36 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews114 for mac-sierra
(1.97 MB, application/zip)
2018-12-14 21:37 PST
,
EWS Watchlist
no flags
Details
Patch
(88.04 KB, patch)
2018-12-18 14:59 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews101 for mac-sierra
(2.60 MB, application/zip)
2018-12-18 16:17 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews106 for mac-sierra-wk2
(3.71 MB, application/zip)
2018-12-18 16:51 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews113 for mac-sierra
(2.13 MB, application/zip)
2018-12-18 17:05 PST
,
EWS Watchlist
no flags
Details
Patch
(19.67 KB, patch)
2018-12-18 19:38 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Patch for landing
(19.59 KB, patch)
2018-12-19 12:02 PST
,
Megan Gardner
no flags
Details
Formatted Diff
Diff
Show Obsolete
(10)
View All
Add attachment
proposed patch, testcase, etc.
Megan Gardner
Comment 1
2018-12-14 19:35:25 PST
Created
attachment 357380
[details]
Patch
EWS Watchlist
Comment 2
2018-12-14 19:37:32 PST
Comment hidden (obsolete)
Attachment 357380
[details]
did not pass style-queue: ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:153: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:75: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 56 files If any of these errors are false positives, please file a bug against check-webkit-style.
EWS Watchlist
Comment 3
2018-12-14 20:49:53 PST
Comment hidden (obsolete)
Comment on
attachment 357380
[details]
Patch
Attachment 357380
[details]
did not pass mac-ews (mac): Output:
https://webkit-queues.webkit.org/results/10407968
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 4
2018-12-14 20:50:01 PST
Comment hidden (obsolete)
Created
attachment 357387
[details]
Archive of layout-test-results from ews103 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 5
2018-12-14 20:57:08 PST
Comment hidden (obsolete)
Comment on
attachment 357380
[details]
Patch
Attachment 357380
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/10407984
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 6
2018-12-14 20:57:10 PST
Comment hidden (obsolete)
Created
attachment 357388
[details]
Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
Tim Horton
Comment 7
2018-12-14 21:29:25 PST
Comment on
attachment 357380
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357380&action=review
> Source/WebCore/dom/Document.cpp:3290 > +String Document::navigatorPlatform() const
userAgent() isn't navigatorUserAgent(), so I don't think this /has/ to be navigatorPlatform(), but I also admit that platform() is pretty generic and confusing, so maybe it's best this way.
> Source/WebCore/page/Navigator.cpp:61 > +#elif OS(MAC_OS_X) && (CPU(PPC) || CPU(PPC64)) > +#define WEBCORE_NAVIGATOR_PLATFORM "MacPPC"_s
You might as well get rid of this case, WebKit certainly doesn't build for PPC macOS anymore.
> Source/WebCore/page/Navigator.cpp:138 > + if (m_platform.isNull())
Humorous that we check isNull twice in the happy (cached) path.
> Source/WebCore/page/WorkerNavigator.cpp:47 > + return m_navigatorPlatform;
Why m_navigatorPlatform here instead of just m_platform? This *is* a Navigator
> Source/WebCore/workers/WorkerThread.cpp:75 > - WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, PAL::SessionID); > + WorkerThreadStartupData(const URL& scriptURL, const String& name, const String& identifier, const String& userAgent, bool isOnline, const String& sourceCode, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin& topOrigin, MonotonicTime timeOrigin, PAL::SessionID, const String& navigatorPlatform);
Wowzers you should try to convince someone to structify some of this.
> Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:66 > +typedef WKDictionaryRef (*WKBundleNavigatorPropertiesForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
Why is this still here? I think you gave up on this approach.
> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3109 > + String platform = platformNavigatorPlatform();
platform navigator platform!
> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3123 > + if (m_page) > + m_page->userAgentChanged();
Did it?
> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:3130 > + return String();
What is happening here
> Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:831 > + return String();
What is happening here
> Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:1551 > +String WebFrameLoaderClient::navigatorPlatform()
What is this for
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:1009 > +}
Nice simple happy test.
EWS Watchlist
Comment 8
2018-12-14 21:36:42 PST
Comment hidden (obsolete)
Comment on
attachment 357380
[details]
Patch
Attachment 357380
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/10408125
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 9
2018-12-14 21:36:44 PST
Comment hidden (obsolete)
Created
attachment 357389
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 10
2018-12-14 21:37:17 PST
Comment hidden (obsolete)
Comment on
attachment 357380
[details]
Patch
Attachment 357380
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/10408114
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 11
2018-12-14 21:37:19 PST
Comment hidden (obsolete)
Created
attachment 357390
[details]
Archive of layout-test-results from ews114 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-sierra Platform: Mac OS X 10.12.6
Megan Gardner
Comment 12
2018-12-18 14:59:26 PST
Created
attachment 357618
[details]
Patch
EWS Watchlist
Comment 13
2018-12-18 15:02:35 PST
Comment hidden (obsolete)
Attachment 357618
[details]
did not pass style-queue: ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:153: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:75: Missing spaces around : [whitespace/init] [4] Total errors found: 2 in 58 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 14
2018-12-18 15:12:07 PST
Comment on
attachment 357618
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357618&action=review
LGTM
> Source/WebCore/ChangeLog:10 > + Lots of piping to allow the setting of a custom navigator platform.
We should probably make a class for all the parameters of making a worker, but not in this patch.
> Source/WebCore/page/Navigator.cpp:123 > + if (!defaultPlatform.isEmpty())
This line doesn't compile on linux.
> Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:531 > +
This space doesn't need to be added.
EWS Watchlist
Comment 15
2018-12-18 16:17:19 PST
Comment hidden (obsolete)
Comment on
attachment 357618
[details]
Patch
Attachment 357618
[details]
did not pass mac-ews (mac): Output:
https://webkit-queues.webkit.org/results/10464946
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 16
2018-12-18 16:17:21 PST
Comment hidden (obsolete)
Created
attachment 357631
[details]
Archive of layout-test-results from ews101 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-sierra Platform: Mac OS X 10.12.6
Tim Horton
Comment 17
2018-12-18 16:21:47 PST
Comment on
attachment 357618
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357618&action=review
Also you broke some WPTs.
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:1014 > + auto delegate = adoptNS([[CustomNavigatorPlatformDelegate alloc] init]);
You need to actually load something in the WKWebView :D Perhaps use loadHTMLString with an empty string. Also need to put back the wait for finishedNavigation. Then you'll be good.
EWS Watchlist
Comment 18
2018-12-18 16:51:27 PST
Comment hidden (obsolete)
Comment on
attachment 357618
[details]
Patch
Attachment 357618
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/10465411
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 19
2018-12-18 16:51:29 PST
Comment hidden (obsolete)
Created
attachment 357634
[details]
Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 20
2018-12-18 17:05:48 PST
Comment hidden (obsolete)
Comment on
attachment 357618
[details]
Patch
Attachment 357618
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/10465205
New failing tests: imported/w3c/web-platform-tests/workers/WorkerNavigator_platform.htm imported/w3c/web-platform-tests/workers/interfaces/WorkerUtils/navigator/004.html
EWS Watchlist
Comment 21
2018-12-18 17:05:59 PST
Comment hidden (obsolete)
Created
attachment 357636
[details]
Archive of layout-test-results from ews113 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-sierra Platform: Mac OS X 10.12.6
Megan Gardner
Comment 22
2018-12-18 19:38:39 PST
Created
attachment 357646
[details]
Patch
Tim Horton
Comment 23
2018-12-19 11:36:39 PST
Comment on
attachment 357646
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357646&action=review
> Source/WebCore/page/Navigator.cpp:101 > +#if !OS(LINUX)
You shouldn't need this ifdef. You should just have the if !OS(LINUX) path everywhere; now that it's on FrameLoader, it will just always be the null String for Linux and fall back to NavigatorBase. No need for platform checks for no reason :)
> Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:996 > + [websitePolicies setCustomNavigatorPlatform:@"Test Custom Platform2"];
Why the 2!
Alex Christensen
Comment 24
2018-12-19 12:00:09 PST
It might be worth testing the user agent and platform from a worker to make sure that is propagated correctly.
Megan Gardner
Comment 25
2018-12-19 12:02:10 PST
Created
attachment 357706
[details]
Patch for landing
Tim Horton
Comment 26
2018-12-19 12:08:25 PST
(In reply to Alex Christensen from
comment #24
)
> It might be worth testing the user agent and platform from a worker to make > sure that is propagated correctly.
We know that it is not, and that is an existing problem.
Chris Dumez
Comment 27
2018-12-19 12:20:32 PST
(In reply to Tim Horton from
comment #26
)
> (In reply to Alex Christensen from
comment #24
) > > It might be worth testing the user agent and platform from a worker to make > > sure that is propagated correctly. > > We know that it is not, and that is an existing problem.
I do not think this is accurate, it is supposed to be working for dedicated workers. It may not work for service workers though and we should probably file an issue about that.
WebKit Commit Bot
Comment 28
2018-12-19 12:21:40 PST
Comment on
attachment 357706
[details]
Patch for landing Clearing flags on attachment: 357706 Committed
r239384
: <
https://trac.webkit.org/changeset/239384
>
WebKit Commit Bot
Comment 29
2018-12-19 12:21:42 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 30
2018-12-19 12:22:31 PST
<
rdar://problem/46848776
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug