Closed Bug 879503 Opened 11 years ago Closed 11 years ago

NPP_StreamAsFile return wrong path

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: tuan_b918, Unassigned)

Details

I have a plug-in that render and display document after download. But after updating to Firefox 20 or later, the plug-in no longer works.

With our plug-in we used NPP_NewStream and set NPMIMEType as NP_ASFILE. For some reason, on Firefox 20 or later, NPP_StreamAsFile return an incorrect path (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\plugtmp-2\plugin-svrel.zhp). Firefox 19 or later return with the correct pathname (:\Documents and Settings\Administrator\Local Settings\Application Data\Mozilla\Firefox\Profiles\jpgiohcq.default\Cache\1\78\87C58d01)
Should be Firefox 19 or older works.
What's the definition of "wrong"? AFAICT NPAPI doesn't guarantee anything about the location of the file.
Flags: needinfo?(tuan_b918)
My question is why does NPP_StreamAsFile return different path on version 19 & 20?
Flags: needinfo?(tuan_b918)
We no longer use our in-path file, because of changes in our cache implementation. Does the file you now receive have the correct contents?
Sorry, "in-cache".
The contents of the file is still correct. 

On Firefox 20, after the content gets download to the plugin path, it's move to the cache location. But because NPP_StreamAsFile state the file locates at the plugin path, our plugin no longer can find the file.
The file passed to NPP_StreamAsFile is only valid until NPP_DestroyStream is called. If you need the file contents for a longer period, you are responsible for copying the file/data somewhere else.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Anyway I can get the cache file location after it move to cache path? Process Monitor shows the file location, and I validate that the contents are correct.
No. You should not be depending on the structure nor lifetime of our cache, and any code which did this in the past was probably subject to race conditions when files were evicted from the cache.
Thank you Benjamin for your replies.

Has it always been the plugin responsible for handling the content after it gets download to a temp location? Our plugin code hasn't changed for many years. We have been depending on the browser to provide us where the file gets downloaded. Just curious if our design need to be revised.
Yes, that has always been the case. It just happens that in many cases we handed you the path of the cache file, which tends to stay around for a while. But that was never guaranteed and is likely to have caused random errors in the past if the disk cache was near capacity.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.