[Pkg-mozext-commits] [greasemonkey] 30/41: Set up string bundle only once.

David Prévot taffit at moszumanska.debian.org
Thu Apr 30 22:06:35 UTC 2015


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

taffit pushed a commit to branch master
in repository greasemonkey.

commit ccf1d4703494e151d4fca1c3a574079e220dcc68
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Wed Apr 22 16:00:52 2015 -0400

    Set up string bundle only once.
---
 modules/xmlhttprequester.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/xmlhttprequester.js b/modules/xmlhttprequester.js
index ba1bc6f..1a05463 100644
--- a/modules/xmlhttprequester.js
+++ b/modules/xmlhttprequester.js
@@ -3,14 +3,16 @@ var EXPORTED_SYMBOLS = ['GM_xmlhttpRequester'];
 Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
 Components.utils.import("resource://greasemonkey/util.js");
 
+var gStringBundle = Components
+    .classes["@mozilla.org/intl/stringbundle;1"]
+    .getService(Components.interfaces.nsIStringBundleService)
+    .createBundle("chrome://greasemonkey/locale/greasemonkey.properties");
+
+
 function GM_xmlhttpRequester(wrappedContentWin, originUrl, sandbox) {
   this.wrappedContentWin = wrappedContentWin;
   this.originUrl = originUrl;
   this.sandboxPrincipal = Components.utils.getObjectPrincipal(sandbox);
-  this.stringBundle = Components
-    .classes["@mozilla.org/intl/stringbundle;1"]
-    .getService(Components.interfaces.nsIStringBundleService)
-    .createBundle("chrome://greasemonkey/locale/greasemonkey.properties");
 }
 
 // this function gets called by user scripts in content security scope to
@@ -29,7 +31,7 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
   } catch (e) {
     // A malformed URL won't be parsed properly.
     throw new Error(
-        this.stringBundle.GetStringFromName('error.invalidUrl')
+        gStringBundle.GetStringFromName('error.invalidUrl')
             .replace('%1', name)
         );
   }
@@ -46,7 +48,7 @@ GM_xmlhttpRequester.prototype.contentStartRequest = function(details) {
       break;
     default:
       throw new Error(
-          this.stringBundle.GetStringFromName('error.disallowedScheme')
+          gStringBundle.GetStringFromName('error.disallowedScheme')
               .replace('%1', details.url)
           );
   }

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



More information about the Pkg-mozext-commits mailing list