<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192769] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192769">192769</a></dd>
<dt>Author</dt> <dd>aestes@apple.com</dd>
<dt>Date</dt> <dd>2015-11-25 00:48:36 -0800 (Wed, 25 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Teach MiniBrowser how to enable the mock content filter
https://bugs.webkit.org/show_bug.cgi?id=151540
Reviewed by Andreas Kling.
Source/WebCore:
Moved the implementation of MockContentFilterEnabler from TestWebKitAPI to here, renamed it to
WebMockContentFilterEnabler, and made it compatible with the legacy Objective-C runtime. Renamed Decision and
DecisionPoint to WebMockContentFilterDecision and WebMockContentFilterDecisionPoint, and changed them from enum
classes to CF_ENUMs so that they can be used by both C++ and Objective-C source files.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSMockContentFilterSettingsCustom.cpp:
(WebCore::JSMockContentFilterSettings::decisionPoint):
(WebCore::JSMockContentFilterSettings::setDecisionPoint):
(WebCore::toDecision):
(WebCore::JSMockContentFilterSettings::decision):
(WebCore::JSMockContentFilterSettings::setDecision):
(WebCore::JSMockContentFilterSettings::unblockRequestDecision):
(WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):
(WebCore::toJSValue): Deleted.
* testing/MockContentFilter.cpp:
(WebCore::MockContentFilter::willSendRequest):
(WebCore::MockContentFilter::responseReceived):
(WebCore::MockContentFilter::addData):
(WebCore::MockContentFilter::finishedAddingData):
(WebCore::MockContentFilter::unblockHandler):
(WebCore::MockContentFilter::maybeDetermineStatus):
* testing/MockContentFilter.h:
* testing/MockContentFilterEnabler.h: Added.
* testing/MockContentFilterEnabler.mm: Added.
(-[WebMockContentFilterEnabler initWithDecision:decisionPoint:blockedString:]):
(-[WebMockContentFilterEnabler initWithCoder:]):
(-[WebMockContentFilterEnabler encodeWithCoder:]):
(-[WebMockContentFilterEnabler enable]):
(-[WebMockContentFilterEnabler dealloc]):
(+[WebMockContentFilterEnabler supportsSecureCoding]):
(-[WebMockContentFilterEnabler copyWithZone:]):
* testing/MockContentFilterSettings.h:
(WebCore::MockContentFilterSettings::decisionPoint):
(WebCore::MockContentFilterSettings::setDecisionPoint):
(WebCore::MockContentFilterSettings::decision):
(WebCore::MockContentFilterSettings::setDecision):
(WebCore::MockContentFilterSettings::unblockRequestDecision):
(WebCore::MockContentFilterSettings::setUnblockRequestDecision):
Tools:
* MiniBrowser/Configurations/Base.xcconfig: Added WebCoreTestSupport and WTF to HEADER_SEARCH_PATHS.
* MiniBrowser/Configurations/MiniBrowser.xcconfig: Linked against libWebCoreTestSupport.
* MiniBrowser/Configurations/MiniBrowserBundle.xcconfig: Ditto.
* MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj: Added blocked-page.html.
* MiniBrowser/MiniBrowserWebProcessPlugIn.m:
(-[MiniBrowserWebProcessPlugIn webProcessPlugIn:initializeWithObject:]): Observed the WebMockContentFilterEnabler key path.
(-[MiniBrowserWebProcessPlugIn dealloc]):
(-[MiniBrowserWebProcessPlugIn observeValueForKeyPath:ofObject:change:context:]): Stored the value in _contentFilterEnabler.
* MiniBrowser/blocked-page.html: Added.
* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration): Created a _WKProcessPoolConfiguration with MiniBrowser.wkbundle as the injected bundle.
* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/BrowserWindowController.m:
(+[BrowserWindowController contentFilteringBlockedString]): Returned an NSString containing blocked-page.html.
* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]): Added [self _contentFilteringMenuItem] to the Settings menu.
(-[SettingsController validateMenuItem:]): Validated the new menu items. Disabled Decision and Decision Point items if filtering is disabled.
(-[SettingsController _contentFilteringMenuItem]): Returned a new Content Filtering menu item with a submenu.
(-[SettingsController toggleContentFilteringEnabled:]): Toggled ContentFilteringEnabledKey.
(-[SettingsController contentFilteringEnabled]): Returned value of ContentFilteringEnabledKey.
(-[SettingsController setContentFilteringDecision:]): Set ContentFilterDecisionKey and called -[BrowserAppDelegate didChangeSettings].
(-[SettingsController contentFilteringDecision]): Returned the value of ContentFilterDecisionKey as a WebMockContentFilterDecision.
Defaulted to WebMockContentFilterDecisionAllow if the value is invalid.
(-[SettingsController setContentFilteringDecisionPoint:]): Set ContentFilterDecisionPointKey and called -[BrowserAppDelegate didChangeSettings].
(-[SettingsController contentFilteringDecisionPoint]): Returned the value of ContentFilterDecisionPointKey as a WebMockContentFilterDecisionPoint.
Defaulted to WebMockContentFilterDecisionPointAfterWillSendRequest if the value is invalid.
* MiniBrowser/mac/WK1BrowserWindowController.h:
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController dealloc]):
(-[WK1BrowserWindowController didChangeSettings]): Created a WebMockContentFilterEnabler with the current settings and stored it in _contentFilterEnabler.
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]): Created a WebMockContentFilterEnabler and set it as the object for the eponymous bundle parameter.
* TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig: Linked against libWebCoreTestSupport.
* TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm:
(configurationWithContentFilterSettings): Converted to use WebMockContentFilterEnabler, WebMockContentFilterDecision, and WebMockContentFilterDecisionPoint.
(TEST): Ditto.
(downloadTest): Ditto.
(+[MockContentFilterEnabler supportsSecureCoding]): Deleted.
(-[MockContentFilterEnabler copyWithZone:]): Deleted.
(-[MockContentFilterEnabler initWithCoder:]): Deleted.
(-[MockContentFilterEnabler initWithDecision:decisionPoint:]): Deleted.
(-[MockContentFilterEnabler encodeWithCoder:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm:
(-[ContentFilteringPlugIn webProcessPlugIn:initializeWithObject:]): Converted to use WebMockContentFilterEnabler.
(-[ContentFilteringPlugIn dealloc]): Ditto.
(-[ContentFilteringPlugIn observeValueForKeyPath:ofObject:change:context:]): Ditto.
(+[MockContentFilterEnabler supportsSecureCoding]): Deleted.
(-[MockContentFilterEnabler copyWithZone:]): Deleted.
(-[MockContentFilterEnabler initWithCoder:]): Deleted.
(-[MockContentFilterEnabler dealloc]): Deleted.
(-[MockContentFilterEnabler encodeWithCoder:]): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMockContentFilterSettingsCustomcpp">trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFiltercpp">trunk/Source/WebCore/testing/MockContentFilter.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterh">trunk/Source/WebCore/testing/MockContentFilter.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterSettingsh">trunk/Source/WebCore/testing/MockContentFilterSettings.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowserConfigurationsBasexcconfig">trunk/Tools/MiniBrowser/Configurations/Base.xcconfig</a></li>
<li><a href="#trunkToolsMiniBrowserConfigurationsMiniBrowserxcconfig">trunk/Tools/MiniBrowser/Configurations/MiniBrowser.xcconfig</a></li>
<li><a href="#trunkToolsMiniBrowserConfigurationsMiniBrowserBundlexcconfig">trunk/Tools/MiniBrowser/Configurations/MiniBrowserBundle.xcconfig</a></li>
<li><a href="#trunkToolsMiniBrowserMiniBrowserxcodeprojprojectpbxproj">trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsMiniBrowserMiniBrowserWebProcessPlugInm">trunk/Tools/MiniBrowser/MiniBrowserWebProcessPlugIn.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacAppDelegatem">trunk/Tools/MiniBrowser/mac/AppDelegate.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowControllerh">trunk/Tools/MiniBrowser/mac/BrowserWindowController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/BrowserWindowController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacBundleMiniBrowserBundle_Prefixpch">trunk/Tools/MiniBrowser/mac/Bundle/MiniBrowserBundle_Prefix.pch</a></li>
<li><a href="#trunkToolsMiniBrowsermacMiniBrowser_Prefixpch">trunk/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch</a></li>
<li><a href="#trunkToolsMiniBrowsermacSettingsControllerh">trunk/Tools/MiniBrowser/mac/SettingsController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacSettingsControllerm">trunk/Tools/MiniBrowser/mac/SettingsController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK1BrowserWindowControllerh">trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK1BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK2BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m</a></li>
<li><a href="#trunkToolsTestWebKitAPIConfigurationsTestWebKitAPIxcconfig">trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaContentFilteringmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaContentFilteringPlugInmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoretestingMockContentFilterEnablerh">trunk/Source/WebCore/testing/MockContentFilterEnabler.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockContentFilterEnablermm">trunk/Source/WebCore/testing/MockContentFilterEnabler.mm</a></li>
<li><a href="#trunkToolsMiniBrowserblockedpagehtml">trunk/Tools/MiniBrowser/blocked-page.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/ChangeLog        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2015-11-22 Andy Estes <aestes@apple.com>
+
+ Teach MiniBrowser how to enable the mock content filter
+ https://bugs.webkit.org/show_bug.cgi?id=151540
+
+ Reviewed by Andreas Kling.
+
+ Moved the implementation of MockContentFilterEnabler from TestWebKitAPI to here, renamed it to
+ WebMockContentFilterEnabler, and made it compatible with the legacy Objective-C runtime. Renamed Decision and
+ DecisionPoint to WebMockContentFilterDecision and WebMockContentFilterDecisionPoint, and changed them from enum
+ classes to CF_ENUMs so that they can be used by both C++ and Objective-C source files.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSMockContentFilterSettingsCustom.cpp:
+ (WebCore::JSMockContentFilterSettings::decisionPoint):
+ (WebCore::JSMockContentFilterSettings::setDecisionPoint):
+ (WebCore::toDecision):
+ (WebCore::JSMockContentFilterSettings::decision):
+ (WebCore::JSMockContentFilterSettings::setDecision):
+ (WebCore::JSMockContentFilterSettings::unblockRequestDecision):
+ (WebCore::JSMockContentFilterSettings::setUnblockRequestDecision):
+ (WebCore::toJSValue): Deleted.
+ * testing/MockContentFilter.cpp:
+ (WebCore::MockContentFilter::willSendRequest):
+ (WebCore::MockContentFilter::responseReceived):
+ (WebCore::MockContentFilter::addData):
+ (WebCore::MockContentFilter::finishedAddingData):
+ (WebCore::MockContentFilter::unblockHandler):
+ (WebCore::MockContentFilter::maybeDetermineStatus):
+ * testing/MockContentFilter.h:
+ * testing/MockContentFilterEnabler.h: Added.
+ * testing/MockContentFilterEnabler.mm: Added.
+ (-[WebMockContentFilterEnabler initWithDecision:decisionPoint:blockedString:]):
+ (-[WebMockContentFilterEnabler initWithCoder:]):
+ (-[WebMockContentFilterEnabler encodeWithCoder:]):
+ (-[WebMockContentFilterEnabler enable]):
+ (-[WebMockContentFilterEnabler dealloc]):
+ (+[WebMockContentFilterEnabler supportsSecureCoding]):
+ (-[WebMockContentFilterEnabler copyWithZone:]):
+ * testing/MockContentFilterSettings.h:
+ (WebCore::MockContentFilterSettings::decisionPoint):
+ (WebCore::MockContentFilterSettings::setDecisionPoint):
+ (WebCore::MockContentFilterSettings::decision):
+ (WebCore::MockContentFilterSettings::setDecision):
+ (WebCore::MockContentFilterSettings::unblockRequestDecision):
+ (WebCore::MockContentFilterSettings::setUnblockRequestDecision):
+
</ins><span class="cx"> 2015-11-24 Xabier Rodriguez Calvar <calvaris@igalia.com>
</span><span class="cx">
</span><span class="cx"> [Streams API] Implement pipeTo method in readable Stream
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -4034,6 +4034,7 @@
</span><span class="cx">                 A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
</span><span class="cx">                 A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; };
</span><ins>+                A138DE4C1C0310650029832B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A138DE4B1C0310650029832B /* Foundation.framework */; };
</ins><span class="cx">                 A14090FB1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */; };
</span><span class="cx">                 A14090FD1AA51E480091191A /* ContentFilterUnblockHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A14832B0187F618D00DA63A6 /* WAKAppKitStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = A148328C187F508700DA63A6 /* WAKAppKitStubs.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -4075,6 +4076,8 @@
</span><span class="cx">                 A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A182D5B61BE722620087A7CC /* SettingsCocoa.mm */; };
</span><span class="cx">                 A18890AE1AA13F250026C301 /* ParentalControlsContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */; };
</span><span class="cx">                 A18890AF1AA13F250026C301 /* ParentalControlsContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */; };
</span><ins>+                A190AD1B1C002EE500DD8741 /* MockContentFilterEnabler.mm in Sources */ = {isa = PBXBuildFile; fileRef = A190AD191C002EE500DD8741 /* MockContentFilterEnabler.mm */; };
+                A190AD1C1C002EE500DD8741 /* MockContentFilterEnabler.h in Headers */ = {isa = PBXBuildFile; fileRef = A190AD1A1C002EE500DD8741 /* MockContentFilterEnabler.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */; };
</span><span class="cx">                 A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */; };
</span><span class="cx">                 A19D93461A9FEC7200B46C24 /* NEFilterSourceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A19D93441A9FEC7200B46C24 /* NEFilterSourceSPI.h */; };
</span><span class="lines">@@ -11617,6 +11620,7 @@
</span><span class="cx">                 A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridTrackSize.h; sourceTree = "<group>"; };
</span><span class="cx">                 A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; };
</span><ins>+                A138DE4B1C0310650029832B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
</ins><span class="cx">                 A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentFilterUnblockHandlerCocoa.mm; sourceTree = "<group>"; };
</span><span class="cx">                 A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilterUnblockHandler.h; sourceTree = "<group>"; };
</span><span class="cx">                 A148328C187F508700DA63A6 /* WAKAppKitStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WAKAppKitStubs.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -11658,6 +11662,8 @@
</span><span class="cx">                 A182D5B61BE722620087A7CC /* SettingsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsCocoa.mm; sourceTree = "<group>"; };
</span><span class="cx">                 A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = "<group>"; };
</span><span class="cx">                 A18890AD1AA13F250026C301 /* ParentalControlsContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParentalControlsContentFilter.h; sourceTree = "<group>"; };
</span><ins>+                A190AD191C002EE500DD8741 /* MockContentFilterEnabler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MockContentFilterEnabler.mm; sourceTree = "<group>"; };
+                A190AD1A1C002EE500DD8741 /* MockContentFilterEnabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockContentFilterEnabler.h; sourceTree = "<group>"; };
</ins><span class="cx">                 A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockContentFilterSettings.idl; sourceTree = "<group>"; };
</span><span class="cx">                 A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockContentFilterSettings.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockContentFilterSettings.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -15042,6 +15048,7 @@
</span><span class="cx">                         isa = PBXFrameworksBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                A138DE4C1C0310650029832B /* Foundation.framework in Frameworks */,
</ins><span class="cx">                                 AA5F3B9116CC5BEB00455EB0 /* CoreFoundation.framework in Frameworks */,
</span><span class="cx">                                 41230913138C42FF00BCCFCA /* JavaScriptCore.framework in Frameworks */,
</span><span class="cx">                                 4123081B138C429700BCCFCA /* WebCore.framework in Frameworks */,
</span><span class="lines">@@ -15520,6 +15527,7 @@
</span><span class="cx">                 0867D69AFE84028FC02AAC07 /* Frameworks */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                A138DE4B1C0310650029832B /* Foundation.framework */,
</ins><span class="cx">                                 FD2DBF0E12B048A300ED98C6 /* Accelerate.framework */,
</span><span class="cx">                                 FD2DBF0F12B048A300ED98C6 /* AudioToolbox.framework */,
</span><span class="cx">                                 FD2DBF1112B048A300ED98C6 /* CoreAudio.framework */,
</span><span class="lines">@@ -16465,6 +16473,8 @@
</span><span class="cx">                                 CDC26B3D160A62B00026757B /* MockCDM.h */,
</span><span class="cx">                                 A1BF6B801AA96C7D00AF4A8A /* MockContentFilter.cpp */,
</span><span class="cx">                                 A1BF6B811AA96C7D00AF4A8A /* MockContentFilter.h */,
</span><ins>+                                A190AD1A1C002EE500DD8741 /* MockContentFilterEnabler.h */,
+                                A190AD191C002EE500DD8741 /* MockContentFilterEnabler.mm */,
</ins><span class="cx">                                 A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */,
</span><span class="cx">                                 A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */,
</span><span class="cx">                                 A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */,
</span><span class="lines">@@ -24556,6 +24566,7 @@
</span><span class="cx">                                 CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */,
</span><span class="cx">                                 A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
</span><span class="cx">                                 EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
</span><ins>+                                A190AD1C1C002EE500DD8741 /* MockContentFilterEnabler.h in Headers */,
</ins><span class="cx">                                 CB8CF01D1A95DE42000D510B /* MicroTaskTest.h in Headers */,
</span><span class="cx">                                 CDC26B41160A8CCE0026757B /* MockCDM.h in Headers */,
</span><span class="cx">                                 A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */,
</span><span class="lines">@@ -28492,6 +28503,7 @@
</span><span class="cx">                                 CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
</span><span class="cx">                                 A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
</span><span class="cx">                                 A1E5B31F1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp in Sources */,
</span><ins>+                                A190AD1B1C002EE500DD8741 /* MockContentFilterEnabler.mm in Sources */,
</ins><span class="cx">                                 EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
</span><span class="cx">                                 CB8CF01F1A95DE59000D510B /* MicroTaskTest.cpp in Sources */,
</span><span class="cx">                                 CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMockContentFilterSettingsCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -35,84 +35,55 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-using Decision = MockContentFilterSettings::Decision;
-using DecisionPoint = MockContentFilterSettings::DecisionPoint;
-
</del><span class="cx"> JSValue JSMockContentFilterSettings::decisionPoint(ExecState&) const
</span><span class="cx"> {
</span><del>- DecisionPoint decisionPoint = wrapped().decisionPoint();
- switch (decisionPoint) {
- case DecisionPoint::AfterWillSendRequest:
- case DecisionPoint::AfterRedirect:
- case DecisionPoint::AfterResponse:
- case DecisionPoint::AfterAddData:
- case DecisionPoint::AfterFinishedAddingData:
- case DecisionPoint::Never:
- return jsNumber(static_cast<uint8_t>(decisionPoint));
- }
-
- ASSERT_NOT_REACHED();
- return jsUndefined();
</del><ins>+ return jsNumber(static_cast<uint8_t>(wrapped().decisionPoint()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JSMockContentFilterSettings::setDecisionPoint(ExecState& state, JSValue value)
</span><span class="cx"> {
</span><del>- uint8_t nativeValue { toUInt8(&state, value, EnforceRange) };
</del><ins>+ uint8_t decisionPoint { toUInt8(&state, value, EnforceRange) };
</ins><span class="cx"> if (state.hadException())
</span><span class="cx"> return;
</span><del>-
- DecisionPoint decisionPoint { static_cast<DecisionPoint>(nativeValue) };
</del><ins>+
</ins><span class="cx"> switch (decisionPoint) {
</span><del>- case DecisionPoint::AfterWillSendRequest:
- case DecisionPoint::AfterRedirect:
- case DecisionPoint::AfterResponse:
- case DecisionPoint::AfterAddData:
- case DecisionPoint::AfterFinishedAddingData:
- case DecisionPoint::Never:
- wrapped().setDecisionPoint(decisionPoint);
</del><ins>+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointAfterWillSendRequest):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointAfterRedirect):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointAfterResponse):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointAfterAddData):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointAfterFinishedAddingData):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionPointNever):
+ wrapped().setDecisionPoint(static_cast<WebMockContentFilterDecisionPoint>(decisionPoint));
</ins><span class="cx"> return;
</span><ins>+ default:
+ throwTypeError(&state, String::format("%u is not a valid decisionPoint value.", decisionPoint));
</ins><span class="cx"> }
</span><del>-
- throwTypeError(&state, String::format("%u is not a valid decisionPoint value.", nativeValue));
</del><span class="cx"> }
</span><span class="cx">
</span><del>-static inline JSValue toJSValue(Decision decision)
</del><ins>+static inline WebMockContentFilterDecision toDecision(ExecState& state, JSValue value)
</ins><span class="cx"> {
</span><del>- switch (decision) {
- case Decision::Allow:
- case Decision::Block:
- return jsNumber(static_cast<uint8_t>(decision));
- }
-
- ASSERT_NOT_REACHED();
- return jsUndefined();
-}
-
-static inline Decision toDecision(ExecState& state, JSValue value)
-{
- uint8_t nativeValue { toUInt8(&state, value, EnforceRange) };
</del><ins>+ uint8_t decision { toUInt8(&state, value, EnforceRange) };
</ins><span class="cx"> if (state.hadException())
</span><del>- return Decision::Allow;
</del><ins>+ return WebMockContentFilterDecisionAllow;
</ins><span class="cx">
</span><del>- Decision decision { static_cast<Decision>(nativeValue) };
</del><span class="cx"> switch (decision) {
</span><del>- case Decision::Allow:
- case Decision::Block:
- return decision;
</del><ins>+ case static_cast<uint8_t>(WebMockContentFilterDecisionAllow):
+ case static_cast<uint8_t>(WebMockContentFilterDecisionBlock):
+ return static_cast<WebMockContentFilterDecision>(decision);
+ default:
+ throwTypeError(&state, String::format("%u is not a valid decision value.", decision));
+ return WebMockContentFilterDecisionAllow;
</ins><span class="cx"> }
</span><del>-
- throwTypeError(&state, String::format("%u is not a valid decision value.", nativeValue));
- return Decision::Allow;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JSValue JSMockContentFilterSettings::decision(ExecState&) const
</span><span class="cx"> {
</span><del>- return toJSValue(wrapped().decision());
</del><ins>+ return jsNumber(static_cast<uint8_t>(wrapped().decision()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JSMockContentFilterSettings::setDecision(ExecState& state, JSValue value)
</span><span class="cx"> {
</span><del>- Decision decision { toDecision(state, value) };
</del><ins>+ WebMockContentFilterDecision decision { toDecision(state, value) };
</ins><span class="cx"> if (state.hadException())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -121,12 +92,12 @@
</span><span class="cx">
</span><span class="cx"> JSValue JSMockContentFilterSettings::unblockRequestDecision(ExecState&) const
</span><span class="cx"> {
</span><del>- return toJSValue(wrapped().unblockRequestDecision());
</del><ins>+ return jsNumber(static_cast<uint8_t>(wrapped().unblockRequestDecision()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JSMockContentFilterSettings::setUnblockRequestDecision(ExecState& state, JSValue value)
</span><span class="cx"> {
</span><del>- Decision unblockRequestDecision { toDecision(state, value) };
</del><ins>+ WebMockContentFilterDecision unblockRequestDecision { toDecision(state, value) };
</ins><span class="cx"> if (state.hadException())
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFiltercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilter.cpp (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/testing/MockContentFilter.cpp        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -40,9 +40,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-using Decision = MockContentFilterSettings::Decision;
-using DecisionPoint = MockContentFilterSettings::DecisionPoint;
-
</del><span class="cx"> void MockContentFilter::ensureInstalled()
</span><span class="cx"> {
</span><span class="cx"> static std::once_flag onceFlag;
</span><span class="lines">@@ -71,9 +68,9 @@
</span><span class="cx"> void MockContentFilter::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse)
</span><span class="cx"> {
</span><span class="cx"> if (redirectResponse.isNull())
</span><del>- maybeDetermineStatus(DecisionPoint::AfterWillSendRequest);
</del><ins>+ maybeDetermineStatus(WebMockContentFilterDecisionPointAfterWillSendRequest);
</ins><span class="cx"> else
</span><del>- maybeDetermineStatus(DecisionPoint::AfterRedirect);
</del><ins>+ maybeDetermineStatus(WebMockContentFilterDecisionPointAfterRedirect);
</ins><span class="cx">
</span><span class="cx"> if (m_status == Status::NeedsMoreData)
</span><span class="cx"> return;
</span><span class="lines">@@ -93,17 +90,17 @@
</span><span class="cx">
</span><span class="cx"> void MockContentFilter::responseReceived(const ResourceResponse&)
</span><span class="cx"> {
</span><del>- maybeDetermineStatus(DecisionPoint::AfterResponse);
</del><ins>+ maybeDetermineStatus(WebMockContentFilterDecisionPointAfterResponse);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MockContentFilter::addData(const char*, int)
</span><span class="cx"> {
</span><del>- maybeDetermineStatus(DecisionPoint::AfterAddData);
</del><ins>+ maybeDetermineStatus(WebMockContentFilterDecisionPointAfterAddData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MockContentFilter::finishedAddingData()
</span><span class="cx"> {
</span><del>- maybeDetermineStatus(DecisionPoint::AfterFinishedAddingData);
</del><ins>+ maybeDetermineStatus(WebMockContentFilterDecisionPointAfterFinishedAddingData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool MockContentFilter::needsMoreData() const
</span><span class="lines">@@ -129,9 +126,9 @@
</span><span class="cx">
</span><span class="cx"> return ContentFilterUnblockHandler {
</span><span class="cx"> MockContentFilterSettings::unblockURLHost(), [](DecisionHandlerFunction decisionHandler) {
</span><del>- bool shouldAllow { settings().unblockRequestDecision() == Decision::Allow };
</del><ins>+ bool shouldAllow { settings().unblockRequestDecision() == WebMockContentFilterDecisionAllow };
</ins><span class="cx"> if (shouldAllow)
</span><del>- settings().setDecision(Decision::Allow);
</del><ins>+ settings().setDecision(WebMockContentFilterDecisionAllow);
</ins><span class="cx"> LOG(ContentFiltering, "MockContentFilter %s the unblock request.\n", shouldAllow ? "allowed" : "did not allow");
</span><span class="cx"> decisionHandler(shouldAllow);
</span><span class="cx"> }
</span><span class="lines">@@ -143,14 +140,14 @@
</span><span class="cx"> return ASCIILiteral("unblockRequestDenied()");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MockContentFilter::maybeDetermineStatus(DecisionPoint decisionPoint)
</del><ins>+void MockContentFilter::maybeDetermineStatus(WebMockContentFilterDecisionPoint decisionPoint)
</ins><span class="cx"> {
</span><span class="cx"> if (m_status != Status::NeedsMoreData || decisionPoint != settings().decisionPoint())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LOG(ContentFiltering, "MockContentFilter stopped buffering with status %u at decision point %u.\n", m_status, decisionPoint);
</span><span class="cx">
</span><del>- m_status = settings().decision() == Decision::Allow ? Status::Allowed : Status::Blocked;
</del><ins>+ m_status = settings().decision() == WebMockContentFilterDecisionAllow ? Status::Allowed : Status::Blocked;
</ins><span class="cx"> if (m_status != Status::Blocked)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilter.h (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilter.h        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/testing/MockContentFilter.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> MockContentFilter() = default;
</span><del>- void maybeDetermineStatus(MockContentFilterSettings::DecisionPoint);
</del><ins>+ void maybeDetermineStatus(WebMockContentFilterDecisionPoint);
</ins><span class="cx">
</span><span class="cx"> Vector<char> m_replacementData;
</span><span class="cx"> Status m_status { Status::NeedsMoreData };
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterEnablerhfromrev192768trunkToolsMiniBrowsermacWK1BrowserWindowControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/testing/MockContentFilterEnabler.h (from rev 192768, trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.h) (0 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterEnabler.h         (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilterEnabler.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "MockContentFilterSettings.h"
+
+WTF_EXPORT_PRIVATE @interface WebMockContentFilterEnabler : NSObject <NSCopying, NSSecureCoding> {
+ BOOL _enabled;
+ WebMockContentFilterDecision _decision;
+ WebMockContentFilterDecisionPoint _decisionPoint;
+ NSString *_blockedString;
+}
+
+- (instancetype)initWithDecision:(WebMockContentFilterDecision)decision decisionPoint:(WebMockContentFilterDecisionPoint)decisionPoint blockedString:(NSString *)blockedString;
+- (void)enable;
+@end
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterEnablermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/testing/MockContentFilterEnabler.mm (0 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterEnabler.mm         (rev 0)
+++ trunk/Source/WebCore/testing/MockContentFilterEnabler.mm        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "MockContentFilterEnabler.h"
+
+static NSString * const DecisionKey = @"Decision";
+static NSString * const DecisionPointKey = @"DecisionPoint";
+static NSString * const BlockedStringKey = @"BlockedString";
+
+@implementation WebMockContentFilterEnabler
+
+- (instancetype)initWithDecision:(WebMockContentFilterDecision)decision decisionPoint:(WebMockContentFilterDecisionPoint)decisionPoint blockedString:(NSString *)blockedString
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _decision = decision;
+ _decisionPoint = decisionPoint;
+ _blockedString = [blockedString copy];
+ return self;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)decoder
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _decision = static_cast<WebMockContentFilterDecision>([decoder decodeIntForKey:DecisionKey]);
+ _decisionPoint = static_cast<WebMockContentFilterDecisionPoint>([decoder decodeIntForKey:DecisionPointKey]);
+ _blockedString = [[decoder decodeObjectOfClass:[NSString class] forKey:BlockedStringKey] retain];
+ return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+ [coder encodeInt:static_cast<int>(_decision) forKey:DecisionKey];
+ [coder encodeInt:static_cast<int>(_decisionPoint) forKey:DecisionPointKey];
+ [coder encodeObject:_blockedString forKey:BlockedStringKey];
+}
+
+- (void)enable
+{
+ if (_enabled)
+ return;
+
+ auto& settings = WebCore::MockContentFilterSettings::singleton();
+ if (settings.enabled())
+ return;
+
+ settings.setEnabled(true);
+ settings.setDecision(_decision);
+ settings.setDecisionPoint(_decisionPoint);
+ settings.setBlockedString(_blockedString);
+ _enabled = YES;
+}
+
+- (void)dealloc
+{
+ [_blockedString release];
+ if (_enabled)
+ WebCore::MockContentFilterSettings::singleton().setEnabled(false);
+ [super dealloc];
+}
+
++ (BOOL)supportsSecureCoding
+{
+ return YES;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ UNUSED_PARAM(zone);
+ return [self retain];
+}
+
+@end
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingMockContentFilterSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockContentFilterSettings.h (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockContentFilterSettings.h        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Source/WebCore/testing/MockContentFilterSettings.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -26,6 +26,24 @@
</span><span class="cx"> #ifndef MockContentFilterSettings_h
</span><span class="cx"> #define MockContentFilterSettings_h
</span><span class="cx">
</span><ins>+#include <CoreFoundation/CoreFoundation.h>
+
+typedef CF_ENUM(int, WebMockContentFilterDecision) {
+ WebMockContentFilterDecisionAllow,
+ WebMockContentFilterDecisionBlock
+};
+
+typedef CF_ENUM(int, WebMockContentFilterDecisionPoint) {
+ WebMockContentFilterDecisionPointAfterWillSendRequest,
+ WebMockContentFilterDecisionPointAfterRedirect,
+ WebMockContentFilterDecisionPointAfterResponse,
+ WebMockContentFilterDecisionPointAfterAddData,
+ WebMockContentFilterDecisionPointAfterFinishedAddingData,
+ WebMockContentFilterDecisionPointNever
+};
+
+#ifdef __cplusplus
+
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="lines">@@ -35,20 +53,6 @@
</span><span class="cx"> friend class NeverDestroyed<MockContentFilterSettings>;
</span><span class="cx">
</span><span class="cx"> public:
</span><del>- enum class DecisionPoint {
- AfterWillSendRequest,
- AfterRedirect,
- AfterResponse,
- AfterAddData,
- AfterFinishedAddingData,
- Never
- };
-
- enum class Decision {
- Allow,
- Block
- };
-
</del><span class="cx"> WTF_EXPORT_PRIVATE static MockContentFilterSettings& singleton();
</span><span class="cx"> static void reset();
</span><span class="cx"> static const char* unblockURLHost() { return "mock-unblock"; }
</span><span class="lines">@@ -63,14 +67,14 @@
</span><span class="cx"> const String& blockedString() const { return m_blockedString; }
</span><span class="cx"> void setBlockedString(const String& blockedString) { m_blockedString = blockedString; }
</span><span class="cx">
</span><del>- DecisionPoint decisionPoint() const { return m_decisionPoint; }
- void setDecisionPoint(DecisionPoint decisionPoint) { m_decisionPoint = decisionPoint; }
</del><ins>+ WebMockContentFilterDecisionPoint decisionPoint() const { return m_decisionPoint; }
+ void setDecisionPoint(WebMockContentFilterDecisionPoint decisionPoint) { m_decisionPoint = decisionPoint; }
</ins><span class="cx">
</span><del>- Decision decision() const { return m_decision; }
- void setDecision(Decision decision) { m_decision = decision; }
</del><ins>+ WebMockContentFilterDecision decision() const { return m_decision; }
+ void setDecision(WebMockContentFilterDecision decision) { m_decision = decision; }
</ins><span class="cx">
</span><del>- Decision unblockRequestDecision() const { return m_unblockRequestDecision; }
- void setUnblockRequestDecision(Decision unblockRequestDecision) { m_unblockRequestDecision = unblockRequestDecision; }
</del><ins>+ WebMockContentFilterDecision unblockRequestDecision() const { return m_unblockRequestDecision; }
+ void setUnblockRequestDecision(WebMockContentFilterDecision unblockRequestDecision) { m_unblockRequestDecision = unblockRequestDecision; }
</ins><span class="cx">
</span><span class="cx"> const String& unblockRequestURL() const;
</span><span class="cx">
</span><span class="lines">@@ -83,13 +87,15 @@
</span><span class="cx"> MockContentFilterSettings& operator=(const MockContentFilterSettings&) = default;
</span><span class="cx">
</span><span class="cx"> bool m_enabled { false };
</span><del>- DecisionPoint m_decisionPoint { DecisionPoint::AfterResponse };
- Decision m_decision { Decision::Allow };
- Decision m_unblockRequestDecision { Decision::Block };
</del><ins>+ WebMockContentFilterDecisionPoint m_decisionPoint { WebMockContentFilterDecisionPointAfterResponse };
+ WebMockContentFilterDecision m_decision { WebMockContentFilterDecisionAllow };
+ WebMockContentFilterDecision m_unblockRequestDecision { WebMockContentFilterDecisionBlock };
</ins><span class="cx"> String m_blockedString;
</span><span class="cx"> String m_modifiedRequestURL;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+#endif // __cplusplus
+
</ins><span class="cx"> #endif // MockContentFilterSettings_h
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/ChangeLog        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2015-11-22 Andy Estes <aestes@apple.com>
+
+ Teach MiniBrowser how to enable the mock content filter
+ https://bugs.webkit.org/show_bug.cgi?id=151540
+
+ Reviewed by Andreas Kling.
+
+ * MiniBrowser/Configurations/Base.xcconfig: Added WebCoreTestSupport and WTF to HEADER_SEARCH_PATHS.
+ * MiniBrowser/Configurations/MiniBrowser.xcconfig: Linked against libWebCoreTestSupport.
+ * MiniBrowser/Configurations/MiniBrowserBundle.xcconfig: Ditto.
+ * MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj: Added blocked-page.html.
+ * MiniBrowser/MiniBrowserWebProcessPlugIn.m:
+ (-[MiniBrowserWebProcessPlugIn webProcessPlugIn:initializeWithObject:]): Observed the WebMockContentFilterEnabler key path.
+ (-[MiniBrowserWebProcessPlugIn dealloc]):
+ (-[MiniBrowserWebProcessPlugIn observeValueForKeyPath:ofObject:change:context:]): Stored the value in _contentFilterEnabler.
+ * MiniBrowser/blocked-page.html: Added.
+ * MiniBrowser/mac/AppDelegate.m:
+ (defaultConfiguration): Created a _WKProcessPoolConfiguration with MiniBrowser.wkbundle as the injected bundle.
+ * MiniBrowser/mac/BrowserWindowController.h:
+ * MiniBrowser/mac/BrowserWindowController.m:
+ (+[BrowserWindowController contentFilteringBlockedString]): Returned an NSString containing blocked-page.html.
+ * MiniBrowser/mac/SettingsController.h:
+ * MiniBrowser/mac/SettingsController.m:
+ (-[SettingsController _populateMenu]): Added [self _contentFilteringMenuItem] to the Settings menu.
+ (-[SettingsController validateMenuItem:]): Validated the new menu items. Disabled Decision and Decision Point items if filtering is disabled.
+ (-[SettingsController _contentFilteringMenuItem]): Returned a new Content Filtering menu item with a submenu.
+ (-[SettingsController toggleContentFilteringEnabled:]): Toggled ContentFilteringEnabledKey.
+ (-[SettingsController contentFilteringEnabled]): Returned value of ContentFilteringEnabledKey.
+ (-[SettingsController setContentFilteringDecision:]): Set ContentFilterDecisionKey and called -[BrowserAppDelegate didChangeSettings].
+ (-[SettingsController contentFilteringDecision]): Returned the value of ContentFilterDecisionKey as a WebMockContentFilterDecision.
+ Defaulted to WebMockContentFilterDecisionAllow if the value is invalid.
+ (-[SettingsController setContentFilteringDecisionPoint:]): Set ContentFilterDecisionPointKey and called -[BrowserAppDelegate didChangeSettings].
+ (-[SettingsController contentFilteringDecisionPoint]): Returned the value of ContentFilterDecisionPointKey as a WebMockContentFilterDecisionPoint.
+ Defaulted to WebMockContentFilterDecisionPointAfterWillSendRequest if the value is invalid.
+ * MiniBrowser/mac/WK1BrowserWindowController.h:
+ * MiniBrowser/mac/WK1BrowserWindowController.m:
+ (-[WK1BrowserWindowController dealloc]):
+ (-[WK1BrowserWindowController didChangeSettings]): Created a WebMockContentFilterEnabler with the current settings and stored it in _contentFilterEnabler.
+ * MiniBrowser/mac/WK2BrowserWindowController.m:
+ (-[WK2BrowserWindowController didChangeSettings]): Created a WebMockContentFilterEnabler and set it as the object for the eponymous bundle parameter.
+ * TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig: Linked against libWebCoreTestSupport.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm:
+ (configurationWithContentFilterSettings): Converted to use WebMockContentFilterEnabler, WebMockContentFilterDecision, and WebMockContentFilterDecisionPoint.
+ (TEST): Ditto.
+ (downloadTest): Ditto.
+ (+[MockContentFilterEnabler supportsSecureCoding]): Deleted.
+ (-[MockContentFilterEnabler copyWithZone:]): Deleted.
+ (-[MockContentFilterEnabler initWithCoder:]): Deleted.
+ (-[MockContentFilterEnabler initWithDecision:decisionPoint:]): Deleted.
+ (-[MockContentFilterEnabler encodeWithCoder:]): Deleted.
+ * TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm:
+ (-[ContentFilteringPlugIn webProcessPlugIn:initializeWithObject:]): Converted to use WebMockContentFilterEnabler.
+ (-[ContentFilteringPlugIn dealloc]): Ditto.
+ (-[ContentFilteringPlugIn observeValueForKeyPath:ofObject:change:context:]): Ditto.
+ (+[MockContentFilterEnabler supportsSecureCoding]): Deleted.
+ (-[MockContentFilterEnabler copyWithZone:]): Deleted.
+ (-[MockContentFilterEnabler initWithCoder:]): Deleted.
+ (-[MockContentFilterEnabler dealloc]): Deleted.
+ (-[MockContentFilterEnabler encodeWithCoder:]): Deleted.
+
</ins><span class="cx"> 2015-11-24 Gyuyoung Kim <gyuyoung.kim@webkit.org>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r192053): MiniBrowser doesn't exit when clicking on the close-window button
</span></span></pre></div>
<a id="trunkToolsMiniBrowserConfigurationsBasexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/Configurations/Base.xcconfig (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/Configurations/Base.xcconfig        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/Configurations/Base.xcconfig        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -65,3 +65,5 @@
</span><span class="cx"> OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
</span><span class="cx"> OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
</span><span class="cx"> OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
</span><ins>+
+HEADER_SEARCH_PATHS = $(inherited) $(BUILT_PRODUCTS_DIR)/WebCoreTestSupport $(SDKROOT)/usr/local/include/WebCoreTestSupport
</ins></span></pre></div>
<a id="trunkToolsMiniBrowserConfigurationsMiniBrowserxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/Configurations/MiniBrowser.xcconfig (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/Configurations/MiniBrowser.xcconfig        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/Configurations/MiniBrowser.xcconfig        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -25,4 +25,5 @@
</span><span class="cx"> GCC_PREFIX_HEADER = mac/MiniBrowser_Prefix.pch
</span><span class="cx"> INFOPLIST_FILE = mac/Info.plist
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *
</span><del>-OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa -framework WebKit
</del><ins>+OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa -framework WebKit -lWebCoreTestSupport
+LD_RUNPATH_SEARCH_PATHS = "@loader_path/."
</ins></span></pre></div>
<a id="trunkToolsMiniBrowserConfigurationsMiniBrowserBundlexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/Configurations/MiniBrowserBundle.xcconfig (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/Configurations/MiniBrowserBundle.xcconfig        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/Configurations/MiniBrowserBundle.xcconfig        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -25,4 +25,5 @@
</span><span class="cx"> GCC_PREFIX_HEADER = mac/Bundle/MiniBrowserBundle_Prefix.pch
</span><span class="cx"> INFOPLIST_FILE = mac/Bundle/Info.plist
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *
</span><del>-OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa
</del><ins>+OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa -lWebCoreTestSupport
+LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../.."
</ins></span></pre></div>
<a id="trunkToolsMiniBrowserMiniBrowserxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -16,6 +16,9 @@
</span><span class="cx">                 51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E244F911EFCE07008228D1 /* MBToolbarItem.m */; };
</span><span class="cx">                 7CA379421AC381C10079DC37 /* ExtensionManagerWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7CA379401AC381C10079DC37 /* ExtensionManagerWindowController.m */; };
</span><span class="cx">                 7CA379431AC381C10079DC37 /* ExtensionManagerWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */; };
</span><ins>+                A138DE441C007D240029832B /* blocked-page.html in Resources */ = {isa = PBXBuildFile; fileRef = A138DE431C007D240029832B /* blocked-page.html */; };
+                A138DE491C02E58E0029832B /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A138DE481C02E58E0029832B /* libWebCoreTestSupport.dylib */; };
+                A138DE4A1C02E5920029832B /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A138DE481C02E58E0029832B /* libWebCoreTestSupport.dylib */; };
</ins><span class="cx">                 BC329487116A92E2008635D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329486116A92E2008635D0 /* main.m */; };
</span><span class="cx">                 BC329498116A941B008635D0 /* WK2BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D0 /* WK2BrowserWindowController.m */; };
</span><span class="cx">                 BC72B89511E57E07001EB4EA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58150DA1D0A300B32029 /* MainMenu.xib */; };
</span><span class="lines">@@ -73,6 +76,8 @@
</span><span class="cx">                 7CA379401AC381C10079DC37 /* ExtensionManagerWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ExtensionManagerWindowController.m; path = mac/ExtensionManagerWindowController.m; sourceTree = "<group>"; };
</span><span class="cx">                 7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ExtensionManagerWindowController.xib; path = mac/ExtensionManagerWindowController.xib; sourceTree = "<group>"; };
</span><span class="cx">                 8D1107320486CEB800E47090 /* MiniBrowser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MiniBrowser.app; sourceTree = BUILT_PRODUCTS_DIR; };
</span><ins>+                A138DE431C007D240029832B /* blocked-page.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "blocked-page.html"; sourceTree = "<group>"; };
+                A138DE481C02E58E0029832B /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libWebCoreTestSupport.dylib; path = ../../WebKitBuild/Debug/libWebCoreTestSupport.dylib; sourceTree = "<group>"; };
</ins><span class="cx">                 BC329486116A92E2008635D0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = mac/main.m; sourceTree = "<group>"; };
</span><span class="cx">                 BC329496116A941B008635D0 /* WK2BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WK2BrowserWindowController.h; path = mac/WK2BrowserWindowController.h; sourceTree = "<group>"; };
</span><span class="cx">                 BC329497116A941B008635D0 /* WK2BrowserWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WK2BrowserWindowController.m; path = mac/WK2BrowserWindowController.m; sourceTree = "<group>"; };
</span><span class="lines">@@ -88,6 +93,7 @@
</span><span class="cx">                         isa = PBXFrameworksBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                A138DE4A1C02E5920029832B /* libWebCoreTestSupport.dylib in Frameworks */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -95,6 +101,7 @@
</span><span class="cx">                         isa = PBXFrameworksBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                A138DE491C02E58E0029832B /* libWebCoreTestSupport.dylib in Frameworks */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -174,6 +181,7 @@
</span><span class="cx">                                 BC3294A2116A9852008635D0 /* BrowserWindow.xib */,
</span><span class="cx">                                 1DDD58150DA1D0A300B32029 /* MainMenu.xib */,
</span><span class="cx">                                 7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */,
</span><ins>+                                A138DE431C007D240029832B /* blocked-page.html */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Resources;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -181,6 +189,7 @@
</span><span class="cx">                 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                A138DE481C02E58E0029832B /* libWebCoreTestSupport.dylib */,
</ins><span class="cx">                                 1AFFEF761860EE6800DA465E /* Cocoa.framework */,
</span><span class="cx">                                 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
</span><span class="cx">                         );
</span><span class="lines">@@ -291,6 +300,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 BC72B89611E57E0F001EB4EA /* BrowserWindow.xib in Resources */,
</span><span class="cx">                                 7CA379431AC381C10079DC37 /* ExtensionManagerWindowController.xib in Resources */,
</span><ins>+                                A138DE441C007D240029832B /* blocked-page.html in Resources */,
</ins><span class="cx">                                 BC72B89511E57E07001EB4EA /* MainMenu.xib in Resources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span></span></pre></div>
<a id="trunkToolsMiniBrowserMiniBrowserWebProcessPlugInm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/MiniBrowserWebProcessPlugIn.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/MiniBrowserWebProcessPlugIn.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/MiniBrowserWebProcessPlugIn.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -27,12 +27,35 @@
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><del>-@implementation MiniBrowserWebProcessPlugIn
</del><ins>+#import "MockContentFilterEnabler.h"
</ins><span class="cx">
</span><ins>+@implementation MiniBrowserWebProcessPlugIn {
+ WebMockContentFilterEnabler *_contentFilterEnabler;
+ WKWebProcessPlugInController *_plugInController;
+}
+
</ins><span class="cx"> - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject
</span><span class="cx"> {
</span><del>-}
</del><ins>+ _plugInController = [plugInController retain];
+ [_plugInController.parameters addObserver:self forKeyPath:NSStringFromClass([WebMockContentFilterEnabler class]) options:NSKeyValueObservingOptionInitial context:NULL];
+}
</ins><span class="cx">
</span><ins>+- (void)dealloc
+{
+ [_plugInController.parameters removeObserver:self forKeyPath:NSStringFromClass([WebMockContentFilterEnabler class])];
+ [_plugInController release];
+ [_contentFilterEnabler release];
+ [super dealloc];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ WebMockContentFilterEnabler *enabler = [[object valueForKeyPath:keyPath] retain];
+ [_contentFilterEnabler release];
+ _contentFilterEnabler = enabler;
+ [_contentFilterEnabler enable];
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkToolsMiniBrowserblockedpagehtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/MiniBrowser/blocked-page.html (0 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/blocked-page.html         (rev 0)
+++ trunk/Tools/MiniBrowser/blocked-page.html        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+<!DOCTYPE html>
+<style>
+span {
+ font-family: -apple-system-font;
+}
+
+.container {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translateX(-50%) translateY(-50%);
+}
+</style>
+<div class="container">
+ <span>Blocked by Content Filter</span>
+</div>
</ins></span></pre></div>
<a id="trunkToolsMiniBrowsermacAppDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/AppDelegate.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -74,12 +74,11 @@
</span><span class="cx"> configuration.preferences._fullScreenEnabled = YES;
</span><span class="cx"> configuration.preferences._developerExtrasEnabled = YES;
</span><span class="cx">
</span><del>- if ([SettingsController shared].perWindowWebProcessesDisabled) {
- _WKProcessPoolConfiguration *singleProcessConfiguration = [[_WKProcessPoolConfiguration alloc] init];
- singleProcessConfiguration.maximumProcessCount = 1;
- configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:singleProcessConfiguration] autorelease];
- [singleProcessConfiguration release];
- }
</del><ins>+ _WKProcessPoolConfiguration *processPoolConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease];
+ processPoolConfiguration.injectedBundleURL = [[NSBundle mainBundle] URLForAuxiliaryExecutable:@"MiniBrowser.wkbundle"];
+ if ([SettingsController shared].perWindowWebProcessesDisabled)
+ processPoolConfiguration.maximumProcessCount = 1;
+ configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration] autorelease];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> configuration.suppressesIncrementalRendering = [SettingsController shared].incrementalRenderingSuppressed;
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.h (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.h        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -76,5 +76,7 @@
</span><span class="cx">
</span><span class="cx"> - (NSURL *)currentURL;
</span><span class="cx">
</span><ins>++ (NSString *)contentFilteringBlockedString;
+
</ins><span class="cx"> @end
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -174,4 +174,12 @@
</span><span class="cx"> return nil;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>++ (NSString *)contentFilteringBlockedString
+{
+ static NSString *blockedString;
+ if (!blockedString)
+ blockedString = [[NSString alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"blocked-page" withExtension:@"html"] encoding:NSUTF8StringEncoding error:NULL];
+ return blockedString;
+}
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBundleMiniBrowserBundle_Prefixpch"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/Bundle/MiniBrowserBundle_Prefix.pch (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/Bundle/MiniBrowserBundle_Prefix.pch        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/Bundle/MiniBrowserBundle_Prefix.pch        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -26,3 +26,5 @@
</span><span class="cx"> #ifdef __OBJC__
</span><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx"> #endif
</span><ins>+
+#define WTF_EXPORT_PRIVATE
</ins></span></pre></div>
<a id="trunkToolsMiniBrowsermacMiniBrowser_Prefixpch"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/MiniBrowser_Prefix.pch        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -35,3 +35,5 @@
</span><span class="cx"> #else
</span><span class="cx"> #define LOG(...) ((void)0)
</span><span class="cx"> #endif
</span><ins>+
+#define WTF_EXPORT_PRIVATE
</ins></span></pre></div>
<a id="trunkToolsMiniBrowsermacSettingsControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/SettingsController.h (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/SettingsController.h        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#import "MockContentFilterSettings.h"
</ins><span class="cx"> #import <Cocoa/Cocoa.h>
</span><span class="cx">
</span><span class="cx"> @interface SettingsController : NSObject {
</span><span class="lines">@@ -48,5 +49,8 @@
</span><span class="cx"> @property (nonatomic, readonly) BOOL subPixelCSSOMMetricsEnabled;
</span><span class="cx"> @property (nonatomic, readonly) BOOL acceleratedDrawingEnabled;
</span><span class="cx"> @property (nonatomic, readonly) NSString *defaultURL;
</span><ins>+@property (nonatomic, readonly) BOOL contentFilteringEnabled;
+@property (nonatomic, readonly) WebMockContentFilterDecision contentFilteringDecision;
+@property (nonatomic, readonly) WebMockContentFilterDecisionPoint contentFilteringDecisionPoint;
</ins><span class="cx">
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacSettingsControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/SettingsController.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/SettingsController.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #import "AppDelegate.h"
</span><span class="cx"> #import "BrowserWindowController.h"
</span><ins>+#import "MockContentFilterSettings.h"
</ins><span class="cx">
</span><span class="cx"> static NSString * const defaultURL = @"http://www.webkit.org/";
</span><span class="cx"> static NSString * const DefaultURLPreferenceKey = @"DefaultURL";
</span><span class="lines">@@ -39,6 +40,10 @@
</span><span class="cx"> static NSString * const IncrementalRenderingSuppressedPreferenceKey = @"IncrementalRenderingSuppressed";
</span><span class="cx"> static NSString * const AcceleratedDrawingEnabledPreferenceKey = @"AcceleratedDrawingEnabled";
</span><span class="cx">
</span><ins>+static NSString * const ContentFilteringEnabledKey = @"ContentFilteringEnabled";
+static NSString * const ContentFilterDecisionKey = @"ContentFilterDecision";
+static NSString * const ContentFilterDecisionPointKey = @"ContentFilterDecisionPoint";
+
</ins><span class="cx"> static NSString * const NonFastScrollableRegionOverlayVisiblePreferenceKey = @"NonFastScrollableRegionOverlayVisible";
</span><span class="cx"> static NSString * const WheelEventHandlerRegionOverlayVisiblePreferenceKey = @"WheelEventHandlerRegionOverlayVisible";
</span><span class="cx">
</span><span class="lines">@@ -110,6 +115,8 @@
</span><span class="cx"> [self _addItemWithTitle:@"Show Simple Line Layout Borders" action:@selector(toggleSimpleLineLayoutDebugBordersEnabled:) indented:NO];
</span><span class="cx"> [self _addItemWithTitle:@"Suppress Incremental Rendering in New Windows" action:@selector(toggleIncrementalRenderingSuppressed:) indented:NO];
</span><span class="cx"> [self _addItemWithTitle:@"Enable Accelerated Drawing" action:@selector(toggleAcceleratedDrawingEnabled:) indented:NO];
</span><ins>+
+ [_menu addItem:[self _contentFilteringMenuItem]];
</ins><span class="cx">
</span><span class="cx"> [self _addHeaderWithTitle:@"WebKit2-only Settings"];
</span><span class="cx">
</span><span class="lines">@@ -170,6 +177,17 @@
</span><span class="cx"> [menuItem setState:[self subPixelCSSOMMetricsEnabled] ? NSOnState : NSOffState];
</span><span class="cx"> else if (action == @selector(toggleDebugOverlay:))
</span><span class="cx"> [menuItem setState:[self debugOverlayVisible:menuItem] ? NSOnState : NSOffState];
</span><ins>+ else if (action == @selector(toggleContentFilteringEnabled:))
+ [menuItem setState:[self contentFilteringEnabled] ? NSOnState : NSOffState];
+ else if (action == @selector(setContentFilteringDecision:)) {
+ [menuItem setState:[self contentFilteringDecision] == menuItem.tag ? NSOnState : NSOffState];
+ if (![self contentFilteringEnabled])
+ return NO;
+ } else if (action == @selector(setContentFilteringDecisionPoint:)) {
+ [menuItem setState:[self contentFilteringDecisionPoint] == menuItem.tag ? NSOnState : NSOffState];
+ if (![self contentFilteringEnabled])
+ return NO;
+ }
</ins><span class="cx">
</span><span class="cx"> return YES;
</span><span class="cx"> }
</span><span class="lines">@@ -370,4 +388,123 @@
</span><span class="cx"> [[NSUserDefaults standardUserDefaults] setObject:customDefaultURL forKey:DefaultURLPreferenceKey];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark Content Filtering
+
+- (NSMenuItem *)_contentFilteringMenuItem
+{
+ NSMenu *menu = [[[NSMenu alloc] initWithTitle:@"Content Filtering"] autorelease];
+
+ NSMenuItem *enabledItem = [[[NSMenuItem alloc] initWithTitle:@"Enabled" action:@selector(toggleContentFilteringEnabled:) keyEquivalent:@""] autorelease];
+ enabledItem.target = self;
+ [menu addItem:enabledItem];
+
+ [menu addItem:[NSMenuItem separatorItem]];
+ [menu addItem:[[[NSMenuItem alloc] initWithTitle:@"Decision" action:nil keyEquivalent:@""] autorelease]];
+
+ NSMenuItem *allowItem = [[[NSMenuItem alloc] initWithTitle:@"Allow" action:@selector(setContentFilteringDecision:) keyEquivalent:@""] autorelease];
+ allowItem.target = self;
+ allowItem.indentationLevel = 1;
+ allowItem.tag = WebMockContentFilterDecisionAllow;
+ [menu addItem:allowItem];
+
+ NSMenuItem *blockItem = [[[NSMenuItem alloc] initWithTitle:@"Block" action:@selector(setContentFilteringDecision:) keyEquivalent:@""] autorelease];
+ blockItem.target = self;
+ blockItem.indentationLevel = 1;
+ blockItem.tag = WebMockContentFilterDecisionBlock;
+ [menu addItem:blockItem];
+
+ [menu addItem:[NSMenuItem separatorItem]];
+ [menu addItem:[[[NSMenuItem alloc] initWithTitle:@"Decision Point" action:nil keyEquivalent:@""] autorelease]];
+
+ NSMenuItem *afterWillSendRequestItem = [[[NSMenuItem alloc] initWithTitle:@"After Will Send Request" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ afterWillSendRequestItem.target = self;
+ afterWillSendRequestItem.indentationLevel = 1;
+ afterWillSendRequestItem.tag = WebMockContentFilterDecisionPointAfterWillSendRequest;
+ [menu addItem:afterWillSendRequestItem];
+
+ NSMenuItem *afterRedirectItem = [[[NSMenuItem alloc] initWithTitle:@"After Redirect" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ afterRedirectItem.target = self;
+ afterRedirectItem.indentationLevel = 1;
+ afterRedirectItem.tag = WebMockContentFilterDecisionPointAfterRedirect;
+ [menu addItem:afterRedirectItem];
+
+ NSMenuItem *afterResponseItem = [[[NSMenuItem alloc] initWithTitle:@"After Response" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ afterResponseItem.target = self;
+ afterResponseItem.indentationLevel = 1;
+ afterResponseItem.tag = WebMockContentFilterDecisionPointAfterResponse;
+ [menu addItem:afterResponseItem];
+
+ NSMenuItem *afterAddDataItem = [[[NSMenuItem alloc] initWithTitle:@"After Add Data" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ afterAddDataItem.target = self;
+ afterAddDataItem.indentationLevel = 1;
+ afterAddDataItem.tag = WebMockContentFilterDecisionPointAfterAddData;
+ [menu addItem:afterAddDataItem];
+
+ NSMenuItem *afterFinishedAddingDataItem = [[[NSMenuItem alloc] initWithTitle:@"After Finished Adding Data" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ afterFinishedAddingDataItem.target = self;
+ afterFinishedAddingDataItem.indentationLevel = 1;
+ afterFinishedAddingDataItem.tag = WebMockContentFilterDecisionPointAfterFinishedAddingData;
+ [menu addItem:afterFinishedAddingDataItem];
+
+ NSMenuItem *neverMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Never" action:@selector(setContentFilteringDecisionPoint:) keyEquivalent:@""] autorelease];
+ neverMenuItem.target = self;
+ neverMenuItem.indentationLevel = 1;
+ neverMenuItem.tag = WebMockContentFilterDecisionPointNever;
+ [menu addItem:neverMenuItem];
+
+ NSMenuItem *submenuItem = [[NSMenuItem alloc] initWithTitle:@"Content Filtering" action:nil keyEquivalent:@""];
+ [submenuItem setSubmenu:menu];
+ return [submenuItem autorelease];
+}
+
+- (void)toggleContentFilteringEnabled:(id)sender
+{
+ [self _toggleBooleanDefault:ContentFilteringEnabledKey];
+}
+
+- (BOOL)contentFilteringEnabled
+{
+ return [[NSUserDefaults standardUserDefaults] boolForKey:ContentFilteringEnabledKey];
+}
+
+- (void)setContentFilteringDecision:(id)sender
+{
+ [[NSUserDefaults standardUserDefaults] setInteger:[sender tag] forKey:ContentFilterDecisionKey];
+ [(BrowserAppDelegate *)[[NSApplication sharedApplication] delegate] didChangeSettings];
+}
+
+- (WebMockContentFilterDecision)contentFilteringDecision
+{
+ NSInteger decision = [[NSUserDefaults standardUserDefaults] integerForKey:ContentFilterDecisionKey];
+ switch (decision) {
+ case (NSInteger)WebMockContentFilterDecisionAllow:
+ case (NSInteger)WebMockContentFilterDecisionBlock:
+ return (WebMockContentFilterDecision)decision;
+ default:
+ return WebMockContentFilterDecisionAllow;
+ }
+}
+
+- (void)setContentFilteringDecisionPoint:(id)sender
+{
+ [[NSUserDefaults standardUserDefaults] setInteger:[sender tag] forKey:ContentFilterDecisionPointKey];
+ [(BrowserAppDelegate *)[[NSApplication sharedApplication] delegate] didChangeSettings];
+}
+
+- (WebMockContentFilterDecisionPoint)contentFilteringDecisionPoint
+{
+ NSInteger decisionPoint = [[NSUserDefaults standardUserDefaults] integerForKey:ContentFilterDecisionPointKey];
+ switch (decisionPoint) {
+ case (NSInteger)WebMockContentFilterDecisionPointAfterWillSendRequest:
+ case (NSInteger)WebMockContentFilterDecisionPointAfterRedirect:
+ case (NSInteger)WebMockContentFilterDecisionPointAfterResponse:
+ case (NSInteger)WebMockContentFilterDecisionPointAfterAddData:
+ case (NSInteger)WebMockContentFilterDecisionPointAfterFinishedAddingData:
+ case (NSInteger)WebMockContentFilterDecisionPointNever:
+ return (WebMockContentFilterDecisionPoint)decisionPoint;
+ default:
+ return WebMockContentFilterDecisionPointAfterWillSendRequest;
+ }
+}
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK1BrowserWindowControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.h (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.h        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.h        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -25,10 +25,12 @@
</span><span class="cx">
</span><span class="cx"> #import "BrowserWindowController.h"
</span><span class="cx">
</span><ins>+@class WebMockContentFilterEnabler;
</ins><span class="cx"> @class WebView;
</span><span class="cx">
</span><span class="cx"> @interface WK1BrowserWindowController : BrowserWindowController {
</span><span class="cx"> WebView *_webView;
</span><ins>+ WebMockContentFilterEnabler *_contentFilterEnabler;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK1BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import "WK1BrowserWindowController.h"
</span><span class="cx">
</span><span class="cx"> #import "AppDelegate.h"
</span><ins>+#import "MockContentFilterEnabler.h"
</ins><span class="cx"> #import "SettingsController.h"
</span><span class="cx"> #import <WebKit/WebKit.h>
</span><span class="cx"> #import <WebKit/WebPreferences.h>
</span><span class="lines">@@ -67,6 +68,7 @@
</span><span class="cx"> [_webView setUIDelegate:nil];
</span><span class="cx"> [_webView setResourceLoadDelegate:nil];
</span><span class="cx"> [_webView release];
</span><ins>+ [_contentFilterEnabler release];
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -281,6 +283,10 @@
</span><span class="cx"> } else
</span><span class="cx"> [_webView _setPaginationMode:WebPaginationModeUnpaginated];
</span><span class="cx"> }
</span><ins>+
+ [_contentFilterEnabler release];
+ _contentFilterEnabler = settings.contentFilteringEnabled ? [[WebMockContentFilterEnabler alloc] initWithDecision:settings.contentFilteringDecision decisionPoint:settings.contentFilteringDecisionPoint blockedString:[BrowserWindowController contentFilteringBlockedString]] : nil;
+ [_contentFilterEnabler enable];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (IBAction)printWebView:(id)sender
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK2BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -28,10 +28,12 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> #import "AppDelegate.h"
</span><ins>+#import "MockContentFilterEnabler.h"
</ins><span class="cx"> #import "SettingsController.h"
</span><span class="cx"> #import <WebKit/WKFrameInfo.h>
</span><span class="cx"> #import <WebKit/WKNavigationDelegate.h>
</span><span class="cx"> #import <WebKit/WKPreferencesPrivate.h>
</span><ins>+#import <WebKit/WKProcessPoolPrivate.h>
</ins><span class="cx"> #import <WebKit/WKUIDelegate.h>
</span><span class="cx"> #import <WebKit/WKWebViewConfigurationPrivate.h>
</span><span class="cx"> #import <WebKit/WKWebViewPrivate.h>
</span><span class="lines">@@ -372,6 +374,9 @@
</span><span class="cx"> visibleOverlayRegions |= _WKWheelEventHandlerRegion;
</span><span class="cx">
</span><span class="cx"> preferences._visibleDebugOverlayRegions = visibleOverlayRegions;
</span><ins>+
+ WebMockContentFilterEnabler *enabler = settings.contentFilteringEnabled ? [[[WebMockContentFilterEnabler alloc] initWithDecision:settings.contentFilteringDecision decisionPoint:settings.contentFilteringDecisionPoint blockedString:[BrowserWindowController contentFilteringBlockedString]] autorelease] : nil;
+ [_webView.configuration.processPool _setObject:enabler forBundleParameter:NSStringFromClass([WebMockContentFilterEnabler class])];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)updateTitle:(NSString *)title
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIConfigurationsTestWebKitAPIxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -26,8 +26,11 @@
</span><span class="cx">
</span><span class="cx"> UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZN7testing4Test16TearDownTestCaseEv -Wl,-unexported_symbol -Wl,__ZN7testing4Test13SetUpTestCaseEv
</span><span class="cx">
</span><del>-OTHER_LDFLAGS = $(inherited) $(UNEXPORTED_SYMBOL_LDFLAGS) -lgtest -force_load $(BUILT_PRODUCTS_DIR)/libTestWebKitAPI.a -framework JavaScriptCore -framework WebKit $(OTHER_LDFLAGS_PLATFORM);
</del><ins>+OTHER_LDFLAGS = $(inherited) $(UNEXPORTED_SYMBOL_LDFLAGS) -lgtest -force_load $(BUILT_PRODUCTS_DIR)/libTestWebKitAPI.a -framework JavaScriptCore -framework WebKit -lWebCoreTestSupport $(OTHER_LDFLAGS_PLATFORM);
</ins><span class="cx"> OTHER_LDFLAGS_PLATFORM[sdk=macosx*] = -framework Cocoa -framework Carbon;
</span><span class="cx">
</span><span class="cx"> // FIXME: This should not be built on iOS. Instead we should create and use a TestWebKitAPI application.
</span><span class="cx"> OTHER_LDFLAGS_PLATFORM[sdk=iphone*] = -framework WebCore -framework CoreGraphics;
</span><ins>+
+LD_RUNPATH_SEARCH_PATHS = "@loader_path/.";
+
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaContentFilteringmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.mm        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED && PLATFORM(MAC)
</span><span class="cx">
</span><del>-#import "MockContentFilterSettings.h"
</del><ins>+#import "MockContentFilterEnabler.h"
</ins><span class="cx"> #import "PlatformUtilities.h"
</span><span class="cx"> #import "TestProtocol.h"
</span><span class="cx"> #import "WKWebViewConfigurationExtras.h"
</span><span class="lines">@@ -38,58 +38,13 @@
</span><span class="cx"> #import <WebKit/_WKDownloadDelegate.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx">
</span><del>-using Decision = WebCore::MockContentFilterSettings::Decision;
-using DecisionPoint = WebCore::MockContentFilterSettings::DecisionPoint;
-
</del><span class="cx"> static bool isDone;
</span><span class="cx">
</span><del>-@interface MockContentFilterEnabler : NSObject <NSCopying, NSSecureCoding>
-- (instancetype)initWithDecision:(Decision)decision decisionPoint:(DecisionPoint)decisionPoint;
-@end
-
-@implementation MockContentFilterEnabler {
- Decision _decision;
- DecisionPoint _decisionPoint;
-}
-
-+ (BOOL)supportsSecureCoding
</del><ins>+static RetainPtr<WKWebViewConfiguration> configurationWithContentFilterSettings(WebMockContentFilterDecision decision, WebMockContentFilterDecisionPoint decisionPoint)
</ins><span class="cx"> {
</span><del>- return YES;
-}
-
-- (id)copyWithZone:(NSZone *)zone
-{
- return [self retain];
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder
-{
- return [super init];
-}
-
-- (instancetype)initWithDecision:(Decision)decision decisionPoint:(DecisionPoint)decisionPoint
-{
- if (!(self = [super init]))
- return nil;
-
- _decision = decision;
- _decisionPoint = decisionPoint;
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder
-{
- [coder encodeInt:static_cast<int>(_decision) forKey:@"Decision"];
- [coder encodeInt:static_cast<int>(_decisionPoint) forKey:@"DecisionPoint"];
-}
-
-@end
-
-static RetainPtr<WKWebViewConfiguration> configurationWithContentFilterSettings(Decision decision, DecisionPoint decisionPoint)
-{
</del><span class="cx"> auto configuration = retainPtr([WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@"ContentFilteringPlugIn"]);
</span><del>- auto contentFilterEnabler = adoptNS([[MockContentFilterEnabler alloc] initWithDecision:decision decisionPoint:decisionPoint]);
- [[configuration processPool] _setObject:contentFilterEnabler.get() forBundleParameter:NSStringFromClass([MockContentFilterEnabler class])];
</del><ins>+ auto contentFilterEnabler = adoptNS([[WebMockContentFilterEnabler alloc] initWithDecision:decision decisionPoint:decisionPoint blockedString:nil]);
+ [[configuration processPool] _setObject:contentFilterEnabler.get() forBundleParameter:NSStringFromClass([WebMockContentFilterEnabler class])];
</ins><span class="cx"> return configuration;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -121,7 +76,7 @@
</span><span class="cx"> [NSURLProtocol registerClass:[TestProtocol class]];
</span><span class="cx"> [WKBrowsingContextController registerSchemeForCustomProtocol:[TestProtocol scheme]];
</span><span class="cx">
</span><del>- auto configuration = configurationWithContentFilterSettings(Decision::Allow, DecisionPoint::AfterAddData);
</del><ins>+ auto configuration = configurationWithContentFilterSettings(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterAddData);
</ins><span class="cx"> auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
</span><span class="cx"> auto navigationDelegate = adoptNS([[ServerRedirectNavigationDelegate alloc] init]);
</span><span class="cx"> [webView setNavigationDelegate:navigationDelegate.get()];
</span><span class="lines">@@ -169,7 +124,7 @@
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-static void downloadTest(Decision decision, DecisionPoint decisionPoint)
</del><ins>+static void downloadTest(WebMockContentFilterDecision decision, WebMockContentFilterDecisionPoint decisionPoint)
</ins><span class="cx"> {
</span><span class="cx"> @autoreleasepool {
</span><span class="cx"> [NSURLProtocol registerClass:[TestProtocol class]];
</span><span class="lines">@@ -185,7 +140,7 @@
</span><span class="cx">
</span><span class="cx"> isDone = false;
</span><span class="cx"> downloadDidStart = false;
</span><del>- const bool downloadShouldStart = decision == Decision::Allow || decisionPoint > DecisionPoint::AfterResponse;
</del><ins>+ const bool downloadShouldStart = decision == WebMockContentFilterDecisionAllow || decisionPoint > WebMockContentFilterDecisionPointAfterResponse;
</ins><span class="cx"> if (downloadShouldStart)
</span><span class="cx"> TestWebKitAPI::Util::run(&downloadDidStart);
</span><span class="cx"> else
</span><span class="lines">@@ -200,62 +155,62 @@
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadAfterWillSendRequest)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::AfterWillSendRequest);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterWillSendRequest);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadAfterWillSendRequest)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::AfterWillSendRequest);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointAfterWillSendRequest);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadAfterRedirect)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::AfterRedirect);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterRedirect);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadAfterRedirect)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::AfterRedirect);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointAfterRedirect);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadAfterResponse)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::AfterResponse);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterResponse);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadAfterResponse)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::AfterResponse);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointAfterResponse);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadAfterAddData)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::AfterAddData);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterAddData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadAfterAddData)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::AfterAddData);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointAfterAddData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadAfterFinishedAddingData)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::AfterFinishedAddingData);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointAfterFinishedAddingData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadAfterFinishedAddingData)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::AfterFinishedAddingData);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointAfterFinishedAddingData);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, AllowDownloadNever)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Allow, DecisionPoint::Never);
</del><ins>+ downloadTest(WebMockContentFilterDecisionAllow, WebMockContentFilterDecisionPointNever);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TEST(ContentFiltering, BlockDownloadNever)
</span><span class="cx"> {
</span><del>- downloadTest(Decision::Block, DecisionPoint::Never);
</del><ins>+ downloadTest(WebMockContentFilterDecisionBlock, WebMockContentFilterDecisionPointNever);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaContentFilteringPlugInmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm (192768 => 192769)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm        2015-11-25 01:43:14 UTC (rev 192768)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFilteringPlugIn.mm        2015-11-25 08:48:36 UTC (rev 192769)
</span><span class="lines">@@ -27,57 +27,14 @@
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><del>-#import "MockContentFilterSettings.h"
</del><ins>+#import "MockContentFilterEnabler.h"
</ins><span class="cx"> #import <WebKit/WKWebProcessPlugIn.h>
</span><span class="cx">
</span><del>-using MockContentFilterSettings = WebCore::MockContentFilterSettings;
-using Decision = MockContentFilterSettings::Decision;
-using DecisionPoint = MockContentFilterSettings::DecisionPoint;
-
-@interface MockContentFilterEnabler : NSObject <NSCopying, NSSecureCoding>
-@end
-
-@implementation MockContentFilterEnabler
-
-+ (BOOL)supportsSecureCoding
-{
- return YES;
-}
-
-- (id)copyWithZone:(NSZone *)zone
-{
- return [self retain];
-}
-
-- (instancetype)initWithCoder:(NSCoder *)decoder
-{
- if (!(self = [super init]))
- return nil;
-
- auto& settings = MockContentFilterSettings::singleton();
- settings.setEnabled(true);
- settings.setDecision(static_cast<Decision>([decoder decodeIntForKey:@"Decision"]));
- settings.setDecisionPoint(static_cast<DecisionPoint>([decoder decodeIntForKey:@"DecisionPoint"]));
- return self;
-}
-
-- (void)dealloc
-{
- MockContentFilterSettings::singleton().setEnabled(false);
- [super dealloc];
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder
-{
-}
-
-@end
-
</del><span class="cx"> @interface ContentFilteringPlugIn : NSObject <WKWebProcessPlugIn>
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation ContentFilteringPlugIn {
</span><del>- RetainPtr<MockContentFilterEnabler> _contentFilterEnabler;
</del><ins>+ RetainPtr<WebMockContentFilterEnabler> _contentFilterEnabler;
</ins><span class="cx"> RetainPtr<WKWebProcessPlugInController> _plugInController;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -85,20 +42,21 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!_plugInController);
</span><span class="cx"> _plugInController = plugInController;
</span><del>- [plugInController.parameters addObserver:self forKeyPath:NSStringFromClass([MockContentFilterEnabler class]) options:NSKeyValueObservingOptionInitial context:NULL];
</del><ins>+ [plugInController.parameters addObserver:self forKeyPath:NSStringFromClass([WebMockContentFilterEnabler class]) options:NSKeyValueObservingOptionInitial context:NULL];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>- [[_plugInController parameters] removeObserver:self forKeyPath:NSStringFromClass([MockContentFilterEnabler class])];
</del><ins>+ [[_plugInController parameters] removeObserver:self forKeyPath:NSStringFromClass([WebMockContentFilterEnabler class])];
</ins><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
</span><span class="cx"> {
</span><span class="cx"> id contentFilterEnabler = [object valueForKeyPath:keyPath];
</span><del>- ASSERT([contentFilterEnabler isKindOfClass:[MockContentFilterEnabler class]]);
</del><ins>+ ASSERT(!contentFilterEnabler || [contentFilterEnabler isKindOfClass:[WebMockContentFilterEnabler class]]);
</ins><span class="cx"> _contentFilterEnabler = contentFilterEnabler;
</span><ins>+ [_contentFilterEnabler enable];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @end
</span></span></pre>
</div>
</div>
</body>
</html>