Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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.