<!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>[176862] 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/176862">176862</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-05 12:48:20 -0800 (Fri, 05 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add a private browsing mode to MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=139308
Reviewed by Sam Weinig.
Source/WebCore:
Use -1 instead of -2 for the deleted value.
* page/SessionIDHash.h:
Tools:
* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration):
(-[BrowserAppDelegate newWindow:]):
(-[BrowserAppDelegate newPrivateWindow:]):
* MiniBrowser/mac/MainMenu.xib:
* MiniBrowser/mac/WK2BrowserWindowController.h:
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController awakeFromNib]):
(-[WK2BrowserWindowController initWithConfiguration:]):
(-[WK2BrowserWindowController dealloc]):
(-[WK2BrowserWindowController observeValueForKeyPath:ofObject:change:context:]):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageSessionIDHashh">trunk/Source/WebCore/page/SessionIDHash.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsermacAppDelegatem">trunk/Tools/MiniBrowser/mac/AppDelegate.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacMainMenuxib">trunk/Tools/MiniBrowser/mac/MainMenu.xib</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK2BrowserWindowControllerh">trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacWK2BrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Source/WebCore/ChangeLog        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-12-05 Anders Carlsson <andersca@apple.com>
+
+ Add a private browsing mode to MiniBrowser
+ https://bugs.webkit.org/show_bug.cgi?id=139308
+
+ Reviewed by Sam Weinig.
+
+ Use -1 instead of -2 for the deleted value.
+
+ * page/SessionIDHash.h:
+
</ins><span class="cx"> 2014-12-05 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Move 'text-emphasis-style' CSS property to the new StyleBuilder
</span></span></pre></div>
<a id="trunkSourceWebCorepageSessionIDHashh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SessionIDHash.h (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SessionIDHash.h        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Source/WebCore/page/SessionIDHash.h        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -32,14 +32,14 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>-// The empty value is emptySessionID(), the deleted value is (-2)
</del><ins>+// The empty value is emptySessionID(), the deleted value is (-1)
</ins><span class="cx"> struct SessionIDHash {
</span><span class="cx"> static unsigned hash(const WebCore::SessionID& p) { return (unsigned)p.sessionID(); }
</span><span class="cx"> static bool equal(const WebCore::SessionID& a, const WebCore::SessionID& b) { return a == b; }
</span><span class="cx"> static const bool safeToCompareToEmptyOrDeleted = true;
</span><span class="cx"> };
</span><span class="cx"> template<> struct HashTraits<WebCore::SessionID> : GenericHashTraits<WebCore::SessionID> {
</span><del>- static const uint64_t deletedValueIdentifier = 0xFFFFFFFFFFFFFFFE;
</del><ins>+ static const uint64_t deletedValueIdentifier = std::numeric_limits<uint64_t>::max();
</ins><span class="cx"> static const bool needsDestruction = false;
</span><span class="cx"> static WebCore::SessionID emptyValue() { return WebCore::SessionID::emptySessionID(); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Tools/ChangeLog        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-12-05 Anders Carlsson <andersca@apple.com>
+
+ Add a private browsing mode to MiniBrowser
+ https://bugs.webkit.org/show_bug.cgi?id=139308
+
+ Reviewed by Sam Weinig.
+
+ * MiniBrowser/mac/AppDelegate.m:
+ (defaultConfiguration):
+ (-[BrowserAppDelegate newWindow:]):
+ (-[BrowserAppDelegate newPrivateWindow:]):
+ * MiniBrowser/mac/MainMenu.xib:
+ * MiniBrowser/mac/WK2BrowserWindowController.h:
+ * MiniBrowser/mac/WK2BrowserWindowController.m:
+ (-[WK2BrowserWindowController awakeFromNib]):
+ (-[WK2BrowserWindowController initWithConfiguration:]):
+ (-[WK2BrowserWindowController dealloc]):
+ (-[WK2BrowserWindowController observeValueForKeyPath:ofObject:change:context:]):
+
</ins><span class="cx"> 2014-12-04 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Run http tests parallel
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacAppDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/AppDelegate.m        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -28,8 +28,10 @@
</span><span class="cx"> #import "SettingsController.h"
</span><span class="cx"> #import "WK1BrowserWindowController.h"
</span><span class="cx"> #import "WK2BrowserWindowController.h"
</span><del>-#import <WebKit/WebHistory.h>
-#import <WebKit/WebKit2.h>
</del><ins>+#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WebKit.h>
+#import <WebKit/_WKWebsiteDataStore.h>
</ins><span class="cx">
</span><span class="cx"> enum {
</span><span class="cx"> WebKit1NewWindowTag = 1,
</span><span class="lines">@@ -55,6 +57,22 @@
</span><span class="cx"> [[NSApp mainMenu] insertItem:[item autorelease] atIndex:[[NSApp mainMenu] indexOfItemWithTitle:@"Debug"]];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if WK_API_ENABLED
+static WKWebViewConfiguration *defaultConfiguration()
+{
+ static WKWebViewConfiguration *configuration;
+
+ if (!configuration) {
+ configuration = [[WKWebViewConfiguration alloc] init];
+ configuration.preferences._fullScreenEnabled = YES;
+ configuration.preferences._developerExtrasEnabled = YES;
+ }
+
+ return configuration;
+}
+#endif
+
+
</ins><span class="cx"> - (IBAction)newWindow:(id)sender
</span><span class="cx"> {
</span><span class="cx"> BrowserWindowController *controller = nil;
</span><span class="lines">@@ -70,7 +88,7 @@
</span><span class="cx"> controller = [[WK1BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"];
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> else
</span><del>- controller = [[WK2BrowserWindowController alloc] initWithWindowNibName:@"BrowserWindow"];
</del><ins>+ controller = [[WK2BrowserWindowController alloc] initWithConfiguration:defaultConfiguration()];
</ins><span class="cx"> #endif
</span><span class="cx"> if (!controller)
</span><span class="cx"> return;
</span><span class="lines">@@ -81,6 +99,23 @@
</span><span class="cx"> [controller loadURLString:[SettingsController shared].defaultURL];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (IBAction)newPrivateWindow:(id)sender
+{
+#if WK_API_ENABLED
+ WKWebViewConfiguration *privateConfiguraton = [defaultConfiguration() copy];
+ privateConfiguraton._websiteDataStore = [_WKWebsiteDataStore nonPersistentDataStore];
+
+ BrowserWindowController *controller = [[WK2BrowserWindowController alloc] initWithConfiguration:privateConfiguraton];
+ [privateConfiguraton release];
+
+ [[controller window] makeKeyAndOrderFront:sender];
+ [_browserWindowControllers addObject:controller];
+ [controller release];
+
+ [controller loadURLString:[SettingsController shared].defaultURL];
+#endif
+}
+
</ins><span class="cx"> - (void)browserWindowWillClose:(NSWindow *)window
</span><span class="cx"> {
</span><span class="cx"> [_browserWindowControllers removeObject:window.windowController];
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacMainMenuxib"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/MainMenu.xib (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/MainMenu.xib        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Tools/MiniBrowser/mac/MainMenu.xib        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
</span><del>-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
</del><ins>+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7096" systemVersion="14D42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
</ins><span class="cx"> <dependencies>
</span><del>- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</del><ins>+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7096"/>
</ins><span class="cx"> </dependencies>
</span><span class="cx"> <objects>
</span><span class="cx"> <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx"> </connections>
</span><span class="cx"> </customObject>
</span><span class="cx"> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
</span><del>- <customObject id="-3" userLabel="Application"/>
</del><ins>+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
</ins><span class="cx"> <menu title="AMainMenu" systemMenu="main" id="29">
</span><span class="cx"> <items>
</span><span class="cx"> <menuItem title="MiniBrowser" id="56">
</span><span class="lines">@@ -81,6 +81,12 @@
</span><span class="cx"> <action selector="newWindow:" target="-1" id="572"/>
</span><span class="cx"> </connections>
</span><span class="cx"> </menuItem>
</span><ins>+ <menuItem title="New WebKit2 Private Window" tag="2" id="Zqs-AO-XAX">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="newPrivateWindow:" target="-1" id="mf5-zi-a5R"/>
+ </connections>
+ </menuItem>
</ins><span class="cx"> <menuItem title="Open…" keyEquivalent="o" id="72">
</span><span class="cx"> <connections>
</span><span class="cx"> <action selector="openDocument:" target="-1" id="374"/>
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK2BrowserWindowControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -28,6 +28,9 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> @interface WK2BrowserWindowController : BrowserWindowController <BrowserController>
</span><ins>+
+- (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration;
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacWK2BrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (176861 => 176862)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2014-12-05 20:27:37 UTC (rev 176861)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m        2014-12-05 20:48:20 UTC (rev 176862)
</span><span class="lines">@@ -34,8 +34,9 @@
</span><span class="cx"> #import <WebKit/WKPreferencesPrivate.h>
</span><span class="cx"> #import <WebKit/WKUIDelegate.h>
</span><span class="cx"> #import <WebKit/WKWebView.h>
</span><del>-#import <WebKit/WKWebViewConfiguration.h>
</del><ins>+#import <WebKit/WKWebViewConfigurationPrivate.h>
</ins><span class="cx"> #import <WebKit/WKWebViewPrivate.h>
</span><ins>+#import <WebKit/_WKWebsiteDataStore.h>
</ins><span class="cx">
</span><span class="cx"> static void* keyValueObservingContext = &keyValueObservingContext;
</span><span class="cx">
</span><span class="lines">@@ -43,19 +44,15 @@
</span><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WK2BrowserWindowController {
</span><ins>+ WKWebViewConfiguration *_configuration;
</ins><span class="cx"> WKWebView *_webView;
</span><span class="cx"> BOOL _zoomTextOnly;
</span><ins>+ BOOL _isPrivateBrowsingWindow;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)awakeFromNib
</span><span class="cx"> {
</span><del>- static WKWebViewConfiguration *configuration;
- if (!configuration) {
- configuration = [[WKWebViewConfiguration alloc] init];
- configuration.preferences._fullScreenEnabled = YES;
- configuration.preferences._developerExtrasEnabled = YES;
- }
- _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:configuration];
</del><ins>+ _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:_configuration];
</ins><span class="cx"> [self didChangeSettings];
</span><span class="cx">
</span><span class="cx"> _webView.allowsMagnification = YES;
</span><span class="lines">@@ -76,6 +73,17 @@
</span><span class="cx"> _zoomTextOnly = NO;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration
+{
+ if (!(self = [super initWithWindowNibName:@"BrowserWindow"]))
+ return nil;
+
+ _configuration = [configuration copy];
+ _isPrivateBrowsingWindow = _configuration._websiteDataStore.isNonPersistent;
+
+ return self;
+}
+
</ins><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><span class="cx"> [_webView removeObserver:self forKeyPath:@"title"];
</span><span class="lines">@@ -85,6 +93,7 @@
</span><span class="cx"> [progressIndicator unbind:NSValueBinding];
</span><span class="cx">
</span><span class="cx"> [_webView release];
</span><ins>+ [_configuration release];
</ins><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -315,7 +324,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if ([keyPath isEqualToString:@"title"])
</span><del>- self.window.title = [_webView.title stringByAppendingFormat:@" [WK2, %d]", _webView._webProcessIdentifier];
</del><ins>+ self.window.title = [NSString stringWithFormat:@"%@%@ [WK2 %d]", _isPrivateBrowsingWindow ? @"🙈 " : @"", _webView.title, _webView._webProcessIdentifier];
</ins><span class="cx"> else if ([keyPath isEqualToString:@"URL"])
</span><span class="cx"> [self updateTextFieldFromURL:_webView.URL];
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>