Source/WebCore/ChangeLog

 12016-02-24 Daniel Bates <dabates@apple.com>
 2
 3 CSP: Make SecurityPolicyViolationEvent more closely conform to CSP spec and enable it by default
 4 https://bugs.webkit.org/show_bug.cgi?id=154522
 5 <rdar://problem/24762078>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Include attributes statusCode and columnNumber in a dispatched SecurityPolicyViolationEvent and
 10 as part of the SecurityPolicyViolationEventInit dictionary as per section Violation DOM Events
 11 of the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp/> (24 February 2016).
 12 Additionally, enable dispatching of this event when a Content Security Policy violation occurs regardless
 13 of whether ENABLE(CSP_NEXT) is enabled.
 14
 15 Test: http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html
 16
 17 * WebCore.xcodeproj/project.pbxproj: Add files JSSecurityPolicyViolationEvent.{cpp, h}.
 18 * dom/EventNames.in: Enable support for SecurityPolicyViolationEvent unconditionally.
 19 * dom/SecurityPolicyViolationEvent.h: Remove ENABLE(CSP_NEXT)-guard so that we compile this
 20 code unconditionally. Modified SecurityPolicyViolationEventInit and SecurityPolicyViolationEvent
 21 to support attributes statusCode and columnNumebr.
 22 * dom/SecurityPolicyViolationEvent.idl: Add attributes statusCode and columnNumber.
 23 * page/csp/ContentSecurityPolicy.cpp:
 24 (WebCore::ContentSecurityPolicy::reportViolation): Modified to both dispatch a SecurityPolicyViolationEvent
 25 and send a violation report (if applicable).
 26
1272016-02-23 Daniel Bates <dabates@apple.com>
228
329 CSP: Enable base-uri directive by default

Source/WebCore/WebCore.xcodeproj/project.pbxproj

62336233 CECADFCD1537791D00E37068 /* TextInsertionBaseCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CECADFCB1537791D00E37068 /* TextInsertionBaseCommand.cpp */; };
62346234 CECADFCE1537791D00E37068 /* TextInsertionBaseCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = CECADFCC1537791D00E37068 /* TextInsertionBaseCommand.h */; };
62356235 CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */ = {isa = PBXBuildFile; fileRef = CECCFC3A141973D5002A0AC1 /* DecodeEscapeSequences.h */; };
 6236 CED06AD01C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CED06ACE1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp */; };
 6237 CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = CED06ACF1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h */; };
62366238 CEDA12D7152CA1CB00D9E08D /* AlternativeTextClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CEDA12D6152CA1CB00D9E08D /* AlternativeTextClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
62376239 CEE27ACB1BBB53A20072400A /* pthreadSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CEE27ACA1BBB53A20072400A /* pthreadSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
62386240 CEEFCD7919DB31F7003876D7 /* MediaResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEEFCD7719DB31F7003876D7 /* MediaResourceLoader.cpp */; };

1423114233 CECADFCB1537791D00E37068 /* TextInsertionBaseCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextInsertionBaseCommand.cpp; sourceTree = "<group>"; };
1423214234 CECADFCC1537791D00E37068 /* TextInsertionBaseCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInsertionBaseCommand.h; sourceTree = "<group>"; };
1423314235 CECCFC3A141973D5002A0AC1 /* DecodeEscapeSequences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecodeEscapeSequences.h; sourceTree = "<group>"; };
 14236 CED06ACE1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSecurityPolicyViolationEvent.cpp; sourceTree = "<group>"; };
 14237 CED06ACF1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSecurityPolicyViolationEvent.h; sourceTree = "<group>"; };
1423414238 CEDA12D6152CA1CB00D9E08D /* AlternativeTextClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlternativeTextClient.h; sourceTree = "<group>"; };
1423514239 CEE27ACA1BBB53A20072400A /* pthreadSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pthreadSPI.h; sourceTree = "<group>"; };
1423614240 CEEC6034187DD962003E43BB /* TextTrackRepresentationIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentationIOS.h; sourceTree = "<group>"; };

2089820902 E1284BAF10449FFA00EAEB52 /* JSPageTransitionEvent.h */,
2089920903 5189F01B10B37BD900F3C739 /* JSPopStateEvent.cpp */,
2090020904 5189F01C10B37BD900F3C739 /* JSPopStateEvent.h */,
 20905 CED06ACE1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp */,
 20906 CED06ACF1C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h */,
