mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-22 08:19:59 +00:00
823a798303
- Bug 1216972 - AsyncShutdown for content processes. r=froydnj (7af834ad7) - Bug 1177310 - Add quit-application-granted to AsyncShutdown parent process phases. r=Yoric (d6f694ae7) - Bug 1025146 - Modernize ViewSourceUtils to be able to use outerWindowIDs to load document sources. r=jryans. (b37b0c536) - Bug 1025146 - Make viewing the source of a page or frame via the context menu work with remote browsers. r=jryans. (0b29a6ef5) - Bug 1025146 - Update ViewSource tests to account for refactor. r=jryans. (669f9f5ac) - Bug 885366 - Show granted and refused site permissions in site identity panel. r=jaws (c60017f97) - Bug 889835 - Use SitePermissions.jsm as the backend for Page Info's Permissions tab. r=jaws (938002b98) - Bug 892378 - Let SitePermissions.jsm handle indexedDB's special use of UNKNOWN_ACTION and ALLOW_ACTION. r=jaws (68f107829) - Bug 894877 - permissions.js onRadioClick tries to pass a host string to SitePermissions.remove, needs to be an nsIURI instead. r=jaws (ed6b34a52) - Bug 1025146 - Modernize viewSource.js to use a frame script. r=jryans. (1e9c1a367) - Bug 1158377 - Make link drag-and-drop work with view source windows o#pened on remote browsers. r=jryans. (54514d89f) - try to cleanup some debugger files, remove apparent osx duplicates (698fe2a46) - Bug 1165050 - Make deprecation warnings in viewSource.js point to the right URL for documentation. r=jryans. (51654351f)
84 lines
2.9 KiB
JavaScript
84 lines
2.9 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
*/
|
|
|
|
let source = "data:text/html,text<link%20href='http://example.com/'%20/>more%20text<a%20href='mailto:abc@def.ghi'>email</a>";
|
|
let gViewSourceWindow, gContextMenu, gCopyLinkMenuItem, gCopyEmailMenuItem;
|
|
|
|
let expectedData = [];
|
|
let currentTest = 0;
|
|
let partialTestRunning = false;
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
openViewSourceWindow(source, onViewSourceWindowOpen);
|
|
}
|
|
|
|
function onViewSourceWindowOpen(aWindow) {
|
|
gViewSourceWindow = aWindow;
|
|
|
|
gContextMenu = aWindow.document.getElementById("viewSourceContextMenu");
|
|
gCopyLinkMenuItem = aWindow.document.getElementById("context-copyLink");
|
|
gCopyEmailMenuItem = aWindow.document.getElementById("context-copyEmail");
|
|
|
|
let aTags = aWindow.gBrowser.contentDocument.querySelectorAll("a[href]");
|
|
is(aTags[0].href, "view-source:http://example.com/", "Link has correct href");
|
|
is(aTags[1].href, "mailto:abc@def.ghi", "Link has correct href");
|
|
let spanTag = aWindow.gBrowser.contentDocument.querySelector("span");
|
|
|
|
expectedData.push([aTags[0], true, false, "http://example.com/"]);
|
|
expectedData.push([aTags[1], false, true, "abc@def.ghi"]);
|
|
expectedData.push([spanTag, false, false, null]);
|
|
|
|
waitForFocus(runNextTest, aWindow);
|
|
}
|
|
|
|
function runNextTest() {
|
|
if (currentTest == expectedData.length) {
|
|
closeViewSourceWindow(gViewSourceWindow, function() {
|
|
if (partialTestRunning) {
|
|
finish();
|
|
return;
|
|
}
|
|
partialTestRunning = true;
|
|
currentTest = 0;
|
|
expectedData = [];
|
|
openDocumentSelect(source, "body", onViewSourceWindowOpen);
|
|
});
|
|
return;
|
|
}
|
|
let test = expectedData[currentTest++];
|
|
checkMenuItems(test[0], test[1], test[2], test[3]);
|
|
}
|
|
|
|
function checkMenuItems(popupNode, copyLinkExpected, copyEmailExpected, expectedClipboardContent) {
|
|
popupNode.scrollIntoView();
|
|
|
|
let cachedEvent = null;
|
|
let mouseFn = function(event) {
|
|
cachedEvent = event;
|
|
};
|
|
|
|
gViewSourceWindow.gBrowser.contentWindow.addEventListener("mousedown", mouseFn, false);
|
|
EventUtils.synthesizeMouseAtCenter(popupNode, { type: "contextmenu", button: 2 }, gViewSourceWindow.gBrowser.contentWindow);
|
|
gViewSourceWindow.gBrowser.contentWindow.removeEventListener("mousedown", mouseFn, false);
|
|
|
|
gContextMenu.openPopup(popupNode, "after_start", 0, 0, false, false, cachedEvent);
|
|
|
|
is(gCopyLinkMenuItem.hidden, !copyLinkExpected, "Copy link menuitem is " + (copyLinkExpected ? "not hidden" : "hidden"));
|
|
is(gCopyEmailMenuItem.hidden, !copyEmailExpected, "Copy email menuitem is " + (copyEmailExpected ? "not hidden" : "hidden"));
|
|
|
|
if (!copyLinkExpected && !copyEmailExpected) {
|
|
runNextTest();
|
|
return;
|
|
}
|
|
|
|
waitForClipboard(expectedClipboardContent, function() {
|
|
if (copyLinkExpected)
|
|
gCopyLinkMenuItem.doCommand();
|
|
else
|
|
gCopyEmailMenuItem.doCommand();
|
|
gContextMenu.hidePopup();
|
|
}, runNextTest, runNextTest);
|
|
}
|