Bug 787203: Get Marionette working in Fennec
MozReview-Commit-ID: D5sFULBOdcU
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -14,16 +14,21 @@
//
// For instance: cachePercentageWidth is 1500
// viewport height is 500
// => display port height will be 500 * 1.5 = 750
//
pref("toolkit.browser.cacheRatioWidth", 2000);
pref("toolkit.browser.cacheRatioHeight", 3000);
+//marionette to be removed
+
+pref("marionette.defaultPrefs.enabled", true);
+pref("marionette.defaultPrefs.port", 2828);
+
// How long before a content view (a handle to a remote scrollable object)
// expires.
pref("toolkit.browser.contentViewExpire", 3000);
pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
pref("browser.chromeURL", "chrome://browser/content/");
// If a tab has not been active for this long (seconds), then it may be
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1499,39 +1499,39 @@ GeckoDriver.prototype.setWindowPosition
* Switch current top-level browsing context by name or server-assigned ID.
* Searches for windows by name, then ID. Content windows take precedence.
*
* @param {string} name
* Target name or ID of the window to switch to.
*/
GeckoDriver.prototype.switchToWindow = function*(cmd, resp) {
let switchTo = cmd.parameters.name;
- let isB2G = this.appName == "B2G";
+ let isMobile = this.appName == "B2G" || this.appName == "Fennec";
let found;
let getOuterWindowId = function(win) {
let rv = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
- rv += isB2G ? "-b2g" : "";
+ rv += isMobile ? "-b2g" : "";
return rv;
};
let byNameOrId = function(name, outerId, contentWindowId) {
return switchTo == name ||
switchTo == contentWindowId ||
switchTo == outerId;
};
let winEn = this.getWinEnumerator();
while (winEn.hasMoreElements()) {
let win = winEn.getNext();
let outerId = getOuterWindowId(win);
- if (win.gBrowser && !isB2G) {
+ if (win.gBrowser && !isMobile) {
let tabbrowser = win.gBrowser;
for (let i = 0; i < tabbrowser.browsers.length; ++i) {
let browser = tabbrowser.getBrowserAtIndex(i);
let contentWindowId = this.getIdForBrowser(browser);
if (byNameOrId(win.name, contentWindowId, outerId)) {
found = {
win: win,
outerId: outerId,
@@ -3034,17 +3034,21 @@ var BrowserObj = function(win, driver) {
this.updateIdForBrowser = driver.updateIdForBrowser.bind(driver);
this._curFrameId = null;
this._browserWasRemote = null;
this._hasRemotenessChange = false;
};
Object.defineProperty(BrowserObj.prototype, "browserForTab", {
get() {
- return this.browser.getBrowserForTab(this.tab);
+ if (this.browser.getBrowserForTab) {
+ return this.browser.getBrowserForTab(this.tab);
+ } else {
+ return this.browser.selectedBrowser;
+ }
}
});
/**
* The current frame ID is managed per browser element on desktop in
* case the ID needs to be refreshed. The currently selected window is
* identified within BrowserObject by a tab.
*/
@@ -3137,20 +3141,21 @@ BrowserObj.prototype.addTab = function(u
* If a window is provided, this BrowserObj's internal reference is updated
* before proceeding.
*/
BrowserObj.prototype.switchToTab = function(ind, win) {
if (win) {
this.window = win;
this.setBrowser(win);
}
-
- this.browser.selectTabAtIndex(ind);
+ if (this.browser.selectTabAtIndex) {
+ this.browser.selectTabAtIndex(ind);
+ this._browserWasRemote = this.browserForTab.isRemoteBrowser;
+ }
this.tab = this.browser.selectedTab;
- this._browserWasRemote = this.browserForTab.isRemoteBrowser;
this._hasRemotenessChange = false;
};
/**
* Registers a new frame, and sets its current frame id to this frame
* if it is not already assigned, and if a) we already have a session
* or b) we're starting a new session and it is the right start frame.
*