addon-sdk/source/lib/sdk/net/xhr.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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": "stable"
     8 };
    10 const { deprecateFunction } = require("../util/deprecate");
    11 const { Cc, Ci } = require("chrome");
    12 const XMLHttpRequest = require("../addon/window").window.XMLHttpRequest;
    14 Object.defineProperties(XMLHttpRequest.prototype, {
    15   mozBackgroundRequest: {
    16     value: true,
    17   },
    18   forceAllowThirdPartyCookie: {
    19     configurable: true,
    20     value: deprecateFunction(function() {
    21       forceAllowThirdPartyCookie(this);
    23     }, "`xhr.forceAllowThirdPartyCookie()` is deprecated, please use" +
    24        "`require('sdk/net/xhr').forceAllowThirdPartyCookie(request)` instead")
    25   }
    26 });
    27 exports.XMLHttpRequest = XMLHttpRequest;
    29 function forceAllowThirdPartyCookie(xhr) {
    30   if (xhr.channel instanceof Ci.nsIHttpChannelInternal)
    31     xhr.channel.forceAllowThirdPartyCookie = true;
    32 }
    33 exports.forceAllowThirdPartyCookie = forceAllowThirdPartyCookie;
    35 // No need to handle add-on unloads as addon/window is closed at unload
    36 // and it will take down all the associated requests.

mercurial