<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[24818] trunk</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/24818">24818</a></dd>
<dt>Author</dt> <dd>aliceli1</dd>
<dt>Date</dt> <dd>2007-08-02 00:13:31 -0700 (Thu, 02 Aug 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebCore:
Reviewed by Kevin McCullough.
fixed <rdar://problem/5310312> REGRESSION: javascript is mis-escaped at http://labs.zarate.org/passwd causing bookmarklet to break
* WebCore.exp:
expose some calls for WebKit to call.
* manual-tests/JavaScript-bookmarklets.html: Added.
WebKit:
Reviewed by Kevin McCullough.
* Misc/WebNSURLExtras.mm:
(+[NSURL _web_URLWithUserTypedString:relativeToURL:]):
(-[NSURL _web_userVisibleString]):
(-[NSURL _web_URLWithLowercasedScheme]):
(-[NSURL _web_dataForURLComponentType:]):
These 4 changes are just casting changes.
(-[NSString _webkit_stringByReplacingValidPercentEscapes]):
This change replaces the call to an NSURL method with a webcore one that doesn't abort the escaping effort once an illegal character is encountered. </pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCoreWebCoreexp">trunk/WebCore/WebCore.exp</a></li>
<li><a href="#trunkWebKitChangeLog">trunk/WebKit/ChangeLog</a></li>
<li><a href="#trunkWebKitMiscWebNSURLExtrasmm">trunk/WebKit/Misc/WebNSURLExtras.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkWebCoremanualtestsJavaScriptbookmarkletshtml">trunk/WebCore/manual-tests/JavaScript-bookmarklets.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (24817 => 24818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-08-02 07:01:42 UTC (rev 24817)
+++ trunk/WebCore/ChangeLog        2007-08-02 07:13:31 UTC (rev 24818)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2007-08-02 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ fixed <rdar://problem/5310312> REGRESSION: javascript is mis-escaped at http://labs.zarate.org/passwd causing bookmarklet to break
+
+ * WebCore.exp:
+ expose some calls for WebKit to call.
+ * manual-tests/JavaScript-bookmarklets.html: Added.
+
</ins><span class="cx"> 2007-08-01 Adam Treat <treat@kde.org>
</span><span class="cx">
</span><span class="cx"> Reviewed by George Staikos.
</span></span></pre></div>
<a id="trunkWebCoreWebCoreexp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/WebCore.exp (24817 => 24818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/WebCore.exp        2007-08-02 07:01:42 UTC (rev 24817)
+++ trunk/WebCore/WebCore.exp        2007-08-02 07:13:31 UTC (rev 24818)
</span><span class="lines">@@ -288,6 +288,7 @@
</span><span class="cx"> __ZN7WebCore15StringTruncator13rightTruncateERKNS_6StringEfRKNS_4FontEb
</span><span class="cx"> __ZN7WebCore15StringTruncator14centerTruncateERKNS_6StringEfRKNS_4FontEb
</span><span class="cx"> __ZN7WebCore15StringTruncator5widthERKNS_6StringERKNS_4FontEb
</span><ins>+__ZN7WebCore16DeprecatedString12fromNSStringEP8NSString
</ins><span class="cx"> __ZN7WebCore16DeprecatedString6appendENS_14DeprecatedCharE
</span><span class="cx"> __ZN7WebCore16DeprecatedString6appendERKS0_
</span><span class="cx"> __ZN7WebCore16DeprecatedString6appendEc
</span><span class="lines">@@ -337,6 +338,7 @@
</span><span class="cx"> __ZN7WebCore4FontC1Ev
</span><span class="cx"> __ZN7WebCore4FontD1Ev
</span><span class="cx"> __ZN7WebCore4FontaSERKS0_
</span><ins>+__ZN7WebCore4KURL13decode_stringERKNS_16DeprecatedStringE
</ins><span class="cx"> __ZN7WebCore4KURLC1EP5NSURL
</span><span class="cx"> __ZN7WebCore4KURLC1ERKNS_16DeprecatedStringE
</span><span class="cx"> __ZN7WebCore4KURLC1Ev
</span></span></pre></div>
<a id="trunkWebCoremanualtestsJavaScriptbookmarkletshtml"></a>
<div class="addfile"><h4>Added: trunk/WebCore/manual-tests/JavaScript-bookmarklets.html (0 => 24818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/manual-tests/JavaScript-bookmarklets.html         (rev 0)
+++ trunk/WebCore/manual-tests/JavaScript-bookmarklets.html        2007-08-02 07:13:31 UTC (rev 24818)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+<script>
+var arr = new Array("var%20x=' ';", // Space %20
+ "var%20x='#';", // # %23
+ "var%20x='$';", // $ %24
+ "var%20x='%';", // % %25
+ "var%20x='&';", // & %26
+ "var%20x='/';", // / %2F
+ "var%20x=':';", // : %3A
+ "var%20x=';';", // ; %3B
+ "var%20x='<';", // < %3C
+ "var%20x='=';", // = %3D
+ "var%20x='>';", // > %3E
+ "var%20x='?';", // ? %3F
+ "var%20x='@';", // @ %40
+ "var%20x='[';", // [ %5B
+ "var%20x='\\';", // \ %5C
+ "var%20x=']';", // ] %5D
+ "var%20x='^';", // ^ %5E
+ "var%20x='`';", // ' %60
+ "var%20x='{';", // { %7B
+ "var%20x='|';", // | %7C
+ "var%20x='}';", // } %7D
+ "var%20x='~';"); // ~ %7E
+
+
+function makeLinks()
+{
+ var str = "javascript:";
+ var anchor, anchorText;
+ for (key in arr)
+ {
+ anchor = document.createElement("a");
+ anchor.setAttribute("href", str+arr[key]);
+ anchorText = document.createTextNode(arr[key]);
+ anchor.appendChild(anchorText);
+ document.body.appendChild(anchor);
+ document.body.appendChild(document.createElement("br"));
+ }
+}
+
+</script>
+<body onload="makeLinks();">
+This test is for <a href="rdar://problem/5310312">rdar://problem/5310312</a> and can be run manually only.<br>
+<a href="rdar://problem/5379908">rdar://problem/5379908</a> tracks the effort to enhance DRT to make this into a layout test.<br>
+<br>
+<b>Directions:</b>
+<ol>
+<li> drag each link below to the bookmarks bar to create bookmarks
+<li> open the JavaScript console (in the debug menu)
+<li> click on all the bookmarks you've just created
+</ol>
+<b>Expected results:</b>
+no parse errors in the JavaScript console<br>
+<br>
+</body>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/ChangeLog (24817 => 24818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/ChangeLog        2007-08-02 07:01:42 UTC (rev 24817)
+++ trunk/WebKit/ChangeLog        2007-08-02 07:13:31 UTC (rev 24818)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2007-08-02 Alice Liu <alice.liu@apple.com>
+
+ Reviewed by Kevin McCullough.
+
+ * Misc/WebNSURLExtras.mm:
+ (+[NSURL _web_URLWithUserTypedString:relativeToURL:]):
+ (-[NSURL _web_userVisibleString]):
+ (-[NSURL _web_URLWithLowercasedScheme]):
+ (-[NSURL _web_dataForURLComponentType:]):
+ These 4 changes are just casting changes.
+
+ (-[NSString _webkit_stringByReplacingValidPercentEscapes]):
+ This change replaces the call to an NSURL method with a webcore one that doesn't abort the escaping effort once an illegal character is encountered.
+
</ins><span class="cx"> 2007-08-01 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix build.
</span></span></pre></div>
<a id="trunkWebKitMiscWebNSURLExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/Misc/WebNSURLExtras.mm (24817 => 24818)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/Misc/WebNSURLExtras.mm        2007-08-02 07:01:42 UTC (rev 24817)
+++ trunk/WebKit/Misc/WebNSURLExtras.mm        2007-08-02 07:13:31 UTC (rev 24818)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import <WebKit/WebNSDataExtras.h>
</span><span class="cx"> #import <WebKit/WebNSObjectExtras.h>
</span><span class="cx"> #import <WebKit/WebLocalizableStrings.h>
</span><ins>+#import <WebCore/KURL.h>
</ins><span class="cx"> #import <WebCore/LoaderNSURLExtras.h>
</span><span class="cx">
</span><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="lines">@@ -45,6 +46,8 @@
</span><span class="cx"> #import <unicode/uidna.h>
</span><span class="cx"> #import <unicode/uscript.h>
</span><span class="cx">
</span><ins>+using namespace WebCore;
+
</ins><span class="cx"> typedef void (* StringRangeApplierFunction)(NSString *string, NSRange range, void *context);
</span><span class="cx">
</span><span class="cx"> // Needs to be big enough to hold an IDN-encoded name.
</span><span class="lines">@@ -357,13 +360,13 @@
</span><span class="cx"> NSData *userTypedData = [string dataUsingEncoding:NSUTF8StringEncoding];
</span><span class="cx"> ASSERT(userTypedData);
</span><span class="cx">
</span><del>- const UInt8 *inBytes = (const UInt8 *)[userTypedData bytes];
</del><ins>+ const UInt8 *inBytes = static_cast<const UInt8 *>([userTypedData bytes]);
</ins><span class="cx"> int inLength = [userTypedData length];
</span><span class="cx"> if (inLength == 0) {
</span><span class="cx"> return [NSURL URLWithString:@""];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- char *outBytes = (char *)malloc(inLength * 3); // large enough to %-escape every character
</del><ins>+ char *outBytes = static_cast<char *>(malloc(inLength * 3)); // large enough to %-escape every character
</ins><span class="cx"> char *p = outBytes;
</span><span class="cx"> int outLength = 0;
</span><span class="cx"> int i;
</span><span class="lines">@@ -431,14 +434,14 @@
</span><span class="cx"> - (NSString *)_web_userVisibleString
</span><span class="cx"> {
</span><span class="cx"> NSData *data = [self _web_originalData];
</span><del>- const unsigned char *before = (const unsigned char*)[data bytes];
</del><ins>+ const unsigned char *before = static_cast<const unsigned char*>([data bytes]);
</ins><span class="cx"> int length = [data length];
</span><span class="cx">
</span><span class="cx"> bool needsHostNameDecoding = false;
</span><span class="cx">
</span><span class="cx"> const unsigned char *p = before;
</span><span class="cx"> int bufferLength = (length * 3) + 1;
</span><del>- char *after = (char *)malloc(bufferLength); // large enough to %-escape every character
</del><ins>+ char *after = static_cast<char *>(malloc(bufferLength)); // large enough to %-escape every character
</ins><span class="cx"> char *q = after;
</span><span class="cx"> int i;
</span><span class="cx"> for (i = 0; i < length; i++) {
</span><span class="lines">@@ -593,7 +596,7 @@
</span><span class="cx"> CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, URL_BYTES_BUFFER_LENGTH);
</span><span class="cx"> if (bytesFilled == -1) {
</span><span class="cx"> CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
</span><del>- buffer = (UInt8 *)malloc(bytesToAllocate);
</del><ins>+ buffer = static_cast<UInt8 *>(malloc(bytesToAllocate));
</ins><span class="cx"> bytesFilled = CFURLGetBytes((CFURLRef)self, buffer, bytesToAllocate);
</span><span class="cx"> ASSERT(bytesFilled == bytesToAllocate);
</span><span class="cx"> }
</span><span class="lines">@@ -659,7 +662,7 @@
</span><span class="cx"> CFIndex bytesFilled = CFURLGetBytes((CFURLRef)self, allBytesBuffer, URLComponentTypeBufferLength);
</span><span class="cx"> if (bytesFilled == -1) {
</span><span class="cx"> CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)self, NULL, 0);
</span><del>- allBytesBuffer = (UInt8 *)malloc(bytesToAllocate);
</del><ins>+ allBytesBuffer = static_cast<UInt8 *>(malloc(bytesToAllocate));
</ins><span class="cx"> bytesFilled = CFURLGetBytes((CFURLRef)self, allBytesBuffer, bytesToAllocate);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -677,7 +680,7 @@
</span><span class="cx">
</span><span class="cx"> NSData *componentData = [NSData dataWithBytes:allBytesBuffer + range.location length:range.length];
</span><span class="cx">
</span><del>- const unsigned char *bytes = (const unsigned char *)[componentData bytes];
</del><ins>+ const unsigned char *bytes = static_cast<const unsigned char *>([componentData bytes]);
</ins><span class="cx"> NSMutableData *resultData = [NSMutableData data];
</span><span class="cx"> // NOTE: add leading '?' to query strings non-zero length query strings.
</span><span class="cx"> // NOTE: retain question-mark only query strings.
</span><span class="lines">@@ -801,8 +804,8 @@
</span><span class="cx">
</span><span class="cx"> - (NSString *)_webkit_stringByReplacingValidPercentEscapes
</span><span class="cx"> {
</span><del>- NSString *s = [self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- return s ? s : self;
</del><ins>+ DeprecatedString s = KURL::decode_string(DeprecatedString::fromNSString(self));
+ return s.getNSString();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (NSString *)_webkit_scriptIfJavaScriptURL
</span></span></pre>
</div>
</div>
</body>
</html>