Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2699, use JS to open terms and privacy links on click
Browse files Browse the repository at this point in the history
This workaround is required because of a bug with e10s handling of https
URLs inside moz-extension pages.

As mentioned in the code comments, this workaround can be removed
once bugzilla bug 1357589 is fixed.
  • Loading branch information
jaredhirsch committed Apr 18, 2017
1 parent a238269 commit 88a0ed6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,15 @@ this.main = (function() {
});
});

// Note: this signal is only needed until bug 1357589 is fixed.
communication.register("openTermsPage", () => {
return catcher.watchPromise(browser.tabs.create({url: "https://www.mozilla.org/about/legal/terms/services/"}));
});

// Note: this signal is also only needed until bug 1357589 is fixed.
communication.register("openPrivacyPage", () => {
return catcher.watchPromise(browser.tabs.create({url: "https://www.mozilla.org/privacy/firefox-cloud/"}));
});

return exports;
})();
11 changes: 11 additions & 0 deletions addon/webextension/onboarding/slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ this.slides = (function() {
el.href = linkUrls[part];
el.textContent = linkTexts[part];
el.target = "_blank";
el.id = (part === termsSentinal) ? "terms" : "privacy";
} else {
el = doc.createTextNode(part);
}
Expand Down Expand Up @@ -140,6 +141,16 @@ this.slides = (function() {
shooter.sendEvent("finish-slides", "done");
callbacks.onEnd();
})));
// Note: e10s breaks the terms and privacy anchor tags. Work around this by
// manually opening the correct URLs on click until bug 1357589 is fixed.
doc.querySelector("#terms").addEventListener("click", watchFunction(assertIsTrusted((event) => {
event.preventDefault();
callBackground("openTermsPage");
})));
doc.querySelector("#privacy").addEventListener("click", watchFunction(assertIsTrusted((event) => {
event.preventDefault();
callBackground("openPrivacyPage");
})));
setSlide(1);
}

Expand Down

0 comments on commit 88a0ed6

Please sign in to comment.