mozilla

Revision 204327 of Working around the Firefox 1.0.3 DHTML regression

  • Revision slug: Working_around_the_Firefox_1.0.3_DHTML_regression
  • Revision title: Working around the Firefox 1.0.3 DHTML regression
  • Revision id: 204327
  • Created:
  • Creator: Dria
  • Is current revision? No
  • Comment
Tags: 

Revision Content

While fixing some serious bugs for the Firefox 1.0.3 release, some changes were made in how DOM is accessed from chrome, and a DHTML regression error was inadvertently introduced.

The error you will receive if you run into these changes or the regression will appear as follows:

Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object"  
nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" 
location: "JS frame :: url_here :: anonymous :: line 789"  data: no]

There are two possible solutions for this error. The first is outlined in Safely accessing content DOM from chrome. That document outlines how you will need to change your code to take account for the changes in how DOM is accessed from chrome.

If that is not relevant for your code, where url_here is a non-chrome .js or .html file, you will have to use the following work-around in your code:

var elementProto = Element.prototype;
elementProto.__proto__ = {
 get text() { return this.firstChild.nodeValue; },
 __proto__: elementProto.__proto__
};

For more information, see Bug 290777.

Revision Source

<p>While fixing some serious bugs for the Firefox 1.0.3 release, some changes were made in how DOM is accessed from chrome, and a DHTML regression error was inadvertently introduced.
</p><p>The error you will receive if you run into these changes or the regression will appear as follows:
</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>url_here</i> :: anonymous :: line 789"  data: no]
</pre>
<p>There are two possible solutions for this error.  The first is outlined in <a href="en/Safely_accessing_content_DOM_from_chrome">Safely accessing content DOM from chrome</a>.  That document outlines how you will need to change your code to take account for the changes in how DOM is accessed from chrome.
</p><p>If that is not relevant for your code, where <i><code>url_here</code></i> is a non-chrome .js or .html file, you will have to use the following work-around in your code:
</p>
<pre>var elementProto = Element.prototype;
elementProto.__proto__ = {
 get text() { return this.firstChild.nodeValue; },
 __proto__: elementProto.__proto__
};
</pre>
<p>For more information, see <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=290777">Bug 290777</a>.
</p>
Revert to this revision