[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:41:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d95509628e2849460c068896153dd1653d546132
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon May 12 20:29:43 2003 +0000

    WebKit:
    
            Reviewed by John.
    
    	- fixed 3254576 -- REGRESSION: visiting bookmarks view sometimes waits for other tabs to load first
    
            * WebView.subproj/WebViewPrivate.h: Added new SPI for registering view and represenation classes by
            scheme rather than MIME type.
            * WebView.subproj/WebViewPrivate.m:
            (+[WebView _registerViewClass:representationClass:forURLScheme:]]): Added.
            (+[WebView _generatedMIMETypeForURLScheme:]): Added. Makes a special MIME type for us only by the
            special "register scheme" mechanism.
            (+[WebView _representationExistsForURLScheme:]): Added.
    
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient continueAfterContentPolicy:response:]): Check for schemes that have their
            own representation, and handle them just like empty documents, loading no data, and doing it synchronously.
            (-[WebMainResourceClient loadWithRequest:]): Same thing here, only also arrange to get the appropriate
            MIME type.
            (-[WebMainResourceClient setDefersCallbacks:]): Same check here.
    
            * English.lproj/StringsNotToBeLocalized.txt: Update for recent changes.
    
    WebBrowser:
    
            Reviewed by John.
    
    	- fixed 3254576 -- REGRESSION: visiting bookmarks view sometimes waits for other tabs to load first
    
            * AppController.m: (+[AppController initialize]): Register the bookmarks view and
            representation class using the scheme, not the MIME type.
    
            * BrowserNSStringExtras.m: (-[NSString possibleURLsForUserTypedString]):
            Fix off by one error that would cause an NSException when you typed bookmarks:.
            Also fix so that bookmarks: is not treated as a host name.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 147c7de..bd93943 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,26 @@
+2003-05-12  Darin Adler  <darin at apple.com>
+
+        Reviewed by John.
+
+	- fixed 3254576 -- REGRESSION: visiting bookmarks view sometimes waits for other tabs to load first
+
+        * WebView.subproj/WebViewPrivate.h: Added new SPI for registering view and represenation classes by
+        scheme rather than MIME type.
+        * WebView.subproj/WebViewPrivate.m:
+        (+[WebView _registerViewClass:representationClass:forURLScheme:]]): Added.
+        (+[WebView _generatedMIMETypeForURLScheme:]): Added. Makes a special MIME type for us only by the
+        special "register scheme" mechanism.
+        (+[WebView _representationExistsForURLScheme:]): Added.
+
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient continueAfterContentPolicy:response:]): Check for schemes that have their
+        own representation, and handle them just like empty documents, loading no data, and doing it synchronously.
+        (-[WebMainResourceClient loadWithRequest:]): Same thing here, only also arrange to get the appropriate
+        MIME type.
+        (-[WebMainResourceClient setDefersCallbacks:]): Same check here.
+
+        * English.lproj/StringsNotToBeLocalized.txt: Update for recent changes.
+
 2003-05-11  Darin Adler  <darin at apple.com>
 
         * WebView.subproj/WebHTMLView.m: (-[WebHTMLView layoutToPageWidth:]): Added a check for nil that I forgot.
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index 56e79c0..c946d3b 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -18,6 +18,7 @@
 "/tmp/WebKitPlugInStreamXXXXXX"
 "/tmp/XXXXXX.tiff"
 "0x0"
+"1"
 "1.00"
 "1000"
 "13"
@@ -26,7 +27,6 @@
 "4096"
 "4194304"
 "7"
-"9"
 ";"
 "<!--framePath "
 "="
@@ -245,6 +245,7 @@
 "video/mp4"
 "visitCount"
 "x"
+"x-apple-web-kit/"
 History.subproj/WebHistoryItem.m:" in \"%@\""
 History.subproj/WebHistoryItem.m:"children"
 History.subproj/WebHistoryItem.m:"title"
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 81d7a05..03ea6f4 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -194,10 +194,10 @@
 
     [super connection:connection didReceiveResponse:r];
 
