#189 closed
Scriptish

need a shared object among user-scripts

Reported by Scriptish | September 18th, 2011 @ 09:52 PM

This post is almost same as Greasemonkey issue 1278

Some user-scripts refer to some object defined by the other user-script.
e.g.)

like following: LDRize use functions defined by Minibuffer.

// Minibuffer
window.Minibuffer = {
  // ...
  addShortcutkey: function () {...}
  // ...
};


// LDRize
window.Minibuffer.addShortcutkey(...);

These cannot work. Because an object defined by the other sandbox cannot be refer on Firefox 4.0b.

Of course, We can use unsafeWindow, but it has security risk.
and I considered about using DataContainerEvent of DOM Event, but it also has security risk.

So I concluded that we need a certain object for sharing among only user-scripts.

here is a patch for Script:

diff --git a/extension/components/scriptish.js b/extension/components/scriptish.js
index ceac80c..9a8302b 100644
--- a/extension/components/scriptish.js
+++ b/extension/components/scriptish.js
@@ -273,10 +273,13 @@ ScriptishService.prototype = {

     // detect and grab reference to firebug console and context, if it exists
     let fbConsole = Scriptish_getFirebugConsole(wrappedContentWin, chromeWin);
+    let sharedObject = {};

     for (var i = 0; script = scripts[i++];) {
       sandbox = new Cu.Sandbox(wrappedContentWin);

+      sandbox.sharedObject = sharedObject;
+
       let GM_API = new tools.GM_API(
           script, url, wrappedContentWin, unsafeContentWin, chromeWin);

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Tags