2090120907 933A14B60B7D1D5200A53FFD /* JSTextEvent.cpp */,
2090220908 933A14B70B7D1D5200A53FFD /* JSTextEvent.h */,
2090320909 0FDA7C10188322EB00C954B5 /* JSTouch.cpp */,

2672726733 FDA15ECE12B03F61003A583A /* JSScriptProcessorNode.h in Headers */,
2672826734 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */,
2672926735 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */,
 26736 CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */,
2673026737 9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */,
2673126738 CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */,
2673226739 CD9DE17D17AAC75B00EA386D /* JSSourceBufferList.h in Headers */,

3047430481 FDA15ECD12B03F61003A583A /* JSScriptProcessorNode.cpp in Sources */,
3047530482 9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */,
3047630483 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */,
 30484 CED06AD01C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.cpp in Sources */,
3047730485 9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */,
3047830486 CD9DE17A17AAC75B00EA386D /* JSSourceBuffer.cpp in Sources */,
3047930487 CD9DE17C17AAC75B00EA386D /* JSSourceBufferList.cpp in Sources */,

Source/WebCore/dom/EventNames.in

@@MediaKeyNeededEvent conditional=ENCRYPTED_MEDIA_V2
5757TrackEvent conditional=VIDEO_TRACK
5858AutocompleteErrorEvent conditional=REQUEST_AUTOCOMPLETE
5959CSSFontFaceLoadEvent conditional=FONT_LOAD_EVENTS
60 SecurityPolicyViolationEvent conditional=CSP_NEXT
 60SecurityPolicyViolationEvent
6161UIRequestEvent conditional=INDIE_UI
6262GestureEvent conditional=IOS_GESTURE_EVENTS|MAC_GESTURE_EVENTS
6363WebKitPlaybackTargetAvailabilityEvent conditional=WIRELESS_PLAYBACK_TARGET

Source/WebCore/dom/SecurityPolicyViolationEvent.h

