[Pkg-mozext-commits] [tabmixplus] 42/61: Wrap original PlacesCommandHook.bookmarkPage function with a function that change browser._contentTitle to a user defined tile when exist
David Prévot
taffit at moszumanska.debian.org
Fri Aug 28 19:09:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 68a0039b217b13be0400d448eb4584e9490ad6ca
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Aug 9 13:41:56 2015 +0300
Wrap original PlacesCommandHook.bookmarkPage function with a function that change browser._contentTitle to a user defined tile when exist
---
chrome/content/places/places.js | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index dc02971..e3a16c8 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -29,11 +29,32 @@ var TMP_Places = {
// use tab label for bookmark name when user renamed the tab
// PlacesCommandHook exist on browser window
if ("PlacesCommandHook" in window) {
- if (!Tabmix.isVersion(400))
- Tabmix.changeCode(PlacesCommandHook, "PlacesCommandHook.bookmarkPage")._replace(
- /(webNav\.document\.)*title \|\| (url|uri)\.spec;/,
- 'TMP_Places.getTabTitle(gBrowser.getTabForBrowser(aBrowser), url.spec) || $&'
- ).toCode();
+ if (Tabmix.isVersion(400)) {
+ if (!Tabmix.originalFunctions.placesBookmarkPage) {
+ Tabmix.originalFunctions.placesBookmarkPage = PlacesCommandHook.bookmarkPage;
+ }
+ PlacesCommandHook.bookmarkPage = function(aBrowser) {
+ let origTitle;
+ let tab = gBrowser.getTabForBrowser(aBrowser);
+ let title = TMP_Places.getTabTitle(tab, aBrowser.currentURI.spec);
+ if (typeof title == "string") {
+ origTitle = aBrowser.contentTitle;
+ aBrowser._contentTitle = title;
+ }
+ try {
+ return Tabmix.originalFunctions.placesBookmarkPage.apply(this, arguments);
+ } finally {
+ if (origTitle) {
+ aBrowser._contentTitle = origTitle;
+ }
+ }
+ };
+ } else {
+ Tabmix.changeCode(PlacesCommandHook, "PlacesCommandHook.bookmarkPage")._replace(
+ /(webNav\.document\.)*title \|\| (url|uri)\.spec;/,
+ 'TMP_Places.getTabTitle(gBrowser.getTabForBrowser(aBrowser), url.spec) || $&'
+ ).toCode();
+ }
Tabmix.changeCode(PlacesCommandHook, "uniqueCurrentPages", {getter: true})._replace(
'URIs.push(tab.linkedBrowser.currentURI);',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list