[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
tkent at chromium.org
tkent at chromium.org
Wed Dec 22 13:16:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c3bc3a5b6f7acaae11bc386d76bdc5ad2f61637c
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 10 05:10:22 2010 +0000
2010-09-09 Dominic Cooney <dominicc at google.com>
Reviewed by Kent Tamura.
Moves location.replace bindings logic into bindings/generic and
instantiates it for JSC and V8.
https://bugs.webkit.org/show_bug.cgi?id=44891
Covered by existing location.replace tests.
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcproj/WebCoreCommon.vsprops:
* WebCore.xcodeproj/project.pbxproj:
* bindings/generic/BindingDOMWindow.h:
* bindings/generic/BindingFrame.h: Added.
(WebCore::::navigateIfAllowed):
* bindings/generic/BindingLocation.h: Added.
(WebCore::::replace):
* bindings/generic/GenericBinding.h:
(WebCore::completeURL):
* bindings/js/JSBinding.h: Added.
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMBinding.cpp:
(WebCore::shouldAllowNavigation):
(WebCore::toLexicalFrame):
(WebCore::toDynamicFrame):
(WebCore::processingUserGesture):
(WebCore::completeURL):
* bindings/js/JSLocationCustom.cpp:
(WebCore::navigateIfAllowed):
(WebCore::JSLocation::replace):
* bindings/js/specialization/JSBindingState.cpp: Added.
(WebCore::::getActiveFrame):
(WebCore::::getFirstFrame):
(WebCore::::processingUserGesture):
(WebCore::::allowsAccessFromFrame):
* bindings/js/specialization/JSBindingState.h: Added.
* bindings/v8/V8Binding.h:
* bindings/v8/V8Utilities.cpp:
(WebCore::completeURL):
(WebCore::navigateIfAllowed):
* bindings/v8/custom/V8LocationCustom.cpp:
(WebCore::V8Location::replaceCallback):
* bindings/v8/specialization/V8BindingState.cpp:
(WebCore::::allowsAccessFromFrame):
* bindings/v8/specialization/V8BindingState.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1f3273c..0fb3ad2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,54 @@
+2010-09-09 Dominic Cooney <dominicc at google.com>
+
+ Reviewed by Kent Tamura.
+
+ Moves location.replace bindings logic into bindings/generic and
+ instantiates it for JSC and V8.
+
+ https://bugs.webkit.org/show_bug.cgi?id=44891
+
+ Covered by existing location.replace tests.
+
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.vcproj/WebCoreCommon.vsprops:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/generic/BindingDOMWindow.h:
+ * bindings/generic/BindingFrame.h: Added.
+ (WebCore::::navigateIfAllowed):
+ * bindings/generic/BindingLocation.h: Added.
+ (WebCore::::replace):
+ * bindings/generic/GenericBinding.h:
+ (WebCore::completeURL):
+ * bindings/js/JSBinding.h: Added.
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::shouldAllowNavigation):
+ (WebCore::toLexicalFrame):
+ (WebCore::toDynamicFrame):
+ (WebCore::processingUserGesture):
+ (WebCore::completeURL):
+ * bindings/js/JSLocationCustom.cpp:
+ (WebCore::navigateIfAllowed):
+ (WebCore::JSLocation::replace):
+ * bindings/js/specialization/JSBindingState.cpp: Added.
+ (WebCore::::getActiveFrame):
+ (WebCore::::getFirstFrame):
+ (WebCore::::processingUserGesture):
+ (WebCore::::allowsAccessFromFrame):
+ * bindings/js/specialization/JSBindingState.h: Added.
+ * bindings/v8/V8Binding.h:
+ * bindings/v8/V8Utilities.cpp:
+ (WebCore::completeURL):
+ (WebCore::navigateIfAllowed):
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ (WebCore::V8Location::replaceCallback):
+ * bindings/v8/specialization/V8BindingState.cpp:
+ (WebCore::::allowsAccessFromFrame):
+ * bindings/v8/specialization/V8BindingState.h:
+
2010-09-09 Kent Tamura <tkent at chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 33dad10..01d11cf 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -9,6 +9,7 @@ webcore_cppflags += \
-I$(srcdir)/WebCore/accessibility \
-I$(srcdir)/WebCore/bindings/generic \
-I$(srcdir)/WebCore/bindings/js \
+ -I$(srcdir)/WebCore/bindings/js/specialization \
-I$(srcdir)/WebCore/bindings/gobject \
-I$(srcdir)/WebCore/bridge \
-I$(srcdir)/WebCore/bridge/c \
@@ -623,6 +624,12 @@ webcore_sources += \
WebCore/accessibility/AccessibilityTableRow.h \
WebCore/bindings/generic/ActiveDOMCallback.cpp \
WebCore/bindings/generic/ActiveDOMCallback.h \
+ WebCore/bindings/generic/BindingFrame.h \
+ WebCore/bindings/generic/BindingLocation.h \
+ WebCore/bindings/generic/BindingSecurity.h \
+ WebCore/bindings/generic/BindingSecurityBase.cpp \
+ WebCore/bindings/generic/BindingSecurityBase.h \
+ WebCore/bindings/generic/GenericBinding.h \
WebCore/bindings/generic/RuntimeEnabledFeatures.cpp \
WebCore/bindings/generic/RuntimeEnabledFeatures.h \
WebCore/bindings/js/CachedScriptSourceProvider.h \
@@ -796,6 +803,8 @@ webcore_sources += \
WebCore/bindings/js/SerializedScriptValue.h \
WebCore/bindings/js/StringSourceProvider.h \
WebCore/bindings/js/WebCoreJSClientData.h \
+ WebCore/bindings/js/specialization/JSBindingState.cpp \
+ WebCore/bindings/js/specialization/JSBindingState.h \
WebCore/bindings/ScriptControllerBase.cpp \
WebCore/bindings/ScriptControllerBase.h \
WebCore/bridge/Bridge.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 6287760..88f0149 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -514,6 +514,8 @@
'bindings/generic/ActiveDOMCallback.cpp',
'bindings/generic/ActiveDOMCallback.h',
'bindings/generic/BindingDOMWindow.h',
+ 'bindings/generic/BindingFrame.h',
+ 'bindings/generic/BindingLocation.h',
'bindings/generic/BindingSecurity.h',
'bindings/generic/BindingSecurityBase.cpp',
'bindings/generic/BindingSecurityBase.h',
@@ -533,6 +535,7 @@
'bindings/js/JSAttrCustom.cpp',
'bindings/js/JSAudioConstructor.cpp',
'bindings/js/JSAudioConstructor.h',
+ 'bindings/js/JSBinding.h',
'bindings/js/JSCanvasRenderingContextCustom.cpp',
'bindings/js/JSCanvasRenderingContext2DCustom.cpp',
'bindings/js/JSCDATASectionCustom.cpp',
@@ -712,6 +715,8 @@
'bindings/js/WebCoreJSClientData.h',
'bindings/js/WorkerScriptController.cpp',
'bindings/js/WorkerScriptController.h',
+ 'bindings/js/specialization/JSBindingState.cpp',
+ 'bindings/js/specialization/JSBindingState.h',
'bindings/ScriptControllerBase.cpp',
'bindings/ScriptControllerBase.h',
'bindings/v8/ChildThreadDOMData.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 57cf531..01bdc75 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -184,6 +184,7 @@ WEBCORE_INCLUDEPATH = \
$$PWD/bindings \
$$PWD/bindings/generic \
$$PWD/bindings/js \
+ $$PWD/bindings/js/specialization \
$$PWD/bridge \
$$PWD/bridge/c \
$$PWD/bridge/jsc \
@@ -392,6 +393,7 @@ SOURCES += \
bindings/js/ScriptValue.cpp \
bindings/js/ScheduledAction.cpp \
bindings/js/SerializedScriptValue.cpp \
+ bindings/js/specialization/JSBindingState.cpp \
bindings/ScriptControllerBase.cpp \
bridge/IdentifierRep.cpp \
bridge/NP_jsobject.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index b6d9e1c..a4adf88 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -42091,10 +42091,30 @@
RelativePath="..\bindings\generic\ActiveDOMCallback.h"
>
</File>
- </Filter>
- <Filter
- Name="generic"
- >
+ <File
+ RelativePath="..\bindings\generic\BindingFrame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\generic\BindingLocation.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\generic\BindingSecurity.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\generic\BindingSecurityBase.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\generic\BindingSecurityBase.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\generic\GenericBinding.h"
+ >
+ </File>
<File
RelativePath="..\bindings\generic\RuntimeEnabledFeatures.cpp"
>
@@ -42448,6 +42468,10 @@
>
</File>
<File
+ RelativePath="..\bindings\js\JSBinding.h"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSBindingsAllInOne.cpp"
>
</File>
@@ -49743,6 +49767,62 @@
RelativePath="..\bindings\js\WorkerScriptController.h"
>
</File>
+ <File
+ RelativePath="..\bindings\js\specialization\JSBindingState.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\bindings\js\specialization\JSBindingState.h"
+ >
+ </File>
</Filter>
</Filter>
<Filter
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
index c98e13b..8677c0e 100644
--- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
+++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
@@ -7,7 +7,7 @@
>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib""
+ AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib""
PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index faab89f..8893d0a 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2851,6 +2851,15 @@
A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */ = {isa = PBXBuildFile; fileRef = A59E3C1D11580F510072928E /* KeyEventIPhone.mm */; };
A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AFB34D115151A700B045CB /* StepRange.cpp */; };
A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; };
+ A622A8EE122C442A00A785B3 /* JSBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8ED122C442A00A785B3 /* JSBinding.h */; };
+ A622A8F2122C444500A785B3 /* JSBindingState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A622A8F0122C444500A785B3 /* JSBindingState.cpp */; };
+ A622A8F3122C444500A785B3 /* JSBindingState.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F1122C444500A785B3 /* JSBindingState.h */; };
+ A622A8FA122C44A600A785B3 /* BindingLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F4122C44A600A785B3 /* BindingLocation.h */; };
+ A622A8FB122C44A600A785B3 /* BindingSecurity.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F5122C44A600A785B3 /* BindingSecurity.h */; };
+ A622A8FC122C44A600A785B3 /* BindingSecurityBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */; };
+ A622A8FD122C44A600A785B3 /* BindingSecurityBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */; };
+ A622A8FE122C44A600A785B3 /* BindingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F8122C44A600A785B3 /* BindingUtilities.h */; };
+ A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F9122C44A600A785B3 /* GenericBinding.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
A7352C190B1BB89D00A986D0 /* RenderSVGBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */; };
@@ -8737,6 +8746,15 @@
A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = "<group>"; };
A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCocoa.h; path = cocoa/KeyEventCocoa.h; sourceTree = "<group>"; };
A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventCocoa.mm; path = cocoa/KeyEventCocoa.mm; sourceTree = "<group>"; };
+ A622A8ED122C442A00A785B3 /* JSBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBinding.h; sourceTree = "<group>"; };
+ A622A8F0122C444500A785B3 /* JSBindingState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBindingState.cpp; sourceTree = "<group>"; };
+ A622A8F1122C444500A785B3 /* JSBindingState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBindingState.h; sourceTree = "<group>"; };
+ A622A8F4122C44A600A785B3 /* BindingLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingLocation.h; path = generic/BindingLocation.h; sourceTree = "<group>"; };
+ A622A8F5122C44A600A785B3 /* BindingSecurity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurity.h; path = generic/BindingSecurity.h; sourceTree = "<group>"; };
+ A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BindingSecurityBase.cpp; path = generic/BindingSecurityBase.cpp; sourceTree = "<group>"; };
+ A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurityBase.h; path = generic/BindingSecurityBase.h; sourceTree = "<group>"; };
+ A622A8F8122C44A600A785B3 /* BindingUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingUtilities.h; path = generic/BindingUtilities.h; sourceTree = "<group>"; };
+ A622A8F9122C44A600A785B3 /* GenericBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericBinding.h; path = generic/GenericBinding.h; sourceTree = "<group>"; };
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
@@ -14504,6 +14522,15 @@
name = cocoa;
sourceTree = "<group>";
};
+ A622A8EF122C444500A785B3 /* specialization */ = {
+ isa = PBXGroup;
+ children = (
+ A622A8F0122C444500A785B3 /* JSBindingState.cpp */,
+ A622A8F1122C444500A785B3 /* JSBindingState.h */,
+ );
+ path = specialization;
+ sourceTree = "<group>";
+ };
A75E8B7F0E1DE2B0007F2481 /* filters */ = {
isa = PBXGroup;
children = (
@@ -16121,6 +16148,12 @@
children = (
B5D31DF811CF610B009F22B4 /* ActiveDOMCallback.cpp */,
B5D31DF911CF610B009F22B4 /* ActiveDOMCallback.h */,
+ A622A8F4122C44A600A785B3 /* BindingLocation.h */,
+ A622A8F5122C44A600A785B3 /* BindingSecurity.h */,
+ A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */,
+ A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */,
+ A622A8F8122C44A600A785B3 /* BindingUtilities.h */,
+ A622A8F9122C44A600A785B3 /* GenericBinding.h */,
);
name = generic;
sourceTree = "<group>";
@@ -16160,6 +16193,7 @@
BCCE58A71061E82F008FB35A /* Callback Objects */,
BCCE58B41061E925008FB35A /* Constructors */,
BC4EDEF70C08F414007EDD49 /* Custom */,
+ A622A8EF122C444500A785B3 /* specialization */,
14DFB33F0A7DF7630018F769 /* Derived Sources */,
BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
@@ -16173,6 +16207,7 @@
C585A66111D4FAC5004C3E4B /* IDBBindingUtilities.h */,
1C81BA030E97348300266E07 /* JavaScriptCallFrame.cpp */,
1C81BA040E97348300266E07 /* JavaScriptCallFrame.h */,
+ A622A8ED122C442A00A785B3 /* JSBinding.h */,
BC53DAC411432FD9000D817E /* JSDebugWrapperSet.cpp */,
BC53DAC111432EEE000D817E /* JSDebugWrapperSet.h */,
93B70D4709EB0C7C009D8468 /* JSDOMBinding.cpp */,
@@ -20485,6 +20520,13 @@
97205AB61239291000B17380 /* ImageDocument.h in Headers */,
97205AB81239291000B17380 /* MediaDocument.h in Headers */,
97205ABC1239292700B17380 /* PluginDocument.h in Headers */,
+ A622A8EE122C442A00A785B3 /* JSBinding.h in Headers */,
+ A622A8F3122C444500A785B3 /* JSBindingState.h in Headers */,
+ A622A8FA122C44A600A785B3 /* BindingLocation.h in Headers */,
+ A622A8FB122C44A600A785B3 /* BindingSecurity.h in Headers */,
+ A622A8FD122C44A600A785B3 /* BindingSecurityBase.h in Headers */,
+ A622A8FE122C44A600A785B3 /* BindingUtilities.h in Headers */,
+ A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */,
893C47A71238908B002B3D86 /* FileCallback.h in Headers */,
893C47A81238908B002B3D86 /* FileWriterCallback.h in Headers */,
893C47B81238A099002B3D86 /* JSFileCallback.h in Headers */,
@@ -22957,6 +22999,8 @@
97205AB51239291000B17380 /* ImageDocument.cpp in Sources */,
97205AB71239291000B17380 /* MediaDocument.cpp in Sources */,
97205ABB1239292700B17380 /* PluginDocument.cpp in Sources */,
+ A622A8F2122C444500A785B3 /* JSBindingState.cpp in Sources */,
+ A622A8FC122C44A600A785B3 /* BindingSecurityBase.cpp in Sources */,
893C47B71238A099002B3D86 /* JSFileCallback.cpp in Sources */,
893C47BB1238A0A9002B3D86 /* JSFileWriterCallback.cpp in Sources */,
);
diff --git a/WebCore/bindings/generic/BindingDOMWindow.h b/WebCore/bindings/generic/BindingDOMWindow.h
index 0c450a5..96b8b9d 100644
--- a/WebCore/bindings/generic/BindingDOMWindow.h
+++ b/WebCore/bindings/generic/BindingDOMWindow.h
@@ -65,9 +65,6 @@ public:
const String& frameName,
const WindowFeatures& rawFeatures);
- // FIXME: There should be a place for generic binding utilities.
- static KURL completeURL(State<Binding>*, const String& relativeURL);
-
private:
// Horizontal and vertical offset, from the parent content area,
// around newly opened popups that don't specify a location.
@@ -268,18 +265,6 @@ WebCore::DOMWindow* BindingDOMWindow<Binding>::open(State<Binding>* state,
return frame->domWindow();
}
-template <class Binding>
-KURL BindingDOMWindow<Binding>::completeURL(State<Binding>* state,
- const String& relativeURL)
-{
- // For historical reasons, we need to complete the URL using the
- // dynamic frame.
- Frame* frame = state->getFirstFrame();
- if (!frame)
- return KURL();
- return frame->loader()->completeURL(relativeURL);
-}
-
} // namespace WebCore
#endif // BindingDOMWindow_h
diff --git a/WebCore/bindings/generic/BindingFrame.h b/WebCore/bindings/generic/BindingFrame.h
new file mode 100644
index 0000000..f1fdc79
--- /dev/null
+++ b/WebCore/bindings/generic/BindingFrame.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef BindingFrame_h
+#define BindingFrame_h
+
+#include "Frame.h"
+#include "GenericBinding.h"
+
+namespace WebCore {
+
+template <class Binding>
+class BindingFrame {
+public:
+ static void navigateIfAllowed(State<Binding>*, Frame*, const KURL&, bool lockHistory, bool lockBackForwardList);
+};
+
+template <class Binding>
+void BindingFrame<Binding>::navigateIfAllowed(State<Binding>* state, Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
+{
+ Frame* activeFrame = state->getActiveFrame();
+ if (!activeFrame)
+ return;
+ if (!protocolIsJavaScript(url) || state->allowsAccessFromFrame(frame))
+ frame->redirectScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, state->processingUserGesture());
+}
+
+} // namespace WebCore
+
+#endif // BindingFrame_h
diff --git a/WebCore/bindings/generic/BindingLocation.h b/WebCore/bindings/generic/BindingLocation.h
new file mode 100644
index 0000000..ca52814
--- /dev/null
+++ b/WebCore/bindings/generic/BindingLocation.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef BindingLocation_h
+#define BindingLocation_h
+
+#include "BindingSecurity.h"
+#include "GenericBinding.h"
+#include "Location.h"
+
+namespace WebCore {
+
+template <class Binding>
+class BindingLocation {
+public:
+ static void replace(State<Binding>*, Location*, const String& url);
+};
+
+template <class Binding>
+void BindingLocation<Binding>::replace(State<Binding>* state, Location* location, const String& url)
+{
+ Frame* frame = location->frame();
+ if (!frame)
+ return;
+
+ KURL fullURL = completeURL(state, url);
+ if (fullURL.isNull())
+ return;
+
+ if (!BindingSecurity<Binding>::shouldAllowNavigation(state, frame))
+ return;
+
+ Binding::Frame::navigateIfAllowed(state, frame, fullURL, true, true);
+}
+
+} // namespace WebCore
+
+#endif // BindingLocation_h
diff --git a/WebCore/bindings/generic/GenericBinding.h b/WebCore/bindings/generic/GenericBinding.h
index d030b45..8bf1343 100644
--- a/WebCore/bindings/generic/GenericBinding.h
+++ b/WebCore/bindings/generic/GenericBinding.h
@@ -31,6 +31,9 @@
#ifndef GenericBinding_h
#define GenericBinding_h
+#include "Frame.h"
+#include "FrameLoader.h"
+
namespace WebCore {
// Used to instantiate binding templates for any methods shared among all
@@ -47,6 +50,17 @@ class State<GenericBinding> {
// Any methods shared across bindings can go here.
};
+template <class Binding>
+KURL completeURL(State<Binding>* state, const String& relativeURL)
+{
+ // For historical reasons, we need to complete the URL using the
+ // dynamic frame.
+ Frame* frame = state->getFirstFrame();
+ if (!frame)
+ return KURL();
+ return frame->loader()->completeURL(relativeURL);
+}
+
}
#endif // GenericBinding_h
diff --git a/WebCore/bindings/js/JSBinding.h b/WebCore/bindings/js/JSBinding.h
new file mode 100644
index 0000000..b42c9be
--- /dev/null
+++ b/WebCore/bindings/js/JSBinding.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef JSBinding_h
+#define JSBinding_h
+
+#include "BindingFrame.h"
+#include "BindingLocation.h"
+#include "BindingSecurity.h"
+
+namespace WebCore {
+
+// Instantiate binding template classes for JSC.
+class JSBinding {
+public:
+ typedef BindingFrame<JSBinding> Frame;
+ typedef BindingLocation<JSBinding> Location;
+};
+
+typedef BindingSecurity<JSBinding> JSBindingSecurity;
+
+} // namespace WebCore
+
+#endif // JSBinding_h
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 922e449..6e1cc1e 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -30,6 +30,7 @@
#include "GCController.cpp"
#include "JSAttrCustom.cpp"
#include "JSAudioConstructor.cpp"
+#include "JSBindingState.cpp"
#include "JSCDATASectionCustom.cpp"
#include "JSCSSRuleCustom.cpp"
#include "JSCSSRuleListCustom.cpp"
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 96394eb..74c8131 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -38,11 +38,14 @@
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "HTMLScriptElement.h"
+#include "JSBinding.h"
+#include "JSBindingState.h"
#include "JSDOMCoreException.h"
#include "JSDOMWindowCustom.h"
#include "JSDebugWrapperSet.h"
#include "JSEventException.h"
#include "JSExceptionBase.h"
+#include "JSMainThreadExecState.h"
#include "JSNode.h"
#include "JSRangeException.h"
#include "JSXMLHttpRequestException.h"
@@ -639,8 +642,8 @@ bool allowsAccessFromFrame(ExecState* exec, Frame* frame, String& message)
bool shouldAllowNavigation(ExecState* exec, Frame* frame)
{
- Frame* lexicalFrame = toLexicalFrame(exec);
- return lexicalFrame && lexicalFrame->loader()->shouldAllowNavigation(frame);
+ JSBindingState state(exec);
+ return JSBindingSecurity::shouldAllowNavigation(&state, frame);
}
bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
@@ -671,26 +674,23 @@ void printErrorMessageForFrame(Frame* frame, const String& message)
Frame* toLexicalFrame(ExecState* exec)
{
- return asJSDOMWindow(exec->lexicalGlobalObject())->impl()->frame();
+ return JSBindingState(exec).getActiveFrame();
}
Frame* toDynamicFrame(ExecState* exec)
{
- return asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame();
+ return JSBindingState(exec).getFirstFrame();
}
bool processingUserGesture()
{
- return ScriptController::processingUserGesture();
+ return JSBindingState(JSMainThreadExecState::currentState()).processingUserGesture();
}
KURL completeURL(ExecState* exec, const String& relativeURL)
{
- // For historical reasons, we need to complete the URL using the dynamic frame.
- Frame* frame = toDynamicFrame(exec);
- if (!frame)
- return KURL();
- return frame->loader()->completeURL(relativeURL);
+ JSBindingState state(exec);
+ return completeURL(&state, relativeURL);
}
JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp
index 99166cd..09e7294 100644
--- a/WebCore/bindings/js/JSLocationCustom.cpp
+++ b/WebCore/bindings/js/JSLocationCustom.cpp
@@ -27,6 +27,8 @@
#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "JSBinding.h"
+#include "JSBindingState.h"
#include "JSDOMBinding.h"
#include "JSDOMWindowCustom.h"
#include "KURL.h"
@@ -186,12 +188,8 @@ void JSLocation::defineGetter(ExecState* exec, const Identifier& propertyName, J
static void navigateIfAllowed(ExecState* exec, Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
{
- Frame* lexicalFrame = toLexicalFrame(exec);
- if (!lexicalFrame)
- return;
-
- if (!protocolIsJavaScript(url) || allowsAccessFromFrame(exec, frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
+ JSBindingState state(exec);
+ JSBinding::Frame::navigateIfAllowed(&state, frame, url, lockHistory, lockBackForwardList);
}
void JSLocation::setHref(ExecState* exec, JSValue value)
@@ -303,18 +301,8 @@ void JSLocation::setHash(ExecState* exec, JSValue value)
JSValue JSLocation::replace(ExecState* exec)
{
- Frame* frame = impl()->frame();
- if (!frame)
- return jsUndefined();
-
- KURL url = completeURL(exec, ustringToString(exec->argument(0).toString(exec)));
- if (url.isNull())
- return jsUndefined();
-
- if (!shouldAllowNavigation(exec, frame))
- return jsUndefined();
-
- navigateIfAllowed(exec, frame, url, true, true);
+ JSBindingState state(exec);
+ JSBinding::Location::replace(&state, impl(), ustringToString(exec->argument(0).toString(exec)));
return jsUndefined();
}
diff --git a/WebCore/bindings/js/specialization/JSBindingState.cpp b/WebCore/bindings/js/specialization/JSBindingState.cpp
new file mode 100644
index 0000000..950b813
--- /dev/null
+++ b/WebCore/bindings/js/specialization/JSBindingState.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 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 "JSBindingState.h"
+
+#include "DOMWindow.h"
+#include "JSDOMWindow.h"
+#include "JSDOMWindowCustom.h"
+#include "ScriptController.h"
+
+namespace WebCore {
+
+class Frame;
+
+Frame* State<JSBinding>::getActiveFrame()
+{
+ return asJSDOMWindow(m_exec->lexicalGlobalObject())->impl()->frame();
+}
+
+Frame* State<JSBinding>::getFirstFrame()
+{
+ return asJSDOMWindow(m_exec->dynamicGlobalObject())->impl()->frame();
+}
+
+bool State<JSBinding>::processingUserGesture()
+{
+ return ScriptController::processingUserGesture();
+}
+
+bool State<JSBinding>::allowsAccessFromFrame(Frame* frame)
+{
+ return WebCore::allowsAccessFromFrame(m_exec, frame);
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/specialization/JSBindingState.h b/WebCore/bindings/js/specialization/JSBindingState.h
new file mode 100644
index 0000000..6640140
--- /dev/null
+++ b/WebCore/bindings/js/specialization/JSBindingState.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef JSBindingState_h
+#define JSBindingState_h
+
+#include "GenericBinding.h"
+#include "JSBinding.h"
+
+namespace JSC {
+
+class ExecState;
+
+} // namespace JSC
+
+namespace WebCore {
+
+class Frame;
+
+template <>
+class State<JSBinding> : public State<GenericBinding> {
+public:
+ explicit State(JSC::ExecState* exec)
+ : m_exec(exec)
+ {
+ }
+
+ virtual ~State()
+ {
+ }
+
+ Frame* getActiveFrame();
+ Frame* getFirstFrame();
+
+ bool processingUserGesture();
+
+ // FIXME: This should be shared in BindingSecurity
+ bool allowsAccessFromFrame(Frame*);
+
+private:
+ JSC::ExecState* m_exec;
+};
+
+typedef State<JSBinding> JSBindingState;
+
+} // namespace WebCore
+
+#endif // JSBindingState_h
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
index 58989ed..566e8ac 100644
--- a/WebCore/bindings/v8/V8Binding.h
+++ b/WebCore/bindings/v8/V8Binding.h
@@ -31,6 +31,8 @@
#ifndef V8Binding_h
#define V8Binding_h
+#include "BindingFrame.h"
+#include "BindingLocation.h"
#include "BindingSecurity.h"
#include "MathExtras.h"
#include "PlatformString.h"
@@ -50,16 +52,18 @@ namespace WebCore {
public:
typedef v8::Handle<v8::Value> Value;
typedef V8BindingDOMWindow DOMWindow;
+ typedef BindingFrame<V8Binding> Frame;
+ typedef BindingLocation<V8Binding> Location;
static Value emptyScriptValue() { return v8::Local<v8::Value>(); }
};
typedef BindingSecurity<V8Binding> V8BindingSecurity;
-
+
enum ExternalMode {
Externalize,
DoNotExternalize
};
-
+
template <typename StringType>
StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external);
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index 2e5cf8b..e497071 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -38,7 +38,6 @@
#include "ScriptExecutionContext.h"
#include "ScriptState.h"
#include "V8Binding.h"
-#include "V8BindingDOMWindow.h" // FIXME: remove when completeURL moves
#include "V8BindingState.h"
#include "V8Proxy.h"
#include "WorkerContext.h"
@@ -112,16 +111,12 @@ bool shouldAllowNavigation(Frame* frame)
KURL completeURL(const String& relativeURL)
{
- return V8BindingDOMWindow::completeURL(V8BindingState::Only(), relativeURL);
+ return completeURL(V8BindingState::Only(), relativeURL);
}
void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
{
- Frame* callingOrEntered = callingOrEnteredFrame();
- if (!callingOrEntered)
- return;
- if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), callingOrEntered->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
+ return V8Binding::Frame::navigateIfAllowed(V8BindingState::Only(), frame, url, lockHistory, lockBackForwardList);
}
ScriptExecutionContext* getScriptExecutionContext()
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index ac305c9..6068aa2 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -292,19 +292,7 @@ v8::Handle<v8::Value> V8Location::replaceCallback(const v8::Arguments& args)
INC_STATS("DOM.Location.replace");
v8::Handle<v8::Object> holder = args.Holder();
Location* imp = V8Location::toNative(holder);
-
- Frame* frame = imp->frame();
- if (!frame)
- return v8::Undefined();
-
- KURL url = completeURL(toWebCoreString(args[0]));
- if (url.isNull())
- return v8::Undefined();
-
- if (!shouldAllowNavigation(frame))
- return v8::Undefined();
-
- navigateIfAllowed(frame, url, true, true);
+ V8Binding::Location::replace(V8BindingState::Only(), imp, toWebCoreString(args[0]));
return v8::Undefined();
}
@@ -378,4 +366,3 @@ v8::Handle<v8::Value> toV8(Location* impl)
}
} // namespace WebCore
-
diff --git a/WebCore/bindings/v8/specialization/V8BindingState.cpp b/WebCore/bindings/v8/specialization/V8BindingState.cpp
index ccdd7c8..2193c9f 100644
--- a/WebCore/bindings/v8/specialization/V8BindingState.cpp
+++ b/WebCore/bindings/v8/specialization/V8BindingState.cpp
@@ -84,4 +84,9 @@ bool State<V8Binding>::processingUserGesture()
return ScriptController::processingUserGesture();
}
+bool State<V8Binding>::allowsAccessFromFrame(Frame* frame)
+{
+ return ScriptController::isSafeScript(frame);
+}
+
} // namespace WebCore
diff --git a/WebCore/bindings/v8/specialization/V8BindingState.h b/WebCore/bindings/v8/specialization/V8BindingState.h
index baba0c6..14305b8 100644
--- a/WebCore/bindings/v8/specialization/V8BindingState.h
+++ b/WebCore/bindings/v8/specialization/V8BindingState.h
@@ -60,6 +60,9 @@ public:
bool processingUserGesture();
+ // FIXME: This should be shared in BindingSecurity
+ bool allowsAccessFromFrame(Frame*);
+
private:
explicit State() {}
~State();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list