Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: third_party/WebKit/Source/core/html/HTMLObjectElement.cpp

Issue 2933213002: Revert of Move ObjectContentType entirely to HTMLPlugInElement (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
index 2f34c6721fbc50b2efbd784de3f2a755100e74ec..8c1b6ddc052e35a535c7560bb82f73fc3891fd53 100644
--- a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
@@ -148,8 +148,11 @@
// TODO(schenney): crbug.com/572908 This function should not deal with url or
// serviceType!
void HTMLObjectElement::ParametersForPlugin(Vector<String>& param_names,
- Vector<String>& param_values) {
+ Vector<String>& param_values,
+ String& url,
+ String& service_type) {
HashSet<StringImpl*, CaseFoldingHash> unique_param_names;
+ String url_parameter;
// Scan the PARAM children and store their name/value pairs.
// Get the URL and type from the params if we don't already have them.
@@ -165,23 +168,33 @@
// TODO(schenney): crbug.com/572908 url adjustment does not belong in this
// function.
- // 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 plugin.
- if (url_.IsEmpty() && (DeprecatedEqualIgnoringCase(name, "src") ||
- DeprecatedEqualIgnoringCase(name, "movie") ||
- DeprecatedEqualIgnoringCase(name, "code") ||
- DeprecatedEqualIgnoringCase(name, "url"))) {
- url_ = StripLeadingAndTrailingHTMLSpaces(p->Value());
- }
+ if (url.IsEmpty() && url_parameter.IsEmpty() &&
+ (DeprecatedEqualIgnoringCase(name, "src") ||
+ DeprecatedEqualIgnoringCase(name, "movie") ||
+ DeprecatedEqualIgnoringCase(name, "code") ||
+ DeprecatedEqualIgnoringCase(name, "url")))
+ url_parameter = StripLeadingAndTrailingHTMLSpaces(p->Value());
// TODO(schenney): crbug.com/572908 serviceType calculation does not belong
// in this function.
- if (service_type_.IsEmpty() && DeprecatedEqualIgnoringCase(name, "type")) {
- size_t pos = p->Value().Find(";");
+ if (service_type.IsEmpty() && DeprecatedEqualIgnoringCase(name, "type")) {
+ service_type = p->Value();
+ size_t pos = service_type.Find(";");
if (pos != kNotFound)
- service_type_ = p->Value().GetString().Left(pos);
+ service_type = service_type.Left(pos);
}
+ }
+
+ // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE
+ // attribute in the tag points to the Java plugin itself (an ActiveX
+ // component) while the actual applet CODEBASE is in a PARAM tag. See
+ // <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means we
+ // have to explicitly suppress the tag's CODEBASE attribute if there is none
+ // in a PARAM, else our Java plugin will misinterpret it. [4004531]
+ String codebase;
+ if (MIMETypeRegistry::IsJavaAppletMIMEType(service_type)) {
+ codebase = "codebase";
+ unique_param_names.insert(
+ codebase.Impl()); // pretend we found it in a PARAM already
}
// Turn the attributes of the <object> element into arrays, but don't override
@@ -196,6 +209,17 @@
}
MapDataParamToSrc(&param_names, &param_values);
+
+ // 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 plugin.
+ if (url.IsEmpty() && !url_parameter.IsEmpty()) {
+ KURL completed_url = GetDocument().CompleteURL(url_parameter);
+ bool use_fallback;
+ if (ShouldUsePlugin(completed_url, service_type, false, use_fallback))
+ url = url_parameter;
+ }
}
bool HTMLObjectElement::HasFallbackContent() const {
@@ -268,14 +292,17 @@
return;
}
+ String url = this->Url();
+ String service_type = service_type_;
+
// TODO(schenney): crbug.com/572908 These should be joined into a
// PluginParameters class.
Vector<String> param_names;
Vector<String> param_values;
- ParametersForPlugin(param_names, param_values);
+ ParametersForPlugin(param_names, param_values, url, service_type);
// Note: url is modified above by parametersForPlugin.
- if (!AllowedToLoadFrameURL(url_)) {
+ if (!AllowedToLoadFrameURL(url)) {
DispatchErrorEvent();
return;
}
@@ -290,12 +317,13 @@
GetDocument().GetFrame()->Loader().Client()->OverrideFlashEmbedWithHTML(
GetDocument().CompleteURL(url_));
if (!overriden_url.IsEmpty()) {
- url_ = overriden_url.GetString();
- service_type_ = "text/html";
- }
-
- if (!HasValidClassId() || !RequestObject(param_names, param_values)) {
- if (!url_.IsEmpty())
+ url = url_ = overriden_url.GetString();
+ service_type = service_type_ = "text/html";
+ }
+
+ if (!HasValidClassId() ||
+ !RequestObject(url, service_type, param_names, param_values)) {
+ if (!url.IsEmpty())
DispatchErrorEvent();
if (HasFallbackContent())
RenderFallbackContent();
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLObjectElement.h ('k') | third_party/WebKit/Source/core/html/HTMLPlugInElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698