dom/plugins/test/unit/test_bug854467.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     4  */
     6 function check_state(aTag, aExpectedClicktoplay, aExpectedDisabled) {
     7   do_check_eq(aTag.clicktoplay, aExpectedClicktoplay);
     8   do_check_eq(aTag.disabled, aExpectedDisabled);
     9 }
    11 function run_test() {
    12   let tag = get_test_plugintag();
    13   tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
    14   check_state(tag, false, false);
    16   /* test going to click-to-play from always enabled and back */
    17   tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
    18   check_state(tag, true, false);
    19   tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
    20   check_state(tag, false, false);
    22   /* test going to disabled from always enabled and back */
    23   tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
    24   check_state(tag, false, true);
    25   tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
    26   check_state(tag, false, false);
    28   /* test going to click-to-play from disabled and back */
    29   tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
    30   check_state(tag, false, true);
    31   tag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
    32   check_state(tag, true, false);
    33   tag.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
    34   check_state(tag, false, true);
    36   /* put everything back to normal and check that that succeeded */
    37   tag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
    38   check_state(tag, false, false);
    39 }

mercurial