Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code is indeed a security vulnerability, you should never do it like that. There is a relatively easy way to do it securely however (important: this is assuming that your XUL isn't running in the browser's content area). You put an iframe into your menupopup:</p> <pre><code>&lt;menu class="menu" label="test"&gt; &lt;menupopup id="ajax" onpopupshowing="myextension.ajax('http://www.myserver.com/phpscript.php'&gt; &lt;menuitem&gt; &lt;iframe id="frame" type="content" width="450" height="700"&gt;&lt;/iframe&gt; &lt;/menuitem&gt; &lt;/menupopup&gt; &lt;/menu&gt; </code></pre> <p>You can then load your data into that frame using a data: URL. The important part here is type="content" here, this creates a security boundary between your code (chrome) and the code you loaded (content). Which is why it is important that your XUL document isn't in the browser's content area - then you are already on the "content" side of the security boundary, you cannot establish another one.</p> <p>Actually putting the data into the frame works like this:</p> <pre><code>var frame = document.getElementById("frame"); // &lt;iframe&gt; element var txt = request.responseText; frame.setAttribute("src", "data:text/html;charset=utf-8," + encodeURIComponent(txt)); </code></pre> <p>For more information see <a href="https://developer.mozilla.org/En/Displaying_web_content_in_an_extension_without_security_issues" rel="nofollow">https://developer.mozilla.org/En/Displaying_web_content_in_an_extension_without_security_issues</a> (this article was written specifically with RSS readers in mind).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload