Commit 331267b0 authored by arv@chromium.org's avatar arv@chromium.org

WindowFeatures arguments shoud ignore invalid characters in values

Original patch from http://trac.webkit.org/changeset/169849

We were getting the length of the string before calling lower() on
it but we were looping over the new string which might have a
different length than the original.

BUG=383704

Review URL: https://codereview.chromium.org/333643008

git-svn-id: svn://svn.chromium.org/blink/trunk@176235 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 57233eea
<!DOCTYPE html>
<html><head></head><body onload="setTimeout('window.opener.finishTest()', 0)"></body></html>
\ No newline at end of file
Tests that Unicode characters that changes the string length when lower cased still works.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS w.innerWidth is 123
PASS w.innerHeight is 123
PASS w !== window is true
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
}
description("Tests that Unicode characters that changes the string length when lower cased still works.");
// U+0130 = LATIN CAPITAL LETTER I WITH DOT ABOVE
// U+0069 LATIN SMALL LETTER I
// U+0307 COMBINING DOT ABOVE
// \u0130 gets lowered to \u0069\u0307.
var w = window.open("resources/window-property-invalid-characters-ignored.html", "blank", "\u0130\u0130=\u0130\u0130,width=123,height=123");
function finishTest()
{
shouldBe("w.innerWidth", "123");
shouldBe("w.innerHeight", "123");
shouldBeTrue("w !== window");
w.close();
finishJSTest();
}
</script>
</head>
<body>
<pre id="console"></pre>
</body>
</html>
\ No newline at end of file
......@@ -74,13 +74,12 @@ WindowFeatures::WindowFeatures(const String& features)
scrollbarsVisible = false;
// Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
int keyBegin, keyEnd;
int valueBegin, valueEnd;
unsigned keyBegin, keyEnd;
unsigned valueBegin, valueEnd;
int i = 0;
int length = features.length();
String buffer = features.lower();
while (i < length) {
unsigned length = buffer.length();
for (unsigned i = 0; i < length; ) {
// skip to first non-separator, but don't skip past the end of the string
while (i < length && isWindowFeaturesSeparator(buffer[i]))
i++;
......
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