NPAPI:HTTPRedirectHandling: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 15: Line 15:
= Specification =
= Specification =


Plugins can query for support for this specification using the following variable:
The following function can be implemented by plugins to allow for HTTP redirect handling:
 
  NPNVsupportsRedirectNotification = 22
 
The following function in the NPAPI plugin function table can be implemented to allow for HTTP redirect handling:


   int32 NPP_URLNotifyRedirect(NPP instance, const char* url,
   int32 NPP_URLNotifyRedirect(NPP instance, const char* url,
Line 29: Line 25:
* notifyData: the data passed into NPN_PostURLNotify() or NPN_GetURLNotify()
* notifyData: the data passed into NPN_PostURLNotify() or NPN_GetURLNotify()


Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed, and when this happens there may be further redirect notifications. Any other return value will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time)
The browser will look for this handler only if the plugin function structure's version field is set to the following value or higher:


The existence of a slot for this handler in the plugin's function table can be confirmed by querying the following version number:
  NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26


   NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26
The slot for this handler in the plugin function structure can be NULL.
 
Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed. There may be further redirect notifications when a redirect is allowed. Any return value other than "NPERR_NO_ERR" will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time)
 
Plugins can query the browser for support for this specification using the following variable:
 
   NPNVsupportsRedirectNotification = 22


The slot in the function table can be NULL, in which case the browser will not send redirect information. [What is the default behavior?]
If the browser returns "true" for this variable then plugins can depend on the browser calling the HTTP redirect handler when appropriate, if it is provided by the plugin.

Revision as of 06:27, 10 October 2010

Status

Under consideration.

Contributors

  • Last modified: October 8, 2010
  • Authors: Rudi Sherry (Adobe), Josh Aas (Mozilla)
  • Contributors: Darin Fisher (Google), Dimcho Balev (Adobe), Deneb Meketa (Adobe)

Overview

We need to allow plugins to participate in HTTP redirect handling.

Specification

The following function can be implemented by plugins to allow for HTTP redirect handling:

 int32 NPP_URLNotifyRedirect(NPP instance, const char* url,
                             int32 status, void* notifyData);
  • instance: the plug-in instance that made the request
  • url: the new redirected url
  • status: the status code returned from the server (will be 3xx)
  • notifyData: the data passed into NPN_PostURLNotify() or NPN_GetURLNotify()

The browser will look for this handler only if the plugin function structure's version field is set to the following value or higher:

 NPVERS_HAS_HTTP_REDIRECT_HANDLER = 26

The slot for this handler in the plugin function structure can be NULL.

Plugins should return "NPERR_NO_ERR" when the redirect is to be allowed. There may be further redirect notifications when a redirect is allowed. Any return value other than "NPERR_NO_ERR" will disallow the redirect and the browser will subsequently issue an "NPP_URLNotify" call with reason "NPRES_USER_BREAK" and the last redirected url (the same one passed to the NPP_URLNotifyRedirect the last time)

Plugins can query the browser for support for this specification using the following variable:

 NPNVsupportsRedirectNotification = 22

If the browser returns "true" for this variable then plugins can depend on the browser calling the HTTP redirect handler when appropriate, if it is provided by the plugin.