[Pkg-mozext-commits] [tabmixplus] 04/23: Open links to other sites in new tabs broken in www.reddit.com
David Prévot
taffit at moszumanska.debian.org
Fri Sep 23 03:31:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit cc09ed29032e1fb5f1afcb1e3ca89c3924831d7e
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Aug 6 09:30:38 2016 +0300
Open links to other sites in new tabs broken in www.reddit.com
---
modules/ContentClick.jsm | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index c297b59..5240887 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -1063,7 +1063,13 @@ ContentClickInternal = {
*
*/
isLinkToExternalDomain: function TMP_isLinkToExternalDomain(curpage, target) {
- var self = this;
+ const fixupURI = url => {
+ try {
+ return this.uriFixup.createFixupURI(url, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
+ } catch (ex) { }
+ return null;
+ };
+
let getDomain = function getDomain(url) {
if (typeof (url) != "string")
url = url.toString();
@@ -1074,18 +1080,25 @@ ContentClickInternal = {
if (url.match(/^file:/))
return "local_file";
- let fixedURI;
- try {
- fixedURI = self.uriFixup.createFixupURI(url, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
+ const fixedURI = fixupURI(url);
+ if (fixedURI) {
url = fixedURI.spec;
- } catch (ex) { }
+ }
if (url.match(/^http/)) {
url = fixedURI || makeURI(url);
// catch redirect
- if (url.path.match(/^\/r\/\?http/))
- url = makeURI(url.path.substr("/r/?".length));
+ const path = url.path;
+ if (path.match(/^\/r\/\?http/)) {
+ url = fixupURI(path.substr("/r/?".length));
+ } else if (path.match(/^.*\?url=http/)) {
+ // redirect in www.reddit.com
+ url = fixupURI(path.replace(/^.*\?url=/, ""));
+ }
+ if (!url) {
+ return null;
+ }
/* DONT DELETE
var host = url.hostPort.split(".");
//XXX while (host.length > 3) <---- this make problem to site like yahoo mail.yahoo.com ard.yahoo.com need
--
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