| Differences between
and this patch
- a/Source/WebCore/ChangeLog +18 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-05-07  Jon Lee  <jonlee@apple.com>
2
3
        Safari warns that it needs to resend the form in an iFrame when going back
4
        https://bugs.webkit.org/show_bug.cgi?id=82658
5
        <rdar://problem/11292558>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Test: http/tests/loading/post-in-iframe-with-back-navigation.html
10
11
        * WebCore.exp.in: Add _wkCFURLRequestAllowAllPostCaching.
12
        * platform/mac/WebCoreSystemInterface.h: Add wkCFURLRequestAllowAllPostCaching.
13
        * platform/mac/WebCoreSystemInterface.mm: Add wkCFURLRequestAllowAllPostCaching.
14
        * platform/network/cf/ResourceRequestCFNet.cpp:
15
        (WebCore::ResourceRequest::doUpdatePlatformRequest): Set the bit to cache all POST responses.
16
        * platform/network/mac/ResourceRequestMac.mm:
17
        (WebCore::ResourceRequest::doUpdatePlatformRequest): Set the bit to cache all POST responses.
18
1
2012-05-06  Kentaro Hara  <haraken@chromium.org>
19
2012-05-06  Kentaro Hara  <haraken@chromium.org>
2
20
3
        [V8][Performance] Remove Isolate lookup from the call path
21
        [V8][Performance] Remove Isolate lookup from the call path
- a/Source/WebKit/mac/ChangeLog +11 lines
Lines 1-3 a/Source/WebKit/mac/ChangeLog_sec1
1
2012-05-07  Jon Lee  <jonlee@apple.com>
2
3
        Safari warns that it needs to resend the form in an iFrame when going back
4
        https://bugs.webkit.org/show_bug.cgi?id=82658
5
        <rdar://problem/11292558>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * WebCoreSupport/WebSystemInterface.mm:
10
        (InitWebCoreSystemInterface): Add wkCFURLRequestAllowAllPostCaching.
11
1
2012-05-05  Dean Jackson  <dino@apple.com>
12
2012-05-05  Dean Jackson  <dino@apple.com>
2
13
3
        Add new Setting/Preference to disable requestAnimationFrame
14
        Add new Setting/Preference to disable requestAnimationFrame
- a/Source/WebKit2/ChangeLog +11 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2012-05-07  Jon Lee  <jonlee@apple.com>
2
3
        Safari warns that it needs to resend the form in an iFrame when going back
4
        https://bugs.webkit.org/show_bug.cgi?id=82658
5
        <rdar://problem/11292558>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
10
        (InitWebCoreSystemInterface): Add wkCFURLRequestAllowAllPostCaching.
11
1
2012-05-06  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
12
2012-05-06  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
13
3
        Convert isPageBoxVisible to use Internals interface.
14
        Convert isPageBoxVisible to use Internals interface.
- a/Source/WebCore/WebCore.exp.in +3 lines
Lines 1553-1558 _wkAdvanceDefaultButtonPulseAnimation a/Source/WebCore/WebCore.exp.in_sec1
1553
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
1553
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
1554
_wkCALayerEnumerateRectsBeingDrawnWithBlock
1554
_wkCALayerEnumerateRectsBeingDrawnWithBlock
1555
#endif
1555
#endif
1556
#if !defined(BUILDING_ON_SNOW_LEOPARD)
1557
_wkCFURLRequestAllowAllPostCaching
1558
#endif
1556
_wkCGContextGetShouldSmoothFonts
1559
_wkCGContextGetShouldSmoothFonts
1557
_wkCGContextResetClip
1560
_wkCGContextResetClip
1558
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
1561
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h +4 lines
Lines 323-326 extern const char* (*wkFilterDataComplete)(WebFilterEvaluator *, int* length); a/Source/WebCore/platform/mac/WebCoreSystemInterface.h_sec1
323
323
324
}
324
}
325
325
326
#if !defined(BUILDING_ON_SNOW_LEOPARD)
327
extern void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
328
#endif
329
326
#endif
330
#endif
- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +4 lines
Lines 191-196 bool (*wkExecutableWasLinkedOnOrBeforeLion)(void); a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm_sec1
191
void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
191
void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
192
#endif
192
#endif
193
193
194
#if !defined(BUILDING_ON_SNOW_LEOPARD)
195
void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef);
196
#endif
197
194
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
198
#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
195
BOOL (*wkFilterIsManagedSession)(void);
199
BOOL (*wkFilterIsManagedSession)(void);
196
WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *);
200
WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *);
- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp +3 lines
Lines 151-156 void ResourceRequest::doUpdatePlatformRequest() a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp_sec1
151
151
152
    if (httpPipeliningEnabled())
