0

With the release of the new version of Firefox 16, my extension was to produce an error: "Permission denied to access property 'myVarExt'".

browser.xul

<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://mynewext/locale/overlay.dtd">
<overlay id="mynewext-overlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript;version=1.7" src="base.js"/>
<hbox id="browser">
    <splitter insertafter="sidebar-splitter"
              state="open"
              resizebefore="closest"
              resizeafter="closest"
              id="mynewext-splitter"
              hidden="true"/>
    <vbox id="mynewext-sidebar"
          insertafter="sidebar-splitter"
          width="308"
          minwidth="308"
          maxwidth="308"
          collapsed="true">
      <tabbox flex="1">
        <tabpanels id="mynewext-panels" flex="1">
          <iframe id="mynewext-dashboard" flex="1"/>
        </tabpanels>        
      </tabbox>
    </vbox>
  </hbox>
</overlay>

The file base.js registered variables and function of the filling iframe:

base.js

...
var myVarExt='Good!'; //Is the same variable that was accessed
...
var xulContentPanel=_('dashboard');
xulContentPanel.contentDocument.location.href = 'resource://mynewext/html/bodyfirefox.xhtml';
...

Access the variable myVarExt of iframe this way:

bodyfirefox.xhtml

<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml"><head>
    <title>myBar</title>
  </head>
<body><div id="testExtVar"></div></body>
<script type="text/javascript" >
var extVar=parent.myVarExt;
document.getElementById('testExtVar').innerHTML = extVar;
</script>
</html>

In older versions of Firefox this appeal worked, and the new no. In what could be the problem?

4

1 回答 1

0

Problem solved.

  1. iframe not use type="content"
  2. transferred the contents of the resource:// to chrome:// (chrome has more priority than the resource).

Well and accordingly rewrote the way where paid to resource for chrome

于 2012-10-15T13:36:27.550 回答