[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 08:09:06 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit ba3757fabcd213ab192878cf36461d710fdec75a
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 4 00:50:15 2003 +0000
Reviewed by Darin.
- fixed 3370085 - new frames with javascript: URLs should be populated with the result of the JavaScript code
* ChangeLog:
* khtml/html/html_baseimpl.cpp:
(HTMLFrameElementImpl::updateForNewURL): Skip special filtering of
javascript:.
(HTMLFrameElementImpl::attach): Ditto.
* khtml/khtml_part.cpp:
(KHTMLPart::replaceContentsWithScriptResult): New method to execute
script and if the result is a string, set it as the new document contents.
(KHTMLPart::requestFrame): Removed APPLE_CHANGES around
javascript: handling. Use new
replaceContentsWithScriptResult method. This executes the
JS in the new child frame, not the parent frame, as in other
browsers.
* khtml/khtml_part.h: Prototype new method.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::openURLRequest): Use new part method.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b7b6f2f..0f137e1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,26 @@
+2003-11-03 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Darin.
+
+ - fixed 3370085 - new frames with javascript: URLs should be populated with the result of the JavaScript code
+
+ * ChangeLog:
+ * khtml/html/html_baseimpl.cpp:
+ (HTMLFrameElementImpl::updateForNewURL): Skip special filtering of
+ javascript:.
+ (HTMLFrameElementImpl::attach): Ditto.
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::replaceContentsWithScriptResult): New method to execute
+ script and if the result is a string, set it as the new document contents.
+ (KHTMLPart::requestFrame): Removed APPLE_CHANGES around
+ javascript: handling. Use new
+ replaceContentsWithScriptResult method. This executes the
+ JS in the new child frame, not the parent frame, as in other
+ browsers.
+ * khtml/khtml_part.h: Prototype new method.
+ * kwq/KWQKHTMLPartBrowserExtension.mm:
+ (KHTMLPartBrowserExtension::openURLRequest): Use new part method.
+
2003-11-03 Vicki Murley <vicki at apple.com>
Reviewed by kocienda.
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index aab9d87..c4f1dca 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -279,13 +279,6 @@ void HTMLFrameElementImpl::updateForNewURL()
KHTMLPart *framePart = part->findFrame(name.string());
KURL kurl = getDocument()->completeURL(relativeURL.string());
- // Temporarily treat javascript: URLs as about:blank, until we can
- // properly support them as frame sources.
- if (kurl.protocol() == "javascript") {
- relativeURL = "about:blank";
- kurl = "about:blank";
- }
-
if (framePart) {
framePart->openURL(kurl);
} else {
@@ -400,12 +393,6 @@ void HTMLFrameElementImpl::attach()
relativeURL = "about:blank";
}
- // Temporarily treat javascript: URLs as about:blank, until we can
- // properly support them as frame sources.
- if (KURL(getDocument()->completeURL(relativeURL.string())).protocol() == "javascript") {
- relativeURL = "about:blank";
- }
-
// we need a unique name for every frame in the frameset. Hope that's unique enough.
if(name.isEmpty() || w->part()->frameExists( name.string() ) )
name = DOMString(w->part()->requestFrameName());
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index b15931c..e7336f2 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -689,6 +689,18 @@ KJSProxy *KHTMLPart::jScript()
return d->m_jscript;
}
+void KHTMLPart::replaceContentsWithScriptResult( const KURL &url )
+{
+ QString script = KURL::decode_string(url.url().mid(strlen("javascript:")));
+ QVariant ret = executeScript(script);
+
+ if (ret.type() == QVariant::String) {
+ begin();
+ write(ret.asString());
+ end();
+ }
+}
+
QVariant KHTMLPart::executeScript( const QString &script, bool forceUserGesture )
{
return executeScript( DOM::Node(), script, forceUserGesture );
@@ -2968,18 +2980,18 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
(*it).m_frame = frame;
(*it).m_params = params;
-#if !APPLE_CHANGES
// Support for <frame src="javascript:string">
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
- 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 )
- myurl.setPath(res.asString());
- return processObjectRequest(&(*it), myurl, QString("text/html") );
+ if (!processObjectRequest(&(*it), "about:blank", "text/html" ))
+ return false;
+
+ KHTMLPart *newPart = static_cast<KHTMLPart *>(&*(*it).m_part);
+ newPart->replaceContentsWithScriptResult( url );
+
+ return true;
}
-#endif // APPLE_CHANGES
+
return requestObject( &(*it), completeURL( url ));
}
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index 461271a..4dd2526 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -1103,6 +1103,8 @@ private:
void receivedFirstData();
+ void replaceContentsWithScriptResult( const KURL &url );
+
KHTMLPartPrivate *d;
friend class KHTMLPartPrivate;
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index 2a1452b..c7702af 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -38,20 +38,8 @@ void KHTMLPartBrowserExtension::openURLRequest(const KURL &url,
const KParts::URLArgs &args)
{
if (url.protocol().lower() == "javascript") {
- QString string = url.url();
_part->createEmptyDocument();
- QString script = KURL::decode_string(string.mid(strlen("javascript:")));
- QVariant ret = _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) {
- _part->begin();
- _part->write(ret.asString());
- _part->end();
- }
-
+ _part->replaceContentsWithScriptResult(url);
} else {
_part->openURLRequest(url, args);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list