title: failed to execute postMessage on DOMWindow : target origin
body: <p>i am working on firefox addon. i have 2 scripts filler.js and aws.js</p>
  
  <p><strong>filler.js</strong></p>
  
  <pre><code>document.getElementById("orderNow").addEventListener("click", function() {
  
  var domain = 'https://www.amazon.com/';
  var openWin = window.open(domain);
  
  //message sender
  var message = "WS Iron Man";
  openWin.postMessage(message,domain); //sending the message
  
  });
  </code></pre>
  
  <p><strong>aws.js</strong></p>
  
  <pre><code>window.onload = function () {
  //alert('page loaded successfully'); //alert function working here
  window.addEventListener("message", receiveMessage, false);
  
  function receiveMessage(event) {
      if (event.origin !== "http://localhost/waveapp/includes/pages/order_details.html")
          return;
  // alert to check function working or not
  var msg = event.data;
      alert(msg);  
  
  }
  };
  </code></pre>
  
  <p><strong>manifest.json</strong></p>
  
  <pre><code> {
  
  "manifest_version": 2,
  "name": "Borderify",
  "version": "1.0",
  
  "description": "Copy details to amazon.com.",
  
  "icons": {
  "48": "icons/border-48.png"
  },
  
  "content_scripts": [
  {
    "matches": ["&lt;all_urls&gt;"],
    "js": ["filler.js"]
  },
   {
    "matches": ["*://*.amazon.com/*"],
    "js": ["aws.js"]
  }
  ],
  
  "permissions": [
  "clipboardRead",
  "unlimitedStorage",
  "storage"
  ]
  
  }
  </code></pre>
  
  <p>filler.js running in my localhost and aws.js run on amazon.com. this is a firefox extension.</p>
  
  <p>when i run, i am getting error msg in console </p>
  
  <p>"<strong>Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘<a href="https://www.amazon.com" rel="nofollow noreferrer">https://www.amazon.com</a>’) does not match the recipient window’s origin (‘null’)</strong>"</p>
  
  <p>also getting this msg </p>
  
  <p>"<strong>Storage access automatically granted for tracker “<a href="https://www.amazon.com" rel="nofollow noreferrer">https://www.amazon.com</a>” on “<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>”</strong>"</p>
  
  <p>Please help me fix it, i am sorry for my bad english</p>