152
    if (httpPipeliningEnabled())
153
        wkSetHTTPPipeliningPriority(cfRequest, toHTTPPipeliningPriority(m_priority));
153
        wkSetHTTPPipeliningPriority(cfRequest, toHTTPPipeliningPriority(m_priority));
154
#if USE(CFNETWORK) || (PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD))
155
    wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]);
156
#endif
154
157
155
    setHeaderFields(cfRequest, httpHeaderFields());
158
    setHeaderFields(cfRequest, httpHeaderFields());
156
    RefPtr<FormData> formData = httpBody();
159
    RefPtr<FormData> formData = httpBody();
- a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm +3 lines
Lines 135-140 void ResourceRequest::doUpdatePlatformRequest() a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm_sec1
135
#endif
135
#endif
136
136
137
    [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
137
    [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
138
#if !defined(BUILDING_ON_SNOW_LEOPARD)
139
    wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]);
140
#endif
138
141
139
    double timeoutInterval = ResourceRequestBase::timeoutInterval();
142
    double timeoutInterval = ResourceRequestBase::timeoutInterval();
140
    if (timeoutInterval)
143
    if (timeoutInterval)
- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +4 lines
Lines 184-189 void InitWebCoreSystemInterface(void) a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm_sec1
184
    INIT(CGPathAddRoundedRect);
184
    INIT(CGPathAddRoundedRect);
185
#endif
185
#endif
186
186
187
#if !defined(BUILDING_ON_SNOW_LEOPARD)
188
    INIT(CFURLRequestAllowAllPostCaching);
189
#endif
190
187
#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
191
#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
188
    INIT(FilterIsManagedSession);
192
    INIT(FilterIsManagedSession);
189
    INIT(FilterCreateInstance);
193
    INIT(FilterCreateInstance);
- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +3 lines
Lines 171-176 void InitWebCoreSystemInterface(void) a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm_sec1
171
        INIT(CGPathAddRoundedRect);
171
        INIT(CGPathAddRoundedRect);
172
#endif
172
#endif
173
173
174
#if !defined(BUILDING_ON_SNOW_LEOPARD)
175
        INIT(CFURLRequestAllowAllPostCaching);
176
#endif
174
#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
177
#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS)
175
        INIT(FilterIsManagedSession);
178
        INIT(FilterIsManagedSession);
176
        INIT(FilterCreateInstance);
179
        INIT(FilterCreateInstance);
- a/LayoutTests/ChangeLog +21 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-05-07  Jon Lee  <jonlee@apple.com>
2
3
        Safari warns that it needs to resend the form in an iFrame when going back
4
        https://bugs.webkit.org/show_bug.cgi?id=82658
5
        <rdar://problem/11292558>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        Add new test which navigates a series of pages in an iframe. Each navigation is a POST.
10
        At the third page we click on a back link, and expect to see stale POST data.
11
12
        * http/tests/loading/post-in-iframe-with-back-navigation-expected.txt: Added.
13
        * http/tests/loading/post-in-iframe-with-back-navigation.html: Added.
14
        * http/tests/loading/resources/post-in-iframe-with-back-navigation-page-1.php: Added.
15
        * http/tests/loading/resources/post-in-iframe-with-back-navigation-page-2.php: Added.
16
        * http/tests/loading/resources/post-in-iframe-with-back-navigation-page-3.php: Added.
17
        * http/tests/resources/js-test-post.js: Added. Copied from fast/js/resources since it is
18
        inaccessible to the test server.
19
        * http/tests/resources/js-test-pre.js: Added. Copied from fast/js/resources since it is
20
        inaccessible to the test server.
