Skip to content

Commit

Permalink
update backbone
Browse files Browse the repository at this point in the history
  • Loading branch information
Quicksaver committed Mar 23, 2016
1 parent ce157e3 commit b4b2e36
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 180 deletions.
24 changes: 23 additions & 1 deletion bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// VERSION 1.8.8
// VERSION 1.8.9

// This looks for file defaults.js in resource folder, expects:
// objName - (string) main object name for the add-on, to be added to window element
Expand Down Expand Up @@ -85,6 +85,28 @@ function LOG(str) {
if(!str) { str = typeof(str)+': '+str; }
console.log(objName+' :: CHROME :: '+str);
}
function STEPLOGGER(name) {
this.name = name;
this.steps = [];
this.initTime = new Date().getTime();
this.lastTime = this.initTime;
}
STEPLOGGER.prototype = {
step: function(name) {
let time = new Date().getTime();
this.steps.push({ name, time: time - this.lastTime});
this.lastTime = time;
},
end: function() {
this.step('end');
let endTime = new Date().getTime();
let report = { name: this.name, total: endTime - this.initTime };
for(let x of this.steps) {
report[x.name] = x.time;
}
console.log(report);
}
};

XPCOMUtils.defineLazyServiceGetter(Services, "xulStore", "@mozilla.org/xul/xulstore;1", "nsIXULStore");
XPCOMUtils.defineLazyServiceGetter(Services, "navigator", "@mozilla.org/network/protocol;1?name=http", "nsIHttpProtocolHandler");
Expand Down
4 changes: 2 additions & 2 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>44.0</em:minVersion>
<em:maxVersion>47.0a1</em:maxVersion>
<em:minVersion>45.0</em:minVersion>
<em:maxVersion>48.0a1</em:maxVersion>
</Description>
</em:targetApplication>

Expand Down
14 changes: 3 additions & 11 deletions resource/modules/content/mFinder.jsm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// VERSION 1.0.22
// VERSION 1.0.23

this.__defineGetter__('isPDFJS', function() { return Finder.isPDFJS; });

Expand Down Expand Up @@ -1079,11 +1079,7 @@ this.Finder = {
}
else {
let body = (document instanceof Ci.nsIDOMHTMLDocument && document.body) ? document.body : document.documentElement;
if(Services.vc.compare(Services.appinfo.version, "45.0a1") >= 0) {
text = body.innerText;
} else {
text = innerText(body);
}
text = body.innerText;
}
resolve(text);
});
Expand Down Expand Up @@ -1115,11 +1111,7 @@ this.Finder = {
let doc = (aWindow.frames[i]) ? aWindow.frames[i].document : null;
if(!doc) { continue; }
let body = (doc instanceof Ci.nsIDOMHTMLDocument && doc.body) ? doc.body : doc.documentElement;
if(Services.vc.compare(Services.appinfo.version, "45.0a1") >= 0) {
text += body.innerText;
} else {
text += innerText(body);
}
text += body.innerText;
text += this.getInnerTextFrames(aWindow.frames[i]);
}
return text;
Expand Down
37 changes: 34 additions & 3 deletions resource/modules/content/utils/ChildProcess.jsm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// VERSION 1.0.1
// VERSION 1.0.3

// This script should be loaded by defaultsContent.js, which is in turn loaded directly by the Messenger module.
// defaultsContent.js call its .init(objPathString, frame) method, where frame is the enviroment of the frame script.
Expand Down Expand Up @@ -80,6 +80,28 @@ function LOG(str) {
if(!str) { str = typeof(str)+': '+str; }
console.log(objName+' :: CONTENT :: '+str);
}
function STEPLOGGER(name) {
this.name = name;
this.steps = [];
this.initTime = new Date().getTime();
this.lastTime = this.initTime;
}
STEPLOGGER.prototype = {
step: function(name) {
let time = new Date().getTime();
this.steps.push({ name, time: time - this.lastTime});
this.lastTime = time;
},
end: function() {
this.step('end');
let endTime = new Date().getTime();
let report = { name: this.name, total: endTime - this.initTime };
for(let x of this.steps) {
report[x.name] = x.time;
}
console.log(report);
}
};

