Diff
Modified: trunk/Source/WebCore/ChangeLog (124834 => 124835)
--- trunk/Source/WebCore/ChangeLog 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/ChangeLog 2012-08-07 02:04:35 UTC (rev 124835)
@@ -1,3 +1,62 @@
+2012-08-06 Adam Barth <[email protected]>
+
+ JSC should use BindingState to determine the activeDOMWindow
+ https://bugs.webkit.org/show_bug.cgi?id=93307
+
+ Reviewed by Eric Seidel.
+
+ This patch moves activeDOMWindow from JSDOMBindings.cpp to
+ BindingState.cpp. This is a first step towards sharing the core
+ security logic in the bindings between _javascript_Core and V8. Once the
+ logic is shared, we will be able to refactor the logic to avoid the
+ need for DOMWindow::m_securityOrigin.
+
+ This patch doesn't actually share any code (yet). It just sets the
+ stage by creating BindingState as a typedef of ExecState and adding the
+ appropriate files to the build systems.
+
+ This patch also renames activeWindow and firstWindow in the V8 bindings
+ to activeDOMWindow and firstDOMWindow to match the names in the
+ _javascript_Core bindings.
+
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * UseJSC.cmake:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/generic/BindingSecurity.cpp:
+ (WebCore::canAccessDocument):
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore):
+ * bindings/js/JSDOMBinding.h:
+ (WebCore):
+ * bindings/v8/BindingState.cpp:
+ (WebCore::activeDOMWindow):
+ (WebCore::firstDOMWindow):
+ * bindings/v8/BindingState.h:
+ (WebCore):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::V8DOMWindow::locationAccessorSetter):
+ (WebCore::handlePostMessageCallback):
+ (WebCore::V8DOMWindow::showModalDialogCallback):
+ (WebCore::V8DOMWindow::openCallback):
+ * bindings/v8/custom/V8DocumentLocationCustom.cpp:
+ (WebCore::V8Document::locationAccessorSetter):
+ * bindings/v8/custom/V8LocationCustom.cpp:
+ (WebCore::V8Location::hashAccessorSetter):
+ (WebCore::V8Location::hostAccessorSetter):
+ (WebCore::V8Location::hostnameAccessorSetter):
+ (WebCore::V8Location::hrefAccessorSetter):
+ (WebCore::V8Location::pathnameAccessorSetter):
+ (WebCore::V8Location::portAccessorSetter):
+ (WebCore::V8Location::protocolAccessorSetter):
+ (WebCore::V8Location::searchAccessorSetter):
+ (WebCore::V8Location::reloadCallback):
+ (WebCore::V8Location::replaceCallback):
+ (WebCore::V8Location::assignCallback):
+
2012-08-05 Kent Tamura <[email protected]>
[Chromium-Mac] Use the default locale only if the browser locale matches to it
Modified: trunk/Source/WebCore/GNUmakefile.list.am (124834 => 124835)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-08-07 02:04:35 UTC (rev 124835)
@@ -1370,12 +1370,15 @@
Source/WebCore/accessibility/AXObjectCache.h \
Source/WebCore/bindings/generic/ActiveDOMCallback.cpp \
Source/WebCore/bindings/generic/ActiveDOMCallback.h \
+ Source/WebCore/bindings/generic/BindingSecurity.cpp \
Source/WebCore/bindings/generic/BindingSecurity.h \
Source/WebCore/bindings/generic/GenericBinding.h \
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp \
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h \
Source/WebCore/bindings/js/ArrayValue.cpp \
Source/WebCore/bindings/js/ArrayValue.h \
+ Source/WebCore/bindings/js/BindingState.cpp \
+ Source/WebCore/bindings/js/BindingState.h \
Source/WebCore/bindings/js/CachedScriptSourceProvider.h \
Source/WebCore/bindings/js/CallbackFunction.cpp \
Source/WebCore/bindings/js/CallbackFunction.h \
Modified: trunk/Source/WebCore/Target.pri (124834 => 124835)
--- trunk/Source/WebCore/Target.pri 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/Target.pri 2012-08-07 02:04:35 UTC (rev 124835)
@@ -69,11 +69,13 @@
accessibility/AccessibilityTableRow.cpp \
accessibility/AXObjectCache.cpp \
bindings/generic/ActiveDOMCallback.cpp \
+ bindings/generic/BindingSecurity.cpp \
bindings/generic/RuntimeEnabledFeatures.cpp
SOURCES += \
bindings/ScriptControllerBase.cpp \
bindings/js/ArrayValue.cpp \
+ bindings/js/BindingState.cpp \
bindings/js/CallbackFunction.cpp \
bindings/js/DOMObjectHashTableMap.cpp \
bindings/js/DOMWrapperWorld.cpp \
@@ -1280,9 +1282,11 @@
accessibility/AXObjectCache.h \
bindings/ScriptControllerBase.h \
bindings/generic/ActiveDOMCallback.h \
+ bindings/generic/BindingSecurity.h \
bindings/generic/RuntimeEnabledFeatures.h
HEADERS += \
+ bindings/js/BindingState.h \
bindings/js/CachedScriptSourceProvider.h \
bindings/js/CallbackFunction.h \
bindings/js/GCController.h \
Modified: trunk/Source/WebCore/UseJSC.cmake (124834 => 124835)
--- trunk/Source/WebCore/UseJSC.cmake 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/UseJSC.cmake 2012-08-07 02:04:35 UTC (rev 124835)
@@ -23,6 +23,7 @@
LIST(APPEND WebCore_SOURCES
bindings/js/ArrayValue.cpp
+ bindings/js/BindingState.cpp
bindings/js/CallbackFunction.cpp
bindings/js/DOMObjectHashTableMap.cpp
bindings/js/DOMWrapperWorld.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (124834 => 124835)
--- trunk/Source/WebCore/WebCore.gypi 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/WebCore.gypi 2012-08-07 02:04:35 UTC (rev 124835)
@@ -1924,6 +1924,8 @@
'bindings/gobject/WebKitHTMLElementWrapperFactory.h',
'bindings/js/ArrayValue.cpp',
'bindings/js/ArrayValue.h',
+ 'bindings/js/BindingState.cpp',
+ 'bindings/js/BindingState.h',
'bindings/js/CachedScriptSourceProvider.h',
'bindings/js/CallbackFunction.cpp',
'bindings/js/CallbackFunction.h',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (124834 => 124835)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-08-07 02:04:35 UTC (rev 124835)
@@ -63794,10 +63794,14 @@
>
</File>
<File
- RelativePath="..\bindings\generic\BindingDOMWindow.h"
+ RelativePath="..\bindings\generic\BindingSecurity.cpp"
>
</File>
<File
+ RelativePath="..\bindings\generic\BindingSecurity.h"
+ >
+ </File>
+ <File
RelativePath="..\bindings\generic\GenericBinding.h"
>
</File>
@@ -63926,6 +63930,62 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\bindings\js\BindingState.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo_CFLite|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Production|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\bindings\js\BindingState.h"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\CallbackFunction.h"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (124834 => 124835)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-08-07 02:04:35 UTC (rev 124835)
@@ -3461,6 +3461,10 @@
9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9728C3121268E4390041E89B /* MarkupAccumulator.h */; };
973889A0116EA9DC00ADF313 /* DocumentWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */; };
973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9738899F116EA9DC00ADF313 /* DocumentWriter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 973AA3F415D088F000E38A85 /* BindingState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973AA3F215D088F000E38A85 /* BindingState.cpp */; };
+ 973AA3F515D088F000E38A85 /* BindingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 973AA3F315D088F000E38A85 /* BindingState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 973AA3F915D0891B00E38A85 /* BindingSecurity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973AA3F715D0891B00E38A85 /* BindingSecurity.cpp */; };
+ 973AA3FA15D0891B00E38A85 /* BindingSecurity.h in Headers */ = {isa = PBXBuildFile; fileRef = 973AA3F815D0891B00E38A85 /* BindingSecurity.h */; };
973DC63F145A9409002842C2 /* ExceptionCodeDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973DC63D145A9409002842C2 /* ExceptionCodeDescription.cpp */; };
973DC640145A9409002842C2 /* ExceptionCodeDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */; };
@@ -10606,6 +10610,10 @@
9728C3121268E4390041E89B /* MarkupAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkupAccumulator.h; sourceTree = "<group>"; };
9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentWriter.cpp; sourceTree = "<group>"; };
9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; };
+ 973AA3F215D088F000E38A85 /* BindingState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BindingState.cpp; sourceTree = "<group>"; };
+ 973AA3F315D088F000E38A85 /* BindingState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BindingState.h; sourceTree = "<group>"; };
+ 973AA3F715D0891B00E38A85 /* BindingSecurity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BindingSecurity.cpp; path = generic/BindingSecurity.cpp; sourceTree = "<group>"; };
+ 973AA3F815D0891B00E38A85 /* BindingSecurity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurity.h; path = generic/BindingSecurity.h; sourceTree = "<group>"; };
973DC63D145A9409002842C2 /* ExceptionCodeDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionCodeDescription.cpp; sourceTree = "<group>"; };
973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodeDescription.h; sourceTree = "<group>"; };
973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadNotifier.cpp; sourceTree = "<group>"; };
@@ -20007,6 +20015,8 @@
children = (
B5D31DF811CF610B009F22B4 /* ActiveDOMCallback.cpp */,
B5D31DF911CF610B009F22B4 /* ActiveDOMCallback.h */,
+ 973AA3F715D0891B00E38A85 /* BindingSecurity.cpp */,
+ 973AA3F815D0891B00E38A85 /* BindingSecurity.h */,
A622A8F9122C44A600A785B3 /* GenericBinding.h */,
);
name = generic;
@@ -20053,6 +20063,8 @@
14DFB33F0A7DF7630018F769 /* Derived Sources */,
49B3760A15C6C6840059131D /* ArrayValue.cpp */,
49B3760B15C6C6840059131D /* ArrayValue.h */,
+ 973AA3F215D088F000E38A85 /* BindingState.cpp */,
+ 973AA3F315D088F000E38A85 /* BindingState.h */,
BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
312D67B01535691F00563D0D /* Dictionary.cpp */,
@@ -21169,8 +21181,8 @@
498391550F1E776900C23782 /* WebKitCSSMatrix.cpp */,
498391560F1E776900C23782 /* WebKitCSSMatrix.h */,
498391570F1E776900C23782 /* WebKitCSSMatrix.idl */,
+ A24BF77A15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.cpp */,
A24BF77915CC3BAF003191F2 /* WebKitCSSMixFunctionValue.h */,
- A24BF77A15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.cpp */,
8AA61CFD144D595B00F37350 /* WebKitCSSRegionRule.cpp */,
8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */,
8AD0A55614C87425000D83C5 /* WebKitCSSRegionRule.idl */,
@@ -22243,6 +22255,8 @@
BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */,
A8C402931348B2220063F1E5 /* BidiRunList.h in Headers */,
938192050F87E1EC00D5352A /* BinaryPropertyList.h in Headers */,
+ 973AA3FA15D0891B00E38A85 /* BindingSecurity.h in Headers */,
+ 973AA3F515D088F000E38A85 /* BindingState.h in Headers */,
F35AE5AC14925F5B004D5776 /* BindingVisitors.h in Headers */,
FD31608D12B026F700C1A359 /* Biquad.h in Headers */,
FD31602512B0267600C1A359 /* BiquadDSPKernel.h in Headers */,
@@ -25270,6 +25284,7 @@
31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */,
31288E750E3005D6003619AE /* WebKitCSSKeyframesRule.h in Headers */,
498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */,
+ A24BF77B15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.h in Headers */,
8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */,
29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */,
0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */,
@@ -25381,7 +25396,6 @@
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
FD537353137B651800008DCE /* ZeroPole.h in Headers */,
- A24BF77B15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -25825,6 +25839,8 @@
B2C3DA230D006C1D00EF6F26 /* BidiContext.cpp in Sources */,
BCE7898B1120E8020060ECE5 /* BidiRun.cpp in Sources */,
938192030F87E1E600D5352A /* BinaryPropertyList.cpp in Sources */,
+ 973AA3F915D0891B00E38A85 /* BindingSecurity.cpp in Sources */,
+ 973AA3F415D088F000E38A85 /* BindingState.cpp in Sources */,
FD31608C12B026F700C1A359 /* Biquad.cpp in Sources */,
FD31602412B0267600C1A359 /* BiquadDSPKernel.cpp in Sources */,
FDC54F041399B0DA008D9117 /* BiquadFilterNode.cpp in Sources */,
@@ -28356,6 +28372,7 @@
31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */,
31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */,
498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */,
+ A24BF77C15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.cpp in Sources */,
8AA61CFF144D595B00F37350 /* WebKitCSSRegionRule.cpp in Sources */,
5038BC0714711CDB0095E0D1 /* WebKitCSSShaderValue.cpp in Sources */,
0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */,
@@ -28456,7 +28473,6 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
- A24BF77C15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/bindings/generic/BindingSecurity.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/generic/BindingSecurity.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/generic/BindingSecurity.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -47,7 +47,7 @@
if (!targetDocument)
return false;
- DOMWindow* active = activeWindow(state);
+ DOMWindow* active = activeDOMWindow(state);
if (!active)
return false;
Modified: trunk/Source/WebCore/bindings/generic/BindingSecurity.h (124834 => 124835)
--- trunk/Source/WebCore/bindings/generic/BindingSecurity.h 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/generic/BindingSecurity.h 2012-08-07 02:04:35 UTC (rev 124835)
@@ -31,13 +31,11 @@
#ifndef BindingSecurity_h
#define BindingSecurity_h
+#include "BindingState.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
-class BindingState;
-class DOMWindow;
-class Frame;
class HTMLFrameElementBase;
class Node;
Added: trunk/Source/WebCore/bindings/js/BindingState.cpp (0 => 124835)
--- trunk/Source/WebCore/bindings/js/BindingState.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/BindingState.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 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 "BindingState.h"
+
+#include "JSDOMWindowCustom.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+DOMWindow* activeDOMWindow(ExecState* exec)
+{
+ return asJSDOMWindow(exec->lexicalGlobalObject())->impl();
+}
+
+DOMWindow* firstDOMWindow(ExecState* exec)
+{
+ return asJSDOMWindow(exec->dynamicGlobalObject())->impl();
+}
+
+}
Added: trunk/Source/WebCore/bindings/js/BindingState.h (0 => 124835)
--- trunk/Source/WebCore/bindings/js/BindingState.h (rev 0)
+++ trunk/Source/WebCore/bindings/js/BindingState.h 2012-08-07 02:04:35 UTC (rev 124835)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 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 BindingState_h
+#define BindingState_h
+
+#include <runtime/JSObject.h>
+
+namespace WebCore {
+
+class DOMWindow;
+class Document;
+class Frame;
+
+typedef JSC::ExecState BindingState;
+
+DOMWindow* activeDOMWindow(BindingState*);
+DOMWindow* firstDOMWindow(BindingState*);
+
+// FIXME: Implement these functions.
+inline Frame* activeFrame(BindingState*) { return 0; }
+inline Frame* firstFrame(BindingState*) { return 0; }
+
+inline void immediatelyReportUnsafeAccessTo(BindingState*, Document*) { }
+
+}
+
+#endif
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -26,6 +26,7 @@
// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
#include "ArrayValue.cpp"
+#include "BindingState.cpp"
#include "CallbackFunction.cpp"
#include "DOMObjectHashTableMap.cpp"
#include "DOMWrapperWorld.cpp"
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -221,16 +221,6 @@
#undef TRY_TO_CREATE_EXCEPTION
-DOMWindow* activeDOMWindow(ExecState* exec)
-{
- return asJSDOMWindow(exec->lexicalGlobalObject())->impl();
-}
-
-DOMWindow* firstDOMWindow(ExecState* exec)
-{
- return asJSDOMWindow(exec->dynamicGlobalObject())->impl();
-}
-
bool shouldAllowAccessToNode(ExecState* exec, Node* node)
{
return node && shouldAllowAccessToFrame(exec, node->document()->frame());
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (124834 => 124835)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2012-08-07 02:04:35 UTC (rev 124835)
@@ -22,6 +22,7 @@
#ifndef JSDOMBinding_h
#define JSDOMBinding_h
+#include "BindingState.h"
#include "CSSImportRule.h"
#include "CSSStyleDeclaration.h"
#include "CSSStyleSheet.h"
@@ -409,12 +410,6 @@
bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*, String& message);
// FIXME: Implement allowAccessToDOMWindow(JSC::ExecState*, DOMWindow*);
- // FIXME: Remove these functions in favor of activeContext and
- // firstContext, which return ScriptExecutionContext*. We prefer to use
- // ScriptExecutionContext* as the context object in the bindings.
- DOMWindow* activeDOMWindow(JSC::ExecState*);
- DOMWindow* firstDOMWindow(JSC::ExecState*);
-
void printErrorMessageForFrame(Frame*, const String& message);
JSC::JSValue objectToStringFunctionGetter(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
Modified: trunk/Source/WebCore/bindings/v8/BindingState.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/v8/BindingState.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/v8/BindingState.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -55,12 +55,12 @@
return v8::Context::GetEntered();
}
-DOMWindow* activeWindow(BindingState*)
+DOMWindow* activeDOMWindow(BindingState*)
{
return V8Proxy::retrieveWindow(activeContext());
}
-DOMWindow* firstWindow(BindingState*)
+DOMWindow* firstDOMWindow(BindingState*)
{
return V8Proxy::retrieveWindow(v8::Context::GetEntered());
}
Modified: trunk/Source/WebCore/bindings/v8/BindingState.h (124834 => 124835)
--- trunk/Source/WebCore/bindings/v8/BindingState.h 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/v8/BindingState.h 2012-08-07 02:04:35 UTC (rev 124835)
@@ -44,8 +44,8 @@
static BindingState* instance();
};
-DOMWindow* activeWindow(BindingState*);
-DOMWindow* firstWindow(BindingState*);
+DOMWindow* activeDOMWindow(BindingState*);
+DOMWindow* firstDOMWindow(BindingState*);
Frame* activeFrame(BindingState*);
Frame* firstFrame(BindingState*);
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -189,11 +189,11 @@
DOMWindow* imp = V8DOMWindow::toNative(info.Holder());
BindingState* state = BindingState::instance();
- DOMWindow* active = activeWindow(state);
+ DOMWindow* active = activeDOMWindow(state);
if (!active)
return;
- DOMWindow* first = firstWindow(state);
+ DOMWindow* first = firstDOMWindow(state);
if (!first)
return;
@@ -300,7 +300,7 @@
// None of these need to be RefPtr because args and context are guaranteed
// to hold on to them.
DOMWindow* window = V8DOMWindow::toNative(args.Holder());
- DOMWindow* source = activeWindow(BindingState::instance());
+ DOMWindow* source = activeDOMWindow(BindingState::instance());
// If called directly by WebCore we don't have a calling context.
if (!source)
@@ -441,7 +441,7 @@
DialogHandler handler(args[1]);
String dialogFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- impl->showModalDialog(urlString, dialogFeaturesString, activeWindow(state), firstWindow(state), setUpDialog, &handler);
+ impl->showModalDialog(urlString, dialogFeaturesString, activeDOMWindow(state), firstDOMWindow(state), setUpDialog, &handler);
return handler.returnValue();
}
@@ -459,7 +459,7 @@
AtomicString frameName = (args[1]->IsUndefined() || args[1]->IsNull()) ? "_blank" : AtomicString(toWebCoreString(args[1]));
String windowFeaturesString = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
- RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeaturesString, activeWindow(state), firstWindow(state));
+ RefPtr<DOMWindow> openedWindow = impl->open(urlString, frameName, windowFeaturesString, activeDOMWindow(state), firstDOMWindow(state));
if (!openedWindow)
return v8::Undefined();
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -52,11 +52,11 @@
BindingState* state = BindingState::instance();
- DOMWindow* active = activeWindow(state);
+ DOMWindow* active = activeDOMWindow(state);
if (!active)
return;
- DOMWindow* first = firstWindow(state);
+ DOMWindow* first = firstDOMWindow(state);
if (!first)
return;
Modified: trunk/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp (124834 => 124835)
--- trunk/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp 2012-08-07 02:01:26 UTC (rev 124834)
+++ trunk/Source/WebCore/bindings/v8/custom/V8LocationCustom.cpp 2012-08-07 02:04:35 UTC (rev 124835)
@@ -55,7 +55,7 @@
// FIXME: Handle exceptions correctly.
String hash = toWebCoreString(value);
- impl->setHash(hash, activeWindow(state), firstWindow(state));
+ impl->setHash(hash, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::hostAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -67,7 +67,7 @@
// FIXME: Handle exceptions correctly.
String host = toWebCoreString(value);
- impl->setHost(host, activeWindow(state), firstWindow(state));
+ impl->setHost(host, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::hostnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -79,7 +79,7 @@
// FIXME: Handle exceptions correctly.
String hostname = toWebCoreString(value);
- impl->setHostname(hostname, activeWindow(state), firstWindow(state));
+ impl->setHostname(hostname, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::hrefAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -91,7 +91,7 @@
// FIXME: Handle exceptions correctly.
String href = ""
- impl->setHref(href, activeWindow(state), firstWindow(state));
+ impl->setHref(href, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::pathnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -103,7 +103,7 @@
// FIXME: Handle exceptions correctly.
String pathname = toWebCoreString(value);
- impl->setPathname(pathname, activeWindow(state), firstWindow(state));
+ impl->setPathname(pathname, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::portAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -115,7 +115,7 @@
// FIXME: Handle exceptions correctly.
String port = toWebCoreString(value);
- impl->setPort(port, activeWindow(state), firstWindow(state));
+ impl->setPort(port, activeDOMWindow(state), firstDOMWindow(state));
}
void V8Location::protocolAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -128,7 +128,7 @@
String protocol = toWebCoreString(value);
ExceptionCode ec = 0;
- impl->setProtocol(protocol, activeWindow(state), firstWindow(state), ec);
+ impl->setProtocol(protocol, activeDOMWindow(state), firstDOMWindow(state), ec);
if (UNLIKELY(ec))
V8Proxy::setDOMException(ec, info.GetIsolate());
}
@@ -142,7 +142,7 @@
// FIXME: Handle exceptions correctly.
String search = toWebCoreString(value);
- impl->setSearch(search, activeWindow(state), firstWindow(state));
+ impl->setSearch(search, activeDOMWindow(state), firstDOMWindow(state));
}
v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -206,7 +206,7 @@
Location* impl = V8Location::toNative(args.Holder());
BindingState* state = BindingState::instance();
- impl->reload(activeWindow(state));
+ impl->reload(activeDOMWindow(state));
return v8::Undefined();
}
@@ -219,7 +219,7 @@
// FIXME: Handle exceptions correctly.
String urlString = toWebCoreString(args[0]);
- impl->replace(urlString, activeWindow(state), firstWindow(state));
+ impl->replace(urlString, activeDOMWindow(state), firstDOMWindow(state));
return v8::Undefined();
}
@@ -232,7 +232,7 @@
// FIXME: Handle exceptions correctly.
String urlString = toWebCoreString(args[0]);
- impl->assign(urlString, activeWindow(state), firstWindow(state));
+ impl->assign(urlString, activeDOMWindow(state), firstDOMWindow(state));
return v8::Undefined();
}