Bug 32572

Summary: [Qt] Cannot load flash files from a local file.
Product: WebKit Reporter: Yael <yael>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hausmann, webkit.review.bot
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch.
none
Patch.
kenneth: review+
New patch to reduce nesting. none

Description Yael 2009-12-15 12:51:15 PST
swf files that are loaded from the local file system have their mime type set to application/octet-stream. This prevents identifying the file as flash file.
The same problem can be observed in Safari, but not in Chrome.
Patch will follow soon.
Comment 1 Yael 2009-12-15 12:58:17 PST
Created attachment 44901 [details]
Patch.
Comment 2 WebKit Review Bot 2009-12-15 13:00:19 PST
style-queue ran check-webkit-style on attachment 44901 [details] without any errors.
Comment 3 Yael 2009-12-15 13:24:20 PST
Created attachment 44903 [details]
Patch.

Separate the new code into its own method, as suggested by Kenneth.
Comment 4 WebKit Review Bot 2009-12-15 13:26:09 PST
style-queue ran check-webkit-style on attachment 44903 [details] without any errors.
Comment 5 Kenneth Rohde Christiansen 2009-12-15 13:49:52 PST
Comment on attachment 44903 [details]
Patch.

When landing consider the below comments

> +        void substituteMIMETypeFromPluginDatabase(const ResourceResponse& r);\

Remove the 'r' variable


> +#if PLATFORM(QT)
> +void MainResourceLoader::substituteMIMETypeFromPluginDatabase(const ResourceResponse& r)
> +{
> +    if (m_frame->settings()->arePluginsEnabled()) {
> +        String filename = r.url().lastPathComponent();
> +        if (!filename.endsWith("/")) {
> +            int extensionPos = filename.reverseFind('.');
> +            if (extensionPos != -1) {
> +                String extension = filename.substring(extensionPos + 1);
> +                String mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(extension);
> +                if (!mimeType.isEmpty()) {
> +                    ResourceResponse* response = const_cast<ResourceResponse*>(&r);
> +                    response->setMimeType(mimeType);
> +                }
> +            }
> +        }
> +    }
> +}
> +#endif

Reduce nesting by using early returns.
Comment 6 Yael 2009-12-15 13:51:26 PST
Created attachment 44907 [details]
New patch to reduce nesting.
Comment 7 WebKit Review Bot 2009-12-15 13:52:00 PST
style-queue ran check-webkit-style on attachment 44907 [details] without any errors.
Comment 8 WebKit Commit Bot 2009-12-15 14:07:58 PST
Comment on attachment 44907 [details]
New patch to reduce nesting.

Clearing flags on attachment: 44907

Committed r52172: <http://trac.webkit.org/changeset/52172>
Comment 9 WebKit Commit Bot 2009-12-15 14:08:12 PST
All reviewed patches have been landed.  Closing bug.