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

Unified Diff: lib/child/utils.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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/child/elemHide.js ('k') | lib/utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/child/utils.js
===================================================================
--- a/lib/child/utils.js
+++ b/lib/child/utils.js
@@ -114,8 +114,28 @@ let getFrames = exports.getFrames = func
/**
* Checks whether Private Browsing mode is enabled for a content window.
* @return {Boolean}
*/
let isPrivate = exports.isPrivate = function(/**Window*/ window)
{
return PrivateBrowsingUtils.isContentWindowPrivate(window);
};
+
+/**
+ * Gets the DOM window associated with a particular request (if any).
+ */
+let getRequestWindow = exports.getRequestWindow = function(/**nsIChannel*/ channel) /**nsIDOMWindow*/
+{
+ try
+ {
+ if (channel.notificationCallbacks)
+ return channel.notificationCallbacks.getInterface(Ci.nsILoadContext).associatedWindow;
+ } catch(e) {}
+
+ try
+ {
+ if (channel.loadGroup && channel.loadGroup.notificationCallbacks)
+ return channel.loadGroup.notificationCallbacks.getInterface(Ci.nsILoadContext).associatedWindow;
+ } catch(e) {}
+
+ return null;
+};
« no previous file with comments | « lib/child/elemHide.js ('k') | lib/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld