RESOLVED FIXED42587
Handle NP_ASFILE and NP_ASFILEONLY transfer modes
https://bugs.webkit.org/show_bug.cgi?id=42587
Summary Handle NP_ASFILE and NP_ASFILEONLY transfer modes
Anders Carlsson
Reported 2010-07-19 12:57:58 PDT
Handle NP_ASFILE and NP_ASFILEONLY transfer modes
Attachments
Patch (15.49 KB, patch)
2010-07-19 13:04 PDT, Anders Carlsson
darin: review+
Anders Carlsson
Comment 1 2010-07-19 13:04:40 PDT
WebKit Review Bot
Comment 2 2010-07-19 13:06:58 PDT
Attachment 61984 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1 WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h:71: NPP_StreamAsFile is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp:193: NetscapePlugin::NPP_StreamAsFile is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 2 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3 2010-07-19 13:28:40 PDT
Comment on attachment 61984 [details] Patch > + return CString(temporaryFilePath.data()); Does the CString constructor really require a vector that already has the '\0' in it? Or does this code end up adding two of them? > + void NPP_StreamAsFile(NPStream* stream, const char* filename); Leave out the "stream" argument name? > + RefPtr<PluginView::Stream> stream = m_streams.get(streamID).get(); Here inside the class we can just call it Stream instead of PluginView::Stream.
Anders Carlsson
Comment 4 2010-07-19 13:41:24 PDT
(In reply to comment #3) > (From update of attachment 61984 [details]) > > + return CString(temporaryFilePath.data()); > > Does the CString constructor really require a vector that already has the '\0' in it? Or does this code end up adding two of them? > The constructor that takes a const char* requires it to be null terminated. The constructor that takes a length still adds a null terminator.
Adam Roben (:aroben)
Comment 5 2010-07-19 14:21:21 PDT
Comment on attachment 61984 [details] Patch > + // NPP_StreamAsFile could call NPN_DestroyStream and destroy the stream. > + if (!m_isStarted) > + return; > + return; > + } Does this really do what you want?
Darin Adler
Comment 6 2010-07-19 14:23:06 PDT
(In reply to comment #5) > (From update of attachment 61984 [details]) > > + // NPP_StreamAsFile could call NPN_DestroyStream and destroy the stream. > > + if (!m_isStarted) > > + return; > > + return; > > + } > > Does this really do what you want? Uh oh! I’m sure that at least one test will fail because of this!!!
mitz
Comment 7 2010-07-19 15:30:38 PDT
Comment on attachment 61984 [details] Patch > --- a/WebCore/WebCore.xcodeproj/project.pbxproj > +++ b/WebCore/WebCore.xcodeproj/project.pbxproj Not mentioned in the change log. > +#import <wtf/text/CString.h> > #import "PlatformString.h" Not in ASCII order. > + // We failed to open the file, stop the stream. > + if (m_fileHandle == invalidPlatformFileHandle) > + stop(NPRES_NETWORK_ERR); Is it safer to return here? > + if (!m_isStarted) > + return; > + return; Too many of something.
Sam Weinig
Comment 8 2010-07-19 15:40:59 PDT
Comment on attachment 61984 [details] Patch What everyone else said. r=me too!
Anders Carlsson
Comment 9 2010-07-19 18:20:47 PDT
Note You need to log in before you can comment on or make changes to this bug.