Bug 1379508: Part 3 - Support <select> popups in OOP popup browsers. r=zombie

MozReview-Commit-ID: BuAjyqg1aja

--HG--
extra : rebase_source : 03b7368659ccdb39ebedf7aeb6a1902b6abe5808
extra : amend_source : 53eadbc91f2468b8d116cf0e5bf457fd7107bfb8
extra : absorb_source : 379f778671c868a08f560663f31e6248872c7989
This commit is contained in:
Kris Maglione 2017-07-13 15:47:52 -07:00
Родитель 2cdd464241
Коммит 4b46d3f00d
3 изменённых файлов: 94 добавлений и 0 удалений

Просмотреть файл

@ -228,6 +228,7 @@ class BasePopup {
browser.setAttribute("tooltip", "aHTMLTooltip");
browser.setAttribute("contextmenu", "contentAreaContextMenu");
browser.setAttribute("autocompletepopup", "PopupAutoComplete");
browser.setAttribute("selectmenulist", "ContentSelectDropdown");
browser.sameProcessAsFrameLoader = this.extension.groupFrameLoader;
if (this.extension.remote) {

Просмотреть файл

@ -9,4 +9,8 @@ install-to-subdir = test-oop-extensions
tags = webextensions remote-webextensions
skip-if = !e10s
[browser_ext_popup_select.js]
support-files =
head.js
[include:browser-common.ini]

Просмотреть файл

@ -0,0 +1,89 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(async function testPopupSelectPopup() {
let extension = ExtensionTestUtils.loadExtension({
background() {
browser.tabs.query({active: true, currentWindow: true}, tabs => {
browser.pageAction.show(tabs[0].id);
});
},
manifest: {
"browser_action": {
"default_popup": "popup.html",
"browser_style": false,
},
"page_action": {
"default_popup": "popup.html",
"browser_style": false,
},
},
files: {
"popup.html": `<!DOCTYPE html>
<html>
<head><meta charset="utf-8"></head>
<body style="width: 300px; height: 300px;">
<div style="text-align: center">
<select id="select">
<option>Foo</option>
<option>Bar</option>
<option>Baz</option>
</select>
</div>
</body>
</html>`,
},
});
await extension.startup();
let selectPopup = document.getElementById("ContentSelectDropdown").firstChild;
async function testPanel(browser) {
let popupPromise = promisePopupShown(selectPopup);
BrowserTestUtils.synthesizeMouseAtCenter("#select", {}, browser);
await popupPromise;
let elemRect = await ContentTask.spawn(browser, null, async function() {
let elem = content.document.getElementById("select");
let r = elem.getBoundingClientRect();
return {left: r.left, bottom: r.bottom};
});
let {boxObject} = browser;
let popupRect = selectPopup.getOuterScreenRect();
is(Math.floor(boxObject.screenX + elemRect.left), popupRect.left,
"Select popup has the correct x origin");
is(Math.floor(boxObject.screenY + elemRect.bottom), popupRect.top,
"Select popup has the correct y origin");
}
{
info("Test browserAction popup");
clickBrowserAction(extension);
let browser = await awaitExtensionPanel(extension);
await testPanel(browser);
await closeBrowserAction(extension);
}
{
info("Test pageAction popup");
clickPageAction(extension);
let browser = await awaitExtensionPanel(extension);
await testPanel(browser);
await closePageAction(extension);
}
await extension.unload();
});