Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

[e10s] I want to get from nsIObserver->nsIHttpChannel->nsIDOMWindow->nsIDOMDocument. How can I do it?

  • 1 پاسخ
  • 1 has this problem
  • 8 views
  • آخرین پاسخ توسّط cor-el

more options

Hello! My addon worked on FF41. Now I want to migrate on e10s. Use Firefox developer edition v43.

The example observer (c++).

NS_IMETHODIMP CFFObserver::Observe( nsISupports* aSubject, const char* aTopic, const char16_t* aData ) { ......... if ( lstrcmpA( aTopic, "http-on-modify-request" ) == 0 ) { CFFObserver::onSending( aSubject ); } .......... } void CFFObserver::onSending( nsISupports* IHttpChannel ) { .............. nsISupports* IDOMWindowOwner = m_gate.Channel_GetOwnerWindow( IHttpChannel ); ................. }

The example JS helper.

Channel_GetOwnerWindow: function( objChannel ) // This option does not worked in v43[e10s]; { try { var notificationCallbacks = objChannel.QueryInterface(Components.interfaces.nsIHttpChannel).notificationCallbacks; if ( !notificationCallbacks ) { var loadGroup = objChannel.QueryInterface(Components.interfaces.nsIRequest).loadGroup.notificationCallbacks; if ( loadGroup ) notificationCallbacks = loadGroup.notificationCallbacks; } if ( notificationCallbacks ) { return notificationCallbacks .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow) .QueryInterface(Components.interfaces.nsISupports); } } catch ( err ) { this.ErrorOut( err ); } return null; }

Below code works but I cannot get document from getting nsIDOMWindow. Channel_GetOwnerWindow: function( objChannel ) { try { return objChannel.QueryInterface(Components.interfaces.nsIHttpChannel) .notificationCallbacks .getInterface(Components.interfaces.nsILoadContext).topFrameElement .QueryInterface(Components.interfaces.nsISupports); } catch ( err ) { this.ErrorOut( err ); } return null; }

Help me please resolve this problem. Thanks.

Hello! My addon worked on FF41. Now I want to migrate on e10s. Use Firefox developer edition v43. The example observer (c++). NS_IMETHODIMP CFFObserver::Observe( nsISupports* aSubject, const char* aTopic, const char16_t* aData ) { ......... if ( lstrcmpA( aTopic, "http-on-modify-request" ) == 0 ) { CFFObserver::onSending( aSubject ); } .......... } void CFFObserver::onSending( nsISupports* IHttpChannel ) { .............. nsISupports* IDOMWindowOwner = m_gate.Channel_GetOwnerWindow( IHttpChannel ); ................. } The example JS helper. Channel_GetOwnerWindow: function( objChannel ) // This option does not worked in v43[e10s]; { try { var notificationCallbacks = objChannel.QueryInterface(Components.interfaces.nsIHttpChannel).notificationCallbacks; if ( !notificationCallbacks ) { var loadGroup = objChannel.QueryInterface(Components.interfaces.nsIRequest).loadGroup.notificationCallbacks; if ( loadGroup ) notificationCallbacks = loadGroup.notificationCallbacks; } if ( notificationCallbacks ) { return notificationCallbacks .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow) .QueryInterface(Components.interfaces.nsISupports); } } catch ( err ) { this.ErrorOut( err ); } return null; } Below code works but I cannot get document from getting nsIDOMWindow. Channel_GetOwnerWindow: function( objChannel ) { try { return objChannel.QueryInterface(Components.interfaces.nsIHttpChannel) .notificationCallbacks .getInterface(Components.interfaces.nsILoadContext).topFrameElement .QueryInterface(Components.interfaces.nsISupports); } catch ( err ) { this.ErrorOut( err ); } return null; } Help me please resolve this problem. Thanks.

Modified by dlmr

All Replies (1)

more options