function handleDeadObject(ex) {
if(ex.message == "can't access dead object") {
Expand Down Expand Up @@ -455,6 +477,9 @@ var ChildProcess = {
'disable'
],

// modules that are found in modules/utils/ and not in modules/content/utils/
nonContentModules: new Set([ 'utils/PrefPanes' ]),

receiveMessage: function(m) {
let name = messageName(m);

Expand Down Expand Up @@ -534,11 +559,17 @@ var ChildProcess = {
},

loadModule: function(name) {
Modules.load('content/'+name);
if(!this.nonContentModules.has(name)) {
name = 'content/'+name;
}
Modules.load(name);
},

unloadModule: function(name) {
Modules.unload('content/'+name);
if(!this.nonContentModules.has(name)) {
name = 'content/'+name;
}
Modules.unload(name);
},

// clean up this object
Expand Down
25 changes: 2 additions & 23 deletions resource/modules/findInTabs.jsm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// VERSION 2.3.18
// VERSION 2.3.19

this.__defineGetter__('FITdeferred', function() { return window.FITdeferred; });
this.__defineGetter__('FITinitialized', function() { return FITdeferred.promise; });
Expand Down Expand Up @@ -776,28 +776,7 @@ this.FIT = {
getTabGroupName: function(aGroup) {
if(aGroup.linkedWindow.TabView) {
// Tab Groups add-on provides an easy way to get the group title
if(aGroup.linkedWindow.TabView.getGroupTitle) {
return aGroup.linkedWindow.TabView.getGroupTitle(aGroup);
}

// This is a copy of what happens in TabView._createGroupMenuItem()
// can be removed in FF45
let name = aGroup.getTitle();
if(!name.trim()) {
let topChildLabel = aGroup.getTopChild().tab.label;
let childNum = aGroup.getChildren().length;

if(childNum > 1) {
Windows.callOnMostRecent(function(win) {
let num = childNum -1;
name = win.gNavigatorBundle.getString("tabview.moveToUnnamedGroup.label");
name = win.PluralForm.get(num, name).replace("#1", topChildLabel).replace("#2", num);
}, 'navigator:browser');
} else {
name = topChildLabel;
}
}
return name;
return aGroup.linkedWindow.TabView.getGroupTitle(aGroup);
}

// Tab Groups are gone, so we make up our own "group" name, which represents the full window
Expand Down
64 changes: 1 addition & 63 deletions resource/modules/gFindBar.jsm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// VERSION 1.2.6
// VERSION 1.2.7

this.__defineGetter__('gFindBar', function() { return window.gFindBar || $('FindToolbar'); });
this.__defineGetter__('gFindBarInitialized', function() { return FITFull || viewSource || window.gFindBarInitialized; });
Expand Down Expand Up @@ -205,64 +205,6 @@ this.baseInit = function(bar) {
Piggyback.add('gFindBar', bar, '_updateMatchesCount', function() {});
bar._foundMatches.value = '';
bar._foundMatches.hidden = true;

// opening the findbar is a somewhat asynchronous process, it needs to fetch the value to prefill from content,
// if the user types in the findbar after it's opened, but before the prefill value is fetched, it can lead to some weirdness with the search query
// see https://github.com/Quicksaver/FindBar-Tweak/issues/198 and https://bugzilla.mozilla.org/show_bug.cgi?id=1198465
if(Services.vc.compare(Services.appinfo.version, "45.0a1") < 0) {
Piggyback.add('gFindBar', bar, 'onCurrentSelection', function(aSelectionString, aIsInitialSelection) {
// no-op in case something resolved and nulled startFindDeferred in the meantime
return !aIsInitialSelection || this._startFindDeferred;
}, Piggyback.MODE_BEFORE);

// keypresses are communicated through a message sent from content
Piggyback.add('gFindBar', bar, '_onBrowserKeypress', function(aFakeEvent) {
// in theory, fast keypresses could stack up when the process is slow/hanging, especially in e10s-code which has a high degree of asynchronicity here.
// we should make sure the findbar isn't "opened" several times, otherwise it could lead to erroneous find queries
// see https://github.com/Quicksaver/FindBar-Tweak/issues/198 and https://bugzilla.mozilla.org/show_bug.cgi?id=1198465
if(!this.hidden && document.activeElement == this._findField.inputField) {
this._dispatchKeypressEvent(this._findField.inputField, aFakeEvent);
return false;
}

let FAYT_LINKS_KEY = "'";
let FAYT_TEXT_KEY = "/";

if(this._findMode != this.FIND_NORMAL && this._quickFindTimeout) {
if(!aFakeEvent.charCode) {
return true;
}

this._findField.select();
this._findField.focus();
this._dispatchKeypressEvent(this._findField.inputField, aFakeEvent);
return false;
}

let key = aFakeEvent.charCode ? String.fromCharCode(aFakeEvent.charCode) : null;
let manualstartFAYT = (key == FAYT_LINKS_KEY || key == FAYT_TEXT_KEY);
let autostartFAYT = !manualstartFAYT && Prefs.FAYTenabled && key && key != " ";
if(manualstartFAYT || autostartFAYT) {
let mode = (key == FAYT_LINKS_KEY || (autostartFAYT && this._typeAheadLinksOnly)) ? this.FIND_LINKS : this.FIND_TYPEAHEAD;

// Clear bar first, so that when open() calls setCaseSensitivity() it doesn't get confused by a lingering value
this._findField.value = "";

this.open(mode);
this._setFindCloseTimeout();
this._findField.select();
this._findField.focus();

if(autostartFAYT) {
this._dispatchKeypressEvent(this._findField.inputField, aFakeEvent);
} else {
this._updateStatusUI(this.nsITypeAheadFind.FIND_FOUND);
}

return false;
}
});
}
};

this.baseDeinit = function(bar) {
Expand Down Expand Up @@ -291,10 +233,6 @@ this.baseDeinit = function(bar) {
Piggyback.revert('gFindBar', bar, '_findAgain');
Piggyback.revert('gFindBar', bar, 'onFindAgainCommand');
Piggyback.revert('gFindBar', bar, '_updateMatchesCount');
if(Services.vc.compare(Services.appinfo.version, "45.0a1") < 0) {
Piggyback.revert('gFindBar', bar, 'onCurrentSelection');
Piggyback.revert('gFindBar', bar, '_onBrowserKeypress');
}

// this should always be resolved just after opening the sidebar,
// but in case any of our initialization listeners hangs around for some reason, better ret rid of it
Expand Down
42 changes: 0 additions & 42 deletions resource/modules/utils/HTMLElements.jsm

This file was deleted.

Loading

0 comments on commit b4b2e36

Please sign in to comment.