NPP_StreamAsFile return wrong path

RESOLVED INVALID

Status

()

Core
Plug-ins
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: tuan_b918, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
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)
(Reporter)

Comment 1

5 years ago
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)
(Reporter)

Comment 3

5 years ago
My question is why does NPP_StreamAsFile return different path on version 19 & 20?
Flags: needinfo?(tuan_b918)

Comment 4

5 years ago
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?

Comment 5

5 years ago
Sorry, "in-cache".
(Reporter)

Comment 6

5 years ago
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.

Comment 7

5 years ago
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
Last Resolved: 5 years ago
Resolution: --- → INVALID
(Reporter)

Comment 8

5 years ago
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.

Comment 9

5 years ago
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.
(Reporter)

Comment 10

5 years ago
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.

Comment 11

5 years ago
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.
You need to log in before you can comment on or make changes to this bug.