WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-112681-20130319185722.patch (text/plain), 26.99 KB, created by
Mike West
on 2013-03-19 11:01:32 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Mike West
Created:
2013-03-19 11:01:32 PDT
Size:
26.99 KB
patch
obsolete
>Subversion Revision: 146216 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0363f3e7588d1f8a36608d185f84d34b9fb85f57..fe69109c6d6e633a28e12acb465ee24f8b4d65e6 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,68 @@ >+2013-03-19 Mike West <mkwst@chromium.org> >+ >+ CSP 1.1: Stub out SecurityPolicyViolationEvent interface. >+ https://bugs.webkit.org/show_bug.cgi?id=112681 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ A first pass at a SecurityPolicyViolationEvent interface is defined in >+ CSP 1.1's editor's draft[1]. This patch puts the big components into >+ place so that we can start getting some implementation experience with >+ the new event interface as it's defined, and feed that back into the >+ working group. >+ >+ Here, we're only defining the interface, and creating a listener on the >+ Document. Events aren't yet being fired when Content Security Policy >+ violations occur. I'll tackle that in a future patch; adding files is >+ a big enough annoyance to do it separately. >+ >+ This patch has only two web-visible impacts: >+ >+ - Document objects now have an 'onsecuritypolicyviolation' attribute. >+ - A SecurityPolicyViolationEvent constructor is accessible on the Window object. >+ >+ Ports that have not enabled the CSP_NEXT flag should experience no change. >+ >+ [1]: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#securitypolicyviolationevent-events >+ >+ Test: http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html >+ >+ * CMakeLists.txt: >+ * GNUmakefile.list.am: >+ * WebCore.gypi: >+ * WebCore.vcproj/WebCore.vcproj: >+ * WebCore.xcodeproj/project.pbxproj: >+ Wow! A new file! This is so exciting! I'm going to tell ALL my build >+ systems about this! >+ * dom/Document.h: >+ * dom/Document.idl: >+ Define an 'onsecuritypolicyviolation' event handler on Document objects. >+ * dom/EventNames.h: >+ * dom/EventNames.in: >+ Define a 'securitypolicyviolation' event type. >+ * dom/SecurityPolicyViolationEvent.h: Added. >+ (WebCore::SecurityPolicyViolationEventInit::SecurityPolicyViolationEventInit): >+ (SecurityPolicyViolationEventInit): >+ (SecurityPolicyViolationEvent): >+ (WebCore::SecurityPolicyViolationEvent::create): >+ (WebCore::SecurityPolicyViolationEvent::documentURI): >+ (WebCore::SecurityPolicyViolationEvent::referrer): >+ (WebCore::SecurityPolicyViolationEvent::blockedURI): >+ (WebCore::SecurityPolicyViolationEvent::violatedDirective): >+ (WebCore::SecurityPolicyViolationEvent::effectiveDirective): >+ (WebCore::SecurityPolicyViolationEvent::originalPolicy): >+ (WebCore::SecurityPolicyViolationEvent::sourceURL): >+ (WebCore::SecurityPolicyViolationEvent::lineNumber): >+ (WebCore::SecurityPolicyViolationEvent::interfaceName): >+ (WebCore::SecurityPolicyViolationEvent::SecurityPolicyViolationEvent): >+ * dom/SecurityPolicyViolationEvent.idl: Added. >+ Define the SecurityPolicyViolationEvent's IDL, and then create all the >+ boilerplate necessary to properly initialize a SecurityPolicyViolationEvent >+ object with the relevant properties. >+ * page/DOMWindow.idl: >+ Add the new SecurityPolicyViolationEvent constructor to the Window object >+ so it's available on a page. >+ > 2013-03-19 Nate Chapin <japhet@chromium.org> > > Merge MainResourceLoader::responseReceived into DocumentLoader >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index ce25ee692a674d6de619469341ad5fdfc19eb635..0a44f58de7125a3bb96fa456d96680c1da4ac100 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -385,6 +385,7 @@ set(WebCore_IDL_FILES > dom/RangeException.idl > dom/Range.idl > dom/RequestAnimationFrameCallback.idl >+ dom/SecurityPolicyViolationEvent.idl > dom/ShadowRoot.idl > dom/StringCallback.idl > dom/TextEvent.idl >diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am >index ff38c43840ca57f839069687deba2893dd1b41b9..4cd1fc39c25302fd2ed8a0870c7a1d56cc805c16 100644 >--- a/Source/WebCore/GNUmakefile.list.am >+++ b/Source/WebCore/GNUmakefile.list.am >@@ -675,6 +675,8 @@ webcore_built_sources += \ > DerivedSources/WebCore/JSScriptProfile.h \ > DerivedSources/WebCore/JSScriptProfileNode.cpp \ > DerivedSources/WebCore/JSScriptProfileNode.h \ >+ DerivedSources/WebCore/JSSecurityPolicyViolationEvent.cpp \ >+ DerivedSources/WebCore/JSSecurityPolicyViolationEvent.h \ > DerivedSources/WebCore/JSShadowRoot.cpp \ > DerivedSources/WebCore/JSShadowRoot.h \ > DerivedSources/WebCore/JSSharedWorkerContext.cpp \ >@@ -1426,6 +1428,7 @@ dom_binding_idls += \ > $(WebCore)/dom/Range.idl \ > $(WebCore)/dom/RangeException.idl \ > $(WebCore)/dom/RequestAnimationFrameCallback.idl \ >+ $(WebCore)/dom/SecurityPolicyViolationEvent.idl \ > $(WebCore)/dom/ShadowRoot.idl \ > $(WebCore)/dom/StringCallback.idl \ > $(WebCore)/dom/Text.idl \ >@@ -3032,6 +3035,7 @@ webcore_sources += \ > Source/WebCore/dom/ScriptRunner.h \ > Source/WebCore/dom/SecurityContext.cpp \ > Source/WebCore/dom/SecurityContext.h \ >+ Source/WebCore/dom/SecurityPolicyViolationEvent.h \ > Source/WebCore/dom/SelectorQuery.cpp \ > Source/WebCore/dom/SelectorQuery.h \ > Source/WebCore/dom/ShadowRoot.cpp \ >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 35a516546a6e36a0cf293b72ae39cc07d96df374..4ef5da709ead92a6cdff5c95b7f98870a629f5af 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -338,6 +338,7 @@ > 'dom/Range.idl', > 'dom/RangeException.idl', > 'dom/RequestAnimationFrameCallback.idl', >+ 'dom/SecurityPolicyViolationEvent.idl', > 'dom/ShadowRoot.idl', > 'dom/StringCallback.idl', > 'dom/Text.idl', >@@ -3068,6 +3069,7 @@ > 'dom/ScriptedAnimationController.h', > 'dom/SecurityContext.cpp', > 'dom/SecurityContext.h', >+ 'dom/SecurityPolicyViolationEvent.h', > 'dom/SelectorQuery.cpp', > 'dom/SelectorQuery.h', > 'dom/ShadowRoot.cpp', >@@ -7238,6 +7240,8 @@ > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSScriptProfile.h', > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSScriptProfileNode.cpp', > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSScriptProfileNode.h', >+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSecurityPolicyViolationEvent.cpp', >+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSecurityPolicyViolationEvent.h', > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSharedWorker.cpp', > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSharedWorker.h', > '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSharedWorkerContext.cpp', >diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >index d11863d7044ee900e977a5964e0fee2416d45c8f..b8265d9355fb451ace0ebe7fae18ceb610503264 100755 >--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj >+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj >@@ -13859,6 +13859,62 @@ > </FileConfiguration> > </File> > <File >+ RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSSecurityPolicyViolationEvent.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="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSSecurityPolicyViolationEvent.h" >+ > >+ </File> >+ <File > RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSShadowRoot.h" > > > </File> >@@ -55315,6 +55371,10 @@ > > > </File> > <File >+ RelativePath="..\dom\SecurityPolicyViolationEvent.h" >+ > >+ </File> >+ <File > RelativePath="..\dom\SelectorQuery.cpp" > > > <FileConfiguration >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 6614de123b3f345f9ef3f8a26f4a634fa9b94303..d05dc55ff3f714811625187f9be25385cb653067 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -795,6 +795,7 @@ > 2D481F04146B5C6B00AA7834 /* GeneratorGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */; }; > 2D5A592F152525230036EE51 /* ImageOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */; }; > 2D5A5931152525D00036EE51 /* ImageOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748D6612CC3763001FBA41 /* ImageOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */; }; > 2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */; }; > 2D8287F716E4A0380086BD00 /* HitTestLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8287F516E4A0380086BD00 /* HitTestLocation.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 2D8FEBDC143E3EF70072502B /* CSSCrossfadeValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */; }; >@@ -8186,6 +8187,8 @@ > 2D2FC0561460CD6F00263633 /* GeneratorGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeneratorGeneratedImage.cpp; sourceTree = "<group>"; }; > 2D2FC0571460CD6F00263633 /* GeneratorGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratorGeneratedImage.h; sourceTree = "<group>"; }; > 2D3A0E3513A7D76100E85AF0 /* SVGParsingError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGParsingError.h; sourceTree = "<group>"; }; >+ 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicyViolationEvent.h; sourceTree = "<group>"; }; >+ 2D5BC42616F882BE007048D0 /* SecurityPolicyViolationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecurityPolicyViolationEvent.idl; sourceTree = "<group>"; }; > 2D8287F416E4A0380086BD00 /* HitTestLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestLocation.cpp; sourceTree = "<group>"; }; > 2D8287F516E4A0380086BD00 /* HitTestLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestLocation.h; sourceTree = "<group>"; }; > 2D8FEBDA143E3EF70072502B /* CSSCrossfadeValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCrossfadeValue.cpp; sourceTree = "<group>"; }; >@@ -22914,6 +22917,8 @@ > 8A413ADE1207BBA50082016E /* ScriptRunner.h */, > 976F36E814686225005E93B4 /* SecurityContext.cpp */, > 976F36E914686225005E93B4 /* SecurityContext.h */, >+ 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */, >+ 2D5BC42616F882BE007048D0 /* SecurityPolicyViolationEvent.idl */, > E45322A9140CE267005A0F92 /* SelectorQuery.cpp */, > E45322AA140CE267005A0F92 /* SelectorQuery.h */, > A6D169611346B49B000EB770 /* ShadowRoot.cpp */, >@@ -26771,6 +26776,7 @@ > 977E2E0F12F0FC9C00C13380 /* XSSAuditorDelegate.h in Headers */, > FD537353137B651800008DCE /* ZeroPole.h in Headers */, > DAED203116F244480070EC0F /* PageConsole.h in Headers */, >+ 2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */, > ); > runOnlyForDeploymentPostprocessing = 0; > }; >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index fbca0c2b49bf3e0bf1614ffbe7a9346afaa1ef2c..302deb1ac30c7d4ecc8e343bc9b84e4ac46a753f 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -307,6 +307,9 @@ public: > #if ENABLE(PAGE_VISIBILITY_API) > DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitvisibilitychange); > #endif >+#if ENABLE(CSP_NEXT) >+ DEFINE_ATTRIBUTE_EVENT_LISTENER(securitypolicyviolation); >+#endif > > void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; } > ViewportArguments viewportArguments() const { return m_viewportArguments; } >diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl >index a4f053c90162c4cd1017fa6e56471d7ed33a3f83..c9df3740195d21248eb7de0f2233eda6099b67ba 100644 >--- a/Source/WebCore/dom/Document.idl >+++ b/Source/WebCore/dom/Document.idl >@@ -341,6 +341,7 @@ > [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventListener onwebkitfullscreenerror; > [NotEnumerable, Conditional=POINTER_LOCK] attribute EventListener onwebkitpointerlockchange; > [NotEnumerable, Conditional=POINTER_LOCK] attribute EventListener onwebkitpointerlockerror; >+ [NotEnumerable, Conditional=CSP_NEXT, V8EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] attribute EventListener onsecuritypolicyviolation; > #endif > > #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS >diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h >index 3b5f232224e39cbcad13a39797427b6909cd2cb4..9f0b4b13064e3875954d9ae785ee3b55fc8bdb48 100644 >--- a/Source/WebCore/dom/EventNames.h >+++ b/Source/WebCore/dom/EventNames.h >@@ -259,6 +259,8 @@ namespace WebCore { > macro(webkitprerenderload) \ > macro(webkitprerenderdomcontentloaded) \ > \ >+ macro(securitypolicyviolation) \ >+ \ > > // end of DOM_EVENT_NAMES_FOR_EACH > >diff --git a/Source/WebCore/dom/EventNames.in b/Source/WebCore/dom/EventNames.in >index fb74ef69e81e4672f2840db797d7018dc046c2a5..124ef53fc016fe7774dd3ab5b0a26c077e85750d 100644 >--- a/Source/WebCore/dom/EventNames.in >+++ b/Source/WebCore/dom/EventNames.in >@@ -57,3 +57,4 @@ MediaKeyNeededEvent conditional=ENCRYPTED_MEDIA_V2 > TrackEvent conditional=VIDEO_TRACK > AutocompleteErrorEvent conditional=REQUEST_AUTOCOMPLETE > CSSFontFaceLoadEvent conditional=FONT_LOAD_EVENTS >+SecurityPolicyViolationEvent conditional=CSP_NEXT >diff --git a/Source/WebCore/dom/SecurityPolicyViolationEvent.h b/Source/WebCore/dom/SecurityPolicyViolationEvent.h >new file mode 100644 >index 0000000000000000000000000000000000000000..497cf894ee999abb64e241b6cab55d5f0c71b579 >--- /dev/null >+++ b/Source/WebCore/dom/SecurityPolicyViolationEvent.h >@@ -0,0 +1,114 @@ >+/* >+ * Copyright (C) 2013 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: >+ * 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 SecurityPolicyViolationEvent_h >+#define SecurityPolicyViolationEvent_h >+ >+#include "Event.h" >+#include "EventNames.h" >+ >+namespace WebCore { >+ >+struct SecurityPolicyViolationEventInit : public EventInit { >+ SecurityPolicyViolationEventInit() >+ { >+ } >+ >+ String documentURI; >+ String referrer; >+ String blockedURI; >+ String violatedDirective; >+ String effectiveDirective; >+ String originalPolicy; >+ String sourceURL; >+ int lineNumber; >+}; >+ >+class SecurityPolicyViolationEvent : public Event { >+public: >+ static PassRefPtr<SecurityPolicyViolationEvent> create() >+ { >+ return adoptRef(new SecurityPolicyViolationEvent); >+ } >+ >+ static PassRefPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer) >+ { >+ return adoptRef(new SecurityPolicyViolationEvent(type, initializer)); >+ } >+ >+ const String& documentURI() const { return m_documentURI; } >+ const String& referrer() const { return m_referrer; } >+ const String& blockedURI() const { return m_blockedURI; } >+ const String& violatedDirective() const { return m_violatedDirective; } >+ const String& effectiveDirective() const { return m_effectiveDirective; } >+ const String& originalPolicy() const { return m_originalPolicy; } >+ const String& sourceURL() const { return m_sourceURL; } >+ int lineNumber() const { return m_lineNumber; } >+ >+ virtual const AtomicString& interfaceName() const { return eventNames().interfaceForSecurityPolicyViolationEvent; } >+ >+private: >+ SecurityPolicyViolationEvent() >+ { >+ } >+ >+ SecurityPolicyViolationEvent(const String& documentURI, const String& referrer, const String& blockedURI, const String& violatedDirective, const String& effectiveDirective, const String& originalPolicy, const String& sourceURL, int lineNumber) >+ : Event(eventNames().securitypolicyviolationEvent, false, false) >+ , m_documentURI(documentURI) >+ , m_referrer(referrer) >+ , m_blockedURI(blockedURI) >+ , m_violatedDirective(violatedDirective) >+ , m_effectiveDirective(effectiveDirective) >+ , m_originalPolicy(originalPolicy) >+ , m_sourceURL(sourceURL) >+ , m_lineNumber(lineNumber) >+ { >+ } >+ >+ SecurityPolicyViolationEvent(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer) >+ : Event(type, initializer) >+ , m_documentURI(initializer.documentURI) >+ , m_referrer(initializer.referrer) >+ , m_blockedURI(initializer.blockedURI) >+ , m_violatedDirective(initializer.violatedDirective) >+ , m_effectiveDirective(initializer.effectiveDirective) >+ , m_originalPolicy(initializer.originalPolicy) >+ , m_sourceURL(initializer.sourceURL) >+ , m_lineNumber(initializer.lineNumber) >+ { >+ } >+ >+ String m_documentURI; >+ String m_referrer; >+ String m_blockedURI; >+ String m_violatedDirective; >+ String m_effectiveDirective; >+ String m_originalPolicy; >+ String m_sourceURL; >+ int m_lineNumber; >+}; >+ >+} // namespace WebCore >+ >+#endif // SecurityPolicyViolationEvent_h >diff --git a/Source/WebCore/dom/SecurityPolicyViolationEvent.idl b/Source/WebCore/dom/SecurityPolicyViolationEvent.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..a9eeb3eaac1233c27e07f0b87b907f40b1ab8a6b >--- /dev/null >+++ b/Source/WebCore/dom/SecurityPolicyViolationEvent.idl >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2013 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: >+ * 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. >+ */ >+ >+[ >+ Conditional=CSP_NEXT, >+ ConstructorTemplate=Event, >+] interface SecurityPolicyViolationEvent : Event { >+ [InitializedByEventConstructor] readonly attribute DOMString documentURI; >+ [InitializedByEventConstructor] readonly attribute DOMString referrer; >+ [InitializedByEventConstructor] readonly attribute DOMString blockedURI; >+ [InitializedByEventConstructor] readonly attribute DOMString violatedDirective; >+ [InitializedByEventConstructor] readonly attribute DOMString effectiveDirective; >+ [InitializedByEventConstructor] readonly attribute DOMString originalPolicy; >+ [InitializedByEventConstructor] readonly attribute DOMString sourceURL; >+ [InitializedByEventConstructor] readonly attribute long lineNumber; >+}; >diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl >index 98374ccb9495f0b09e517b10be199e4638e841d6..95ff750beb6cc8b9e6d463ca8011549f871ad89f 100644 >--- a/Source/WebCore/page/DOMWindow.idl >+++ b/Source/WebCore/page/DOMWindow.idl >@@ -570,6 +570,7 @@ > [Conditional=WEBGL] attribute WebGLContextEventConstructor WebGLContextEvent; > [Conditional=PROXIMITY_EVENTS] attribute DeviceProximityEventConstructor DeviceProximityEvent; > [Conditional=REQUEST_AUTOCOMPLETE] attribute AutocompleteErrorEventConstructor AutocompleteErrorEvent; >+ [Conditional=CSP_NEXT, V8EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] attribute SecurityPolicyViolationEventConstructor SecurityPolicyViolationEvent; > > attribute EventExceptionConstructor EventException; > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 24749d2f7b7aee509f69a5e93859fd0746b587a7..73b0c68104c3b0c985a6dff6d783ba9f56906846 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2013-03-19 Mike West <mkwst@chromium.org> >+ >+ CSP 1.1: Stub out SecurityPolicyViolationEvent interface. >+ https://bugs.webkit.org/show_bug.cgi?id=112681 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt: Added. >+ * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html: Added. >+ Simple test which checks only that events are created correctly, >+ and that the event handler exists on Document. We'll test the >+ real functionality once we wire the event up to the handler. >+ > 2013-03-19 Zan Dobersek <zdobersek@igalia.com> > > Unreviewed GTK gardening, >diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..95581f2903af867ec64531f7c97cf9910c17a071 >--- /dev/null >+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt >@@ -0,0 +1,20 @@ >+Check that a SecurityPolicyViolationEvent handler exists, and that events can be created. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS typeof document.onsecuritypolicyviolation is "object" >+PASS typeof SecurityPolicyViolationEvent is "function" >+PASS typeof window.e is "object" >+PASS window.e.documentURI is "documentURIValue" >+PASS window.e.referrer is "referrerValue" >+PASS window.e.blockedURI is "blockedURIValue" >+PASS window.e.violatedDirective is "violatedDirectiveValue" >+PASS window.e.effectiveDirective is "effectiveDirectiveValue" >+PASS window.e.originalPolicy is "originalPolicyValue" >+PASS window.e.sourceURL is "sourceURLValue" >+PASS window.e.lineNumber is 1 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html >new file mode 100644 >index 0000000000000000000000000000000000000000..cb80dd51fa9390cd5f44ce0a9aac8ad2b6e06977 >--- /dev/null >+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test-pre.js"></script> >+ <script> >+ description('Check that a SecurityPolicyViolationEvent handler exists, and that events can be created.'); >+ >+ try { >+ shouldBeEqualToString('typeof document.onsecuritypolicyviolation', 'object'); >+ shouldBeEqualToString('typeof SecurityPolicyViolationEvent', 'function'); >+ var data = { >+ 'documentURI': 'documentURIValue', >+ 'referrer': 'referrerValue', >+ 'blockedURI': 'blockedURIValue', >+ 'violatedDirective': 'violatedDirectiveValue', >+ 'effectiveDirective': 'effectiveDirectiveValue', >+ 'originalPolicy': 'originalPolicyValue', >+ 'sourceURL': 'sourceURLValue', >+ 'lineNumber': 1 >+ }; >+ window.e = new SecurityPolicyViolationEvent('SecurityPolicyViolation', data); >+ shouldBeEqualToString('typeof window.e', 'object'); >+ for (key in data) >+ shouldBe('window.e.' + key, JSON.stringify(data[key])); >+ } catch (ex) { >+ testFailed('Exception thrown: ' + ex.message); >+ } >+ </script> >+ <script src="/js-test-resources/js-test-post.js"></script> >+</head> >+<body> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 112681
:
193819
|
193867
|
193919