Commit 58af41be authored by darin's avatar darin
Browse files

WebCore:

	WebCore support for using referrer even in loads that are not initiated
	by WebCore itself.

        * kwq/KWQKHTMLPartBrowserExtension.mm:
        (KHTMLPartBrowserExtension::createNewWindow): Don't pass a referrer.
	We get the referrer from the part.

        * kwq/KWQKHTMLPartImpl.h: Add a new referrer method that works on the
	part, and remove the old one that got it from the URL arguments.
        * kwq/KWQKHTMLPartImpl.mm:
        (KWQKHTMLPartImpl::bridgeForFrameName): Don't pass a referrer when
	creating a new window.
        (KWQKHTMLPartImpl::openURLRequest): Don't pass a referrer when doing a load.
        (KWQKHTMLPartImpl::urlSelected): Don't pass a referrer when doing a load.
        (KWQKHTMLPartImpl::createPart): Don't pass a referrer when creating a child
	frame for this window.
        (KWQKHTMLPartImpl::submitForm): Don't pass a referrer when doing a load.
        (KWQKHTMLPartImpl::referrer): Added.

        * kwq/KWQLoaderImpl.mm: (KWQServeRequest): Don't pass a referrer when starting
	a load.
        * kwq/WebCoreBridge.h: Add referrer method. Remove referrer parameter from
	many other methods.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge referrer]): Added.

WebKit:

	- fixed 3062393 -- need to send proper referrer for "open in new window" menu items and keyboard shortcuts

        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge createWindowWithURL:frameName:]): Don't take a referrer parameter any more.
	Get the referrer by calling to the other side of the bridge, instead.
        (-[WebBridge startLoadingResource:withURL:]): Ditto.
        (-[WebBridge loadURL:]): Ditto.
        (-[WebBridge postWithURL:data:contentType:]): Ditto.
        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
	Ditto.

        * WebView.subproj/WebDefaultContextMenuDelegate.m:
        (-[WebDefaultContextMenuDelegate openNewWindowWithURL:]): Don't take a referrer parameter,
	which was always nil anyway. Instead, get the referrer from the bridge.
        (-[WebDefaultContextMenuDelegate openLinkInNewWindow:]): Don't pass nil for referrer.
        (-[WebDefaultContextMenuDelegate openImageInNewWindow:]): Ditto.
        (-[WebDefaultContextMenuDelegate openFrameInNewWindow:]): Ditto.

        * WebView.subproj/WebHTMLViewPrivate.m:
        (-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass a referrer from the bridge, rather
	than nil, for both WebClickPolicyOpenNewWindow and WebClickPolicyOpenNewWindowBehind.

        * Plugins.subproj/WebBaseNetscapePluginView.m:
        (-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:]): Add a FIXME.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4356a8f1
2002-10-15 Darin Adler <darin@apple.com>
WebCore support for using referrer even in loads that are not initiated
by WebCore itself.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Don't pass a referrer.
We get the referrer from the part.
* kwq/KWQKHTMLPartImpl.h: Add a new referrer method that works on the
part, and remove the old one that got it from the URL arguments.
* kwq/KWQKHTMLPartImpl.mm:
(KWQKHTMLPartImpl::bridgeForFrameName): Don't pass a referrer when
creating a new window.
(KWQKHTMLPartImpl::openURLRequest): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::urlSelected): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::createPart): Don't pass a referrer when creating a child
frame for this window.
(KWQKHTMLPartImpl::submitForm): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::referrer): Added.
* kwq/KWQLoaderImpl.mm: (KWQServeRequest): Don't pass a referrer when starting
a load.
* kwq/WebCoreBridge.h: Add referrer method. Remove referrer parameter from
many other methods.
* kwq/WebCoreBridge.mm: (-[WebCoreBridge referrer]): Added.
2002-10-15 Darin Adler <darin@apple.com>
 
- fixed 3021713 -- text selection background obliterates descenders
......
2002-10-15 Darin Adler <darin@apple.com>
WebCore support for using referrer even in loads that are not initiated
by WebCore itself.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Don't pass a referrer.
We get the referrer from the part.
* kwq/KWQKHTMLPartImpl.h: Add a new referrer method that works on the
part, and remove the old one that got it from the URL arguments.
* kwq/KWQKHTMLPartImpl.mm:
(KWQKHTMLPartImpl::bridgeForFrameName): Don't pass a referrer when
creating a new window.
(KWQKHTMLPartImpl::openURLRequest): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::urlSelected): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::createPart): Don't pass a referrer when creating a child
frame for this window.
(KWQKHTMLPartImpl::submitForm): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::referrer): Added.
* kwq/KWQLoaderImpl.mm: (KWQServeRequest): Don't pass a referrer when starting
a load.
* kwq/WebCoreBridge.h: Add referrer method. Remove referrer parameter from
many other methods.
* kwq/WebCoreBridge.mm: (-[WebCoreBridge referrer]): Added.
2002-10-15 Darin Adler <darin@apple.com>
 