11/*
22 * Copyright (C) 2013 Google Inc. All rights reserved.
 3 * Copyright (C) 2016 Apple Inc. All rights reserved.
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions

2526#ifndef SecurityPolicyViolationEvent_h
2627#define SecurityPolicyViolationEvent_h
2728
28 #if ENABLE(CSP_NEXT)
29 
3029#include "Event.h"
3130
3231namespace WebCore {

@@struct SecurityPolicyViolationEventInit : public EventInit {
3938 String effectiveDirective;
4039 String originalPolicy;
4140 String sourceFile;
 41 unsigned short statusCode { 0 };
4242 int lineNumber { 0 };
 43 int columnNumber { 0 };
4344};
4445
4546class SecurityPolicyViolationEvent final : public Event {
4647public:
47  static Ref<SecurityPolicyViolationEvent> create(const AtomicString& type, bool canBubble, bool cancelable, const String& documentURI, const String& referrer, const String& blockedURI, const String& violatedDirective, const String& effectiveDirective, const String& originalPolicy, const String& sourceFile, int lineNumber)
 48 static Ref<SecurityPolicyViolationEvent> create(const AtomicString& type, bool canBubble, bool cancelable, const String& documentURI, const String& referrer, const String& blockedURI, const String& violatedDirective, const String& effectiveDirective, const String& originalPolicy, const String& sourceFile, unsigned short statusCode, int lineNumber, int columnNumber)
4849 {
49  return adoptRef(*new SecurityPolicyViolationEvent(type, canBubble, cancelable, documentURI, referrer, blockedURI, violatedDirective, effectiveDirective, originalPolicy, sourceFile, lineNumber));
 50 return adoptRef(*new SecurityPolicyViolationEvent(type, canBubble, cancelable, documentURI, referrer, blockedURI, violatedDirective, effectiveDirective, originalPolicy, sourceFile, statusCode, lineNumber, columnNumber));
5051 }
5152
5253 static Ref<SecurityPolicyViolationEvent> createForBindings()

@@public:
6667 const String& effectiveDirective() const { return m_effectiveDirective; }
6768 const String& originalPolicy() const { return m_originalPolicy; }
6869 const String& sourceFile() const { return m_sourceFile; }
 70 unsigned short statusCode() const { return m_statusCode; }
6971 int lineNumber() const { return m_lineNumber; }
 72 int columnNumber() const { return m_columnNumber; }
7073
7174 virtual EventInterface eventInterface() const { return SecurityPolicyViolationEventInterfaceType; }
7275

@@private:
7578 {
7679 }
7780
78  SecurityPolicyViolationEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& documentURI, const String& referrer, const String& blockedURI, const String& violatedDirective, const String& effectiveDirective, const String& originalPolicy, const String& sourceFile, int lineNumber)
 81 SecurityPolicyViolationEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& documentURI, const String& referrer, const String& blockedURI, const String& violatedDirective, const String& effectiveDirective, const String& originalPolicy, const String& sourceFile, unsigned short statusCode, int lineNumber, int columnNumber)
7982 : Event(type, canBubble, cancelable)
8083 , m_documentURI(documentURI)
8184 , m_referrer(referrer)

@@private:
8487 , m_effectiveDirective(effectiveDirective)
8588 , m_originalPolicy(originalPolicy)
8689 , m_sourceFile(sourceFile)
 90 , m_statusCode(statusCode)
8791 , m_lineNumber(lineNumber)
 92 , m_columnNumber(columnNumber)
8893 {
8994 }
9095

@@private:
97102 , m_effectiveDirective(initializer.effectiveDirective)
98103 , m_originalPolicy(initializer.originalPolicy)
99104 , m_sourceFile(initializer.sourceFile)
 105 , m_statusCode(initializer.statusCode)
100106 , m_lineNumber(initializer.lineNumber)
 107 , m_columnNumber(initializer.columnNumber)
101108 {
102109 }
103110

@@private:
108115 String m_effectiveDirective;
109116 String m_originalPolicy;
110117 String m_sourceFile;
 118 unsigned short m_statusCode;
111119 int m_lineNumber;
 120 int m_columnNumber;
112121};
113122
114123} // namespace WebCore
115124
116 #endif // ENABLE(CSP_NEXT)
117 
118125#endif // SecurityPolicyViolationEvent_h

Source/WebCore/dom/SecurityPolicyViolationEvent.idl

11/*
22 * Copyright (C) 2013 Google Inc. All rights reserved.
 3 * Copyright (C) 2016 Apple Inc. All rights reserved.
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions

2324 */
2425
2526[
26  Conditional=CSP_NEXT,
2727 ConstructorTemplate=Event,
2828] interface SecurityPolicyViolationEvent : Event {
2929 [InitializedByEventConstructor] readonly attribute DOMString documentURI;

3333 [InitializedByEventConstructor] readonly attribute DOMString effectiveDirective;
3434 [InitializedByEventConstructor] readonly attribute DOMString originalPolicy;
3535 [InitializedByEventConstructor] readonly attribute DOMString sourceFile;
36  [InitializedByEventConstructor] readonly attribute long lineNumber;
 36 [InitializedByEventConstructor] readonly attribute unsigned short statusCode;
 37 [InitializedByEventConstructor] readonly attribute long lineNumber;
 38 [InitializedByEventConstructor] readonly attribute long columnNumber;
3739};

Source/WebCore/page/csp/ContentSecurityPolicy.cpp

