Last Comment Bug 638367 - [Firefox 4] [NPAPI plugins] NPN_GetURLNotify does not call NPP_URLNotify if notifyData is null
: [Firefox 4] [NPAPI plugins] NPN_GetURLNotify does not call NPP_URLNotify if n...
Status: NEW
: regression
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: x86 Linux
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-02 22:54 PST by Andrey Terentyev
Modified: 2011-03-03 13:42 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Simple NPAPI plugin that calls NPN_GetURLNotify and prints to standard output whether NPP_URLNotify is called or not (100.00 KB, application/octet-stream)
2011-03-02 22:58 PST, Andrey Terentyev
no flags Details
Simple plugin that demonstrates the issue (100.00 KB, application/octet-stream)
2011-03-03 10:33 PST, Andrey Terentyev
no flags Details

Description Andrey Terentyev 2011-03-02 22:54:20 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110218 Firefox/3.6.14
Build Identifier: Firefox 4.0b12

On Firefox 4, NPN_GetURLNotify does not call NPP_URLNotify

It does this on Firefox 3.6

Reproducible: Always

Steps to Reproduce:
1. Use a plugin that calls NPN_GetURLNotify with a NULL target
Comment 1 Andrey Terentyev 2011-03-02 22:58:55 PST
Created attachment 516519 [details]
Simple NPAPI plugin that calls NPN_GetURLNotify and prints to standard output whether NPP_URLNotify is called or not

This is a simple NPAPI plugin based on mozilla code (http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/).

It issues a call to NPN_GetURLNotify( "http://google.com" ) and does printf() inside NPP_NewStream, NPP_DestroyStream and NPP_URLNotify

Under Firefox 3 you see all 3 calls. On Firefox 4, NPP_URLNotify is not called.

You need to run Firefox in console to see the printf's.
Comment 2 Andrey Terentyev 2011-03-02 23:01:31 PST
This issue is also reproducible on Windows.
Comment 3 Benjamin Smedberg [:bsmedberg] 2011-03-03 08:58:09 PST
What are you passing for the notifyData void*? I believe we changed our behavior so that we don't notify if you pass a null pointer as notifyData...
Comment 4 Andrey Terentyev 2011-03-03 10:25:41 PST
Exactly! I'm calling NPN_GetURLNotify(mInstance, "http://google.com", NULL, NULL)

I have just tried specifying the notifyData (e.g. NPN_GetURLNotify(mInstance, "http://google.com", NULL, (void*)mInstance) ) and this works!
Comment 5 Andrey Terentyev 2011-03-03 10:33:50 PST
Created attachment 516639 [details]
Simple plugin that demonstrates the issue

First attachment had a buggy Makefile (it does not define XP_UNIX, and such plugin does not work)
Comment 6 Benjamin Smedberg [:bsmedberg] 2011-03-03 10:35:31 PST
I believe that Josh made this change intentionally, but I'll let him close this WONTFIX if so when he gets back from vacation.
Comment 7 Josh Aas 2011-03-03 13:04:08 PST
I don't have time at the moment to look into this (I think it was intentional, as Benjamin said), but my advice would be to not pass NULL for notifyData if you want notifications. The browser doesn't deref that pointer value, it's just a unique identifier which you can use to reference your own stream data if you want. Technically you can pass whatever you want so long as it is unique to a stream - it doesn't have to be an actual memory address. You could just pass 0x1 if you only ever had one stream active at a time, for example.
Comment 8 Andrey Terentyev 2011-03-03 13:42:34 PST
Thanks Josh. That's exactly what I was going to use - just a dummy address like 0x1.

I have just put a warning into these wiki pages about current behavior:
https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/URLs
https://developer.mozilla.org/en/NPN_GetURLNotify

Note You need to log in before you can comment on or make changes to this bug.