mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound. a=merge
This commit is contained in:
commit
73462444fb
@ -88,7 +88,6 @@ devtools/client/framework/**
|
||||
# included in the ignore list.
|
||||
devtools/client/inspector/computed/**
|
||||
devtools/client/inspector/fonts/**
|
||||
devtools/client/inspector/markup/test/**
|
||||
devtools/client/inspector/shared/test/**
|
||||
devtools/client/inspector/test/**
|
||||
devtools/client/inspector/*.js
|
||||
@ -129,7 +128,7 @@ devtools/client/webaudioeditor/lib/dagre-d3.js
|
||||
devtools/client/sourceeditor/codemirror/*.js
|
||||
devtools/client/sourceeditor/codemirror/**/*.js
|
||||
devtools/client/sourceeditor/test/codemirror/*
|
||||
devtools/client/markupview/test/lib_*
|
||||
devtools/client/inspector/markup/test/lib_*
|
||||
|
||||
# mobile/android/ exclusions
|
||||
mobile/android/chrome/content
|
||||
|
@ -1593,9 +1593,11 @@ pref("browser.tabs.crashReporting.includeURL", false);
|
||||
pref("browser.tabs.crashReporting.emailMe", false);
|
||||
pref("browser.tabs.crashReporting.email", "");
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
#ifndef MOZ_MULET
|
||||
pref("layers.async-pan-zoom.enabled", true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Enable e10s add-on interposition by default.
|
||||
pref("extensions.interposition.enabled", true);
|
||||
|
@ -110,6 +110,15 @@ var healthReportWrapper = {
|
||||
},
|
||||
|
||||
handleRemoteCommand: function (evt) {
|
||||
// Do an origin check to harden against the frame content being loaded from unexpected locations.
|
||||
let allowedPrincipal = Services.scriptSecurityManager.getCodebasePrincipal(this._getReportURI());
|
||||
let targetPrincipal = evt.target.nodePrincipal;
|
||||
if (!allowedPrincipal.equals(targetPrincipal)) {
|
||||
Cu.reportError(`Origin check failed for message "${evt.detail.command}": ` +
|
||||
`target origin is "${targetPrincipal.origin}", expected "${allowedPrincipal.origin}"`);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (evt.detail.command) {
|
||||
case "DisableDataSubmission":
|
||||
this.setDataSubmission(false);
|
||||
|
@ -16,19 +16,19 @@ add_task(function* test_notificationReplace() {
|
||||
let promiseCloseEvent = ContentTaskUtils.waitForEvent(notification, "close");
|
||||
|
||||
let showEvent = yield ContentTaskUtils.waitForEvent(notification, "show");
|
||||
is(showEvent.target.body, "Test body 1", "Showed tagged notification");
|
||||
Assert.equal(showEvent.target.body, "Test body 1", "Showed tagged notification");
|
||||
|
||||
let newNotification = win.showNotification2();
|
||||
let newShowEvent = yield ContentTaskUtils.waitForEvent(newNotification, "show");
|
||||
is(newShowEvent.target.body, "Test body 2", "Showed new notification with same tag");
|
||||
Assert.equal(newShowEvent.target.body, "Test body 2", "Showed new notification with same tag");
|
||||
|
||||
let closeEvent = yield promiseCloseEvent;
|
||||
is(closeEvent.target.body, "Test body 1", "Closed previous tagged notification");
|
||||
Assert.equal(closeEvent.target.body, "Test body 1", "Closed previous tagged notification");
|
||||
|
||||
let promiseNewCloseEvent = ContentTaskUtils.waitForEvent(newNotification, "close");
|
||||
newNotification.close();
|
||||
let newCloseEvent = yield promiseNewCloseEvent;
|
||||
is(newCloseEvent.target.body, "Test body 2", "Closed new notification");
|
||||
Assert.equal(newCloseEvent.target.body, "Test body 2", "Closed new notification");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -252,7 +252,7 @@ add_chat_task(function* testFocusedElement() {
|
||||
yield promise;
|
||||
|
||||
yield ContentTask.spawn(chat.content, null, function* () {
|
||||
is(content.document.activeElement.getAttribute("id"), "input2",
|
||||
Assert.equal(content.document.activeElement.getAttribute("id"), "input2",
|
||||
"correct input field still has focus");
|
||||
});
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ add_chat_task(function* testTearoffChat() {
|
||||
|
||||
yield ContentTask.spawn(chatbox.content, null, function* () {
|
||||
let div = content.document.getElementById("testdiv");
|
||||
is(div.getAttribute("test"), "1", "docshell should have been swapped");
|
||||
Assert.equal(div.getAttribute("test"), "1", "docshell should have been swapped");
|
||||
div.setAttribute("test", "2");
|
||||
});
|
||||
|
||||
@ -84,7 +84,7 @@ add_chat_task(function* testTearoffChat() {
|
||||
|
||||
yield ContentTask.spawn(chatbox.content, null, function* () {
|
||||
let div = content.document.getElementById("testdiv");
|
||||
is(div.getAttribute("test"), "2", "docshell should have been swapped");
|
||||
Assert.equal(div.getAttribute("test"), "2", "docshell should have been swapped");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -5,28 +5,25 @@
|
||||
add_task(function* () {
|
||||
let rooturi = "https://example.com/browser/toolkit/modules/tests/browser/";
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, rooturi + "metadata_simple.html");
|
||||
let result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return PageMetadata.getData(content.document);
|
||||
});
|
||||
// result should have description
|
||||
is(result.url, rooturi + "metadata_simple.html", "metadata url is correct");
|
||||
is(result.title, "Test Title", "metadata title is correct");
|
||||
is(result.description, "A very simple test page", "description is correct");
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { rooturi }, function* (args) {
|
||||
let result = PageMetadata.getData(content.document);
|
||||
// Result should have description.
|
||||
Assert.equal(result.url, args.rooturi + "metadata_simple.html", "metadata url is correct");
|
||||
Assert.equal(result.title, "Test Title", "metadata title is correct");
|
||||
Assert.equal(result.description, "A very simple test page", "description is correct");
|
||||
|
||||
result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.history.pushState({}, "2", "2.html");
|
||||
return PageMetadata.getData(content.document);
|
||||
});
|
||||
// result should not have description
|
||||
is(result.url, rooturi + "2.html", "metadata url is correct");
|
||||
is(result.title, "Test Title", "metadata title is correct");
|
||||
ok(!result.description, "description is undefined");
|
||||
result = PageMetadata.getData(content.document);
|
||||
// Result should not have description.
|
||||
Assert.equal(result.url, args.rooturi + "2.html", "metadata url is correct");
|
||||
Assert.equal(result.title, "Test Title", "metadata title is correct");
|
||||
Assert.ok(!result.description, "description is undefined");
|
||||
|
||||
let documentURI = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return content.document.documentURI;
|
||||
Assert.equal(content.document.documentURI, args.rooturi + "2.html",
|
||||
"content.document has correct url");
|
||||
});
|
||||
|
||||
is(gBrowser.currentURI.spec, rooturi + "2.html", "gBrowser has correct url");
|
||||
is(documentURI, rooturi + "2.html", "content.document has correct url");
|
||||
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ add_task(function* () {
|
||||
yield BrowserTestUtils.openNewForegroundTab(newWindow.gBrowser, "about:home");
|
||||
|
||||
yield ContentTask.spawn(newWindow.gBrowser.selectedBrowser, {}, function* () {
|
||||
is(content.document.body.getAttribute("narrow"), "true", "narrow mode");
|
||||
Assert.equal(content.document.body.getAttribute("narrow"), "true", "narrow mode");
|
||||
});
|
||||
|
||||
resizedPromise = BrowserTestUtils.waitForContentEvent(newWindow.gBrowser.selectedBrowser, "resize");
|
||||
@ -21,7 +21,7 @@ add_task(function* () {
|
||||
yield resizedPromise;
|
||||
|
||||
yield ContentTask.spawn(newWindow.gBrowser.selectedBrowser, {}, function* () {
|
||||
is(content.document.body.hasAttribute("narrow"), false, "non-narrow mode");
|
||||
Assert.equal(content.document.body.hasAttribute("narrow"), false, "non-narrow mode");
|
||||
});
|
||||
|
||||
yield BrowserTestUtils.closeWindow(newWindow);
|
||||
|
@ -29,12 +29,12 @@ add_task(function* test_without_dump() {
|
||||
|
||||
yield ContentTask.spawn(browser, null, function*() {
|
||||
let doc = content.document;
|
||||
ok(!doc.documentElement.classList.contains("crashDumpAvailable"),
|
||||
Assert.ok(!doc.documentElement.classList.contains("crashDumpAvailable"),
|
||||
"doesn't have crash dump");
|
||||
|
||||
let container = doc.getElementById("crash-reporter-container");
|
||||
ok(container, "has crash-reporter-container");
|
||||
ok(container.hidden, "crash-reporter-container is hidden");
|
||||
Assert.ok(container, "has crash-reporter-container");
|
||||
Assert.ok(container.hidden, "crash-reporter-container is hidden");
|
||||
|
||||
doc.getElementById("closeTab").click();
|
||||
});
|
||||
|
@ -13,28 +13,22 @@ add_task(function* () {
|
||||
gBrowser.loadURI("https://nocert.example.com/");
|
||||
yield promise;
|
||||
|
||||
let uri = yield remote(() => {
|
||||
return content.document.documentURI;
|
||||
yield remote(() => {
|
||||
// Confirm that we are displaying the contributed error page, not the default
|
||||
let uri = content.document.documentURI;
|
||||
Assert.ok(uri.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
|
||||
});
|
||||
|
||||
// Confirm that we are displaying the contributed error page, not the default
|
||||
ok(uri.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
|
||||
|
||||
let advancedDiv, advancedDivVisibility, technicalDivCollapsed;
|
||||
|
||||
[advancedDiv, advancedDivVisibility] = yield remote(() => {
|
||||
yield remote(() => {
|
||||
let div = content.document.getElementById("advancedPanel");
|
||||
if (div) {
|
||||
return [true, div.ownerDocument.defaultView.getComputedStyle(div, "").visibility];
|
||||
} else {
|
||||
return [null, null];
|
||||
}
|
||||
// Confirm that the expert section is collapsed
|
||||
Assert.ok(div, "Advanced content div should exist");
|
||||
Assert.equal(div.ownerDocument.defaultView.getComputedStyle(div, "").visibility,
|
||||
"hidden", "Advanced content should not be visible by default");
|
||||
});
|
||||
|
||||
// Confirm that the expert section is collapsed
|
||||
ok(advancedDiv, "Advanced content div should exist");
|
||||
is(advancedDivVisibility, "hidden", "Advanced content should not be visible by default");
|
||||
|
||||
// Tweak the expert mode pref
|
||||
gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
|
||||
|
||||
@ -44,18 +38,13 @@ add_task(function* () {
|
||||
gBrowser.reload();
|
||||
yield promise;
|
||||
|
||||
[advancedDiv, advancedDivVisibility] = yield remote(() => {
|
||||
yield remote(() => {
|
||||
let div = content.document.getElementById("advancedPanel");
|
||||
if (div) {
|
||||
return [true, div.ownerDocument.defaultView.getComputedStyle(div, "").visibility];
|
||||
} else {
|
||||
return [null, null];
|
||||
}
|
||||
Assert.ok(div, "Advanced content div should exist");
|
||||
Assert.equal(div.ownerDocument.defaultView.getComputedStyle(div, "").visibility,
|
||||
"visible", "Advanced content should be visible by default");
|
||||
});
|
||||
|
||||
ok(advancedDiv, "Advanced content div should exist");
|
||||
is(advancedDivVisibility, "visible", "Advanced content should be visible by default");
|
||||
|
||||
// Clean up
|
||||
gBrowser.removeCurrentTab();
|
||||
if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
|
||||
|
@ -73,20 +73,18 @@ function* blurChildElement(browser)
|
||||
|
||||
function* checkChildFocus(browser, message)
|
||||
{
|
||||
let [activeElement, validMsg] =
|
||||
yield ContentTask.spawn(browser, message, function* (msg) {
|
||||
var focused = content.document.activeElement == content.document.getElementById('i');
|
||||
yield ContentTask.spawn(browser, [message, testId], function* (args) {
|
||||
let [msg, testId] = args;
|
||||
var focused = content.document.activeElement == content.document.getElementById('i');
|
||||
|
||||
var validMsg = true;
|
||||
if (msg) {
|
||||
validMsg = (msg == content.document.getElementById('i').validationMessage);
|
||||
}
|
||||
var validMsg = true;
|
||||
if (msg) {
|
||||
validMsg = (msg == content.document.getElementById('i').validationMessage);
|
||||
}
|
||||
|
||||
return [focused, validMsg];
|
||||
Assert.equal(focused, true, "Test " + testId + " First invalid element should be focused");
|
||||
Assert.equal(validMsg, true, "Test " + testId + " The panel should show the message from validationMessage");
|
||||
});
|
||||
|
||||
is(activeElement, true, "Test " + testId + " First invalid element should be focused");
|
||||
is(validMsg, true, "Test " + testId + " The panel should show the message from validationMessage");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,11 +22,11 @@ add_task(function* () {
|
||||
});
|
||||
yield popupShownPromise;
|
||||
|
||||
let activeElement = yield ContentTask.spawn(browser, {}, function* () {
|
||||
yield ContentTask.spawn(browser, {}, function* () {
|
||||
let childdoc = content.document.getElementsByTagName('iframe')[0].contentDocument;
|
||||
return childdoc.activeElement == childdoc.getElementById('i');
|
||||
Assert.equal(childdoc.activeElement, childdoc.getElementById("i"),
|
||||
"First invalid element should be focused");
|
||||
});
|
||||
is(activeElement, true, "First invalid element should be focused");
|
||||
|
||||
ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open',
|
||||
"The invalid form popup should be shown");
|
||||
|
@ -20,9 +20,9 @@ function test () {
|
||||
function testLink(link, name, next) {
|
||||
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, null, () => {
|
||||
return content.document.getElementById("unload-flag").textContent;
|
||||
}).then(unloadFlag => {
|
||||
is(unloadFlag, "Okay", "beforeunload shouldn't have fired");
|
||||
Assert.equal(content.document.getElementById("unload-flag").textContent,
|
||||
"Okay", "beforeunload shouldn't have fired");
|
||||
}).then(() => {
|
||||
is(win.document.getElementById("location").value, name, "file name should match");
|
||||
win.close();
|
||||
next();
|
||||
|
@ -24,8 +24,9 @@ add_task(function* ()
|
||||
});
|
||||
},
|
||||
verify: function () {
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
|
||||
return [content.document.body.textContent, "no domain was inherited for view background image"];
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
|
||||
Assert.ok(!content.document.body.textContent,
|
||||
"no domain was inherited for view background image");
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -44,8 +45,9 @@ add_task(function* ()
|
||||
});
|
||||
},
|
||||
verify: function () {
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
|
||||
return [content.document.body.textContent, "no domain was inherited for view image"];
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
|
||||
Assert.ok(!content.document.body.textContent,
|
||||
"no domain was inherited for view image");
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -70,8 +72,9 @@ add_task(function* ()
|
||||
});
|
||||
},
|
||||
verify: function () {
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, { writeDomainURL: writeDomainURL }, function* (arg) {
|
||||
return [content.document.body.textContent, "no domain was inherited for 'show only this frame'"];
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* (arg) {
|
||||
Assert.ok(!content.document.body.textContent,
|
||||
"no domain was inherited for 'show only this frame'");
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -96,8 +99,7 @@ add_task(function* ()
|
||||
document.getElementById(commandToRun).click();
|
||||
yield loadedAfterCommandPromise;
|
||||
|
||||
let result = yield test.verify();
|
||||
ok(!result[0], result[1]);
|
||||
yield test.verify();
|
||||
|
||||
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
|
||||
contentAreaContextMenu.hidePopup();
|
||||
|
@ -1,7 +1,8 @@
|
||||
// This test is used to check copy and paste in editable areas to ensure that non-text
|
||||
// types (html and images) are copied to and pasted from the clipboard properly.
|
||||
|
||||
var testPage = "<body style='margin: 0'><img id='img' tabindex='1' src='http://example.org/browser/browser/base/content/test/general/moz.png'>" +
|
||||
var testPage = "<body style='margin: 0'>" +
|
||||
" <img id='img' tabindex='1' src='http://example.org/browser/browser/base/content/test/general/moz.png'>" +
|
||||
" <div id='main' contenteditable='true'>Test <b>Bold</b> After Text</div>" +
|
||||
"</body>";
|
||||
|
||||
@ -23,8 +24,7 @@ add_task(function*() {
|
||||
const htmlPrefix = (navigator.platform.indexOf("Win") >= 0) ? "<html><body>\n<!--StartFragment-->" : "";
|
||||
const htmlPostfix = (navigator.platform.indexOf("Win") >= 0) ? "<!--EndFragment-->\n</body>\n</html>" : "";
|
||||
|
||||
let results = yield ContentTask.spawn(browser, { modifier: modifier, htmlPrefix: htmlPrefix, htmlPostfix: htmlPostfix },
|
||||
function* (arg) {
|
||||
yield ContentTask.spawn(browser, { modifier, htmlPrefix, htmlPostfix }, function* (arg) {
|
||||
var doc = content.document;
|
||||
var main = doc.getElementById("main");
|
||||
main.focus();
|
||||
@ -33,17 +33,11 @@ add_task(function*() {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
|
||||
const modifier = arg.modifier;
|
||||
function sendKey(key)
|
||||
{
|
||||
if (utils.sendKeyEvent("keydown", key, 0, modifier)) {
|
||||
utils.sendKeyEvent("keypress", key, key.charCodeAt(0), modifier);
|
||||
}
|
||||
utils.sendKeyEvent("keyup", key, 0, modifier);
|
||||
}
|
||||
|
||||
let results = [];
|
||||
function is(l, r, v) {
|
||||
results.push(((l === r) ? "PASSED" : "FAILED") + " got: " + l + " expected: " + r + " - " + v);
|
||||
function sendKey(key) {
|
||||
if (utils.sendKeyEvent("keydown", key, 0, modifier)) {
|
||||
utils.sendKeyEvent("keypress", key, key.charCodeAt(0), modifier);
|
||||
}
|
||||
utils.sendKeyEvent("keyup", key, 0, modifier);
|
||||
}
|
||||
|
||||
// Select an area of the text.
|
||||
@ -59,7 +53,7 @@ add_task(function*() {
|
||||
addEventListener("copy", function copyEvent(event) {
|
||||
removeEventListener("copy", copyEvent, true);
|
||||
// The data is empty as the selection is copied during the event default phase.
|
||||
is(event.clipboardData.mozItemCount, 0, "Zero items on clipboard");
|
||||
Assert.equal(event.clipboardData.mozItemCount, 0, "Zero items on clipboard");
|
||||
resolve();
|
||||
}, true)
|
||||
|
||||
@ -72,18 +66,19 @@ add_task(function*() {
|
||||
addEventListener("paste", function copyEvent(event) {
|
||||
removeEventListener("paste", copyEvent, true);
|
||||
let clipboardData = event.clipboardData;
|
||||
is(clipboardData.mozItemCount, 1, "One item on clipboard");
|
||||
is(clipboardData.types.length, 2, "Two types on clipboard");
|
||||
is(clipboardData.types[0], "text/html", "text/html on clipboard");
|
||||
is(clipboardData.types[1], "text/plain", "text/plain on clipboard");
|
||||
is(clipboardData.getData("text/html"), arg.htmlPrefix + "t <b>Bold</b>" + arg.htmlPostfix, "text/html value");
|
||||
is(clipboardData.getData("text/plain"), "t Bold", "text/plain value");
|
||||
Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard");
|
||||
Assert.equal(clipboardData.types.length, 2, "Two types on clipboard");
|
||||
Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard");
|
||||
Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard");
|
||||
Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
|
||||
"t <b>Bold</b>" + arg.htmlPostfix, "text/html value");
|
||||
Assert.equal(clipboardData.getData("text/plain"), "t Bold", "text/plain value");
|
||||
resolve();
|
||||
}, true)
|
||||
sendKey("v");
|
||||
});
|
||||
|
||||
is(main.innerHTML, "Test <b>Bold</b> After Textt <b>Bold</b>", "Copy and paste html");
|
||||
Assert.equal(main.innerHTML, "Test <b>Bold</b> After Textt <b>Bold</b>", "Copy and paste html");
|
||||
|
||||
selection.modify("extend", "left", "word");
|
||||
selection.modify("extend", "left", "word");
|
||||
@ -107,27 +102,22 @@ add_task(function*() {
|
||||
addEventListener("paste", function copyEvent(event) {
|
||||
removeEventListener("paste", copyEvent, true);
|
||||
let clipboardData = event.clipboardData;
|
||||
is(clipboardData.mozItemCount, 1, "One item on clipboard 2");
|
||||
is(clipboardData.types.length, 2, "Two types on clipboard 2");
|
||||
is(clipboardData.types[0], "text/html", "text/html on clipboard 2");
|
||||
is(clipboardData.types[1], "text/plain", "text/plain on clipboard 2");
|
||||
is(clipboardData.getData("text/html"), arg.htmlPrefix + "<i>Italic</i> " + arg.htmlPostfix, "text/html value 2");
|
||||
is(clipboardData.getData("text/plain"), "Some text", "text/plain value 2");
|
||||
Assert.equal(clipboardData.mozItemCount, 1, "One item on clipboard 2");
|
||||
Assert.equal(clipboardData.types.length, 2, "Two types on clipboard 2");
|
||||
Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard 2");
|
||||
Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard 2");
|
||||
Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
|
||||
"<i>Italic</i> " + arg.htmlPostfix, "text/html value 2");
|
||||
Assert.equal(clipboardData.getData("text/plain"), "Some text", "text/plain value 2");
|
||||
resolve();
|
||||
}, true)
|
||||
sendKey("v");
|
||||
});
|
||||
|
||||
is(main.innerHTML, "<i>Italic</i> Test <b>Bold</b> After<b></b>", "Copy and paste html 2");
|
||||
|
||||
return results;
|
||||
Assert.equal(main.innerHTML, "<i>Italic</i> Test <b>Bold</b> After<b></b>",
|
||||
"Copy and paste html 2");
|
||||
});
|
||||
|
||||
is(results.length, 15, "Correct number of results");
|
||||
for (var t = 0; t < results.length; t++) {
|
||||
ok(results[t].startsWith("PASSED"), results[t]);
|
||||
}
|
||||
|
||||
// Next, check that the Copy Image command works.
|
||||
|
||||
// The context menu needs to be opened to properly initialize for the copy
|
||||
@ -145,8 +135,7 @@ add_task(function*() {
|
||||
// Focus the content again
|
||||
yield SimpleTest.promiseFocus(browser.contentWindowAsCPOW);
|
||||
|
||||
let expectedContent = yield ContentTask.spawn(browser, { modifier: modifier, htmlPrefix: htmlPrefix, htmlPostfix: htmlPostfix },
|
||||
function* (arg) {
|
||||
yield ContentTask.spawn(browser, { modifier, htmlPrefix, htmlPostfix }, function* (arg) {
|
||||
var doc = content.document;
|
||||
var main = doc.getElementById("main");
|
||||
main.focus();
|
||||
@ -176,14 +165,12 @@ add_task(function*() {
|
||||
utils.sendKeyEvent("keyup", "v", 0, modifier);
|
||||
});
|
||||
|
||||
// Return the new content which should now include an image.
|
||||
return main.innerHTML;
|
||||
// The new content should now include an image.
|
||||
Assert.equal(main.innerHTML, '<i>Italic</i> <img id="img" tabindex="1" ' +
|
||||
'src="http://example.org/browser/browser/base/content/test/general/moz.png">' +
|
||||
'Test <b>Bold</b> After<b></b>', "Paste after copy image");
|
||||
});
|
||||
|
||||
is(expectedContent, '<i>Italic</i> <img id="img" tabindex="1" ' +
|
||||
'src="http://example.org/browser/browser/base/content/test/general/moz.png">' +
|
||||
'Test <b>Bold</b> After<b></b>', "Paste after copy image");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
|
@ -425,7 +425,7 @@ add_task(function* test_copylinkcommand() {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
|
||||
let doc = content.document;
|
||||
let input = doc.getElementById("test-input");
|
||||
is(input.value, "http://mozilla.com/", "paste for command cmd_paste");
|
||||
Assert.equal(input.value, "http://mozilla.com/", "paste for command cmd_paste");
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -473,7 +473,7 @@ add_task(function* test_pagemenu() {
|
||||
item.doCommand();
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
|
||||
let pagemenu = content.document.getElementById("test-pagemenu");
|
||||
ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
|
||||
Assert.ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -900,7 +900,7 @@ function* selectText(selector) {
|
||||
win.getSelection().removeAllRanges();
|
||||
let div = doc.createRange();
|
||||
let element = doc.querySelector(selector);
|
||||
ok(element, "Found element to select text from");
|
||||
Assert.ok(element, "Found element to select text from");
|
||||
div.setStartBefore(element);
|
||||
div.setEndAfter(element);
|
||||
win.getSelection().addRange(div);
|
||||
|
@ -117,10 +117,10 @@ add_task(function* ()
|
||||
true, "basic focus again content page with button focused");
|
||||
|
||||
// Check to ensure that the root element is focused
|
||||
let match = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
return content.document.activeElement == content.document.documentElement;
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
Assert.ok(content.document.activeElement == content.document.documentElement,
|
||||
"basic focus again content page with button focused child root is focused");
|
||||
});
|
||||
ok(match, "basic focus again content page with button focused child root is focused");
|
||||
});
|
||||
|
||||
// Open a second tab. Document focus should skip the background tab.
|
||||
|
@ -45,8 +45,7 @@ add_task(function* shift_left_click_test() {
|
||||
|
||||
info("URL should be loaded in a new window");
|
||||
is(gURLBar.value, "", "Urlbar reverted to original value");
|
||||
let childFocus = yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
ok(childFocus, "There should be no focused element");
|
||||
yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
is(document.activeElement, gBrowser.selectedBrowser, "Content window should be focused");
|
||||
is(win.gURLBar.textValue, TEST_VALUE, "New URL is loaded in new window");
|
||||
|
||||
@ -115,8 +114,7 @@ add_task(function* load_in_current_tab_test() {
|
||||
|
||||
info("URL should be loaded in the current tab");
|
||||
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
|
||||
let childFocus = yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
ok(childFocus, "There should be no focused element");
|
||||
yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
is(document.activeElement, gBrowser.selectedBrowser, "Content window should be focused");
|
||||
is(gBrowser.selectedTab, tab, "New URL was loaded in the current tab");
|
||||
|
||||
@ -145,8 +143,7 @@ add_task(function* load_in_new_tab_test() {
|
||||
// Check the load occurred in a new tab.
|
||||
info("URL should be loaded in a new focused tab");
|
||||
is(gURLBar.inputField.value, TEST_VALUE, "Urlbar still has the value we entered");
|
||||
let childFocus = yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
ok(childFocus, "There should be no focused element");
|
||||
yield promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
|
||||
is(document.activeElement, gBrowser.selectedBrowser, "Content window should be focused");
|
||||
isnot(gBrowser.selectedTab, tab, "New URL was loaded in a new tab");
|
||||
|
||||
@ -224,12 +221,13 @@ function promiseWaitForNewWindow() {
|
||||
function promiseCheckChildNoFocusedElement(browser)
|
||||
{
|
||||
if (!gMultiProcessBrowser) {
|
||||
return Services.focus.focusedElement == null;
|
||||
Assert.equal(Services.focus.focusedElement, null, "There should be no focused element");
|
||||
return;
|
||||
}
|
||||
|
||||
return ContentTask.spawn(browser, { }, function* () {
|
||||
const fm = Components.classes["@mozilla.org/focus-manager;1"].
|
||||
getService(Components.interfaces.nsIFocusManager);
|
||||
return fm.focusedElement == null;
|
||||
Assert.equal(fm.focusedElement, null, "There should be no focused element");
|
||||
});
|
||||
}
|
||||
|
@ -45,23 +45,17 @@ function testURL(url, loadFunc, endFunc) {
|
||||
|
||||
yield promiseWaitForEvent(browser, "pageshow");
|
||||
|
||||
let focused = yield ContentTask.spawn(browser, { isRemote: gMultiProcessBrowser },
|
||||
yield ContentTask.spawn(browser, { isRemote: gMultiProcessBrowser },
|
||||
function* (arg) {
|
||||
const fm = Components.classes["@mozilla.org/focus-manager;1"].
|
||||
getService(Components.interfaces.nsIFocusManager);
|
||||
if (fm.focusedElement != null) {
|
||||
return "FAIL - focusedElement not null";
|
||||
}
|
||||
Assert.equal(fm.focusedElement, null, "focusedElement not null");
|
||||
|
||||
if (arg.isRemote) {
|
||||
return fm.activeWindow == content ? "PASS" :
|
||||
"FAIL - activeWindow not correct";
|
||||
Assert.equal(fm.activeWindow, content, "activeWindow not correct");
|
||||
}
|
||||
|
||||
return "PASS";
|
||||
});
|
||||
|
||||
is(focused, "PASS", "should be no focused element");
|
||||
is(document.activeElement, browser, "content window should be focused");
|
||||
|
||||
ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
|
||||
|
@ -18,20 +18,16 @@ add_task(function* purgeHistoryTest() {
|
||||
ok(backButton.hasAttribute("disabled"), "Back button is disabled");
|
||||
ok(forwardButton.hasAttribute("disabled"), "Forward button is disabled");
|
||||
|
||||
let pushState = ContentTask.spawn(browser, null, function*() {
|
||||
yield ContentTask.spawn(browser, null, function*() {
|
||||
let startHistory = content.history.length;
|
||||
content.history.pushState({}, "");
|
||||
content.history.pushState({}, "");
|
||||
content.history.back();
|
||||
let newHistory = content.history.length;
|
||||
return [startHistory, newHistory];
|
||||
Assert.equal(startHistory, 1, "Initial SHistory size");
|
||||
Assert.equal(newHistory, 3, "New SHistory size");
|
||||
});
|
||||
|
||||
let [startHistory, newHistory] = yield pushState;
|
||||
|
||||
is(startHistory, 1, "Initial SHistory size");
|
||||
is(newHistory, 3, "New SHistory size");
|
||||
|
||||
ok(browser.webNavigation.canGoBack, true,
|
||||
"New value for webNavigation.canGoBack");
|
||||
ok(browser.webNavigation.canGoForward, true,
|
||||
@ -50,12 +46,10 @@ add_task(function* purgeHistoryTest() {
|
||||
|
||||
yield sanitizer.sanitize(["history"]);
|
||||
|
||||
let historyAfterPurge = yield ContentTask.spawn(browser, null, function*() {
|
||||
return content.history.length;
|
||||
yield ContentTask.spawn(browser, null, function*() {
|
||||
Assert.equal(content.history.length, 1, "SHistory correctly cleared");
|
||||
});
|
||||
|
||||
is(historyAfterPurge, 1, "SHistory correctly cleared");
|
||||
|
||||
ok(!browser.webNavigation.canGoBack,
|
||||
"webNavigation.canGoBack correctly cleared");
|
||||
ok(!browser.webNavigation.canGoForward,
|
||||
|
@ -22,8 +22,8 @@ function* attemptFakeRefresh(browser, expectRefresh) {
|
||||
let refresher = docShell.QueryInterface(Ci.nsIRefreshURI);
|
||||
refresher.refreshURI(URI, 0, false, true);
|
||||
|
||||
is(refresher.refreshPending, expectRefresh,
|
||||
"Got the right refreshPending state");
|
||||
Assert.equal(refresher.refreshPending, expectRefresh,
|
||||
"Got the right refreshPending state");
|
||||
|
||||
if (refresher.refreshPending) {
|
||||
// Cancel the pending refresh
|
||||
|
@ -109,10 +109,10 @@ function doSelectTests(contentType, dtd)
|
||||
is((yield getChangeEvents()), 0, "Before closed - number of change events");
|
||||
|
||||
EventUtils.synthesizeKey("a", { accelKey: true });
|
||||
let selection = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
return String(content.getSelection());
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { isWindows }, function(args) {
|
||||
Assert.equal(String(content.getSelection()), args.isWindows ? "Text" : "",
|
||||
"Select all while popup is open");
|
||||
});
|
||||
is(selection, isWindows ? "Text" : "", "Select all while popup is open");
|
||||
|
||||
yield hideSelectPopup(selectPopup);
|
||||
|
||||
|
@ -137,11 +137,11 @@ function* testSendReportDisabled(testURL, errorURISuffix) {
|
||||
yield checkErrorPage(browser, errorURISuffix);
|
||||
|
||||
// Check that the error reporting section is hidden.
|
||||
let hidden = yield ContentTask.spawn(browser, null, function* () {
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
let section = content.document.getElementById("certificateErrorReporting");
|
||||
return content.getComputedStyle(section).display == "none";
|
||||
Assert.equal(content.getComputedStyle(section).display, "none",
|
||||
"error reporting section should be hidden");
|
||||
});
|
||||
ok(hidden, "error reporting section should be hidden");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
@ -167,9 +167,8 @@ function createReportResponseStatusPromise(expectedURI) {
|
||||
}
|
||||
|
||||
function checkErrorPage(browser, suffix) {
|
||||
return ContentTask.spawn(browser, null, function* () {
|
||||
return content.document.documentURI;
|
||||
}).then(uri => {
|
||||
ok(uri.startsWith(`about:${suffix}`), "correct error page loaded");
|
||||
return ContentTask.spawn(browser, { suffix }, function* (args) {
|
||||
let uri = content.document.documentURI;
|
||||
Assert.ok(uri.startsWith(`about:${args.suffix}`), "correct error page loaded");
|
||||
});
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ add_task(function* test_fetch() {
|
||||
let securityChange = waitForSecurityChange();
|
||||
yield ContentTask.spawn(newTabBrowser, null, function* () {
|
||||
yield content.wrappedJSObject.test_fetch()
|
||||
.then((response) => { ok(false, "should have denied the request"); })
|
||||
.catch((e) => { ok(true, `Caught exception: ${e}`); });
|
||||
.then(response => Assert.ok(false, "should have denied the request"))
|
||||
.catch(e => Assert.ok(true, `Caught exception: ${e}`));
|
||||
});
|
||||
yield securityChange;
|
||||
|
||||
|
@ -26,12 +26,11 @@ add_task(function*() {
|
||||
EventUtils.synthesizeKey("g", { accelKey: true });
|
||||
yield scrollPromise;
|
||||
|
||||
let scrollLeftPos = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
|
||||
return content.document.getElementById("s").getBoundingClientRect().left;
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
Assert.ok(content.document.getElementById("s").getBoundingClientRect().left >= 0,
|
||||
"scroll should include find result");
|
||||
});
|
||||
|
||||
ok(scrollLeftPos >= 0, "scroll should include find result");
|
||||
|
||||
// clear the find bar
|
||||
EventUtils.synthesizeKey("a", { accelKey: true });
|
||||
EventUtils.synthesizeKey("VK_DELETE", { });
|
||||
|
@ -17,7 +17,7 @@ add_task(function* () {
|
||||
let cell = content.gGrid.cells[aIndex];
|
||||
|
||||
let link = cell.node.querySelector(".newtab-link");
|
||||
is(link.getAttribute("title"), aExpected, aMessage);
|
||||
Assert.equal(link.getAttribute("title"), aExpected, aMessage);
|
||||
}
|
||||
|
||||
checkTooltip(0, "http://example7.com/", "1st tooltip is correct");
|
||||
|
@ -15,10 +15,9 @@ add_task(function* () {
|
||||
ok(NewTabUtils.allPages.enabled, "page is enabled");
|
||||
NewTabUtils.allPages.enabled = false;
|
||||
|
||||
let disabled = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return content.gGrid.node.hasAttribute("page-disabled");
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
Assert.ok(content.gGrid.node.hasAttribute("page-disabled"), "page is disabled");
|
||||
});
|
||||
ok(disabled, "page is disabled");
|
||||
|
||||
NewTabUtils.allPages.enabled = true;
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ add_task(function* () {
|
||||
let link = site.querySelector(".newtab-link");
|
||||
|
||||
function checkGridLocked(aLocked, aMessage) {
|
||||
is(grid.node.hasAttribute("locked"), aLocked, aMessage);
|
||||
Assert.equal(grid.node.hasAttribute("locked"), aLocked, aMessage);
|
||||
}
|
||||
|
||||
function sendDragEvent(aEventType, aTarget) {
|
||||
|
@ -21,13 +21,13 @@ add_task(function* () {
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
let {_cellMargin, _cellHeight, _cellWidth, node} = content.gGrid;
|
||||
isnot(_cellMargin, null, "grid has a computed cell margin");
|
||||
isnot(_cellHeight, null, "grid has a computed cell height");
|
||||
isnot(_cellWidth, null, "grid has a computed cell width");
|
||||
Assert.notEqual(_cellMargin, null, "grid has a computed cell margin");
|
||||
Assert.notEqual(_cellHeight, null, "grid has a computed cell height");
|
||||
Assert.notEqual(_cellWidth, null, "grid has a computed cell width");
|
||||
let {height, maxHeight, maxWidth} = node.style;
|
||||
isnot(height, "", "grid has a computed grid height");
|
||||
isnot(maxHeight, "", "grid has a computed grid max-height");
|
||||
isnot(maxWidth, "", "grid has a computed grid max-width");
|
||||
Assert.notEqual(height, "", "grid has a computed grid height");
|
||||
Assert.notEqual(maxHeight, "", "grid has a computed grid max-height");
|
||||
Assert.notEqual(maxWidth, "", "grid has a computed grid max-width");
|
||||
});
|
||||
|
||||
// restore original state
|
||||
|
@ -34,10 +34,10 @@ add_task(function* () {
|
||||
ok(isDisabled, "page is disabled");
|
||||
|
||||
// check that no sites have been rendered
|
||||
let sitesLength = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function*() {
|
||||
return content.document.querySelectorAll(".site").length;
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function*() {
|
||||
Assert.equal(content.document.querySelectorAll(".site").length, 0,
|
||||
"no sites have been rendered");
|
||||
});
|
||||
is(0, sitesLength, "no sites have been rendered");
|
||||
|
||||
NewTabUtils.allPages.enabled = true;
|
||||
|
||||
|
@ -28,7 +28,7 @@ add_task(function* () {
|
||||
|
||||
let pinned = aSite.isPinned();
|
||||
if (pinned != aSite.node.hasAttribute("pinned")) {
|
||||
ok(false, "invalid state (site.isPinned() != site[pinned])");
|
||||
Assert.ok(false, "invalid state (site.isPinned() != site[pinned])");
|
||||
}
|
||||
|
||||
return aSite.url.replace(/^http:\/\/example(\d+)\.com\/$/, "$1") + (pinned ? "p" : "");
|
||||
|
@ -150,7 +150,7 @@ add_task(function* () {
|
||||
let observer = new content.MutationObserver(() => {
|
||||
if (input.getAttribute("aria-expanded") == "true") {
|
||||
observer.disconnect();
|
||||
ok(!table.hidden, "Search suggestion table unhidden");
|
||||
Assert.ok(!table.hidden, "Search suggestion table unhidden");
|
||||
sendAsyncMessage("test:newtab-suggestions-open", {});
|
||||
}
|
||||
});
|
||||
@ -173,10 +173,10 @@ add_task(function* () {
|
||||
EventUtils.synthesizeKey("a", { accelKey: true });
|
||||
EventUtils.synthesizeKey("VK_DELETE", {});
|
||||
|
||||
let tableHidden = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return content.document.getElementById("searchSuggestionTable").hidden;
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
Assert.ok(content.document.getElementById("searchSuggestionTable").hidden,
|
||||
"Search suggestion table hidden");
|
||||
});
|
||||
ok(tableHidden, "Search suggestion table hidden");
|
||||
|
||||
// Remove the search bar from toolbar
|
||||
CustomizableUI.removeWidgetFromArea("search-container");
|
||||
@ -185,7 +185,7 @@ add_task(function* () {
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
let input = content.document.getElementById("newtab-search-text");
|
||||
isnot(input, content.document.activeElement, "Search input should not be focused");
|
||||
Assert.notEqual(input, content.document.activeElement, "Search input should not be focused");
|
||||
});
|
||||
|
||||
// Test that Ctrl/Cmd + K will focus the input field from the page.
|
||||
@ -195,7 +195,7 @@ add_task(function* () {
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
let input = content.document.getElementById("newtab-search-text");
|
||||
is(input, content.document.activeElement, "Search input should be focused");
|
||||
Assert.equal(input, content.document.activeElement, "Search input should be focused");
|
||||
});
|
||||
|
||||
// Reset changes made to toolbar
|
||||
@ -226,9 +226,11 @@ add_task(function* () {
|
||||
yield aboutHomeLoaded;
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* () {
|
||||
is(content.document.documentURI.toLowerCase(), "about:home", "New tab's uri should be about:home");
|
||||
Assert.equal(content.document.documentURI.toLowerCase(), "about:home",
|
||||
"New tab's uri should be about:home");
|
||||
let searchInput = content.document.getElementById("searchText");
|
||||
is(searchInput, content.document.activeElement, "Search input must be the selected element");
|
||||
Assert.equal(searchInput, content.document.activeElement,
|
||||
"Search input must be the selected element");
|
||||
});
|
||||
|
||||
NewTabUtils.allPages.enabled = true;
|
||||
@ -297,8 +299,8 @@ function* checkCurrentEngine(engineInfo)
|
||||
"Sanity check: current engine: engine.name=" + engine.name +
|
||||
" basename=" + engineInfo.name);
|
||||
|
||||
let engineName = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
return content.gSearch._contentSearchController.defaultEngine.name;
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { name: engine.name }, function* (args) {
|
||||
Assert.equal(content.gSearch._contentSearchController.defaultEngine.name,
|
||||
args.name, "currentEngineName: " + args.name);
|
||||
});
|
||||
is(engineName, engine.name, "currentEngineName: " + engine.name);
|
||||
}
|
||||
|
@ -22,26 +22,32 @@ add_task(function* () {
|
||||
let sponsoredButton = site.querySelector(".newtab-sponsored");
|
||||
EventUtils.synthesizeMouseAtCenter(sponsoredButton, {}, content);
|
||||
let explain = site.querySelector(".sponsored-explain");
|
||||
isnot(explain, null, "Sponsored explanation shown");
|
||||
ok(explain.querySelector("input").classList.contains("newtab-control-block"), "sponsored tiles show blocked image");
|
||||
ok(sponsoredButton.hasAttribute("active"), "Sponsored button has active attribute");
|
||||
Assert.notEqual(explain, null, "Sponsored explanation shown");
|
||||
Assert.ok(explain.querySelector("input").classList.contains("newtab-control-block"),
|
||||
"sponsored tiles show blocked image");
|
||||
Assert.ok(sponsoredButton.hasAttribute("active"), "Sponsored button has active attribute");
|
||||
|
||||
// test dismissing sponsored explain
|
||||
EventUtils.synthesizeMouseAtCenter(sponsoredButton, {}, content);
|
||||
is(site.querySelector(".sponsored-explain"), null, "Sponsored explanation no longer shown");
|
||||
ok(!sponsoredButton.hasAttribute("active"), "Sponsored button does not have active attribute");
|
||||
Assert.equal(site.querySelector(".sponsored-explain"), null,
|
||||
"Sponsored explanation no longer shown");
|
||||
Assert.ok(!sponsoredButton.hasAttribute("active"),
|
||||
"Sponsored button does not have active attribute");
|
||||
|
||||
// test with enhanced tile
|
||||
site.setAttribute("type", "enhanced");
|
||||
EventUtils.synthesizeMouseAtCenter(sponsoredButton, {}, content);
|
||||
explain = site.querySelector(".sponsored-explain");
|
||||
isnot(explain, null, "Sponsored explanation shown");
|
||||
ok(explain.querySelector("input").classList.contains("newtab-customize"), "enhanced tiles show customize image");
|
||||
ok(sponsoredButton.hasAttribute("active"), "Sponsored button has active attribute");
|
||||
Assert.notEqual(explain, null, "Sponsored explanation shown");
|
||||
Assert.ok(explain.querySelector("input").classList.contains("newtab-customize"),
|
||||
"enhanced tiles show customize image");
|
||||
Assert.ok(sponsoredButton.hasAttribute("active"), "Sponsored button has active attribute");
|
||||
|
||||
// test dismissing enhanced explain
|
||||
EventUtils.synthesizeMouseAtCenter(sponsoredButton, {}, content);
|
||||
is(site.querySelector(".sponsored-explain"), null, "Sponsored explanation no longer shown");
|
||||
ok(!sponsoredButton.hasAttribute("active"), "Sponsored button does not have active attribute");
|
||||
Assert.equal(site.querySelector(".sponsored-explain"), null,
|
||||
"Sponsored explanation no longer shown");
|
||||
Assert.ok(!sponsoredButton.hasAttribute("active"),
|
||||
"Sponsored button does not have active attribute");
|
||||
});
|
||||
});
|
||||
|
@ -333,30 +333,29 @@ function* addNewTabPageTab() {
|
||||
* The second cell contains 'http://example2.com/'. The third cell is empty.
|
||||
* The fourth cell contains the pinned site 'http://example4.com/'.
|
||||
*/
|
||||
function* checkGrid(aSitesPattern) {
|
||||
let length = aSitesPattern.split(",").length;
|
||||
function* checkGrid(pattern) {
|
||||
let length = pattern.split(",").length;
|
||||
|
||||
let foundPattern =
|
||||
yield ContentTask.spawn(gWindow.gBrowser.selectedBrowser,
|
||||
{ length: length }, function* (args) {
|
||||
let grid = content.wrappedJSObject.gGrid;
|
||||
yield ContentTask.spawn(gWindow.gBrowser.selectedBrowser,
|
||||
{ length, pattern }, function* (args) {
|
||||
let grid = content.wrappedJSObject.gGrid;
|
||||
|
||||
let sites = grid.sites.slice(0, args.length);
|
||||
return sites.map(function (aSite) {
|
||||
if (!aSite)
|
||||
return "";
|
||||
let sites = grid.sites.slice(0, args.length);
|
||||
let foundPattern = sites.map(function (aSite) {
|
||||
if (!aSite)
|
||||
return "";
|
||||
|
||||
let pinned = aSite.isPinned();
|
||||
let hasPinnedAttr = aSite.node.hasAttribute("pinned");
|
||||
let pinned = aSite.isPinned();
|
||||
let hasPinnedAttr = aSite.node.hasAttribute("pinned");
|
||||
|
||||
if (pinned != hasPinnedAttr)
|
||||
ok(false, "invalid state (site.isPinned() != site[pinned])");
|
||||
if (pinned != hasPinnedAttr)
|
||||
ok(false, "invalid state (site.isPinned() != site[pinned])");
|
||||
|
||||
return aSite.url.replace(/^http:\/\/example(\d+)\.com\/$/, "$1") + (pinned ? "p" : "");
|
||||
});
|
||||
return aSite.url.replace(/^http:\/\/example(\d+)\.com\/$/, "$1") + (pinned ? "p" : "");
|
||||
});
|
||||
|
||||
Assert.equal(foundPattern, args.pattern, "grid status = " + args.pattern);
|
||||
});
|
||||
|
||||
is(foundPattern, aSitesPattern, "grid status = " + aSitesPattern);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ add_task(function* () {
|
||||
yield promiseUpdatePluginBindings(gBrowser.selectedBrowser);
|
||||
|
||||
// Tests that the overlay can be hidden for plugins using the close icon.
|
||||
let overlayIsVisible = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
@ -43,10 +43,8 @@ add_task(function* () {
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
|
||||
return overlay.classList.contains("visible");
|
||||
Assert.ok(!overlay.classList.contains("visible"), "overlay should be hidden.");
|
||||
});
|
||||
|
||||
ok(!overlayIsVisible, "overlay should be hidden.");
|
||||
});
|
||||
|
||||
// Test that the overlay cannot be interacted with after the user closes the overlay
|
||||
@ -59,7 +57,7 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gBrowser.selectedBrowser);
|
||||
|
||||
let overlayHidden = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
@ -80,11 +78,11 @@ add_task(function* () {
|
||||
utils.sendMouseEvent("mousedown", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
|
||||
|
||||
return overlay.hasAttribute("dismissed") && !overlay.classList.contains("visible");
|
||||
Assert.ok(overlay.hasAttribute("dismissed") && !overlay.classList.contains("visible"),
|
||||
"Overlay should be hidden");
|
||||
});
|
||||
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins");
|
||||
|
||||
ok(notification.dismissed, "No notification should be shown");
|
||||
ok(overlayHidden, "Overlay should be hidden");
|
||||
});
|
||||
|
@ -25,20 +25,14 @@ add_task(function* () {
|
||||
|
||||
// Tests that the overlays are visible and actionable if the plugin is in an iframe.
|
||||
|
||||
let result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
let frame = content.document.getElementById("frame");
|
||||
let doc = frame.contentDocument;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return plugin && overlay.classList.contains("visible");
|
||||
});
|
||||
ok(result, "Test 1, Plugin overlay should exist, not be hidden");
|
||||
Assert.ok(plugin && overlay.classList.contains("visible"),
|
||||
"Test 1, Plugin overlay should exist, not be hidden");
|
||||
|
||||
result = yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
let frame = content.document.getElementById("frame");
|
||||
let doc = frame.contentDocument;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
let closeIcon = doc.getAnonymousElementByAttribute(plugin, "anonid", "closeIcon");
|
||||
let bounds = closeIcon.getBoundingClientRect();
|
||||
let left = (bounds.left + bounds.right) / 2;
|
||||
@ -47,8 +41,8 @@ add_task(function* () {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
return overlay.classList.contains("visible");
|
||||
Assert.ok(!overlay.classList.contains("visible"),
|
||||
"Test 1, Plugin overlay should exist, be hidden");
|
||||
});
|
||||
ok(!result, "Test 1, Plugin overlay should exist, be hidden");
|
||||
});
|
||||
|
||||
|
@ -66,25 +66,24 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return plugin.pluginFallbackType;
|
||||
Assert.equal(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 3b, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
});
|
||||
is(result, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 3b, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
|
||||
let pluginInfo = yield promiseForPluginInfo("test");
|
||||
ok(!pluginInfo.activated, "Test 1a, plugin should not be activated");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 3b, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 3b, overlay should be hidden.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -97,22 +96,21 @@ add_task(function* () {
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
yield promiseForNotificationBar("plugin-hidden", gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return plugin.pluginFallbackType;
|
||||
Assert.equal(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 4b, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
});
|
||||
is(result, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 4b, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 4b, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 4b, overlay should be hidden.");
|
||||
});
|
||||
|
||||
// Test that the notification bar is getting dismissed when directly activating plugins
|
||||
@ -127,14 +125,13 @@ add_task(function* () {
|
||||
// Expecting a plugin notification bar when plugins are overlaid offscreen.
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return plugin.pluginFallbackType;
|
||||
Assert.equal(plugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 6, Plugin should be click-to-play");
|
||||
});
|
||||
is(result, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 6, Plugin should be click-to-play");
|
||||
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
|
||||
|
@ -53,13 +53,13 @@ add_task(function* () {
|
||||
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let doc = content.document;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 2, overlay should be visible.");
|
||||
});
|
||||
ok(result, "Test 2, overlay should be visible.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -82,13 +82,13 @@ add_task(function* () {
|
||||
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let doc = content.document;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 3, overlay should be visible.");
|
||||
});
|
||||
ok(result, "Test 3, overlay should be visible.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -110,11 +110,11 @@ add_task(function* () {
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let doc = content.document;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 4, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 4, overlay should be hidden.");
|
||||
});
|
||||
|
@ -42,13 +42,13 @@ add_task(function* () {
|
||||
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(popupNotification, "Test 2, Should have a click-to-play notification");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 2, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 2, overlay should be hidden.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -60,13 +60,13 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 3, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 3, overlay should be hidden.");
|
||||
});
|
||||
|
||||
|
||||
@ -80,13 +80,13 @@ add_task(function* () {
|
||||
content.document.getElementById("test").clientTop;
|
||||
});
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 4, overlay should be visible.");
|
||||
});
|
||||
ok(result, "Test 4, overlay should be visible.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -100,13 +100,13 @@ add_task(function* () {
|
||||
content.document.getElementById("test").clientTop;
|
||||
});
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(!(overlay && overlay.classList.contains("visible")),
|
||||
"Test 5, overlay should be hidden.");
|
||||
});
|
||||
ok(!result, "Test 5, overlay should be hidden.");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -120,11 +120,11 @@ add_task(function* () {
|
||||
content.document.getElementById("test").clientTop;
|
||||
});
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 6, overlay should be visible.");
|
||||
});
|
||||
ok(result, "Test 6, overlay should be visible.");
|
||||
});
|
||||
|
@ -49,13 +49,13 @@ add_task(function* () {
|
||||
// Reload the page
|
||||
yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_zoom.html");
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, { count }, function* (args) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Overlay should be visible for zoom change count " + args.count);
|
||||
});
|
||||
ok(result, "Overlay should be visible for zoom change count " + count);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -83,21 +83,17 @@ add_task(function* () {
|
||||
"Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
||||
ok(!pluginInfo.activated, "Test 18a, Plugin should not be activated");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let doc = content.document;
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
});
|
||||
ok(result, "Test 18a, Plugin overlay should exist, not be hidden");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 18a, Plugin overlay should exist, not be hidden");
|
||||
|
||||
let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
|
||||
return updateLink.style.visibility != "hidden";
|
||||
Assert.ok(updateLink.style.visibility != "hidden",
|
||||
"Test 18a, Plugin should have an update link");
|
||||
});
|
||||
ok(result, "Test 18a, Plugin should have an update link");
|
||||
|
||||
let promise = waitForEvent(gBrowser.tabContainer, "TabOpen", null, true);
|
||||
let pluginUpdateURL = Services.urlFormatter.formatURLPref("plugins.update.url");
|
||||
@ -129,13 +125,13 @@ add_task(function* () {
|
||||
"Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
|
||||
ok(!pluginInfo.activated, "Test 18b, Plugin should not be activated");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 18b, Plugin overlay should exist, not be hidden");
|
||||
});
|
||||
ok(result, "Test 18b, Plugin overlay should exist, not be hidden");
|
||||
});
|
||||
|
||||
// Tests a vulnerable plugin with no update
|
||||
@ -157,21 +153,17 @@ add_task(function* () {
|
||||
"Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
|
||||
ok(!pluginInfo.activated, "Test 18c, Plugin should not be activated");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return overlay && overlay.classList.contains("visible");
|
||||
});
|
||||
ok(result, "Test 18c, Plugin overlay should exist, not be hidden");
|
||||
Assert.ok(overlay && overlay.classList.contains("visible"),
|
||||
"Test 18c, Plugin overlay should exist, not be hidden");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
|
||||
return updateLink && updateLink.style.display != "block";
|
||||
Assert.ok(updateLink && updateLink.style.display != "block",
|
||||
"Test 18c, Plugin should not have an update link");
|
||||
});
|
||||
ok(result, "Test 18c, Plugin should not have an update link");
|
||||
|
||||
// check that click "Always allow" works with blocked plugins
|
||||
yield promiseForNotificationShown(notification);
|
||||
@ -342,12 +334,11 @@ add_task(function* () {
|
||||
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
|
||||
"Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(!objLoadingContent.activated, "Plugin should not be activated.");
|
||||
});
|
||||
ok(!result, "Plugin should not be activated.");
|
||||
|
||||
const testUrl = "http://test.url.com/";
|
||||
|
||||
|
@ -41,11 +41,10 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let test = content.document.getElementById("test");
|
||||
return test.activated;
|
||||
Assert.ok(test.activated, "task 1a: test plugin should be activated!");
|
||||
});
|
||||
ok(result, "task 1a: test plugin should be activated!");
|
||||
});
|
||||
|
||||
// Load a fresh page, load a new plugin blocklist, then load the same page again.
|
||||
@ -57,11 +56,10 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let test = content.document.getElementById("test");
|
||||
return test.activated;
|
||||
ok(!test.activated, "task 2a: test plugin shouldn't activate!");
|
||||
});
|
||||
ok(!result, "task 2a: test plugin shouldn't activate!");
|
||||
});
|
||||
|
||||
// Unload the block list and lets do this again, only this time lets
|
||||
@ -82,11 +80,10 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let test = content.document.getElementById("test");
|
||||
return test.activated;
|
||||
Assert.ok(test.activated, "task 3a: test plugin should be activated!");
|
||||
});
|
||||
ok(result, "task 3a: test plugin should be activated!");
|
||||
});
|
||||
|
||||
// Load a fresh page, load a new plugin blocklist, then load the same page again.
|
||||
@ -98,11 +95,10 @@ add_task(function* () {
|
||||
// Work around for delayed PluginBindingAttached
|
||||
yield promiseUpdatePluginBindings(gTestBrowser);
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let test = content.document.getElementById("test");
|
||||
return test.activated;
|
||||
Assert.ok(!test.activated, "task 4a: test plugin shouldn't activate!");
|
||||
});
|
||||
ok(!result, "task 4a: test plugin shouldn't activate!");
|
||||
|
||||
yield asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
|
||||
});
|
||||
|
@ -50,12 +50,11 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementsByTagName("embed")[0];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
|
||||
});
|
||||
ok(!isActivated, "Test 1b, Plugin should not be activated");
|
||||
|
||||
// Click the activate button on doorhanger to make sure it works
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
@ -64,34 +63,32 @@ add_task(function* () {
|
||||
|
||||
PopupNotifications.panel.firstChild._primaryButton.click();
|
||||
|
||||
isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementsByTagName("embed")[0];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
|
||||
});
|
||||
ok(isActivated, "Test 1b, Plugin should be activated");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "Test 1c, Should still have a click-to-play notification");
|
||||
|
||||
let isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
|
||||
let plugin = content.document.getElementsByTagName("embed")[1];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(objLoadingContent.activated,
|
||||
"Test 1c, Newly inserted plugin in activated page should be activated");
|
||||
});
|
||||
ok(isActivated, "Test 1c, Newly inserted plugin in activated page should be activated");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementsByTagName("embed")[1];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(objLoadingContent.activated, "Test 1d, Plugin should be activated");
|
||||
});
|
||||
ok(isActivated, "Test 1d, Plugin should be activated");
|
||||
|
||||
let promise = waitForEvent(gTestBrowser.contentWindow, "hashchange", null);
|
||||
gTestBrowser.contentWindow.location += "#anchorNavigation";
|
||||
@ -99,29 +96,24 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
|
||||
let plugin = content.document.getElementsByTagName("embed")[2];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
Assert.ok(objLoadingContent.activated, "Test 1e, Plugin should be activated");
|
||||
});
|
||||
ok(isActivated, "Test 1e, Plugin should be activated");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
let isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementsByTagName("embed")[2];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
});
|
||||
ok(isActivated, "Test 1f, Plugin should be activated");
|
||||
Assert.ok(objLoadingContent.activated, "Test 1f, Plugin should be activated");
|
||||
|
||||
isActivated = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
content.history.replaceState({}, "", "replacedState");
|
||||
new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
|
||||
let plugin = content.document.getElementsByTagName("embed")[3];
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
return objLoadingContent.activated;
|
||||
plugin = content.document.getElementsByTagName("embed")[3];
|
||||
objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
Assert.ok(objLoadingContent.activated, "Test 1g, Plugin should be activated");
|
||||
});
|
||||
ok(isActivated, "Test 1f, Plugin should not be activated");
|
||||
});
|
||||
|
@ -37,15 +37,14 @@ add_task(function* () {
|
||||
|
||||
yield promiseForCondition(function () { return gNumPluginBindingsAttached == 1; });
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
if (!plugin) {
|
||||
Assert.ok(false, "plugin element not available.");
|
||||
return false;
|
||||
}
|
||||
// We can't use MochiKit's routine
|
||||
let style = content.getComputedStyle(plugin);
|
||||
return 'opacity' in style && style.opacity == 1;
|
||||
Assert.ok(("opacity" in style) && style.opacity == 1, "plugin style properly configured.");
|
||||
});
|
||||
|
||||
ok(result, true, "plugin style properly configured.");
|
||||
});
|
||||
|
@ -41,10 +41,10 @@ add_task(function* () {
|
||||
let pluginInfo = yield promiseForPluginInfo("test");
|
||||
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE");
|
||||
|
||||
let found = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
return !!content.document.getElementById("test");
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
Assert.ok(!!content.document.getElementById("test"),
|
||||
"test part 1: plugin should not be activated");
|
||||
});
|
||||
ok(found, "test part 1: plugin should not be activated");
|
||||
|
||||
yield promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
|
||||
});
|
||||
@ -52,10 +52,10 @@ add_task(function* () {
|
||||
add_task(function* () {
|
||||
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(!popupNotification, "test part 2: Should not have a click-to-play notification");
|
||||
let found = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
return !!content.document.getElementById("test");
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
Assert.ok(!content.document.getElementById("test"),
|
||||
"test part 2: plugin should not be activated");
|
||||
});
|
||||
ok(!found, "test part 2: plugin should not be activated");
|
||||
|
||||
let obsPromise = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
|
||||
let overlayPromise = promisePopupNotification("click-to-play-plugins");
|
||||
@ -73,8 +73,8 @@ add_task(function* () {
|
||||
let pluginInfo = yield promiseForPluginInfo("test");
|
||||
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE");
|
||||
|
||||
let found = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
return !!content.document.getElementById("test");
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
Assert.ok(!!content.document.getElementById("test"),
|
||||
"test part 3: plugin should not be activated");
|
||||
});
|
||||
ok(found, "test part 3: plugin should not be activated");
|
||||
});
|
||||
|
@ -59,7 +59,7 @@ add_task(function* () {
|
||||
let crashReportStatus = TestUtils.topicObserved("crash-report-status", onSubmitStatus);
|
||||
|
||||
// Test that the crash submission UI is actually visible and submit the crash report.
|
||||
let crashUiVisible = yield ContentTask.spawn(gTestBrowser, config, function* (aConfig) {
|
||||
yield ContentTask.spawn(gTestBrowser, config, function* (aConfig) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("plugin");
|
||||
let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
|
||||
@ -67,12 +67,11 @@ add_task(function* () {
|
||||
// Test that we don't send the URL when urlOptIn is false.
|
||||
doc.getAnonymousElementByAttribute(plugin, "anonid", "submitURLOptIn").checked = aConfig.urlOptIn;
|
||||
submitButton.click();
|
||||
return content.getComputedStyle(pleaseSubmit).display == "block";
|
||||
Assert.equal(content.getComputedStyle(pleaseSubmit).display == "block",
|
||||
aConfig.shouldSubmissionUIBeVisible, "The crash UI should be visible");
|
||||
});
|
||||
|
||||
yield crashReportStatus;
|
||||
|
||||
is(crashUiVisible, config.shouldSubmissionUIBeVisible, "The crash UI should be visible");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -97,7 +96,7 @@ add_task(function* () {
|
||||
let crashReportStatus = TestUtils.topicObserved("crash-report-status", onSubmitStatus);
|
||||
|
||||
// Test that the crash submission UI is actually visible and submit the crash report.
|
||||
let crashUiVisible = yield ContentTask.spawn(gTestBrowser, config, function* (aConfig) {
|
||||
yield ContentTask.spawn(gTestBrowser, config, function* (aConfig) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("plugin");
|
||||
let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
|
||||
@ -106,12 +105,11 @@ add_task(function* () {
|
||||
doc.getAnonymousElementByAttribute(plugin, "anonid", "submitURLOptIn").checked = aConfig.urlOptIn;
|
||||
doc.getAnonymousElementByAttribute(plugin, "anonid", "submitComment").value = aConfig.comment;
|
||||
submitButton.click();
|
||||
return content.getComputedStyle(pleaseSubmit).display == "block";
|
||||
Assert.equal(content.getComputedStyle(pleaseSubmit).display == "block",
|
||||
aConfig.shouldSubmissionUIBeVisible, "The crash UI should be visible");
|
||||
});
|
||||
|
||||
yield crashReportStatus;
|
||||
|
||||
is(crashUiVisible, config.shouldSubmissionUIBeVisible, "The crash UI should be visible");
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
@ -136,14 +134,13 @@ add_task(function* () {
|
||||
yield pluginCrashed;
|
||||
|
||||
// Test that the crash submission UI is not visible and do not submit a crash report.
|
||||
let crashUiVisible = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, config, function* (aConfig) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("plugin");
|
||||
let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
|
||||
return !!pleaseSubmit && content.getComputedStyle(pleaseSubmit).display == "block";
|
||||
Assert.equal(!!pleaseSubmit && content.getComputedStyle(pleaseSubmit).display == "block",
|
||||
aConfig.shouldSubmissionUIBeVisible, "Plugin crash UI should not be visible");
|
||||
});
|
||||
|
||||
is(crashUiVisible, config.shouldSubmissionUIBeVisible, "Plugin crash UI should not be visible");
|
||||
});
|
||||
|
||||
function promisePluginCrashed() {
|
||||
|
@ -143,7 +143,7 @@ add_task(function* testChromeHearsPluginCrashFirst() {
|
||||
mm.sendAsyncMessage(CRASHED_MESSAGE,
|
||||
{ pluginName: "", runID, state: "please" });
|
||||
|
||||
let [gotExpected, msg] = yield ContentTask.spawn(browser, {}, function* () {
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
// At this point, the content process should have heard the
|
||||
// plugin crash message from the parent, and we are OK to emit
|
||||
// the PluginCrashed event.
|
||||
@ -154,7 +154,8 @@ add_task(function* testChromeHearsPluginCrashFirst() {
|
||||
"submitStatus");
|
||||
|
||||
if (statusDiv.getAttribute("status") == "please") {
|
||||
return [false, "Did not expect plugin to be in crash report mode yet."];
|
||||
Assert.ok(false, "Did not expect plugin to be in crash report mode yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we need the plugin to seem crashed to PluginContent.jsm, without
|
||||
@ -176,11 +177,9 @@ add_task(function* testChromeHearsPluginCrashFirst() {
|
||||
});
|
||||
|
||||
plugin.dispatchEvent(event);
|
||||
return [statusDiv.getAttribute("status") == "please",
|
||||
"Should have been showing crash report UI"];
|
||||
Assert.equal(statusDiv.getAttribute("status"), "please",
|
||||
"Should have been showing crash report UI");
|
||||
});
|
||||
|
||||
ok(gotExpected, msg);
|
||||
yield BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
@ -202,7 +201,7 @@ add_task(function* testContentHearsCrashFirst() {
|
||||
let runID = yield preparePlugin(browser,
|
||||
Ci.nsIObjectLoadingContent.PLUGIN_CRASHED);
|
||||
|
||||
let [gotExpected, msg] = yield ContentTask.spawn(browser, null, function* () {
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
// At this point, the content process has not yet heard from the
|
||||
// parent about the crash report. Let's ensure that by making sure
|
||||
// we're not showing the plugin crash report UI.
|
||||
@ -213,7 +212,7 @@ add_task(function* testContentHearsCrashFirst() {
|
||||
"submitStatus");
|
||||
|
||||
if (statusDiv.getAttribute("status") == "please") {
|
||||
return [false, "Did not expect plugin to be in crash report mode yet."];
|
||||
Assert.ok(false, "Did not expect plugin to be in crash report mode yet.");
|
||||
}
|
||||
|
||||
let event = new content.PluginCrashedEvent("PluginCrashed", {
|
||||
@ -227,19 +226,17 @@ add_task(function* testContentHearsCrashFirst() {
|
||||
|
||||
plugin.dispatchEvent(event);
|
||||
|
||||
return [statusDiv.getAttribute("status") != "please",
|
||||
"Should not yet be showing crash report UI"];
|
||||
Assert.notEqual(statusDiv.getAttribute("status"), "please",
|
||||
"Should not yet be showing crash report UI");
|
||||
});
|
||||
|
||||
ok(gotExpected, msg);
|
||||
|
||||
// Now send the message down to PluginContent.jsm that the plugin has
|
||||
// crashed...
|
||||
let mm = browser.messageManager;
|
||||
mm.sendAsyncMessage(CRASHED_MESSAGE,
|
||||
{ pluginName: "", runID, state: "please"});
|
||||
|
||||
[gotExpected, msg] = yield ContentTask.spawn(browser, null, function* () {
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
// At this point, the content process will have heard the message
|
||||
// from the parent and reacted to it. We should be showing the plugin
|
||||
// crash report UI now.
|
||||
@ -249,11 +246,9 @@ add_task(function* testContentHearsCrashFirst() {
|
||||
.getAnonymousElementByAttribute(plugin, "anonid",
|
||||
"submitStatus");
|
||||
|
||||
return [statusDiv.getAttribute("status") == "please",
|
||||
"Should have been showing crash report UI"];
|
||||
Assert.equal(statusDiv.getAttribute("status"), "please",
|
||||
"Should have been showing crash report UI");
|
||||
});
|
||||
|
||||
ok(gotExpected, msg);
|
||||
|
||||
yield BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
@ -41,7 +41,7 @@ add_task(function* () {
|
||||
|
||||
// This test opens a new tab to about:addons
|
||||
let promise = waitForEvent(gBrowser.tabContainer, "TabOpen", null, true);
|
||||
let success = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let pluginNode = content.document.getElementById("test");
|
||||
let manageLink = content.document.getAnonymousElementByAttribute(pluginNode, "anonid", "managePluginsLink");
|
||||
let bounds = manageLink.getBoundingClientRect();
|
||||
@ -51,9 +51,9 @@ add_task(function* () {
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
|
||||
utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
|
||||
return true;
|
||||
Assert.ok(true, "click on manage link");
|
||||
});
|
||||
ok(success, "click on manage link");
|
||||
|
||||
yield promise;
|
||||
|
||||
promise = waitForEvent(gBrowser.tabContainer, "TabClose", null, true);
|
||||
|
@ -65,19 +65,19 @@ add_task(function* () {
|
||||
is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 3, plugin should have started");
|
||||
ok(pluginInfo.activated, "Test 4, plugin node should not be activated");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let plugin = content.document.getElementById("test");
|
||||
let npobj1 = Components.utils.waiveXrays(plugin).getObjectValue();
|
||||
plugin.src = plugin.src;
|
||||
let pluginsDiffer = false;
|
||||
try {
|
||||
Components.utils.waiveXrays(plugin).checkObjectValue(npobj1);
|
||||
} catch (e) {
|
||||
pluginsDiffer = true;
|
||||
}
|
||||
return pluginsDiffer;
|
||||
try {
|
||||
Components.utils.waiveXrays(plugin).checkObjectValue(npobj1);
|
||||
} catch (e) {
|
||||
pluginsDiffer = true;
|
||||
}
|
||||
|
||||
Assert.ok(pluginsDiffer, "Test 5, plugins differ.");
|
||||
});
|
||||
ok(result, "Test 5, plugins differ.");
|
||||
|
||||
pluginInfo = yield promiseForPluginInfo("test");
|
||||
ok(pluginInfo.activated, "Test 6, Plugin should have retained activated state.");
|
||||
|
@ -84,7 +84,7 @@ add_task(function* () {
|
||||
ok(!pluginInfo.activated, "Plugin should not be activated");
|
||||
|
||||
// Simulate clicking the overlay
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let bounds = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
@ -158,13 +158,13 @@ add_task(function* () {
|
||||
|
||||
yield promisePopupNotification("click-to-play-plugins");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let test = content.document.getElementById("test");
|
||||
let secondtestA = content.document.getElementById("secondtestA");
|
||||
let secondtestB = content.document.getElementById("secondtestB");
|
||||
return test.activated && !secondtestA.activated && !secondtestB.activated;
|
||||
Assert.ok(test.activated && !secondtestA.activated && !secondtestB.activated,
|
||||
"Content plugins are set up");
|
||||
});
|
||||
ok(result, "Content plugins are set up");
|
||||
|
||||
clearAllPluginPermissions();
|
||||
});
|
||||
@ -190,13 +190,12 @@ add_task(function* () {
|
||||
|
||||
yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_alternate_content.html");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return !!mainBox;
|
||||
Assert.ok(!!mainBox, "Test 15, Plugin overlay should exist");
|
||||
});
|
||||
ok(result, "Test 15, Plugin overlay should exist");
|
||||
});
|
||||
|
||||
// Tests that mContentType is used for click-to-play plugins, and not the
|
||||
@ -226,7 +225,7 @@ add_task(function* () {
|
||||
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
|
||||
"Test 19a, Doorhanger should start out dismissed");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let icon = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
|
||||
@ -256,7 +255,7 @@ add_task(function* () {
|
||||
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
|
||||
"Test 19c, Doorhanger should start out dismissed");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let text = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
|
||||
@ -287,7 +286,7 @@ add_task(function* () {
|
||||
ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
|
||||
"Test 19e, Doorhanger should start out dismissed");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
@ -320,54 +319,53 @@ add_task(function* () {
|
||||
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(notification, "Test 20a, Should have a click-to-play notification");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
return !!overlay;
|
||||
Assert.ok(!!overlay, "Test 20a, Plugin overlay should exist");
|
||||
});
|
||||
ok(result, "Test 20a, Plugin overlay should exist");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
let overlayRect = mainBox.getBoundingClientRect();
|
||||
return overlayRect.width == 0 && overlayRect.height == 0;
|
||||
Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
|
||||
"Test 20a, plugin should have an overlay with 0px width and height");
|
||||
});
|
||||
ok(result, "Test 20a, plugin should have an overlay with 0px width and height");
|
||||
|
||||
let pluginInfo = yield promiseForPluginInfo("test");
|
||||
ok(!pluginInfo.activated, "Test 20b, plugin should not be activated");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let div = doc.getElementById("container");
|
||||
return div.style.display == "none";
|
||||
Assert.equal(div.style.display, "none",
|
||||
"Test 20b, container div should be display: none");
|
||||
});
|
||||
ok(result, "Test 20b, container div should be display: none");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let div = doc.getElementById("container");
|
||||
div.style.display = "block";
|
||||
});
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||
let overlayRect = mainBox.getBoundingClientRect();
|
||||
return overlayRect.width == 200 && overlayRect.height == 200;
|
||||
Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
|
||||
"Test 20c, plugin should have overlay dims of 200px");
|
||||
});
|
||||
ok(result, "Test 20c, plugin should have overlay dims of 200px");
|
||||
|
||||
pluginInfo = yield promiseForPluginInfo("test");
|
||||
ok(!pluginInfo.activated, "Test 20b, plugin should not be activated");
|
||||
|
||||
ok(notification.dismissed, "Test 20c, Doorhanger should start out dismissed");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let bounds = plugin.getBoundingClientRect();
|
||||
@ -386,13 +384,13 @@ add_task(function* () {
|
||||
pluginInfo = yield promiseForPluginInfo("test");
|
||||
ok(pluginInfo.activated, "Test 20c, plugin should be activated");
|
||||
|
||||
result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
return overlayRect.width == 0 && overlayRect.height == 0;
|
||||
Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
|
||||
"Test 20c, plugin should have overlay dims of 0px");
|
||||
});
|
||||
ok(result, "Test 20c, plugin should have overlay dims of 0px");
|
||||
|
||||
clearAllPluginPermissions();
|
||||
});
|
||||
@ -411,13 +409,13 @@ add_task(function* () {
|
||||
// confirm all three are blocked by ctp at this point
|
||||
let ids = ["test", "secondtestA", "secondtestB"];
|
||||
for (let id of ids) {
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {aId: id}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById(arguments[0].aId);
|
||||
let plugin = doc.getElementById(args.id);
|
||||
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
return overlayRect.width == 200 && overlayRect.height == 200;
|
||||
Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
|
||||
"Test 21a, plugin " + args.id + " should have click-to-play overlay with dims");
|
||||
});
|
||||
ok(result, "Test 21a, plugin " + id + " should have click-to-play overlay with dims");
|
||||
|
||||
let pluginInfo = yield promiseForPluginInfo(id);
|
||||
ok(!pluginInfo.activated, "Test 21a, Plugin with id=" + id + " should not be activated");
|
||||
@ -466,23 +464,24 @@ add_task(function* () {
|
||||
|
||||
ok(notification.options.pluginData.size == 2, "Test 21c, Should have one type of plugin in the notification");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
return overlayRect.width == 0 && overlayRect.height == 0;
|
||||
Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
|
||||
"Test 21c, plugin should have overlay dims of 0px");
|
||||
});
|
||||
ok(result, "Test 21c, plugin should have overlay dims of 0px");
|
||||
|
||||
ids = ["secondtestA", "secondtestB"];
|
||||
for (let id of ids) {
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {aId: id}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById(arguments[0].aId);
|
||||
let plugin = doc.getElementById(args.id);
|
||||
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
return overlayRect.width == 200 && overlayRect.height == 200;
|
||||
Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
|
||||
"Test 21c, plugin " + args.id + " should have click-to-play overlay with zero dims");
|
||||
});
|
||||
ok(result, "Test 21c, plugin " + id + " should have click-to-play overlay with zero dims");
|
||||
|
||||
|
||||
let pluginInfo = yield promiseForPluginInfo(id);
|
||||
ok(!pluginInfo.activated, "Test 21c, Plugin with id=" + id + " should not be activated");
|
||||
@ -521,13 +520,13 @@ add_task(function* () {
|
||||
|
||||
ids = ["test", "secondtestA", "secondtestB"];
|
||||
for (let id of ids) {
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {aId: id}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById(arguments[0].aId);
|
||||
let plugin = doc.getElementById(args.id);
|
||||
let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
|
||||
return overlayRect.width == 0 && overlayRect.height == 0;
|
||||
Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
|
||||
"Test 21d, plugin " + args.id + " should have click-to-play overlay with zero dims");
|
||||
});
|
||||
ok(result, "Test 21d, plugin " + id + " should have click-to-play overlay with zero dims");
|
||||
|
||||
let pluginInfo = yield promiseForPluginInfo(id);
|
||||
ok(pluginInfo.activated, "Test 21d, Plugin with id=" + id + " should not be activated");
|
||||
@ -553,7 +552,7 @@ add_task(function* () {
|
||||
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
|
||||
"Test 23, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
||||
|
||||
yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
plugin.type = null;
|
||||
@ -565,7 +564,7 @@ add_task(function* () {
|
||||
pluginInfo = yield promiseForPluginInfo("test");
|
||||
is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, plugin should be TYPE_NULL");
|
||||
|
||||
let result = yield ContentTask.spawn(gTestBrowser, {}, function* () {
|
||||
yield ContentTask.spawn(gTestBrowser, null, function* () {
|
||||
let doc = content.document;
|
||||
let plugin = doc.getElementById("test");
|
||||
plugin.type = "application/x-test";
|
||||
|
@ -445,7 +445,7 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
|
||||
}
|
||||
|
||||
let window = createProperties.windowId !== null ?
|
||||
WindowManager.getWindow(createProperties.windowId) :
|
||||
WindowManager.getWindow(createProperties.windowId, context) :
|
||||
WindowManager.topWindow;
|
||||
if (!window.gBrowser) {
|
||||
let obs = (finishedWindow, topic, data) => {
|
||||
@ -629,7 +629,7 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
|
||||
|
||||
let window = windowId == null ?
|
||||
WindowManager.topWindow :
|
||||
WindowManager.getWindow(windowId);
|
||||
WindowManager.getWindow(windowId, context);
|
||||
|
||||
let browser = window.gBrowser.selectedBrowser;
|
||||
let recipient = {
|
||||
@ -774,7 +774,7 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
|
||||
|
||||
let destinationWindow = null;
|
||||
if (moveProperties.windowId !== null) {
|
||||
destinationWindow = WindowManager.getWindow(moveProperties.windowId);
|
||||
destinationWindow = WindowManager.getWindow(moveProperties.windowId, context);
|
||||
// Ignore invalid window.
|
||||
if (!destinationWindow) {
|
||||
return;
|
||||
|
@ -625,6 +625,16 @@ global.WindowManager = {
|
||||
|
||||
windowType(window) {
|
||||
// TODO: Make this work.
|
||||
|
||||
let {chromeFlags} = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell)
|
||||
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow);
|
||||
|
||||
if (chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) {
|
||||
return "popup";
|
||||
}
|
||||
|
||||
return "normal";
|
||||
},
|
||||
|
||||
@ -637,7 +647,11 @@ global.WindowManager = {
|
||||
return id;
|
||||
},
|
||||
|
||||
getWindow(id) {
|
||||
getWindow(id, context) {
|
||||
if (id == this.WINDOW_ID_CURRENT) {
|
||||
return currentWindow(context);
|
||||
}
|
||||
|
||||
for (let window of WindowListManager.browserWindows(true)) {
|
||||
if (this.getId(window) == id) {
|
||||
return window;
|
||||
@ -646,7 +660,56 @@ global.WindowManager = {
|
||||
return null;
|
||||
},
|
||||
|
||||
setState(window, state) {
|
||||
if (state != "fullscreen" && window.fullScreen) {
|
||||
window.fullScreen = false;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case "maximized":
|
||||
window.maximize();
|
||||
break;
|
||||
|
||||
case "minimized":
|
||||
case "docked":
|
||||
window.minimize();
|
||||
break;
|
||||
|
||||
case "normal":
|
||||
// Restore sometimes returns the window to its previous state, rather
|
||||
// than to the "normal" state, so it may need to be called anywhere from
|
||||
// zero to two times.
|
||||
window.restore();
|
||||
if (window.windowState != window.STATE_NORMAL) {
|
||||
window.restore();
|
||||
}
|
||||
if (window.windowState != window.STATE_NORMAL) {
|
||||
// And on OS-X, where normal vs. maximized is basically a heuristic,
|
||||
// we need to cheat.
|
||||
window.sizeToContent();
|
||||
}
|
||||
break;
|
||||
|
||||
case "fullscreen":
|
||||
window.fullScreen = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error(`Unexpected window state: ${state}`);
|
||||
}
|
||||
},
|
||||
|
||||
convert(extension, window, getInfo) {
|
||||
const STATES = {
|
||||
[window.STATE_MAXIMIZED]: "maximized",
|
||||
[window.STATE_MINIMIZED]: "minimized",
|
||||
[window.STATE_NORMAL]: "normal",
|
||||
};
|
||||
let state = STATES[window.windowState];
|
||||
if (window.fullScreen) {
|
||||
state = "fullscreen";
|
||||
}
|
||||
|
||||
let result = {
|
||||
id: this.getId(window),
|
||||
focused: window.document.hasFocus(),
|
||||
@ -655,10 +718,8 @@ global.WindowManager = {
|
||||
width: window.outerWidth,
|
||||
height: window.outerHeight,
|
||||
incognito: PrivateBrowsingUtils.isWindowPrivate(window),
|
||||
|
||||
// We fudge on these next two.
|
||||
type: this.windowType(window),
|
||||
state: window.fullScreen ? "fullscreen" : "normal",
|
||||
state,
|
||||
};
|
||||
|
||||
if (getInfo && getInfo.populate) {
|
||||
|
@ -5,6 +5,8 @@
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
|
||||
"@mozilla.org/browser/aboutnewtab-service;1",
|
||||
"nsIAboutNewTabService");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
@ -42,7 +44,7 @@ extensions.registerSchemaAPI("windows", null, (extension, context) => {
|
||||
}).api(),
|
||||
|
||||
get: function(windowId, getInfo) {
|
||||
let window = WindowManager.getWindow(windowId);
|
||||
let window = WindowManager.getWindow(windowId, context);
|
||||
return Promise.resolve(WindowManager.convert(extension, window, getInfo));
|
||||
},
|
||||
|
||||
@ -63,6 +65,13 @@ extensions.registerSchemaAPI("windows", null, (extension, context) => {
|
||||
},
|
||||
|
||||
create: function(createData) {
|
||||
if (createData.state !== null && createData.state != "normal") {
|
||||
if (createData.left !== null || createData.top !== null ||
|
||||
createData.width !== null || createData.height !== null) {
|
||||
return Promise.reject({message: `"state": "${createData.state}" may not be combined with "left", "top", "width", or "height"`});
|
||||
}
|
||||
}
|
||||
|
||||
function mkstr(s) {
|
||||
let result = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
|
||||
result.data = s;
|
||||
@ -104,17 +113,25 @@ extensions.registerSchemaAPI("windows", null, (extension, context) => {
|
||||
args.AppendElement(mkstr(aboutNewTabService.newTabURL));
|
||||
}
|
||||
|
||||
let extraFeatures = "";
|
||||
let features = ["chrome"];
|
||||
|
||||
if (createData.type === null || createData.type == "normal") {
|
||||
features.push("dialog=no", "all");
|
||||
} else {
|
||||
// All other types create "popup"-type windows by default.
|
||||
features.push("dialog", "resizable", "minimizable", "centerscreen", "titlebar", "close");
|
||||
}
|
||||
|
||||
if (createData.incognito !== null) {
|
||||
if (createData.incognito) {
|
||||
extraFeatures += ",private";
|
||||
features.push("private");
|
||||
} else {
|
||||
extraFeatures += ",non-private";
|
||||
features.push("non-private");
|
||||
}
|
||||
}
|
||||
|
||||
let window = Services.ww.openWindow(null, "chrome://browser/content/browser.xul", "_blank",
|
||||
"chrome,dialog=no,all" + extraFeatures, args);
|
||||
features.join(","), args);
|
||||
|
||||
if (createData.left !== null || createData.top !== null) {
|
||||
let left = createData.left !== null ? createData.left : window.screenX;
|
||||
@ -127,28 +144,62 @@ extensions.registerSchemaAPI("windows", null, (extension, context) => {
|
||||
window.resizeTo(width, height);
|
||||
}
|
||||
|
||||
// TODO: focused, type, state
|
||||
// TODO: focused, type
|
||||
|
||||
return new Promise(resolve => {
|
||||
window.addEventListener("load", function listener() {
|
||||
window.removeEventListener("load", listener);
|
||||
resolve(WindowManager.convert(extension, window));
|
||||
|
||||
if (createData.state == "maximized" || createData.state == "normal" ||
|
||||
(createData.state == "fullscreen" && AppConstants.platform != "macosx")) {
|
||||
window.document.documentElement.setAttribute("sizemode", createData.state);
|
||||
} else if (createData.state !== null) {
|
||||
// window.minimize() has no useful effect until the window has
|
||||
// been shown.
|
||||
|
||||
let obs = doc => {
|
||||
if (doc === window.document) {
|
||||
Services.obs.removeObserver(obs, "document-shown");
|
||||
WindowManager.setState(window, createData.state);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(obs, "document-shown", false);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
}).then(() => {
|
||||
return WindowManager.convert(extension, window);
|
||||
});
|
||||
},
|
||||
|
||||
update: function(windowId, updateInfo) {
|
||||
let window = WindowManager.getWindow(windowId);
|
||||
// TODO: When we support size/position updates:
|
||||
// if (updateInfo.state !== null && updateInfo.state != "normal") {
|
||||
// if (updateInfo.left !== null || updateInfo.top !== null ||
|
||||
// updateInfo.width !== null || updateInfo.height !== null) {
|
||||
// return Promise.reject({message: `"state": "${updateInfo.state}" may not be combined with "left", "top", "width", or "height"`});
|
||||
// }
|
||||
// }
|
||||
|
||||
let window = WindowManager.getWindow(windowId, context);
|
||||
if (updateInfo.focused) {
|
||||
Services.focus.activeWindow = window;
|
||||
}
|
||||
// TODO: All the other properties...
|
||||
|
||||
if (updateInfo.state !== null) {
|
||||
WindowManager.setState(window, updateInfo.state);
|
||||
}
|
||||
|
||||
// TODO: All the other properties, focused=false...
|
||||
|
||||
return Promise.resolve(WindowManager.convert(extension, window));
|
||||
},
|
||||
|
||||
remove: function(windowId) {
|
||||
let window = WindowManager.getWindow(windowId);
|
||||
let window = WindowManager.getWindow(windowId, context);
|
||||
window.close();
|
||||
|
||||
return new Promise(resolve => {
|
||||
|
@ -335,13 +335,11 @@
|
||||
"description": "Whether the new window should be an incognito window."
|
||||
},
|
||||
"type": {
|
||||
"unsupported": true,
|
||||
"$ref": "CreateType",
|
||||
"optional": true,
|
||||
"description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set."
|
||||
},
|
||||
"state": {
|
||||
"unsupported": true,
|
||||
"$ref": "WindowState",
|
||||
"optional": true,
|
||||
"description": "The initial state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'."
|
||||
@ -417,7 +415,6 @@
|
||||
"description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request."
|
||||
},
|
||||
"state": {
|
||||
"unsupported": true,
|
||||
"$ref": "WindowState",
|
||||
"optional": true,
|
||||
"description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'."
|
||||
|
@ -49,6 +49,7 @@ support-files =
|
||||
[browser_ext_tabs_move.js]
|
||||
[browser_ext_tabs_move_window.js]
|
||||
[browser_ext_tabs_onHighlighted.js]
|
||||
[browser_ext_windows_create.js]
|
||||
[browser_ext_windows_create_tabId.js]
|
||||
[browser_ext_windows_update.js]
|
||||
[browser_ext_contentscript_connect.js]
|
||||
|
@ -0,0 +1,167 @@
|
||||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
add_task(function* testWindowCreate() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
let _checkWindowPromise;
|
||||
browser.test.onMessage.addListener(msg => {
|
||||
if (msg == "checked-window") {
|
||||
_checkWindowPromise.resolve();
|
||||
_checkWindowPromise = null;
|
||||
}
|
||||
});
|
||||
|
||||
let os;
|
||||
|
||||
function checkWindow(expected) {
|
||||
return new Promise(resolve => {
|
||||
_checkWindowPromise = {resolve};
|
||||
browser.test.sendMessage("check-window", expected);
|
||||
});
|
||||
}
|
||||
|
||||
function createWindow(params, expected, keep = false) {
|
||||
return browser.windows.create(params).then(window => {
|
||||
for (let key of Object.keys(params)) {
|
||||
if (key == "state" && os == "mac" && params.state == "normal") {
|
||||
// OS-X doesn't have a hard distinction between "normal" and
|
||||
// "maximized" states.
|
||||
browser.test.assertTrue(window.state == "normal" || window.state == "maximized",
|
||||
`Expected window.state (currently ${window.state}) to be "normal" but will accept "maximized"`);
|
||||
} else {
|
||||
browser.test.assertEq(params[key], window[key], `Got expected value for window.${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
return checkWindow(expected).then(() => {
|
||||
if (keep) {
|
||||
return window;
|
||||
}
|
||||
if (params.state == "fullscreen" && os == "win") {
|
||||
// FIXME: Closing a fullscreen window causes a window leak in
|
||||
// Windows tests.
|
||||
return browser.windows.update(window.id, {state: "normal"}).then(() => {
|
||||
return browser.windows.remove(window.id);
|
||||
});
|
||||
}
|
||||
return browser.windows.remove(window.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
browser.runtime.getPlatformInfo().then(info => { os = info.os; })
|
||||
.then(() => createWindow({state: "maximized"}, {state: "STATE_MAXIMIZED"}))
|
||||
.then(() => createWindow({state: "minimized"}, {state: "STATE_MINIMIZED"}))
|
||||
.then(() => createWindow({state: "normal"}, {state: "STATE_NORMAL", hiddenChrome: []}))
|
||||
.then(() => createWindow({state: "fullscreen"}, {state: "STATE_FULLSCREEN"}))
|
||||
.then(() => {
|
||||
return createWindow({type: "popup"},
|
||||
{hiddenChrome: ["menubar", "toolbar", "location", "directories", "status", "extrachrome"],
|
||||
chromeFlags: ["CHROME_OPENAS_DIALOG"]},
|
||||
true);
|
||||
}).then(window => {
|
||||
return browser.tabs.query({windowType: "popup", active: true}).then(tabs => {
|
||||
browser.test.assertEq(1, tabs.length, "Expected only one popup");
|
||||
browser.test.assertEq(window.id, tabs[0].windowId, "Expected new window to be returned in query");
|
||||
|
||||
return browser.windows.remove(window.id);
|
||||
});
|
||||
}).then(() => {
|
||||
browser.test.notifyPass("window-create");
|
||||
}).catch(e => {
|
||||
browser.test.fail(`${e} :: ${e.stack}`);
|
||||
browser.test.notifyFail("window-create");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
let latestWindow;
|
||||
let windowListener = (window, topic) => {
|
||||
if (topic == "domwindowopened") {
|
||||
latestWindow = window;
|
||||
}
|
||||
};
|
||||
Services.ww.registerNotification(windowListener);
|
||||
|
||||
extension.onMessage("check-window", expected => {
|
||||
if (expected.state != null) {
|
||||
let {windowState} = latestWindow;
|
||||
if (latestWindow.fullScreen) {
|
||||
windowState = latestWindow.STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
if (expected.state == "STATE_NORMAL" && AppConstants.platform == "macosx") {
|
||||
ok(windowState == window.STATE_NORMAL || windowState == window.STATE_MAXIMIZED,
|
||||
`Expected windowState (currently ${windowState}) to be STATE_NORMAL but will accept STATE_MAXIMIZED`);
|
||||
} else {
|
||||
is(windowState, window[expected.state],
|
||||
`Expected window state to be ${expected.state}`);
|
||||
}
|
||||
}
|
||||
if (expected.hiddenChrome) {
|
||||
let chromeHidden = latestWindow.document.documentElement.getAttribute("chromehidden");
|
||||
is(chromeHidden.trim().split(/\s+/).sort().join(" "),
|
||||
expected.hiddenChrome.sort().join(" "),
|
||||
"Got expected hidden chrome");
|
||||
}
|
||||
if (expected.chromeFlags) {
|
||||
let {chromeFlags} = latestWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell)
|
||||
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow);
|
||||
for (let flag of expected.chromeFlags) {
|
||||
ok(chromeFlags & Ci.nsIWebBrowserChrome[flag],
|
||||
`Expected window to have the ${flag} flag`);
|
||||
}
|
||||
}
|
||||
|
||||
extension.sendMessage("checked-window");
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("window-create");
|
||||
yield extension.unload();
|
||||
|
||||
Services.ww.unregisterNotification(windowListener);
|
||||
latestWindow = null;
|
||||
});
|
||||
|
||||
|
||||
// Tests that incompatible parameters can't be used together.
|
||||
add_task(function* testWindowCreateParams() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
function* getCalls() {
|
||||
for (let state of ["minimized", "maximized", "fullscreen"]) {
|
||||
for (let param of ["left", "top", "width", "height"]) {
|
||||
let expected = `"state": "${state}" may not be combined with "left", "top", "width", or "height"`;
|
||||
|
||||
yield browser.windows.create({state, [param]: 100}).then(
|
||||
val => {
|
||||
browser.test.fail(`Expected error but got "${val}" instead`);
|
||||
},
|
||||
error => {
|
||||
browser.test.assertTrue(
|
||||
error.message.includes(expected),
|
||||
`Got expected error (got: '${error.message}', expected: '${expected}'`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(getCalls()).then(() => {
|
||||
browser.test.notifyPass("window-create-params");
|
||||
}).catch(e => {
|
||||
browser.test.fail(`${e} :: ${e.stack}`);
|
||||
browser.test.notifyFail("window-create-params");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("window-create-params");
|
||||
yield extension.unload();
|
||||
});
|
||||
|
@ -19,10 +19,6 @@ add_task(function* () {
|
||||
yield promiseWaitForFocus(window2);
|
||||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["windows"],
|
||||
},
|
||||
|
||||
background: function() {
|
||||
browser.windows.getAll(undefined, function(wins) {
|
||||
browser.test.assertEq(wins.length, 2, "should have two windows");
|
||||
@ -51,3 +47,81 @@ add_task(function* () {
|
||||
|
||||
yield BrowserTestUtils.closeWindow(window2);
|
||||
});
|
||||
|
||||
|
||||
add_task(function* testWindowUpdate() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background() {
|
||||
let _checkWindowPromise;
|
||||
browser.test.onMessage.addListener(msg => {
|
||||
if (msg == "checked-window") {
|
||||
_checkWindowPromise.resolve();
|
||||
_checkWindowPromise = null;
|
||||
}
|
||||
});
|
||||
|
||||
let os;
|
||||
function checkWindow(expected) {
|
||||
return new Promise(resolve => {
|
||||
_checkWindowPromise = {resolve};
|
||||
browser.test.sendMessage("check-window", expected);
|
||||
});
|
||||
}
|
||||
|
||||
function updateWindow(windowId, params, expected) {
|
||||
return browser.windows.update(windowId, params).then(window => {
|
||||
for (let key of Object.keys(params)) {
|
||||
if (key == "state" && os == "mac" && params.state == "normal") {
|
||||
// OS-X doesn't have a hard distinction between "normal" and
|
||||
// "maximized" states.
|
||||
browser.test.assertTrue(window.state == "normal" || window.state == "maximized",
|
||||
`Expected window.state (currently ${window.state}) to be "normal" but will accept "maximized"`);
|
||||
} else {
|
||||
browser.test.assertEq(params[key], window[key], `Got expected value for window.${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
return checkWindow(expected);
|
||||
});
|
||||
}
|
||||
|
||||
let windowId = browser.windows.WINDOW_ID_CURRENT;
|
||||
|
||||
browser.runtime.getPlatformInfo().then(info => { os = info.os; })
|
||||
.then(() => updateWindow(windowId, {state: "maximized"}, {state: "STATE_MAXIMIZED"}))
|
||||
.then(() => updateWindow(windowId, {state: "minimized"}, {state: "STATE_MINIMIZED"}))
|
||||
.then(() => updateWindow(windowId, {state: "normal"}, {state: "STATE_NORMAL"}))
|
||||
.then(() => updateWindow(windowId, {state: "fullscreen"}, {state: "STATE_FULLSCREEN"}))
|
||||
.then(() => updateWindow(windowId, {state: "normal"}, {state: "STATE_NORMAL"}))
|
||||
.then(() => {
|
||||
browser.test.notifyPass("window-update");
|
||||
}).catch(e => {
|
||||
browser.test.fail(`${e} :: ${e.stack}`);
|
||||
browser.test.notifyFail("window-update");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
extension.onMessage("check-window", expected => {
|
||||
if (expected.state != null) {
|
||||
let {windowState} = window;
|
||||
if (window.fullScreen) {
|
||||
windowState = window.STATE_FULLSCREEN;
|
||||
}
|
||||
|
||||
if (expected.state == "STATE_NORMAL" && AppConstants.platform == "macosx") {
|
||||
ok(windowState == window.STATE_NORMAL || windowState == window.STATE_MAXIMIZED,
|
||||
`Expected windowState (currently ${windowState}) to be STATE_NORMAL but will accept STATE_MAXIMIZED`);
|
||||
} else {
|
||||
is(windowState, window[expected.state],
|
||||
`Expected window state to be ${expected.state}`);
|
||||
}
|
||||
}
|
||||
|
||||
extension.sendMessage("checked-window");
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("window-update");
|
||||
yield extension.unload();
|
||||
});
|
||||
|
@ -58,11 +58,11 @@ add_task(function* redirector_ignores_override() {
|
||||
*/
|
||||
yield BrowserTestUtils.withNewTab(tabOptions, function*(browser) {
|
||||
yield ContentTask.spawn(browser, {}, function*() {
|
||||
is(content.location.href, "about:newtab", "Got right URL");
|
||||
is(content.document.location.href, "about:newtab", "Got right URL");
|
||||
is(content.document.nodePrincipal,
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
"nodePrincipal should match systemPrincipal");
|
||||
Assert.equal(content.location.href, "about:newtab", "Got right URL");
|
||||
Assert.equal(content.document.location.href, "about:newtab", "Got right URL");
|
||||
Assert.equal(content.document.nodePrincipal,
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
"nodePrincipal should match systemPrincipal");
|
||||
});
|
||||
}); // jshint ignore:line
|
||||
}
|
||||
@ -92,8 +92,8 @@ add_task(function* override_loads_in_browser() {
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
yield ContentTask.spawn(browser, {url: overrideURL}, function*(args) {
|
||||
is(content.location.href, args.url.trim(), "Got right URL");
|
||||
is(content.document.location.href, args.url.trim(), "Got right URL");
|
||||
Assert.equal(content.location.href, args.url.trim(), "Got right URL");
|
||||
Assert.equal(content.document.location.href, args.url.trim(), "Got right URL");
|
||||
}); // jshint ignore:line
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
@ -124,8 +124,8 @@ add_task(function* override_blank_loads_in_browser() {
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
yield ContentTask.spawn(browser, {}, function*() {
|
||||
is(content.location.href, "about:blank", "Got right URL");
|
||||
is(content.document.location.href, "about:blank", "Got right URL");
|
||||
Assert.equal(content.location.href, "about:blank", "Got right URL");
|
||||
Assert.equal(content.document.location.href, "about:blank", "Got right URL");
|
||||
}); // jshint ignore:line
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
|
@ -34,9 +34,12 @@ add_task(function* open_newtab() {
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
yield ContentTask.spawn(browser, {url: TEST_URL}, function*(args) {
|
||||
is(content.document.location.href, args.url, "document.location should match the external resource");
|
||||
is(content.document.documentURI, args.url, "document.documentURI should match the external resource");
|
||||
is(content.document.nodePrincipal.URI.spec, args.url, "nodePrincipal should match the external resource");
|
||||
Assert.equal(content.document.location.href, args.url,
|
||||
"document.location should match the external resource");
|
||||
Assert.equal(content.document.documentURI, args.url,
|
||||
"document.documentURI should match the external resource");
|
||||
Assert.equal(content.document.nodePrincipal.URI.spec, args.url,
|
||||
"nodePrincipal should match the external resource");
|
||||
});
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
@ -30,7 +30,6 @@ support-files =
|
||||
[browser_bookmarkProperties_readOnlyRoot.js]
|
||||
[browser_bookmarksProperties.js]
|
||||
[browser_drag_bookmarks_on_toolbar.js]
|
||||
skip-if = e10s # Bug ?????? - test fails - "Number of dragged items should be the same. - Got 0, expected 1"
|
||||
[browser_forgetthissite_single.js]
|
||||
[browser_history_sidebar_search.js]
|
||||
[browser_library_batch_delete.js]
|
||||
|
@ -7,12 +7,12 @@ add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
is(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
is(alwaysCheck.checked, false, "Always Check is unchecked by default");
|
||||
is(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"), false,
|
||||
"alwaysCheck pref should be false by default in test runs");
|
||||
Assert.ok(!alwaysCheck.checked, "Always Check is unchecked by default");
|
||||
Assert.ok(!Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should be false by default in test runs");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
@ -21,16 +21,16 @@ add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
yield ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
"'Always Check' checkbox should get checked after clicking the 'Set Default' button");
|
||||
|
||||
is(alwaysCheck.checked, true,
|
||||
"Clicking 'Make Default' checks the 'Always Check' checkbox");
|
||||
is(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"), true,
|
||||
"Checking the checkbox should set the pref to true");
|
||||
is(alwaysCheck.disabled, true,
|
||||
"'Always Check' checkbox is locked with default browser and alwaysCheck=true");
|
||||
is(setDefaultPane.selectedIndex, "1",
|
||||
"The 'make default' pane should not be visible when default");
|
||||
is(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"), true,
|
||||
"checkDefaultBrowser pref is now enabled");
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Clicking 'Make Default' checks the 'Always Check' checkbox");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"Checking the checkbox should set the pref to true");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check' checkbox is locked with default browser and alwaysCheck=true");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "1",
|
||||
"The 'make default' pane should not be visible when default");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"checkDefaultBrowser pref is now enabled");
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
@ -43,14 +43,14 @@ add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
is(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
is(alwaysCheck.disabled, true, "Always Check is disabled when locked");
|
||||
is(alwaysCheck.checked, true,
|
||||
"Always Check is checked because defaultPref is true and pref is locked");
|
||||
is(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"), true,
|
||||
"alwaysCheck pref should ship with 'true' by default");
|
||||
Assert.ok(alwaysCheck.disabled, "Always Check is disabled when locked");
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Always Check is checked because defaultPref is true and pref is locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should ship with 'true' by default");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
@ -59,12 +59,12 @@ add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
yield ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
"Browser is now default");
|
||||
|
||||
is(alwaysCheck.checked, true,
|
||||
"'Always Check' is still checked because it's locked");
|
||||
is(alwaysCheck.disabled, true,
|
||||
"'Always Check is disabled because it's locked");
|
||||
is(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"), true,
|
||||
"The pref is locked and so doesn't get changed");
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"'Always Check' is still checked because it's locked");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check is disabled because it's locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"The pref is locked and so doesn't get changed");
|
||||
});
|
||||
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
|
@ -39,12 +39,12 @@ function* open_subdialog_and_test_generic_start_state(browser, domcontentloadedF
|
||||
}
|
||||
}
|
||||
|
||||
ok(!!subdialog._frame.contentWindow, "The dialog should be non-null");
|
||||
isnot(subdialog._frame.contentWindow.location.toString(), "about:blank",
|
||||
Assert.ok(!!subdialog._frame.contentWindow, "The dialog should be non-null");
|
||||
Assert.notEqual(subdialog._frame.contentWindow.location.toString(), "about:blank",
|
||||
"Subdialog URL should not be about:blank");
|
||||
is(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
|
||||
Assert.equal(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
|
||||
"Overlay should be visible");
|
||||
is(expectedStyleSheetURLs.length, 0,
|
||||
Assert.equal(expectedStyleSheetURLs.length, 0,
|
||||
"No stylesheets that were expected are missing");
|
||||
return result;
|
||||
});
|
||||
@ -64,14 +64,14 @@ function* close_subdialog_and_test_generic_end_state(browser, closingFn, closing
|
||||
info("waiting for about:blank load");
|
||||
yield ContentTaskUtils.waitForEvent(frame, "load");
|
||||
|
||||
isnot(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
|
||||
Assert.notEqual(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
|
||||
"overlay is not visible");
|
||||
is(frame.getAttribute("style"), "", "inline styles should be cleared");
|
||||
is(frame.contentWindow.location.href.toString(), "about:blank",
|
||||
Assert.equal(frame.getAttribute("style"), "", "inline styles should be cleared");
|
||||
Assert.equal(frame.contentWindow.location.href.toString(), "about:blank",
|
||||
"sub-dialog should be unloaded");
|
||||
is(closingEvent.detail.button, expectations.closingButton,
|
||||
Assert.equal(closingEvent.detail.button, expectations.closingButton,
|
||||
"closing event should indicate button was '" + expectations.closingButton + "'");
|
||||
is(actualAcceptCount, expectations.acceptCount,
|
||||
Assert.equal(actualAcceptCount, expectations.acceptCount,
|
||||
"should be 1 if accepted, 0 if canceled, undefined if closed w/out button");
|
||||
});
|
||||
|
||||
@ -97,9 +97,9 @@ add_task(function* check_titlebar_focus_returnval_titlechanges_accepting() {
|
||||
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
|
||||
let dialog = content.window.gSubDialog._frame.contentWindow;
|
||||
let dialogTitleElement = content.document.getElementById("dialogTitle");
|
||||
is(dialogTitleElement.textContent, "Sample sub-dialog",
|
||||
Assert.equal(dialogTitleElement.textContent, "Sample sub-dialog",
|
||||
"Title should be correct initially");
|
||||
is(dialog.document.activeElement.value, "Default text",
|
||||
Assert.equal(dialog.document.activeElement.value, "Default text",
|
||||
"Textbox with correct text is focused");
|
||||
dialog.document.title = "Updated title";
|
||||
});
|
||||
@ -109,7 +109,8 @@ add_task(function* check_titlebar_focus_returnval_titlechanges_accepting() {
|
||||
|
||||
ContentTask.spawn(tab.linkedBrowser, null, function*() {
|
||||
let dialogTitleElement = content.document.getElementById("dialogTitle");
|
||||
is(dialogTitleElement.textContent, "Updated title", "subdialog should have updated title");
|
||||
Assert.equal(dialogTitleElement.textContent, "Updated title",
|
||||
"subdialog should have updated title");
|
||||
});
|
||||
|
||||
// Accept the dialog
|
||||
@ -182,8 +183,10 @@ add_task(function* correct_width_and_height_should_be_used_for_dialog() {
|
||||
|
||||
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
|
||||
let frameStyle = content.window.gSubDialog._frame.style;
|
||||
is(frameStyle.width, "32em", "Width should be set on the frame from the dialog");
|
||||
is(frameStyle.height, "5em", "Height should be set on the frame from the dialog");
|
||||
Assert.equal(frameStyle.width, "32em",
|
||||
"Width should be set on the frame from the dialog");
|
||||
Assert.equal(frameStyle.height, "5em",
|
||||
"Height should be set on the frame from the dialog");
|
||||
});
|
||||
|
||||
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
|
||||
@ -215,11 +218,11 @@ add_task(function* wrapped_text_in_dialog_should_have_expected_scrollHeight() {
|
||||
yield ContentTask.spawn(tab.linkedBrowser, oldHeight, function*(oldHeight) {
|
||||
let frame = content.window.gSubDialog._frame;
|
||||
let docEl = frame.contentDocument.documentElement;
|
||||
is(frame.style.width, "32em",
|
||||
Assert.equal(frame.style.width, "32em",
|
||||
"Width should be set on the frame from the dialog");
|
||||
ok(docEl.scrollHeight > oldHeight,
|
||||
Assert.ok(docEl.scrollHeight > oldHeight,
|
||||
"Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
|
||||
is(frame.style.height, docEl.scrollHeight + "px",
|
||||
Assert.equal(frame.style.height, docEl.scrollHeight + "px",
|
||||
"Height on the frame should be higher now");
|
||||
});
|
||||
|
||||
@ -236,8 +239,8 @@ add_task(function* dialog_too_tall_should_get_reduced_in_height() {
|
||||
|
||||
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
|
||||
let frame = content.window.gSubDialog._frame;
|
||||
is(frame.style.width, "32em", "Width should be set on the frame from the dialog");
|
||||
ok(parseInt(frame.style.height) < content.window.innerHeight,
|
||||
Assert.equal(frame.style.width, "32em", "Width should be set on the frame from the dialog");
|
||||
Assert.ok(parseInt(frame.style.height, 10) < content.window.innerHeight,
|
||||
"Height on the frame should be smaller than window's innerHeight");
|
||||
});
|
||||
|
||||
@ -255,9 +258,9 @@ add_task(function* scrollWidth_and_scrollHeight_from_subdialog_should_size_the_b
|
||||
|
||||
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
|
||||
let frame = content.window.gSubDialog._frame;
|
||||
ok(frame.style.width.endsWith("px"),
|
||||
Assert.ok(frame.style.width.endsWith("px"),
|
||||
"Width (" + frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
|
||||
ok(frame.style.height.endsWith("px"),
|
||||
Assert.ok(frame.style.height.endsWith("px"),
|
||||
"Height (" + frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
|
||||
});
|
||||
|
||||
|
@ -14,13 +14,11 @@ add_task(function* test_no_sessionrestore_button() {
|
||||
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
let display = yield ContentTask.spawn(browser, {}, function* (){
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
let button = content.document.getElementById("restorePreviousSession");
|
||||
return content.getComputedStyle(button).display;
|
||||
Assert.equal(content.getComputedStyle(button).display, "none",
|
||||
"The Session Restore about:home button should be disabled");
|
||||
});
|
||||
|
||||
is(display, "none",
|
||||
"The Session Restore about:home button should be disabled");
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -14,11 +14,10 @@ add_task(function* testNoSessionRestoreButton() {
|
||||
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
let disabled = yield ContentTask.spawn(browser, {}, function* (){
|
||||
return content.document.getElementById("errorTryAgain").disabled;
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
Assert.ok(content.document.getElementById("errorTryAgain").disabled,
|
||||
"The Restore about:sessionrestore button should be disabled");
|
||||
});
|
||||
|
||||
ok(disabled, "The Restore about:sessionrestore button should be disabled");
|
||||
|
||||
win.close();
|
||||
});
|
||||
|
@ -32,25 +32,21 @@ add_task(function* () {
|
||||
yield promiseTabRestored(tab2);
|
||||
|
||||
// Query a few values from the top and its child frames.
|
||||
let query = ContentTask.spawn(tab2.linkedBrowser, null, function* () {
|
||||
return [
|
||||
content.document.getElementById("out1").value,
|
||||
yield ContentTask.spawn(tab2.linkedBrowser, null, function* () {
|
||||
Assert.notEqual(content.document.getElementById("out1").value,
|
||||
content.frames[1].document.getElementById("out1").value,
|
||||
content.document.getElementsByName("1|#out2")[0].value,
|
||||
content.frames[1].document.getElementById("out2").value,
|
||||
content.frames[0].frames[1].document.getElementById("in1").value,
|
||||
content.frames[1].frames[0].document.getElementById("in1").value
|
||||
];
|
||||
"text isn't reused for frames");
|
||||
Assert.notEqual(content.document.getElementsByName("1|#out2")[0].value,
|
||||
"", "text containing | and # is correctly restored");
|
||||
Assert.equal(content.frames[1].document.getElementById("out2").value,
|
||||
"", "id prefixes can't be faked");
|
||||
// Disabled for now, Bug 588077
|
||||
//Assert.equal(content.frames[0].frames[1].document.getElementById("in1").value,
|
||||
// "", "id prefixes aren't mixed up");
|
||||
Assert.equal(content.frames[1].frames[0].document.getElementById("in1").value,
|
||||
"", "id prefixes aren't mixed up");
|
||||
});
|
||||
|
||||
let [v1, v2, v3, v4, v5, v6] = yield query;
|
||||
isnot(v1, v2, "text isn't reused for frames");
|
||||
isnot(v3, "", "text containing | and # is correctly restored");
|
||||
is(v4, "", "id prefixes can't be faked");
|
||||
// Disabled for now, Bug 588077
|
||||
//is(v5, "", "id prefixes aren't mixed up");
|
||||
is(v6, "", "id prefixes aren't mixed up");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab2);
|
||||
gBrowser.removeTab(tab);
|
||||
|
@ -4,6 +4,12 @@ const REFERRER1 = "http://example.org/?" + Date.now();
|
||||
const REFERRER2 = "http://example.org/?" + Math.random();
|
||||
|
||||
add_task(function* () {
|
||||
function* checkDocumentReferrer(referrer, msg) {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, { referrer, msg }, function* (args) {
|
||||
Assert.equal(content.document.referrer, args.referrer, args.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// Add a new tab.
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
let browser = tab.linkedBrowser;
|
||||
@ -22,21 +28,15 @@ add_task(function* () {
|
||||
tabState.entries[0].referrer = REFERRER2;
|
||||
yield promiseTabState(tab, tabState);
|
||||
|
||||
is((yield promiseDocumentReferrer()), REFERRER2,
|
||||
"document.referrer matches referrer set via setTabState.");
|
||||
yield checkDocumentReferrer(REFERRER2,
|
||||
"document.referrer matches referrer set via setTabState.");
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
// Restore the closed tab.
|
||||
tab = ss.undoCloseTab(window, 0);
|
||||
yield promiseTabRestored(tab);
|
||||
|
||||
is((yield promiseDocumentReferrer()), REFERRER2,
|
||||
"document.referrer is still correct after closing and reopening the tab.");
|
||||
yield checkDocumentReferrer(REFERRER2,
|
||||
"document.referrer is still correct after closing and reopening the tab.");
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
function promiseDocumentReferrer() {
|
||||
return ContentTask.spawn(gBrowser.selectedBrowser, null, function* () {
|
||||
return content.document.referrer;
|
||||
});
|
||||
}
|
||||
|
@ -43,10 +43,9 @@ function checkState(tab) {
|
||||
// not currently Xrayable (see bug 1014991), trying to pull |obj3| (a RegExp)
|
||||
// off of an Xrayed Object won't work. So we need to waive.
|
||||
ContentTask.spawn(tab.linkedBrowser, aEvent.state, function(state) {
|
||||
return Cu.waiveXrays(state).obj3.toString();
|
||||
}).then(function(stateStr) {
|
||||
is(stateStr, '/^a$/', "second popstate object.");
|
||||
|
||||
Assert.equal(Cu.waiveXrays(state).obj3.toString(),
|
||||
"/^a$/", "second popstate object.");
|
||||
}).then(function() {
|
||||
// Make sure that the new-elem node is present in the document. If it's
|
||||
// not, then this history entry has a different doc identifier than the
|
||||
// previous entry, which is bad.
|
||||
|
@ -28,7 +28,7 @@ add_task(function*() {
|
||||
|
||||
yield ContentTask.spawn(browser, PAGE_2, function*(PAGE_2) {
|
||||
docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
is(docShell.currentURI.spec, PAGE_2,
|
||||
Assert.equal(docShell.currentURI.spec, PAGE_2,
|
||||
"Content should have PAGE_2 as the browser currentURI");
|
||||
});
|
||||
|
||||
|
@ -16,7 +16,8 @@ function checkTabContents(browser) {
|
||||
let Ci = Components.interfaces;
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
|
||||
return history && history.count == 1 && content.document.documentURI == "about:mozilla";
|
||||
Assert.ok(history && history.count == 1 && content.document.documentURI == "about:mozilla",
|
||||
"expected tab contents found");
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,13 +44,13 @@ add_task(function* () {
|
||||
|
||||
// Purge session history.
|
||||
Services.obs.notifyObservers(null, "browser:purge-session-history", "");
|
||||
ok((yield checkTabContents(browser)), "expected tab contents found");
|
||||
yield checkTabContents(browser);
|
||||
ok(tab2.hasAttribute("pending"), "tab is still pending");
|
||||
|
||||
// Kick off tab restoration.
|
||||
gBrowser.selectedTab = tab2;
|
||||
yield promiseTabRestored(tab2);
|
||||
ok((yield checkTabContents(browser2)), "expected tab contents found");
|
||||
yield checkTabContents(browser2);
|
||||
ok(!tab2.hasAttribute("pending"), "tab is not pending anymore");
|
||||
|
||||
// Cleanup.
|
||||
|
@ -40,13 +40,12 @@ var testSwitchToTab = Task.async(function* (url, options) {
|
||||
is(browser.currentURI.spec, url, "correct URL loaded");
|
||||
|
||||
// Check that we didn't lose any history entries.
|
||||
let count = yield ContentTask.spawn(browser, null, function* () {
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
let Ci = Components.interfaces;
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
|
||||
return history && history.count;
|
||||
Assert.equal(history && history.count, 3, "three history entries");
|
||||
});
|
||||
is(count, 3, "three history entries");
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
|
@ -2,14 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function retrieveUserContextId(browser) {
|
||||
return ContentTask.spawn(browser, null, function* () {
|
||||
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
return loadContext.originAttributes.userContextId;
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function() {
|
||||
add_task(function* () {
|
||||
for (let i = 0; i < 3; ++i) {
|
||||
let tab = gBrowser.addTab("http://example.com/", {userContextId: i});
|
||||
let browser = tab.linkedBrowser;
|
||||
@ -20,8 +13,11 @@ add_task(function() {
|
||||
let browser2 = tab2.linkedBrowser;
|
||||
yield promiseTabRestored(tab2)
|
||||
|
||||
let userContextId = yield retrieveUserContextId(browser2);
|
||||
is(userContextId, i, "The docShell has the correct userContextId");
|
||||
yield ContentTask.spawn(browser2, { expectedId: i }, function* (args) {
|
||||
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
|
||||
Assert.equal(loadContext.originAttributes.userContextId,
|
||||
args.expectedId, "The docShell has the correct userContextId");
|
||||
});
|
||||
|
||||
yield promiseRemoveTab(tab);
|
||||
yield promiseRemoveTab(tab2);
|
||||
|
@ -2,12 +2,13 @@
|
||||
|
||||
const URL = "http://example.com/browser_switch_remoteness_";
|
||||
|
||||
function countHistoryEntries(browser) {
|
||||
return ContentTask.spawn(browser, null, function* () {
|
||||
function countHistoryEntries(browser, expected) {
|
||||
return ContentTask.spawn(browser, { expected }, function* (args) {
|
||||
let Ci = Components.interfaces;
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
|
||||
return history && history.count;
|
||||
Assert.equal(history && history.count, args.expected,
|
||||
"correct number of shistory entries");
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,8 +31,7 @@ add_task(function* () {
|
||||
}
|
||||
|
||||
// Check we have the right number of shistory entries.
|
||||
let count = yield countHistoryEntries(browser);
|
||||
is(count, MAX_BACK + 2, "correct number of shistory entries");
|
||||
yield countHistoryEntries(browser, MAX_BACK + 2);
|
||||
|
||||
// Load a non-remote page.
|
||||
browser.loadURI("about:robots");
|
||||
@ -39,8 +39,7 @@ add_task(function* () {
|
||||
ok(!browser.isRemoteBrowser, "browser is not remote anymore");
|
||||
|
||||
// Check that we didn't lose any shistory entries.
|
||||
count = yield countHistoryEntries(browser);
|
||||
is(count, MAX_BACK + 3, "correct number of shistory entries");
|
||||
yield countHistoryEntries(browser, MAX_BACK + 3);
|
||||
|
||||
// Cleanup.
|
||||
gBrowser.removeTab(tab);
|
||||
|
@ -48,7 +48,7 @@ add_task(function* test_bing_translation() {
|
||||
let result = yield client.translate();
|
||||
|
||||
// XXXmikedeboer; here you would continue the test/ content inspection.
|
||||
ok(result, "There should be a result");
|
||||
Assert.ok(result, "There should be a result");
|
||||
});
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
@ -89,7 +89,7 @@ add_task(function* test_handling_out_of_valid_key_error() {
|
||||
client._resetToken();
|
||||
|
||||
// Checking if the client detected service and unavailable.
|
||||
ok(client._serviceUnavailable, "Service should be detected unavailable.");
|
||||
Assert.ok(client._serviceUnavailable, "Service should be detected unavailable.");
|
||||
});
|
||||
|
||||
// Cleaning up.
|
||||
|
@ -47,7 +47,7 @@ add_task(function* test_yandex_translation() {
|
||||
new TranslationDocument(content.document), "fr", "en");
|
||||
let result = yield client.translate();
|
||||
|
||||
ok(result, "There should be a result.");
|
||||
Assert.ok(result, "There should be a result.");
|
||||
});
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
|
@ -240,10 +240,9 @@ if (typeof Mozilla == 'undefined') {
|
||||
* @param {Object} extraURLCampaignParams - An object containing additional
|
||||
* paramaters for the URL opened by the browser for reasons of promotional
|
||||
* campaign tracking. Each attribute of the object must have a name that
|
||||
* begins with "utm_" and a value that is a string. Both the name and value
|
||||
* must contain only alphanumeric characters, dashes or underscores (meaning
|
||||
* that you are limited to values that don't need encoding, as any such
|
||||
* characters in the name or value will be rejected.)
|
||||
* begins with "utm_" and a value that is a string that contains only only
|
||||
* alphanumeric characters, dashes or underscores. The values may be any
|
||||
* string and will automatically be encoded.
|
||||
*/
|
||||
Mozilla.UITour.showFirefoxAccounts = function(extraURLCampaignParams) {
|
||||
_sendEvent('showFirefoxAccounts', {
|
||||
|
@ -39,7 +39,7 @@ skip-if = e10s # Bug 1240747 - UITour.jsm not e10s friendly.
|
||||
skip-if = true # Bug 1225832 - New Loop architecture is not compatible with test.
|
||||
[browser_UITour_loop_panel.js]
|
||||
[browser_UITour_modalDialog.js]
|
||||
skip-if = os != "mac" || e10s # modal dialog disabling only working on OS X. Bug 1240747 - UITour.jsm not e10s friendly
|
||||
skip-if = os != "mac" # modal dialog disabling only working on OS X.
|
||||
[browser_UITour_observe.js]
|
||||
skip-if = e10s # Bug 1240747 - UITour.jsm not e10s friendly.
|
||||
[browser_UITour_panel_close_annotation.js]
|
||||
|
25
browser/extensions/loop/bootstrap.js
vendored
25
browser/extensions/loop/bootstrap.js
vendored
@ -601,18 +601,25 @@ var WindowListener = {
|
||||
|
||||
let cursor = document.getElementById("loop-remote-cursor");
|
||||
if (!cursor) {
|
||||
cursor = document.createElement("image");
|
||||
// Create a container to keep the pointer inside.
|
||||
// This allows us to hide the overflow when out of bounds.
|
||||
let cursorContainer = document.createElement("div");
|
||||
cursorContainer.setAttribute("id", "loop-remote-cursor-container");
|
||||
|
||||
cursor = document.createElement("img");
|
||||
cursor.setAttribute("id", "loop-remote-cursor");
|
||||
|
||||
cursorContainer.appendChild(cursor);
|
||||
// Note that browser.parent is a xul:stack so container will use
|
||||
// 100% of space if no other constrains added.
|
||||
browser.parentNode.appendChild(cursorContainer);
|
||||
}
|
||||
|
||||
// Update the cursor's position.
|
||||
cursor.setAttribute("left",
|
||||
cursorData.ratioX * browser.boxObject.width);
|
||||
cursor.setAttribute("top",
|
||||
cursorData.ratioY * browser.boxObject.height);
|
||||
|
||||
// browser's parent is a xul:stack, so positioning with left/top works.
|
||||
browser.parentNode.appendChild(cursor);
|
||||
// Update the cursor's position with CSS.
|
||||
cursor.style.left =
|
||||
Math.abs(cursorData.ratioX * browser.boxObject.width) + "px";
|
||||
cursor.style.top =
|
||||
Math.abs(cursorData.ratioY * browser.boxObject.height) + "px";
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -144,6 +144,14 @@ const kMauPrefMap = new Map(
|
||||
return [LOOP_MAU_TYPE[name], parts[0] + parts[1].charAt(0).toUpperCase() + parts[1].substr(1)];
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* WARNING: Every function in kMessageHandlers must call the reply() function,
|
||||
* as otherwise the content requesters can be left hanging.
|
||||
*
|
||||
* Ideally, we should rewrite them to handle failure/long times better, at which
|
||||
* point this could be relaxed slightly.
|
||||
*/
|
||||
const kMessageHandlers = {
|
||||
/**
|
||||
* Start browser sharing, which basically means to start listening for tab
|
||||
|
@ -99,10 +99,8 @@ loop.SimpleSlideshow = function () {
|
||||
var slidesNodes = this.props.data.map(function (slideNode, index) {
|
||||
var isActive = state.currentSlide === index;
|
||||
return React.createElement(Slide, { active: isActive,
|
||||
imageAlt: slideNode.imageAlt,
|
||||
imageClass: slideNode.imageClass,
|
||||
indexClass: slideNode.id,
|
||||
key: slideNode.id,
|
||||
text: slideNode.text,
|
||||
title: slideNode.title });
|
||||
});
|
||||
|
@ -376,6 +376,44 @@ html[dir="rtl"] .settings-menu.dropdown-menu {
|
||||
}
|
||||
}
|
||||
|
||||
/* Stream paused */
|
||||
.focus-stream > .room-inner-info-area > .remote-stream-paused {
|
||||
background-color: #fff;
|
||||
border: solid 1px #a6a6a6;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,.25);
|
||||
display: inline-block;
|
||||
margin: auto;
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.focus-stream > .room-inner-info-area > .remote-stream-paused > h1 {
|
||||
font-size: 1.6rem;
|
||||
line-height: 3rem;
|
||||
padding-left: 42px;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.focus-stream > .room-inner-info-area > .remote-stream-paused > h1:before {
|
||||
background: url("../img/paused-hello.svg") center center no-repeat;
|
||||
content: "";
|
||||
display: block;
|
||||
height: 30px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .focus-stream > .room-inner-info-area > .remote-stream-paused > h1 {
|
||||
padding-left: 0;
|
||||
padding-right: 42px;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .focus-stream > .room-inner-info-area > .remote-stream-paused > h1:before {
|
||||
right: 0;
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
.remote > .avatar {
|
||||
/* make visually distinct from local avatar */
|
||||
opacity: 0.25;
|
||||
@ -595,6 +633,10 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item {
|
||||
background-color: #d8d8d8;
|
||||
}
|
||||
|
||||
.media-wrapper > .focus-stream.screen-sharing-paused > .remote-video-box {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.media-wrapper > .local {
|
||||
flex: 0 1 auto;
|
||||
width: 200px;
|
||||
|
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 225 50"><path fill="#1E92CE" d="M146.3,20.2c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.3-0.1-0.5-0.1c-0.2,0-0.3,0-0.5,0.1 c-0.2,0.1-0.3,0.2-0.4,0.3c-0.1,0.1-0.2,0.3-0.3,0.4c-0.1,0.2-0.1,0.3-0.1,0.5c0,0.2,0,0.4,0.1,0.5c0.1,0.2,0.2,0.3,0.3,0.4 c0.1,0.1,0.2,0.2,0.4,0.3c0.2,0.1,0.3,0.1,0.5,0.1c0.2,0,0.3,0,0.5-0.1c0.2-0.1,0.3-0.2,0.4-0.3c0.1-0.1,0.2-0.3,0.3-0.4 c0.1-0.2,0.1-0.3,0.1-0.5c0-0.2,0-0.3-0.1-0.5C146.5,20.4,146.4,20.3,146.3,20.2z M146.3,21.5c-0.1,0.1-0.1,0.2-0.2,0.3 c-0.1,0.1-0.2,0.2-0.3,0.2c-0.1,0.1-0.3,0.1-0.4,0.1c-0.1,0-0.3,0-0.4-0.1c-0.1-0.1-0.2-0.1-0.3-0.2c-0.1-0.1-0.2-0.2-0.2-0.3 c-0.1-0.1-0.1-0.3-0.1-0.4c0-0.2,0-0.3,0.1-0.4c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.2c0.1-0.1,0.3-0.1,0.4-0.1 c0.1,0,0.3,0,0.4,0.1c0.1,0.1,0.2,0.1,0.3,0.2c0.1,0.1,0.2,0.2,0.2,0.3c0.1,0.1,0.1,0.3,0.1,0.4C146.4,21.2,146.4,21.4,146.3,21.5 z M145.7,21.4C145.7,21.3,145.6,21.3,145.7,21.4c-0.1-0.1-0.1-0.1-0.1-0.2c0,0,0,0,0,0c0.1,0,0.2,0,0.3-0.1 c0.1-0.1,0.1-0.2,0.1-0.3c0-0.1,0-0.1,0-0.2c0,0,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.2,0H145v1.4h0.2v-0.6 c0,0,0,0,0.1,0c0,0,0,0,0,0c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.1,0.1,0.2l0.1,0.2h0.3L145.7,21.4C145.7,21.4,145.7,21.4,145.7,21.4z M145.3,21h-0.1v-0.5h0.1c0.1,0,0.2,0,0.2,0.1c0,0,0.1,0.1,0.1,0.2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0-0.1,0.1 C145.4,21,145.4,21,145.3,21z M54.4,37.8h4.1V26.5h6.8v-3.3h-6.8v-6.7h8.4l0.5-3.3h-13V37.8z M71.6,11.9c-1.5,0-2.6,1.2-2.6,2.6 c0,1.4,1.1,2.6,2.5,2.6c1.5,0,2.6-1.2,2.6-2.6C74.1,13.1,73,11.9,71.6,11.9z M69.5,37.8h3.9V19.4l-3.9,0.7V37.8z M85.4,19.3 c-1.7,0-3.2,0.9-4.6,2.9c0-1-0.2-2-0.7-2.8l-3.6,0.9c0.4,1.1,0.6,2.6,0.6,4.8v12.7h3.9V25.6c0.4-1.5,1.7-2.7,3.4-2.7 c0.4,0,0.7,0.1,1.1,0.2l1.2-3.6C86.3,19.4,86,19.3,85.4,19.3z M94,19.4c-2.3,0-4,0.7-5.5,2.4c-1.6,1.8-2.2,3.9-2.2,7 c0,5.7,3.2,9.4,8.3,9.4c2.4,0,4.6-0.8,6.4-2.4l-1.5-2.4c-1.3,1.2-2.8,1.8-4.5,1.8c-3.5,0-4.4-2.6-4.4-5.1v-0.3h10.7V29 c0-4.2-0.8-6.4-2.3-7.8C97.4,19.9,95.7,19.4,94,19.4z M90.6,27c0-2.9,1.2-4.6,3.4-4.6c1.9,0,3.2,1.7,3.2,4.6H90.6z M108,19.8v-2.7 c0-1.6,0.9-2.5,2.2-2.5c0.7,0,1.3,0.2,2.2,0.6l1.3-2.5c-1.2-0.7-2.5-1-4-1c-3.2,0-5.5,1.7-5.5,5.5c0,1.7,0.1,2.7,0.1,2.7h-1.7v2.7 h1.7v15.3h3.9V22.5h3.7l1-2.7H108z M119.9,19.4c-4.7,0-7.8,3.7-7.8,9.4c0,5.7,3,9.4,7.9,9.4c4.9,0,7.9-3.6,7.9-9.4 C127.9,23.2,125,19.4,119.9,19.4z M120.1,35.3c-2.3,0-3.6-1.5-3.6-6.7c0-4.4,1.1-6.2,3.5-6.2c2.3,0,3.7,1.5,3.7,6.6 C123.6,33.4,122.4,35.3,120.1,35.3z M143.2,19.8h-4.5c-0.5,0.7-2.3,4.3-2.8,5.5c-0.9-1.7-2.4-4.5-3.3-5.8l-4.2,0.9l5.2,7.7 l-6.7,9.7h4.9c0.7-1,3.2-5.4,3.9-6.7c0.4,0.6,3.3,5.7,3.9,6.7h4.9L138,28L143.2,19.8z M165.8,23.6h-10.3V13.3h-2.9v24.6h2.9V26 h10.3v11.9h2.9V13.3h-2.9V23.6z M179,19.5c-2.1,0-3.9,0.8-5.3,2.5c-1.5,1.8-2.1,3.7-2.1,6.7c0,5.9,3,9.5,7.9,9.5 c2.3,0,4.4-0.8,6-2.2l-1.1-1.8c-1.3,1.1-2.6,1.7-4.4,1.7c-1.8,0-3.4-0.6-4.4-2.2c-0.6-0.9-0.8-2.2-0.8-3.9v-0.4h11.1V29 c-0.1-4.3-0.5-5.9-2-7.5C182.6,20.2,181,19.5,179,19.5z M174.8,27.3c0.1-3.7,1.6-5.6,4.1-5.6c1.4,0,2.6,0.6,3.2,1.6 c0.5,0.9,0.8,2,0.8,4H174.8z M193.1,36.1c-0.8,0-1-0.4-1-1.8V16c0-2.7-0.5-4.2-0.5-4.2l-2.8,0.5c0,0,0.4,1.3,0.4,3.7v18.9 c0,1.3,0.3,2,0.9,2.5c0.5,0.5,1.3,0.8,2.1,0.8c0.8,0,1.1-0.1,1.8-0.4l-0.6-1.8C193.4,36,193.2,36.1,193.1,36.1z M200.3,36.1 c-0.8,0-1-0.4-1-1.8V16c0-2.7-0.5-4.2-0.5-4.2l-2.8,0.5c0,0,0.4,1.3,0.4,3.7v18.9c0,1.3,0.3,2,0.9,2.5c0.5,0.5,1.2,0.8,2.1,0.8 c0.7,0,1.1-0.1,1.8-0.4l-0.6-1.8C200.6,36,200.4,36.1,200.3,36.1z M216.3,22.6c-1.2-1.8-3.1-3.1-6.1-3.1c-4.7,0-7.6,3.5-7.6,9.4 c0,5.9,2.8,9.5,7.7,9.5c4.5,0,7.7-3.2,7.7-9.1C218,26.3,217.5,24.2,216.3,22.6z M214.3,33.3c-0.6,1.7-2,2.7-3.9,2.7 c-1.5,0-3-0.7-3.6-1.8c-0.7-1.1-1.1-3.3-1.1-5.8c0-2.1,0.3-3.5,0.9-4.7c0.6-1.2,2.1-1.9,3.6-1.9c1.5,0,3,0.7,3.8,2.3 c0.6,1.2,0.8,2.9,0.8,5.4C214.8,31.2,214.7,32.2,214.3,33.3z M26.1,7.7C16.1,7.7,8,14.9,8,23.6c0,4.4,2,8.3,5.2,11.2 c-0.6,2-1.7,4.7-3.9,7.3c0.4,0.7,6.6-1.7,11-3.4c1.8,0.5,3.7,0.8,5.7,0.8c10,0,18.1-7.1,18.1-15.9C44.1,14.9,36,7.7,26.1,7.7z M31.5,17.3c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4C29.1,18.3,30.2,17.3,31.5,17.3z M20.6,17.3 c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4C18.2,18.3,19.3,17.3,20.6,17.3z M26.1,34.7 C26.1,34.7,26,34.7,26.1,34.7c-0.1,0-0.1,0-0.1,0c-4.8,0-10.2-3.1-11.5-8.4c3.3,1.5,7.8,2.2,11.5,2.2c3.7,0,8.3-0.7,11.5-2.2 C36.3,31.6,30.9,34.7,26.1,34.7z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 225 50"><path fill="#06A6E0" d="M146.3,20.2c-0.1-0.1-0.2-0.2-0.4-0.3c-0.2-0.1-0.3-0.1-0.5-0.1c-0.2,0-0.3,0-0.5,0.1 c-0.2,0.1-0.3,0.2-0.4,0.3c-0.1,0.1-0.2,0.3-0.3,0.4c-0.1,0.2-0.1,0.3-0.1,0.5c0,0.2,0,0.4,0.1,0.5c0.1,0.2,0.2,0.3,0.3,0.4 c0.1,0.1,0.2,0.2,0.4,0.3c0.2,0.1,0.3,0.1,0.5,0.1c0.2,0,0.3,0,0.5-0.1c0.2-0.1,0.3-0.2,0.4-0.3c0.1-0.1,0.2-0.3,0.3-0.4 c0.1-0.2,0.1-0.3,0.1-0.5c0-0.2,0-0.3-0.1-0.5C146.5,20.4,146.4,20.3,146.3,20.2z M146.3,21.5c-0.1,0.1-0.1,0.2-0.2,0.3 c-0.1,0.1-0.2,0.2-0.3,0.2c-0.1,0.1-0.3,0.1-0.4,0.1c-0.1,0-0.3,0-0.4-0.1c-0.1-0.1-0.2-0.1-0.3-0.2c-0.1-0.1-0.2-0.2-0.2-0.3 c-0.1-0.1-0.1-0.3-0.1-0.4c0-0.2,0-0.3,0.1-0.4c0.1-0.1,0.1-0.2,0.2-0.3c0.1-0.1,0.2-0.2,0.3-0.2c0.1-0.1,0.3-0.1,0.4-0.1 c0.1,0,0.3,0,0.4,0.1c0.1,0.1,0.2,0.1,0.3,0.2c0.1,0.1,0.2,0.2,0.2,0.3c0.1,0.1,0.1,0.3,0.1,0.4C146.4,21.2,146.4,21.4,146.3,21.5 z M145.7,21.4C145.7,21.3,145.6,21.3,145.7,21.4c-0.1-0.1-0.1-0.1-0.1-0.2c0,0,0,0,0,0c0.1,0,0.2,0,0.3-0.1 c0.1-0.1,0.1-0.2,0.1-0.3c0-0.1,0-0.1,0-0.2c0,0,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.2,0H145v1.4h0.2v-0.6 c0,0,0,0,0.1,0c0,0,0,0,0,0c0,0,0.1,0.1,0.1,0.1c0,0.1,0.1,0.1,0.1,0.2l0.1,0.2h0.3L145.7,21.4C145.7,21.4,145.7,21.4,145.7,21.4z M145.3,21h-0.1v-0.5h0.1c0.1,0,0.2,0,0.2,0.1c0,0,0.1,0.1,0.1,0.2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0-0.1,0.1 C145.4,21,145.4,21,145.3,21z M54.4,37.8h4.1V26.5h6.8v-3.3h-6.8v-6.7h8.4l0.5-3.3h-13V37.8z M71.6,11.9c-1.5,0-2.6,1.2-2.6,2.6 c0,1.4,1.1,2.6,2.5,2.6c1.5,0,2.6-1.2,2.6-2.6C74.1,13.1,73,11.9,71.6,11.9z M69.5,37.8h3.9V19.4l-3.9,0.7V37.8z M85.4,19.3 c-1.7,0-3.2,0.9-4.6,2.9c0-1-0.2-2-0.7-2.8l-3.6,0.9c0.4,1.1,0.6,2.6,0.6,4.8v12.7h3.9V25.6c0.4-1.5,1.7-2.7,3.4-2.7 c0.4,0,0.7,0.1,1.1,0.2l1.2-3.6C86.3,19.4,86,19.3,85.4,19.3z M94,19.4c-2.3,0-4,0.7-5.5,2.4c-1.6,1.8-2.2,3.9-2.2,7 c0,5.7,3.2,9.4,8.3,9.4c2.4,0,4.6-0.8,6.4-2.4l-1.5-2.4c-1.3,1.2-2.8,1.8-4.5,1.8c-3.5,0-4.4-2.6-4.4-5.1v-0.3h10.7V29 c0-4.2-0.8-6.4-2.3-7.8C97.4,19.9,95.7,19.4,94,19.4z M90.6,27c0-2.9,1.2-4.6,3.4-4.6c1.9,0,3.2,1.7,3.2,4.6H90.6z M108,19.8v-2.7 c0-1.6,0.9-2.5,2.2-2.5c0.7,0,1.3,0.2,2.2,0.6l1.3-2.5c-1.2-0.7-2.5-1-4-1c-3.2,0-5.5,1.7-5.5,5.5c0,1.7,0.1,2.7,0.1,2.7h-1.7v2.7 h1.7v15.3h3.9V22.5h3.7l1-2.7H108z M119.9,19.4c-4.7,0-7.8,3.7-7.8,9.4c0,5.7,3,9.4,7.9,9.4c4.9,0,7.9-3.6,7.9-9.4 C127.9,23.2,125,19.4,119.9,19.4z M120.1,35.3c-2.3,0-3.6-1.5-3.6-6.7c0-4.4,1.1-6.2,3.5-6.2c2.3,0,3.7,1.5,3.7,6.6 C123.6,33.4,122.4,35.3,120.1,35.3z M143.2,19.8h-4.5c-0.5,0.7-2.3,4.3-2.8,5.5c-0.9-1.7-2.4-4.5-3.3-5.8l-4.2,0.9l5.2,7.7 l-6.7,9.7h4.9c0.7-1,3.2-5.4,3.9-6.7c0.4,0.6,3.3,5.7,3.9,6.7h4.9L138,28L143.2,19.8z M165.8,23.6h-10.3V13.3h-2.9v24.6h2.9V26 h10.3v11.9h2.9V13.3h-2.9V23.6z M179,19.5c-2.1,0-3.9,0.8-5.3,2.5c-1.5,1.8-2.1,3.7-2.1,6.7c0,5.9,3,9.5,7.9,9.5 c2.3,0,4.4-0.8,6-2.2l-1.1-1.8c-1.3,1.1-2.6,1.7-4.4,1.7c-1.8,0-3.4-0.6-4.4-2.2c-0.6-0.9-0.8-2.2-0.8-3.9v-0.4h11.1V29 c-0.1-4.3-0.5-5.9-2-7.5C182.6,20.2,181,19.5,179,19.5z M174.8,27.3c0.1-3.7,1.6-5.6,4.1-5.6c1.4,0,2.6,0.6,3.2,1.6 c0.5,0.9,0.8,2,0.8,4H174.8z M193.1,36.1c-0.8,0-1-0.4-1-1.8V16c0-2.7-0.5-4.2-0.5-4.2l-2.8,0.5c0,0,0.4,1.3,0.4,3.7v18.9 c0,1.3,0.3,2,0.9,2.5c0.5,0.5,1.3,0.8,2.1,0.8c0.8,0,1.1-0.1,1.8-0.4l-0.6-1.8C193.4,36,193.2,36.1,193.1,36.1z M200.3,36.1 c-0.8,0-1-0.4-1-1.8V16c0-2.7-0.5-4.2-0.5-4.2l-2.8,0.5c0,0,0.4,1.3,0.4,3.7v18.9c0,1.3,0.3,2,0.9,2.5c0.5,0.5,1.2,0.8,2.1,0.8 c0.7,0,1.1-0.1,1.8-0.4l-0.6-1.8C200.6,36,200.4,36.1,200.3,36.1z M216.3,22.6c-1.2-1.8-3.1-3.1-6.1-3.1c-4.7,0-7.6,3.5-7.6,9.4 c0,5.9,2.8,9.5,7.7,9.5c4.5,0,7.7-3.2,7.7-9.1C218,26.3,217.5,24.2,216.3,22.6z M214.3,33.3c-0.6,1.7-2,2.7-3.9,2.7 c-1.5,0-3-0.7-3.6-1.8c-0.7-1.1-1.1-3.3-1.1-5.8c0-2.1,0.3-3.5,0.9-4.7c0.6-1.2,2.1-1.9,3.6-1.9c1.5,0,3,0.7,3.8,2.3 c0.6,1.2,0.8,2.9,0.8,5.4C214.8,31.2,214.7,32.2,214.3,33.3z M26.1,7.7C16.1,7.7,8,14.9,8,23.6c0,4.4,2,8.3,5.2,11.2 c-0.6,2-1.7,4.7-3.9,7.3c0.4,0.7,6.6-1.7,11-3.4c1.8,0.5,3.7,0.8,5.7,0.8c10,0,18.1-7.1,18.1-15.9C44.1,14.9,36,7.7,26.1,7.7z M31.5,17.3c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4C29.1,18.3,30.2,17.3,31.5,17.3z M20.6,17.3 c1.3,0,2.4,1.1,2.4,2.4c0,1.3-1.1,2.4-2.4,2.4c-1.3,0-2.4-1.1-2.4-2.4C18.2,18.3,19.3,17.3,20.6,17.3z M26.1,34.7 C26.1,34.7,26,34.7,26.1,34.7c-0.1,0-0.1,0-0.1,0c-4.8,0-10.2-3.1-11.5-8.4c3.3,1.5,7.8,2.2,11.5,2.2c3.7,0,8.3-0.7,11.5-2.2 C36.3,31.6,30.9,34.7,26.1,34.7z"/></svg>
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1 @@
|
||||
<svg width="32" height="30" viewBox="0 0 32 30" xmlns="http://www.w3.org/2000/svg"><path d="M15.999 0c-8.834 0-15.999 6.135-15.999 13.7 0 3.767 1.776 7.179 4.648 9.656-.499 1.714-1.487 4.04-3.438 6.311.334.575 5.83-1.454 9.704-2.973 1.599.456 3.306.706 5.084.706 8.837 0 16.001-6.134 16.001-13.701 0-7.565-7.164-13.7-16.001-13.7zm4.742 8.186v9.823c0 .121-.035.226-.106.314-.07.088-.154.133-.25.133h-2.844c-.096 0-.18-.044-.25-.133-.07-.088-.106-.193-.106-.314v-9.823c0-.121.035-.226.106-.314.07-.088.154-.133.25-.133h2.844c.096 0 .18.044.25.133.07.088.106.193.106.314zm-5.333 0v9.823c0 .121-.035.226-.106.314-.07.088-.154.133-.25.133h-2.844c-.096 0-.18-.044-.25-.133-.07-.088-.106-.193-.106-.314v-9.823c0-.121.035-.226.106-.314.07-.088.154-.133.25-.133h2.844c.096 0 .18.044.25.133.07.088.106.193.106.314z" fill="#757575"/></svg>
|
After Width: | Height: | Size: 829 B |
@ -112,6 +112,7 @@ loop.store.ActiveRoomStore = (function(mozL10n) {
|
||||
"remoteSrcMediaElement",
|
||||
"remoteVideoDimensions",
|
||||
"remoteVideoEnabled",
|
||||
"streamPaused",
|
||||
"screenSharingState",
|
||||
"screenShareMediaElement",
|
||||
"videoMuted"
|
||||
@ -151,6 +152,8 @@ loop.store.ActiveRoomStore = (function(mozL10n) {
|
||||
roomInfoFailure: null,
|
||||
// The name of the room.
|
||||
roomName: null,
|
||||
// True when sharing screen has been paused.
|
||||
streamPaused: false,
|
||||
// Social API state.
|
||||
socialShareProviders: null,
|
||||
// True if media has been connected both-ways.
|
||||
@ -268,7 +271,8 @@ loop.store.ActiveRoomStore = (function(mozL10n) {
|
||||
"toggleBrowserSharing",
|
||||
"updateSocialShareInfo",
|
||||
"connectionStatus",
|
||||
"mediaConnected"
|
||||
"mediaConnected",
|
||||
"videoScreenStreamChanged"
|
||||
];
|
||||
// Register actions that are only used on Desktop.
|
||||
if (this._isDesktop) {
|
||||
@ -1207,6 +1211,18 @@ loop.store.ActiveRoomStore = (function(mozL10n) {
|
||||
this.setStoreState(nextState);
|
||||
},
|
||||
|
||||
/**
|
||||
* Listen to screen stream changes in order to check if sharing screen
|
||||
* has been paused.
|
||||
*
|
||||
* @param {sharedActions.VideoScreenStreamChanged} actionData
|
||||
*/
|
||||
videoScreenStreamChanged: function(actionData) {
|
||||
this.setStoreState({
|
||||
streamPaused: !actionData.hasVideo
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles chat messages received and/ or about to send. If this is the first
|
||||
* chat message for the current session, register a count with telemetry.
|
||||
|
@ -11,7 +11,6 @@ var loop = loop || {};
|
||||
var kMessageName = "Loop:Message";
|
||||
var kPushMessageName = "Loop:Message:Push";
|
||||
var kBatchMessage = "Batch";
|
||||
var kReplyTimeoutMs = 5000;
|
||||
var gListeningForMessages = false;
|
||||
var gListenersMap = {};
|
||||
var gListeningForPushMessages = false;
|
||||
@ -75,20 +74,10 @@ var loop = loop || {};
|
||||
gListenersMap[seq] = resolve;
|
||||
|
||||
gRootObj.sendAsyncMessage(kMessageName, payload);
|
||||
|
||||
gRootObj.setTimeout(function() {
|
||||
// Check if the promise was already resolved before by the message handler.
|
||||
if (!gListenersMap[seq]) {
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
delete gListenersMap[seq];
|
||||
}, kReplyTimeoutMs);
|
||||
});
|
||||
};
|
||||
|
||||
// These functions should only be used in unit tests.
|
||||
loop.request.getReplyTimeoutMs = function() { return kReplyTimeoutMs; };
|
||||
loop.request.inspect = function() { return _.extend({}, gListenersMap); };
|
||||
loop.request.reset = function() {
|
||||
gListeningForMessages = false;
|
||||
|
@ -396,7 +396,8 @@ if (inChrome) {
|
||||
*
|
||||
* @param {String} url The url to format.
|
||||
* @param {String} suppressConsoleError For testing, call with a boolean which is true to squash the default console error.
|
||||
* @return {Object} An object containing the hostname and full location.
|
||||
* @return {Object} An object containing the hostname,
|
||||
* full location and protocol.
|
||||
*/
|
||||
function formatURL(url, suppressConsoleError) {
|
||||
// We're using new URL to pass this through the browser's ACE/punycode
|
||||
@ -412,7 +413,8 @@ if (inChrome) {
|
||||
// Finally, ensure we look good.
|
||||
return {
|
||||
hostname: urlObject.hostname,
|
||||
location: decodeURI(urlObject.href)
|
||||
location: decodeURI(urlObject.href),
|
||||
protocol: urlObject.protocol
|
||||
};
|
||||
} catch (ex) {
|
||||
if (suppressConsoleError ? !suppressConsoleError : true) {
|
||||
|
@ -606,11 +606,16 @@ loop.shared.views = function (_, mozL10n) {
|
||||
// Bug 1196143 - formatURL sanitizes(decodes) the URL from IDN homographic attacks.
|
||||
// Try catch to not produce output if invalid url
|
||||
try {
|
||||
var sanitizeURL = loop.shared.utils.formatURL(this.props.url, true).hostname;
|
||||
var sanitizedURL = loop.shared.utils.formatURL(this.props.url, true);
|
||||
} catch (ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Only allow specific types of URLs.
|
||||
if (!sanitizedURL || sanitizedURL.protocol !== "http:" && sanitizedURL.protocol !== "https:" && sanitizedURL.protocol !== "ftp:") {
|
||||
return null;
|
||||
}
|
||||
|
||||
var thumbnail = this.props.thumbnail;
|
||||
|
||||
if (!thumbnail) {
|
||||
@ -640,7 +645,7 @@ loop.shared.views = function (_, mozL10n) {
|
||||
React.createElement(
|
||||
"span",
|
||||
{ className: "context-url" },
|
||||
sanitizeURL
|
||||
sanitizedURL.hostname
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -666,6 +671,7 @@ loop.shared.views = function (_, mozL10n) {
|
||||
isLoading: React.PropTypes.bool.isRequired,
|
||||
mediaType: React.PropTypes.string.isRequired,
|
||||
posterUrl: React.PropTypes.string,
|
||||
screenSharingPaused: React.PropTypes.bool,
|
||||
shareCursor: React.PropTypes.bool,
|
||||
// Expecting "local" or "remote".
|
||||
srcMediaElement: React.PropTypes.object
|
||||
@ -781,7 +787,7 @@ loop.shared.views = function (_, mozL10n) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.props.shareCursor) {
|
||||
if (this.props.shareCursor && !this.props.screenSharingPaused) {
|
||||
videoElement.addEventListener("loadeddata", this.handleVideoDimensions);
|
||||
videoElement.addEventListener("mousemove", this.handleMouseMove);
|
||||
}
|
||||
@ -872,6 +878,7 @@ loop.shared.views = function (_, mozL10n) {
|
||||
renderRemoteVideo: React.PropTypes.bool.isRequired,
|
||||
screenShareMediaElement: React.PropTypes.object,
|
||||
screenSharePosterUrl: React.PropTypes.string,
|
||||
screenSharingPaused: React.PropTypes.bool,
|
||||
showInitialContext: React.PropTypes.bool.isRequired,
|
||||
useDesktopPaths: React.PropTypes.bool.isRequired
|
||||
},
|
||||
@ -938,7 +945,8 @@ loop.shared.views = function (_, mozL10n) {
|
||||
|
||||
var screenShareStreamClasses = classNames({
|
||||
"screen": true,
|
||||
"focus-stream": this.props.displayScreenShare
|
||||
"focus-stream": this.props.displayScreenShare,
|
||||
"screen-sharing-paused": this.props.screenSharingPaused
|
||||
});
|
||||
|
||||
var mediaWrapperClasses = classNames({
|
||||
@ -981,6 +989,7 @@ loop.shared.views = function (_, mozL10n) {
|
||||
isLoading: this.props.isScreenShareLoading,
|
||||
mediaType: "screen-share",
|
||||
posterUrl: this.props.screenSharePosterUrl,
|
||||
screenSharingPaused: this.props.screenSharingPaused,
|
||||
shareCursor: true,
|
||||
srcMediaElement: this.props.screenShareMediaElement }),
|
||||
this.props.displayScreenShare ? this.props.children : null
|
||||
|
@ -748,6 +748,17 @@ describe("loop.store.ActiveRoomStore", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#videoScreenStreamChanged", function() {
|
||||
it("should set streamPaused if screen stream has no video", function() {
|
||||
var actionData = {
|
||||
hasVideo: false
|
||||
};
|
||||
|
||||
store.videoScreenStreamChanged(new sharedActions.VideoScreenStreamChanged(actionData));
|
||||
expect(store.getStoreState().streamPaused).eql(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#updateRoomInfo", function() {
|
||||
var fakeRoomInfo;
|
||||
|
||||
|
@ -5,15 +5,13 @@ describe("loopapi-client", function() {
|
||||
"use strict";
|
||||
|
||||
var expect = chai.expect;
|
||||
var sandbox, clock, replyTimeoutMs;
|
||||
var sandbox;
|
||||
|
||||
beforeEach(function() {
|
||||
sandbox = sinon.sandbox.create();
|
||||
window.addMessageListener = sinon.stub();
|
||||
window.removeMessageListener = sinon.stub();
|
||||
window.sendAsyncMessage = sinon.stub();
|
||||
clock = sandbox.useFakeTimers();
|
||||
replyTimeoutMs = loop.request.getReplyTimeoutMs();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
@ -36,7 +34,12 @@ describe("loopapi-client", function() {
|
||||
[loop._lastMessageID, "GetLoopPref", "enabled"]);
|
||||
sinon.assert.calledOnce(window.addMessageListener);
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
@ -46,7 +49,12 @@ describe("loopapi-client", function() {
|
||||
sinon.assert.calledWithExactly(window.sendAsyncMessage, "Loop:Message",
|
||||
[loop._lastMessageID, "GetLoopPref", "enabled"]);
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
@ -56,7 +64,12 @@ describe("loopapi-client", function() {
|
||||
sinon.assert.calledWithExactly(window.sendAsyncMessage, "Loop:Message",
|
||||
[loop._lastMessageID, "SetLoopPref", "enabled", false, 1, 2, 3]);
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
@ -77,17 +90,6 @@ describe("loopapi-client", function() {
|
||||
return promise;
|
||||
});
|
||||
|
||||
it("should cancel the message listener when no reply is received in time", function() {
|
||||
var promise = loop.request("GetLoopPref", "enabled");
|
||||
|
||||
promise.then(function(result) {
|
||||
expect(result).to.eql(undefined);
|
||||
});
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
return promise;
|
||||
});
|
||||
|
||||
it("should not start listening for messages more than once", function() {
|
||||
return new Promise(function(resolve) {
|
||||
loop.request("GetLoopPref", "enabled").then(function() {
|
||||
@ -99,10 +101,18 @@ describe("loopapi-client", function() {
|
||||
resolve();
|
||||
});
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
});
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -166,7 +176,12 @@ describe("loopapi-client", function() {
|
||||
[loop._lastMessageID - 1, "GetLoopPref", "e10s.enabled"]]
|
||||
]);
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
@ -183,7 +198,12 @@ describe("loopapi-client", function() {
|
||||
[loop._lastMessageID - 1, "GetLoopPref", "e10s.enabled"]]
|
||||
]);
|
||||
|
||||
clock.tick(replyTimeoutMs);
|
||||
// Call the added listener, so that the promise resolves.
|
||||
window.addMessageListener.args[0][1]({
|
||||
name: "Loop:Message",
|
||||
data: [loop._lastMessageID, "true"]
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
|
@ -303,7 +303,8 @@ describe("loop.shared.utils", function() {
|
||||
expect(sharedUtils.formatURL("http://invalid.com/?a=Foo%20Bar"))
|
||||
.eql({
|
||||
location: "http://invalid.com/?a=Foo Bar",
|
||||
hostname: "invalid.com"
|
||||
hostname: "invalid.com",
|
||||
protocol: "http:"
|
||||
});
|
||||
});
|
||||
|
||||
@ -314,7 +315,8 @@ describe("loop.shared.utils", function() {
|
||||
expect(sharedUtils.formatURL("http://\u0261oogle.com/"))
|
||||
.eql({
|
||||
location: "http://xn--oogle-qmc.com/",
|
||||
hostname: "xn--oogle-qmc.com"
|
||||
hostname: "xn--oogle-qmc.com",
|
||||
protocol: "http:"
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -832,6 +832,16 @@ describe("VideoMuteButton", function() {
|
||||
expect(node.querySelector(".screen").classList.contains("focus-stream")).eql(true);
|
||||
});
|
||||
|
||||
it("should mark the screen share stream as paused when screen shared has been paused", function() {
|
||||
view = mountTestComponent({
|
||||
screenSharingPaused: true
|
||||
});
|
||||
|
||||
var node = view.getDOMNode();
|
||||
|
||||
expect(node.querySelector(".screen").classList.contains("screen-sharing-paused")).eql(true);
|
||||
});
|
||||
|
||||
it("should not mark the wrapper as receiving screen share when not displaying a screen share", function() {
|
||||
view = mountTestComponent({
|
||||
displayScreenShare: false
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Panel Strings
|
||||
|
||||
clientSuperShortname=Hello
|
||||
|
||||
|
||||
## LOCALIZATION_NOTE(loopMenuItem_label): Label of the menu item that is placed
|
||||
## inside the browser 'Tools' menu. Use the unicode ellipsis char, \u2026, or
|
||||
@ -257,8 +257,15 @@ rooms_room_joined_owner_not_connected_label=Yoldaşınız {{roomURLHostname}} ü
|
||||
|
||||
self_view_hidden_message=Özünü göstərmə gizlədilib amma hələ də göndərilir. göstərmək üçün pəncərə ölçülərini dəyişin
|
||||
|
||||
peer_left_session=Yoldaşınız çıxdı.
|
||||
peer_unexpected_quit=Yoldaşınız gözlənilmədən ayrıldı.
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
tos_failure_message={{clientShortname}} sizin ölkədə icazə verilmir.
|
||||
|
||||
display_name_guest=Qonaq
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Panel Strings
|
||||
|
||||
clientSuperShortname=Hello
|
||||
|
||||
|
||||
## LOCALIZATION_NOTE(loopMenuItem_label): Label of the menu item that is placed
|
||||
## inside the browser 'Tools' menu. Use the unicode ellipsis char, \u2026, or
|
||||
@ -161,3 +161,7 @@ self_view_hidden_message=Какво виждат другите е скрито,
|
||||
tos_failure_message={{clientShortname}} е недостъпен във вашата държава.
|
||||
|
||||
display_name_guest=Гост
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Panel Strings
|
||||
|
||||
clientSuperShortname=Hello
|
||||
|
||||
|
||||
## LOCALIZATION_NOTE(loopMenuItem_label): Label of the menu item that is placed
|
||||
## inside the browser 'Tools' menu. Use the unicode ellipsis char, \u2026, or
|
||||
@ -262,3 +262,7 @@ self_view_hidden_message=সেলফ-ভিউ লুকানো কিন্
|
||||
tos_failure_message={{clientShortname}} আপনার দেশের বিদ্যমান নয়।
|
||||
|
||||
display_name_guest=অতিথি
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -147,3 +147,7 @@ self_view_hidden_message=স্বয়ং-ভিউ লোকানো কিন
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
@ -161,3 +161,7 @@ self_view_hidden_message=Self-view hidden but still being sent; resize window to
|
||||
|
||||
## LOCALIZATION NOTE (tos_failure_message): Don't translate {{clientShortname}}
|
||||
## as this will be replaced by clientShortname2.
|
||||
|
||||
## LOCALIZATION NOTE(clientSuperShortname): This should not be localized and
|
||||
## should remain "Hello" for all locales.
|
||||
clientSuperShortname=Hello
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user