зеркало из https://github.com/mozilla/gecko-dev.git
Bug 583976. Part 2 - Remove manual focus activation in mobile and add a test. r=stechz
This commit is contained in:
Родитель
3a4ec1255f
Коммит
d50cd925d5
|
@ -1836,13 +1836,8 @@ const ContentTouchHandler = {
|
|||
},
|
||||
|
||||
tapDown: function tapDown(aX, aY) {
|
||||
// Ensure that the content process has gets an activate event
|
||||
let browser = getBrowser();
|
||||
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
|
||||
browser.focus();
|
||||
try {
|
||||
fl.activateRemoteFrame();
|
||||
} catch (e) {}
|
||||
|
||||
// if the page might capture touch events, we give it the option
|
||||
this.updateCanCancel(aX, aY);
|
||||
|
@ -2964,12 +2959,7 @@ Tab.prototype = {
|
|||
Elements.browsers.selectedPanel = notification;
|
||||
browser.active = true;
|
||||
document.getElementById("tabs").selectedTab = this._chromeTab;
|
||||
|
||||
// Ensure that the content process has gets an activate event
|
||||
try {
|
||||
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
|
||||
fl.activateRemoteFrame();
|
||||
} catch (e) {}
|
||||
browser.focus();
|
||||
} else {
|
||||
browser.messageManager.sendAsyncMessage("Browser:Blur", { });
|
||||
browser.setAttribute("type", "content");
|
||||
|
|
|
@ -51,6 +51,7 @@ _BROWSER_FILES = \
|
|||
remote_autocomplete.js \
|
||||
remote_contentpopup.js \
|
||||
remote_head.js \
|
||||
remote_focus.js \
|
||||
remote_forms.js \
|
||||
remote_formsZoom.js \
|
||||
remote_vkb.js \
|
||||
|
@ -64,6 +65,8 @@ _BROWSER_FILES = \
|
|||
browser_contacts.js \
|
||||
browser_dragger.js \
|
||||
browser_find.js \
|
||||
browser_focus.html \
|
||||
browser_focus.js \
|
||||
browser_forms.html \
|
||||
$(warning browser_forms.js disabled due to failures) \
|
||||
browser_formsZoom.html \
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Focus/Activate test</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,52 @@
|
|||
"use strict";
|
||||
let testURL = chromeRoot + "browser_focus.html";
|
||||
let newTab = null;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
try {
|
||||
messageManager.sendAsyncMessage("Test:E10SFocusTestFinished", {});
|
||||
Browser.closeTab(newTab);
|
||||
} finally {
|
||||
newTab = null;
|
||||
}
|
||||
});
|
||||
|
||||
messageManager.addMessageListener("pageshow", function listener(aMessage) {
|
||||
if (newTab && newTab.browser.currentURI.spec != "about:blank") {
|
||||
messageManager.removeMessageListener("pageshow", listener);
|
||||
setTimeout(onTabLoaded, 0);
|
||||
}
|
||||
});
|
||||
|
||||
newTab = Browser.addTab(testURL, true);
|
||||
}
|
||||
|
||||
function onTabLoaded() {
|
||||
// ensure that the <browser> is not already focused
|
||||
newTab.browser.blur();
|
||||
messageManager.loadFrameScript(chromeRoot + "remote_focus.js", false);
|
||||
testFocus();
|
||||
}
|
||||
|
||||
function testFocus() {
|
||||
onMessageOnce(messageManager, "Test:E10SFocusReceived", function() {
|
||||
ok("Focus in <browser remote> triggered activateRemoteFrame as expected");
|
||||
testBlur();
|
||||
});
|
||||
newTab.browser.focus();
|
||||
}
|
||||
|
||||
function testBlur() {
|
||||
onMessageOnce(messageManager, "Test:E10SBlurReceived", function() {
|
||||
ok("Blur in <browser remote> triggerered deactivateRemoteFrame as expected");
|
||||
endTest();
|
||||
});
|
||||
newTab.browser.blur();
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
finish();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
function focusReceived() {
|
||||
sendAsyncMessage("Test:E10SFocusReceived");
|
||||
}
|
||||
|
||||
function blurReceived() {
|
||||
sendAsyncMessage("Test:E10SBlurReceived");
|
||||
}
|
||||
|
||||
addEventListener("focus", focusReceived, true);
|
||||
addEventListener("blur", blurReceived, true);
|
||||
|
||||
addMessageListener("Test:E10SFocusTestFinished", function testFinished() {
|
||||
removeEventListener("focus", focusReceived, true);
|
||||
removeEventListener("blur", blurReceived, true);
|
||||
removeMessageListener("Test:E10SFocusTestFinished", testFinished);
|
||||
});
|
Загрузка…
Ссылка в новой задаче