21
1
2012-05-06  Andrey Kosyakov  <caseq@chromium.org>
22
2012-05-06  Andrey Kosyakov  <caseq@chromium.org>
2
23
3
        Unreviewed expectations update for overflow-positioning.html.
24
        Unreviewed expectations update for overflow-positioning.html.
- a/LayoutTests/http/tests/loading/post-in-iframe-with-back-navigation-expected.txt +44 lines
Line 0 a/LayoutTests/http/tests/loading/post-in-iframe-with-back-navigation-expected.txt_sec1
1
main frame - didStartProvisionalLoadForFrame
2
main frame - didCommitLoadForFrame
3
main frame - didReceiveTitle: Resending form on back navigation from POST submissions
4
frame "frame" - didStartProvisionalLoadForFrame
5
frame "frame" - didCommitLoadForFrame
6
frame "frame" - didFinishDocumentLoadForFrame
7
frame "frame" - didHandleOnloadEventsForFrame
8
frame "frame" - didFinishLoadForFrame
9
main frame - didFinishDocumentLoadForFrame
10
main frame - didHandleOnloadEventsForFrame
11
main frame - didFinishLoadForFrame
12
frame "frame" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/post-in-iframe-with-back-navigation-page-2.php 
13
frame "frame" - didStartProvisionalLoadForFrame
14
frame "frame" - didCancelClientRedirectForFrame
15
frame "frame" - didCommitLoadForFrame
16
frame "frame" - didFinishDocumentLoadForFrame
17
frame "frame" - didHandleOnloadEventsForFrame
18
frame "frame" - didFinishLoadForFrame
19
frame "frame" - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resources/post-in-iframe-with-back-navigation-page-3.php 
20
frame "frame" - didStartProvisionalLoadForFrame
21
frame "frame" - didCancelClientRedirectForFrame
22
frame "frame" - didCommitLoadForFrame
23
frame "frame" - didFinishDocumentLoadForFrame
24
frame "frame" - didHandleOnloadEventsForFrame
25
frame "frame" - didFinishLoadForFrame
26
frame "frame" - didStartProvisionalLoadForFrame
27
frame "frame" - didCommitLoadForFrame
28
frame "frame" - didFinishDocumentLoadForFrame
29
frame "frame" - didHandleOnloadEventsForFrame
30
frame "frame" - didFinishLoadForFrame
31
32
Resending form on back navigation from POST submissions
33
34
To test manually, click on the navigation links in the iframe. When going back from page 3, it should navigate to page 2 without requesting to resend the form.
35
36
PASS successfullyParsed is true
37
38
TEST COMPLETE
39
PASS getTitle() is "Page 1"
40
PASS getTitle() is "Page 2"
41
PASS getTitle() is "Page 3"
42
PASS getTitle() is "Page 2"
43
PASS window.frames[0].document.getElementById('submissionTime').innerText is step2output
44
- a/LayoutTests/http/tests/loading/post-in-iframe-with-back-navigation.html +80 lines
Line 0 a/LayoutTests/http/tests/loading/post-in-iframe-with-back-navigation.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <title>Resending form on back navigation from POST submissions</title>
5
    <script src="../resources/js-test-pre.js"></script>
