Bug 1318351 - Remove mainContent and related code used by B2G. r=ato

MozReview-Commit-ID: 1BZY5VvCMZ9

--HG--
extra : rebase_source : f306e0509b2403496dd60fa19ca28abe2e198cdb
This commit is contained in:
Henrik Skupin 2017-05-04 11:45:08 +02:00
parent 2ef12d4a3e
commit 7d15bba78b
3 changed files with 7 additions and 64 deletions

View File

@ -67,7 +67,7 @@ browser.getTabBrowser = function (win) {
* Creates a browsing context wrapper.
*
* Browsing contexts handle interactions with the browser, according to
* the current environment (desktop, B2G, Fennec, &c).
* the current environment (Firefox, Fennec).
*
* @param {nsIDOMWindow} win
* The window whose browser needs to be accessed.
@ -92,9 +92,6 @@ browser.Context = class {
this.knownFrames = [];
// Used in B2G to identify the homescreen content page
this.mainContentId = null;
// Used to set curFrameId upon new session
this.newSession = true;
@ -119,7 +116,6 @@ browser.Context = class {
this.frameManager.addMessageManagerListeners(driver.mm);
this.getIdForBrowser = driver.getIdForBrowser.bind(driver);
this.updateIdForBrowser = driver.updateIdForBrowser.bind(driver);
this._curFrameId = null;
this._browserWasRemote = null;
this._hasRemotenessChange = false;
}
@ -143,20 +139,12 @@ browser.Context = class {
*/
get curFrameId() {
let rv = null;
if (this.driver.appName == "B2G") {
rv = this._curFrameId;
} else if (this.tab) {
if (this.tab) {
rv = this.getIdForBrowser(this.contentBrowser);
}
return rv;
}
set curFrameId(id) {
if (this.driver.appName != "Firefox") {
this._curFrameId = id;
}
}
/**
* Retrieves the current tabmodal UI object. According to the browser
* associated with the currently selected tab.
@ -314,11 +302,7 @@ browser.Context = class {
if (target === this.contentBrowser) {
this.updateIdForBrowser(this.contentBrowser, uid);
this.mainContentId = uid;
}
} else {
this._curFrameId = uid;
this.mainContentId = uid;
}
}
@ -333,7 +317,7 @@ browser.Context = class {
* script. This function does the necessary bookkeeping.
*/
hasRemotenessChange() {
// None of these checks are relevant on b2g or if we don't have a tab yet,
// None of these checks are relevant if we don't have a tab yet,
// and may not apply on Fennec.
if (this.driver.appName != "Firefox" ||
this.tab === null ||

View File

@ -93,7 +93,7 @@ this.Context.fromString = function (s) {
* object.
*
* @param {string} appName
* Description of the product, for example "B2G" or "Firefox".
* Description of the product, for example "Firefox".
* @param {MarionetteServer} server
* The instance of Marionette server.
*/
@ -110,7 +110,6 @@ this.GeckoDriver = function (appName, server) {
this.mainFrame = null;
// chrome iframe that currently has focus
this.curFrame = null;
this.mainContentFrameId = null;
this.mozBrowserClose = null;
this.currentFrameElement = null;
// frame ID of the current remote frame, used for mozbrowserclose events
@ -509,8 +508,7 @@ GeckoDriver.prototype.registerBrowser = function (id, be) {
}
let reg = {};
// this will be sent to tell the content process if it is the main content
let mainContent = this.curBrowser.mainContentId === null;
// We want to ignore frames that are XUL browsers that aren't in the "main"
// tabbrowser, but accept things on Fennec (which doesn't have a
// xul:tabbrowser), and accept HTML iframes (because tests depend on it),
@ -523,12 +521,6 @@ GeckoDriver.prototype.registerBrowser = function (id, be) {
reg.remotenessChange = this.curBrowser.register(id, be);
}
// set to true if we updated mainContentId
mainContent = mainContent && this.curBrowser.mainContentId !== null;
if (mainContent) {
this.mainContentFrameId = this.curBrowser.curFrameId;
}
this.wins.set(reg.id, listenerWindow);
if (nullPrevious && (this.curBrowser.curFrameId !== null)) {
this.sendAsync(
@ -540,7 +532,7 @@ GeckoDriver.prototype.registerBrowser = function (id, be) {
}
}
return [reg, mainContent, this.capabilities.toJSON()];
return [reg, this.capabilities.toJSON()];
};
GeckoDriver.prototype.registerPromise = function () {

View File

@ -394,13 +394,9 @@ function registerSelf() {
if (register[0]) {
let {id, remotenessChange} = register[0][0];
capabilities = session.Capabilities.fromJSON(register[0][2]);
capabilities = session.Capabilities.fromJSON(register[0][1]);
listenerId = id;
if (typeof id != "undefined") {
// check if we're the main process
if (register[0][1]) {
addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame);
}
startListeners();
let rv = {};
if (remotenessChange) {
@ -411,35 +407,6 @@ function registerSelf() {
}
}
function emitTouchEventForIFrame(message) {
message = message.json;
let identifier = legacyactions.nextTouchId;
let domWindowUtils = curContainer.frame.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var ratio = domWindowUtils.screenPixelsPerCSSPixel;
var typeForUtils;
switch (message.type) {
case 'touchstart':
typeForUtils = domWindowUtils.TOUCH_CONTACT;
break;
case 'touchend':
typeForUtils = domWindowUtils.TOUCH_REMOVE;
break;
case 'touchcancel':
typeForUtils = domWindowUtils.TOUCH_CANCEL;
break;
case 'touchmove':
typeForUtils = domWindowUtils.TOUCH_CONTACT;
break;
}
domWindowUtils.sendNativeTouchPoint(identifier, typeForUtils,
Math.round(message.screenX * ratio), Math.round(message.screenY * ratio),
message.force, 90);
}
// Eventually we will not have a closure for every single command, but
// use a generic dispatch for all listener commands.
//