@@void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
342342 if (!frame)
343343 return;
344344
345 #if ENABLE(CSP_NEXT)
346  if (experimentalFeaturesEnabled()) {
347  // FIXME: This code means that we're gathering information like line numbers twice. Once we can bring this out from behind the flag, we should reuse the data gathered here when generating the JSON report below.
348  String documentURI = document.url().string();
349  String referrer = document.referrer();
350  String blockedURI = stripURLForUseInReport(document, blockedURL);
351  String violatedDirective = directiveText;
352  String originalPolicy = header;
353  String sourceFile = String();
354  int lineNumber = 0;
355 
356  Ref<ScriptCallStack> stack = createScriptCallStack(JSMainThreadExecState::currentState(), 2);
357  const ScriptCallFrame* callFrame = stack->firstNonNativeCallFrame();
358  if (callFrame && callFrame->lineNumber()) {
359  URL source = URL(URL(), callFrame->sourceURL());
360  sourceFile = stripURLForUseInReport(document, source);
361  lineNumber = callFrame->lineNumber();
362  }
363 
364  document.enqueueDocumentEvent(SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, false, false, documentURI, referrer, blockedURI, violatedDirective, effectiveDirective, originalPolicy, sourceFile, lineNumber));
 345 String documentURI = document.url().strippedForUseAsReferrer();
 346 String referrer = document.referrer();
 347 String blockedURI = stripURLForUseInReport(document, blockedURL);
 348 String violatedDirective = directiveText;
 349 String originalPolicy = header;
 350 ASSERT(document.loader());
 351 unsigned short statusCode = document.url().protocolIs("http") && document.loader() ? document.loader()->response().httpStatusCode() : 0;
 352
 353 String sourceFile;
 354 int lineNumber;
 355 int columnNumber;
 356 RefPtr<ScriptCallStack> stack = createScriptCallStack(JSMainThreadExecState::currentState(), 2);
 357 const ScriptCallFrame* callFrame = stack->firstNonNativeCallFrame();
 358 if (callFrame && callFrame->lineNumber()) {
 359 sourceFile = stripURLForUseInReport(document, URL(URL(), callFrame->sourceURL()));
 360 lineNumber = callFrame->lineNumber();
 361 columnNumber = callFrame->columnNumber();
 362 } else {
 363 lineNumber = 0;
 364 columnNumber = 0;
365365 }
366 #endif
367366
 367 // 1. Dispatch violation event.
 368 bool canBubble = false;
 369 bool cancelable = false;
 370 document.enqueueDocumentEvent(SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, canBubble, cancelable, documentURI, referrer, blockedURI, violatedDirective, effectiveDirective, originalPolicy, sourceFile, statusCode, lineNumber, columnNumber));
 371
 372 // 2. Send violation report (if applicable).
368373 if (reportURIs.isEmpty())
369374 return;
370375

@@void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
379384 // harmless information.
380385
381386 RefPtr<InspectorObject> cspReport = InspectorObject::create();
382  cspReport->setString(ASCIILiteral("document-uri"), document.url().strippedForUseAsReferrer());
383  cspReport->setString(ASCIILiteral("referrer"), document.referrer());
 387 cspReport->setString(ASCIILiteral("document-uri"), documentURI);
 388 cspReport->setString(ASCIILiteral("referrer"), referrer);