6
</head>
7
<body onload="runTest()">
8
<iframe id="frame" onload="nextStep()" src="resources/post-in-iframe-with-back-navigation-page-1.php" width=300 height=300></iframe>
9
<p>Resending form on back navigation from POST submissions<br/><br/>
10
11
To test manually, click on the navigation links in the iframe. When going back from page 3, it should navigate to page 2 without requesting to resend the form.
12
</p>
13
<div id="console"></div>
14
15
<script>
16
var loaded = false;
17
function runTest()
18
{
19
    if (window.layoutTestController) {
20
        layoutTestController.dumpAsText();
21
        layoutTestController.waitUntilDone();
22
    }
23
    
24
    loaded = true;
25
    setTimeout(function() { layoutTestController.notifyDone(); }, 200);
26
}
27
28
function clickLink()
29
{
30
    var frame = document.getElementById("frame");
31
    var link = window.frames[0].document.getElementById("link");
32
    if (window.eventSender) {
33
        eventSender.mouseMoveTo(link.offsetLeft + frame.offsetLeft + 10, link.offsetTop + frame.offsetTop + 3);
34
        eventSender.mouseDown();
35
        eventSender.mouseUp();
36
    }
37
}
38
39
function getTitle()
40
{
41
    return window.frames[0].document.querySelector("h1").innerText;
42
}
43
44
var step = 0;
45
var step2output;
46
function nextStep()
47
{
48
    if (!loaded) {
49
        setTimeout(nextStep, 10);
50
        return;
51
    }
52
53
    switch (step++) {
54
    case 0:
55
        shouldBeEqualToString("getTitle()", "Page 1");
56
        setTimeout(clickLink, 0);
57
        break;
58
    case 1:
59
        shouldBeEqualToString("getTitle()", "Page 2");
60
        step2output = window.frames[0].document.getElementById("submissionTime").innerText;
61
        setTimeout(clickLink, 0);
62
        break;
63
    case 2:
64
        shouldBeEqualToString("getTitle()", "Page 3");
65
        setTimeout(clickLink, 0);
66
        break;
67
    case 3:
68
        shouldBeEqualToString("getTitle()", "Page 2");
69
        shouldBe("window.frames[0].document.getElementById('submissionTime').innerText", "step2output");
70
        if (window.layoutTestController);
71
            layoutTestController.notifyDone();
72
        break;
73
    }
74
}
75
76
successfullyParsed = true;
77
</script>
78
<script src="../resources/js-test-post.js"></script>
79
</body>
80
</html>
- a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-1.php +6 lines
Line 0 a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-1.php_sec1
1
<!DOCTYPE html>
2
<h1>Page 1</h1>
3
<span id="submissionTime"><?php print microtime();?></span><br/>
4
<form action="./post-in-iframe-with-back-navigation-page-2.php" name="form" method="POST">
5
</form>
6
<a id="link" href="javascript:document.form.submit();">to page 2</a>
- a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-2.php +7 lines
Line 0 a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-2.php_sec1
1
<!DOCTYPE html>
2
<h1>Page 2</h1>
3
<span id="submissionTime"><?php print microtime();?></span><br/>
4
<form action="./post-in-iframe-with-back-navigation-page-3.php" name="form" method="POST">
5
</form>
6
<a id="link" href="javascript:document.form.submit();">to page 3</a><br/>
7
<a id="backLink" href="javascript:history.back();">go back</a>
- a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-3.php +4 lines
Line 0 a/LayoutTests/http/tests/loading/resources/post-in-iframe-with-back-navigation-page-3.php_sec1
1
<!DOCTYPE html>
2
<h1>Page 3</h1>
3
<span id="submissionTime"><?php print microtime();?></span><br/>
4
<a id="link" href="javascript:history.back();">go back</a>
- a/LayoutTests/http/tests/resources/js-test-post.js +9 lines
Line 0 a/LayoutTests/http/tests/resources/js-test-post.js_sec1
1
wasPostTestScriptParsed = true;
2
3
if (window.jsTestIsAsync) {
4
    if (window.layoutTestController)
5
        layoutTestController.waitUntilDone();
6
    if (window.wasFinishJSTestCalled)
7
        finishJSTest();
8
} else
9
    finishJSTest();
- a/LayoutTests/http/tests/resources/js-test-pre.js +526 lines
Line 0 a/LayoutTests/http/tests/resources/js-test-pre.js_sec1
1
// svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump text + pixel results
2
if (self.layoutTestController)
3
    layoutTestController.dumpAsText(self.enablePixelTesting);