-    if (![dataSource _isStopping]){
-        if ([[request URL] _web_shouldLoadAsEmptyDocument]) {
-            [self connectionDidFinishLoading:connection];
-        }
+    if (![dataSource _isStopping]
+            && ([[request URL] _web_shouldLoadAsEmptyDocument]
+            	|| [WebView _representationExistsForURLScheme:[[request URL] scheme]])) {
+        [self connectionDidFinishLoading:connection];
     }
     
     [self release];
@@ -300,22 +300,26 @@
 {
     ASSERT(connection == nil);
     
-    if ([[r URL] _web_shouldLoadAsEmptyDocument]) {
-        connection = [[NSURLConnection alloc] initWithRequest:r delegate:nil];
-
-	[self connection:connection willSendRequest:r redirectResponse:nil];
+    // Send this synthetic delegate callback since clients expect it, and
+    // we no longer send the callback from within NSURLConnection for
+    // initial requests.
+    r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
+
+    NSURL *URL = [r URL];
+    BOOL shouldLoadEmpty = [URL _web_shouldLoadAsEmptyDocument];
+    if (shouldLoadEmpty || [WebView _representationExistsForURLScheme:[URL scheme]]) {
+        NSString *MIMEType;
+        if (shouldLoadEmpty) {
+            MIMEType = @"text/html";
+        } else {
+            MIMEType = [WebView _generatedMIMETypeForURLScheme:[URL scheme]];
+        }
 
-	NSURLResponse *rsp = [[NSURLResponse alloc] initWithURL:[[[self dataSource] request] URL]
-						    MIMEType:@"text/html"
-						    expectedContentLength:0
-						    textEncodingName:nil];
-	[self connection:connection didReceiveResponse:rsp];
-	[rsp release];
+	NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
+            expectedContentLength:0 textEncodingName:nil];
+	[self connection:nil didReceiveResponse:resp];
+	[resp release];
     } else {
-        // send this synthetic delegate callback since clients expect it, and
-        // we no longer send the callback from within NSURLConnection for
-        // initial requests.
-        r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
         connection = [[NSURLConnection alloc] initWithRequest:r delegate:proxy];
         if ([self defersCallbacks]) {
             [connection setDefersCallbacks:YES];
@@ -327,7 +331,9 @@
 
 - (void)setDefersCallbacks:(BOOL)defers
 {
-    if (request && !([[request URL] _web_shouldLoadAsEmptyDocument])) {
+    if (request
+            && ![[request URL] _web_shouldLoadAsEmptyDocument]
+            && ![WebView _representationExistsForURLScheme:[[request URL] scheme]]) {
 	[super setDefersCallbacks:defers];
     }
 }
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 81d7a05..03ea6f4 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -194,10 +194,10 @@
 
     [super connection:connection didReceiveResponse:r];
 
-    if (![dataSource _isStopping]){
-        if ([[request URL] _web_shouldLoadAsEmptyDocument]) {
-            [self connectionDidFinishLoading:connection];
-        }
+    if (![dataSource _isStopping]
+            && ([[request URL] _web_shouldLoadAsEmptyDocument]
+            	|| [WebView _representationExistsForURLScheme:[[request URL] scheme]])) {
+        [self connectionDidFinishLoading:connection];
     }
     
     [self release];
@@ -300,22 +300,26 @@
 {
     ASSERT(connection == nil);
     
-    if ([[r URL] _web_shouldLoadAsEmptyDocument]) {
-        connection = [[NSURLConnection alloc] initWithRequest:r delegate:nil];
-
-	[self connection:connection willSendRequest:r redirectResponse:nil];
+    // Send this synthetic delegate callback since clients expect it, and
+    // we no longer send the callback from within NSURLConnection for
+    // initial requests.
+    r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
+
+    NSURL *URL = [r URL];
+    BOOL shouldLoadEmpty = [URL _web_shouldLoadAsEmptyDocument];
+    if (shouldLoadEmpty || [WebView _representationExistsForURLScheme:[URL scheme]]) {
+        NSString *MIMEType;
+        if (shouldLoadEmpty) {
+            MIMEType = @"text/html";
+        } else {
+            MIMEType = [WebView _generatedMIMETypeForURLScheme:[URL scheme]];
+        }
 
-	NSURLResponse *rsp = [[NSURLResponse alloc] initWithURL:[[[self dataSource] request] URL]
-						    MIMEType:@"text/html"
-						    expectedContentLength:0
-						    textEncodingName:nil];
-	[self connection:connection didReceiveResponse:rsp];
-	[rsp release];
+	NSURLResponse *resp = [[NSURLResponse alloc] initWithURL:URL MIMEType:MIMEType
+            expectedContentLength:0 textEncodingName:nil];
+	[self connection:nil didReceiveResponse:resp];
+	[resp release];
     } else {
-        // send this synthetic delegate callback since clients expect it, and
-        // we no longer send the callback from within NSURLConnection for
-        // initial requests.
-        r = [proxy connection:nil willSendRequest:r redirectResponse:nil];
         connection = [[NSURLConnection alloc] initWithRequest:r delegate:proxy];
         if ([self defersCallbacks]) {
             [connection setDefersCallbacks:YES];
@@ -327,7 +331,9 @@
 
 - (void)setDefersCallbacks:(BOOL)defers
 {
-    if (request && !([[request URL] _web_shouldLoadAsEmptyDocument])) {
+    if (request
+            && ![[request URL] _web_shouldLoadAsEmptyDocument]
+            && ![WebView _representationExistsForURLScheme:[[request URL] scheme]]) {
 	[super setDefersCallbacks:defers];
     }
 }
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index e879ff0..0c3df9e 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -165,6 +165,19 @@ Could be worth adding to the API.
 - (void)_registerDraggedTypes;
 
 - (void)_close;
+
+/*!
+    @method _registerViewClass:representationClass:forURLScheme:
+    @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
+    @param viewClass The WebDocumentView class to use to render data for a given MIME type.
+    @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
+    @param scheme The URL scheme to represent with an object of the given class.
+*/
++ (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
+
++ (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
++ (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
+
 @end
 
 @interface _WebSafeForwarder : NSObject
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index b528afa..514f723 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -33,6 +33,8 @@
 
 #import <WebCore/WebCoreSettings.h>
 
+static NSMutableSet *schemesWithRepresentationsSet;
+
 @implementation WebViewPrivate
 
 - init 
@@ -563,6 +565,29 @@
     [[self _UIDelegateForwarder] webViewClose:self];
 }
 
++ (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
+{
+    NSString *MIMEType = [self _generatedMIMETypeForURLScheme:URLScheme];
+    [self registerViewClass:viewClass representationClass:representationClass forMIMEType:MIMEType];
+
+    // This is used to make _representationExistsForURLScheme faster.
+    // Without this set, we'd have to create the MIME type each time.
+    if (schemesWithRepresentationsSet == nil) {
+        schemesWithRepresentationsSet = [[NSMutableSet alloc] init];
+    }
+    [schemesWithRepresentationsSet addObject:[[[URLScheme lowercaseString] copy] autorelease]];
+}
+
++ (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme
+{
+    return [@"x-apple-web-kit/" stringByAppendingString:[URLScheme lowercaseString]];
+}
+
++ (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme
+{
+    return [schemesWithRepresentationsSet containsObject:[URLScheme lowercaseString]];
+}
+
 @end
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list