Closed
Bug 1069401
Opened 10 years ago
Closed 10 years ago
UserAgent cannot be changed for specific websites in workers
Categories
(Core :: DOM: Workers, defect)
Core
DOM: Workers
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: baku, Assigned: baku)
References
Details
Attachments
(1 file, 6 obsolete files)
26.40 KB,
patch
|
Sylvestre
:
approval-mozilla-aurora+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Currently navigator.userAgent value can be changed using nsISiteSpecificUserAgent and properties as such as general.useragent.site_specific_overrides and general.useragent.override.*.
This feature should be supported in workers too.
Assignee | ||
Comment 1•10 years ago
|
||
It turned out that we ignored general.useragent.override in the main-thread too.
Just because we can have overridden values per site, we cannot use the standard approach to retrieve prefs in workers.
Attachment #8491691 -
Flags: review?(khuey)
Comment on attachment 8491691 [details] [diff] [review]
useragent.patch
Review of attachment 8491691 [details] [diff] [review]:
-----------------------------------------------------------------
I assume that you've tested that this behaves sanely in a worker created from a JSM/JS component?
::: dom/base/Navigator.cpp
@@ +2550,5 @@
> + MOZ_ASSERT(NS_IsMainThread());
> +
> + if (!nsContentUtils::IsCallerChrome()) {
> + const nsAdoptingString& override =
> + mozilla::Preferences::GetString("general.useragent.override");
Is a fully qualified mozilla:: really necessary here?
Attachment #8491691 -
Flags: review?(khuey) → review+
Comment on attachment 8491691 [details] [diff] [review]
useragent.patch
Review of attachment 8491691 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/workers/Navigator.cpp
@@ +366,5 @@
> +
> +} // anonymous namespace
> +
> +void
> +WorkerNavigator::GetUserAgent(nsString& aUserAgent) const
We should cache here, rather than go to the main thread every time.
Assignee | ||
Comment 4•10 years ago
|
||
> We should cache here, rather than go to the main thread every time.
We don't need to do that because the attribute is marked as [Cached] in the WebIDL. The bindings do the magic.
I'll write a test for worker in JSM.
Ah, nice. Magic ftw.
Assignee | ||
Comment 6•10 years ago
|
||
bz, can you take a look at this change?
I need language to be cached and to have the ClearCachedLanguageValue() method.
Attachment #8491691 -
Attachment is obsolete: true
Attachment #8493621 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Comment 8•10 years ago
|
||
khuey, a quick review on this interdiff? A test was failing with the previous patch.
Attachment #8493729 -
Flags: review?(khuey)
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8493623 -
Attachment is obsolete: true
Comment 10•10 years ago
|
||
Comment on attachment 8493621 [details] [diff] [review]
id.patch
r=me especially if you add a comment to the IDL about why it's cached.
Attachment #8493621 -
Flags: review?(bzbarsky) → review+
Attachment #8493729 -
Flags: review?(khuey) → review+
Assignee | ||
Comment 11•10 years ago
|
||
Last push to try before landing:
https://tbpl.mozilla.org/?tree=Try&rev=6f38ed97475d
Assignee | ||
Comment 12•10 years ago
|
||
Attachment #8493621 -
Attachment is obsolete: true
Attachment #8493729 -
Attachment is obsolete: true
Attachment #8493730 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 13•10 years ago
|
||
Assignee: nobody → amarchesini
Keywords: checkin-needed
Comment 14•10 years ago
|
||
sorry had to backout this change for test failures like https://tbpl.mozilla.org/php/getParsedLog.php?id=48754884&tree=Mozilla-Inbound
Assignee | ||
Comment 15•10 years ago
|
||
it turned out that on b2g desktop the platform can be an empty string.
https://tbpl.mozilla.org/?tree=Try&rev=63fd93df5ddb
Attachment #8494257 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 16•10 years ago
|
||
Keywords: checkin-needed
Comment 17•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Assignee | ||
Comment 18•10 years ago
|
||
We should uplift this patch because it's similar to bug 1062920
Flags: needinfo?(ryanvm)
Comment 19•10 years ago
|
||
Happy to do so once it has approval ;)
status-firefox35:
--- → fixed
Flags: needinfo?(ryanvm) → needinfo?(amarchesini)
Assignee | ||
Comment 20•10 years ago
|
||
Comment on attachment 8494445 [details] [diff] [review]
useragent.patch
Approval Request Comment
[Feature/regressing bug #]: 925847
[User impact if declined]: The overridden prefs for userAgent will be ignored in workers.
[Describe test coverage new/current, TBPL]: https://tbpl.mozilla.org/?tree=Try&rev=63fd93df5ddb
[Risks and why]: The patch is not complex and it has good mochitests.
[String/UUID change made/needed]: none
Attachment #8494445 -
Flags: approval-mozilla-beta?
Attachment #8494445 -
Flags: approval-mozilla-aurora?
Flags: needinfo?(amarchesini)
Updated•10 years ago
|
status-firefox33:
--- → affected
status-firefox34:
--- → affected
Updated•10 years ago
|
Attachment #8494445 -
Flags: approval-mozilla-beta?
Attachment #8494445 -
Flags: approval-mozilla-beta+
Attachment #8494445 -
Flags: approval-mozilla-aurora?
Attachment #8494445 -
Flags: approval-mozilla-aurora+
Comment 21•10 years ago
|
||
Comment 22•9 years ago
|
||
> r=me especially if you add a comment to the IDL about why it's cached.
This comment never got added. Or rather, a comment got added, but it doesn't explain the _why_.
Flags: needinfo?(amarchesini)
You need to log in
before you can comment on or make changes to this bug.
Description
•