384389 cspReport->setString(ASCIILiteral("violated-directive"), directiveText);
385390 cspReport->setString(ASCIILiteral("effective-directive"), effectiveDirective);
386  cspReport->setString(ASCIILiteral("original-policy"), header);
387  cspReport->setString(ASCIILiteral("blocked-uri"), stripURLForUseInReport(document, blockedURL));
388 
389  ASSERT(document.loader());
390  cspReport->setInteger(ASCIILiteral("status-code"), document.url().protocolIs("http") && document.loader() ? document.loader()->response().httpStatusCode() : 0);
391 
392  RefPtr<ScriptCallStack> stack = createScriptCallStack(JSMainThreadExecState::currentState(), 2);
393  const ScriptCallFrame* callFrame = stack->firstNonNativeCallFrame();
394  if (callFrame && callFrame->lineNumber()) {
395  URL source = URL(URL(), callFrame->sourceURL());
396  cspReport->setString(ASCIILiteral("source-file"), stripURLForUseInReport(document, source));
397  cspReport->setInteger(ASCIILiteral("line-number"), callFrame->lineNumber());
398  cspReport->setInteger(ASCIILiteral("column-number"), callFrame->columnNumber());
 391 cspReport->setString(ASCIILiteral("original-policy"), originalPolicy);
 392 cspReport->setString(ASCIILiteral("blocked-uri"), blockedURI);
 393 cspReport->setInteger(ASCIILiteral("status-code"), statusCode);
 394 if (!sourceFile.isNull()) {
 395 cspReport->setString(ASCIILiteral("source-file"), sourceFile);
 396 cspReport->setInteger(ASCIILiteral("line-number"), lineNumber);
 397 cspReport->setInteger(ASCIILiteral("column-number"), columnNumber);
399398 }
400399
401400 RefPtr<InspectorObject> reportObject = InspectorObject::create();
402401 reportObject->setObject(ASCIILiteral("csp-report"), cspReport.release());
403402
404403 RefPtr<FormData> report = FormData::create(reportObject->toJSONString().utf8());
405 
406404 for (const auto& url : reportURIs)
407405 PingLoader::sendViolationReport(*frame, document.completeURL(url), report.copyRef(), ViolationReportType::ContentSecurityPolicy);
408406}

LayoutTests/ChangeLog

 12016-02-24 Daniel Bates <dabates@apple.com>
 2
 3 CSP: Make SecurityPolicyViolationEvent more closely conform to CSP spec and enable it by default
 4 https://bugs.webkit.org/show_bug.cgi?id=154522
 5 <rdar://problem/24762078>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Add new test http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html
 10 to ensure that SecurityPolicyViolationEvent.statusCode is 0 when dispatched for a violation on an HTTPS-served
 11 document per section Reporting of the Content Security Policy 2.0 spec, <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.
 12 Update existing test results and mark more tests as PASS in file LayoutTests/TestExpectations.
 13
 14 * TestExpectations: Mark tests http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation*.html as PASS
 15 so that we run them.
 16 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt: Update expected result to
 17 reflect failing sub-test. We do not support the experimental JavaScript event listener onsecuritypolicyviolation when
 18 building with ENABLE(CSP_NEXT) disabled.
 19 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-expected.txt: Update line and column numbers.
 20 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt: Ditto.
 21 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-from-script.html: Ditto.
 22 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image.html: Ditto.
 23 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-expected.txt: Ditto.
 24 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-from-script-expected.txt: Ditto.
 25 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-from-script.html: Ditto.
 26 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https-expected.txt: Added.
 27 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html: Added.
 28 * http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html: Update line and column numbers.
 29 * js/dom/global-constructors-attributes-expected.txt: Update expected results now that we expose SecurityPolicyViolationEvent.
 30 * platform/efl/js/dom/global-constructors-attributes-expected.txt: Ditto.
 31 * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt: Ditto.
 32 * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: Ditto.
 33 * platform/mac/js/dom/global-constructors-attributes-expected.txt: Ditto.
 34
1352016-02-23 Daniel Bates <dabates@apple.com>
236
337 CSP: Enable base-uri directive by default

LayoutTests/TestExpectations

@@http/tests/security/contentSecurityPolicy/1.1/base-uri-allow.html [ Pass ]
814814http/tests/security/contentSecurityPolicy/1.1/base-uri-default-ignored.html [ Pass ]
815815http/tests/security/contentSecurityPolicy/1.1/base-uri-deny.html [ Pass ]
816816http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive.php [ Pass ]
 817http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics.html [ Pass ]
 818http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-from-script.html [ Pass ]
 819http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image.html [ Pass ]
 820http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-from-script.html [ Pass ]
 821http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html [ Pass ]
 822http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html [ Pass ]
817823webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-overrides-xfo.html
818824webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/scripthash-default-src.html
819825webkit.org/b/154203 http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src.html

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-basics-expected.txt

