Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/child/contentPolicy.js

Issue 29356087: Issue 4497 - Move Utils.getRequestWindow() into child/utils.js (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created Oct. 6, 2016, 12:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 21 matching lines...) Expand all
32 catch (e) 32 catch (e)
33 { 33 {
34 Cu.reportError(e); 34 Cu.reportError(e);
35 } 35 }
36 36
37 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); 37 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
38 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 38 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
39 39
40 let {port} = require("messaging"); 40 let {port} = require("messaging");
41 let {Utils} = require("utils"); 41 let {Utils} = require("utils");
42 let {getFrames, isPrivate} = require("child/utils"); 42 let {getFrames, isPrivate, getRequestWindow} = require("child/utils");
43 let {objectMouseEventHander} = require("child/objectTabs"); 43 let {objectMouseEventHander} = require("child/objectTabs");
44 let {RequestNotifier} = require("child/requestNotifier"); 44 let {RequestNotifier} = require("child/requestNotifier");
45 45
46 /** 46 /**
47 * Randomly generated class name, to be applied to collapsed nodes. 47 * Randomly generated class name, to be applied to collapsed nodes.
48 * @type Promise.<string> 48 * @type Promise.<string>
49 */ 49 */
50 let collapsedClass = port.emitWithResponse("getCollapsedClass"); 50 let collapsedClass = port.emitWithResponse("getCollapsedClass");
51 51
52 /** 52 /**
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 try 399 try
400 { 400 {
401 // nsILoadInfo.contentPolicyType was introduced in Gecko 35, then 401 // nsILoadInfo.contentPolicyType was introduced in Gecko 35, then
402 // renamed to nsILoadInfo.externalContentPolicyType in Gecko 44. 402 // renamed to nsILoadInfo.externalContentPolicyType in Gecko 44.
403 let loadInfo = oldChannel.loadInfo; 403 let loadInfo = oldChannel.loadInfo;
404 let contentType = ("externalContentPolicyType" in loadInfo ? 404 let contentType = ("externalContentPolicyType" in loadInfo ?
405 loadInfo.externalContentPolicyType : loadInfo.contentPolicyType); 405 loadInfo.externalContentPolicyType : loadInfo.contentPolicyType);
406 if (!contentType) 406 if (!contentType)
407 return; 407 return;
408 408
409 let wnd = Utils.getRequestWindow(newChannel); 409 let wnd = getRequestWindow(newChannel);
410 if (!wnd) 410 if (!wnd)
411 return; 411 return;
412 412
413 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) 413 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT)
414 { 414 {
415 if (wnd.history.length <= 1 && wnd.opener) 415 if (wnd.history.length <= 1 && wnd.opener)
416 { 416 {
417 // Special treatment for pop-up windows - this will close the window 417 // Special treatment for pop-up windows - this will close the window
418 // rather than preventing the redirect. Note that we might not have 418 // rather than preventing the redirect. Note that we might not have
419 // seen the original channel yet because the redirect happened before 419 // seen the original channel yet because the redirect happened before
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 let weights = parentNode[property].split(","); 509 let weights = parentNode[property].split(",");
510 weights[index] = "0"; 510 weights[index] = "0";
511 parentNode[property] = weights.join(","); 511 parentNode[property] = weights.join(",");
512 } 512 }
513 } 513 }
514 else 514 else
515 node.classList.add(cls); 515 node.classList.add(cls);
516 } 516 }
517 }); 517 });
518 } 518 }
OLDNEW
« no previous file with comments | « no previous file | lib/child/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld