mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-04 10:04:12 +01:00
s/service[(".*?")]/services.get(\1)/g; s/service.get(\w+)/'services.create("' + lcfirst($1) + '")'/ge
This commit is contained in:
@@ -28,11 +28,6 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
|
||||
/** @scope modules */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const plugins = {};
|
||||
@@ -684,18 +679,18 @@ const liberator = (function () //{{{
|
||||
return false; // so you can do: if (...) return liberator.beep();
|
||||
},
|
||||
|
||||
newThread: function () service["threadManager"].newThread(0),
|
||||
newThread: function () services.get("threadManager").newThread(0),
|
||||
|
||||
callAsync: function (thread, self, func)
|
||||
{
|
||||
thread = thread || service["threadManager"].newThread(0);
|
||||
thread = thread || services.get("threadManager").newThread(0);
|
||||
thread.dispatch(new Runnable(self, func, Array.slice(arguments, 3)), thread.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
// be sure to call GUI related methods like alert() or dump() ONLY in the main thread
|
||||
callFunctionInThread: function (thread, func)
|
||||
{
|
||||
thread = thread || service["threadManager"].newThread(0);
|
||||
thread = thread || services.get("threadManager").newThread(0);
|
||||
|
||||
// DISPATCH_SYNC is necessary, otherwise strange things will happen
|
||||
thread.dispatch(new Runnable(null, func, Array.slice(arguments, 2)), thread.DISPATCH_SYNC);
|
||||
@@ -767,7 +762,7 @@ const liberator = (function () //{{{
|
||||
|
||||
loadScript: function (uri, context)
|
||||
{
|
||||
service["subscriptLoader"].loadSubScript(uri, context);
|
||||
services.get("subscriptLoader").loadSubScript(uri, context);
|
||||
},
|
||||
|
||||
eval: function (str, context)
|
||||
@@ -901,7 +896,7 @@ const liberator = (function () //{{{
|
||||
// if clearFocusedElement, also blur a focused link
|
||||
focusContent: function (clearFocusedElement)
|
||||
{
|
||||
if (window != service["windowWatcher"].activeWindow)
|
||||
if (window != services.get("windowWatcher").activeWindow)
|
||||
return;
|
||||
|
||||
let elem = config.mainWidget || window.content;
|
||||
@@ -934,7 +929,7 @@ const liberator = (function () //{{{
|
||||
|
||||
hasExtension: function (name)
|
||||
{
|
||||
let extensions = service["extensionManager"].getItemList(Ci.nsIUpdateItem.TYPE_EXTENSION, {});
|
||||
let extensions = services.get("extensionManager").getItemList(Ci.nsIUpdateItem.TYPE_EXTENSION, {});
|
||||
|
||||
return extensions.some(function (e) e.name == name);
|
||||
},
|
||||
@@ -1112,8 +1107,8 @@ const liberator = (function () //{{{
|
||||
|
||||
case liberator.NEW_WINDOW:
|
||||
window.open();
|
||||
service["windowMediator"].getMostRecentWindow("navigator:browser")
|
||||
.loadURI(url, null, postdata);
|
||||
services.get("windowMediator").getMostRecentWindow("navigator:browser")
|
||||
.loadURI(url, null, postdata);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1154,7 +1149,7 @@ const liberator = (function () //{{{
|
||||
options.setPref("browser.startup.page", 1); // start with default homepage session
|
||||
|
||||
if (force)
|
||||
service["appStartup"].quit(Ci.nsIAppStartup.eForceQuit);
|
||||
services.get("appStartup").quit(Ci.nsIAppStartup.eForceQuit);
|
||||
else
|
||||
window.goQuitApplication();
|
||||
},
|
||||
@@ -1184,24 +1179,24 @@ const liberator = (function () //{{{
|
||||
{
|
||||
// notify all windows that an application quit has been requested.
|
||||
var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||
service["observer"].notifyObservers(cancelQuit, "quit-application-requested", null);
|
||||
services.get("observer").notifyObservers(cancelQuit, "quit-application-requested", null);
|
||||
|
||||
// something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
return;
|
||||
|
||||
// notify all windows that an application quit has been granted.
|
||||
service["observer"].notifyObservers(null, "quit-application-granted", null);
|
||||
services.get("observer").notifyObservers(null, "quit-application-granted", null);
|
||||
|
||||
// enumerate all windows and call shutdown handlers
|
||||
let windows = service["windowMediator"].getEnumerator(null);
|
||||
let windows = services.get("windowMediator").getEnumerator(null);
|
||||
while (windows.hasMoreElements())
|
||||
{
|
||||
let win = windows.getNext();
|
||||
if (("tryToClose" in win) && !win.tryToClose())
|
||||
return;
|
||||
}
|
||||
service["appStartup"].quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
|
||||
services.get("appStartup").quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
|
||||
},
|
||||
|
||||
// TODO: move to {muttator,vimperator,...}.js
|
||||
@@ -1228,10 +1223,10 @@ const liberator = (function () //{{{
|
||||
|
||||
try
|
||||
{
|
||||
let infoPath = service.getFile();
|
||||
let infoPath = services.create("file");
|
||||
infoPath.initWithPath(IO.expandPath(IO.runtimePath.replace(/,.*/, "")));
|
||||
infoPath.append("info");
|
||||
infoPath.append(service["profile"].selectedProfile.name);
|
||||
infoPath.append(services.get("profile").selectedProfile.name);
|
||||
storage.infoPath = infoPath;
|
||||
}
|
||||
catch (e)
|
||||
@@ -1280,7 +1275,7 @@ const liberator = (function () //{{{
|
||||
// make sourcing asynchronous, otherwise commands that open new tabs won't work
|
||||
setTimeout(function () {
|
||||
|
||||
let init = service["environment"].get(config.name.toUpperCase() + "_INIT");
|
||||
let init = services.get("environment").get(config.name.toUpperCase() + "_INIT");
|
||||
if (init)
|
||||
liberator.execute(init);
|
||||
else
|
||||
@@ -1337,7 +1332,7 @@ const liberator = (function () //{{{
|
||||
|
||||
sleep: function (delay)
|
||||
{
|
||||
let mainThread = service["threadManager"].mainThread;
|
||||
let mainThread = services.get("threadManager").mainThread;
|
||||
|
||||
let end = Date.now() + delay;
|
||||
while (Date.now() < end)
|
||||
@@ -1347,8 +1342,8 @@ const liberator = (function () //{{{
|
||||
|
||||
callInMainThread: function (callback, self)
|
||||
{
|
||||
let mainThread = service["threadManager"].mainThread;
|
||||
if (!service["threadManager"].isMainThread)
|
||||
let mainThread = services.get("threadManager").mainThread;
|
||||
if (!services.get("threadManager").isMainThread)
|
||||
mainThread.dispatch({ run: callback.call(self) }, mainThread.DISPATCH_NORMAL);
|
||||
else
|
||||
callback.call(self);
|
||||
@@ -1356,7 +1351,7 @@ const liberator = (function () //{{{
|
||||
|
||||
threadYield: function (flush, interruptable)
|
||||
{
|
||||
let mainThread = service["threadManager"].mainThread;
|
||||
let mainThread = services.get("threadManager").mainThread;
|
||||
liberator.interrupted = false;
|
||||
do
|
||||
{
|
||||
@@ -1396,7 +1391,7 @@ const liberator = (function () //{{{
|
||||
get windows()
|
||||
{
|
||||
let windows = [];
|
||||
let enumerator = service["windowMediator"].getEnumerator("navigator:browser");
|
||||
let enumerator = services.get("windowMediator").getEnumerator("navigator:browser");
|
||||
while (enumerator.hasMoreElements())
|
||||
windows.push(enumerator.getNext());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user