Commit c26ab578 authored by darin's avatar darin
Browse files

WebCore:

	- fixed 3083043 -- Alex doesn't decode % sequences in javascript: URLs

	Some places here did KURL::decode_string, but others didn't.

        * khtml/khtml_part.cpp:
        (KHTMLPart::slotShowDocument): Added call to KURL::decode_string.
        (KHTMLPart::overURL): Ditto.
        (KHTMLPart::urlSelected): Ditto.
        (KHTMLPart::requestFrame): Ditto.
        (KHTMLPart::slotChildURLRequest): Ditto.

WebKit:

	- improved the code that manages observing the window and superview

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView addSuperviewObservers]): Added.
        (-[WebHTMLView removeSuperviewObservers]): Added.
        (-[WebHTMLView addWindowObservers]): Added.
        (-[WebHTMLView removeWindowObservers]): Added.
        (-[WebHTMLView viewWillMoveToSuperview:]): Call removeSuperviewObservers.
        (-[WebHTMLView viewDidMoveToSuperview]): Call addSuperviewObservers.
        (-[WebHTMLView viewWillMoveToWindow:]): Call removeWindowObservers and
	removeSuperviewObservers.
        (-[WebHTMLView viewDidMoveToWindow]): Call addWindowObservers and
	addSuperviewObservers.

WebBrowser:

	- fixed 3083043 -- Alex doesn't decode % sequences in javascript: URLs

        * BrowserWebBookmarkExtras.m: (-[WebBookmark _goToWithWindowPolicy:]):
	Call CFURLCreateStringByReplacingPercentEscapes on the URL fragment before
	passing it to stringByEvaluatingJavaScriptFromString:.
        * BrowserWindowController.m: (-[BrowserWindowController goToToolbarLocation:]):
	Ditto.

	- fixed world leaks seen when playing with the snippet window

        * Debug/SnippetController.m:
        (-[SnippetController dealloc]): Release the location change delegate to avoid a leak.
	Also release the data source now that we retain it.
        (-[SnippetController windowWillClose:]): Release everything here. If we don't we get
	a world leak. Also remove the WebView from the superview. If we don't, it leaks.
	At some point we should look into this because it may indicate a WebKit problem, so
	I marked it with a FIXME.
        (-[SnippetController load]): Retain the data source.
        (-[SnippetController loadComplete]): Release the old text storage.

        * Debug/SnippetController.h: Tweaks.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f774070a
2002-11-12 Darin Adler <darin@apple.com>
- fixed 3083043 -- Alex doesn't decode % sequences in javascript: URLs
Some places here did KURL::decode_string, but others didn't.
* khtml/khtml_part.cpp:
(KHTMLPart::slotShowDocument): Added call to KURL::decode_string.
(KHTMLPart::overURL): Ditto.
(KHTMLPart::urlSelected): Ditto.
(KHTMLPart::requestFrame): Ditto.
(KHTMLPart::slotChildURLRequest): Ditto.
2002-11-11 Darin Adler <darin@apple.com>
 
* kwq/KWQWidget.mm: (QWidget::setCursor): Remove printf I left
......
2002-11-12 Darin Adler <darin@apple.com>
- fixed 3083043 -- Alex doesn't decode % sequences in javascript: URLs
Some places here did KURL::decode_string, but others didn't.
* khtml/khtml_part.cpp:
(KHTMLPart::slotShowDocument): Added call to KURL::decode_string.
(KHTMLPart::overURL): Ditto.
(KHTMLPart::urlSelected): Ditto.
(KHTMLPart::requestFrame): Ditto.
(KHTMLPart::slotChildURLRequest): Ditto.
2002-11-11 Darin Adler <darin@apple.com>
 
* kwq/KWQWidget.mm: (QWidget::setCursor): Remove printf I left
......
2002-11-12 Darin Adler <darin@apple.com>
- fixed 3083043 -- Alex doesn't decode % sequences in javascript: URLs
Some places here did KURL::decode_string, but others didn't.
* khtml/khtml_part.cpp:
(KHTMLPart::slotShowDocument): Added call to KURL::decode_string.
(KHTMLPart::overURL): Ditto.
(KHTMLPart::urlSelected): Ditto.
(KHTMLPart::requestFrame): Ditto.
(KHTMLPart::slotChildURLRequest): Ditto.
2002-11-11 Darin Adler <darin@apple.com>
 
