Skip to content

Commit

Permalink
Toggle using duplication: try restore text in URL bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Feb 19, 2017
1 parent 650747f commit f713005
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3807,6 +3807,7 @@ var privateTab = {
replaceTabAndTogglePrivate: function(tab, isPrivate) {
var window = tab.ownerDocument.defaultView;
var gBrowser = this.getTabBrowser(tab);
var gURLBar = window.gURLBar;
var pos = "_tPos" in tab
? tab._tPos
: Array.prototype.indexOf.call(gBrowser.tabs, tab); // SeaMonkey
Expand All @@ -3818,18 +3819,29 @@ var privateTab = {
if((e.originalTarget || e.target) != dupTab)
return;
window.removeEventListener(e.type, onRestored, false);
if(typed != null) window.setTimeout(function() {
if(!dupTab.linkedBrowser) // Already closed?
return;
if(focusURLBar) // Force update
gURLBar.value = typed;
dupTab.linkedBrowser.userTypedValue = typed;
}, 100);
window.setTimeout(function() {
delete dupTab._privateTabSourceTab;
}, 250);
}, false);
});
var focusURLBar = gURLBar.focused;
var typed = tab.linkedBrowser.userTypedValue;
var dupTab = this.duplicateTabAndTogglePrivate(tab, isPrivate);
dupTab._privateTabWaitInitialize = Date.now();
dupTab.collapsed = false; // Not really needed, just to ensure
tab.pinned && this.forcePinTab(dupTab, pos);
gBrowser.moveTabTo(dupTab, pos);
if(tab.selected)
gBrowser.selectedTab = dupTab;
if(focusURLBar && !gURLBar.focused)
gURLBar.focus();
var removeTab, startTime = Date.now();
window.setTimeout(removeTab = function() { // Wait for async duplication
if(this.isTabNotInitialized(dupTab) && Date.now() - startTime < 10e3) {
Expand Down

0 comments on commit f713005

Please sign in to comment.