[Pkg-mozext-commits] [greasemonkey] 05/55: fix xray access denied error
David Prévot
taffit at moszumanska.debian.org
Thu Oct 29 15:38:01 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 06349bfd02fdba03f2226e090f2bd284a477c4eb
Author: The8472 <git at infinite-source.de>
Date: Sun Sep 13 23:10:40 2015 +0200
fix xray access denied error
---
modules/sandbox.js | 53 ++++++++++++++++++++++++++---------------------------
1 file changed, 26 insertions(+), 27 deletions(-)
diff --git a/modules/sandbox.js b/modules/sandbox.js
index 9a70b62..1da77bd 100644
--- a/modules/sandbox.js
+++ b/modules/sandbox.js
@@ -143,36 +143,35 @@ function injectGMInfo(aScript, sandbox) {
var waivedInfo = Components.utils.waiveXrays(sandbox.GM_info);
var fileCache = new Map();
+
- // lazy getters for heavyweight strings that aren't sent down through IPC
- Object.defineProperty(waivedInfo,
- "scriptSource",
- { get: Cu.exportFunction(
- function() {
- var content = fileCache.get("scriptSource");
- if(content === undefined) {
- content = GM_util.fileXHR(scriptURL, "application/javascript");
- fileCache.set("scriptSource", content);
- }
- return content;
- }, sandbox)
+ function getScriptSource() {
+ var content = fileCache.get("scriptSource");
+ if (content === undefined) {
+ content = GM_util.fileXHR(scriptURL, "application/javascript");
+ fileCache.set("scriptSource", content);
}
- );
-
- // meta depends on content, so we need a lazy one here too
- Object.defineProperty(waivedInfo,
- 'scriptMetaStr',
- {get: Cu.exportFunction(
- function() {
- var meta = fileCache.get("meta");
- if(meta === undefined) {
- meta = extractMeta(this.scriptSource);
- fileCache.set("meta", meta);
- }
- return meta;
- }, sandbox)
+ return content;
+ }
+
+ function getMeta() {
+ var meta = fileCache.get("meta");
+ if (meta === undefined) {
+ meta = extractMeta(getScriptSource());
+ fileCache.set("meta", meta);
}
- );
+ return meta;
+ }
+
+ // lazy getters for heavyweight strings that aren't sent down through IPC
+ Object.defineProperty(waivedInfo, "scriptSource", {
+ get: Cu.exportFunction(getScriptSource, sandbox)
+ });
+
+ // meta depends on content, so we need a lazy one here too
+ Object.defineProperty(waivedInfo, 'scriptMetaStr', {
+ get: Cu.exportFunction(getMeta, sandbox)
+ });
}
--
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