@@Check that a SecurityPolicyViolationEvent handler exists, and that events can be
33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
44
55
6 PASS typeof document.onsecuritypolicyviolation is "object"
 6FAIL typeof document.onsecuritypolicyviolation should be object. Was undefined.
77PASS typeof SecurityPolicyViolationEvent is "function"
88PASS typeof window.e is "object"
99PASS window.e.documentURI is "documentURIValue"

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-expected.txt

@@PASS window.e.violatedDirective is "img-src 'none'"
1313PASS window.e.effectiveDirective is "img-src"
1414PASS window.e.originalPolicy is "img-src 'none'"
1515PASS window.e.sourceFile is "http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image.html"
16 PASS window.e.lineNumber is 23
17 PASS window.e.columnNumber is 21
 16PASS window.e.lineNumber is 25
 17PASS window.e.columnNumber is 16
1818PASS window.e.statusCode is 200
1919PASS successfullyParsed is true
2020

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt

@@PASS window.e.effectiveDirective is "img-src"
1414PASS window.e.originalPolicy is "img-src 'none'"
1515PASS window.e.sourceFile is "http://localhost:8000"
1616PASS window.e.lineNumber is 3
17 PASS window.e.columnNumber is 7
 17PASS window.e.columnNumber is 2
1818PASS window.e.statusCode is 200
1919PASS successfullyParsed is true
2020

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-from-script.html

1616 'originalPolicy': 'img-src \'none\'',
1717 'sourceFile': 'http://localhost:8000',
1818 'lineNumber': 3,
19  'columnNumber': 7,
 19 'columnNumber': 2,
2020 'statusCode': 200,
2121 };
2222

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image.html

1515 'effectiveDirective': 'img-src',
1616 'originalPolicy': 'img-src \'none\'',
1717 'sourceFile': document.location.toString(),
18  'lineNumber': 23,
19  'columnNumber': 21,
 18 'lineNumber': 25,
 19 'columnNumber': 16,
2020 'statusCode': 200,
2121 };
2222

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-expected.txt

@@PASS window.e.violatedDirective is "img-src 'none'"
1313PASS window.e.effectiveDirective is "img-src"
1414PASS window.e.originalPolicy is "img-src 'none'"
1515PASS window.e.sourceFile is "http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html"
16 PASS window.e.lineNumber is 23
17 PASS window.e.columnNumber is 21
 16PASS window.e.lineNumber is 25
 17PASS window.e.columnNumber is 16
1818PASS window.e.statusCode is 200
1919PASS successfullyParsed is true
2020

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-from-script-expected.txt

@@PASS window.e.effectiveDirective is "img-src"
1414PASS window.e.originalPolicy is "img-src 'none'"
1515PASS window.e.sourceFile is "http://127.0.0.1:8000/security/contentSecurityPolicy/resources/inject-image.js"
1616PASS window.e.lineNumber is 3
17 PASS window.e.columnNumber is 7
 17PASS window.e.columnNumber is 2
1818PASS window.e.statusCode is 200
1919PASS successfullyParsed is true
2020

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-from-script.html

1616 'originalPolicy': 'img-src \'none\'',
1717 'sourceFile': 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/inject-image.js',
1818 'lineNumber': 3,
19  'columnNumber': 7,
 19 'columnNumber': 2,
