Skip to content

Commit

Permalink
Bug 1130287 - Expose isB2G in SpecialPowers. r=sicking
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Alexandre Lissy committed Feb 8, 2015
1 parent bdd90d9 commit 791808d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion testing/marionette/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ marionette.jar:
% content specialpowers %content/
content/specialpowers.js (../specialpowers/content/specialpowers.js)
content/SpecialPowersObserver.js (../specialpowers/components/SpecialPowersObserver.js)
content/specialpowersAPI.js (../specialpowers/content/specialpowersAPI.js)
* content/specialpowersAPI.js (../specialpowers/content/specialpowersAPI.js)
content/SpecialPowersObserverAPI.js (../specialpowers/content/SpecialPowersObserverAPI.js)
content/ChromePowers.js (../mochitest/tests/SimpleTest/ChromePowers.js)
content/MozillaLogger.js (../specialpowers/content/MozillaLogger.js)
Expand Down
2 changes: 1 addition & 1 deletion testing/mochitest/jar.mn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mochikit.jar:
content/tests/SimpleTest/MozillaLogger.js (../specialpowers/content/MozillaLogger.js)
content/tests/SimpleTest/specialpowers.js (../specialpowers/content/specialpowers.js)
content/tests/SimpleTest/SpecialPowersObserverAPI.js (../specialpowers/content/SpecialPowersObserverAPI.js)
content/tests/SimpleTest/specialpowersAPI.js (../specialpowers/content/specialpowersAPI.js)
* content/tests/SimpleTest/specialpowersAPI.js (../specialpowers/content/specialpowersAPI.js)
content/tests/SimpleTest/setup.js (tests/SimpleTest/setup.js)
content/tests/SimpleTest/SimpleTest.js (tests/SimpleTest/SimpleTest.js)
content/tests/SimpleTest/test.css (tests/SimpleTest/test.css)
Expand Down
8 changes: 8 additions & 0 deletions testing/specialpowers/content/specialpowersAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,14 @@ SpecialPowersAPI.prototype = {
return this._os;
},

get isB2G() {
#ifdef MOZ_B2G
return true;
#else
return false;
#endif
},

addSystemEventListener: function(target, type, listener, useCapture) {
Cc["@mozilla.org/eventlistenerservice;1"].
getService(Ci.nsIEventListenerService).
Expand Down
2 changes: 1 addition & 1 deletion testing/specialpowers/jar.mn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
specialpowers.jar:
% content specialpowers %content/
content/specialpowers.js (content/specialpowers.js)
content/specialpowersAPI.js (content/specialpowersAPI.js)
* content/specialpowersAPI.js (content/specialpowersAPI.js)
content/SpecialPowersObserverAPI.js (content/SpecialPowersObserverAPI.js)
content/MozillaLogger.js (content/MozillaLogger.js)

Expand Down

0 comments on commit 791808d

Please sign in to comment.