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

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

Issue 29329550: Issue 3208 - Move getFrames() function from child/elemHide module into a shared child/utils module (Closed)
Patch Set: Created Oct. 30, 2015, 7:50 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/utils.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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 15 matching lines...) Expand all
26 let property = Object.getOwnPropertyDescriptor(proto, "Components"); 26 let property = Object.getOwnPropertyDescriptor(proto, "Components");
27 if (property && property.get) 27 if (property && property.get)
28 delete proto.Components; 28 delete proto.Components;
29 } 29 }
30 catch (e) 30 catch (e)
31 { 31 {
32 Cu.reportError(e); 32 Cu.reportError(e);
33 } 33 }
34 34
35 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); 35 let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
36 let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/PrivateBrowsingUt ils.jsm")
37 36
38 let {Utils} = require("utils"); 37 let {Utils} = require("utils");
38 let {getFrames} = require("child/utils");
39 39
40 let messageID = 0; 40 let messageID = 0;
41 41
42 // The allowXBL binding below won't have any effect on the element. For elements 42 // The allowXBL binding below won't have any effect on the element. For elements
43 // that should be hidden however we don't return any binding at all, this makes 43 // that should be hidden however we don't return any binding at all, this makes
44 // Gecko stop constructing the node - it cannot be shown. 44 // Gecko stop constructing the node - it cannot be shown.
45 const allowXBL = "<bindings xmlns='http://www.mozilla.org/xbl'><binding id='dumm y' bindToUntrustedContent='true'/></bindings>"; 45 const allowXBL = "<bindings xmlns='http://www.mozilla.org/xbl'><binding id='dumm y' bindToUntrustedContent='true'/></bindings>";
46 const hideXBL = "<bindings xmlns='http://www.mozilla.org/xbl'/>"; 46 const hideXBL = "<bindings xmlns='http://www.mozilla.org/xbl'/>";
47 47
48 function getFrames(window)
49 {
50 let frames = [];
51 while (window)
52 {
53 let frame = {
54 location: window.location.href,
55 sitekey: null
56 };
57
58 let documentElement = window.document && window.document.documentElement;
59 if (documentElement)
60 frame.sitekey = documentElement.getAttribute("data-adblockkey")
61
62 if (window == window.parent)
63 frame.privateBrowsing = PrivateBrowsingUtils.isWindowPrivate(window);
64
65 frames.push(frame);
66 window = (window != window.parent ? window.parent : null);
67 }
68 return frames;
69 }
70
71 /** 48 /**
72 * about: URL module used to count hits. 49 * about: URL module used to count hits.
73 * @class 50 * @class
74 */ 51 */
75 let AboutHandler = 52 let AboutHandler =
76 { 53 {
77 classID: Components.ID("{55fb7be0-1dd2-11b2-98e6-9e97caf8ba67}"), 54 classID: Components.ID("{55fb7be0-1dd2-11b2-98e6-9e97caf8ba67}"),
78 classDescription: "Element hiding hit registration protocol handler", 55 classDescription: "Element hiding hit registration protocol handler",
79 aboutPrefix: "abp-elemhidehit", 56 aboutPrefix: "abp-elemhidehit",
80 57
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 { 183 {
207 throw Cr.NS_ERROR_NOT_IMPLEMENTED; 184 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
208 }, 185 },
209 resume: function() 186 resume: function()
210 { 187 {
211 throw Cr.NS_ERROR_NOT_IMPLEMENTED; 188 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
212 }, 189 },
213 190
214 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) 191 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest])
215 }; 192 };
OLDNEW
« no previous file with comments | « no previous file | lib/child/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld