Bug 1254194: [webext] Fix tests that violate the default CSP. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 14 Apr 2016 16:36:47 -0700
changeset 351731 95206fc37f0d79070efc062ce1dab68bc64b854e
parent 347695 71d3427c683190cdb409063ad67e24d5926f4591
child 351732 35dae970c0bd48820f19eaecd75abea9d84ac4d0
push id15524
push usermaglione.k@gmail.com
push dateFri, 15 Apr 2016 01:09:46 +0000
reviewersaswan
bugs1254194
milestone48.0a1
Bug 1254194: [webext] Fix tests that violate the default CSP. r?aswan MozReview-Commit-ID: GAon89LFr6C
browser/components/extensions/test/browser/browser_ext_popup_api_injection.js
toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
--- 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/");