Closed
Bug 1130287
Opened 8 years ago
Closed 8 years ago
Expose isB2G in SpecialPowers
Categories
(Firefox OS Graveyard :: Runtime, defect)
Tracking
(firefox38 fixed)
RESOLVED
FIXED
2.2 S6 (20feb)
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: gerard-majax, Assigned: gerard-majax)
References
Details
(Whiteboard: [systemsfe])
Attachments
(1 file, 3 obsolete files)
5.43 KB,
patch
|
gerard-majax
:
review+
|
Details | Diff | Splinter Review |
On B2G Desktop/Mulet, the user agent string is: > Mozilla/5.0 (rv:38.0) Gecko/20100101 Firefox/38.0 On Firefox OS Simulator (FXOS_SIMULATOR flag), we have: > Mozilla/5.0 (X11; Mobile; rv:38.0) Gecko/20100101 Firefox/38.0 Having B2G Destop, Mulet, and Firefox OS Simulator having the same user agent string makes sense and would help fixing some mochitests.
Comment 1•8 years ago
|
||
I disagree. There's no reason b2g desktop should pretend to be Mobile when it's not running as FXOS_SIMULATOR. I don't care too much about Mulet.
Assignee | ||
Comment 2•8 years ago
|
||
From http://ftp.mozilla.org/pub/mozilla.org/b2g/try-builds/alissy@mozilla.com-b92db483929d/try-linux64_gecko/try_ubuntu64_vm-b2gdt_test-mochitest-oop-1-bm115-tests1-linux64-build1030.txt.gz : > 03:16:49 INFO - 8425 INFO TEST-START | dom/workers/test/test_navigator.html > 03:16:49 INFO - UserAgent :: Mozilla/5.0 (Mobile; rv:38.0) Gecko/20100101 Firefox/38.0 > 03:16:49 INFO - UserAgent :: Mozilla/5.0 (Mobile; rv:38.0) Gecko/20100101 Firefox/38.0 => isDesktop: false > 03:16:49 INFO - UserAgent :: Mozilla/5.0 (Mobile; rv:38.0) Gecko/20100101 Firefox/38.0 => isB2G: true > 03:16:49 INFO - 8426 INFO TEST-OK | dom/workers/test/test_navigator.html | took 219ms So B2G Desktop Linux shows the "Mobile" substring.
Assignee | ||
Comment 3•8 years ago
|
||
And that's because ... http://ftp.mozilla.org/pub/mozilla.org/b2g/try-builds/alissy@mozilla.com-b92db483929d/try-linux64_gecko/try-linux64_gecko-bm75-try1-build4736.txt.gz : > # Build simulator xpi and phone tweaks for b2g-desktop > FXOS_SIMULATOR=1
Assignee | ||
Comment 4•8 years ago
|
||
Current uses: Introduction FXOS_SIMULATOR=1 : f0f375c4 2014-04-08 08:23:00 +0200 ================================================================== - dom/base/test/test_getFeature_with_perm.html: var isB2G = !isAndroid && /Mobile|Tablet/.test(navigator.userAgent); => 843ce0bc 2014-04-15 14:30:22 +0800 - dom/base/test/test_hasFeature.html: var isB2g = isMulet || (!isAndroid && /Mobile|Tablet/.test(navigator.userAgent)); => 62da4d35 2014-07-24 16:57:02 -0300 - dom/browser-element/mochitest/browserElement_GetScreenshot.js: var isB2G = (navigator.platform === ''); => 2f91ae99 2014-01-13 08:55:15 -0500 - dom/canvas/test/test_drawWindow.html: var isB2G = /Mobile|Tablet/.test(navigator.userAgent) && => 9fcd6a5b 2014-04-14 11:12:00 -0700 - dom/tests/mochitest/general/test_donottrack.html: var isB2G = !isAndroid && /Mobile|Tablet/.test(navigator.userAgent); => d2190515 2014-05-26 22:10:39 +0100 - dom/tests/mochitest/general/test_interfaces.html: var isB2G = !isDesktop && !navigator.userAgent.contains("Android"); => 793b2837e 2013-09-01 02:50:18 +0900 - dom/workers/test/navigator_worker.js:var isB2G = !isDesktop && !navigator.userAgent.contains("Android"); => dd4520e3 2014-02-24 21:57:42 +0800 - dom/workers/test/test_worker_interfaces.js: var isB2G = !isDesktop && !userAgent.contains("Android"); => 3017d285 2014-07-31 21:54:44 -0400
Assignee | ||
Comment 5•8 years ago
|
||
(In reply to Alexandre LISSY :gerard-majax from comment #3) > And that's because ... > http://ftp.mozilla.org/pub/mozilla.org/b2g/try-builds/alissy@mozilla.com- > b92db483929d/try-linux64_gecko/try-linux64_gecko-bm75-try1-build4736.txt.gz : > > > # Build simulator xpi and phone tweaks for b2g-desktop > > FXOS_SIMULATOR=1 When removed, it fails also on B2G Desktop: https://treeherder.mozilla.org/#/jobs?repo=try&revision=877652fc8efa&exclusion_state=all
Assignee | ||
Updated•8 years ago
|
Summary: Expose "Mobile" in User Agent String for B2G Desktop/Mulet → Fix mochitests for proper B2G detection
Updated•8 years ago
|
Whiteboard: [systemsfe]
Assignee | ||
Comment 6•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5f8f70a38d02
Assignee | ||
Comment 7•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8560867 -
Flags: review?(jonas)
Comment 8•8 years ago
|
||
Comment on attachment 8560867 [details] [diff] [review] Expose isB2G in SpecialPowers r=sicking Review of attachment 8560867 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/specialpowers/content/specialpowersAPI.js @@ +1508,5 @@ > + } catch (ex) { }; > + } > + > + return this._isB2G; > + }, Simpler option: make specialpowersAPI.js a preprocessed file, and just do: get isB2G() { #ifdef MOZ_B2G return true; #else return false; #endif }
Comment on attachment 8560867 [details] [diff] [review] Expose isB2G in SpecialPowers r=sicking Review of attachment 8560867 [details] [diff] [review]: ----------------------------------------------------------------- r=me with this or Fabrice's solution.
Attachment #8560867 -
Flags: review?(jonas) → review+
Assignee | ||
Comment 10•8 years ago
|
||
Some mochitests needs to behave differently when ran on B2G Desktop. Currently, this is implemented using user agent string detection, mostly relying on "Mobile" being present and "Android" being absent. This is only true on B2G Desktop when ran on Try because the mozconfig defined FXOS_SIMULATOR and that, per bug 1115935, this substring is only added in this case, but not if just MOZ_B2G is defined. A better approach is to expose 'isB2G' in SpecialPowers for this kind of detection.
Assignee | ||
Comment 11•8 years ago
|
||
Comment on attachment 8560984 [details] [diff] [review] Expose isB2G in SpecialPowers r=sicking Carrying r+ from :sicking, implemented as suggested by :fabrice
Attachment #8560984 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Attachment #8560867 -
Attachment is obsolete: true
Assignee | ||
Comment 12•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=89a6e5950709
Assignee | ||
Updated•8 years ago
|
Summary: Fix mochitests for proper B2G detection → Expose isB2G in SpecialPowers
Assignee | ||
Comment 13•8 years ago
|
||
Some mochitests needs to behave differently when ran on B2G Desktop. Currently, this is implemented using user agent string detection, mostly relying on "Mobile" being present and "Android" being absent. This is only true on B2G Desktop when ran on Try because the mozconfig defined FXOS_SIMULATOR and that, per bug 1115935, this substring is only added in this case, but not if just MOZ_B2G is defined. A better approach is to expose 'isB2G' in SpecialPowers for this kind of detection.
Assignee | ||
Comment 14•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cbb33b804c39
Assignee | ||
Updated•8 years ago
|
Attachment #8560984 -
Attachment is obsolete: true
Assignee | ||
Comment 15•8 years ago
|
||
Comment on attachment 8561024 [details] [diff] [review] Expose isB2G in SpecialPowers r=sicking Carrying r+, making specialpowersAPI.js a preprocessed file on more cases.
Attachment #8561024 -
Flags: review+
Comment 16•8 years ago
|
||
Comment on attachment 8561024 [details] [diff] [review] Expose isB2G in SpecialPowers r=sicking Review of attachment 8561024 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/specialpowers/content/specialpowersAPI.js @@ +4,5 @@ > /* This code is loaded in every child process that is started by mochitest in > * order to be used as a replacement for UniversalXPConnect > */ > > +#filter substitution Are you sure you need that?
Assignee | ||
Comment 17•8 years ago
|
||
According to the doc, you're right it's not needed. Thanks for spotting it
Assignee | ||
Updated•8 years ago
|
Attachment #8561024 -
Attachment is obsolete: true
Assignee | ||
Comment 18•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=484c118766ef
Assignee | ||
Comment 19•8 years ago
|
||
Some mochitests needs to behave differently when ran on B2G Desktop. Currently, this is implemented using user agent string detection, mostly relying on "Mobile" being present and "Android" being absent. This is only true on B2G Desktop when ran on Try because the mozconfig defined FXOS_SIMULATOR and that, per bug 1115935, this substring is only added in this case, but not if just MOZ_B2G is defined. A better approach is to expose 'isB2G' in SpecialPowers for this kind of detection.
Assignee | ||
Updated•8 years ago
|
Attachment #8561063 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 20•8 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/8fff8db4305b
Keywords: checkin-needed
Comment 21•8 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/8fff8db4305b
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S6 (20feb)
You need to log in
before you can comment on or make changes to this bug.
Description
•