javascript - How to set 'load' action after unsafeWindow.open -


It appears that I could just do this:

  var newWindow = unsafeWindow Open (someUrlOnTheSameDomain); NewWindow.addEventListener ('Load', toRunOnLoad); // or newWindow.onload = toRunOnLoad;   

But now Firefox returns error Refusing permission to use property 'addEventListener' when trying to perform similar or similar action This is done whether window.open or unsafe Windows.open is used.

According to the new way to interact with an unsafe, clonoin () , exportfunction () , and createObjectIn () , but this announcement or limited documentation is not clear how any of these can be added in the event controller in the new window.

What is the new solution for this pattern?

Hmm .. interacting with a window that opens from the second window through the content script is actually a something's wrong.

  1. You can use window.open , but can not be interacted with the resulting window, in conjunction with the Sandbox Principal (the same basic policy) Due to various included wrappers.
  2. You can use unsafe Window.open , but it is necessary to ensure that is related to unsecured Wando to provide a function .

    So I used a little experiment, and it is expected to work in Firefox 31 and Knightley.

    main.js

      var pageMod = ("sdk / page-mod"); PageMod.PageMod ({include: "* .mozilla.org", contentScriptFile: Required ("SDK / Self)". Data.url ("script.js")});   

    script.js

      function doSomething (e) {var d = e.target.ownerDocument || E.target; Var w = d.defaultView; Console.log ("abc", d.location.href, w.document.title, d.body.inner HTML); } Export Fraction (what some, unsafe Wando, {defined: "doSomething"}); Var w = unsafe window.open ("http://www.mozilla.org/about"); W.addEventListener ('Load', Unsecured Window.doSomething);    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -