RESOLVED FIXED 45364
Fallback content should be rendered when an <object> doesn't specify a data, type or classid attribute.
https://bugs.webkit.org/show_bug.cgi?id=45364
Summary Fallback content should be rendered when an <object> doesn't specify a data, ...
Andy Estes
Reported 2010-09-07 20:00:30 PDT
Fallback content should be rendered when an <object> doesn't specify a data, type or classid attribute.
Attachments
Patch (12.60 KB, patch)
2010-09-07 20:23 PDT, Andy Estes
no flags
Patch (12.61 KB, patch)
2010-09-07 20:34 PDT, Andy Estes
no flags
Patch (13.23 KB, patch)
2010-09-07 23:59 PDT, Andy Estes
eric.carlson: review+
Andy Estes
Comment 1 2010-09-07 20:18:24 PDT
Andy Estes
Comment 2 2010-09-07 20:21:07 PDT
See comment #2 on https://bugs.webkit.org/show_bug.cgi?id=44933 for the rationale behind this fix.
Andy Estes
Comment 3 2010-09-07 20:23:29 PDT
WebKit Review Bot
Comment 4 2010-09-07 20:29:24 PDT
Attachment 66836 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1 WebCore/ChangeLog:8: Line contains tab character. [whitespace/tab] [5] LayoutTests/ChangeLog:8: Line contains tab character. [whitespace/tab] [5] Total errors found: 2 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Andy Estes
Comment 5 2010-09-07 20:34:27 PDT
Eric Carlson
Comment 6 2010-09-07 21:52:27 PDT
Comment on attachment 66836 [details] Patch > + Fallback content should be rendered when an <object> doesn't specify a > + data, type or classid attribute. > + https://bugs.webkit.org/show_bug.cgi?id=45364 > + <rdar://problem/8375816> > + > + HTML5 says that if no data or type attribute is specified on the <object>, > + fallback content should be rendered. However, WebKit has traditionally > + supported specifying a URL and MIME type in a <param> element. > + > + To more closely match the spec while maintaining compatibility, continue > + to load resources specified in <param> elements under a more limited set > + of circumstances: > + > + - MIME type is specified by a <param> named "type" or can be inferred > + from the extension of a URL specified in a param named "src", "movie", > + "code" or "url", and > + - resources of that MIME type will load in a plug-in. > + > + If these two conditions aren't met, and the <object> element has no > + "data" or "type" attribute, fallback content will be rendered. > + Otherwise, there is no change in behavior. > + > + * html/HTMLObjectElement.cpp: > + (WebCore::HTMLObjectElement::parametersForPlugin): > + (WebCore::HTMLObjectElement::updateWidget): > + * loader/SubframeLoader.cpp: > + (WebCore::SubframeLoader::resourceWillUsePlugin): > + * loader/SubframeLoader.h: > + The summary of what changed and why is great, but comments about what specifically changed in each function will be appreciated by someone that comes along later and tries to figure this out. > // FIXME: url adjustment does not belong in this function. > - if (url.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) > - url = deprecatedParseURL(p->value()); > + if (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url")) > + urlParam = deprecatedParseURL(p->value()); > // FIXME: serviceType calculation does not belong in this function. > if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { > serviceType = p->value(); 1) "urlParam" won't be used later in this function unless "url" is empty so you can skip all of the string comparisons and url parsing if url is non-empty. 2) The old code used the first non-empty url-equivalent param but this code uses the *last* non-empty param. Is this correct? The ChangeLog says: > - MIME type is specified by a <param> named "type" or can be inferred > from the extension of a URL specified in a param named "src", "movie", > "code" or "url", and Where is the type inferred from the url extension?
Andy Estes
Comment 7 2010-09-07 22:19:52 PDT
(In reply to comment #6) > (From update of attachment 66836 [details]) > > + Fallback content should be rendered when an <object> doesn't specify a > > + data, type or classid attribute. > > + https://bugs.webkit.org/show_bug.cgi?id=45364 > > + <rdar://problem/8375816> > > + > > + HTML5 says that if no data or type attribute is specified on the <object>, > > + fallback content should be rendered. However, WebKit has traditionally > > + supported specifying a URL and MIME type in a <param> element. > > + > > + To more closely match the spec while maintaining compatibility, continue > > + to load resources specified in <param> elements under a more limited set > > + of circumstances: > > + > > + - MIME type is specified by a <param> named "type" or can be inferred > > + from the extension of a URL specified in a param named "src", "movie", > > + "code" or "url", and > > + - resources of that MIME type will load in a plug-in. > > + > > + If these two conditions aren't met, and the <object> element has no > > + "data" or "type" attribute, fallback content will be rendered. > > + Otherwise, there is no change in behavior. > > + > > + * html/HTMLObjectElement.cpp: > > + (WebCore::HTMLObjectElement::parametersForPlugin): > > + (WebCore::HTMLObjectElement::updateWidget): > > + * loader/SubframeLoader.cpp: > > + (WebCore::SubframeLoader::resourceWillUsePlugin): > > + * loader/SubframeLoader.h: > > + > The summary of what changed and why is great, but comments about what specifically changed in each function will be appreciated by someone that comes along later and tries to figure this out. I'll add these comments. > > > > // FIXME: url adjustment does not belong in this function. > > - if (url.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) > > - url = deprecatedParseURL(p->value()); > > + if (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url")) > > + urlParam = deprecatedParseURL(p->value()); > > // FIXME: serviceType calculation does not belong in this function. > > if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { > > serviceType = p->value(); > 1) "urlParam" won't be used later in this function unless "url" is empty so you can skip all of the string comparisons and url parsing if url is non-empty. Good point. I'll add back the url.isEmpty() clause. > 2) The old code used the first non-empty url-equivalent param but this code uses the *last* non-empty param. Is this correct? That was an unintended change. I don't think there is anything that says what we should do here, but it's probably best not to change our old behavior without reason. I'll fix this. > > > The ChangeLog says: > > > - MIME type is specified by a <param> named "type" or can be inferred > > from the extension of a URL specified in a param named "src", "movie", > > "code" or "url", and > Where is the type inferred from the url extension? The Mac port does this in its implementation of FrameLoaderClient::objectContentType(), which gets eventually called by SubframeLoader::resourceWillUsePlugin(). I suppose I shouldn't assume that all ports do the same thing, though. Perhaps I should just rephrase the comment to say something more general like "if the MIME type can be determined from the information in the <param> elements." Thanks for the feedback! I'll post a new patch shortly.
Andy Estes
Comment 8 2010-09-07 23:59:49 PDT
Eric Carlson
Comment 9 2010-09-08 06:52:29 PDT
Comment on attachment 66850 [details] Patch > + // HTML5 says that an object resource's URL is specified by the object's data > + // attribute, not by a param element. However, for compatibility, allow the > + // resource's URL to be given by a param named "src", "movie", "code" or "url" > + // if we know that resource points to a plug-in. > + SubframeLoader* loader = document()->frame()->loader()->subframeLoader(); > + if (url.isEmpty() && loader->resourceWillUsePlugin(urlParam, serviceType)) > + url = urlParam; Minor nit, but you don't need the many dereferences to fetch "loader" unless url is empty. r=me
Andy Estes
Comment 10 2010-09-08 10:08:28 PDT
Note You need to log in before you can comment on or make changes to this bug.