toolkit/content/tests/browser/browser_input_file_tooltips.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 function test()
     2 {
     3   let data = [
     4     { value: "/tmp", result: "tmp" },
     5     { title: "foo", result: "foo" },
     6     { result: "No file selected." },
     7     { multiple: true, result: "No files selected." },
     8     { required: true, result: "Please select a file." }
     9   ];
    11   let doc = gBrowser.contentDocument;
    12   let tooltip = document.getElementById("aHTMLTooltip");
    14   for (let test of data) {
    15     let input = doc.createElement('input');
    16     doc.body.appendChild(input);
    17     input.type = 'file';
    18     if (test.title) {
    19       input.setAttribute('title', test.title);
    20     }
    21     if (test.value) {
    22       if (test.value == "/tmp" && navigator.platform.indexOf('Win') != -1) {
    23         test.value = "C:\\Temp";
    24         test.result = "Temp";
    25       }
    26       input.value = test.value;
    27     }
    28     if (test.multiple) {
    29       input.multiple = true;
    30     }
    31     if (test.required) {
    32       input.required = true;
    33     }
    35     ok(tooltip.fillInPageTooltip(input));
    36     is(tooltip.getAttribute('label'), test.result);
    37   }
    38 }

mercurial