Bug 1254194: [webext] Fix tests that violate the default CSP. r?aswan
MozReview-Commit-ID: GAon89LFr6C
--- a/browser/components/extensions/test/browser/browser_ext_popup_api_injection.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_api_injection.js
@@ -11,23 +11,23 @@ add_task(function* testPageActionPopup()
"default_popup": `${BASE}/file_popup_api_injection_a.html`,
},
"page_action": {
"default_popup": `${BASE}/file_popup_api_injection_b.html`,
},
},
files: {
- "popup-a.html": String.raw`<html><head><meta charset="utf-8"><script type="application/javascript">
- browser.test.sendMessage("from-popup-a");
- </script></head></html>`,
+ "popup-a.html": `<html><head><meta charset="utf-8">
+ <script type="application/javascript" src="popup-a.js"></script></head></html>`,
+ "popup-a.js": 'browser.test.sendMessage("from-popup-a");',
- "popup-b.html": String.raw`<html><head><meta charset="utf-8"><script type="application/javascript">
- browser.test.sendMessage("from-popup-b");
- </script></head></html>`,
+ "popup-b.html": `<html><head><meta charset="utf-8">
+ <script type="application/javascript" src="popup-b.js"></script></head></html>`,
+ "popup-b.js": 'browser.test.sendMessage("from-popup-b");',
},
background: function() {
let tabId;
browser.tabs.query({active: true, currentWindow: true}, tabs => {
tabId = tabs[0].id;
browser.pageAction.show(tabId);
browser.test.sendMessage("ready");
--- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
@@ -100,23 +100,27 @@ add_task(function* test_web_accessible_r
background: `(${background})()`,
files: {
"content_script.js": `(${contentScript})()`,
"accessible.html": `<html><head>
<meta charset="utf-8">
- <script>browser.runtime.sendMessage(["page-script", location.href]);</${"script"}>
+ <script src="accessible.js"></${"script"}>
</head></html>`,
+ "accessible.js": 'browser.runtime.sendMessage(["page-script", location.href]);',
+
"inaccessible.html": `<html><head>
<meta charset="utf-8">
- <script>browser.runtime.sendMessage(["page-script", location.href]);</${"script"}>
+ <script src="inaccessible.js"></${"script"}>
</head></html>`,
+
+ "inaccessible.js": 'browser.runtime.sendMessage(["page-script", location.href]);',
},
});
yield extension.startup();
yield extension.awaitMessage("ready");
let win = window.open("http://example.com/");