4
5
var description, debug, successfullyParsed, errorMessage;
6
7
(function() {
8
9
    function getOrCreate(id, tagName)
10
    {
11
        var element = document.getElementById(id);
12
        if (element)
13
            return element;
14
15
        element = document.createElement(tagName);
16
        element.id = id;
17
        var refNode;
18
        var parent = document.body || document.documentElement;
19
        if (id == "description")
20
            refNode = getOrCreate("console", "div");
21
        else
22
            refNode = parent.firstChild;
23
24
        parent.insertBefore(element, refNode);
25
        return element;
26
    }
27
28
    description = function description(msg, quiet)
29
    {
30
        // For MSIE 6 compatibility
31
        var span = document.createElement("span");
32
        if (quiet)
33
            span.innerHTML = '<p>' + msg + '</p><p>On success, you will see no "<span class="fail">FAIL</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
34
        else
35
            span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
36
37
        var description = getOrCreate("description", "p");
38
        if (description.firstChild)
39
            description.replaceChild(span, description.firstChild);
40
        else
41
            description.appendChild(span);
42
    };
43
44
    debug = function debug(msg)
45
    {
46
        var span = document.createElement("span");
47
        getOrCreate("console", "div").appendChild(span); // insert it first so XHTML knows the namespace
48
        span.innerHTML = msg + '<br />';
49
    };
50
51
    var css =
52
        ".pass {" +
53
            "font-weight: bold;" +
54
            "color: green;" +
55
        "}" +
56
        ".fail {" +
57
            "font-weight: bold;" +
58
            "color: red;" +
59
        "}" +
60
        "#console {" +
61
            "white-space: pre-wrap;" +
62
            "font-family: monospace;" +
63
        "}";
64
65
    function insertStyleSheet()
66
    {
67
        var styleElement = document.createElement("style");
68
        styleElement.textContent = css;
69
        (document.head || document.documentElement).appendChild(styleElement);
70
    }
71
    
72
    if (!isWorker())
73
        insertStyleSheet();
74
75
    self.onerror = function(message)
76
    {
77
        errorMessage = message;
78
    };
79
80
})();
81
82
function isWorker()
83
{
84
    // It's conceivable that someone would stub out 'document' in a worker so
85
    // also check for childNodes, an arbitrary DOM-related object that is
86
    // meaningless in a WorkerContext.
87
    return (typeof document === 'undefined' || typeof document.childNodes === 'undefined') && !!self.importScripts;
88
}
89
90
function descriptionQuiet(msg) { description(msg, true); }
91
92
function escapeHTML(text)
93
{
94
    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
95
}
96
97
function testPassed(msg)
98
{
99
    debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
100
}
101
102
function testFailed(msg)
103
{
104
    debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
105
}
106
107
function areArraysEqual(_a, _b)
108
{
109
    try {
110
        if (_a.length !== _b.length)
111
            return false;
112
        for (var i = 0; i < _a.length; i++)
113
            if (_a[i] !== _b[i])
114
                return false;
115
    } catch (ex) {
116
        return false;
117
    }
118
    return true;
119
}
120
121
function isMinusZero(n)
122
{
123
    // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
124
    // -Infinity instead of Infinity
125
    return n === 0 && 1/n < 0;
126
}
127
128
function isResultCorrect(_actual, _expected)
129
{
130
    if (_expected === 0)
131
        return _actual === _expected && (1/_actual) === (1/_expected);
132
    if (_actual === _expected)
133
        return true;
134
    if (typeof(_expected) == "number" && isNaN(_expected))
135
        return typeof(_actual) == "number" && isNaN(_actual);
136
    if (_expected && (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([])))
137
        return areArraysEqual(_actual, _expected);
138
    return false;
139
}
140
141
function stringify(v)
142
{
143
    if (v === 0 && 1/v < 0)
144
        return "-0";
145
    else return "" + v;
146
}
147
148
function evalAndLog(_a)
149
{
150
  if (typeof _a != "string")
151
    debug("WARN: tryAndLog() expects a string argument");
152
153
  // Log first in case things go horribly wrong or this causes a sync event.
154
  debug(_a);
155
156
  var _av;
157
  try {
158
     _av = eval(_a);
159
  } catch (e) {
160
    testFailed(_a + " threw exception " + e);
161
  }
162
  return _av;
163
}
164
165
function shouldBe(_a, _b, quiet)
166
{
167
  if (typeof _a != "string" || typeof _b != "string")
168
    debug("WARN: shouldBe() expects string arguments");
169
  var exception;
170
  var _av;
171
  try {
172
     _av = eval(_a);
173
  } catch (e) {
174
     exception = e;
175
  }
176
  var _bv = eval(_b);
177
178
  if (exception)
179
    testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
180
  else if (isResultCorrect(_av, _bv)) {
181
    if (!quiet) {
182
        testPassed(_a + " is " + _b);
183
    }
184
  } else if (typeof(_av) == typeof(_bv))
185
    testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
186
  else
187
    testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
188
}
189
190
// Variant of shouldBe()--confirms that result of eval(_to_eval) is within
191
// numeric _tolerance of numeric _target.
192
function shouldBeCloseTo(_to_eval, _target, _tolerance, quiet)
193
{
194
  if (typeof _to_eval != "string") {
195
    testFailed("shouldBeCloseTo() requires string argument _to_eval. was type " + typeof _to_eval);
196
    return;
197
  }
198
  if (typeof _target != "number") {
199
    testFailed("shouldBeCloseTo() requires numeric argument _target. was type " + typeof _target);
200
    return;
201
  }
202
  if (typeof _tolerance != "number") {
203
    testFailed("shouldBeCloseTo() requires numeric argument _tolerance. was type " + typeof _tolerance);
204
    return;
205
  }
206
207
  var _result;
208
  try {
209
     _result = eval(_to_eval);
210
  } catch (e) {
211
    testFailed(_to_eval + " should be within " + _tolerance + " of "
212
               + _target + ". Threw exception " + e);
213
    return;
214
  }
215
216
  if (typeof(_result) != typeof(_target)) {
217
    testFailed(_to_eval + " should be of type " + typeof _target
218
               + " but was of type " + typeof _result);
219
  } else if (Math.abs(_result - _target) <= _tolerance) {
220
    if (!quiet) {
221
        testPassed(_to_eval + " is within " + _tolerance + " of " + _target);
222
    }
223
  } else {
224
    testFailed(_to_eval + " should be within " + _tolerance + " of " + _target
225
               + ". Was " + _result + ".");
226
  }
227
}
228
229
function shouldNotBe(_a, _b, quiet)
230
{
231
  if (typeof _a != "string" || typeof _b != "string")
232
    debug("WARN: shouldNotBe() expects string arguments");
233
  var exception;
234
  var _av;
235
  try {
236
     _av = eval(_a);
237
  } catch (e) {
238
     exception = e;
239
  }
240
  var _bv = eval(_b);
241
242
  if (exception)
243
    testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
244
  else if (!isResultCorrect(_av, _bv)) {
245
    if (!quiet) {
246
        testPassed(_a + " is not " + _b);
247
    }
248
  } else
249
    testFailed(_a + " should not be " + _bv + ".");
250
}
251
252
function shouldBeTrue(_a) { shouldBe(_a, "true"); }
253
function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); }
254
function shouldBeFalse(_a) { shouldBe(_a, "false"); }
255
function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
256
function shouldBeNull(_a) { shouldBe(_a, "null"); }
257
function shouldBeZero(_a) { shouldBe(_a, "0"); }
258
259
function shouldBeEqualToString(a, b)
260
{
261
  var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
262
  shouldBe(a, unevaledString);
263
}
264
265
function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ""); }
266
267
function shouldEvaluateTo(actual, expected) {
268
  // A general-purpose comparator.  'actual' should be a string to be
269
  // evaluated, as for shouldBe(). 'expected' may be any type and will be
270
  // used without being eval'ed.
271
  if (expected == null) {
272
    // Do this before the object test, since null is of type 'object'.
273
    shouldBeNull(actual);
274
  } else if (typeof expected == "undefined") {
275
    shouldBeUndefined(actual);
276
  } else if (typeof expected == "function") {
277
    // All this fuss is to avoid the string-arg warning from shouldBe().
278
    try {
279
      actualValue = eval(actual);
280
    } catch (e) {
281
      testFailed("Evaluating " + actual + ": Threw exception " + e);
282
      return;
283
    }
284
    shouldBe("'" + actualValue.toString().replace(/\n/g, "") + "'",
285
             "'" + expected.toString().replace(/\n/g, "") + "'");
286
  } else if (typeof expected == "object") {
287
    shouldBeTrue(actual + " == '" + expected + "'");
288
  } else if (typeof expected == "string") {
289
    shouldBe(actual, expected);
290
  } else if (typeof expected == "boolean") {
291
    shouldBe("typeof " + actual, "'boolean'");
292
    if (expected)
293
      shouldBeTrue(actual);
294
    else
295
      shouldBeFalse(actual);
296
  } else if (typeof expected == "number") {
297
    shouldBe(actual, stringify(expected));
298
  } else {
299
    debug(expected + " is unknown type " + typeof expected);
300
    shouldBeTrue(actual, "'"  +expected.toString() + "'");
301
  }
302
}
303
304
function shouldBeNonZero(_a)
305
{
306
  var exception;
307
  var _av;
308
  try {
309
     _av = eval(_a);
310
  } catch (e) {
311
     exception = e;
312
  }
313
314
  if (exception)
315
    testFailed(_a + " should be non-zero. Threw exception " + exception);
316
  else if (_av != 0)
317
    testPassed(_a + " is non-zero.");
318
  else
319
    testFailed(_a + " should be non-zero. Was " + _av);
320
}
321
322
function shouldBeNonNull(_a)
323
{
324
  var exception;
325
  var _av;
326
  try {
327
     _av = eval(_a);
328
  } catch (e) {
329
     exception = e;
330
  }
331
332
  if (exception)
333
    testFailed(_a + " should be non-null. Threw exception " + exception);
334
  else if (_av != null)
335
    testPassed(_a + " is non-null.");
336
  else
337
    testFailed(_a + " should be non-null. Was " + _av);
338
}
339
340
function shouldBeUndefined(_a)
341
{
342
  var exception;
343
  var _av;
344
  try {
345
     _av = eval(_a);
346
  } catch (e) {
347
     exception = e;
348
  }
349
350
  if (exception)
351
    testFailed(_a + " should be undefined. Threw exception " + exception);
352
  else if (typeof _av == "undefined")
353
    testPassed(_a + " is undefined.");
354
  else
355
    testFailed(_a + " should be undefined. Was " + _av);
356
}
357
358
function shouldBeDefined(_a)
359
{
360
  var exception;
361
  var _av;
362
  try {
363
     _av = eval(_a);
364
  } catch (e) {
365
     exception = e;
366
  }
367
368
  if (exception)
369
    testFailed(_a + " should be defined. Threw exception " + exception);
370
  else if (_av !== undefined)
371
    testPassed(_a + " is defined.");
372
  else
373
    testFailed(_a + " should be defined. Was " + _av);
374
}
375
376
function shouldBeGreaterThanOrEqual(_a, _b) {
377
    if (typeof _a != "string" || typeof _b != "string")
378
        debug("WARN: shouldBeGreaterThanOrEqual expects string arguments");
379
380
    var exception;
381
    var _av;
382
    try {
383
        _av = eval(_a);
384
    } catch (e) {
385
        exception = e;
386
    }
387
    var _bv = eval(_b);
388
389
    if (exception)
390
        testFailed(_a + " should be >= " + _b + ". Threw exception " + exception);
391
    else if (typeof _av == "undefined" || _av < _bv)
392
        testFailed(_a + " should be >= " + _b + ". Was " + _av + " (of type " + typeof _av + ").");
393
    else
394
        testPassed(_a + " is >= " + _b);
395
}
396
397
function shouldThrow(_a, _e)
398
{
399
  var exception;
400
  var _av;
401
  try {
402
     _av = eval(_a);
403
  } catch (e) {
404
     exception = e;
405
  }
406
407
  var _ev;
408
  if (_e)
409
      _ev =  eval(_e);
410
411
  if (exception) {
412
    if (typeof _e == "undefined" || exception == _ev)
413
      testPassed(_a + " threw exception " + exception + ".");
414
    else
415
      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
416
  } else if (typeof _av == "undefined")
417
    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
418
  else
419
    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
420
}
421
422
function shouldHaveHadError(message)
423
{
424
    if (errorMessage) {
425
        if (!message)
426
            testPassed("Got expected error");
427
        else if (errorMessage.indexOf(message) !== -1)
428
            testPassed("Got expected error: '" + message + "'");
429
        else
430
            testFailed("Unexpexted error '" + message + "'");
431
    } else
432
        testFailed("Missing expexted error");
433
    errorMessage = undefined;
434
}
435
436
function gc() {
437
    if (typeof GCController !== "undefined")
438
        GCController.collect();
439
    else {
440
        var gcRec = function (n) {
441
            if (n < 1)
442
                return {};
443
            var temp = {i: "ab" + i + (i / 100000)};
444
            temp += "foo";
445
            gcRec(n-1);
446
        };
447
        for (var i = 0; i < 1000; i++)
448
            gcRec(10)
449
    }
450
}
451
452
function isSuccessfullyParsed()
453
{
454
    // FIXME: Remove this and only report unexpected syntax errors.
455
    if (!errorMessage)
456
        successfullyParsed = true;
457
    shouldBeTrue("successfullyParsed");
458
    debug('<br /><span class="pass">TEST COMPLETE</span>');
459
}
460
461
// It's possible for an async test to call finishJSTest() before js-test-post.js
462
// has been parsed.
463
function finishJSTest()
464
{
465
    wasFinishJSTestCalled = true;
466
    if (!self.wasPostTestScriptParsed)
467
        return;
468
    isSuccessfullyParsed();
469
    if (self.jsTestIsAsync && self.layoutTestController)
470
        layoutTestController.notifyDone();
471
}
472
473
function startWorker(testScriptURL, shared)
474
{
475
    self.jsTestIsAsync = true;
476
    debug('Starting worker: ' + testScriptURL);
477
    var worker = shared ? new SharedWorker(testScriptURL) : new Worker(testScriptURL);
478
    if (shared)
479
        worker.port.onmessage = function(event) { worker.onmessage(event); };
480
    worker.onmessage = function(event)
481
    {
482
        var workerPrefix = "[Worker] ";
483
        if (event.data.length < 5 || event.data.charAt(4) != ':') {
484
          debug(workerPrefix + event.data);
485
          return;
486
        }
487
        var code = event.data.substring(0, 4);
488
        var payload = workerPrefix + event.data.substring(5);
489
        if (code == "PASS")
490
            testPassed(payload);
491
        else if (code == "FAIL")
492
            testFailed(payload);
493
        else if (code == "DESC")
494
            description(payload);
495
        else if (code == "DONE")
496
            finishJSTest();
497
        else
498
            debug(workerPrefix + event.data);
499
    };
500
501
    worker.onerror = function(event)
502
    {
503
        debug('Got error from worker: ' + event.message);
504
        finishJSTest();
505
    }
506
507
    return worker;
508
}
509
510
if (isWorker()) {
511
    description = function(msg, quiet) {
512
        postMessage('DESC:' + msg);
513
    }
514
    testFailed = function(msg) {
515
        postMessage('FAIL:' + msg);
516
    }
517
    testPassed = function(msg) {
518
        postMessage('PASS:' + msg);
519
    }
520
    finishJSTest = function() {
521
        postMessage('DONE:');
522
    }
523
    debug = function(msg) {
524
        postMessage(msg);
525
    }
526
}
- a/WebKitLibraries/ChangeLog +13 lines
Lines 1-3 a/WebKitLibraries/ChangeLog_sec1
1
2012-05-07  Jon Lee  <jonlee@apple.com>
2
3
        Safari warns that it needs to resend the form in an iFrame when going back
