mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
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:
parent
2ef12d4a3e
commit
7d15bba78b
@ -67,7 +67,7 @@ browser.getTabBrowser = function (win) {
|
|||||||
* Creates a browsing context wrapper.
|
* Creates a browsing context wrapper.
|
||||||
*
|
*
|
||||||
* Browsing contexts handle interactions with the browser, according to
|
* Browsing contexts handle interactions with the browser, according to
|
||||||
* the current environment (desktop, B2G, Fennec, &c).
|
* the current environment (Firefox, Fennec).
|
||||||
*
|
*
|
||||||
* @param {nsIDOMWindow} win
|
* @param {nsIDOMWindow} win
|
||||||
* The window whose browser needs to be accessed.
|
* The window whose browser needs to be accessed.
|
||||||
@ -92,9 +92,6 @@ browser.Context = class {
|
|||||||
|
|
||||||
this.knownFrames = [];
|
this.knownFrames = [];
|
||||||
|
|
||||||
// Used in B2G to identify the homescreen content page
|
|
||||||
this.mainContentId = null;
|
|
||||||
|
|
||||||
// Used to set curFrameId upon new session
|
// Used to set curFrameId upon new session
|
||||||
this.newSession = true;
|
this.newSession = true;
|
||||||
|
|
||||||
@ -119,7 +116,6 @@ browser.Context = class {
|
|||||||
this.frameManager.addMessageManagerListeners(driver.mm);
|
this.frameManager.addMessageManagerListeners(driver.mm);
|
||||||
this.getIdForBrowser = driver.getIdForBrowser.bind(driver);
|
this.getIdForBrowser = driver.getIdForBrowser.bind(driver);
|
||||||
this.updateIdForBrowser = driver.updateIdForBrowser.bind(driver);
|
this.updateIdForBrowser = driver.updateIdForBrowser.bind(driver);
|
||||||
this._curFrameId = null;
|
|
||||||
this._browserWasRemote = null;
|
this._browserWasRemote = null;
|
||||||
this._hasRemotenessChange = false;
|
this._hasRemotenessChange = false;
|
||||||
}
|
}
|
||||||
@ -143,20 +139,12 @@ browser.Context = class {
|
|||||||
*/
|
*/
|
||||||
get curFrameId() {
|
get curFrameId() {
|
||||||
let rv = null;
|
let rv = null;
|
||||||
if (this.driver.appName == "B2G") {
|
if (this.tab) {
|
||||||
rv = this._curFrameId;
|
|
||||||
} else if (this.tab) {
|
|
||||||
rv = this.getIdForBrowser(this.contentBrowser);
|
rv = this.getIdForBrowser(this.contentBrowser);
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
set curFrameId(id) {
|
|
||||||
if (this.driver.appName != "Firefox") {
|
|
||||||
this._curFrameId = id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the current tabmodal UI object. According to the browser
|
* Retrieves the current tabmodal UI object. According to the browser
|
||||||
* associated with the currently selected tab.
|
* associated with the currently selected tab.
|
||||||
@ -314,11 +302,7 @@ browser.Context = class {
|
|||||||
|
|
||||||
if (target === this.contentBrowser) {
|
if (target === this.contentBrowser) {
|
||||||
this.updateIdForBrowser(this.contentBrowser, uid);
|
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.
|
* script. This function does the necessary bookkeeping.
|
||||||
*/
|
*/
|
||||||
hasRemotenessChange() {
|
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.
|
// and may not apply on Fennec.
|
||||||
if (this.driver.appName != "Firefox" ||
|
if (this.driver.appName != "Firefox" ||
|
||||||
this.tab === null ||
|
this.tab === null ||
|
||||||
|
@ -93,7 +93,7 @@ this.Context.fromString = function (s) {
|
|||||||
* object.
|
* object.
|
||||||
*
|
*
|
||||||
* @param {string} appName
|
* @param {string} appName
|
||||||
* Description of the product, for example "B2G" or "Firefox".
|
* Description of the product, for example "Firefox".
|
||||||
* @param {MarionetteServer} server
|
* @param {MarionetteServer} server
|
||||||
* The instance of Marionette server.
|
* The instance of Marionette server.
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,6 @@ this.GeckoDriver = function (appName, server) {
|
|||||||
this.mainFrame = null;
|
this.mainFrame = null;
|
||||||
// chrome iframe that currently has focus
|
// chrome iframe that currently has focus
|
||||||
this.curFrame = null;
|
this.curFrame = null;
|
||||||
this.mainContentFrameId = null;
|
|
||||||
this.mozBrowserClose = null;
|
this.mozBrowserClose = null;
|
||||||
this.currentFrameElement = null;
|
this.currentFrameElement = null;
|
||||||
// frame ID of the current remote frame, used for mozbrowserclose events
|
// frame ID of the current remote frame, used for mozbrowserclose events
|
||||||
@ -509,8 +508,7 @@ GeckoDriver.prototype.registerBrowser = function (id, be) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let reg = {};
|
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"
|
// 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
|
// tabbrowser, but accept things on Fennec (which doesn't have a
|
||||||
// xul:tabbrowser), and accept HTML iframes (because tests depend on it),
|
// 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);
|
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);
|
this.wins.set(reg.id, listenerWindow);
|
||||||
if (nullPrevious && (this.curBrowser.curFrameId !== null)) {
|
if (nullPrevious && (this.curBrowser.curFrameId !== null)) {
|
||||||
this.sendAsync(
|
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 () {
|
GeckoDriver.prototype.registerPromise = function () {
|
||||||
|
@ -394,13 +394,9 @@ function registerSelf() {
|
|||||||
|
|
||||||
if (register[0]) {
|
if (register[0]) {
|
||||||
let {id, remotenessChange} = register[0][0];
|
let {id, remotenessChange} = register[0][0];
|
||||||
capabilities = session.Capabilities.fromJSON(register[0][2]);
|
capabilities = session.Capabilities.fromJSON(register[0][1]);
|
||||||
listenerId = id;
|
listenerId = id;
|
||||||
if (typeof id != "undefined") {
|
if (typeof id != "undefined") {
|
||||||
// check if we're the main process
|
|
||||||
if (register[0][1]) {
|
|
||||||
addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame);
|
|
||||||
}
|
|
||||||
startListeners();
|
startListeners();
|
||||||
let rv = {};
|
let rv = {};
|
||||||
if (remotenessChange) {
|
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
|
// Eventually we will not have a closure for every single command, but
|
||||||
// use a generic dispatch for all listener commands.
|
// use a generic dispatch for all listener commands.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user