2020 'statusCode': 200,
2121 };
2222

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https-expected.txt

 1CONSOLE MESSAGE: Refused to load the image 'http://127.0.0.1:8000/security/resources/abe.png' because it violates the following Content Security Policy directive: "img-src 'none'".
 2
 3
 4
 5--------
 6Frame: '<!--framePath //<!--frame0-->-->'
 7--------
 8Check that a SecurityPolicyViolationEvent is fired upon blocking an image.
 9
 10On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 11
 12
 13Kicking off the tests:
 14PASS window.e.documentURI is "https://127.0.0.1:8443/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html"
 15PASS window.e.referrer is "http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html"
 16FAIL window.e.blockedURI should be http://127.0.0.1:8000/security/resources/abe.png. Was http://127.0.0.1:8000.
 17PASS window.e.violatedDirective is "img-src 'none'"
 18PASS window.e.effectiveDirective is "img-src"
 19PASS window.e.originalPolicy is "img-src 'none'"
 20PASS window.e.sourceFile is "https://127.0.0.1:8443/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html"
 21PASS window.e.lineNumber is 25
 22PASS window.e.columnNumber is 16
 23PASS window.e.statusCode is 0
 24PASS successfullyParsed is true
 25
 26TEST COMPLETE
 27

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image-https.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<script>
 5if (window.testRunner) {
 6 testRunner.dumpAsText();
 7 testRunner.dumpChildFramesAsText();
 8 testRunner.waitUntilDone();
 9}
 10</script>
 11</head>
 12<body>
 13<iframe src="https://127.0.0.1:8443/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html"></iframe>
 14</body>
 15</html>

LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-image.html

1515 'effectiveDirective': 'img-src',
1616 'originalPolicy': 'img-src \'none\'',
1717 'sourceFile': document.location.toString(),
18  'lineNumber': 23,
19  'columnNumber': 21,
20  'statusCode': 200,
 18 'lineNumber': 25,
 19 'columnNumber': 16,
 20 'statusCode': document.location.protocol === 'http:' ? 200 : 0,
2121 };
2222
2323 function run() {
2424 var img = document.createElement('img');
25  img.src = '/security/resources/abe.png';
 25 img.src = 'http://127.0.0.1:8000/security/resources/abe.png';
2626 document.body.appendChild(img);
2727 }
2828 </script>

LayoutTests/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProper
17131713PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProperty('set') is false
17141714PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').enumerable is false
17151715PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').configurable is true
 1716PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').value is SecurityPolicyViolationEvent
 1717PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('get') is false
 1718PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('set') is false
 1719PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').enumerable is false
 1720PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').configurable is true
17161721PASS Object.getOwnPropertyDescriptor(global, 'Selection').value is Selection
17171722PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('get') is false
17181723PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false

LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProper
17831783PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProperty('set') is false
17841784PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').enumerable is false
17851785PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').configurable is true
 1786PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').value is SecurityPolicyViolationEvent
 1787PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('get') is false
 1788PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('set') is false
 1789PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').enumerable is false
 1790PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').configurable is true
17861791PASS Object.getOwnPropertyDescriptor(global, 'Selection').value is Selection
17871792PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('get') is false
17881793PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false

LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProper
17931793PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProperty('set') is false
17941794PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').enumerable is false
17951795PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').configurable is true
 1796PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').value is SecurityPolicyViolationEvent
 1797PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('get') is false
 1798PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('set') is false
 1799PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').enumerable is false
 1800PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').configurable is true
17961801PASS Object.getOwnPropertyDescriptor(global, 'Selection').value is Selection
17971802PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('get') is false
17981803PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false

LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProper
19181918PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProperty('set') is false
19191919PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').enumerable is false
19201920PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').configurable is true
 1921PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').value is SecurityPolicyViolationEvent
 1922PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('get') is false
 1923PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('set') is false
 1924PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').enumerable is false
 1925PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').configurable is true
19211926PASS Object.getOwnPropertyDescriptor(global, 'Selection').value is Selection
19221927PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('get') is false
19231928PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false

LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProper
19181918PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').hasOwnProperty('set') is false
19191919PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').enumerable is false
19201920PASS Object.getOwnPropertyDescriptor(global, 'ScriptProcessorNode').configurable is true
 1921PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').value is SecurityPolicyViolationEvent
 1922PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('get') is false
 1923PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').hasOwnProperty('set') is false
 1924PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').enumerable is false
 1925PASS Object.getOwnPropertyDescriptor(global, 'SecurityPolicyViolationEvent').configurable is true
19211926PASS Object.getOwnPropertyDescriptor(global, 'Selection').value is Selection
19221927PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('get') is false
19231928PASS Object.getOwnPropertyDescriptor(global, 'Selection').hasOwnProperty('set') is false