summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-28 00:58:32 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-28 00:58:32 +0000
commit3131a289c0edff9d58da46cae16beae6bd6c0650 (patch)
tree1604f160750d771ed32a21097d1f0c7e3e00f620
parent87fde4a19ca045af34cc2582b405449541b2b0ca (diff)
downloadchromium_src-3131a289c0edff9d58da46cae16beae6bd6c0650.zip
chromium_src-3131a289c0edff9d58da46cae16beae6bd6c0650.tar.gz
chromium_src-3131a289c0edff9d58da46cae16beae6bd6c0650.tar.bz2
Workaround for webkit change that broke Gears. The fix is to use a V8
extension to inject a getter into every page which loads the gears plugin when accessed. BUG=http://code.google.com/p/chromium/issues/detail?id=8209 Review URL: http://codereview.chromium.org/27294 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10663 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/build/V8Bindings/SConscript1
-rw-r--r--webkit/build/V8Bindings/V8Bindings.vcproj136
-rwxr-xr-xwebkit/port/bindings/v8/extensions/Gears.cpp45
-rwxr-xr-xwebkit/port/bindings/v8/extensions/Gears.h24
-rw-r--r--webkit/port/bindings/v8/v8_proxy.cpp2
-rw-r--r--webkit/webkit.gyp2
-rw-r--r--webkit/webkit.xcodeproj/project.pbxproj6
7 files changed, 152 insertions, 64 deletions
diff --git a/webkit/build/V8Bindings/SConscript b/webkit/build/V8Bindings/SConscript
index 9e444985..6f8be2e 100644
--- a/webkit/build/V8Bindings/SConscript
+++ b/webkit/build/V8Bindings/SConscript
@@ -350,6 +350,7 @@ inputs = [
'$PORT_DIR/bindings/v8/WorkerContextExecutionProxy.cpp',
'$PORT_DIR/bindings/v8/WorkerScriptController.cpp',
'$PORT_DIR/bindings/v8/extensions/GCController.cpp',
+ '$PORT_DIR/bindings/v8/extensions/Gears.cpp',
'$PORT_DIR/bindings/v8/extensions/Interval.cpp',
'$PORT_DIR/bindings/v8/extensions/Playback.cpp',
diff --git a/webkit/build/V8Bindings/V8Bindings.vcproj b/webkit/build/V8Bindings/V8Bindings.vcproj
index ae90fac..91eddb8 100644
--- a/webkit/build/V8Bindings/V8Bindings.vcproj
+++ b/webkit/build/V8Bindings/V8Bindings.vcproj
@@ -127,70 +127,70 @@
<Filter
Name="custom"
>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8CustomBinding.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8CustomEventListener.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8DOMWindowCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLCollectionCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLFormElementCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLInputElementCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLOptionsCollectionCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLPlugInElementCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLSelectElementCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLSelectElementCustom.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8LocationCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8NamedNodesCollection.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8NamedNodesCollection.h"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGElementInstanceCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGLengthCustom.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGMatrixCustom.cpp"
- >
- </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8CustomBinding.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8CustomEventListener.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8DOMWindowCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLCollectionCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLFormElementCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLInputElementCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLOptionsCollectionCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLPlugInElementCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLSelectElementCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8HTMLSelectElementCustom.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8LocationCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8NamedNodesCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8NamedNodesCollection.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGElementInstanceCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGLengthCustom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\bindings\v8\custom\V8SVGMatrixCustom.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="DerivedSources"
@@ -2576,6 +2576,14 @@
>
</File>
<File
+ RelativePath="..\..\port\bindings\v8\extensions\Gears.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\port\bindings\v8\extensions\Gears.h"
+ >
+ </File>
+ <File
RelativePath="..\..\port\bindings\v8\extensions\Interval.cpp"
>
</File>
diff --git a/webkit/port/bindings/v8/extensions/Gears.cpp b/webkit/port/bindings/v8/extensions/Gears.cpp
new file mode 100755
index 0000000..54787a8
--- /dev/null
+++ b/webkit/port/bindings/v8/extensions/Gears.cpp
@@ -0,0 +1,45 @@
+// Copyright (c) 2006-2009 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.
+
+#include "config.h"
+#include "Gears.h"
+
+namespace WebCore {
+
+const char* kGearsExtensionName = "v8/Gears";
+
+// Note: when a page touches the "google.gears.factory" object, this script
+// touches the DOM. We expect the DOM to be available at that time.
+const char* kGearsExtensionScript =
+ "var google;"
+ "if (!google)"
+ " google = {};"
+ "if (!google.gears)"
+ " google.gears = {};"
+ "(function() {"
+ " var factory = null;"
+ " google.gears.__defineGetter__('factory', function() {"
+ " if (!factory) {"
+ " factory = document.createElement('object');"
+ " factory.width = 0;"
+ " factory.height = 0;"
+ " factory.style.visibility = 'hidden';"
+ " factory.type = 'application/x-googlegears';"
+ " document.documentElement.appendChild(factory);"
+ " }"
+ " return factory;"
+ " });"
+ "})();";
+
+class GearsExtensionWrapper : public v8::Extension {
+public:
+ GearsExtensionWrapper() :
+ v8::Extension(kGearsExtensionName, kGearsExtensionScript) {}
+};
+
+v8::Extension* GearsExtension::Get() {
+ return new GearsExtensionWrapper();
+}
+
+}
diff --git a/webkit/port/bindings/v8/extensions/Gears.h b/webkit/port/bindings/v8/extensions/Gears.h
new file mode 100755
index 0000000..4e6c07d
--- /dev/null
+++ b/webkit/port/bindings/v8/extensions/Gears.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2006-2009 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.
+
+// The GearsExtension is a v8 extension to add a "google.gears.factory" getter
+// on the page, which, when accessed, lazily inserts the gears plugin into
+// the page and attaches it to the factory variable.
+
+#ifndef GEARS_EXTENSION_H__
+#define GEARS_EXTENSION_H__
+
+#include "v8.h"
+
+namespace WebCore {
+
+class GearsExtension {
+ public:
+ static v8::Extension* Get();
+};
+
+}
+
+#endif // GEARS_EXTENSION_H__
+
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp
index 56f62e6..20c6ccf 100644
--- a/webkit/port/bindings/v8/v8_proxy.cpp
+++ b/webkit/port/bindings/v8/v8_proxy.cpp
@@ -206,6 +206,7 @@
#endif
#include "extensions/GCController.h"
+#include "extensions/Gears.h"
#include "extensions/Interval.h"
#include "extensions/Playback.h"
@@ -2323,6 +2324,7 @@ void V8Proxy::InitContextIfNeeded()
v8::V8::SetFailedAccessCheckCallbackFunction(ReportUnsafeJavaScriptAccess);
// Register known extensions
+ RegisterExtension(GearsExtension::Get());
RegisterExtension(IntervalExtension::Get());
if (ScriptController::shouldExposeGCController())
RegisterExtension(GCExtension::Get());
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 252779c..dc3915c 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -1016,6 +1016,8 @@
'../third_party/WebKit/WebCore/bindings/v8/V8Proxy.h',
'port/bindings/v8/extensions/GCController.cpp',
'port/bindings/v8/extensions/GCController.h',
+ 'port/bindings/v8/extensions/Gears.cpp',
+ 'port/bindings/v8/extensions/Gears.h',
'port/bindings/v8/extensions/Interval.cpp',
'port/bindings/v8/extensions/Interval.h',
'port/bindings/v8/extensions/Playback.cpp',
diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj
index aca31ff..3784613 100644
--- a/webkit/webkit.xcodeproj/project.pbxproj
+++ b/webkit/webkit.xcodeproj/project.pbxproj
@@ -1333,6 +1333,7 @@
ABF923090F3A388C009B64EC /* webplugin_delegate_impl_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825405ED0D92E3FF0006B936 /* webplugin_delegate_impl_mac.cc */; };
B26072924B6C110181ECF928 /* webplugin_delegate.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1459AC310DEBF6A597167F45 /* webplugin_delegate.cc */; };
B5B0D6890EC91D3D00EA3314 /* autofill_form.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5B0D6880EC91D3D00EA3314 /* autofill_form.cc */; };
+ CC188E0A792C13D2A53C8FD6 /* Gears.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20EE9F2D403A8BC28297DD27 /* Gears.cpp */; };
E40054A70E9BC4C20055B38E /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40054A60E9BC4C20055B38E /* RefCountedLeakCounter.cpp */; };
E40054B10E9BCC5C0055B38E /* CollatorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40054B00E9BCC5C0055B38E /* CollatorICU.cpp */; };
E40060DB0EA69E0B0055B38E /* ScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E40060DA0EA69E0B0055B38E /* ScriptController.cpp */; };
@@ -1540,6 +1541,7 @@
181A25BB0F57EFCE00939C89 /* V8WebKitPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8WebKitPoint.cpp; sourceTree = "<group>"; };
181A25BC0F57EFCE00939C89 /* V8WebKitPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V8WebKitPoint.h; sourceTree = "<group>"; };
1DF458E80DD265C670E05B03 /* RenderSelectionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSelectionInfo.h; sourceTree = "<group>"; };
+ 20EE9F2D403A8BC28297DD27 /* Gears.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gears.cpp; path = port/bindings/v8/extensions/Gears.cpp; sourceTree = SOURCE_ROOT; };
20EF92D9CD4E55999674A63E /* CurrentTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurrentTime.h; sourceTree = "<group>"; };
31493A4FA536C112F8C2FB03 /* PNGImageEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PNGImageEncoder.cpp; path = "../third_party/WebKit/WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp"; sourceTree = SOURCE_ROOT; };
31C1FF1C3BB820B928CFE9BD /* V8DOMWindowCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8DOMWindowCustom.cpp; sourceTree = "<group>"; };
@@ -4105,6 +4107,7 @@
89F4A0D30F200D59000A326A /* V8CanvasPixelArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8CanvasPixelArray.cpp; sourceTree = "<group>"; };
89F4A0D40F200D59000A326A /* V8CanvasPixelArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = V8CanvasPixelArray.h; sourceTree = "<group>"; };
89F4A1FC0F2101F8000A326A /* V8CanvasPixelArrayCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = V8CanvasPixelArrayCustom.cpp; sourceTree = "<group>"; };
+ 8CF41B1A2D4E8F64A2C5C3F6 /* Gears.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gears.h; path = port/bindings/v8/extensions/Gears.h; sourceTree = SOURCE_ROOT; };
934CC0030EBFE0E000A658F2 /* chromium_bridge_impl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chromium_bridge_impl.cc; sourceTree = "<group>"; };
934CC2270EDCC37600A658F2 /* RGBColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RGBColor.cpp; sourceTree = "<group>"; };
934CC2290EDCC38400A658F2 /* RGBColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RGBColor.h; sourceTree = "<group>"; };
@@ -4858,6 +4861,8 @@
4CDA86D8A0B62BD0EBF07D78 /* AnimationControllerPrivate.h */,
7FF1567A8464BD6DC36B47CD /* MainThreadChromium.cpp */,
31493A4FA536C112F8C2FB03 /* PNGImageEncoder.cpp */,
+ 20EE9F2D403A8BC28297DD27 /* Gears.cpp */,
+ 8CF41B1A2D4E8F64A2C5C3F6 /* Gears.h */,
);
sourceTree = "<group>";
};
@@ -9813,6 +9818,7 @@
buildActionMask = 2147483647;
files = (
A5779DD6BC0DA17AB7DE63D4 /* GCController.cpp in Sources */,
+ CC188E0A792C13D2A53C8FD6 /* Gears.cpp in Sources */,
E4E4C94A0E797648009A687C /* ImageSourceCG.cpp in Sources */,
453FFDF935221CD484A3AFED /* Interval.cpp in Sources */,
3C9197C6A7DABB989CBDBF81 /* Playback.cpp in Sources */,