| 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; |
| +}; |