- fixed 3021713 -- text selection background obliterates descenders
......
2002-10-15 Darin Adler <darin@apple.com>
WebCore support for using referrer even in loads that are not initiated
by WebCore itself.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Don't pass a referrer.
We get the referrer from the part.
* kwq/KWQKHTMLPartImpl.h: Add a new referrer method that works on the
part, and remove the old one that got it from the URL arguments.
* kwq/KWQKHTMLPartImpl.mm:
(KWQKHTMLPartImpl::bridgeForFrameName): Don't pass a referrer when
creating a new window.
(KWQKHTMLPartImpl::openURLRequest): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::urlSelected): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::createPart): Don't pass a referrer when creating a child
frame for this window.
(KWQKHTMLPartImpl::submitForm): Don't pass a referrer when doing a load.
(KWQKHTMLPartImpl::referrer): Added.
* kwq/KWQLoaderImpl.mm: (KWQServeRequest): Don't pass a referrer when starting
a load.
* kwq/WebCoreBridge.h: Add referrer method. Remove referrer parameter from
many other methods.
* kwq/WebCoreBridge.mm: (-[WebCoreBridge referrer]): Added.
2002-10-15 Darin Adler <darin@apple.com>
 
- fixed 3021713 -- text selection background obliterates descenders
......
......@@ -125,7 +125,7 @@ public:
void redirectionTimerStartedOrStopped();
static NSString *referrer(const KParts::URLArgs &);
QString referrer() const;
static const QPtrList<KWQKHTMLPartImpl> &instances() { return mutableInstances(); }
......
......@@ -118,7 +118,7 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
frame = [_bridge frameNamed:frameName.getNSString()];
}
if (frame == nil) {
frame = [_bridge createWindowWithURL:nil referrer:nil frameName:frameName.getNSString()];
frame = [_bridge createWindowWithURL:nil frameName:frameName.getNSString()];
[frame showWindow];
}
}
......@@ -126,11 +126,6 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
return frame;
}
NSString *KWQKHTMLPartImpl::referrer(const URLArgs &args)
{
return args.metaData()["referrer"].getNSString();
}
void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
{
NSURL *cocoaURL = url.getNSURL();
......@@ -139,7 +134,7 @@ void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:cocoaURL];
}
void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const char *bytes, int length, bool complete)
......@@ -168,7 +163,7 @@ void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:cocoaURL];
}
class KWQPluginPart : public ReadOnlyPart
......@@ -201,8 +196,7 @@ ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &
} else {
LOG(Frames, "name %s", child.m_name.ascii());
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(child.m_frame->element());
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString()
withURL:childURL referrer:referrer(child.m_args)
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString() withURL:childURL
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
......@@ -212,11 +206,11 @@ ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &
void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
{
if (!args.doPost()) {
[bridgeForFrameName(args.frameName) loadURL:u.getNSURL() referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:u.getNSURL()];
} else {
QString contentType = args.contentType();
ASSERT(contentType.startsWith("Content-Type: "));
[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL() referrer:referrer(args)
[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL()
data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
contentType:contentType.mid(14).getNSString()];
}
......@@ -486,3 +480,8 @@ void KWQKHTMLPartImpl::forceLayout()
v->unscheduleRelayout();
}
}
QString KWQKHTMLPartImpl::referrer() const
{
return d->m_referrer;
}
......@@ -77,9 +77,7 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
}
NSURL *cocoaURL = url.isEmpty() ? nil : url.getNSURL();
bridge = [m_part->impl->bridge() createWindowWithURL:cocoaURL
referrer:KWQKHTMLPartImpl::referrer(urlArgs)
frameName:frameName];
bridge = [m_part->impl->bridge() createWindowWithURL:cocoaURL frameName:frameName];
if (!winArgs.toolBarsVisible) {
[bridge setToolbarsVisible:NO];
......
......@@ -125,7 +125,7 @@ public:
void redirectionTimerStartedOrStopped();
static NSString *referrer(const KParts::URLArgs &);
QString referrer() const;
static const QPtrList<KWQKHTMLPartImpl> &instances() { return mutableInstances(); }
......
......@@ -118,7 +118,7 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
frame = [_bridge frameNamed:frameName.getNSString()];
}
if (frame == nil) {
frame = [_bridge createWindowWithURL:nil referrer:nil frameName:frameName.getNSString()];
frame = [_bridge createWindowWithURL:nil frameName:frameName.getNSString()];
[frame showWindow];
}
}
......@@ -126,11 +126,6 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
return frame;
}
NSString *KWQKHTMLPartImpl::referrer(const URLArgs &args)
{
return args.metaData()["referrer"].getNSString();
}
void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
{
NSURL *cocoaURL = url.getNSURL();
......@@ -139,7 +134,7 @@ void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:cocoaURL];
}
void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const char *bytes, int length, bool complete)
......@@ -168,7 +163,7 @@ void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:cocoaURL];
}
class KWQPluginPart : public ReadOnlyPart
......@@ -201,8 +196,7 @@ ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &
} else {
LOG(Frames, "name %s", child.m_name.ascii());
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(child.m_frame->element());
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString()
withURL:childURL referrer:referrer(child.m_args)
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString() withURL:childURL
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
......@@ -212,11 +206,11 @@ ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &
void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
{
if (!args.doPost()) {
[bridgeForFrameName(args.frameName) loadURL:u.getNSURL() referrer:referrer(args)];
[bridgeForFrameName(args.frameName) loadURL:u.getNSURL()];
} else {
QString contentType = args.contentType();
ASSERT(contentType.startsWith("Content-Type: "));
[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL() referrer:referrer(args)
[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL()
data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
contentType:contentType.mid(14).getNSString()];
}
......@@ -486,3 +480,8 @@ void KWQKHTMLPartImpl::forceLayout()
v->unscheduleRelayout();
}
}
QString KWQKHTMLPartImpl::referrer() const
{
return d->m_referrer;
}
......@@ -110,8 +110,7 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
}
WebCoreResourceLoader *resourceLoader = [[WebCoreResourceLoader alloc] initWithLoader:loader job:job];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader
withURL:URL referrer:job->queryMetaData("referrer").getNSString()];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:URL];
[resourceLoader release];
if (handle == nil) {
......
......@@ -110,8 +110,7 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
}
WebCoreResourceLoader *resourceLoader = [[WebCoreResourceLoader alloc] initWithLoader:loader job:job];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader
withURL:URL referrer:job->queryMetaData("referrer").getNSString()];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:URL];
[resourceLoader release];
if (handle == nil) {
......
......@@ -98,6 +98,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
- (void)end;
- (NSURL *)URL;
- (NSString *)referrer;
- (void)installInFrame:(NSView *)view;
- (void)removeFromFrame;
......@@ -164,10 +165,10 @@ typedef khtml::RenderPart KHTMLRenderPart;
- (WebCoreBridge *)mainFrame;
- (WebCoreBridge *)frameNamed:(NSString *)name; // searches entire hierarchy starting with mainFrame
- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer;
- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer data:(NSData *)data contentType:(NSString *)contentType;
- (void)loadURL:(NSURL *)URL;
- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType;
- (WebCoreBridge *)createWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer frameName:(NSString *)name;
- (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
- (void)showWindow;
- (NSString *)userAgentForURL:(NSURL *)URL;
......@@ -178,8 +179,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
- (void)setIconURL:(NSURL *)URL;
- (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName
withURL:(NSURL *)URL referrer:(NSString *)referrer
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
renderPart:(KHTMLRenderPart *)renderPart
allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
......@@ -192,7 +192,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
- (NSWindow *)window;
- (void)setWindowFrame:(NSRect)frame;
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL referrer:(NSString *)referrer;
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL;
- (void)reportBadURL:(NSString *)badURL;
- (void)objectLoadedFromCache:(NSURL *)URL response:(id)response size:(unsigned)bytes;
- (BOOL)isReloading;
......
......@@ -765,4 +765,9 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
return part->url().getNSURL();
}
- (NSString *)referrer
{
return part->impl->referrer().getNSString();
}
@end
2002-10-15 Darin Adler <darin@apple.com>
- fixed 3062393 -- need to send proper referrer for "open in new window" menu items and keyboard shortcuts
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge createWindowWithURL:frameName:]): Don't take a referrer parameter any more.
Get the referrer by calling to the other side of the bridge, instead.
(-[WebBridge startLoadingResource:withURL:]): Ditto.
(-[WebBridge loadURL:]): Ditto.
(-[WebBridge postWithURL:data:contentType:]): Ditto.
(-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
Ditto.
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultContextMenuDelegate openNewWindowWithURL:]): Don't take a referrer parameter,
which was always nil anyway. Instead, get the referrer from the bridge.
(-[WebDefaultContextMenuDelegate openLinkInNewWindow:]): Don't pass nil for referrer.
(-[WebDefaultContextMenuDelegate openImageInNewWindow:]): Ditto.
(-[WebDefaultContextMenuDelegate openFrameInNewWindow:]): Ditto.
* WebView.subproj/WebHTMLViewPrivate.m:
(-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass a referrer from the bridge, rather
than nil, for both WebClickPolicyOpenNewWindow and WebClickPolicyOpenNewWindowBehind.
* Plugins.subproj/WebBaseNetscapePluginView.m:
(-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:]): Add a FIXME.
2002-10-15 Darin Adler <darin@apple.com>
 
