summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--webkit/build/WebCore/WebCore.vcproj44
-rw-r--r--webkit/build/port/port.vcproj8
-rw-r--r--webkit/port/DerivedSources.make11
-rw-r--r--webkit/port/bindings/scripts/CodeGeneratorV8.pm6
-rw-r--r--webkit/port/bindings/v8/v8_collection.h94
-rw-r--r--webkit/port/bindings/v8/v8_custom.cpp13
-rw-r--r--webkit/port/bindings/v8/v8_custom.h6
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp44
-rw-r--r--webkit/port/bridge/chromium/PluginsChromium.cpp3
-rw-r--r--webkit/port/page/Navigator.cpp79
-rw-r--r--webkit/port/page/Navigator.h274
-rw-r--r--webkit/port/page/Navigator.idl63
-rw-r--r--webkit/port/plugins/chromium/PluginDataChromium.cpp25
14 files changed, 537 insertions, 135 deletions
diff --git a/DEPS b/DEPS
index 562c3ca..b23cb26 100644
--- a/DEPS
+++ b/DEPS
@@ -12,7 +12,7 @@ deps = {
"http://googletest.googlecode.com/svn/trunk@63",
"src/third_party/WebKit":
- "/trunk/deps/third_party/WebKit@3611",
+ "/trunk/deps/third_party/WebKit@3593",
"src/third_party/cygwin":
"/trunk/deps/third_party/cygwin@3248",
diff --git a/webkit/build/WebCore/WebCore.vcproj b/webkit/build/WebCore/WebCore.vcproj
index 7a41044..fb61b6b 100644
--- a/webkit/build/WebCore/WebCore.vcproj
+++ b/webkit/build/WebCore/WebCore.vcproj
@@ -369,14 +369,6 @@
RelativePath="..\..\..\third_party\WebKit\WebCore\page\MouseEventWithHitTestResults.h"
>
</File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\page\Navigator.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\page\Navigator.h"
- >
- </File>
<File
RelativePath="..\..\..\third_party\WebKit\WebCore\page\Page.cpp"
>
@@ -394,6 +386,10 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\page\Plugin.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebCore\page\Screen.cpp"
>
</File>
@@ -5990,42 +5986,10 @@
Name="plugins"
>
<File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\MimeType.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\MimeType.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\MimeTypeArray.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\MimeTypeArray.h"
- >
- </File>
- <File
RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\npfunctions.h"
>
</File>
<File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\Plugin.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\Plugin.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\PluginArray.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\PluginArray.h"
- >
- </File>
- <File
RelativePath="..\..\..\third_party\WebKit\WebCore\plugins\PluginData.cpp"
>
</File>
diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj
index 6be5a6a..a4e0856 100644
--- a/webkit/build/port/port.vcproj
+++ b/webkit/build/port/port.vcproj
@@ -168,6 +168,14 @@
>
</File>
<File
+ RelativePath="..\..\port\page\Navigator.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\port\page\Navigator.h"
+ >
+ </File>
+ <File
RelativePath="..\..\port\dom\ScheduledAction.h"
>
</File>
diff --git a/webkit/port/DerivedSources.make b/webkit/port/DerivedSources.make
index f0a0dad..ea2e50f 100644
--- a/webkit/port/DerivedSources.make
+++ b/webkit/port/DerivedSources.make
@@ -43,7 +43,6 @@ VPATH = \
$(WebCore)/dom \
$(WebCore)/html \
$(WebCore)/page \
- $(WebCore)/plugins \
$(WebCore)/storage \
$(WebCore)/xml \
$(WebCore)/svg \
@@ -922,10 +921,6 @@ all : \
V8InspectorController.h \
V8Location.h \
V8Navigator.h \
- V8MimeType.h \
- V8MimeTypeArray.h \
- V8Plugin.h \
- V8PluginArray.h \
V8RGBColor.h \
V8SVGAnimatedPoints.h \
V8SVGURIReference.h \
@@ -1134,7 +1129,7 @@ OBJC_BINDINGS_SCRIPTS = \
#
DOM%.h : %.idl $(OBJC_BINDINGS_SCRIPTS) $(PUBLICDOMINTERFACES)
- perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC --include dom --include html --include css --include page --include xml --include svg --include bindings/js --include plugins --outputdir . $<
+ perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_OBJECTIVE_C" --generator ObjC --include dom --include html --include css --include page --include xml --include svg --include bindings/js --outputdir . $<
# new-style JavaScript bindings
@@ -1147,7 +1142,7 @@ JS_BINDINGS_SCRIPTS = \
#
JS%.h : %.idl $(JS_BINDINGS_SCRIPTS)
- perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --include css --include page --include xml --include svg --include bindings/js --include plugins --outputdir . $<
+ perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --include css --include page --include xml --include svg --include bindings/js --outputdir . $<
# new-style V8 bindings
@@ -1165,5 +1160,5 @@ V8%.h : %.idl $(V8_SCRIPTS)
rm -f $@; \
for i in 1 2 3 4 5 6 7 8 9 10; do \
if test -e $@; then break; fi; \
- perl -w -I $(PORTROOT)/bindings/scripts -I $(WebCore)/bindings/scripts $(PORTROOT)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT V8_BINDING" --generator V8 --include ../../../webkit/pending --include ../../../webkit/port/dom --include ../../../webkit/port/html --include ../../../webkit/port/page --include ../../../webkit/port/xml --include svg --include dom --include html --include css --include page --include xml --include plugins --outputdir . $< ; \
+ perl -w -I $(PORTROOT)/bindings/scripts -I $(WebCore)/bindings/scripts $(PORTROOT)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT V8_BINDING" --generator V8 --include ../../../webkit/pending --include ../../../webkit/port/dom --include ../../../webkit/port/html --include ../../../webkit/port/page --include ../../../webkit/port/xml --include svg --include dom --include html --include css --include page --include xml --outputdir . $< ; \
done
diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm
index 2121862..81391b9 100644
--- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm
+++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm
@@ -225,6 +225,10 @@ sub GetImplementationFileName
my $iface = shift;
return "HTMLCollection.h" if $iface eq "UndetectableHTMLCollection";
return "HTMLInputElement.h" if $iface eq "HTMLSelectionInputElement";
+ return "Navigator.h" if $iface eq "MimeType";
+ return "Navigator.h" if $iface eq "MimeTypeArray";
+ return "Navigator.h" if $iface eq "Plugin";
+ return "Navigator.h" if $iface eq "PluginArray";
return "Event.h" if $iface eq "DOMTimeStamp";
return "NamedAttrMap.h" if $iface eq "NamedNodeMap";
return "NameNodeList.h" if $iface eq "NodeList";
@@ -1429,13 +1433,11 @@ sub IsRefPtrType
return 1 if $type eq "HTMLElement";
return 1 if $type eq "HTMLOptionsCollection";
return 1 if $type eq "ImageData";
- return 1 if $type eq "MimeType";
return 1 if $type eq "Node";
return 1 if $type eq "NodeList";
return 1 if $type eq "NodeFilter";
return 1 if $type eq "NodeIterator";
return 1 if $type eq "NSResolver";
- return 1 if $type eq "Plugin";
return 1 if $type eq "ProcessingInstruction";
return 1 if $type eq "Range";
return 1 if $type eq "Text";
diff --git a/webkit/port/bindings/v8/v8_collection.h b/webkit/port/bindings/v8/v8_collection.h
index 775de86..c468a0e 100644
--- a/webkit/port/bindings/v8/v8_collection.h
+++ b/webkit/port/bindings/v8/v8_collection.h
@@ -12,7 +12,7 @@
namespace WebCore {
// Returns named property of a collection.
-template <class C, class D>
+template <class C>
static v8::Handle<v8::Value> GetNamedPropertyOfCollection(
v8::Local<v8::String> name,
v8::Local<v8::Object> object,
@@ -23,19 +23,7 @@ static v8::Handle<v8::Value> GetNamedPropertyOfCollection(
ASSERT(t != V8ClassIndex::NODE);
C* collection = V8Proxy::ToNativeObject<C>(t, object);
String prop_name = ToWebCoreString(name);
- return GetV8Object<D>(collection->namedItem(prop_name), data);
-}
-
-template <class D>
-static v8::Handle<v8::Value> GetV8Object(
- PassRefPtr<D> result,
- v8::Local<v8::Value> data) {
- return GetV8Object(result.get(), data);
-}
-
-static v8::Handle<v8::Value> GetV8Object(
- void * result,
- v8::Local<v8::Value> data) {
+ void* result = collection->namedItem(prop_name);
if (!result) return v8::Handle<v8::Value>();
V8ClassIndex::V8WrapperType type = V8ClassIndex::ToWrapperType(data);
if (type == V8ClassIndex::NODE)
@@ -45,10 +33,10 @@ static v8::Handle<v8::Value> GetV8Object(
}
// A template of named property accessor of collections.
-template <class C, class D>
+template <class C>
static v8::Handle<v8::Value> CollectionNamedPropertyGetter(
v8::Local<v8::String> name, const v8::AccessorInfo& info) {
- return GetNamedPropertyOfCollection<C, D>(name, info.Holder(), info.Data());
+ return GetNamedPropertyOfCollection<C>(name, info.Holder(), info.Data());
}
@@ -62,12 +50,34 @@ static v8::Handle<v8::Value> NodeCollectionNamedPropertyGetter(
C* collection = V8Proxy::DOMWrapperToNode<C>(info.Holder());
String prop_name = ToWebCoreString(name);
void* result = collection->namedItem(prop_name);
- return GetV8Object(result, info.Data());
+ if (!result) return v8::Handle<v8::Value>();
+ V8ClassIndex::V8WrapperType type = V8ClassIndex::ToWrapperType(info.Data());
+ if (type == V8ClassIndex::NODE)
+ return V8Proxy::NodeToV8Object(static_cast<Node*>(result));
+ else
+ return V8Proxy::ToV8Object(type, result);
+}
+
+
+// A template returns whether a collection has a named property.
+// This function does not cause JS heap allocation.
+template <class C>
+static bool HasNamedPropertyOfCollection(v8::Local<v8::String> name,
+ v8::Local<v8::Object> object,
+ v8::Local<v8::Value> data) {
+ // TODO: assert object is a collection type
+ ASSERT(V8Proxy::MaybeDOMWrapper(object));
+
+ V8ClassIndex::V8WrapperType t = V8Proxy::GetDOMWrapperType(object);
+ C* collection = V8Proxy::ToNativeObject<C>(t, object);
+ String prop_name = ToWebCoreString(name);
+ void* result = collection->namedItem(prop_name);
+ return result != NULL;
}
// Returns the property at the index of a collection.
-template <class C, class D>
+template <class C>
static v8::Handle<v8::Value> GetIndexedPropertyOfCollection(
uint32_t index, v8::Local<v8::Object> object, v8::Local<v8::Value> data) {
// TODO, assert that object must be a collection type
@@ -75,15 +85,21 @@ static v8::Handle<v8::Value> GetIndexedPropertyOfCollection(
V8ClassIndex::V8WrapperType t = V8Proxy::GetDOMWrapperType(object);
ASSERT(t != V8ClassIndex::NODE);
C* collection = V8Proxy::ToNativeObject<C>(t, object);
- return GetV8Object<D>(collection->item(index), data);
+ void* result = collection->item(index);
+ if (!result) return v8::Handle<v8::Value>();
+ V8ClassIndex::V8WrapperType type = V8ClassIndex::ToWrapperType(data);
+ if (type == V8ClassIndex::NODE)
+ return V8Proxy::NodeToV8Object(static_cast<Node*>(result));
+ else
+ return V8Proxy::ToV8Object(type, result);
}
// A template of index interceptor of collections.
-template <class C, class D>
+template <class C>
static v8::Handle<v8::Value> CollectionIndexedPropertyGetter(
uint32_t index, const v8::AccessorInfo& info) {
- return GetIndexedPropertyOfCollection<C, D>(index, info.Holder(), info.Data());
+ return GetIndexedPropertyOfCollection<C>(index, info.Holder(), info.Data());
}
@@ -95,7 +111,12 @@ static v8::Handle<v8::Value> NodeCollectionIndexedPropertyGetter(
ASSERT(V8Proxy::GetDOMWrapperType(info.Holder()) == V8ClassIndex::NODE);
C* collection = V8Proxy::DOMWrapperToNode<C>(info.Holder());
void* result = collection->item(index);
- return GetV8Object(result, info.Data());
+ if (!result) return v8::Handle<v8::Value>();
+ V8ClassIndex::V8WrapperType type = V8ClassIndex::ToWrapperType(info.Data());
+ if (type == V8ClassIndex::NODE)
+ return V8Proxy::NodeToV8Object(static_cast<Node*>(result));
+ else
+ return V8Proxy::ToV8Object(type, result);
}
@@ -137,6 +158,21 @@ static v8::Handle<v8::Array> CollectionIndexedPropertyEnumerator(
}
+// Returns whether a collection has a property at a given index.
+// This function does not cause JS heap allocation.
+template <class C>
+static bool HasIndexedPropertyOfCollection(uint32_t index,
+ v8::Local<v8::Object> object,
+ v8::Local<v8::Value> data) {
+ // TODO, assert that object must be a collection type
+ ASSERT(V8Proxy::MaybeDOMWrapper(object));
+ V8ClassIndex::V8WrapperType t = V8Proxy::GetDOMWrapperType(object);
+ C* collection = V8Proxy::ToNativeObject<C>(t, object);
+ void* result = collection->item(index);
+ return result != NULL;
+}
+
+
// A template for indexed getters on collections of strings that should return
// null if the resulting string is a null string.
template <class C>
@@ -152,11 +188,11 @@ static v8::Handle<v8::Value> CollectionStringOrNullIndexedPropertyGetter(
// Add indexed getter to the function template for a collection.
-template <class T, class D>
+template <class T>
static void SetCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc,
V8ClassIndex::V8WrapperType type) {
desc->InstanceTemplate()->SetIndexedPropertyHandler(
- CollectionIndexedPropertyGetter<T, D>,
+ CollectionIndexedPropertyGetter<T>,
0,
0,
0,
@@ -166,11 +202,11 @@ static void SetCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc,
// Add named getter to the function template for a collection.
-template <class T, class D>
+template <class T>
static void SetCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc,
V8ClassIndex::V8WrapperType type) {
desc->InstanceTemplate()->SetNamedPropertyHandler(
- CollectionNamedPropertyGetter<T, D>,
+ CollectionNamedPropertyGetter<T>,
0,
0,
0,
@@ -180,21 +216,21 @@ static void SetCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc,
// Add named and indexed getters to the function template for a collection.
-template <class T, class D>
+template <class T>
static void SetCollectionIndexedAndNamedGetters(
v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type) {
// If we interceptor before object, accessing 'length' can trigger
// a webkit assertion error.
// (see fast/dom/HTMLDocument/document-special-properties.html
desc->InstanceTemplate()->SetNamedPropertyHandler(
- CollectionNamedPropertyGetter<T, D>,
+ CollectionNamedPropertyGetter<T>,
0,
0,
0,
0,
v8::External::New(reinterpret_cast<void*>(type)));
desc->InstanceTemplate()->SetIndexedPropertyHandler(
- CollectionIndexedPropertyGetter<T, D>,
+ CollectionIndexedPropertyGetter<T>,
0,
0,
0,
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp
index 0904839..1d36ccc 100644
--- a/webkit/port/bindings/v8/v8_custom.cpp
+++ b/webkit/port/bindings/v8/v8_custom.cpp
@@ -114,8 +114,6 @@
#include "SVGPathSeg.h"
#endif
-#include "Navigator.h"
-
#undef LOG
#include "webkit/glue/webplugin_impl.h"
@@ -3147,17 +3145,6 @@ CALLBACK_FUNC_DECL(EventTargetNodeRemoveEventListener) {
}
-// Navigator ------------------------------------------------------------------
-ACCESSOR_GETTER(NavigatorAppVersion) {
- INC_STATS(L"DOM.Navigator.appVersion");
- v8::Handle<v8::Object> holder = info.Holder();
- Navigator* imp = V8Proxy::ToNativeObject<Navigator>(V8ClassIndex::NAVIGATOR,
- holder);
- String v = ToString(imp->appVersion());
- return v8StringOrUndefined(v);
-}
-
-
// TreeWalker ------------------------------------------------------------------
CALLBACK_FUNC_DECL(TreeWalkerParentNode) {
diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h
index 302b80a..101a1a5 100644
--- a/webkit/port/bindings/v8/v8_custom.h
+++ b/webkit/port/bindings/v8/v8_custom.h
@@ -279,12 +279,6 @@ DECLARE_CALLBACK(ElementSetAttributeNodeNS)
DECLARE_CALLBACK(EventTargetNodeAddEventListener)
DECLARE_CALLBACK(EventTargetNodeRemoveEventListener)
-// Custom implementation is Navigator properties.
-// We actually only need this because WebKit has
-// navigator.appVersion as custom. Our version just
-// passes through.
-DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion)
-
// Custom implementation of XMLHttpRequest properties
DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort)
DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror)
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp
index 81df91f..bc8f183 100644
--- a/webkit/port/bindings/v8/v8_proxy.cpp
+++ b/webkit/port/bindings/v8/v8_proxy.cpp
@@ -73,24 +73,20 @@
#include "EventTarget.h"
#include "Event.h"
#include "HTMLInputElement.h"
+#include "XMLHttpRequest.h"
+#include "StyleSheet.h"
+#include "StyleSheetList.h"
#include "CSSRule.h"
#include "CSSRuleList.h"
#include "CSSValueList.h"
#include "CSSVariablesDeclaration.h"
#include "FrameLoader.h"
#include "FrameTree.h"
-#include "MimeTypeArray.h"
-#include "NodeFilter.h"
-#include "Plugin.h"
-#include "PluginArray.h"
#include "RangeException.h"
#include "ScriptController.h"
+#include "NodeFilter.h"
#include "SecurityOrigin.h"
-#include "Settings.h"
-#include "StyleSheet.h"
-#include "StyleSheetList.h"
#include "WebKitCSSTransformValue.h"
-#include "XMLHttpRequest.h"
#include "XMLHttpRequestException.h"
#include "XPathException.h"
@@ -1127,13 +1123,10 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
SetCollectionStringOrNullIndexedGetter<CSSStyleDeclaration>(desc);
break;
case V8ClassIndex::CSSRULELIST:
- SetCollectionIndexedGetter<CSSRuleList, CSSRule>(desc,
- V8ClassIndex::CSSRULE);
+ SetCollectionIndexedGetter<CSSRuleList>(desc, V8ClassIndex::CSSRULE);
break;
case V8ClassIndex::CSSVALUELIST:
- SetCollectionIndexedGetter<CSSValueList, CSSValue>(
- desc,
- V8ClassIndex::CSSVALUE);
+ SetCollectionIndexedGetter<CSSValueList>(desc, V8ClassIndex::CSSVALUE);
break;
case V8ClassIndex::CSSVARIABLESDECLARATION:
SetCollectionStringOrNullIndexedGetter<CSSVariablesDeclaration>(desc);
@@ -1145,13 +1138,10 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
USE_NAMED_PROPERTY_GETTER(HTMLCollection));
desc->InstanceTemplate()->SetCallAsFunctionHandler(
USE_CALLBACK(HTMLCollectionCallAsFunction));
- SetCollectionIndexedGetter<HTMLCollection, Node>(desc,
- V8ClassIndex::NODE);
+ SetCollectionIndexedGetter<HTMLCollection>(desc, V8ClassIndex::NODE);
break;
case V8ClassIndex::HTMLOPTIONSCOLLECTION:
- SetCollectionNamedGetter<HTMLOptionsCollection, Node>(
- desc,
- V8ClassIndex::NODE);
+ SetCollectionNamedGetter<HTMLOptionsCollection>(desc, V8ClassIndex::NODE);
desc->InstanceTemplate()->SetIndexedPropertyHandler(
USE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection),
USE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection));
@@ -1261,7 +1251,7 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
SetCollectionStringOrNullIndexedGetter<MediaList>(desc);
break;
case V8ClassIndex::MIMETYPEARRAY:
- SetCollectionIndexedAndNamedGetters<MimeTypeArray, MimeType>(
+ SetCollectionIndexedAndNamedGetters<MimeTypeArray>(
desc,
V8ClassIndex::MIMETYPE);
break;
@@ -1277,26 +1267,22 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate(
v8::External::New(reinterpret_cast<void*>(V8ClassIndex::NODE)));
break;
case V8ClassIndex::NODELIST:
- SetCollectionIndexedGetter<NodeList, Node>(desc, V8ClassIndex::NODE);
+ SetCollectionIndexedGetter<NodeList>(desc, V8ClassIndex::NODE);
desc->InstanceTemplate()->SetNamedPropertyHandler(
USE_NAMED_PROPERTY_GETTER(NodeList));
break;
case V8ClassIndex::PLUGIN:
- SetCollectionIndexedAndNamedGetters<Plugin, MimeType>(
- desc,
- V8ClassIndex::MIMETYPE);
+ SetCollectionIndexedAndNamedGetters<Plugin>(desc, V8ClassIndex::MIMETYPE);
break;
case V8ClassIndex::PLUGINARRAY:
- SetCollectionIndexedAndNamedGetters<PluginArray, Plugin>(
- desc,
- V8ClassIndex::PLUGIN);
+ SetCollectionIndexedAndNamedGetters<PluginArray>(desc,
+ V8ClassIndex::PLUGIN);
break;
case V8ClassIndex::STYLESHEETLIST:
desc->InstanceTemplate()->SetNamedPropertyHandler(
USE_NAMED_PROPERTY_GETTER(StyleSheetList));
- SetCollectionIndexedGetter<StyleSheetList, StyleSheet>(
- desc,
- V8ClassIndex::STYLESHEET);
+ SetCollectionIndexedGetter<StyleSheetList>(desc,
+ V8ClassIndex::STYLESHEET);
break;
case V8ClassIndex::DOMWINDOW: {
v8::Local<v8::Signature> default_signature = v8::Signature::New(desc);
diff --git a/webkit/port/bridge/chromium/PluginsChromium.cpp b/webkit/port/bridge/chromium/PluginsChromium.cpp
index eb6188d..ef7572a 100644
--- a/webkit/port/bridge/chromium/PluginsChromium.cpp
+++ b/webkit/port/bridge/chromium/PluginsChromium.cpp
@@ -35,7 +35,6 @@
#include "config.h"
-#include "PluginData.h"
#pragma warning(push, 0)
#include "PluginInfoStore.h"
#pragma warning(pop)
@@ -69,8 +68,6 @@ void LoadPlugins(bool refresh)
// deleting contents of the PluginInfo.
PluginInfo* PluginInfoStore::createPluginInfoForPluginAtIndex(unsigned int index)
{
- LoadPlugins(false);
-
WebCore::PluginInfo* rv = new WebCore::PluginInfo();
const WebPluginInfo& plugin = g_plugins[index];
rv->name = webkit_glue::StdWStringToString(plugin.name);
diff --git a/webkit/port/page/Navigator.cpp b/webkit/port/page/Navigator.cpp
new file mode 100644
index 0000000..4be2995
--- /dev/null
+++ b/webkit/port/page/Navigator.cpp
@@ -0,0 +1,79 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "Navigator.h"
+#include "PluginInfoStore.h"
+
+namespace WebCore {
+
+void PluginArray::refresh(bool reload) {
+ m_navigator->Refresh(reload);
+}
+
+Navigator::Navigator(Frame* frame) : m_frame(frame) {
+}
+
+Navigator::~Navigator() {
+}
+
+void Navigator::Initialize(bool refresh) {
+ if (!m_mimetypes)
+ m_mimetypes = new MimeTypeArray();
+ if (!m_plugins)
+ m_plugins = new PluginArray(this);
+
+ if (refresh)
+ WebCore::refreshPlugins(refresh);
+
+ PluginInfoStore c;
+ for (unsigned i = 0; i < c.pluginCount(); ++i) {
+ PluginInfo* info = c.createPluginInfoForPluginAtIndex(i);
+ if (info) {
+ Plugin* plugin = new Plugin(info);
+ m_plugins->Add(plugin);
+
+ for (unsigned j = 0; j < info->mimes.size(); ++j)
+ m_mimetypes->Add(new MimeType(info->mimes[j], plugin));
+ }
+ }
+}
+
+void Navigator::Refresh(bool reload) {
+ if (!m_frame) return;
+
+ if (m_mimetypes)
+ m_mimetypes->Clear();
+ if (m_plugins)
+ m_plugins->Clear();
+
+ Initialize(reload);
+}
+
+} // namespace WebCore
diff --git a/webkit/port/page/Navigator.h b/webkit/port/page/Navigator.h
new file mode 100644
index 0000000..b757cec
--- /dev/null
+++ b/webkit/port/page/Navigator.h
@@ -0,0 +1,274 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef Navigator_h
+#define Navigator_h
+
+#include "Language.h"
+#include "CookieJar.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "Document.h"
+#include "NetworkStateNotifier.h"
+#include "Settings.h"
+#include "PluginInfoStore.h"
+#include <wtf/RefCounted.h>
+
+// Navigator strings copied from KJS, must be updated whenever
+// Apple updated theirs.
+#ifndef WEBCORE_NAVIGATOR_PLATFORM
+#if PLATFORM(MAC) && PLATFORM(PPC)
+#define WEBCORE_NAVIGATOR_PLATFORM "MacPPC"
+#elif PLATFORM(MAC) && PLATFORM(X86)
+#define WEBCORE_NAVIGATOR_PLATFORM "MacIntel"
+#elif PLATFORM(WIN_OS)
+#define WEBCORE_NAVIGATOR_PLATFORM "Win32"
+#else
+#define WEBCORE_NAVIGATOR_PLATFORM ""
+#endif
+#endif // ifndef WEBCORE_NAVIGATOR_PLATFORM
+
+#ifndef WEBCORE_NAVIGATOR_PRODUCT
+#define WEBCORE_NAVIGATOR_PRODUCT "Gecko"
+#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT
+
+#ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
+#define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
+#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
+
+#ifndef WEBCORE_NAVIGATOR_VENDOR
+#define WEBCORE_NAVIGATOR_VENDOR "Apple Computer, Inc."
+#endif // ifndef WEBCORE_NAVIGATOR_VENDOR
+
+#ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
+#define WEBCORE_NAVIGATOR_VENDOR_SUB ""
+#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
+
+namespace WebCore {
+
+class Plugin;
+class Navigator;
+
+// The following two classes (MimeType and Plugin) are wrappers around
+// MimeClassInfo and PluginInfo structs defined by WebKit. These are created
+// by PluginInfoStore::createPluginInfoForPluginAtIndex and are responsible
+// for cleaning up *info objects on deletion. The cleanup for MimeClassInfo
+// as well as PluginInfo is done by Plugin wrapper because each Plugin has its
+// own list of supported mime_types that should not be needed once the plugin
+// is gone.
+class MimeType : public RefCounted<MimeType> {
+ public:
+ explicit MimeType(MimeClassInfo* info, Plugin* plugin)
+ : m_info(info), m_plugin(plugin) { }
+
+ String description() const { return m_info->desc; }
+ Plugin* enabledPlugin() const { return m_plugin; }
+ String suffixes() const { return m_info->suffixes; }
+ String type() const { return m_info->type; }
+ private:
+ MimeClassInfo* m_info;
+ Plugin* m_plugin;
+};
+
+class Plugin : public RefCounted<Plugin> {
+ public:
+ explicit Plugin(PluginInfo* info) : m_info(info) {
+ }
+ ~Plugin() {
+ if (m_info) {
+ for (size_t i = 0; i < m_info->mimes.size(); i++) {
+ if (m_info->mimes[i]) {
+ delete m_info->mimes[i];
+ m_info->mimes[i] = NULL;
+ }
+ }
+ delete m_info;
+ m_info = NULL;
+ }
+ }
+ String description() const { return m_info->desc; }
+ String filename() const { return m_info->file; }
+ String name() const { return m_info->name; }
+ int length() const { return m_info->mimes.size(); }
+
+ MimeType* item(int index) {
+ if (index >= 0 && index < length())
+ return new MimeType(m_info->mimes[index], this);
+ return NULL;
+ }
+
+ MimeType* namedItem(const String& name) {
+ for (int i = 0; i < length(); ++i) {
+ MimeClassInfo* m = m_info->mimes[i];
+ if (m->type == name)
+ return new MimeType(m, this);
+ }
+ return NULL;
+ }
+ private:
+ PluginInfo* m_info;
+};
+
+
+template<class T>
+class ArrayOf {
+ public:
+ ~ArrayOf() {
+ // release contents
+ Clear();
+ }
+
+ int length() const {
+ return m_contents.size();
+ }
+
+ T* item(int index) {
+ if (index >= 0 && index < length())
+ return m_contents[index];
+ return NULL;
+ }
+
+ protected:
+ Vector<T*> m_contents;
+
+ private:
+ void Add(T* el) {
+ el->ref();
+ m_contents.append(el);
+ }
+
+ void Clear() {
+ while (m_contents.size() > 0) {
+ m_contents[0]->deref();
+ m_contents.remove(0);
+ }
+ }
+
+ friend class Navigator;
+};
+
+class MimeTypeArray : public ArrayOf<MimeType>,
+ public RefCounted<MimeTypeArray> {
+ public:
+ MimeType* namedItem(const String& name) {
+ for (int i = 0; i < length(); ++i) {
+ if (m_contents[i]->type() == name)
+ return m_contents[i];
+ }
+ return NULL;
+ }
+};
+
+class PluginArray : public ArrayOf<Plugin>, public RefCounted<PluginArray> {
+ public:
+ explicit PluginArray(Navigator* nav) : m_navigator(nav) { }
+ Plugin* namedItem(const String& name) {
+ for (int i = 0; i < length(); ++i) {
+ if (m_contents[i]->name() == name)
+ return m_contents[i];
+ }
+ return NULL;
+ }
+
+ void refresh(bool reloadDocuments);
+ private:
+ Navigator* m_navigator;
+};
+
+class Navigator : public RefCounted<Navigator> {
+ public:
+ static PassRefPtr<Navigator> create(Frame* frame)
+ {
+ return adoptRef(new Navigator(frame));
+ }
+ ~Navigator();
+ String appCodeName() const { return "Mozilla"; }
+ String appName() const { return "Netscape"; }
+
+ String appVersion() const {
+ if (!m_frame)
+ return String();
+
+ KURL url;
+ if (m_frame->document()) {
+ url = m_frame->document()->url();
+ }
+ const String user_agent = m_frame->loader()->userAgent(url);
+ return user_agent.substring(user_agent.find('/') + 1);
+ }
+ String language() { return defaultLanguage(); }
+
+ MimeTypeArray* mimeTypes() {
+ if (!m_frame)
+ return NULL;
+
+ if (!m_mimetypes)
+ Initialize(false);
+ return m_mimetypes.get();
+ }
+ String platform() const { return WEBCORE_NAVIGATOR_PLATFORM; }
+ String vendor() const { return WEBCORE_NAVIGATOR_VENDOR; }
+ String vendorSub() const { return WEBCORE_NAVIGATOR_VENDOR_SUB; }
+ String product() const { return WEBCORE_NAVIGATOR_PRODUCT; }
+ String productSub() const { return WEBCORE_NAVIGATOR_PRODUCT_SUB; }
+
+ PluginArray* plugins() {
+ if (!m_frame)
+ return NULL;
+
+ if (!m_plugins)
+ Initialize(false);
+ return m_plugins.get();
+ }
+
+ String userAgent() const {
+ if (!m_frame)
+ return String();
+
+ KURL url;
+ if (m_frame->document()) {
+ url = m_frame->document()->url();
+ }
+ return m_frame->loader()->userAgent(url);
+ }
+
+ bool cookieEnabled() {
+ if (!m_frame)
+ return false;
+
+ return cookiesEnabled(m_frame->document());
+ }
+
+ bool javaEnabled() {
+ if (!m_frame)
+ return false;
+
+ return m_frame->settings()->isJavaEnabled();
+ }
+
+ bool onLine() const {
+ return networkStateNotifier().onLine();
+ }
+
+ Frame* frame() { return m_frame; }
+
+ void disconnectFrame() { m_frame = NULL; }
+
+ private:
+ Navigator(Frame* frame);
+
+ Frame* m_frame;
+ RefPtr<MimeTypeArray> m_mimetypes;
+ RefPtr<PluginArray> m_plugins;
+
+ void Initialize(bool refresh);
+
+ friend class PluginArray; // need to call Refresh
+ void Refresh(bool reload);
+};
+
+} // namespace WebCore
+
+#endif
+
diff --git a/webkit/port/page/Navigator.idl b/webkit/port/page/Navigator.idl
new file mode 100644
index 0000000..6ed8243
--- /dev/null
+++ b/webkit/port/page/Navigator.idl
@@ -0,0 +1,63 @@
+// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+module core {
+#if defined(V8_BINDING)
+// V8 specific
+interface Navigator {
+ readonly attribute DOMString appCodeName;
+ readonly attribute DOMString appName;
+ readonly attribute DOMString appVersion;
+ readonly attribute DOMString language;
+ readonly attribute MimeTypeArray mimeTypes;
+ readonly attribute DOMString platform;
+// readonly attribute DOMString oscpu;
+ readonly attribute DOMString vendor;
+ readonly attribute DOMString vendorSub;
+ readonly attribute DOMString product;
+ readonly attribute DOMString productSub;
+ readonly attribute PluginArray plugins;
+// readonly attribute DOMString securityPolicy;
+ readonly attribute DOMString userAgent;
+ readonly attribute boolean cookieEnabled;
+ readonly attribute boolean onLine;
+// readonly attribute DOMString buildID;
+
+ boolean javaEnabled();
+// boolean taintEnabled();
+};
+
+interface MimeType {
+ readonly attribute DOMString description;
+ readonly attribute Plugin enabledPlugin;
+ readonly attribute DOMString suffixes;
+ readonly attribute DOMString type;
+};
+
+interface Plugin {
+ readonly attribute DOMString description;
+ readonly attribute DOMString filename;
+ readonly attribute DOMString name;
+
+ readonly attribute unsigned long length;
+ MimeType item(in unsigned long index);
+ MimeType namedItem(in DOMString name);
+};
+
+interface MimeTypeArray {
+ readonly attribute unsigned long length;
+ MimeType item(in unsigned long index);
+ MimeType namedItem(in DOMString name);
+};
+
+interface PluginArray {
+ readonly attribute unsigned long length;
+ Plugin item(in unsigned long index);
+ Plugin namedItem(in DOMString name);
+ void refresh(in boolean reloadDocuments);
+};
+
+#endif // V8_BINDING
+
+} // module
diff --git a/webkit/port/plugins/chromium/PluginDataChromium.cpp b/webkit/port/plugins/chromium/PluginDataChromium.cpp
index 7670e22..c289464 100644
--- a/webkit/port/plugins/chromium/PluginDataChromium.cpp
+++ b/webkit/port/plugins/chromium/PluginDataChromium.cpp
@@ -5,8 +5,6 @@
#include "config.h"
#include "PluginData.h"
-#include "PluginInfoStore.h"
-
#undef LOG
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webkit_glue.h"
@@ -22,9 +20,28 @@ void PluginData::initPlugins()
return;
refreshData = false;
- PluginInfoStore c;
for (size_t i = 0; i < plugins.size(); ++i) {
- PluginInfo* info = c.createPluginInfoForPluginAtIndex(i);
+ const WebPluginInfo& sourceInfo = plugins[i];
+
+ PluginInfo* info = new PluginInfo;
+ info->name = webkit_glue::StdWStringToString(sourceInfo.name);
+ info->file = webkit_glue::StdWStringToString(sourceInfo.file);
+ info->desc = webkit_glue::StdWStringToString(sourceInfo.desc);
+
+ for (size_t j = 0; j < sourceInfo.mime_types.size(); ++j) {
+ const WebPluginMimeType& mimeType = sourceInfo.mime_types[j];
+
+ MimeClassInfo* mime = new MimeClassInfo;
+ mime->type = webkit_glue::StdStringToString(mimeType.mime_type);
+ mime->desc = webkit_glue::StdWStringToString(mimeType.description);
+
+ for (size_t k = 0; k < mimeType.file_extensions.size(); ++k) {
+ if (k > 0)
+ mime->suffixes += ",";
+ mime->suffixes += webkit_glue::StdStringToString(mimeType.file_extensions[k]);
+ }
+ info->mimes.append(mime);
+ }
m_plugins.append(info);
}
}