Commit af2e011f authored by beidson@apple.com's avatar beidson@apple.com

WebCore:

2008-04-14  Brady Eidson  <beidson@apple.com>

        Reviewed by Anders

        Add a hidden pref to debug WebArchive loading.  With this pref on, when loading a WebArchive,
        if the resource isn't in the ArchiveResourceCollection, the loader will not fall back to the 
        network and will instead fail the load as "cancelled."

        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::load): Do the check here.

        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::setWebArchiveDebugModeEnabled):
        * page/Settings.h:
        (WebCore::Settings::webArchiveDebugModeEnabled):

WebKit/mac:

2008-04-14  Brady Eidson  <beidson@apple.com>

        Reviewed by Anders

        Add a hidden pref to debug WebArchive loading.  With this pref on, when loading a WebArchive,
        if the resource isn't in the ArchiveResourceCollection, the loader will not fall back to the 
        network and will instead fail the load as "cancelled."

        * WebView/WebPreferenceKeysPrivate.h:

        * WebView/WebPreferences.m:
        (+[WebPreferences initialize]):
        (-[WebPreferences _webArchiveDebugModeEnabled]):
        * WebView/WebPreferencesPrivate.h:

        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54eebebc
2008-04-14 Brady Eidson <beidson@apple.com>
Reviewed by Anders
Add a hidden pref to debug WebArchive loading. With this pref on, when loading a WebArchive,
if the resource isn't in the ArchiveResourceCollection, the loader will not fall back to the
network and will instead fail the load as "cancelled."
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::load): Do the check here.
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setWebArchiveDebugModeEnabled):
* page/Settings.h:
(WebCore::Settings::webArchiveDebugModeEnabled):
2008-04-14 Antti Koivisto <antti@apple.com>
Reviewed by Eric.
......@@ -30,6 +30,7 @@
#include "config.h"
#include "ResourceLoader.h"
#include "ArchiveFactory.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoader.h"
......@@ -118,6 +119,15 @@ bool ResourceLoader::load(const ResourceRequest& r)
if (m_documentLoader->scheduleArchiveLoad(this, clientRequest, r.url()))
return true;
// WebArchiveDebugMode means we don't load resources not in the archive. Representing these loads as "cannot show URL" is clear enough
// for developers debugging webarchives
if (m_frame->settings()->webArchiveDebugModeEnabled()) {
if (ArchiveFactory::isArchiveMimeType(m_documentLoader->responseMIMEType())) {
didFail(cannotShowURLError());
return false;
}
}
if (m_defersLoading) {
m_deferredRequest = clientRequest;
return true;
......
......@@ -71,6 +71,7 @@ Settings::Settings(Page* page)
, m_authorAndUserStylesEnabled(true)
, m_needsSiteSpecificQuirks(false)
, m_fontRenderingMode(0)
, m_webArchiveDebugModeEnabled(false)
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
......@@ -323,4 +324,9 @@ void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
m_needsSiteSpecificQuirks = needsQuirks;
}
void Settings::setWebArchiveDebugModeEnabled(bool enabled)
{
m_webArchiveDebugModeEnabled = enabled;
}
} // namespace WebCore
......@@ -148,6 +148,9 @@ namespace WebCore {
void setNeedsSiteSpecificQuirks(bool);
bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
void setWebArchiveDebugModeEnabled(bool);
bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
private:
Page* m_page;
......@@ -186,6 +189,7 @@ namespace WebCore {
bool m_authorAndUserStylesEnabled : 1;
bool m_needsSiteSpecificQuirks : 1;
unsigned m_fontRenderingMode : 1;
bool m_webArchiveDebugModeEnabled : 1;
};
} // namespace WebCore
......
2008-04-14 Brady Eidson <beidson@apple.com>
Reviewed by Anders
Add a hidden pref to debug WebArchive loading. With this pref on, when loading a WebArchive,
if the resource isn't in the ArchiveResourceCollection, the loader will not fall back to the
network and will instead fail the load as "cancelled."
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.m:
(+[WebPreferences initialize]):
(-[WebPreferences _webArchiveDebugModeEnabled]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]):
2008-04-11 David Hyatt <hyatt@apple.com>
Rename CachedResource ref/deref methods to addClient/removeClient.
......
......@@ -64,6 +64,7 @@
#define WebKitForceFTPDirectoryListings @"WebKitForceFTPDirectoryListings"
#define WebKitDeveloperExtrasEnabledPreferenceKey @"WebKitDeveloperExtrasEnabledPreferenceKey"
#define WebKitAuthorAndUserStylesEnabledPreferenceKey @"WebKitAuthorAndUserStylesEnabledPreferenceKey"
#define WebKitWebArchiveDebugModeEnabledPreferenceKey @"WebKitWebArchiveDebugModeEnabledPreferenceKey"
// These are private both because callers should be using the cover methods and because the
// cover methods themselves are private.
......
......@@ -330,8 +330,9 @@ + (void)initialize
[NSNumber numberWithBool:NO], WebKitDOMPasteAllowedPreferenceKey,
[NSNumber numberWithBool:YES], WebKitUsesPageCachePreferenceKey,
[NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
[NSNumber numberWithBool:NO], WebKitDeveloperExtrasEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitDeveloperExtrasEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey,
[NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey,
nil];
// This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
......@@ -750,6 +751,11 @@ - (BOOL)authorAndUserStylesEnabled
return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
}
- (BOOL)_webArchiveDebugModeEnabled
{
return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
}
- (void)setAuthorAndUserStylesEnabled:(BOOL)flag
{
[self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
......
......@@ -90,6 +90,8 @@ extern NSString *WebPreferencesRemovedNotification;
- (void)_setForceFTPDirectoryListings:(BOOL)force;
- (BOOL)_forceFTPDirectoryListings;
- (BOOL)_webArchiveDebugModeEnabled;
// Other private methods
- (void)_postPreferencesChangesNotification;
+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier;
......
......@@ -983,6 +983,7 @@ static bool debugWidget = true;
settings->setNeedsAdobeFrameReloadingQuirk([self _needsAdobeFrameReloadingQuirk]);
settings->setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
settings->setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing);
settings->setWebArchiveDebugModeEnabled([preferences _webArchiveDebugModeEnabled]);
}
static inline IMP getMethod(id o, SEL s)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment