toolkit/components/viewsource/test/browser/browser_gotoline.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 let content = "line 1\nline 2\nline 3";
     6 let runningPlainText = false;
     8 function test() {
     9   waitForExplicitFinish();
    11   testViewSourceWindow("data:text/html," + encodeURIComponent(content), checkViewSource, function() {
    12     testViewSourceWindow("data:text/plain," + encodeURIComponent(content), checkViewSource, finish);
    13   });
    14 }
    16 function checkViewSource(aWindow) {
    17   is(aWindow.gBrowser.contentDocument.body.textContent, content, "Correct content loaded");
    19   let selection = aWindow.gBrowser.contentWindow.getSelection();
    20   let statusPanel = aWindow.document.getElementById("statusbar-line-col");
    21   is(statusPanel.getAttribute("label"), "", "Correct status bar text");
    22   for (let i = 1; i <= 3; i++) {
    23     aWindow.goToLine(i);
    24     is(selection.toString(), "line " + i, "Correct text selected");
    25     is(statusPanel.getAttribute("label"), "Line " + i + ", Col 1", "Correct status bar text");
    26   }
    27 }

mercurial