Solution: If "file_url" is a Chrome-related file

Changes were made in Firefox 1.0.3 that change how the content DOM is accessed from Chrome. These changes, and the changes you need to make to your code, are outlined in the Safely accessing content DOM from chrome.

Solution/Workaround: If "file_url" is a non-Chrome .js or .html file

If this is the case, then you have run into a bug we inadvertently introduced while making some major security fixes for Firefox 1.0.3. There is a workaround for this, as follows:

Note: If you are trying to override a predefined prototype property, you may have to put these vanilla objects ahead of the DOM prototype, instead of after it as these examples do. In that case, be careful not to reset the DOM prototype for all browsers (you'll need to detect the user agent and reset Element.prototype only for Firefox 1.0.3; other browsers do not support __proto__, so do not allow insertion in an existing prototype chain).

For more information

Revision Source

<h3 name="The_Problem"> The Problem </h3>
<p>Changes were made in Firefox 1.0.3 that can cause the following error to arise on pages that would have worked properly in previous versions:
</p>
<pre class="eval">Error: uncaught exception: [Exception... "Illegal operation
on WrappedNative prototype object"
nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)"
location: "JS frame :: <i>file_url</i> :: anonymous :: line 789" data: no]
</pre>
<p>If you are getting this error, there are two possible solutions.
</p>
<h3 name="Solution:_If_.22file_url.22_is_a_Chrome-related_file"> Solution: If "file_url" is a Chrome-related file </h3>
<p>Changes were made in Firefox 1.0.3 that change how the content DOM is accessed from Chrome. These changes, and the changes you need to make to your code, are outlined in the <a href="en/Safely_accessing_content_DOM_from_chrome">Safely accessing content DOM from chrome</a>.
</p>
<h3 name="Solution.2FWorkaround:_If_.22file_url.22_is_a_non-Chrome_.js_or_.html_file"> Solution/Workaround: If "file_url" is a non-Chrome .js or .html file </h3>
<p>If this is the case, then you have run into a bug we inadvertently introduced while making some major security fixes for Firefox 1.0.3. There is a workaround for this, as follows:
</p>
<h4 name="Gecko-based_browsers"> Gecko-based browsers </h4>
<pre>var elementProto = Element.prototype;
elementProto.__proto__ = {
get text() { return this.firstChild.nodeValue; },
__proto__: elementProto.__proto__
};
</pre>
<p><b>Note:</b> The <code>get text() {...}</code> syntax will not work in non-Gecko browsers.
</p>
<h4 name="All_browsers"> All browsers </h4>
<pre>var elementProto = Element.prototype;
var elementGrandProto = elementProto.__proto__ = {
__proto__: elementProto.__proto__;
};
elementGrandProto.__defineGetter__('text',
function () { return this.firstChild.nodeValue; }
);
</pre>
<p><b>Note:</b> If you are trying to override a predefined prototype property, you may have to put these vanilla objects ahead of the DOM prototype, instead of after it as these examples do. In that case, be careful not to reset the DOM prototype for all browsers (you'll need to detect the user agent and reset Element.prototype only for Firefox 1.0.3; other browsers do not support __proto__, so do not allow insertion in an existing prototype chain).
</p>
<h3 name="For_more_information"> For more information </h3>
<p>For more information, see <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=290777">Bug 290777</a>.
</p>