Closed Bug 324211 Opened 20 years ago Closed 20 years ago

setting parentURIContentListener throws Exception NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN Cannot modify properties of a WrappedNative

Categories

(Toolkit Graveyard :: Error Console, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: general, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 I've written an extension for FireFox 1.0.6 which captures URL events. According to the "Mozilla Embedding FAQ - How do I watch/intercept a load before it happens?" http://developer.mozilla.org/en/docs/Mozilla_Embedding_FAQ:How_do_I... The following code works in all other version including 1.0.6 but not in 1.5 This is a snippet of my code which is failing: docShell = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShell) .QueryInterface(Components.interfaces.nsIInterfaceRequestor); try { docShell.parentURIContentListener = uriListener; } catch (e) { consoleService.logStringMessage("Exception:" + e); } Reproducible: Always Steps to Reproduce: 1. Bring up the Java Console 2. Insert the following line in the evaluate text field as one line: var uriListener; var docShell = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShell) .QueryInterface(Components.interfaces.nsIInterfaceRequestor); try { docShell.parentURIContentListener = uriListener; } catch (e) { Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService).logStringMessage("Exception:" + e); } } 3. Click evaluate Actual Results: Exception:[Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: javascript: var uriListener; var docShell = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShell) .QueryInterface(Components.interfaces.nsIInterfaceRequestor); try { docShell.parentURIContentListener = uriListener; } catch (e) { Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService).logStringMessage("Exception:" + e); } :: <TOP_LEVEL> :: line 1" data: no] Expected Results: no exception thrown as seen in FireFox 1.0.6 Please fix this. As an extension developer this is the only way to intercept URIs and to maintain backward compatibility.
The parentURIContentListener attribute has been removed from the docshell object. Please check bug 283108 for details and some info on what to use instead.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.