Changeset 166661 in webkit


Ignore:
Timestamp:
Apr 2, 2014 1:07:33 PM (10 years ago)
Author:
mhock@apple.com
Message:

Unify private browsing with sessions.
https://bugs.webkit.org/show_bug.cgi?id=130099

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Unless otherwise noted, the following consists solely of mechanical changes to replace querying WebCore::Settings::privateBrowsingEnabled() with Page::usesEphemeralSession().

  • Modules/webdatabase/DatabaseContext.cpp:

(WebCore::DatabaseContext::allowDatabaseAccess):

  • WebCore.exp.in: Remove Settings::setPrivateBrowsingEnabled, add Page::legacyPrivateBrowsingEnabled.
  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::parseAttribute):

  • loader/HistoryController.cpp:

(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateForClientRedirect):
(WebCore::HistoryController::updateForSameDocumentNavigation):
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::replaceState):

  • loader/appcache/ApplicationCacheGroup.cpp:

(WebCore::ApplicationCacheGroup::cacheForMainRequest):
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
(WebCore::ApplicationCacheGroup::update):

  • loader/appcache/ApplicationCacheHost.cpp:

(WebCore::ApplicationCacheHost::isApplicationCacheEnabled):

  • loader/icon/IconController.cpp:

(WebCore::IconController::continueLoadWithDecision):

  • page/Page.cpp:

(WebCore::Page::Page): Initialize with defaultSessionID.
(WebCore::Page::legacyPrivateBrowsingEnabled): Legacy setting for private browsing.
(WebCore::Page::privateBrowsingStateChanged): Move implementation to setSessionID.
(WebCore::Page::sessionID): Simplify to just return m_sessionID.
(WebCore::Page::setSessionID): Also perform privateBrowsingStateChanged action.a
(WebCore::Page::privateBrowsingStateChanged): Deleted.
(WebCore::Page::checkSubframeCountConsistency): Deleted.

  • page/Page.h:
  • page/PageConsole.cpp:

(WebCore::PageConsole::addMessage):
(WebCore::PageConsole::messageWithTypeAndLevel):

  • page/Settings.cpp: Remove privateBrowsingEnabled setting.

(WebCore::Settings::Settings):
(WebCore::Settings::setPrivateBrowsingEnabled): Page reflects setting using session.

  • page/Settings.h:
  • plugins/PluginView.cpp:

(WebCore::PluginView::getValue):

  • rendering/RenderSearchField.cpp:

(WebCore::RenderSearchField::addSearchResult):

  • storage/Storage.cpp:

(WebCore::Storage::isDisabledByPrivateBrowsing):

Source/WebKit/efl:

  • ewk/ewk_view.cpp:

(_ewk_view_priv_new): Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().
(ewk_view_setting_private_browsing_set): Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().

Source/WebKit/gtk:

  • WebCoreSupport/FrameLoaderClientGtk.cpp: Change WebCore::Settings::privateBrowsingEnabled() to Page:usesEphemeralSession().

(WebKit::FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):

  • webkit/webkitwebview.cpp: Change Settings::setPrivateBrowsingEnabled() to Page::enablePrivateBrowsing().

(webkit_web_view_update_settings):
(webkit_web_view_settings_notify):

Source/WebKit/mac:

  • WebCoreSupport/WebFrameLoaderClient.mm: Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().

(WebFrameLoaderClient::updateGlobalHistoryItemForPage):

  • WebCoreSupport/WebFrameNetworkingContext.mm: Ditto.

(WebFrameNetworkingContext::storageSession):

  • WebView/WebView.mm: Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().

(-[WebView _preferencesChanged:]):

Source/WebKit/win:

  • WebCoreSupport/WebFrameLoaderClient.cpp: Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().

(WebFrameLoaderClient::updateGlobalHistoryItemForPage):

  • WebCoreSupport/WebFrameNetworkingContext.cpp: Ditto.

(WebFrameNetworkingContext::storageSession):

  • WebView.cpp: Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().

(WebView::notifyPreferencesChanged):

Source/WebKit2:

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: Change WebPage::isUsingEphemeralSession() to WebPage::usesEphemeralSession().

(WKBundlePageIsUsingEphemeralSession):

  • WebProcess/InjectedBundle/InjectedBundle.cpp: Change Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().

(WebKit::InjectedBundle::setPrivateBrowsingEnabled):

  • WebProcess/Plugins/PluginView.cpp: Change Settings::privateBrowsingEnabled() to Page::usesEphemeralSession().

(WebKit::PluginView::isPrivateBrowsingEnabled):

  • WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp: Ditto.