4
        https://bugs.webkit.org/show_bug.cgi?id=82658
5
        <rdar://problem/11292558>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * WebKitSystemInterface.h:
10
        * libWebKitSystemInterfaceLeopard.a:
11
        * libWebKitSystemInterfaceLion.a:
12
        * libWebKitSystemInterfaceSnowLeopard.a:
13
1
2012-05-06  Eric Seidel  <eric@webkit.org>
14
2012-05-06  Eric Seidel  <eric@webkit.org>
2
15
3
        Remove 3D_CANVAS define from vsprops files (it was renamed WEBGL many months ago)
16
        Remove 3D_CANVAS define from vsprops files (it was renamed WEBGL many months ago)
- a/WebKitLibraries/WebKitSystemInterface.h +4 lines
Lines 488-493 bool WKExecutableWasLinkedOnOrBeforeLion(void); a/WebKitLibraries/WebKitSystemInterface.h_sec1
488
void WKCGPathAddRoundedRect(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
488
void WKCGPathAddRoundedRect(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight);
489
#endif
489
#endif
490
490
491
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
492
void WKCFURLRequestAllowAllPostCaching(CFURLRequestRef request);
493
#endif
494
491
#ifdef __cplusplus
495
#ifdef __cplusplus
492
}
496
}
493
#endif
497
#endif

Return to Bug 82658