Skip to content

Commit

Permalink
Update urlbar.js
Browse files Browse the repository at this point in the history
  • Loading branch information
117649 committed Apr 8, 2021
1 parent ba241bb commit 914ee55
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions AdvancedLocationbar/chrome/content/urlbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
}
}, true);

this._original_getSelectedValueForClipboard = gURLBar._getSelectedValueForClipboard;

this.scroll_on_mouse_wheel = this._prefsext.getBoolPref("scroll_on_mouse_wheel");;
}

Expand All @@ -142,8 +144,6 @@
}

connectedCallback() {
this._original_getSelectedValueForClipboard = gURLBar._getSelectedValueForClipboard;

if (this.delayConnectedCallback()) {
return;
}
Expand Down Expand Up @@ -271,17 +271,17 @@
}

set copy_unescaped(val) {
if (this._original_getSelectedValueForClipboard)
if (this._original_getSelectedValueForClipboard && (val != this._copy_unescaped))
if (val)
gURLBar._getSelectedValueForClipboard = _ => this._getSelectedValueForClipboard.call(this);
else
gURLBar._getSelectedValueForClipboard = this._original_getSelectedValueForClipboard;

this._copy_unescaped = val;
return val;
}

get copy_unescaped() {
return this._prefsext.getBoolPref("copy_unescaped");
return this._copy_unescaped;
}

_syncValue() {
Expand Down Expand Up @@ -351,7 +351,7 @@
while (this.pathFileNodeQ.nextSibling != this.pathFileNodeF)
presentation.removeChild(this.pathFileNodeQ.nextSibling);

var pathSegments = UrlbarInput.prototype._getValueFromResult({payload:{url: this.uri.spec}}, this.uri.spec).replace(/^[^:]*:\/\/[^\/]*\//, "");
var pathSegments = UrlbarInput.prototype._getValueFromResult({ payload: { url: this.uri.spec } }, this.uri.spec).replace(/^[^:]*:\/\/[^\/]*\//, "");

var iFragment = pathSegments.indexOf("#");
if (iFragment > -1) {
Expand Down Expand Up @@ -470,7 +470,7 @@
var urlstr = this._original_getSelectedValueForClipboard.call(gURLBar);
if (this.copy_unescaped && !gURLBar.valueIsTyped && gURLBar.selectionStart == 0 && gURLBar.selectionEnd == gURLBar.inputField.value.length) {
try {
return UrlbarInput.prototype._getValueFromResult({payload:{url: urlstr}}, urlstr).replace(/[()"\s]/g, escape); // escape() doesn't encode @*_+-./
return UrlbarInput.prototype._getValueFromResult({ payload: { url: urlstr } }, urlstr).replace(/[()"\s]/g, escape); // escape() doesn't encode @*_+-./
} catch (e) {
return urlstr;
}
Expand Down

0 comments on commit 914ee55

Please sign in to comment.