Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (136931 => 136932)
--- trunk/Source/WebCore/CMakeLists.txt 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-12-07 08:43:32 UTC (rev 136932)
@@ -2066,6 +2066,7 @@
plugins/DOMMimeType.cpp
plugins/DOMPluginArray.cpp
plugins/DOMPlugin.cpp
+ plugins/PlugInOriginHash.cpp
plugins/PluginData.cpp
plugins/PluginMainThreadScheduler.cpp
Modified: trunk/Source/WebCore/ChangeLog (136931 => 136932)
--- trunk/Source/WebCore/ChangeLog 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/ChangeLog 2012-12-07 08:43:32 UTC (rev 136932)
@@ -1,3 +1,28 @@
+2012-12-04 Jon Lee <jon...@apple.com>
+
+ Add PlugInOriginHash
+ https://bugs.webkit.org/show_bug.cgi?id=103655
+ <rdar://problem/12778949>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add the concept of plug-in origin hashes, which are based on a combination of the base domains of the
+ page's main frame and the plug-in, and the plug-in MIME type.
+
+ * plugins/PlugInOriginHash.cpp: Added.
+ (WebCore::addCaseFoldedCharacters): Add the case-folded string to the hash.
+ (WebCore::PlugInOriginHash::hash): The hash is based on the concatenation of the page's host, the plug-in
+ URL's host, and the MIME type. We use StringHasher to get all 32-bits of the hash, since using StringImpl's hash
+ masks out 8 of the hash bits to make room for bit flags.
+ * plugins/PlugInOriginHash.h: Added.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+
2012-12-06 Kent Tamura <tk...@chromium.org>
Refactoring: Clean up placeholder attribute usage
Modified: trunk/Source/WebCore/GNUmakefile.list.am (136931 => 136932)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-12-07 08:43:32 UTC (rev 136932)
@@ -4180,6 +4180,8 @@
Source/WebCore/plugins/DOMPlugin.h \
Source/WebCore/plugins/npapi.cpp \
Source/WebCore/plugins/npfunctions.h \
+ Source/WebCore/plugins/PlugInOriginHash.cpp \
+ Source/WebCore/plugins/PlugInOriginHash.h \
Source/WebCore/plugins/PluginDatabase.cpp \
Source/WebCore/plugins/PluginDatabase.h \
Source/WebCore/plugins/PluginData.cpp \
Modified: trunk/Source/WebCore/Target.pri (136931 => 136932)
--- trunk/Source/WebCore/Target.pri 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/Target.pri 2012-12-07 08:43:32 UTC (rev 136932)
@@ -939,6 +939,7 @@
plugins/PluginMainThreadScheduler.cpp \
plugins/DOMMimeType.cpp \
plugins/DOMMimeTypeArray.cpp \
+ plugins/PlugInOriginHash.cpp \
platform/animation/Animation.cpp \
platform/animation/AnimationList.cpp \
platform/Arena.cpp \
@@ -2342,6 +2343,7 @@
plugins/PluginDebug.h \
plugins/DOMPlugin.h \
plugins/IFrameShimSupport.h \
+ plugins/PlugInOriginHash.h \
plugins/PluginMainThreadScheduler.h \
plugins/PluginPackage.h \
plugins/PluginStream.h \
Modified: trunk/Source/WebCore/WebCore.gypi (136931 => 136932)
--- trunk/Source/WebCore/WebCore.gypi 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/WebCore.gypi 2012-12-07 08:43:32 UTC (rev 136932)
@@ -2187,6 +2187,8 @@
'plugins/DOMPluginArray.h',
'plugins/IFrameShimSupport.cpp',
'plugins/IFrameShimSupport.h',
+ 'plugins/PlugInOriginHash.cpp',
+ 'plugins/PlugInOriginHash.h',
'plugins/PluginData.cpp',
'plugins/PluginDataNone.cpp',
'plugins/PluginDatabase.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (136931 => 136932)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-12-07 08:43:32 UTC (rev 136932)
@@ -72750,6 +72750,14 @@
>
</File>
<File
+ RelativePath="..\plugins\PlugInOriginHash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\plugins\PlugInOriginHash.h"
+ >
+ </File>
+ <File
RelativePath="..\plugins\PluginData.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (136931 => 136932)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-07 08:25:49 UTC (rev 136931)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-12-07 08:43:32 UTC (rev 136932)
@@ -949,6 +949,8 @@
31C0FF4C0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */; };
31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */; };
31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; };
+ 31D591BB166C2E6C00E6BF02 /* PlugInOriginHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31D591B9166C2E6C00E6BF02 /* PlugInOriginHash.cpp */; };
+ 31D591BC166C2E6C00E6BF02 /* PlugInOriginHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D591BA166C2E6C00E6BF02 /* PlugInOriginHash.h */; settings = {ATTRIBUTES = (); }; };
31EC1E2814FF60EE00C94662 /* JSNotificationPermissionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31EC1E2614FF60EE00C94662 /* JSNotificationPermissionCallback.cpp */; };
31EC1E2914FF60EE00C94662 /* JSNotificationPermissionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 31EC1E2714FF60EE00C94662 /* JSNotificationPermissionCallback.h */; };
31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A4F120A5D0600DC02A0 /* DeviceMotionClient.h */; };
@@ -8145,6 +8147,8 @@
31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEvent.h; sourceTree = "<group>"; };
31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; };
31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; };
+ 31D591B9166C2E6C00E6BF02 /* PlugInOriginHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlugInOriginHash.cpp; sourceTree = "<group>"; };
+ 31D591BA166C2E6C00E6BF02 /* PlugInOriginHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInOriginHash.h; sourceTree = "<group>"; };
31E8D8BA160BC94B004CE8F5 /* RenderSnapshottedPlugIn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSnapshottedPlugIn.cpp; sourceTree = "<group>"; };
31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSnapshottedPlugIn.h; sourceTree = "<group>"; };
31EC1D5014FEFD0800C94662 /* NotificationPermissionCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NotificationPermissionCallback.idl; path = Modules/notifications/NotificationPermissionCallback.idl; sourceTree = "<group>"; };
@@ -15669,6 +15673,8 @@
A9C6E4F20D745E48006442E9 /* PluginData.h */,
1ADA140E0E1AE5D900023EE5 /* PluginMainThreadScheduler.cpp */,
1ADA140F0E1AE5D900023EE5 /* PluginMainThreadScheduler.h */,
+ 31D591B9166C2E6C00E6BF02 /* PlugInOriginHash.cpp */,
+ 31D591BA166C2E6C00E6BF02 /* PlugInOriginHash.h */,
1AA8798F11CBE846003C664F /* PluginStrategy.h */,
0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */,
76FF17E211235673001D61B5 /* PluginViewNone.cpp */,
@@ -25889,6 +25895,7 @@
DEBCCDD416646EAF00A452E1 /* MediaControlElementTypes.h in Headers */,
D66817FB166FE6D700FA07B4 /* HTMLTemplateElement.h in Headers */,
D6489D26166FFCF1007C031B /* JSHTMLTemplateElement.h in Headers */,
+ 31D591BC166C2E6C00E6BF02 /* PlugInOriginHash.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -28999,6 +29006,7 @@
D66817FA166FE6D700FA07B4 /* HTMLTemplateElement.cpp in Sources */,
D6489D25166FFCF1007C031B /* JSHTMLTemplateElement.cpp in Sources */,
D6F7960D166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp in Sources */,
+ 31D591BB166C2E6C00E6BF02 /* PlugInOriginHash.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Source/WebCore/plugins/PlugInOriginHash.cpp (0 => 136932)
--- trunk/Source/WebCore/plugins/PlugInOriginHash.cpp (rev 0)
+++ trunk/Source/WebCore/plugins/PlugInOriginHash.cpp 2012-12-07 08:43:32 UTC (rev 136932)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "PlugInOriginHash.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "HTMLPlugInImageElement.h"
+#include "KURL.h"
+#include "Logging.h"
+#include "Page.h"
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+static inline void addCaseFoldedCharacters(StringHasher& hasher, const String& string)
+{
+ if (string.is8Bit())
+ return hasher.addCharacters<LChar, CaseFoldingHash::foldCase<LChar> >(string.characters8(), string.length());
+ return hasher.addCharacters<UChar, CaseFoldingHash::foldCase<UChar> >(string.characters16(), string.length());
+}
+
+unsigned PlugInOriginHash::hash(HTMLPlugInImageElement* plugInElement, const KURL& plugInURL)
+{
+ ASSERT(document()->page());
+
+ // We want to avoid concatenating the strings and then taking the hash, since that could lead to an expensive conversion.
+ // We also want to avoid using the hash() function in StringImpl or CaseFoldingHash because that masks out bits for the use of flags.
+ StringHasher hasher;
+ addCaseFoldedCharacters(hasher, plugInElement->document()->page()->mainFrame()->document()->baseURL().host());
+ hasher.addCharacter(0);
+ addCaseFoldedCharacters(hasher, plugInURL.host());
+ hasher.addCharacter(0);
+ addCaseFoldedCharacters(hasher, plugInElement->serviceType());
+ LOG(Plugins, "Hash: %s %s %s", plugInElement->document()->page()->mainFrame()->document()->baseURL().host().utf8().data(), plugInURL.host().utf8().data(), plugInElement->serviceType().utf8().data());
+ return hasher.hash();
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/plugins/PlugInOriginHash.h (0 => 136932)
--- trunk/Source/WebCore/plugins/PlugInOriginHash.h (rev 0)
+++ trunk/Source/WebCore/plugins/PlugInOriginHash.h 2012-12-07 08:43:32 UTC (rev 136932)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+ */
+
+#ifndef PlugInOriginHash_h
+#define PlugInOriginHash_h
+
+namespace WebCore {
+
+class HTMLPlugInImageElement;
+class KURL;
+
+struct PlugInOriginHash {
+ static unsigned hash(HTMLPlugInImageElement*, const KURL&);
+};
+
+} // namespace WebCore
+
+#endif /* PlugInOriginHash_h */