addon-sdk/source/lib/sdk/tabs/helpers.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 'use strict';
     6 module.metadata = {
     7   'stability': 'unstable'
     8 };
    11 // NOTE: This file should only export Tab instances
    14 const { getTabForContentWindow, getTabForBrowser: getRawTabForBrowser } = require('./utils');
    15 const { Tab } = require('./tab');
    16 const { rawTabNS } = require('./namespace');
    18 function getTabForWindow(win) {
    19   let tab = getTabForContentWindow(win);
    20   // We were unable to find the related tab!
    21   if (!tab)
    22     return null;
    24   return getTabForRawTab(tab) || Tab({ tab: tab });
    25 }
    26 exports.getTabForWindow = getTabForWindow;
    28 // only works on fennec atm
    29 function getTabForRawTab(rawTab) {
    30   let tab = rawTabNS(rawTab).tab;
    31   if (tab) {
    32     return tab;
    33   }
    34   return null;
    35 }
    36 exports.getTabForRawTab = getTabForRawTab;
    38 function getTabForBrowser(browser) {
    39   return getTabForRawTab(getRawTabForBrowser(browser));
    40 }
    41 exports.getTabForBrowser = getTabForBrowser;

mercurial