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

Update addon export branch to 10.7.0 #3143

Merged
merged 3 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Version 10.7.0

* Fix icon path, so that starred icon is shown to new users ([#3136](https://github.com/mozilla-services/screenshots/issues/3136))
* Address 10.6 review comments ([bugzilla bug 1381132](https://bugzil.la/1381132#c3))

## Version 10.6.0

* Iframe tests: validate iframe URLs, remove unneeded iframe onload handlers ([#3134](https://github.com/mozilla-services/screenshots/issues/3134))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Should be applied *inside* catcher.watchFunction
*/
this.assertIsBlankDocumentUrl = function assertIsBlankDocumentUrl(documentUrl) {
if (documentUrl !== browser.extension.getURL("blank.html")) {
this.assertIsBlankDocument = function assertIsBlankDocument(doc) {
if (doc.documentURI !== browser.extension.getURL("blank.html")) {
let exc = new Error('iframe URL does not match expected blank.html');
exc.foundURL = documentUrl;
exc.foundURL = doc.documentURI;
throw exc;
}
}
Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/background/selectorLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ this.selectorLoader = (function() {
"log.js",
"catcher.js",
"assertIsTrusted.js",
"assertIsBlankDocumentUrl.js",
"assertIsBlankDocument.js",
"background/selectorLoader.js",
"selector/callBackground.js",
"selector/util.js"
Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/background/startBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ this.startBackground = (function() {
browser.storage.local.get(["hasSeenOnboarding"]).then((result) => {
let hasSeenOnboarding = !!result.hasSeenOnboarding;
if (!hasSeenOnboarding) {
let path = "icons/icon-starred-32.svg";
let path = "icons/icon-starred-32-v2.svg";
browser.browserAction.setIcon({path});
}
}).catch((error) => {
Expand Down
13 changes: 6 additions & 7 deletions addon/webextension/clipboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals catcher, assertIsBlankDocumentUrl */
/* globals catcher, assertIsBlankDocument */

"use strict";

Expand All @@ -14,11 +14,10 @@ this.clipboard = (function() {
element.style.opacity = "0";
element.style.width = "1px";
element.style.height = "1px";
element.onload = catcher.watchFunction(() => {
element.addEventListener("load", catcher.watchFunction(() => {
try {
element.onload = null;
let doc = element.contentDocument;
assertIsBlankDocumentUrl(doc.URL);
assertIsBlankDocument(doc);
let el = doc.createElement("textarea");
doc.body.appendChild(el);
el.value = text;
Expand All @@ -27,12 +26,12 @@ this.clipboard = (function() {
if (!copied) {
catcher.unhandled(new Error("Clipboard copy failed"));
}
doc.body.removeChild(el);
el.remove();
resolve(copied);
} finally {
document.body.removeChild(element);
element.remove();
}
});
}), {once: true});
document.body.appendChild(element);
});
};
Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/icons/icon-starred-32-v2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions addon/webextension/onboarding/slides.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals log, catcher, onboardingHtml, onboardingCss, util, shooter, callBackground, assertIsTrusted, assertIsBlankDocumentUrl */
/* globals log, catcher, onboardingHtml, onboardingCss, util, shooter, callBackground, assertIsTrusted, assertIsBlankDocument */

"use strict";

Expand Down Expand Up @@ -35,10 +35,9 @@ this.slides = (function() {
html = html.replace(/MOZ_EXTENSION([^\"]+)/g, (match, filename) => {
return browser.extension.getURL(filename);
});
iframe.onload = catcher.watchFunction(() => {
iframe.onload = null;
iframe.addEventListener("load", catcher.watchFunction(() => {
doc = iframe.contentDocument;
assertIsBlankDocumentUrl(doc.URL);
assertIsBlankDocument(doc);
let parsedDom = (new DOMParser()).parseFromString(
html,
"text/html"
Expand All @@ -53,7 +52,7 @@ this.slides = (function() {
localizeText(doc);
activateSlide(doc);
resolve();
});
}), {once: true});
document.body.appendChild(iframe);
iframe.focus();
window.addEventListener("resize", onResize);
Expand Down
16 changes: 7 additions & 9 deletions addon/webextension/selector/ui.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals log, util, catcher, inlineSelectionCss, callBackground, assertIsTrusted, assertIsBlankDocumentUrl */
/* globals log, util, catcher, inlineSelectionCss, callBackground, assertIsTrusted, assertIsBlankDocument */

"use strict";

Expand Down Expand Up @@ -92,10 +92,9 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
this.element.style.margin = "0";
this.element.scrolling = "no";
this.updateElementSize();
this.element.onload = watchFunction(() => {
this.element.onload = null;
this.element.addEventListener("load", watchFunction(() => {
this.document = this.element.contentDocument;
assertIsBlankDocumentUrl(this.document.URL);
assertIsBlankDocument(this.document);
this.document.documentElement.innerHTML = `
<head>
<style>${substitutedCss}</style>
Expand All @@ -109,7 +108,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
this.document.documentElement.dir = browser.i18n.getMessage("@@bidi_dir");
this.document.documentElement.lang = browser.i18n.getMessage("@@ui_locale");
resolve();
});
}), {once: true});
document.body.appendChild(this.element);
} else {
resolve();
Expand Down Expand Up @@ -221,10 +220,9 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
this.element.style.margin = "0";
this.element.scrolling = "no";
this.updateElementSize();
this.element.onload = watchFunction(() => {
this.element.onload = null;
this.element.addEventListener("load", watchFunction(() => {
this.document = this.element.contentDocument;
assertIsBlankDocumentUrl(this.document.URL)
assertIsBlankDocument(this.document)
this.document.documentElement.innerHTML = `
<head>
<style>${substitutedCss}</style>
Expand Down Expand Up @@ -266,7 +264,7 @@ this.ui = (function() { // eslint-disable-line no-unused-vars
overlay.querySelector(".full-page").addEventListener(
"click", watchFunction(assertIsTrusted(standardOverlayCallbacks.onClickFullPage)));
resolve();
});
}), {once: true});
document.body.appendChild(this.element);
this.unhide();
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "firefox-screenshots",
"description": "An experiment in creating better shareable versions of content.",
"version": "10.6.0",
"version": "10.7.0",
"author": "Mozilla (https://mozilla.org/)",
"bugs": {
"url": "https://github.com/mozilla-services/screenshots/issues"
Expand Down