Permalink
Browse files

Added Mobile support and extended compatibility.

Supports all current Aurora versions.
Adds support for Firefox Mobile. Removed use of FUEL library because of this.
Moved menu item to the Web Developer submenu.
  • Loading branch information...
1 parent f7f6ea2 commit e33f34e680224204abcb3c12e49828d145406be9 @jvillalobos committed Oct 1, 2011
View
@@ -80,6 +80,7 @@ xpi_built := install.rdf \
$(wildcard locale/*/*.dtd) \
$(wildcard locale/*/*.properties) \
$(wildcard modules/*.js) \
+ $(wildcard components/*.js) \
$(template_files) \
# defaults/preferences/$(extension_name).js
View
@@ -27,5 +27,11 @@ locale remotexulmanager fr locale/fr/
locale remotexulmanager sv-SE locale/sv-SE/
locale remotexulmanager zh-CN locale/zh-CN/
-overlay chrome://browser/content/browser.xul chrome://remotexulmanager/content/rxmBrowserOverlay.xul
-overlay chrome://navigator/content/navigator.xul chrome://remotexulmanager/content/rxmBrowserOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
+overlay chrome://browser/content/browser.xul chrome://remotexulmanager/content/rxmBrowserOverlay.xul application!={a23983c0-fd0e-11dc-95ff-0800200c9a66}
+
+# Mobile Firefox.
+component {aa76f1c0-a902-4afe-ab37-e51d8c6d2e68} components/aboutRXM.js application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
+contract @mozilla.org/network/protocol/about;1?what=remotexul {aa76f1c0-a902-4afe-ab37-e51d8c6d2e68} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
+
+# SeaMonkey.
+overlay chrome://navigator/content/navigator.xul chrome://remotexulmanager/content/rxmBrowserOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2011 Jorge Villalobos
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+/**
+ * Registers itself as an about: provider, so that about:remotexul points to a
+ * chrome path in this extension.
+ */
+function AboutRXM() {}
+
+AboutRXM.prototype = {
+ classDescription : "about:remotexul",
+ contractID : "@mozilla.org/network/protocol/about;1?what=remotexul",
+ classID : Components.ID("{aa76f1c0-a902-4afe-ab37-e51d8c6d2e68}"),
+
+ getURIFlags : function(aURI) {
+ return Ci.nsIAboutModule.ALLOW_SCRIPT;
+ },
+
+ newChannel : function(aURI) {
+ let ioService =
+ Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
+ let channel =
+ ioService.newChannel(
+ "chrome://remotexulmanager/content/rxmAbout.xul", null, null);
+
+ channel.originalURI = aURI;
+
+ return channel;
+ },
+
+ QueryInterface : XPCOMUtils.generateQI([ Ci.nsIAboutModule ])
+};
+
+if (XPCOMUtils.generateNSGetFactory) {
+ var NSGetFactory = XPCOMUtils.generateNSGetFactory([ AboutRXM ]);
+} else {
+ var NSGetModule = XPCOMUtils.generateNSGetModule([ AboutRXM ]);
+}
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+
+<!--
+ - Copyright 2011 Jorge Villalobos
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+
+ - http://www.apache.org/licenses/LICENSE-2.0
+
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -->
+
+<?xml-stylesheet type="text/css" href="chrome://global/skin/" ?>
+<?xml-stylesheet type="text/css"
+ href="chrome://remotexulmanager/skin/rxmManager.css" ?>
+
+<!DOCTYPE window SYSTEM "chrome://remotexulmanager/locale/rxmManager.dtd">
+
+<window id="remotexulmanager-about-window"
+ windowtype="remotexulmanager-about-window"
+ title="&remotexulmanager.manager.title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript"
+ src="chrome://remotexulmanager/content/rxmManager.js" />
+
+ <vbox id="window-content" flex="1">
+ <label control="domains" value="&remotexulmanager.allowed.label;" />
+ <listbox id="domains" rows="15" seltype="multiple"
+ onselect="RXULMChrome.Manager.select(event);" />
+ <button id="add" label="&remotexulmanager.add.label;"
+ accesskey="&remotexulmanager.add.accesskey;"
+ oncommand="RXULMChrome.Manager.add(event);" />
+ <button id="remove" disabled="true"
+ label="&remotexulmanager.remove.label;"
+ accesskey="&remotexulmanager.remove.accesskey;"
+ oncommand="RXULMChrome.Manager.remove(event);" />
+ </vbox>
+
+</window>
@@ -20,16 +20,15 @@
<!DOCTYPE overlay SYSTEM "chrome://remotexulmanager/locale/rxmBrowserOverlay.dtd">
-<overlay id="powersearchbox-browser-overlay"
+<overlay id="rxm-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://remotexulmanager/content/rxmBrowserOverlay.js" />
<!-- Main menu. -->
- <menupopup id="menu_ToolsPopup">
- <menuitem id="rxm-main-menu"
- insertafter="javascriptConsole,devToolsSeparator"
+ <menupopup id="menuWebDeveloperPopup">
+ <menuitem id="rxm-main-menu" insertbefore="devToolsEndSeparator"
label="&rxm.menu.label;" accesskey="&rxm.menu.accesskey;"
oncommand="RXULMChrome.BrowserOverlay.launchManager(event);" />
</menupopup>
@@ -96,7 +96,10 @@ RXULMChrome.Manager = {
domains.appendChild(item);
}
- generateItem.disabled = (0 == allowedCount);
+ // null in the about:remotexul window.
+ if (null != generateItem) {
+ generateItem.disabled = (0 == allowedCount);
+ }
} catch (e) {
this._logger.error("_loadPermissions\n" + e);
}
@@ -198,7 +201,11 @@ RXULMChrome.Manager = {
let listbox = document.getElementById("domains");
removeButton.disabled = (0 == listbox.selectedCount);
- exportMenu.disabled = (0 == listbox.selectedCount);
+
+ // null in the about:remotexul window.
+ if (null != exportMenu) {
+ exportMenu.disabled = (0 == listbox.selectedCount);
+ }
},
/**
View
@@ -23,7 +23,7 @@
<em:id>remotexulmanager@xulforge.com</em:id>
<em:name>Remote XUL Manager</em:name>
<em:description>Manages the Remote XUL whitelist.</em:description>
- <em:version>1.0.2</em:version>
+ <em:version>1.1</em:version>
<em:creator>Jorge Villalobos</em:creator>
<em:homepageURL>http://github.com/jvillalobos/Remote-XUL-Manager</em:homepageURL>
<em:type>2</em:type>
@@ -32,17 +32,26 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>4.0b9</em:minVersion>
- <em:maxVersion>6.*</em:maxVersion>
+ <em:minVersion>6.0</em:minVersion>
+ <em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- SeaMonkey -->
<em:targetApplication>
<Description>
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
- <em:minVersion>2.1b2</em:minVersion>
- <em:maxVersion>2.2.*</em:maxVersion>
+ <em:minVersion>2.2</em:minVersion>
+ <em:maxVersion>2.6.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Firefox Mobile -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id>
+ <em:minVersion>6.0</em:minVersion>
+ <em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>
@@ -24,10 +24,8 @@ const Ci = Components.interfaces;
*/
if ("undefined" == typeof(RXULM)) {
var RXULM = {
- /* The root branch for all RXM preferences. */
- get PREF_BRANCH() { return "extensions.rxulm."; },
- /* The FUEL Application object. */
- _application : null,
+ /* The preferences service. */
+ _prefService : null,
/* Array of timer references, keeps timeouts alive. */
_timers : [],
@@ -104,28 +102,15 @@ if ("undefined" == typeof(RXULM)) {
},
/**
- * Gets the FUEL Application object.
+ * Gets the preferences service.
*/
- get Application() {
- if (null == this._application) {
- if (null != Cc["@mozilla.org/fuel/application;1"]) {
- // Firefox and Flock.
- this._application =
- Cc["@mozilla.org/fuel/application;1"].
- getService(Ci.fuelIApplication);
- } else if (null != Cc["@mozilla.org/smile/application;1"]) {
- // SeaMonkey.
- this._application =
- Cc["@mozilla.org/smile/application;1"].
- getService(Ci.smileIApplication);
- } else {
- // Other?
- this._logger.fatal(
- "get Application: Couldn't load FUEL or equivalent.");
- }
+ get prefService() {
+ if (null == this._prefService) {
+ this._prefService =
+ Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
}
- return this._application;
+ return this._prefService;
},
/**
@@ -70,7 +70,13 @@ RXULM.Permissions = {
try {
let enumerator = this._permissionManager.enumerator;
- let localFilePref = RXULM.Application.prefs.get(LOCAL_FILE_PREF);
+ let allowLocalFiles = false;
+
+ try {
+ allowLocalFiles = RXULM.prefService.getBoolPref(LOCAL_FILE_PREF);
+ } catch (e) {
+ this._logger.info("getAll. No value for local files pref.");
+ }
while (enumerator.hasMoreElements()) {
permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
@@ -81,7 +87,7 @@ RXULM.Permissions = {
}
}
- if ((null != localFilePref) && localFilePref.value) {
+ if (allowLocalFiles) {
list.push(this.LOCAL_FILES);
}
} catch (e) {
@@ -107,7 +113,7 @@ RXULM.Permissions = {
this._permissionManager.add(uri, ALLOW_REMOTE_XUL, ALLOW);
} else {
- RXULM.Application.prefs.setValue(LOCAL_FILE_PREF, true);
+ RXULM.prefService.setBoolPref(LOCAL_FILE_PREF, true);
}
success = true;
@@ -132,7 +138,7 @@ RXULM.Permissions = {
if (this.LOCAL_FILES != aDomain) {
this._permissionManager.remove(aDomain, ALLOW_REMOTE_XUL);
} else {
- RXULM.Application.prefs.setValue(LOCAL_FILE_PREF, false);
+ RXULM.prefService.setBoolPref(LOCAL_FILE_PREF, false);
}
success = true;
@@ -18,6 +18,10 @@
height: 16em;
}
+#remotexulmanager-about-window > #domains {
+ height: 8em;
+}
+
#window-content {
padding: 1em;
}
View
@@ -125,21 +125,10 @@ var RXULMInstaller = {
uri = this._ioService.newURI(aDomain, null, null);
this._permissionManager.add(uri, this.ALLOW_REMOTE_XUL, this.ALLOW);
} else {
- let application;
-
- if (null != Cc["@mozilla.org/fuel/application;1"]) {
- // Firefox and Flock.
- application =
- Cc["@mozilla.org/fuel/application;1"].
- getService(Ci.fuelIApplication);
- } else if (null != Cc["@mozilla.org/smile/application;1"]) {
- // SeaMonkey.
- application =
- Cc["@mozilla.org/smile/application;1"].
- getService(Ci.smileIApplication);
- }
+ let prefService =
+ Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
- application.prefs.setValue(this.LOCAL_FILE_PREF, true);
+ prefService.setBoolPref(this.LOCAL_FILE_PREF, true);
}
} catch (e) {
this._showAlert(
View
@@ -33,26 +33,26 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>4.0b6</em:minVersion>
- <em:maxVersion>6.*</em:maxVersion>
+ <em:minVersion>4.0</em:minVersion>
+ <em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- SeaMonkey -->
<em:targetApplication>
<Description>
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
- <em:minVersion>2.1b2</em:minVersion>
- <em:maxVersion>2.2.*</em:maxVersion>
+ <em:minVersion>2.2</em:minVersion>
+ <em:maxVersion>2.6.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Firefox Mobile -->
<em:targetApplication>
<Description>
<em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id>
- <em:minVersion>4.0</em:minVersion>
- <em:maxVersion>6.*</em:maxVersion>
+ <em:minVersion>6.0</em:minVersion>
+ <em:maxVersion>9.*</em:maxVersion>
</Description>
</em:targetApplication>

0 comments on commit e33f34e

Please sign in to comment.