[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:16:21 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit b1432259fb89d54e8f6af648c0f5d292df825d36
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 19 00:54:38 2002 +0000
WebFoundation:
Reviewed by Trey and Darin.
Minor fixes required to fix these bugs:
3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
3091248 - picture does not show up in window from epinions
* CacheLoader.subproj/WebResourceResponse.h: Don't include uninstalled headers
in this private but installed header.
* ProtocolHandlers.subproj/WebAboutProtocolHandler.m:
(-[WebAboutProtocolHandler setResponseMetadata:]): "about:blank"
should be a blank html document, not a blank plain text document.
* Misc.subproj/WebNSURLExtras.h:
* Misc.subproj/WebNSURLExtras.m:
(-[NSString _web_shouldLoadAsEmptyDocument]): New method.
* English.lproj/StringsNotToBeLocalized.txt: Updated.
WebCore:
Reviewed by Trey and Darin.
- fixed 3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
- fixed 3091248 - picture does not show up in window from epinions
* khtml/ecma/kjs_window.cpp:
(Window::get): Put back document-creating code that was in #if
!APPLE_CHANGES.
(Window::isSafeScript): Extend access to a window that was opened
to no URL or to about:blank by the active window.
(shouldLoadAsEmptyDocument): Helper for the above.
(WindowFunc::tryCall): Update APPLE_CHANGES comments - now it's
clear we don't need to create a document in a fresh window
(accessing document will take care of that), and that it will be
counter-productive, possibly adding a useless entry to the
back/forward list.
* khtml/khtml_part.cpp:
(KHTMLPart::begin): If we're not loading a URL, make a dummy
document (the call will check if we have a dummy document
already).
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::createEmptyDocument): Isntead of setting up a
half-assed document, ask bridge to synchronously load a fully
assed (but empty) document. Renamed from createDummyDocument.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::openURLRequest): Decode script. Also,
check if return value is a string - if so, write it into the
document. Maybe we want this to be more general.
* kwq/KWQKURL.mm:
(KURL::KURL): Changed to successfully resolve absolute URLs
against an empty base URL.
* kwq/WebCoreBridge.h: prototyped new
loadEmptyDocumentSynchronously method.
WebKit:
Reviewed by Darin and Trey.
- fixed 3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
- fixed 3091248 - picture does not show up in window from epinions
- made "about:blank" load synchronously, which I'm told is required by some sites.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge createWindowWithURL:frameName:]): If the URL is nil
or empty, pass a nil request - otherwise WebBrowser will try to
load it, resulting in an extra back/forward list entry.
(-[WebBridge loadEmptyDocumentSynchronously]): Tell the frame to
load a request with an empty URL - this will cause a synchronous
load of an empty html document
* WebView.subproj/WebBaseResourceHandleDelegate.h:
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate loadWithRequest:]): Split off
startLoading: part of method to allow behavior to be subclassed.
(-[WebBaseResourceHandleDelegate startLoading:]):
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSource _commitIfReady:]): Lie and claim the URL is
"about:blank" if it's really empty to avoid confusing WebCore.
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _transitionToCommitted:]): Don't put the empty URL in
global history.
(-[WebFrame
_checkNavigationPolicyForRequest:dataSource:andCall:withSelector:]):
Don't check policy if URL is empty - this is likely to confuse the
client and we know what the right behavior here is.
* WebView.subproj/WebMainResourceClient.m:
(-[WebMainResourceClient startLoading:]): Try to load
"about:blank" and the empty URL synchronously, bypassing
WebFoundation.
(-[WebMainResourceClient continueAfterContentPolicy:response:]): Ditto.
(-[WebMainResourceClient setDefersCallbacks:]): Ditto.
* English.lproj/StringsNotToBeLocalized.txt: Updated.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 89c9f0f..80a2363 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,40 @@
+2002-12-18 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey and Darin.
+
+ - fixed 3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
+ - fixed 3091248 - picture does not show up in window from epinions
+
+
+ * khtml/ecma/kjs_window.cpp:
+ (Window::get): Put back document-creating code that was in #if
+ !APPLE_CHANGES.
+ (Window::isSafeScript): Extend access to a window that was opened
+ to no URL or to about:blank by the active window.
+ (shouldLoadAsEmptyDocument): Helper for the above.
+ (WindowFunc::tryCall): Update APPLE_CHANGES comments - now it's
+ clear we don't need to create a document in a fresh window
+ (accessing document will take care of that), and that it will be
+ counter-productive, possibly adding a useless entry to the
+ back/forward list.
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::begin): If we're not loading a URL, make a dummy
+ document (the call will check if we have a dummy document
+ already).
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::createEmptyDocument): Isntead of setting up a
+ half-assed document, ask bridge to synchronously load a fully
+ assed (but empty) document. Renamed from createDummyDocument.
+ * kwq/KWQKHTMLPartBrowserExtension.mm:
+ (KHTMLPartBrowserExtension::openURLRequest): Decode script. Also,
+ check if return value is a string - if so, write it into the
+ document. Maybe we want this to be more general.
+ * kwq/KWQKURL.mm:
+ (KURL::KURL): Changed to successfully resolve absolute URLs
+ against an empty base URL.
+ * kwq/WebCoreBridge.h: prototyped new
+ loadEmptyDocumentSynchronously method.
+
2002-12-18 Chris Blumenberg <cblu at apple.com>
Fixed: 3052731 - qt file complains about lack of active-x handler
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 89c9f0f..80a2363 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,40 @@
+2002-12-18 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Trey and Darin.
+
+ - fixed 3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
+ - fixed 3091248 - picture does not show up in window from epinions
+
+
+ * khtml/ecma/kjs_window.cpp:
+ (Window::get): Put back document-creating code that was in #if
+ !APPLE_CHANGES.
+ (Window::isSafeScript): Extend access to a window that was opened
+ to no URL or to about:blank by the active window.
+ (shouldLoadAsEmptyDocument): Helper for the above.
+ (WindowFunc::tryCall): Update APPLE_CHANGES comments - now it's
+ clear we don't need to create a document in a fresh window
+ (accessing document will take care of that), and that it will be
+ counter-productive, possibly adding a useless entry to the
+ back/forward list.
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::begin): If we're not loading a URL, make a dummy
+ document (the call will check if we have a dummy document
+ already).
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::createEmptyDocument): Isntead of setting up a
+ half-assed document, ask bridge to synchronously load a fully
+ assed (but empty) document. Renamed from createDummyDocument.
+ * kwq/KWQKHTMLPartBrowserExtension.mm:
+ (KHTMLPartBrowserExtension::openURLRequest): Decode script. Also,
+ check if return value is a string - if so, write it into the
+ document. Maybe we want this to be more general.
+ * kwq/KWQKURL.mm:
+ (KURL::KURL): Changed to successfully resolve absolute URLs
+ against an empty base URL.
+ * kwq/WebCoreBridge.h: prototyped new
+ loadEmptyDocumentSynchronously method.
+
2002-12-18 Chris Blumenberg <cblu at apple.com>
Fixed: 3052731 - qt file complains about lack of active-x handler
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 628ca30..35dcba2 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -391,16 +391,12 @@ Value Window::get(ExecState *exec, const Identifier &p) const
case Document:
if (isSafeScript(exec))
{
-#if APPLE_CHANGES
- // FIXME: need to figure out and emulate point of this code.
-#else
if (m_part->document().isNull()) {
kdDebug(6070) << "Document.write: adding <HTML><BODY> to create document" << endl;
m_part->begin();
m_part->write("<HTML><BODY>");
m_part->end();
}
-#endif
Value val = getDOMNode(exec,m_part->document());
return val;
}
@@ -898,6 +894,11 @@ void Window::scheduleClose()
#endif
}
+static bool shouldLoadAsEmptyDocument(const KURL &url)
+{
+ return url.protocol().lower() == "about" || url.isEmpty();
+}
+
bool Window::isSafeScript(ExecState *exec) const
{
if (m_part.isNull()) { // part deleted ? can't grant access
@@ -915,6 +916,13 @@ bool Window::isSafeScript(ExecState *exec) const
if ( m_part->document().isNull() )
return true; // allow to access a window that was just created (e.g. with window.open("about:blank"))
+ if ( activePart == m_part->opener() &&
+ shouldLoadAsEmptyDocument(KURL(m_part->document().completeURL("").string())) ) {
+ return true; // allow access from the window opened this one if it
+ // made an initially empty document.
+ }
+
+
DOM::HTMLDocument thisDocument = m_part->htmlDocument();
if ( thisDocument.isNull() ) {
kdDebug(6070) << "Window::isSafeScript: trying to access an XML document !?" << endl;
@@ -1214,10 +1222,12 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
//qDebug("opener set to %p (this Window's part) in new Window %p (this Window=%p)",part,win,window);
khtmlpart->setOpener(part);
khtmlpart->setOpenedByJS(true);
- if (khtmlpart->document().isNull()) {
#if APPLE_CHANGES
- // FIXME: need to figure out and emulate point of this code.
+ // We don't need this because accessing document from
+ // JavaScript will do the work below on demand, and having
+ // this in adds an extra entry to the back/forward list.
#else
+ if (khtmlpart->document().isNull()) {
khtmlpart->begin();
khtmlpart->write("<HTML><BODY>");
khtmlpart->end();
@@ -1226,8 +1236,8 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
khtmlpart->docImpl()->setDomain( part->docImpl()->domain(), true );
khtmlpart->docImpl()->setBaseURL( part->docImpl()->baseURL() );
}
-#endif
}
+#endif
uargs.serviceType = QString::null;
if (uargs.frameName == "_blank")
uargs.frameName = QString::null;
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index c47dce3..dedbc7d 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -1303,6 +1303,15 @@ void KHTMLPart::slotFinished( KIO::Job * job )
void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
{
+#if APPLE_CHANGES
+ // If we aren't loading an actual URL, then we need to make sure
+ // that we have at least an empty document. createEmptyDocument will
+ // do that if we don't have a document already.
+ if (d->m_workingURL.isEmpty()) {
+ KWQ(this)->createEmptyDocument();
+ }
+#endif
+
clear();
d->m_bCleared = false;
d->m_cacheId = 0;
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index c8fb56a..b65a186 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -126,7 +126,7 @@ public:
void forceLayout();
void paint(QPainter *, const QRect &);
- void createDummyDocument();
+ void createEmptyDocument();
static WebCoreBridge *bridgeForWidget(QWidget *);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 3354d2f..49b8878 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -642,22 +642,9 @@ bool KWQKHTMLPart::runJavaScriptPrompt(const QString &prompt, const QString &def
return ok;
}
-void KWQKHTMLPart::createDummyDocument()
+void KWQKHTMLPart::createEmptyDocument()
{
- if (d->m_doc) {
- ASSERT(d->m_view);
- } else {
- d->m_doc = DOMImplementationImpl::instance()->createHTMLDocument(d->m_view);
- d->m_doc->ref();
-
- ASSERT(d->m_view == 0);
- KHTMLView *kview = new KHTMLView(this, 0);
- setView(kview, true);
-
- NSView *view = [[KWQDummyView alloc] initWithWindow:[_bridge window]];
- kview->setView(view);
- [view release];
- }
+ [_bridge loadEmptyDocumentSynchronously];
}
void KWQKHTMLPart::addMetaData(const QString &key, const QString &value)
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index adafa15..0dff9f1 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -37,8 +37,19 @@ void KHTMLPartBrowserExtension::openURLRequest(const KURL &url,
{
if (url.protocol().lower() == "javascript") {
QString string = url.url();
- KWQ(m_part)->createDummyDocument();
- KWQ(m_part)->executeScript(string.mid(strlen("javascript:")));
+ KWQ(m_part)->createEmptyDocument();
+ QString script = KURL::decode_string(string.mid(strlen("javascript:")));
+ QVariant ret = KWQ(m_part)->executeScript(script);
+
+ // some sites open windows with a javascript: URL that
+ // evaluates to an HTML string which they want placed in the
+ // window - should executing a script always do this?
+ if (ret.type() == QVariant::String) {
+ m_part->begin();
+ m_part->write(ret.asString());
+ m_part->end();
+ }
+
} else {
KWQ(m_part)->openURLRequest(url, args);
}
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index 4de7e6a..d21e0ea 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -233,7 +233,8 @@ KURL::KURL(const QString &url, int encoding_hint) :
KURL::KURL(const KURL &base, const QString &relative)
{
- if (!base.m_isValid) {
+ // Allow at lest absolute URLs to resolve against an empty URL.
+ if (!base.m_isValid && !base.isEmpty()) {
m_isValid = false;
return;
}
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 5435308..87a8da4 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -246,6 +246,8 @@ enum FrameBorderStyle {
- (int)getObjectCacheSize;
+- (void)loadEmptyDocumentSynchronously;
+
@end
// This interface definition allows those who hold a WebCoreBridge * to call all the methods
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index b5d7354..c004564 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -560,7 +560,7 @@ static bool initializedObjectCacheSize = FALSE;
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string
{
- _part->createDummyDocument();
+ _part->createEmptyDocument();
return _part->executeScript(QString::fromNSString(string)).asString().getNSString();
}
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c3b8656..740afd8 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,41 @@
+2002-12-18 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin and Trey.
+
+ - fixed 3124933 - abcnews.com leads to empty window with sheet complaining about javascript: URL
+ - fixed 3091248 - picture does not show up in window from epinions
+ - made "about:blank" load synchronously, which I'm told is required by some sites.
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge createWindowWithURL:frameName:]): If the URL is nil
+ or empty, pass a nil request - otherwise WebBrowser will try to
+ load it, resulting in an extra back/forward list entry.
+ (-[WebBridge loadEmptyDocumentSynchronously]): Tell the frame to
+ load a request with an empty URL - this will cause a synchronous
+ load of an empty html document
+ * WebView.subproj/WebBaseResourceHandleDelegate.h:
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate loadWithRequest:]): Split off
+ startLoading: part of method to allow behavior to be subclassed.
+ (-[WebBaseResourceHandleDelegate startLoading:]):
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSource _commitIfReady:]): Lie and claim the URL is
+ "about:blank" if it's really empty to avoid confusing WebCore.
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _transitionToCommitted:]): Don't put the empty URL in
+ global history.
+ (-[WebFrame
+ _checkNavigationPolicyForRequest:dataSource:andCall:withSelector:]):
+ Don't check policy if URL is empty - this is likely to confuse the
+ client and we know what the right behavior here is.
+ * WebView.subproj/WebMainResourceClient.m:
+ (-[WebMainResourceClient startLoading:]): Try to load
+ "about:blank" and the empty URL synchronously, bypassing
+ WebFoundation.
+ (-[WebMainResourceClient continueAfterContentPolicy:response:]): Ditto.
+ (-[WebMainResourceClient setDefersCallbacks:]): Ditto.
+ * English.lproj/StringsNotToBeLocalized.txt: Updated.
+
2002-12-18 Chris Blumenberg <cblu at apple.com>
Fixed: 2862385 - need to pass browser's user agent and version to plug-ins
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index a42621c..921bf6c 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -201,6 +201,7 @@
"_parent"
"_self"
"_top"
+"about:blank"
"application/octet-stream"
"application/pdf"
"application/x-java-applet"
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 4d72836..a9a9833 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -100,7 +100,12 @@
{
ASSERT(frame != nil);
- WebResourceRequest *request = [WebResourceRequest requestWithURL:[NSURL _web_URLWithString:URL]];
+ WebResourceRequest *request = nil;
+
+ if (URL != nil && [URL length] > 0) {
+ request = [WebResourceRequest requestWithURL:[NSURL _web_URLWithString:URL]];
+ }
+
WebController *newController = [[[frame controller] windowOperationsDelegate] createWindowWithRequest:request];
[newController _setTopLevelFrameName:name];
return [[newController mainFrame] _bridge];
@@ -549,5 +554,13 @@ static BOOL loggedObjectCacheSize = NO;
return cacheSize * multiplier;
}
+- (void)loadEmptyDocumentSynchronously
+{
+ NSURL *url = [[NSURL alloc] initWithString:@""];
+ WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:url];
+ [frame loadRequest:request];
+ [request release];
+ [url release];
+}
@end
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
index ef25b8d..4353ab6 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.h
@@ -20,9 +20,9 @@
@protected
WebDataSource *dataSource;
WebResourceHandle *handle;
+ WebResourceRequest *request;
@private
WebController *controller;
- WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
id <WebResourceLoadDelegate>resourceLoadDelegate;
@@ -34,6 +34,9 @@
- (BOOL)loadWithRequest:(WebResourceRequest *)request;
+// this method exists only to be subclassed, don't call it directly
+- (void)startLoading:(WebResourceRequest *)r;
+
- (void)setDataSource:(WebDataSource *)d;
- (WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
index 5b18d81..901653b 100644
--- a/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
+++ b/WebKit/WebView.subproj/WebBaseResourceHandleDelegate.m
@@ -61,6 +61,11 @@
[super dealloc];
}
+- (void)startLoading:(WebResourceRequest *)r
+{
+ [handle loadWithDelegate:self];
+}
+
- (BOOL)loadWithRequest:(WebResourceRequest *)r
{
ASSERT(handle == nil);
@@ -72,7 +77,9 @@
if (defersCallbacks) {
[handle _setDefersCallbacks:YES];
}
- [handle loadWithDelegate:self];
+
+ [self startLoading:r];
+
return YES;
}
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index f53791a..0a21092 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -463,8 +463,15 @@
[self _makeRepresentation];
[[self webFrame] _transitionToCommitted: pageCache];
-
- [[self _bridge] openURL:[[_private->response URL] absoluteString]
+
+ NSString *urlString = [[_private->response URL] absoluteString];
+
+ // WebCore will crash if given an empty URL here.
+ if ([urlString length] == 0) {
+ urlString = @"about:blank";
+ }
+
+ [[self _bridge] openURL:urlString
reload:reload
headers:headers
lastModified: (pageCache ? nil : [_private->response lastModifiedDate])
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 80be620..414a4d4 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -562,9 +562,12 @@ Repeat load of the same URL (by any other means of navigation other than the rel
case WebFrameLoadTypeStandard:
if (![ds _isClientRedirect]) {
// Add item to history.
- entry = [[WebHistory sharedHistory] addEntryForURL: [[[ds _originalRequest] URL] _web_canonicalize]];
- if (ptitle)
- [entry setTitle: ptitle];
+ NSURL *URL = [[[ds _originalRequest] URL] _web_canonicalize];
+ if ([[URL absoluteString] length] > 0) {
+ entry = [[WebHistory sharedHistory] addEntryForURL:URL];
+ if (ptitle)
+ [entry setTitle: ptitle];
+ }
[self _addBackForwardItemClippedAtTarget:YES];
} else {
@@ -1232,6 +1235,13 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
return;
}
+ // If we are loading the empty URL, don't bother to ask - clients
+ // are likely to get confused.
+ if ([[[request URL] absoluteString] length] == 0) {
+ [target performSelector:selector withObject:(id)YES withObject:request];
+ return;
+ }
+
[dataSource _setLastCheckedRequest:request];
WebPolicyDecisionListener *listener = [[WebPolicyDecisionListener alloc]
diff --git a/WebKit/WebView.subproj/WebLoader.h b/WebKit/WebView.subproj/WebLoader.h
index ef25b8d..4353ab6 100644
--- a/WebKit/WebView.subproj/WebLoader.h
+++ b/WebKit/WebView.subproj/WebLoader.h
@@ -20,9 +20,9 @@
@protected
WebDataSource *dataSource;
WebResourceHandle *handle;
+ WebResourceRequest *request;
@private
WebController *controller;
- WebResourceRequest *request;
WebResourceResponse *response;
id identifier;
id <WebResourceLoadDelegate>resourceLoadDelegate;
@@ -34,6 +34,9 @@
- (BOOL)loadWithRequest:(WebResourceRequest *)request;
+// this method exists only to be subclassed, don't call it directly
+- (void)startLoading:(WebResourceRequest *)r;
+
- (void)setDataSource:(WebDataSource *)d;
- (WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebLoader.m b/WebKit/WebView.subproj/WebLoader.m
index 5b18d81..901653b 100644
--- a/WebKit/WebView.subproj/WebLoader.m
+++ b/WebKit/WebView.subproj/WebLoader.m
@@ -61,6 +61,11 @@
[super dealloc];
}
+- (void)startLoading:(WebResourceRequest *)r
+{
+ [handle loadWithDelegate:self];
+}
+
- (BOOL)loadWithRequest:(WebResourceRequest *)r
{
ASSERT(handle == nil);
@@ -72,7 +77,9 @@
if (defersCallbacks) {
[handle _setDefersCallbacks:YES];
}
- [handle loadWithDelegate:self];
+
+ [self startLoading:r];
+
return YES;
}
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 0e83832..2fbc81e 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -8,10 +8,12 @@
#import <WebFoundation/WebCookieConstants.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebFileTypeMappings.h>
+#import <WebFoundation/WebNSURLExtras.h>
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
+#import <WebFoundation/WebResourceResponsePrivate.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebController.h>
@@ -243,6 +245,10 @@
}
[super handle:handle didReceiveResponse:r];
+
+ if ([[req URL] _web_shouldLoadAsEmptyDocument]) {
+ [self handleDidFinishLoading:handle];
+ }
}
@@ -352,4 +358,28 @@
[self release];
}
+- (void)startLoading:(WebResourceRequest *)r
+{
+ if ([[r URL] _web_shouldLoadAsEmptyDocument]) {
+ [self handle:handle willSendRequest:r];
+
+ WebResourceResponse *rsp = [[WebResourceResponse alloc] init];
+ [rsp _setURL:[r URL]];
+ [rsp _setContentType:@"text/html"];
+ [rsp _setContentLength:0];
+ [self handle:handle didReceiveResponse:rsp];
+ [rsp release];
+ } else {
+ [super startLoading:r];
+ }
+}
+
+- (void)setDefersCallbacks:(BOOL)defers
+{
+ if (request && !([[request URL] _web_shouldLoadAsEmptyDocument])) {
+ [super setDefersCallbacks:defers];
+ }
+}
+
+
@end
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 0e83832..2fbc81e 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -8,10 +8,12 @@
#import <WebFoundation/WebCookieConstants.h>
#import <WebFoundation/WebError.h>
#import <WebFoundation/WebFileTypeMappings.h>
+#import <WebFoundation/WebNSURLExtras.h>
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceRequest.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
#import <WebFoundation/WebResourceResponse.h>
+#import <WebFoundation/WebResourceResponsePrivate.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebController.h>
@@ -243,6 +245,10 @@
}
[super handle:handle didReceiveResponse:r];
+
+ if ([[req URL] _web_shouldLoadAsEmptyDocument]) {
+ [self handleDidFinishLoading:handle];
+ }
}
@@ -352,4 +358,28 @@
[self release];
}
+- (void)startLoading:(WebResourceRequest *)r
+{
+ if ([[r URL] _web_shouldLoadAsEmptyDocument]) {
+ [self handle:handle willSendRequest:r];
+
+ WebResourceResponse *rsp = [[WebResourceResponse alloc] init];
+ [rsp _setURL:[r URL]];
+ [rsp _setContentType:@"text/html"];
+ [rsp _setContentLength:0];
+ [self handle:handle didReceiveResponse:rsp];
+ [rsp release];
+ } else {
+ [super startLoading:r];
+ }
+}
+
+- (void)setDefersCallbacks:(BOOL)defers
+{
+ if (request && !([[request URL] _web_shouldLoadAsEmptyDocument])) {
+ [super setDefersCallbacks:defers];
+ }
+}
+
+
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list