2 * Copyright (C) 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Joone Hur <joone@kldp.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "LayoutTestController.h"
33 #include "WorkQueue.h"
34 #include "WorkQueueItem.h"
36 #include <JavaScriptCore/JSContextRef.h>
37 #include <JavaScriptCore/JSObjectRef.h>
38 #include <JavaScriptCore/JSRetainPtr.h>
40 #include <wtf/Assertions.h>
41 #include <wtf/MathExtras.h>
42 #include <wtf/RefPtr.h>
44 LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash)
45 : m_dumpApplicationCacheDelegateCallbacks(false)
48 , m_dumpBackForwardList(false)
49 , m_dumpChildFrameScrollPositions(false)
50 , m_dumpChildFramesAsText(false)
51 , m_dumpDOMAsWebArchive(false)
52 , m_dumpDatabaseCallbacks(false)
53 , m_dumpEditingCallbacks(false)
54 , m_dumpFrameLoadCallbacks(false)
55 , m_dumpUserGestureInFrameLoadCallbacks(false)
56 , m_dumpHistoryDelegateCallbacks(false)
57 , m_dumpResourceLoadCallbacks(false)
58 , m_dumpResourceResponseMIMETypes(false)
59 , m_dumpSelectionRect(false)
60 , m_dumpSourceAsWebArchive(false)
61 , m_dumpStatusCallbacks(false)
62 , m_dumpTitleChanges(false)
63 , m_dumpIconChanges(false)
64 , m_dumpVisitedLinksCallback(false)
65 , m_dumpWillCacheResponse(false)
66 , m_generatePixelResults(true)
67 , m_callCloseOnWebViews(true)
68 , m_canOpenWindows(false)
69 , m_closeRemainingWindowsWhenComplete(true)
70 , m_newWindowsCopyBackForwardList(false)
71 , m_stopProvisionalFrameLoads(false)
72 , m_testOnscreen(false)
73 , m_testRepaint(false)
74 , m_testRepaintSweepHorizontally(false)
76 , m_willSendRequestReturnsNull(false)
77 , m_willSendRequestReturnsNullOnRedirect(false)
79 , m_alwaysAcceptCookies(false)
81 , m_isGeolocationPermissionSet(false)
82 , m_geolocationPermission(false)
83 , m_handlesAuthenticationChallenges(false)
85 , m_deferMainResourceDataLoad(true)
86 , m_shouldPaintBrokenImage(true)
87 , m_testPathOrURL(testPathOrURL)
88 , m_expectedPixelHash(expectedPixelHash)
92 PassRefPtr<LayoutTestController> LayoutTestController::create(const std::string& testPathOrURL, const std::string& expectedPixelHash)
94 return adoptRef(new LayoutTestController(testPathOrURL, expectedPixelHash));
99 static JSValueRef dumpApplicationCacheDelegateCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
101 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
102 controller->setDumpApplicationCacheDelegateCallbacks(true);
103 return JSValueMakeUndefined(context);
106 static JSValueRef dumpAsPDFCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
108 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
109 controller->setDumpAsPDF(true);
110 return JSValueMakeUndefined(context);
113 static JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
115 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
116 controller->setDumpAsText(true);
118 // Optional paramater, describing whether it's allowed to dump pixel results in dumpAsText mode.
119 controller->setGeneratePixelResults(argumentCount > 0 ? JSValueToBoolean(context, arguments[0]) : false);
121 return JSValueMakeUndefined(context);
124 static JSValueRef dumpBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
126 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
127 controller->setDumpBackForwardList(true);
128 return JSValueMakeUndefined(context);
131 static JSValueRef dumpChildFramesAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
133 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
134 controller->setDumpChildFramesAsText(true);
135 return JSValueMakeUndefined(context);
138 static JSValueRef dumpChildFrameScrollPositionsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
140 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
141 controller->setDumpChildFrameScrollPositions(true);
142 return JSValueMakeUndefined(context);
145 static JSValueRef dumpConfigurationForViewportCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
147 if (argumentCount < 2)
148 return JSValueMakeUndefined(context);
151 double deviceDPI = JSValueToNumber(context, arguments[0], exception);
153 double deviceWidth = JSValueToNumber(context, arguments[1], exception);
155 double deviceHeight = JSValueToNumber(context, arguments[2], exception);
157 double availableWidth = JSValueToNumber(context, arguments[3], exception);
159 double availableHeight = JSValueToNumber(context, arguments[4], exception);
162 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
163 controller->dumpConfigurationForViewport(static_cast<int>(deviceDPI), static_cast<int>(deviceWidth), static_cast<int>(deviceHeight), static_cast<int>(availableWidth), static_cast<int>(availableHeight));
165 return JSValueMakeUndefined(context);
168 static JSValueRef dumpDatabaseCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
170 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
171 controller->setDumpDatabaseCallbacks(true);
172 return JSValueMakeUndefined(context);
175 static JSValueRef dumpDOMAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
177 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
178 controller->setDumpDOMAsWebArchive(true);
179 return JSValueMakeUndefined(context);
182 static JSValueRef dumpEditingCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
184 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
185 controller->setDumpEditingCallbacks(true);
186 return JSValueMakeUndefined(context);
189 static JSValueRef dumpFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
191 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
192 controller->setDumpFrameLoadCallbacks(true);
193 return JSValueMakeUndefined(context);
196 static JSValueRef dumpUserGestureInFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
198 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
199 controller->setDumpUserGestureInFrameLoadCallbacks(true);
200 return JSValueMakeUndefined(context);
203 static JSValueRef dumpResourceLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
205 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
206 controller->setDumpResourceLoadCallbacks(true);
207 return JSValueMakeUndefined(context);
210 static JSValueRef dumpResourceResponseMIMETypesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
212 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
213 controller->setDumpResourceResponseMIMETypes(true);
214 return JSValueMakeUndefined(context);
217 static JSValueRef dumpSelectionRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
219 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
220 controller->setDumpSelectionRect(true);
221 return JSValueMakeUndefined(context);
224 static JSValueRef dumpSourceAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
226 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
227 controller->setDumpSourceAsWebArchive(true);
228 return JSValueMakeUndefined(context);
231 static JSValueRef dumpStatusCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
233 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
234 controller->setDumpStatusCallbacks(true);
235 return JSValueMakeUndefined(context);
238 static JSValueRef dumpTitleChangesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
240 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
241 controller->setDumpTitleChanges(true);
242 return JSValueMakeUndefined(context);
245 static JSValueRef dumpIconChangesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
247 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
248 controller->setDumpIconChanges(true);
249 return JSValueMakeUndefined(context);
252 static JSValueRef dumpWillCacheResponseCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
254 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
255 controller->setDumpWillCacheResponse(true);
256 return JSValueMakeUndefined(context);
259 static JSValueRef pathToLocalResourceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
261 if (argumentCount < 1)
262 return JSValueMakeUndefined(context);
264 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
265 JSRetainPtr<JSStringRef> localPath(Adopt, JSValueToStringCopy(context, arguments[0], exception));
268 JSRetainPtr<JSStringRef> convertedPath(Adopt, controller->pathToLocalResource(context, localPath.get()));
270 return JSValueMakeUndefined(context);
272 return JSValueMakeString(context, convertedPath.get());
275 static JSValueRef removeAllVisitedLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
277 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
278 controller->setDumpVisitedLinksCallback(true);
279 controller->removeAllVisitedLinks();
280 return JSValueMakeUndefined(context);
283 static JSValueRef repaintSweepHorizontallyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
285 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
286 controller->setTestRepaintSweepHorizontally(true);
287 return JSValueMakeUndefined(context);
290 static JSValueRef setCallCloseOnWebViewsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
292 if (argumentCount < 1)
293 return JSValueMakeUndefined(context);
295 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
296 controller->setCallCloseOnWebViews(JSValueToBoolean(context, arguments[0]));
297 return JSValueMakeUndefined(context);
300 static JSValueRef setCanOpenWindowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
302 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
303 controller->setCanOpenWindows(true);
304 return JSValueMakeUndefined(context);
307 static JSValueRef setCloseRemainingWindowsWhenCompleteCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
309 if (argumentCount < 1)
310 return JSValueMakeUndefined(context);
312 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
313 controller->setCloseRemainingWindowsWhenComplete(JSValueToBoolean(context, arguments[0]));
314 return JSValueMakeUndefined(context);
317 static JSValueRef testOnscreenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
319 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
320 controller->setTestOnscreen(true);
321 return JSValueMakeUndefined(context);
324 static JSValueRef testRepaintCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
326 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
327 controller->setTestRepaint(true);
328 return JSValueMakeUndefined(context);
331 static JSValueRef addDisallowedURLCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
333 // Has mac implementation
334 if (argumentCount < 1)
335 return JSValueMakeUndefined(context);
337 JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception));
340 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
341 controller->addDisallowedURL(url.get());
343 return JSValueMakeUndefined(context);
346 static JSValueRef addURLToRedirectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
348 if (argumentCount < 2)
349 return JSValueMakeUndefined(context);
351 JSRetainPtr<JSStringRef> origin(Adopt, JSValueToStringCopy(context, arguments[0], exception));
354 JSRetainPtr<JSStringRef> destination(Adopt, JSValueToStringCopy(context, arguments[1], exception));
357 size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get());
358 char* originBuffer = new char[maxLength + 1];
359 JSStringGetUTF8CString(origin.get(), originBuffer, maxLength + 1);
361 maxLength = JSStringGetMaximumUTF8CStringSize(destination.get());
362 char* destinationBuffer = new char[maxLength + 1];
363 JSStringGetUTF8CString(destination.get(), destinationBuffer, maxLength + 1);
365 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
366 controller->addURLToRedirect(originBuffer, destinationBuffer);
368 return JSValueMakeUndefined(context);
371 static JSValueRef callShouldCloseOnWebViewCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
373 // Has mac & windows implementation
374 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
376 return JSValueMakeBoolean(context, controller->callShouldCloseOnWebView());
379 static JSValueRef clearAllApplicationCachesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
381 // Has mac implementation
382 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
383 controller->clearAllApplicationCaches();
385 return JSValueMakeUndefined(context);
388 static JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
390 // Has mac & windows implementation
391 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
392 controller->clearAllDatabases();
394 return JSValueMakeUndefined(context);
397 static JSValueRef clearBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
399 // Has mac & windows implementation
400 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
401 controller->clearBackForwardList();
403 return JSValueMakeUndefined(context);
406 static JSValueRef clearPersistentUserStyleSheetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
408 // Has mac & windows implementation
409 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
410 controller->clearPersistentUserStyleSheet();
412 return JSValueMakeUndefined(context);
415 static JSValueRef decodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
417 // Has mac implementation
418 if (argumentCount < 1)
419 return JSValueMakeUndefined(context);
421 JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception));
424 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
425 JSRetainPtr<JSStringRef> decodedHostName(Adopt, controller->copyDecodedHostName(name.get()));
426 return JSValueMakeString(context, decodedHostName.get());
429 static JSValueRef disableImageLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
431 // Has mac implementation, needs windows implementation
432 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
433 controller->disableImageLoading();
435 return JSValueMakeUndefined(context);
438 static JSValueRef dispatchPendingLoadRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
440 // Has mac implementation, needs windows implementation
441 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
442 controller->dispatchPendingLoadRequests();
444 return JSValueMakeUndefined(context);
447 static JSValueRef displayCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
449 // Has mac & windows implementation
450 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
451 controller->display();
453 return JSValueMakeUndefined(context);
456 static JSValueRef displayInvalidatedRegionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
458 // Has mac & windows implementation
459 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
460 // LayoutTestController::display() only renders the invalidated region so
461 // we can just use that.
462 controller->display();
464 return JSValueMakeUndefined(context);
467 static JSValueRef encodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
469 // Has mac implementation
470 if (argumentCount < 1)
471 return JSValueMakeUndefined(context);
473 JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception));
476 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
477 JSRetainPtr<JSStringRef> encodedHostName(Adopt, controller->copyEncodedHostName(name.get()));
478 return JSValueMakeString(context, encodedHostName.get());
481 static JSValueRef execCommandCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
483 // Has Mac & Windows implementations.
484 if (argumentCount < 1)
485 return JSValueMakeUndefined(context);
487 JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception));
490 // Ignoring the second parameter (userInterface), as this command emulates a manual action.
492 JSRetainPtr<JSStringRef> value;
493 if (argumentCount >= 3) {
494 value.adopt(JSValueToStringCopy(context, arguments[2], exception));
497 value.adopt(JSStringCreateWithUTF8CString(""));
500 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
501 controller->execCommand(name.get(), value.get());
503 return JSValueMakeUndefined(context);
506 static JSValueRef findStringCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
508 // Has Mac implementation.
509 if (argumentCount < 2)
510 return JSValueMakeUndefined(context);
512 JSRetainPtr<JSStringRef> target(Adopt, JSValueToStringCopy(context, arguments[0], exception));
515 JSObjectRef options = JSValueToObject(context, arguments[1], exception);
518 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
519 return JSValueMakeBoolean(context, controller->findString(context, target.get(), options));
522 static JSValueRef counterValueForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
524 if (argumentCount < 1)
525 return JSValueMakeUndefined(context);
527 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
529 return JSValueMakeUndefined(context);
531 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
532 JSRetainPtr<JSStringRef> counterValue(controller->counterValueForElementById(elementId.get()));
533 if (!counterValue.get())
534 return JSValueMakeUndefined(context);
535 return JSValueMakeString(context, counterValue.get());
538 static JSValueRef grantDesktopNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
540 // Has Windows implementation
541 if (argumentCount < 1)
542 return JSValueMakeUndefined(context);
544 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
546 controller->grantDesktopNotificationPermission(JSValueToStringCopy(context, arguments[0], NULL));
548 return JSValueMakeUndefined(context);
551 static JSValueRef isCommandEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
553 // Has Mac implementation.
555 if (argumentCount < 1)
556 return JSValueMakeUndefined(context);
558 JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception));
561 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
563 return JSValueMakeBoolean(context, controller->isCommandEnabled(name.get()));
566 static JSValueRef overridePreferenceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
568 if (argumentCount < 2)
569 return JSValueMakeUndefined(context);
571 JSRetainPtr<JSStringRef> key(Adopt, JSValueToStringCopy(context, arguments[0], exception));
573 JSRetainPtr<JSStringRef> value(Adopt, JSValueToStringCopy(context, arguments[1], exception));
576 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
577 controller->overridePreference(key.get(), value.get());
579 return JSValueMakeUndefined(context);
582 static JSValueRef keepWebHistoryCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
584 // Has mac implementation
585 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
586 controller->keepWebHistory();
588 return JSValueMakeUndefined(context);
591 static JSValueRef computedStyleIncludingVisitedInfoCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
593 if (argumentCount != 1)
594 return JSValueMakeUndefined(context);
596 // Has mac implementation
597 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
598 return controller->computedStyleIncludingVisitedInfo(context, arguments[0]);
601 static JSValueRef nodesFromRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
603 if (argumentCount != 8)
604 return JSValueMakeUndefined(context);
606 int x = JSValueToNumber(context, arguments[1], NULL);
607 int y = JSValueToNumber(context, arguments[2], NULL);
608 int top = static_cast<unsigned>(JSValueToNumber(context, arguments[3], NULL));
609 int right = static_cast<unsigned>(JSValueToNumber(context, arguments[4], NULL));
610 int bottom = static_cast<unsigned>(JSValueToNumber(context, arguments[5], NULL));
611 int left = static_cast<unsigned>(JSValueToNumber(context, arguments[6], NULL));
612 bool ignoreClipping = JSValueToBoolean(context, arguments[7]);
614 // Has mac implementation.
615 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
616 return controller->nodesFromRect(context, arguments[0], x, y, top, right, bottom, left, ignoreClipping);
619 static JSValueRef layerTreeAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
621 // Has mac & windows implementation
622 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
623 return JSValueMakeString(context, controller->layerTreeAsText().get());
626 static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
628 // Has mac & windows implementation
629 // May be able to be made platform independant by using shared WorkQueue
630 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
631 controller->notifyDone();
632 return JSValueMakeUndefined(context);
635 static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels)
637 pageWidthInPixels = LayoutTestController::maxViewWidth;
638 pageHeightInPixels = LayoutTestController::maxViewHeight;
639 switch (argumentCount) {
641 pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception));
644 pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
647 case 0: // Fall through.
655 // Caller needs to delete[] propertyName.
656 static bool parsePagePropertyParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, char*& propertyName, int& pageNumber)
659 switch (argumentCount) {
661 pageNumber = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
666 JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSValueToStringCopy(context, arguments[0], exception));
670 size_t maxLength = JSStringGetMaximumUTF8CStringSize(propertyNameString.get());
671 propertyName = new char[maxLength + 1];
672 JSStringGetUTF8CString(propertyNameString.get(), propertyName, maxLength + 1);
681 static bool parsePageNumber(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber)
684 switch (argumentCount) {
686 pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
697 static bool parsePageNumberSizeMarings(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber, int& width, int& height, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
701 marginTop = marginRight = marginBottom = marginLeft = 0;
703 switch (argumentCount) {
705 marginLeft = static_cast<int>(JSValueToNumber(context, arguments[6], exception));
710 marginBottom = static_cast<int>(JSValueToNumber(context, arguments[5], exception));
715 marginRight = static_cast<int>(JSValueToNumber(context, arguments[4], exception));
720 marginTop = static_cast<int>(JSValueToNumber(context, arguments[3], exception));
725 height = static_cast<int>(JSValueToNumber(context, arguments[2], exception));
730 width = static_cast<int>(JSValueToNumber(context, arguments[1], exception));
735 pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
745 static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
747 float pageWidthInPixels = 0;
748 float pageHeightInPixels = 0;
749 if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels))
750 return JSValueMakeUndefined(context);
752 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
754 return JSValueMakeUndefined(context);
756 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
757 int pageNumber = controller->pageNumberForElementById(elementId.get(), pageWidthInPixels, pageHeightInPixels);
758 return JSValueMakeNumber(context, pageNumber);
761 static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
763 float pageWidthInPixels = 0;
764 float pageHeightInPixels = 0;
765 if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels))
766 return JSValueMakeUndefined(context);
768 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
769 return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels));
772 static JSValueRef pagePropertyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
774 char* propertyName = 0;
776 if (!parsePagePropertyParameters(context, argumentCount, arguments, exception, propertyName, pageNumber))
777 return JSValueMakeUndefined(context);
779 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
780 JSValueRef value = JSValueMakeString(context, controller->pageProperty(propertyName, pageNumber).get());
782 delete[] propertyName;
786 static JSValueRef isPageBoxVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
789 if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
790 return JSValueMakeUndefined(context);
792 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
793 return JSValueMakeBoolean(context, controller->isPageBoxVisible(pageNumber));
796 static JSValueRef pageSizeAndMarginsInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
799 int width = 0, height = 0;
800 int marginTop = 0, marginRight = 0, marginBottom = 0, marginLeft = 0;
801 if (!parsePageNumberSizeMarings(context, argumentCount, arguments, exception, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft))
802 return JSValueMakeUndefined(context);
804 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
805 return JSValueMakeString(context, controller->pageSizeAndMarginsInPixels(pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft).get());
808 static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
810 // Has mac & windows implementation
811 // May be able to be made platform independant by using shared WorkQueue
812 if (argumentCount < 1)
813 return JSValueMakeUndefined(context);
815 double howFarBackDouble = JSValueToNumber(context, arguments[0], exception);
818 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
819 controller->queueBackNavigation(static_cast<int>(howFarBackDouble));
821 return JSValueMakeUndefined(context);
824 static JSValueRef queueForwardNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
826 // Has mac & windows implementation
827 // May be able to be made platform independant by using shared WorkQueue
828 if (argumentCount < 1)
829 return JSValueMakeUndefined(context);
831 double howFarForwardDouble = JSValueToNumber(context, arguments[0], exception);
834 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
835 controller->queueForwardNavigation(static_cast<int>(howFarForwardDouble));
837 return JSValueMakeUndefined(context);
840 static JSValueRef queueLoadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
842 // Has mac & windows implementation
843 // May be able to be made platform independant by using shared WorkQueue
844 if (argumentCount < 1)
845 return JSValueMakeUndefined(context);
847 JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception));
850 JSRetainPtr<JSStringRef> target;
851 if (argumentCount >= 2) {
852 target.adopt(JSValueToStringCopy(context, arguments[1], exception));
855 target.adopt(JSStringCreateWithUTF8CString(""));
857 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
858 controller->queueLoad(url.get(), target.get());
860 return JSValueMakeUndefined(context);
863 static JSValueRef queueLoadHTMLStringCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
865 // Has Mac & Windows implementation
866 if (argumentCount < 1)
867 return JSValueMakeUndefined(context);
869 JSRetainPtr<JSStringRef> content(Adopt, JSValueToStringCopy(context, arguments[0], exception));
872 JSRetainPtr<JSStringRef> baseURL;
873 if (argumentCount >= 2) {
874 baseURL.adopt(JSValueToStringCopy(context, arguments[1], exception));
877 baseURL.adopt(JSStringCreateWithUTF8CString(""));
879 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
881 if (argumentCount >= 3) {
882 JSRetainPtr<JSStringRef> unreachableURL;
883 unreachableURL.adopt(JSValueToStringCopy(context, arguments[2], exception));
885 controller->queueLoadAlternateHTMLString(content.get(), baseURL.get(), unreachableURL.get());
886 return JSValueMakeUndefined(context);
889 controller->queueLoadHTMLString(content.get(), baseURL.get());
890 return JSValueMakeUndefined(context);
893 static JSValueRef queueReloadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
895 // Has mac & windows implementation
896 // May be able to be made platform independant by using shared WorkQueue
898 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
899 controller->queueReload();
901 return JSValueMakeUndefined(context);
904 static JSValueRef queueLoadingScriptCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
906 // Has mac & windows implementation
907 // May be able to be made platform independant by using shared WorkQueue
908 if (argumentCount < 1)
909 return JSValueMakeUndefined(context);
911 JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception));
914 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
915 controller->queueLoadingScript(script.get());
917 return JSValueMakeUndefined(context);
920 static JSValueRef queueNonLoadingScriptCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
922 // Has mac & windows implementation
923 // May be able to be made platform independant by using shared WorkQueue
924 if (argumentCount < 1)
925 return JSValueMakeUndefined(context);
927 JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception));
930 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
931 controller->queueNonLoadingScript(script.get());
933 return JSValueMakeUndefined(context);
936 static JSValueRef setAcceptsEditingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
938 // Has mac & windows implementation
939 if (argumentCount < 1)
940 return JSValueMakeUndefined(context);
942 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
943 controller->setAcceptsEditing(JSValueToBoolean(context, arguments[0]));
945 return JSValueMakeUndefined(context);
948 static JSValueRef setAlwaysAcceptCookiesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
950 // Has mac & windows implementation
951 if (argumentCount < 1)
952 return JSValueMakeUndefined(context);
954 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
955 controller->setAlwaysAcceptCookies(JSValueToBoolean(context, arguments[0]));
957 return JSValueMakeUndefined(context);
960 static JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
962 // Has mac implementation
963 if (argumentCount < 1)
964 return JSValueMakeUndefined(context);
966 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
968 double size = JSValueToNumber(context, arguments[0], NULL);
970 controller->setAppCacheMaximumSize(static_cast<unsigned long long>(size));
972 return JSValueMakeUndefined(context);
975 static JSValueRef setApplicationCacheOriginQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
977 // Has mac implementation
978 if (argumentCount < 1)
979 return JSValueMakeUndefined(context);
981 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
983 double size = JSValueToNumber(context, arguments[0], NULL);
985 controller->setApplicationCacheOriginQuota(static_cast<unsigned long long>(size));
987 return JSValueMakeUndefined(context);
990 static JSValueRef setAuthenticationPasswordCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
992 // Has mac & windows implementation
993 if (argumentCount < 1)
994 return JSValueMakeUndefined(context);
996 JSRetainPtr<JSStringRef> password(Adopt, JSValueToStringCopy(context, arguments[0], exception));
999 size_t maxLength = JSStringGetMaximumUTF8CStringSize(password.get());
1000 char* passwordBuffer = new char[maxLength + 1];
1001 JSStringGetUTF8CString(password.get(), passwordBuffer, maxLength + 1);
1003 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1004 controller->setAuthenticationPassword(passwordBuffer);
1005 delete[] passwordBuffer;
1007 return JSValueMakeUndefined(context);
1010 static JSValueRef setAuthenticationUsernameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1012 // Has mac & windows implementation
1013 if (argumentCount < 1)
1014 return JSValueMakeUndefined(context);
1016 JSRetainPtr<JSStringRef> username(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1017 ASSERT(!*exception);
1019 size_t maxLength = JSStringGetMaximumUTF8CStringSize(username.get());
1020 char* usernameBuffer = new char[maxLength + 1];
1021 JSStringGetUTF8CString(username.get(), usernameBuffer, maxLength + 1);
1023 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1024 controller->setAuthenticationUsername(usernameBuffer);
1025 delete[] usernameBuffer;
1027 return JSValueMakeUndefined(context);
1030 static JSValueRef setAuthorAndUserStylesEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1032 // Has mac & windows implementation
1033 if (argumentCount < 1)
1034 return JSValueMakeUndefined(context);
1036 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1037 controller->setAuthorAndUserStylesEnabled(JSValueToBoolean(context, arguments[0]));
1039 return JSValueMakeUndefined(context);
1042 static JSValueRef setCacheModelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1044 // Has Mac implementation.
1045 if (argumentCount < 1)
1046 return JSValueMakeUndefined(context);
1048 int cacheModel = JSValueToNumber(context, arguments[0], exception);
1049 ASSERT(!*exception);
1051 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1052 controller->setCacheModel(cacheModel);
1054 return JSValueMakeUndefined(context);
1057 static JSValueRef setCustomPolicyDelegateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1059 // Has mac implementation
1060 if (argumentCount < 1)
1061 return JSValueMakeUndefined(context);
1063 bool permissive = false;
1064 if (argumentCount >= 2)
1065 permissive = JSValueToBoolean(context, arguments[1]);
1067 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1068 controller->setCustomPolicyDelegate(JSValueToBoolean(context, arguments[0]), permissive);
1070 return JSValueMakeUndefined(context);
1073 static JSValueRef setDatabaseQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1075 // Has mac implementation
1076 if (argumentCount < 1)
1077 return JSValueMakeUndefined(context);
1079 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1081 double quota = JSValueToNumber(context, arguments[0], NULL);
1083 controller->setDatabaseQuota(static_cast<unsigned long long>(quota));
1085 return JSValueMakeUndefined(context);
1088 static JSValueRef setDeferMainResourceDataLoadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1090 // Has Mac and Windows implementation
1091 if (argumentCount < 1)
1092 return JSValueMakeUndefined(context);
1094 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1095 controller->setDeferMainResourceDataLoad(JSValueToBoolean(context, arguments[0]));
1097 return JSValueMakeUndefined(context);
1100 static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1102 // Has Mac and Windows implementation
1103 if (argumentCount < 2)
1104 return JSValueMakeUndefined(context);
1106 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1108 bool forbidden = JSValueToBoolean(context, arguments[0]);
1109 JSRetainPtr<JSStringRef> scheme(Adopt, JSValueToStringCopy(context, arguments[1], 0));
1110 controller->setDomainRelaxationForbiddenForURLScheme(forbidden, scheme.get());
1112 return JSValueMakeUndefined(context);
1115 static JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1117 if (argumentCount < 6)
1118 return JSValueMakeUndefined(context);
1120 bool canProvideAlpha = JSValueToBoolean(context, arguments[0]);
1121 double alpha = JSValueToNumber(context, arguments[1], exception);
1122 ASSERT(!*exception);
1123 bool canProvideBeta = JSValueToBoolean(context, arguments[2]);
1124 double beta = JSValueToNumber(context, arguments[3], exception);
1125 ASSERT(!*exception);
1126 bool canProvideGamma = JSValueToBoolean(context, arguments[4]);
1127 double gamma = JSValueToNumber(context, arguments[5], exception);
1128 ASSERT(!*exception);
1130 LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1131 controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
1133 return JSValueMakeUndefined(context);
1136 static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1138 if (argumentCount < 3)
1139 return JSValueMakeUndefined(context);
1141 LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1142 controller->setMockGeolocationPosition(JSValueToNumber(context, arguments[0], NULL), // latitude
1143 JSValueToNumber(context, arguments[1], NULL), // longitude
1144 JSValueToNumber(context, arguments[2], NULL)); // accuracy
1146 return JSValueMakeUndefined(context);
1149 static JSValueRef setMockGeolocationErrorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1151 if (argumentCount < 2)
1152 return JSValueMakeUndefined(context);
1154 int code = JSValueToNumber(context, arguments[0], NULL);
1155 JSRetainPtr<JSStringRef> message(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1156 ASSERT(!*exception);
1158 LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1159 controller->setMockGeolocationError(code, message.get());
1161 return JSValueMakeUndefined(context);
1164 static JSValueRef addMockSpeechInputResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1166 if (argumentCount < 3)
1167 return JSValueMakeUndefined(context);
1169 JSRetainPtr<JSStringRef> result(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1170 ASSERT(!*exception);
1172 double confidence = JSValueToNumber(context, arguments[1], exception);
1174 JSRetainPtr<JSStringRef> language(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1175 ASSERT(!*exception);
1177 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1178 controller->addMockSpeechInputResult(result.get(), confidence, language.get());
1180 return JSValueMakeUndefined(context);
1183 static JSValueRef setNewWindowsCopyBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1185 // Has mac implementation
1186 if (argumentCount < 1)
1187 return JSValueMakeUndefined(context);
1189 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1190 controller->setNewWindowsCopyBackForwardList(JSValueToBoolean(context, arguments[0]));
1192 return JSValueMakeUndefined(context);
1195 static JSValueRef setGeolocationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1197 // Has mac implementation
1198 if (argumentCount < 1)
1199 return JSValueMakeUndefined(context);
1201 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1202 controller->setGeolocationPermission(JSValueToBoolean(context, arguments[0]));
1204 return JSValueMakeUndefined(context);
1207 static JSValueRef setHandlesAuthenticationChallengesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1209 // Has mac & windows implementation
1210 if (argumentCount < 1)
1211 return JSValueMakeUndefined(context);
1213 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1214 controller->setHandlesAuthenticationChallenges(JSValueToBoolean(context, arguments[0]));
1216 return JSValueMakeUndefined(context);
1219 static JSValueRef setPOSIXLocaleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1221 if (argumentCount < 1)
1222 return JSValueMakeUndefined(context);
1224 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1225 JSRetainPtr<JSStringRef> locale(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1226 ASSERT(!*exception);
1227 controller->setPOSIXLocale(locale.get());
1229 return JSValueMakeUndefined(context);
1232 static JSValueRef setIconDatabaseEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1234 // Has mac & windows implementation
1235 if (argumentCount < 1)
1236 return JSValueMakeUndefined(context);
1238 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1239 controller->setIconDatabaseEnabled(JSValueToBoolean(context, arguments[0]));
1241 return JSValueMakeUndefined(context);
1244 static JSValueRef setJavaScriptProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1246 if (argumentCount < 1)
1247 return JSValueMakeUndefined(context);
1249 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1250 controller->setJavaScriptProfilingEnabled(JSValueToBoolean(context, arguments[0]));
1252 return JSValueMakeUndefined(context);
1255 static JSValueRef setMainFrameIsFirstResponderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1257 // Has mac implementation
1258 if (argumentCount < 1)
1259 return JSValueMakeUndefined(context);
1261 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1262 controller->setMainFrameIsFirstResponder(JSValueToBoolean(context, arguments[0]));
1264 return JSValueMakeUndefined(context);
1267 static JSValueRef setPersistentUserStyleSheetLocationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1269 // Has mac implementation
1270 if (argumentCount < 1)
1271 return JSValueMakeUndefined(context);
1273 JSRetainPtr<JSStringRef> path(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1274 ASSERT(!*exception);
1276 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1277 controller->setPersistentUserStyleSheetLocation(path.get());
1279 return JSValueMakeUndefined(context);
1282 static JSValueRef setPrivateBrowsingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1284 // Has mac & windows implementation
1285 if (argumentCount < 1)
1286 return JSValueMakeUndefined(context);
1288 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1289 controller->setPrivateBrowsingEnabled(JSValueToBoolean(context, arguments[0]));
1291 return JSValueMakeUndefined(context);
1294 static JSValueRef setJavaScriptCanAccessClipboardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1296 // Has mac & windows implementation
1297 if (argumentCount < 1)
1298 return JSValueMakeUndefined(context);
1300 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1301 controller->setJavaScriptCanAccessClipboard(JSValueToBoolean(context, arguments[0]));
1303 return JSValueMakeUndefined(context);
1306 static JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1308 // Has mac & windows implementation
1309 if (argumentCount < 1)
1310 return JSValueMakeUndefined(context);
1312 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1313 controller->setXSSAuditorEnabled(JSValueToBoolean(context, arguments[0]));
1315 return JSValueMakeUndefined(context);
1318 static JSValueRef setSpatialNavigationEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1320 // Has mac implementation.
1321 if (argumentCount < 1)
1322 return JSValueMakeUndefined(context);
1324 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1325 controller->setSpatialNavigationEnabled(JSValueToBoolean(context, arguments[0]));
1327 return JSValueMakeUndefined(context);
1330 static JSValueRef setPrintingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1332 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1333 controller->setIsPrinting(true);
1334 return JSValueMakeUndefined(context);
1338 static JSValueRef setFrameFlatteningEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1340 // Has mac & windows implementation
1341 if (argumentCount < 1)
1342 return JSValueMakeUndefined(context);
1344 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1345 controller->setFrameFlatteningEnabled(JSValueToBoolean(context, arguments[0]));
1347 return JSValueMakeUndefined(context);
1350 static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1352 // Has mac & windows implementation
1353 if (argumentCount < 1)
1354 return JSValueMakeUndefined(context);
1356 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1357 controller->setAllowUniversalAccessFromFileURLs(JSValueToBoolean(context, arguments[0]));
1359 return JSValueMakeUndefined(context);
1362 static JSValueRef setAllowFileAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1364 // Has mac & windows implementation
1365 if (argumentCount < 1)
1366 return JSValueMakeUndefined(context);
1368 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1369 controller->setAllowFileAccessFromFileURLs(JSValueToBoolean(context, arguments[0]));
1371 return JSValueMakeUndefined(context);
1374 static JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1376 // Has mac & windows implementation
1377 if (argumentCount < 1)
1378 return JSValueMakeUndefined(context);
1380 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1381 controller->setTabKeyCyclesThroughElements(JSValueToBoolean(context, arguments[0]));
1383 return JSValueMakeUndefined(context);
1386 static JSValueRef setTimelineProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1388 if (argumentCount < 1)
1389 return JSValueMakeUndefined(context);
1391 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1392 controller->setTimelineProfilingEnabled(JSValueToBoolean(context, arguments[0]));
1393 return JSValueMakeUndefined(context);
1396 static JSValueRef setUseDashboardCompatibilityModeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1398 // Has mac implementation
1399 if (argumentCount < 1)
1400 return JSValueMakeUndefined(context);
1402 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1403 controller->setUseDashboardCompatibilityMode(JSValueToBoolean(context, arguments[0]));
1405 return JSValueMakeUndefined(context);
1408 static JSValueRef setUserStyleSheetEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1410 // Has mac implementation
1411 if (argumentCount < 1)
1412 return JSValueMakeUndefined(context);
1414 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1415 controller->setUserStyleSheetEnabled(JSValueToBoolean(context, arguments[0]));
1417 return JSValueMakeUndefined(context);
1420 static JSValueRef setUserStyleSheetLocationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1422 // Has mac implementation
1423 if (argumentCount < 1)
1424 return JSValueMakeUndefined(context);
1426 JSRetainPtr<JSStringRef> path(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1427 ASSERT(!*exception);
1429 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1430 controller->setUserStyleSheetLocation(path.get());
1432 return JSValueMakeUndefined(context);
1435 static JSValueRef setValueForUserCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1437 // Has mac implementation
1438 if (argumentCount != 2)
1439 return JSValueMakeUndefined(context);
1441 JSRetainPtr<JSStringRef> value(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1442 ASSERT(!*exception);
1444 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1445 controller->setValueForUser(context, arguments[0], value.get());
1447 return JSValueMakeUndefined(context);
1450 static JSValueRef setViewModeMediaFeatureCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1452 // Has mac implementation
1453 if (argumentCount < 1)
1454 return JSValueMakeUndefined(context);
1456 JSRetainPtr<JSStringRef> mode(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1457 ASSERT(!*exception);
1459 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1460 controller->setViewModeMediaFeature(mode.get());
1462 return JSValueMakeUndefined(context);
1465 static JSValueRef setWillSendRequestClearHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1467 // Has mac & windows implementation
1468 if (argumentCount < 1)
1469 return JSValueMakeUndefined(context);
1471 JSRetainPtr<JSStringRef> header(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1472 ASSERT(!*exception);
1474 size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get());
1475 char* headerBuffer = new char[maxLength + 1];
1476 JSStringGetUTF8CString(header.get(), headerBuffer, maxLength + 1);
1478 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1479 controller->setWillSendRequestClearHeader(headerBuffer);
1481 return JSValueMakeUndefined(context);
1484 static JSValueRef setWillSendRequestReturnsNullCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1486 // Has cross-platform implementation
1487 if (argumentCount < 1)
1488 return JSValueMakeUndefined(context);
1490 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1491 controller->setWillSendRequestReturnsNull(JSValueToBoolean(context, arguments[0]));
1493 return JSValueMakeUndefined(context);
1496 static JSValueRef setWillSendRequestReturnsNullOnRedirectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1498 // Has cross-platform implementation
1499 if (argumentCount < 1)
1500 return JSValueMakeUndefined(context);
1502 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1503 controller->setWillSendRequestReturnsNullOnRedirect(JSValueToBoolean(context, arguments[0]));
1505 return JSValueMakeUndefined(context);
1508 static JSValueRef setWindowIsKeyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1510 // Has mac implementation
1511 if (argumentCount < 1)
1512 return JSValueMakeUndefined(context);
1514 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1515 controller->setWindowIsKey(JSValueToBoolean(context, arguments[0]));
1517 return JSValueMakeUndefined(context);
1520 static JSValueRef waitUntilDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1522 // Has mac & windows implementation
1523 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1524 controller->setWaitToDump(true);
1526 return JSValueMakeUndefined(context);
1529 static JSValueRef windowCountCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1531 // Has mac implementation
1532 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1533 int windows = controller->windowCount();
1534 return JSValueMakeNumber(context, windows);
1537 static JSValueRef setPopupBlockingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1539 // Has mac & windows implementation
1540 if (argumentCount < 1)
1541 return JSValueMakeUndefined(context);
1543 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1544 controller->setPopupBlockingEnabled(JSValueToBoolean(context, arguments[0]));
1546 return JSValueMakeUndefined(context);
1549 static JSValueRef setPluginsEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1551 // Has mac & windows implementation
1552 if (argumentCount < 1)
1553 return JSValueMakeUndefined(context);
1555 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1556 controller->setPluginsEnabled(JSValueToBoolean(context, arguments[0]));
1558 return JSValueMakeUndefined(context);
1561 static JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1563 if (argumentCount < 1)
1564 return JSValueMakeUndefined(context);
1566 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1567 controller->setSmartInsertDeleteEnabled(JSValueToBoolean(context, arguments[0]));
1568 return JSValueMakeUndefined(context);
1571 static JSValueRef setSelectTrailingWhitespaceEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1573 if (argumentCount < 1)
1574 return JSValueMakeUndefined(context);
1576 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1577 controller->setSelectTrailingWhitespaceEnabled(JSValueToBoolean(context, arguments[0]));
1578 return JSValueMakeUndefined(context);
1581 static JSValueRef setStopProvisionalFrameLoadsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1583 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1584 controller->setStopProvisionalFrameLoads(true);
1585 return JSValueMakeUndefined(context);
1588 static JSValueRef setAsynchronousSpellCheckingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1590 if (argumentCount < 1)
1591 return JSValueMakeUndefined(context);
1593 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1594 controller->setAsynchronousSpellCheckingEnabled(JSValueToBoolean(context, arguments[0]));
1595 return JSValueMakeUndefined(context);
1598 static JSValueRef showWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1600 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1601 controller->showWebInspector();
1602 return JSValueMakeUndefined(context);
1605 static JSValueRef closeWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1607 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1608 controller->setTimelineProfilingEnabled(false);
1609 controller->closeWebInspector();
1610 return JSValueMakeUndefined(context);
1613 static JSValueRef evaluateInWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1615 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1616 double callId = JSValueToNumber(context, arguments[0], exception);
1617 ASSERT(!*exception);
1618 JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1619 ASSERT(!*exception);
1621 controller->evaluateInWebInspector(static_cast<long>(callId), script.get());
1622 return JSValueMakeUndefined(context);
1625 static JSValueRef evaluateScriptInIsolatedWorldCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1627 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1628 double worldID = JSValueToNumber(context, arguments[0], exception);
1629 ASSERT(!*exception);
1630 JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1631 ASSERT(!*exception);
1633 controller->evaluateScriptInIsolatedWorld(static_cast<unsigned>(worldID), JSContextGetGlobalObject(context), script.get());
1634 return JSValueMakeUndefined(context);
1637 static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1639 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1640 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1641 ASSERT(!*exception);
1643 bool autoCompletes = controller->elementDoesAutoCompleteForElementWithId(elementId.get());
1645 return JSValueMakeBoolean(context, autoCompletes);
1648 static JSValueRef pauseAnimationAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1650 if (argumentCount != 3)
1651 return JSValueMakeUndefined(context);
1653 JSRetainPtr<JSStringRef> animationName(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1654 ASSERT(!*exception);
1655 double time = JSValueToNumber(context, arguments[1], exception);
1656 ASSERT(!*exception);
1657 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1658 ASSERT(!*exception);
1660 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1661 return JSValueMakeBoolean(context, controller->pauseAnimationAtTimeOnElementWithId(animationName.get(), time, elementId.get()));
1664 static JSValueRef pauseTransitionAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1666 if (argumentCount != 3)
1667 return JSValueMakeUndefined(context);
1669 JSRetainPtr<JSStringRef> propertyName(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1670 ASSERT(!*exception);
1671 double time = JSValueToNumber(context, arguments[1], exception);
1672 ASSERT(!*exception);
1673 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1674 ASSERT(!*exception);
1676 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1677 return JSValueMakeBoolean(context, controller->pauseTransitionAtTimeOnElementWithId(propertyName.get(), time, elementId.get()));
1680 static JSValueRef sampleSVGAnimationForElementAtTimeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1682 if (argumentCount != 3)
1683 return JSValueMakeUndefined(context);
1685 JSRetainPtr<JSStringRef> animationId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1686 ASSERT(!*exception);
1687 double time = JSValueToNumber(context, arguments[1], exception);
1688 ASSERT(!*exception);
1689 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1690 ASSERT(!*exception);
1692 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1693 return JSValueMakeBoolean(context, controller->sampleSVGAnimationForElementAtTime(animationId.get(), time, elementId.get()));
1696 static JSValueRef numberOfActiveAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1698 if (argumentCount != 0)
1699 return JSValueMakeUndefined(context);
1701 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1702 return JSValueMakeNumber(context, controller->numberOfActiveAnimations());
1705 static JSValueRef suspendAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1707 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1708 controller->suspendAnimations();
1709 return JSValueMakeUndefined(context);
1712 static JSValueRef resumeAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1714 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1715 controller->resumeAnimations();
1716 return JSValueMakeUndefined(context);
1719 static JSValueRef waitForPolicyDelegateCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
1721 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1722 controller->waitForPolicyDelegate();
1723 return JSValueMakeUndefined(context);
1726 static JSValueRef addOriginAccessWhitelistEntryCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1728 if (argumentCount != 4)
1729 return JSValueMakeUndefined(context);
1731 JSRetainPtr<JSStringRef> sourceOrigin(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1732 ASSERT(!*exception);
1733 JSRetainPtr<JSStringRef> destinationProtocol(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1734 ASSERT(!*exception);
1735 JSRetainPtr<JSStringRef> destinationHost(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1736 ASSERT(!*exception);
1737 bool allowDestinationSubdomains = JSValueToBoolean(context, arguments[3]);
1739 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1740 controller->addOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains);
1741 return JSValueMakeUndefined(context);
1744 static JSValueRef removeOriginAccessWhitelistEntryCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1746 if (argumentCount != 4)
1747 return JSValueMakeUndefined(context);
1749 JSRetainPtr<JSStringRef> sourceOrigin(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1750 ASSERT(!*exception);
1751 JSRetainPtr<JSStringRef> destinationProtocol(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1752 ASSERT(!*exception);
1753 JSRetainPtr<JSStringRef> destinationHost(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1754 ASSERT(!*exception);
1755 bool allowDestinationSubdomains = JSValueToBoolean(context, arguments[3]);
1757 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1758 controller->removeOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains);
1759 return JSValueMakeUndefined(context);
1762 static JSValueRef setScrollbarPolicyCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1764 if (argumentCount != 2)
1765 return JSValueMakeUndefined(context);
1767 JSRetainPtr<JSStringRef> orientation(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1768 ASSERT(!*exception);
1769 JSRetainPtr<JSStringRef> policy(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1770 ASSERT(!*exception);
1772 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1773 controller->setScrollbarPolicy(orientation.get(), policy.get());
1774 return JSValueMakeUndefined(context);
1777 static JSValueRef addUserScriptCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1779 if (argumentCount != 3)
1780 return JSValueMakeUndefined(context);
1782 JSRetainPtr<JSStringRef> source(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1783 ASSERT(!*exception);
1784 bool runAtStart = JSValueToBoolean(context, arguments[1]);
1785 bool allFrames = JSValueToBoolean(context, arguments[2]);
1787 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1788 controller->addUserScript(source.get(), runAtStart, allFrames);
1789 return JSValueMakeUndefined(context);
1792 static JSValueRef addUserStyleSheetCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1794 if (argumentCount != 2)
1795 return JSValueMakeUndefined(context);
1797 JSRetainPtr<JSStringRef> source(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1798 ASSERT(!*exception);
1799 bool allFrames = JSValueToBoolean(context, arguments[1]);
1801 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1802 controller->addUserStyleSheet(source.get(), allFrames);
1803 return JSValueMakeUndefined(context);
1806 static JSValueRef setShouldPaintBrokenImageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1808 // Has Mac implementation
1809 if (argumentCount < 1)
1810 return JSValueMakeUndefined(context);
1812 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1813 controller->setShouldPaintBrokenImage(JSValueToBoolean(context, arguments[0]));
1815 return JSValueMakeUndefined(context);
1818 static JSValueRef apiTestNewWindowDataLoadBaseURLCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1820 if (argumentCount != 2)
1821 return JSValueMakeUndefined(context);
1823 JSRetainPtr<JSStringRef> utf8Data(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1824 ASSERT(!*exception);
1826 JSRetainPtr<JSStringRef> baseURL(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1827 ASSERT(!*exception);
1829 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1830 controller->apiTestNewWindowDataLoadBaseURL(utf8Data.get(), baseURL.get());
1831 return JSValueMakeUndefined(context);
1834 static JSValueRef apiTestGoToCurrentBackForwardItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1836 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1837 controller->apiTestGoToCurrentBackForwardItem();
1838 return JSValueMakeUndefined(context);
1841 static JSValueRef setWebViewEditableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1843 // Has Mac implementation
1844 if (argumentCount < 1)
1845 return JSValueMakeUndefined(context);
1847 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1848 controller->setWebViewEditable(JSValueToBoolean(context, arguments[0]));
1850 return JSValueMakeUndefined(context);
1854 static JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1856 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1857 controller->abortModal();
1858 return JSValueMakeUndefined(context);
1861 static JSValueRef hasSpellingMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1863 if (argumentCount != 2)
1864 return JSValueMakeUndefined(context);
1866 int from = JSValueToNumber(context, arguments[0], 0);
1867 int length = JSValueToNumber(context, arguments[1], 0);
1868 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1869 bool ok = controller->hasSpellingMarker(from, length);
1871 return JSValueMakeBoolean(context, ok);
1874 static JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1876 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1877 if (argumentCount < 1)
1878 return JSValueMakeUndefined(context);
1879 return JSValueMakeString(context, controller->markerTextForListItem(context, arguments[0]).get());
1882 static JSValueRef authenticateSessionCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1884 // authenticateSession(url, username, password)
1885 if (argumentCount != 3)
1886 return JSValueMakeUndefined(context);
1888 JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1889 ASSERT(!*exception);
1890 JSRetainPtr<JSStringRef> username(Adopt, JSValueToStringCopy(context, arguments[1], exception));
1891 ASSERT(!*exception);
1892 JSRetainPtr<JSStringRef> password(Adopt, JSValueToStringCopy(context, arguments[2], exception));
1893 ASSERT(!*exception);
1895 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1896 controller->authenticateSession(url.get(), username.get(), password.get());
1897 return JSValueMakeUndefined(context);
1900 static JSValueRef setEditingBehaviorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1902 // The editing behavior string.
1903 if (argumentCount < 1)
1904 return JSValueMakeUndefined(context);
1906 JSRetainPtr<JSStringRef> editingBehavior(Adopt, JSValueToStringCopy(context, arguments[0], exception));
1907 ASSERT(!*exception);
1909 size_t maxLength = JSStringGetMaximumUTF8CStringSize(editingBehavior.get());
1910 char* behaviorBuffer = new char[maxLength + 1];
1911 JSStringGetUTF8CString(editingBehavior.get(), behaviorBuffer, maxLength);
1913 if (strcmp(behaviorBuffer, "mac") && strcmp(behaviorBuffer, "win") && strcmp(behaviorBuffer, "unix")) {
1914 JSRetainPtr<JSStringRef> invalidArgument(JSStringCreateWithUTF8CString("Passed invalid editing behavior. Must be 'mac', 'win', or 'unix'."));
1915 *exception = JSValueMakeString(context, invalidArgument.get());
1916 return JSValueMakeUndefined(context);
1919 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1920 controller->setEditingBehavior(behaviorBuffer);
1922 delete [] behaviorBuffer;
1924 return JSValueMakeUndefined(context);
1927 static JSValueRef setSerializeHTTPLoadsCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1929 bool serialize = true;
1930 if (argumentCount == 1)
1931 serialize = JSValueToBoolean(context, arguments[0]);
1933 LayoutTestController::setSerializeHTTPLoads(serialize);
1934 return JSValueMakeUndefined(context);
1939 static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
1941 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1942 return JSValueMakeBoolean(context, controller->globalFlag());
1945 static JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
1947 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1948 return JSValueMakeNumber(context, controller->webHistoryItemCount());
1951 static JSValueRef getWorkerThreadCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
1953 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1954 return JSValueMakeNumber(context, controller->workerThreadCount());
1957 static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
1959 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1960 controller->setGlobalFlag(JSValueToBoolean(context, value));
1964 static JSValueRef setMinimumTimerIntervalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
1966 if (argumentCount < 1)
1967 return JSValueMakeUndefined(context);
1969 double minimum = JSValueToNumber(context, arguments[0], exception);
1970 ASSERT(!*exception);
1972 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
1973 controller->setMinimumTimerInterval(minimum);
1975 return JSValueMakeUndefined(context);
1978 static void layoutTestControllerObjectFinalize(JSObjectRef object)
1980 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(object));
1981 controller->deref();
1986 void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
1988 JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController"));
1991 JSClassRef classRef = getJSClass();
1992 JSValueRef layoutTestContollerObject = JSObjectMake(context, classRef, this);
1993 JSClassRelease(classRef);
1995 JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
1998 JSClassRef LayoutTestController::getJSClass()
2000 static JSStaticValue* staticValues = LayoutTestController::staticValues();
2001 static JSStaticFunction* staticFunctions = LayoutTestController::staticFunctions();
2002 static JSClassDefinition classDefinition = {
2003 0, kJSClassAttributeNone, "LayoutTestController", 0, staticValues, staticFunctions,
2004 0, layoutTestControllerObjectFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0
2007 return JSClassCreate(&classDefinition);
2010 JSStaticValue* LayoutTestController::staticValues()
2012 static JSStaticValue staticValues[] = {
2013 { "globalFlag", getGlobalFlagCallback, setGlobalFlagCallback, kJSPropertyAttributeNone },
2014 { "webHistoryItemCount", getWebHistoryItemCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2015 { "workerThreadCount", getWorkerThreadCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2018 return staticValues;
2021 JSStaticFunction* LayoutTestController::staticFunctions()
2023 static JSStaticFunction staticFunctions[] = {
2024 { "abortModal", abortModalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2025 { "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2026 { "addURLToRedirect", addURLToRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2027 { "addUserScript", addUserScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2028 { "addUserStyleSheet", addUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2029 { "apiTestNewWindowDataLoadBaseURL", apiTestNewWindowDataLoadBaseURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2030 { "apiTestGoToCurrentBackForwardItem", apiTestGoToCurrentBackForwardItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2031 { "callShouldCloseOnWebView", callShouldCloseOnWebViewCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2032 { "clearAllApplicationCaches", clearAllApplicationCachesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2033 { "clearAllDatabases", clearAllDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2034 { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2035 { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2036 { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2037 { "computedStyleIncludingVisitedInfo", computedStyleIncludingVisitedInfoCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2038 { "nodesFromRect", nodesFromRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2039 { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2040 { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2041 { "dispatchPendingLoadRequests", dispatchPendingLoadRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2042 { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2043 { "displayInvalidatedRegion", displayInvalidatedRegionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2044 { "dumpApplicationCacheDelegateCallbacks", dumpApplicationCacheDelegateCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2045 { "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2046 { "dumpBackForwardList", dumpBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2047 { "dumpChildFrameScrollPositions", dumpChildFrameScrollPositionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2048 { "dumpChildFramesAsText", dumpChildFramesAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2049 { "dumpConfigurationForViewport", dumpConfigurationForViewportCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2050 { "dumpDOMAsWebArchive", dumpDOMAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2051 { "dumpDatabaseCallbacks", dumpDatabaseCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2052 { "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2053 { "dumpFrameLoadCallbacks", dumpFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2054 { "dumpUserGestureInFrameLoadCallbacks", dumpUserGestureInFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2055 { "dumpResourceLoadCallbacks", dumpResourceLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2056 { "dumpResourceResponseMIMETypes", dumpResourceResponseMIMETypesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2057 { "dumpSelectionRect", dumpSelectionRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2058 { "dumpSourceAsWebArchive", dumpSourceAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2059 { "dumpStatusCallbacks", dumpStatusCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2060 { "dumpTitleChanges", dumpTitleChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2061 { "dumpIconChanges", dumpIconChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2062 { "dumpWillCacheResponse", dumpWillCacheResponseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2063 { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2064 { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2065 { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2066 { "evaluateScriptInIsolatedWorld", evaluateScriptInIsolatedWorldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2067 { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2068 { "findString", findStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2069 { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2070 { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2071 { "hasSpellingMarker", hasSpellingMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2072 { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2073 { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2074 { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2075 { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2076 { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2077 { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2078 { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2079 { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2080 { "suspendAnimations", suspendAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2081 { "resumeAnimations", resumeAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2082 { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2083 { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2084 { "pageSizeAndMarginsInPixels", pageSizeAndMarginsInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2085 { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2086 { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2087 { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2088 { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2089 { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2090 { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2091 { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2092 { "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2093 { "queueLoad", queueLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2094 { "queueLoadHTMLString", queueLoadHTMLStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2095 { "queueLoadingScript", queueLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2096 { "queueNonLoadingScript", queueNonLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2097 { "queueReload", queueReloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2098 { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2099 { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2100 { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2101 { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2102 { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2103 { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2104 { "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2105 { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2106 { "setApplicationCacheOriginQuota", setApplicationCacheOriginQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2107 { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2108 { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2109 { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2110 { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2111 { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2112 { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2113 { "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2114 { "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2115 { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2116 { "setDeferMainResourceDataLoad", setDeferMainResourceDataLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2117 { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2118 { "setEditingBehavior", setEditingBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2119 { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2120 { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2121 { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2122 { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2123 { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2124 { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2125 { "setMinimumTimerInterval", setMinimumTimerIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2126 { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2127 { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2128 { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2129 { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2130 { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2131 { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2132 { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2133 { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2134 { "setPluginsEnabled", setPluginsEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2135 { "setPrinting", setPrintingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2136 { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2137 { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2138 { "setSerializeHTTPLoads", setSerializeHTTPLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2139 { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2140 { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2141 { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2142 { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2143 { "setTimelineProfilingEnabled", setTimelineProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2144 { "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2145 { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2146 { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2147 { "setValueForUser", setValueForUserCallback, kJSPropertyAttributeDontDelete },
2148 { "setViewModeMediaFeature", setViewModeMediaFeatureCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2149 { "setWebViewEditable", setWebViewEditableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2150 { "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2151 { "setWillSendRequestReturnsNull", setWillSendRequestReturnsNullCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2152 { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2153 { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2154 { "setJavaScriptCanAccessClipboard", setJavaScriptCanAccessClipboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2155 { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2156 { "setAsynchronousSpellCheckingEnabled", setAsynchronousSpellCheckingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2157 { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2158 { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2159 { "testRepaint", testRepaintCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2160 { "waitForPolicyDelegate", waitForPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2161 { "waitUntilDone", waitUntilDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2162 { "windowCount", windowCountCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2163 { "addOriginAccessWhitelistEntry", addOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2164 { "setScrollbarPolicy", setScrollbarPolicyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2165 { "authenticateSession", authenticateSessionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2166 { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
2170 return staticFunctions;
2173 void LayoutTestController::queueLoadHTMLString(JSStringRef content, JSStringRef baseURL)
2175 WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL));
2178 void LayoutTestController::queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL)
2180 WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, unreachableURL));
2183 void LayoutTestController::queueBackNavigation(int howFarBack)
2185 WorkQueue::shared()->queue(new BackItem(howFarBack));
2188 void LayoutTestController::queueForwardNavigation(int howFarForward)
2190 WorkQueue::shared()->queue(new ForwardItem(howFarForward));
2193 void LayoutTestController::queueLoadingScript(JSStringRef script)
2195 WorkQueue::shared()->queue(new LoadingScriptItem(script));
2198 void LayoutTestController::queueNonLoadingScript(JSStringRef script)
2200 WorkQueue::shared()->queue(new NonLoadingScriptItem(script));
2203 void LayoutTestController::queueReload()
2205 WorkQueue::shared()->queue(new ReloadItem);
2208 void LayoutTestController::grantDesktopNotificationPermission(JSStringRef origin)
2210 m_desktopNotificationAllowedOrigins.push_back(JSStringRetain(origin));
2213 bool LayoutTestController::checkDesktopNotificationPermission(JSStringRef origin)
2215 std::vector<JSStringRef>::iterator i;
2216 for (i = m_desktopNotificationAllowedOrigins.begin();
2217 i != m_desktopNotificationAllowedOrigins.end();
2219 if (JSStringIsEqual(*i, origin))
2225 void LayoutTestController::waitToDumpWatchdogTimerFired()
2227 const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
2228 fprintf(stderr, "%s", message);
2229 fprintf(stdout, "%s", message);
2233 void LayoutTestController::setGeolocationPermissionCommon(bool allow)
2235 m_isGeolocationPermissionSet = true;
2236 m_geolocationPermission = allow;
2239 void LayoutTestController::setPOSIXLocale(JSStringRef locale)
2242 JSStringGetUTF8CString(locale, localeBuf, sizeof(localeBuf));
2243 setlocale(LC_ALL, localeBuf);
2246 void LayoutTestController::addURLToRedirect(std::string origin, std::string destination)
2248 m_URLsToRedirect[origin] = destination;
2251 const std::string& LayoutTestController::redirectionDestinationForURL(std::string origin)
2253 return m_URLsToRedirect[origin];
2256 void LayoutTestController::setShouldPaintBrokenImage(bool shouldPaintBrokenImage)
2258 m_shouldPaintBrokenImage = shouldPaintBrokenImage;
2261 const unsigned LayoutTestController::maxViewWidth = 800;
2262 const unsigned LayoutTestController::maxViewHeight = 600;