* kwq/KWQWidget.mm: (QWidget::setCursor): Remove printf I left
......
......@@ -808,7 +808,7 @@ void KHTMLPart::slotShowDocument( const QString &url, const QString &target )
// TODO: handle child target correctly! currently the script are always executed fur the parent
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 ) {
executeScript( url.right( url.length() - 11) );
executeScript( KURL::decode_string( url.right( url.length() - 11) ) );
return;
}
......@@ -2167,7 +2167,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
if (url.find( QString::fromLatin1( "javascript:" ),0, false ) != -1 )
{
emit setStatusBarText( url.mid( url.find( "javascript:", 0, false ) ) );
emit setStatusBarText( KURL::decode_string( url.mid( url.find( "javascript:", 0, false ) ) ) );
return;
}
......@@ -2327,7 +2327,7 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
executeScript( url.right( url.length() - 11) );
executeScript( KURL::decode_string( url.right( url.length() - 11) ) );
return;
}
......@@ -2651,7 +2651,7 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
// Support for <frame src="javascript:string">
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
QVariant res = executeScript( DOM::Node(frame->element()), url.right( url.length() - 11) );
QVariant res = executeScript( DOM::Node(frame->element()), KURL::decode_string( url.right( url.length() - 11) ) );
KURL myurl;
myurl.setProtocol("javascript");
if ( res.type() == QVariant::String )
......@@ -3294,7 +3294,7 @@ void KHTMLPart::slotChildURLRequest( const KURL &url, const KParts::URLArgs &arg
// TODO: handle child target correctly! currently the script are always executed fur the parent
QString urlStr = url.url();
if ( urlStr.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 ) {
executeScript( urlStr.right( urlStr.length() - 11) );
executeScript( KURL::decode_string( urlStr.right( urlStr.length() - 11) ) );
return;
}
......
2002-11-12 Darin Adler <darin@apple.com>
- improved the code that manages observing the window and superview
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView addSuperviewObservers]): Added.
(-[WebHTMLView removeSuperviewObservers]): Added.
(-[WebHTMLView addWindowObservers]): Added.
(-[WebHTMLView removeWindowObservers]): Added.
(-[WebHTMLView viewWillMoveToSuperview:]): Call removeSuperviewObservers.
(-[WebHTMLView viewDidMoveToSuperview]): Call addSuperviewObservers.
(-[WebHTMLView viewWillMoveToWindow:]): Call removeWindowObservers and
removeSuperviewObservers.
(-[WebHTMLView viewDidMoveToWindow]): Call addWindowObservers and
addSuperviewObservers.
2002-11-11 Maciej Stachowiak <mjs@apple.com>
 
Remove contentPolicy parameter from _downloadURL, and remove
......
2002-11-12 Darin Adler <darin@apple.com>
- improved the code that manages observing the window and superview
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView addSuperviewObservers]): Added.
(-[WebHTMLView removeSuperviewObservers]): Added.
(-[WebHTMLView addWindowObservers]): Added.
(-[WebHTMLView removeWindowObservers]): Added.
(-[WebHTMLView viewWillMoveToSuperview:]): Call removeSuperviewObservers.
(-[WebHTMLView viewDidMoveToSuperview]): Call addSuperviewObservers.
(-[WebHTMLView viewWillMoveToWindow:]): Call removeWindowObservers and
removeSuperviewObservers.
(-[WebHTMLView viewDidMoveToWindow]): Call addWindowObservers and
addSuperviewObservers.
2002-11-11 Maciej Stachowiak <mjs@apple.com>
 
Remove contentPolicy parameter from _downloadURL, and remove
......
......@@ -164,7 +164,7 @@ - (void)removeMouseMovedObserver
name:NSMouseMovedNotification object:nil];
}
- (void)viewWillMoveToSuperview:(NSView *)newSuperview
- (void)addSuperviewObservers
{
// We watch the bounds of our superview, so that we can do a layout when the size
// of the superview changes. This is different from other scrollable things that don't
......@@ -173,43 +173,72 @@ - (void)viewWillMoveToSuperview:(NSView *)newSuperview
// We need to pay attention to both height and width because, our "layout" has to change
// to extend the background the full height of the space.
NSView *oldSuperview = [self superview];
if (oldSuperview) {
NSView *superview = [self superview];
if (superview && [self window]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_frameOrBoundsChanged)
name:NSViewFrameDidChangeNotification object:superview];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_frameOrBoundsChanged)
name:NSViewBoundsDidChangeNotification object:superview];
}
}
- (void)removeSuperviewObservers
{
NSView *superview = [self superview];
if (superview && [self window]) {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewFrameDidChangeNotification object:oldSuperview];
name:NSViewFrameDidChangeNotification object:superview];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewBoundsDidChangeNotification object:oldSuperview];
name:NSViewBoundsDidChangeNotification object:superview];
}
}
if (newSuperview) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_frameOrBoundsChanged)
name:NSViewFrameDidChangeNotification object:newSuperview];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_frameOrBoundsChanged)
name:NSViewBoundsDidChangeNotification object:newSuperview];
- (void)addWindowObservers
{
NSWindow *window = [self window];
if (window) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:)
name:NSWindowDidBecomeMainNotification object:window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignMain:)
name:NSWindowDidResignMainNotification object:window];
}
}
- (void)viewWillMoveToWindow:(NSWindow *)window
- (void)removeWindowObservers
{
if ([self window]) {
NSWindow *window = [self window];
if (window) {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowDidBecomeMainNotification object:[self window]];
name:NSWindowDidBecomeMainNotification object:window];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowDidResignMainNotification object:[self window]];
name:NSWindowDidResignMainNotification object:window];
}
}
- (void)viewWillMoveToSuperview:(NSView *)newSuperview
{
[self removeSuperviewObservers];
}
- (void)viewDidMoveToSuperview
{
[self addSuperviewObservers];
}
- (void)viewWillMoveToWindow:(NSWindow *)window
{
[self removeMouseMovedObserver];
[self removeWindowObservers];
[self removeSuperviewObservers];
}
- (void)viewDidMoveToWindow
{
if ([self window]) {
[self addWindowObservers];
[self addSuperviewObservers];
if ([[self window] isMainWindow] && ![self _insideAnotherHTMLView]) {
[self addMouseMovedObserver];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:)
name:NSWindowDidBecomeMainNotification object:[self window]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignMain:)
name:NSWindowDidResignMainNotification object:[self window]];
}
_private->inWindow = YES;
} else {
......@@ -218,7 +247,6 @@ - (void)viewDidMoveToWindow
// This is only needed because viewDidMoveToWindow is called even when
// the window is not changing (bug in AppKit).
if (_private->inWindow) {
[self removeMouseMovedObserver];
[self _reset];
_private->inWindow = NO;
}
......
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