[Pkg-mozext-commits] [adblock-plus] 38/98: Issue 4497 - Move Utils.getRequestWindow() into child/utils.js

David Prévot taffit at moszumanska.debian.org
Tue Oct 24 01:30:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 2ce2307205962a84c75c562b5e4c5a87d4e02741
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Thu Oct 6 14:17:53 2016 +0200

    Issue 4497 - Move Utils.getRequestWindow() into child/utils.js
---
 lib/child/contentPolicy.js |  4 ++--
 lib/child/elemHide.js      |  4 ++--
 lib/child/utils.js         | 20 ++++++++++++++++++++
 lib/utils.js               | 20 --------------------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/lib/child/contentPolicy.js b/lib/child/contentPolicy.js
index 98d1a94..ed0a26d 100644
--- a/lib/child/contentPolicy.js
+++ b/lib/child/contentPolicy.js
@@ -39,7 +39,7 @@ let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
 
 let {port} = require("messaging");
 let {Utils} = require("utils");
-let {getFrames, isPrivate} = require("child/utils");
+let {getFrames, isPrivate, getRequestWindow} = require("child/utils");
 let {objectMouseEventHander} = require("child/objectTabs");
 let {RequestNotifier} = require("child/requestNotifier");
 
@@ -406,7 +406,7 @@ var PolicyImplementation =
       if (!contentType)
         return;
 
-      let wnd = Utils.getRequestWindow(newChannel);
+      let wnd = getRequestWindow(newChannel);
       if (!wnd)
         return;
 
diff --git a/lib/child/elemHide.js b/lib/child/elemHide.js
index 63c639d..a9e67b6 100644
--- a/lib/child/elemHide.js
+++ b/lib/child/elemHide.js
@@ -36,7 +36,7 @@ let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
 
 let {shouldAllowAsync} = require("child/contentPolicy");
-let {getFrames, isPrivate} = require("child/utils");
+let {getFrames, isPrivate, getRequestWindow} = require("child/utils");
 let {RequestNotifier} = require("child/requestNotifier");
 let {port} = require("messaging");
 let {Utils} = require("utils");
@@ -269,7 +269,7 @@ HitRegistrationChannel.prototype = {
 
   _getResponse: function()
   {
-    let window = Utils.getRequestWindow(this);
+    let window = getRequestWindow(this);
     port.emitWithResponse("registerElemHideHit", {
       key: this.key,
       frames: getFrames(window),
diff --git a/lib/child/utils.js b/lib/child/utils.js
index a4e6819..727c511 100644
--- a/lib/child/utils.js
+++ b/lib/child/utils.js
@@ -119,3 +119,23 @@ 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;
+};
diff --git a/lib/utils.js b/lib/utils.js
index 7673cad..daa908a 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -210,26 +210,6 @@ let Utils = exports.Utils =
   },
 
   /**
-   * Gets the DOM window associated with a particular request (if any).
-   */
-  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;
-  },
-
-  /**
    * Generates filter subscription checksum.
    *
    * @param {string[]} lines filter subscription lines (with checksum line removed)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list