* WebView.subproj/WebDataSourcePrivate.h: Remove unused stuff.
......
2002-10-15 Darin Adler <darin@apple.com>
- fixed 3062393 -- need to send proper referrer for "open in new window" menu items and keyboard shortcuts
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge createWindowWithURL:frameName:]): Don't take a referrer parameter any more.
Get the referrer by calling to the other side of the bridge, instead.
(-[WebBridge startLoadingResource:withURL:]): Ditto.
(-[WebBridge loadURL:]): Ditto.
(-[WebBridge postWithURL:data:contentType:]): Ditto.
(-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
Ditto.
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultContextMenuDelegate openNewWindowWithURL:]): Don't take a referrer parameter,
which was always nil anyway. Instead, get the referrer from the bridge.
(-[WebDefaultContextMenuDelegate openLinkInNewWindow:]): Don't pass nil for referrer.
(-[WebDefaultContextMenuDelegate openImageInNewWindow:]): Ditto.
(-[WebDefaultContextMenuDelegate openFrameInNewWindow:]): Ditto.
* WebView.subproj/WebHTMLViewPrivate.m:
(-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass a referrer from the bridge, rather
than nil, for both WebClickPolicyOpenNewWindow and WebClickPolicyOpenNewWindowBehind.
* Plugins.subproj/WebBaseNetscapePluginView.m:
(-[WebBaseNetscapePluginView loadRequest:inTarget:withNotifyData:]): Add a FIXME.
2002-10-15 Darin Adler <darin@apple.com>
 
* WebView.subproj/WebDataSourcePrivate.h: Remove unused stuff.
......
......@@ -790,6 +790,7 @@ - (NPError)loadRequest:(WebResourceRequest *)request inTarget:(NSString *)target
WebFrame *frame = [[self webFrame] frameNamed:target];
if(!frame){
// FIXME: Why is it OK to just discard all the attributes in this case?
// FIXME: Do we need a referrer here?
[[self controller] _openNewWindowWithURL:URL referrer:nil behind:NO];
// FIXME: Need to send NPP_URLNotify at the right time.
// FIXME: Need to name new frame
......
......@@ -68,11 +68,11 @@ - (WebCoreBridge *)descendantFrameNamed:(NSString *)name
return [[frame frameNamed:name] _bridge];
}
- (WebCoreBridge *)createWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer frameName:(NSString *)name
- (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name
{
ASSERT(frame != nil);
WebController *newController = [[[frame controller] windowOperationsDelegate] createWindowWithURL:URL referrer:referrer];
WebController *newController = [[[frame controller] windowOperationsDelegate] createWindowWithURL:URL referrer:[self referrer]];
[newController _setTopLevelFrameName:name];
return [[newController mainFrame] _bridge];
}
......@@ -166,11 +166,11 @@ - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)withDataSour
}
}
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader withURL:(NSURL *)URL referrer:(NSString *)referrer
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader withURL:(NSURL *)URL
{
return [WebSubresourceClient startLoadingResource:resourceLoader
withURL:URL
referrer:referrer
referrer:[self referrer]
forDataSource:[self dataSource]];
}
......@@ -265,7 +265,7 @@ - (void)loadRequest:(WebResourceRequest *)request
[newDataSource release];
}
- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer
- (void)loadURL:(NSURL *)URL
{
// FIXME: This logic doesn't exactly match what KHTML does in openURL, so it's possible
// this will screw up in some cases involving framesets.
......@@ -287,12 +287,12 @@ - (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer
}
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
[request setReferrer:referrer];
[request setReferrer:[self referrer]];
[self loadRequest:request];
[request release];
}
- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer data:(NSData *)data contentType:(NSString *)contentType
- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
{
// When posting, use the WebResourceHandleFlagLoadFromOrigin load flag.
// This prevents a potential bug which may cause a page
......@@ -303,13 +303,12 @@ - (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer data:(NSData *)da
[request setMethod:@"POST"];
[request setData:data];
[request setContentType:contentType];
[request setReferrer:referrer];
[request setReferrer:[self referrer]];
[self loadRequest:request];
[request release];
}
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName
withURL:(NSURL *)URL referrer:(NSString *)referrer
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
renderPart:(KHTMLRenderPart *)childRenderPart
allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height
{
......@@ -324,7 +323,10 @@ - (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName
[[newFrame webView] _setMarginWidth:width];
[[newFrame webView] _setMarginHeight:height];
[[newFrame _bridge] loadURL:URL referrer:referrer];
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
[request setReferrer:[self referrer]];
[[newFrame _bridge] loadRequest:request];
[request release];
// Set the load type so this load doesn't end up in the back/forward list.
[newFrame _setLoadType:WebFrameLoadTypeInternal];
......
......@@ -4,13 +4,11 @@
*/
#import <WebKit/WebContextMenuDelegate.h>
#import <WebKit/WebController.h>
#import <WebKit/WebControllerPolicyDelegate.h>
#import <WebKit/WebControllerPrivate.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDefaultContextMenuDelegate.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebNSPasteboardExtras.h>
#import <WebKit/WebWindowOperationsDelegate.h>
......@@ -96,11 +94,11 @@ - (NSArray *)contextMenuItemsForElement: (NSDictionary *)theElement defaultMenu
return menuItems;
}
- (void)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer
- (void)openNewWindowWithURL:(NSURL *)URL
{
WebFrame *webFrame = [element objectForKey:WebElementFrameKey];
WebController *controller = [webFrame controller];
[controller _openNewWindowWithURL:URL referrer:referrer behind:NO];
[controller _openNewWindowWithURL:URL referrer:[[webFrame _bridge] referrer] behind:NO];
}
- (void)downloadURL:(NSURL *)URL
......@@ -112,7 +110,7 @@ - (void)downloadURL:(NSURL *)URL
- (void)openLinkInNewWindow:(id)sender
{
[self openNewWindowWithURL:[element objectForKey:WebElementLinkURLKey] referrer:nil];
[self openNewWindowWithURL:[element objectForKey:WebElementLinkURLKey]];
}
- (void)downloadLinkToDisk:(id)sender
......@@ -130,7 +128,7 @@ - (void)copyLinkToClipboard:(id)sender
- (void)openImageInNewWindow:(id)sender
{
[self openNewWindowWithURL:[element objectForKey:WebElementImageURLKey] referrer:nil];
[self openNewWindowWithURL:[element objectForKey:WebElementImageURLKey]];
}
- (void)downloadImageToDisk:(id)sender
......@@ -152,7 +150,7 @@ - (void)openFrameInNewWindow:(id)sender
WebFrame *webFrame = [element objectForKey:WebElementFrameKey];
WebDataSource *dataSource = [webFrame dataSource];
NSURL *URL = [dataSource URL];
[self openNewWindowWithURL:URL referrer:nil];
[self openNewWindowWithURL:URL];
}
......
......@@ -172,10 +172,10 @@ - (BOOL)_continueAfterClickPolicyForEvent:(NSEvent *)event
case WebClickPolicyShow:
return YES;
case WebClickPolicyOpenNewWindow:
[controller _openNewWindowWithURL:URL referrer:nil behind:NO];
[controller _openNewWindowWithURL:URL referrer:[[self _bridge] referrer] behind:NO];
break;
case WebClickPolicyOpenNewWindowBehind:
[controller _openNewWindowWithURL:URL referrer:nil behind:YES];
[controller _openNewWindowWithURL:URL referrer:[[self _bridge] referrer] behind:YES];
break;
case WebClickPolicySave:
case WebClickPolicySaveAndOpenExternally:
......
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