(WebKit::WebFrameNetworkingContext::storageSession):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::usesEphemeralSession): Renamed from isUsingEphemeralSession.
(WebKit::WebPage::setSessionID): Ensure session before setting.
(WebKit::WebPage::updatePreferences): Set session to legacy private session if needed.
(WebKit::WebPage::sessionID): Moved to header.
(WebKit::WebPage::isUsingEphemeralSession): Renamed to usesEphemeralSession.

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::sessionID): Just call down to m_page.

Tools:

Add an API test for ephemeral sessions similar to PrivateBrowsingPushStateNoHistoryCallback.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/EphemeralSessionPushStateNoHistoryCallback.cpp:

(TestWebKitAPI::didNavigateWithNavigationData):
(TestWebKitAPI::didSameDocumentNavigationForFrame):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp: Also test to make sure private browsing can be disabled.

(TestWebKitAPI::didNavigateWithoutNavigationData):
(TestWebKitAPI::didNavigateWithNavigationData):
(TestWebKitAPI::didSameDocumentNavigationForFrame):
(TestWebKitAPI::TEST):

Location:
trunk
Files:
39 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166659 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Unless otherwise noted, the following consists solely of mechanical changes to replace querying WebCore::Settings::privateBrowsingEnabled() with Page::usesEphemeralSession().
     9
     10        * Modules/webdatabase/DatabaseContext.cpp:
     11        (WebCore::DatabaseContext::allowDatabaseAccess):
     12        * WebCore.exp.in: Remove Settings::setPrivateBrowsingEnabled, add Page::legacyPrivateBrowsingEnabled.
     13        * html/HTMLMediaElement.cpp:
     14        (WebCore::HTMLMediaElement::parseAttribute):
     15        * loader/HistoryController.cpp:
     16        (WebCore::HistoryController::updateForStandardLoad):
     17        (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
     18        (WebCore::HistoryController::updateForClientRedirect):
     19        (WebCore::HistoryController::updateForSameDocumentNavigation):
     20        (WebCore::HistoryController::pushState):
     21        (WebCore::HistoryController::replaceState):
     22        * loader/appcache/ApplicationCacheGroup.cpp:
     23        (WebCore::ApplicationCacheGroup::cacheForMainRequest):
     24        (WebCore::ApplicationCacheGroup::selectCache):
     25        (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
     26        (WebCore::ApplicationCacheGroup::update):
     27        * loader/appcache/ApplicationCacheHost.cpp:
     28        (WebCore::ApplicationCacheHost::isApplicationCacheEnabled):
     29        * loader/icon/IconController.cpp:
     30        (WebCore::IconController::continueLoadWithDecision):
     31        * page/Page.cpp:
     32        (WebCore::Page::Page): Initialize with defaultSessionID.
     33        (WebCore::Page::legacyPrivateBrowsingEnabled): Legacy setting for private browsing.
     34        (WebCore::Page::privateBrowsingStateChanged): Move implementation to setSessionID.
     35        (WebCore::Page::sessionID): Simplify to just return m_sessionID.
     36        (WebCore::Page::setSessionID): Also perform privateBrowsingStateChanged action.a
     37        (WebCore::Page::privateBrowsingStateChanged): Deleted.
     38        (WebCore::Page::checkSubframeCountConsistency): Deleted.
     39        * page/Page.h:
     40        * page/PageConsole.cpp:
     41        (WebCore::PageConsole::addMessage):
     42        (WebCore::PageConsole::messageWithTypeAndLevel):
     43        * page/Settings.cpp: Remove privateBrowsingEnabled setting.
     44        (WebCore::Settings::Settings):
     45        (WebCore::Settings::setPrivateBrowsingEnabled): Page reflects setting using session.
     46        * page/Settings.h:
     47        * plugins/PluginView.cpp:
     48        (WebCore::PluginView::getValue):
     49        * rendering/RenderSearchField.cpp:
     50        (WebCore::RenderSearchField::addSearchResult):
     51        * storage/Storage.cpp:
     52        (WebCore::Storage::isDisabledByPrivateBrowsing):
     53
    1542014-04-02  Antti Koivisto  <antti@apple.com>
    255
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp

    r165676 r166661  
    228228    if (m_scriptExecutionContext->isDocument()) {
    229229        Document* document = toDocument(m_scriptExecutionContext);
    230         if (!document->page() || (document->page()->settings().privateBrowsingEnabled() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document->securityOrigin()->protocol())))
     230        if (!document->page() || (document->page()->usesEphemeralSession() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document->securityOrigin()->protocol())))
    231231            return false;
    232232        return true;
  • trunk/Source/WebCore/WebCore.exp.in

    r166654 r166661  
    10621062__ZN7WebCore4Page24scrollingStateTreeAsTextEv
    10631063__ZN7WebCore4Page25suspendScriptedAnimationsEv
     1064__ZN7WebCore4Page27enableLegacyPrivateBrowsingEb
    10641065__ZN7WebCore4Page27invalidateStylesForAllLinksEv
    10651066__ZN7WebCore4Page32setMemoryCacheClientCallsEnabledEb
     
    12721273__ZN7WebCore8Settings24setUsesOverlayScrollbarsEb
    12731274__ZN7WebCore8Settings25setMinimumLogicalFontSizeEi
    1274 __ZN7WebCore8Settings25setPrivateBrowsingEnabledEb
    12751275__ZN7WebCore8Settings25setUserStyleSheetLocationERKNS_3URLE
    12761276__ZN7WebCore8Settings26defaultMinDOMTimerIntervalEv
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r166362 r166661  
    7373#include "ScriptSourceCode.h"
    7474#include "SecurityPolicy.h"
     75#include "SessionID.h"
    7576#include "Settings.h"
    7677#include "ShadowRoot.h"
     
    12621263        startProgressEventTimer();
    12631264
    1264     Settings* settings = document().settings();
    1265     bool privateMode = !settings || settings->privateBrowsingEnabled();
     1265    bool privateMode = document().page() && document().page()->usesEphemeralSession();
    12661266    m_player->setPrivateBrowsingMode(privateMode);
    12671267
     
    52675267        return;
    52685268
    5269     Settings* settings = document().settings();
    5270     bool privateMode = !settings || settings->privateBrowsingEnabled();
     5269    bool privateMode = document().page() && document().page()->usesEphemeralSession();
    52715270    LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString(privateMode));
    52725271    m_player->setPrivateBrowsingMode(privateMode);
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r165676 r166661  
    349349    FrameLoader& frameLoader = m_frame.loader();
    350350
    351     bool needPrivacy = m_frame.settings().privateBrowsingEnabled();
     351    bool needPrivacy = m_frame.page()->usesEphemeralSession();
    352352    const URL& historyURL = frameLoader.documentLoader()->urlForHistory();
    353353
     
    386386#endif
    387387   
    388     bool needPrivacy = m_frame.settings().privateBrowsingEnabled();
     388    bool needPrivacy = m_frame.page()->usesEphemeralSession();
    389389    const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory();
    390390
     
    434434    }
    435435
    436     bool needPrivacy = m_frame.settings().privateBrowsingEnabled();
     436    bool needPrivacy = m_frame.page()->usesEphemeralSession();
    437437    const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory();
    438438
     
    524524        return;
    525525
    526     if (m_frame.settings().privateBrowsingEnabled())
     526    if (m_frame.page()->usesEphemeralSession())
    527527        return;
    528528
     
    848848    page->backForward().addItem(topItem.release());
    849849
    850     if (m_frame.settings().privateBrowsingEnabled())
     850    if (m_frame.page()->usesEphemeralSession())
    851851        return;
    852852
     
    867867    m_currentItem->setFormContentType(String());
    868868
    869     if (m_frame.settings().privateBrowsingEnabled())
     869    if (m_frame.page()->usesEphemeralSession())
    870870        return;
    871871
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r165199 r166661  
    104104        url.removeFragmentIdentifier();
    105105
    106     if (documentLoader->frame() && (documentLoader->frame()->settings().privateBrowsingEnabled() || !documentLoader->frame()->document()->securityOrigin()->canAccessApplicationCache(documentLoader->frame()->tree().top().document()->securityOrigin())))
     106    if (documentLoader->frame() && (documentLoader->frame()->page()->usesEphemeralSession() || !documentLoader->frame()->document()->securityOrigin()->canAccessApplicationCache(documentLoader->frame()->tree().top().document()->securityOrigin())))
    107107        return 0;
    108108
     
    152152
    153153    // Don't access anything on disk if private browsing is enabled.
    154     if (frame->settings().privateBrowsingEnabled() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
     154    if (frame->page()->usesEphemeralSession() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
    155155        postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
    156156        postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
     
    220220
    221221    // Don't access anything on disk if private browsing is enabled.
    222     if (frame->settings().privateBrowsingEnabled() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
     222    if (frame->page()->usesEphemeralSession() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
    223223        postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
    224224        postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
     
    435435
    436436    // Don't access anything on disk if private browsing is enabled.
    437     if (frame->settings().privateBrowsingEnabled() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
     437    if (frame->page()->usesEphemeralSession() || !frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree().top().document()->securityOrigin())) {
    438438        ASSERT(m_pendingMasterResourceLoaders.isEmpty());
    439439        ASSERT(m_pendingEntries.isEmpty());
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp

    r163914 r166661  
    477477bool ApplicationCacheHost::isApplicationCacheEnabled()
    478478{
    479     return m_documentLoader->frame() && m_documentLoader->frame()->settings().offlineWebApplicationCacheEnabled() && !m_documentLoader->frame()->settings().privateBrowsingEnabled();
     479    return m_documentLoader->frame() && m_documentLoader->frame()->settings().offlineWebApplicationCacheEnabled() && !m_documentLoader->frame()->page()->usesEphemeralSession();
    480480}
    481481
  • trunk/Source/WebCore/loader/icon/IconController.cpp

    r165676 r166661  
    205205
    206206    //  FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
    207     if (iconDatabase().supportsAsynchronousMode() && m_frame.page()->settings().privateBrowsingEnabled())
     207    if (iconDatabase().supportsAsynchronousMode() && m_frame.page()->usesEphemeralSession())
    208208        return;
    209209
  • trunk/Source/WebCore/page/Page.cpp

    r166459 r166661  
    193193    , m_framesHandlingBeforeUnloadEvent(0)
    194194    , m_visitedLinkStore(std::move(pageClients.visitedLinkStore))
    195     , m_sessionID(SessionID::emptySessionID())
     195    , m_sessionID(SessionID::defaultSessionID())
    196196{
    197197    ASSERT(m_editorClient);
     
    10811081}
    10821082
    1083 void Page::privateBrowsingStateChanged()
    1084 {
    1085     bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
    1086 
    1087     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
    1088         frame->document()->privateBrowsingStateDidChange();
    1089 
    1090     // Collect the PluginViews in to a vector to ensure that action the plug-in takes
    1091     // from below privateBrowsingStateChanged does not affect their lifetime.
    1092     auto views = pluginViews();
    1093 
    1094     for (unsigned i = 0; i < views.size(); ++i)
    1095         views[i]->privateBrowsingStateChanged(privateBrowsingEnabled);
     1083void Page::enableLegacyPrivateBrowsing(bool privateBrowsingEnabled)
     1084{
     1085    // Don't allow changing the legacy private browsing state if we have set a session ID.
     1086    ASSERT(m_sessionID == SessionID::defaultSessionID() || m_sessionID == SessionID::legacyPrivateSessionID());
     1087
     1088    setSessionID(privateBrowsingEnabled ? SessionID::legacyPrivateSessionID() : SessionID::defaultSessionID());
    10961089}
    10971090
     
    15151508SessionID Page::sessionID() const
    15161509{
    1517     if (m_sessionID.isValid())
    1518         return m_sessionID;
    1519 
    1520     if (settings().privateBrowsingEnabled())
    1521         return SessionID::legacyPrivateSessionID();
    1522 
    1523     return SessionID::defaultSessionID();
     1510    return m_sessionID;
    15241511}
    15251512
     
    15271514{
    15281515    ASSERT(sessionID.isValid());
     1516
     1517    bool privateBrowsingStateChanged = (sessionID.isEphemeral() != m_sessionID.isEphemeral());
     1518
    15291519    m_sessionID = sessionID;
     1520
     1521    if (!privateBrowsingStateChanged)
     1522        return;
     1523
     1524    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
     1525        frame->document()->privateBrowsingStateDidChange();
     1526
     1527    // Collect the PluginViews in to a vector to ensure that action the plug-in takes
     1528    // from below privateBrowsingStateChanged does not affect their lifetime.
     1529
     1530    for (auto& view : pluginViews())
     1531        view->privateBrowsingStateChanged(sessionID.isEphemeral());
     1532
    15301533}
    15311534
  • trunk/Source/WebCore/page/Page.h

    r166017 r166661  
    314314    void dnsPrefetchingStateChanged();
    315315    void storageBlockingStateChanged();
    316     void privateBrowsingStateChanged();
    317316
    318317    void setDebugger(JSC::Debugger*);
     
    411410    SessionID sessionID() const;
    412411    void setSessionID(SessionID);
    413     bool isSessionIDSet() const { return m_sessionID.isValid(); }
     412    void enableLegacyPrivateBrowsing(bool privateBrowsingEnabled);
     413    bool usesEphemeralSession() const { return m_sessionID.isEphemeral(); }
    414414
    415415private:
  • trunk/Source/WebCore/page/PageConsole.cpp

    r165676 r166661  
    127127        return;
    128128
    129     if (m_page.settings().privateBrowsingEnabled())
     129    if (m_page.usesEphemeralSession())
    130130        return;
    131131
     
    147147    InspectorInstrumentation::addMessageToConsole(&m_page, MessageSource::ConsoleAPI, type, level, message, exec, arguments);
    148148
    149     if (m_page.settings().privateBrowsingEnabled())
     149    if (m_page.usesEphemeralSession())
    150150        return;
    151151
  • trunk/Source/WebCore/page/Settings.cpp

    r166516 r166661  
    172172    , m_isJavaEnabledForLocalFiles(true)
    173173    , m_loadsImagesAutomatically(false)
    174     , m_privateBrowsingEnabled(false)
    175174    , m_areImagesEnabled(true)
    176175    , m_arePluginsEnabled(false)
     
    427426}
    428427
    429 void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
    430 {
    431     if (m_privateBrowsingEnabled == privateBrowsingEnabled)
    432         return;
    433 
    434     m_privateBrowsingEnabled = privateBrowsingEnabled;
    435     m_page->privateBrowsingStateChanged();
    436 }
    437 
    438428void Settings::setUserStyleSheetLocation(const URL& userStyleSheetLocation)
    439429{
  • trunk/Source/WebCore/page/Settings.h

    r166516 r166661  
    147147    //  - Plug-ins (that support NPNVprivateModeBool)
    148148    void setPrivateBrowsingEnabled(bool);
    149     bool privateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
    150149
    151150    void setDNSPrefetchingEnabled(bool);
     
    299298    bool m_isJavaEnabledForLocalFiles : 1;
    300299    bool m_loadsImagesAutomatically : 1;
    301     bool m_privateBrowsingEnabled : 1;
    302300    bool m_areImagesEnabled : 1;
    303301    bool m_arePluginsEnabled : 1;
  • trunk/Source/WebCore/plugins/PluginView.cpp

    r165676 r166661  
    13551355        if (!page)
    13561356            return NPERR_GENERIC_ERROR;
    1357         *((NPBool*)value) = page->settings().privateBrowsingEnabled();
     1357        *((NPBool*)value) = page->usesEphemeralSession();
    13581358        return NPERR_NO_ERROR;
    13591359    }
  • trunk/Source/WebCore/rendering/RenderSearchField.cpp

    r162791 r166661  
    8686        return;
    8787
    88     if (frame().settings().privateBrowsingEnabled())
     88    if (frame().page()->usesEphemeralSession())
    8989        return;
    9090
  • trunk/Source/WebCore/storage/Storage.cpp

    r153927 r166661  
    159159bool Storage::isDisabledByPrivateBrowsing() const
    160160{
    161     if (!m_frame->page()->settings().privateBrowsingEnabled())
     161    if (!m_frame->page()->usesEphemeralSession())
    162162        return false;
    163163
  • trunk/Source/WebKit/efl/ChangeLog

    r166637 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * ewk/ewk_view.cpp:
     9        (_ewk_view_priv_new): Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().
     10        (ewk_view_setting_private_browsing_set): Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().
     11
    1122014-04-02  Hyowon Kim  <hw1008.kim@samsung.com>
    213
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r166637 r166661  
    6767#include "RuntimeEnabledFeatures.h"
    6868#include "ScriptController.h"
     69#include "SessionID.h"
    6970#include "Settings.h"
    7071#include "SoupNetworkSession.h"
     
    792793    priv->settings.scriptsCanAccessClipboard = pageSettings.javaScriptCanAccessClipboard() && pageSettings.DOMPasteAllowed();
    793794    priv->settings.resizableTextareas = pageSettings.textAreasAreResizable();
    794     priv->settings.privateBrowsing = pageSettings.privateBrowsingEnabled();
     795    priv->settings.privateBrowsing = priv->page->usesEphemeralSession();
    795796    priv->settings.caretBrowsing = pageSettings.caretBrowsingEnabled();
    796797    priv->settings.spatialNavigation = pageSettings.spatialNavigationEnabled();
     
    22192220    enable = !!enable;
    22202221    if (priv->settings.privateBrowsing != enable) {
    2221         priv->page->settings().setPrivateBrowsingEnabled(enable);
     2222        priv->page->enableLegacyPrivateBrowsing(enable);
    22222223        priv->settings.privateBrowsing = enable;
    22232224    }
  • trunk/Source/WebKit/gtk/ChangeLog

    r166499 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/FrameLoaderClientGtk.cpp: Change WebCore::Settings::privateBrowsingEnabled() to Page:usesEphemeralSession().
     9        (WebKit::FrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
     10        * webkit/webkitwebview.cpp: Change Settings::setPrivateBrowsingEnabled() to Page::enablePrivateBrowsing().
     11        (webkit_web_view_update_settings):
     12        (webkit_web_view_settings_notify):
     13
    1142014-03-31  Martin Robinson  <mrobinson@igalia.com>
    215
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r165810 r166661  
    259259
    260260    CredentialStorageMode credentialStorageMode;
    261     if (core(view)->settings().privateBrowsingEnabled())
     261    if (core(view)->usesEphemeralSession())
    262262        credentialStorageMode = DisallowPersistentStorage;
    263263    else
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r165810 r166661  
    36023602    coreSettings.setUserStyleSheetLocation(URL(URL(), settingsPrivate->userStylesheetURI.data()));
    36033603    coreSettings.setDeveloperExtrasEnabled(settingsPrivate->enableDeveloperExtras);
    3604     coreSettings.setPrivateBrowsingEnabled(settingsPrivate->enablePrivateBrowsing);
     3604    core(webView)->enableLegacyPrivateBrowsing(settingsPrivate->enablePrivateBrowsing);
    36053605    coreSettings.setCaretBrowsingEnabled(settingsPrivate->enableCaretBrowsing);
    36063606    coreSettings.setLocalStorageEnabled(settingsPrivate->enableHTML5LocalStorage);
     
    37343734        settings.setDeveloperExtrasEnabled(g_value_get_boolean(&value));
    37353735    else if (name == g_intern_string("enable-private-browsing"))
    3736         settings.setPrivateBrowsingEnabled(g_value_get_boolean(&value));
     3736        core(webView)->enableLegacyPrivateBrowsing(g_value_get_boolean(&value));
    37373737    else if (name == g_intern_string("enable-caret-browsing"))
    37383738        settings.setCaretBrowsingEnabled(g_value_get_boolean(&value));
  • trunk/Source/WebKit/mac/ChangeLog

    r166617 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/WebFrameLoaderClient.mm: Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().
     9        (WebFrameLoaderClient::updateGlobalHistoryItemForPage):
     10        * WebCoreSupport/WebFrameNetworkingContext.mm: Ditto.
     11        (WebFrameNetworkingContext::storageSession):
     12        * WebView/WebView.mm: Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().
     13        (-[WebView _preferencesChanged:]):
     14
    1152014-04-01  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r166378 r166661  
    11151115
    11161116    if (Page* page = core(m_webFrame.get())->page()) {
    1117         if (!page->settings().privateBrowsingEnabled())
     1117        if (!page->sessionID().isEphemeral())
    11181118            historyItem = page->backForward().currentItem();
    11191119    }
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm

    r161185 r166661  
    114114    ASSERT(isMainThread());
    115115
    116     if (frame() && frame()->settings().privateBrowsingEnabled())
     116    if (frame() && frame()->page()->sessionID().isEphemeral())
    117117        return *privateSession();
    118118
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r166529 r166661  
    22482248    settings.setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]);
    22492249#endif
    2250     settings.setPrivateBrowsingEnabled([preferences privateBrowsingEnabled]);
     2250    _private->page->enableLegacyPrivateBrowsing([preferences privateBrowsingEnabled]);
    22512251    settings.setSansSerifFontFamily([preferences sansSerifFontFamily]);
    22522252    settings.setSerifFontFamily([preferences serifFontFamily]);
  • trunk/Source/WebKit/win/ChangeLog

    r166120 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebCoreSupport/WebFrameLoaderClient.cpp: Change WebCore::Settings::privateBrowsingEnabled() to Page::sessionID().isEphemeral().
     9        (WebFrameLoaderClient::updateGlobalHistoryItemForPage):
     10        * WebCoreSupport/WebFrameNetworkingContext.cpp: Ditto.
     11        (WebFrameNetworkingContext::storageSession):
     12        * WebView.cpp: Change WebCore::Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().
     13        (WebView::notifyPreferencesChanged):
     14
    1152014-03-22  Darin Adler  <darin@apple.com>
    216
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r165676 r166661  
    804804
    805805    if (Page* page = webView->page()) {
    806         if (!page->settings().privateBrowsingEnabled())
     806        if (!page->usesEphemeralSession())
    807807            historyItem = page->backForward().currentItem();
    808808    }
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp

    r157337 r166661  
    115115    ASSERT(isMainThread());
    116116
    117     if (frame() && frame()->settings().privateBrowsingEnabled())
     117    if (frame() && frame()->page()->usesEphemeralSession())
    118118        return *privateSession();
    119119
  • trunk/Source/WebKit/win/WebView.cpp

    r165753 r166661  
    47884788        WebFrameNetworkingContext::destroyPrivateBrowsingSession();
    47894789#endif
    4790     settings.setPrivateBrowsingEnabled(!!enabled);
     4790    m_page->enableLegacyPrivateBrowsing(!!enabled);
    47914791
    47924792    hr = preferences->sansSerifFontFamily(&str);
  • trunk/Source/WebKit2/ChangeLog

    r166658 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: Change WebPage::isUsingEphemeralSession() to WebPage::usesEphemeralSession().
     9        (WKBundlePageIsUsingEphemeralSession):
     10        * WebProcess/InjectedBundle/InjectedBundle.cpp: Change Settings::setPrivateBrowsingEnabled() to Page::enableLegacyPrivateBrowsing().
     11        (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
     12        * WebProcess/Plugins/PluginView.cpp: Change Settings::privateBrowsingEnabled() to Page::usesEphemeralSession().
     13        (WebKit::PluginView::isPrivateBrowsingEnabled):
     14        * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp: Ditto.
     15        (WebKit::WebFrameNetworkingContext::storageSession):
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::usesEphemeralSession): Renamed from isUsingEphemeralSession.
     18        (WebKit::WebPage::setSessionID): Ensure session before setting.
     19        (WebKit::WebPage::updatePreferences): Set session to legacy private session if needed.
     20        (WebKit::WebPage::sessionID): Moved to header.
     21        (WebKit::WebPage::isUsingEphemeralSession): Renamed to usesEphemeralSession.
     22        * WebProcess/WebPage/WebPage.h:
     23        (WebKit::WebPage::sessionID): Just call down to m_page.
     24
    1252014-04-02  Alice Barraclough  <alice.liu@apple.com>
    226
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r165870 r166661  
    562562bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef pageRef)
    563563{
    564     return toImpl(pageRef)->isUsingEphemeralSession();
    565 }
     564    return toImpl(pageRef)->usesEphemeralSession();
     565}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r166262 r166661  
    305305    const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
    306306    for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
    307         (*iter)->settings().setPrivateBrowsingEnabled(enabled);
     307        (*iter)->enableLegacyPrivateBrowsing(enabled);
    308308}
    309309
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r166443 r166661  
    15401540        return true;
    15411541
    1542     return frame()->settings().privateBrowsingEnabled();
     1542    return frame()->page()->usesEphemeralSession();
    15431543}
    15441544
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp

    r164726 r166661  
    5656NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
    5757{
    58     if (frame() && frame()->settings().privateBrowsingEnabled())
     58    if (frame() && frame()->page()->usesEphemeralSession())
    5959        return *SessionTracker::session(SessionID::legacyPrivateSessionID());
    6060
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r166557 r166661  
    5252#include "PrintInfo.h"
    5353#include "SessionState.h"
     54#include "SessionTracker.h"
    5455#include "ShareableBitmap.h"
    5556#include "VisitedLinkTableController.h"
     
    21812182}
    21822183
    2183 SessionID WebPage::sessionID() const
    2184 {
    2185     if (m_page->isSessionIDSet())
    2186         return m_page->sessionID();
    2187 
    2188     return m_page->settings().privateBrowsingEnabled() ? SessionID::legacyPrivateSessionID() : SessionID::defaultSessionID();
    2189 }
    2190 
    2191 bool WebPage::isUsingEphemeralSession() const
    2192 {
    2193     return sessionID().isEphemeral();
    2194 }
    2195 
    21962184void WebPage::setSessionID(SessionID sessionID)
    21972185{
    2198     m_page->setSessionID(sessionID);
    21992186    if (sessionID.isEphemeral())
    22002187        WebProcess::shared().ensurePrivateBrowsingSession(sessionID);
     2188    m_page->setSessionID(sessionID);
    22012189}
    22022190
     
    25032491    settings.setXSSAuditorEnabled(store.getBoolValueForKey(WebPreferencesKey::xssAuditorEnabledKey()));
    25042492    settings.setFrameFlatteningEnabled(store.getBoolValueForKey(WebPreferencesKey::frameFlatteningEnabledKey()));
    2505     if (m_page->isSessionIDSet())
    2506         settings.setPrivateBrowsingEnabled(m_page->sessionID().isEphemeral());
    2507     else
    2508         settings.setPrivateBrowsingEnabled(store.getBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey()));
     2493    if (store.getBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey()) && !usesEphemeralSession())
     2494        setSessionID(SessionID::legacyPrivateSessionID());
     2495    else if (!store.getBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey()) && sessionID() == SessionID::legacyPrivateSessionID())
     2496        setSessionID(SessionID::defaultSessionID());
    25092497    settings.setDeveloperExtrasEnabled(store.getBoolValueForKey(WebPreferencesKey::developerExtrasEnabledKey()));
    25102498    settings.setJavaScriptExperimentsEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptExperimentsEnabledKey()));
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r166431 r166661  
    194194    WebCore::Page* corePage() const { return m_page.get(); }
    195195    uint64_t pageID() const { return m_pageID; }
    196     WebCore::SessionID sessionID() const;
    197     bool isUsingEphemeralSession() const;
     196    WebCore::SessionID sessionID() const { return m_page->sessionID(); }
     197    bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
     198
    198199    void setSessionID(WebCore::SessionID);
    199200
  • trunk/Tools/ChangeLog

    r166648 r166661  
     12014-04-02  Martin Hock  <mhock@apple.com>
     2
     3        Unify private browsing with sessions.
     4        https://bugs.webkit.org/show_bug.cgi?id=130099
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Add an API test for ephemeral sessions similar to PrivateBrowsingPushStateNoHistoryCallback.
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKit2/EphemeralSessionPushStateNoHistoryCallback.cpp:
     11        (TestWebKitAPI::didNavigateWithNavigationData):
     12        (TestWebKitAPI::didSameDocumentNavigationForFrame):
     13        (TestWebKitAPI::TEST):
     14
     15        * TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp: Also test to make sure private browsing can be disabled.
     16        (TestWebKitAPI::didNavigateWithoutNavigationData):
     17        (TestWebKitAPI::didNavigateWithNavigationData):
     18        (TestWebKitAPI::didSameDocumentNavigationForFrame):
     19        (TestWebKitAPI::TEST):
     20
    1212014-04-02  Martin Robinson  <mrobinson@igalia.com>
    222
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r166448 r166661  
    108108                52E5CE4614D21E9D003B2BD8 /* ParentFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */; };
    109109                52E5CE4914D21EAB003B2BD8 /* ParentFrame_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */; };
     110                75F3134018C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */; };
    110111                76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */; };
    111112                76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
     
    435436                52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentFrame.cpp; sourceTree = "<group>"; };
    436437                52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParentFrame_Bundle.cpp; sourceTree = "<group>"; };
     438                75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EphemeralSessionPushStateNoHistoryCallback.cpp; sourceTree = "<group>"; };
    437439                76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = "<group>"; };
    438440                76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; };
     
    769771                                F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */,
    770772                                C045F9441385C2E900C0F3CD /* DownloadDecideDestinationCrash.cpp */,
     773                                75F3133F18C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp */,
    771774                                1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */,
    772775                                BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
     
    11551158                                379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */,
    11561159                                291861FF17BD4DC700D4E41E /* StopLoadingFromDidFinishLoading.mm in Sources */,
     1160                                75F3134018C171B70041CAEC /* EphemeralSessionPushStateNoHistoryCallback.cpp in Sources */,
    11571161                                26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */,
    11581162                                B55F11A01516834F00915916 /* AttributedString.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/EphemeralSessionPushStateNoHistoryCallback.cpp

    r166660 r166661  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4545}
    4646
    47 TEST(WebKit2, PrivateBrowsingPushStateNoHistoryCallback)
     47TEST(WebKit2, EphemeralSessionPushStateNoHistoryCallback)
    4848{
    4949    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
     
    6767    WKPageSetPageLoaderClient(webView.page(), &pageLoaderClient.base);
    6868
    69     WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate());
    70     WKPreferencesSetPrivateBrowsingEnabled(preferences.get(), true);
    71 
    72     WKPageGroupRef pageGroup = WKPageGetPageGroup(webView.page());
    73     WKPageGroupSetPreferences(pageGroup, preferences.get());
     69    WKSessionRef session = WKSessionCreate(true);
     70    WKPageSetSession(webView.page(), session);
    7471
    7572    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("push-state", "html"));
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp

    r160104 r166661  
    3232namespace TestWebKitAPI {
    3333
    34 static bool testDone;
     34static bool didNavigate;
     35static bool didSameDocumentNavigation;
    3536
    36 static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
     37static void didNavigateWithoutNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
    3738{
    3839    // This should never be called when navigating in Private Browsing.
     
    4041}
    4142
     43static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
     44{
     45    didNavigate = true;
     46}
     47
    4248static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo)
    4349{
    44     testDone = true;
     50    didSameDocumentNavigation = true;
    4551}
    4652
     
    5359
    5460    historyClient.base.version = 0;
    55     historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData;
     61    historyClient.didNavigateWithNavigationData = didNavigateWithoutNavigationData;
    5662
    5763    WKContextSetHistoryClient(context.get(), &historyClient.base);
     
    7682    WKPageLoadURL(webView.page(), url.get());
    7783
    78     Util::run(&testDone);
     84    Util::run(&didSameDocumentNavigation);
     85
     86    WKPreferencesSetPrivateBrowsingEnabled(preferences.get(), false);
     87
     88    historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData;
     89    WKContextSetHistoryClient(context.get(), &historyClient.base);
     90
     91    WKPageLoadURL(webView.page(), url.get());
     92
     93    Util::run(&didNavigate);
    7994}
    8095
Note: See TracChangeset for help on using the changeset viewer.