1563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark/* 265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch * Copyright (C) 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. 3f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch * Copyright (C) 2010 Joone Hur <joone@kldp.org> 4563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 5563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * Redistribution and use in source and binary forms, with or without 6563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * modification, are permitted provided that the following conditions 7563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * are met: 8563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 9563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 1. Redistributions of source code must retain the above copyright 10563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * notice, this list of conditions and the following disclaimer. 11563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 2. Redistributions in binary form must reproduce the above copyright 12563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * notice, this list of conditions and the following disclaimer in the 13563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * documentation and/or other materials provided with the distribution. 14563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * its contributors may be used to endorse or promote products derived 16563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * from this software without specific prior written permission. 17563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * 18563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark */ 29563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 30563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include "config.h" 31563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include "LayoutTestController.h" 32563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch#include "WorkQueue.h" 340bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch#include "WorkQueueItem.h" 35e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block#include <cstring> 36cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block#include <JavaScriptCore/JSContextRef.h> 37563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include <JavaScriptCore/JSObjectRef.h> 38563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include <JavaScriptCore/JSRetainPtr.h> 39231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <stdio.h> 40563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include <wtf/Assertions.h> 41563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark#include <wtf/MathExtras.h> 422bde8e466a4451c7319e3a072d118917957d6554Steve Block#include <wtf/OwnArrayPtr.h> 43231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <wtf/RefPtr.h> 44563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 45563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkLayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash) 46dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch : m_dumpApplicationCacheDelegateCallbacks(false) 472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_dumpAsAudio(false) 48dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch , m_dumpAsPDF(false) 49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpAsText(false) 50563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpBackForwardList(false) 51563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpChildFrameScrollPositions(false) 52563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpChildFramesAsText(false) 53563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpDOMAsWebArchive(false) 54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpDatabaseCallbacks(false) 55231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpEditingCallbacks(false) 56231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpFrameLoadCallbacks(false) 57e14391e94c850b8bd03680c23b38978db68687a8John Reck , m_dumpUserGestureInFrameLoadCallbacks(false) 58cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block , m_dumpHistoryDelegateCallbacks(false) 59231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpResourceLoadCallbacks(false) 60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_dumpResourceResponseMIMETypes(false) 61563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpSelectionRect(false) 62563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpSourceAsWebArchive(false) 63563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpStatusCallbacks(false) 64563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_dumpTitleChanges(false) 6521939df44de1705786c545cd1bf519d47250322dBen Murdoch , m_dumpIconChanges(false) 66cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block , m_dumpVisitedLinksCallback(false) 670bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch , m_dumpWillCacheResponse(false) 68967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch , m_generatePixelResults(true) 69563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_callCloseOnWebViews(true) 70563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_canOpenWindows(false) 71563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_closeRemainingWindowsWhenComplete(true) 725e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block , m_newWindowsCopyBackForwardList(false) 73563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_stopProvisionalFrameLoads(false) 74563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_testOnscreen(false) 75563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_testRepaint(false) 76563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_testRepaintSweepHorizontally(false) 77563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_waitToDump(false) 78d0825bca7fe65beaee391d30da42e937db621564Steve Block , m_willSendRequestReturnsNull(false) 790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch , m_willSendRequestReturnsNullOnRedirect(false) 80563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_windowIsKey(true) 81231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_alwaysAcceptCookies(false) 82563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_globalFlag(false) 83231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_isGeolocationPermissionSet(false) 84231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block , m_geolocationPermission(false) 85dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block , m_handlesAuthenticationChallenges(false) 8621939df44de1705786c545cd1bf519d47250322dBen Murdoch , m_isPrinting(false) 87967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch , m_deferMainResourceDataLoad(true) 8881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch , m_shouldPaintBrokenImage(true) 89563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_testPathOrURL(testPathOrURL) 90563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark , m_expectedPixelHash(expectedPixelHash) 91563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 92563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 93563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 9406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian MonsenPassRefPtr<LayoutTestController> LayoutTestController::create(const std::string& testPathOrURL, const std::string& expectedPixelHash) 9506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 9606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return adoptRef(new LayoutTestController(testPathOrURL, expectedPixelHash)); 9706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 9806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 99563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Static Functions 100563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 101dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochstatic JSValueRef dumpApplicationCacheDelegateCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 102dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 103dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 104dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch controller->setDumpApplicationCacheDelegateCallbacks(true); 105dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 106dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 107dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef dumpAsPDFCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 109563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setDumpAsPDF(true); 112563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 113563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 114563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 115231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef dumpAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 116563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setDumpAsText(true); 119967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 120967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch // Optional paramater, describing whether it's allowed to dump pixel results in dumpAsText mode. 121967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch controller->setGeneratePixelResults(argumentCount > 0 ? JSValueToBoolean(context, arguments[0]) : false); 122967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 123563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 124563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 125563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 126563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 127563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 129563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpBackForwardList(true); 130563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 131563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 132563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 133563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpChildFramesAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 134563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 136563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpChildFramesAsText(true); 137563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 138563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 139563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 140563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpChildFrameScrollPositionsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 141563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 143563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpChildFrameScrollPositions(true); 144563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 145563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 146563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 147f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef dumpConfigurationForViewportCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 148f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{ 149f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (argumentCount < 2) 150f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 151f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 15281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 15381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double deviceDPI = JSValueToNumber(context, arguments[0], exception); 15481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch ASSERT(!*exception); 15581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double deviceWidth = JSValueToNumber(context, arguments[1], exception); 15681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch ASSERT(!*exception); 15781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double deviceHeight = JSValueToNumber(context, arguments[2], exception); 158f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch ASSERT(!*exception); 15981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double availableWidth = JSValueToNumber(context, arguments[3], exception); 16081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch ASSERT(!*exception); 16181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double availableHeight = JSValueToNumber(context, arguments[4], exception); 162f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch ASSERT(!*exception); 163f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 164f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 16581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch controller->dumpConfigurationForViewport(static_cast<int>(deviceDPI), static_cast<int>(deviceWidth), static_cast<int>(deviceHeight), static_cast<int>(availableWidth), static_cast<int>(availableHeight)); 16681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 167f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 168f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch} 169f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 170563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpDatabaseCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 171563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1720bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 173563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpDatabaseCallbacks(true); 174563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 175563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 176563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 177563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpDOMAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 178563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 180563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpDOMAsWebArchive(true); 181563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 182563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 183563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 184563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpEditingCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 185563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1860bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 187563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpEditingCallbacks(true); 188563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 189563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 190563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 191231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef dumpFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 192231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 193231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 194231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setDumpFrameLoadCallbacks(true); 195231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 196231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 197231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 198e14391e94c850b8bd03680c23b38978db68687a8John Reckstatic JSValueRef dumpUserGestureInFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 199e14391e94c850b8bd03680c23b38978db68687a8John Reck{ 200e14391e94c850b8bd03680c23b38978db68687a8John Reck LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 201e14391e94c850b8bd03680c23b38978db68687a8John Reck controller->setDumpUserGestureInFrameLoadCallbacks(true); 202e14391e94c850b8bd03680c23b38978db68687a8John Reck return JSValueMakeUndefined(context); 203e14391e94c850b8bd03680c23b38978db68687a8John Reck} 204e14391e94c850b8bd03680c23b38978db68687a8John Reck 205563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpResourceLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 206563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2070bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 208563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpResourceLoadCallbacks(true); 209563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 210563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 211563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2120bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef dumpResourceResponseMIMETypesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 2140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->setDumpResourceResponseMIMETypes(true); 2160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 2170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 2180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 219563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpSelectionRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 220563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 222563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpSelectionRect(true); 223563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 224563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 225563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 226563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpSourceAsWebArchiveCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 227563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 229563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpSourceAsWebArchive(true); 230563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 231563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 232563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 233563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpStatusCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 234563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 236563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpStatusCallbacks(true); 237563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 238563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 239563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 240563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef dumpTitleChangesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 241563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 243563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDumpTitleChanges(true); 244563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 245563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 246563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 24721939df44de1705786c545cd1bf519d47250322dBen Murdochstatic JSValueRef dumpIconChangesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 24821939df44de1705786c545cd1bf519d47250322dBen Murdoch{ 24921939df44de1705786c545cd1bf519d47250322dBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 25021939df44de1705786c545cd1bf519d47250322dBen Murdoch controller->setDumpIconChanges(true); 25121939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 25221939df44de1705786c545cd1bf519d47250322dBen Murdoch} 25321939df44de1705786c545cd1bf519d47250322dBen Murdoch 2540bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef dumpWillCacheResponseCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 2560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2570bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->setDumpWillCacheResponse(true); 2580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 2590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 2600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 261563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef pathToLocalResourceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 262563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 263563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 264563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 265563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2660bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 267563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> localPath(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 268563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 269563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 270563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> convertedPath(Adopt, controller->pathToLocalResource(context, localPath.get())); 271563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (!convertedPath) 272563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 273563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 274563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeString(context, convertedPath.get()); 275563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 276563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 277cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Blockstatic JSValueRef removeAllVisitedLinksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 278cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block{ 279cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 280cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block controller->setDumpVisitedLinksCallback(true); 281cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block controller->removeAllVisitedLinks(); 282cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeUndefined(context); 283cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block} 284cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 285563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef repaintSweepHorizontallyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 286563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2870bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 288563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setTestRepaintSweepHorizontally(true); 289563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 290563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 291563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 292563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setCallCloseOnWebViewsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 293563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 294563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 295563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 296563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 298563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setCallCloseOnWebViews(JSValueToBoolean(context, arguments[0])); 299563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 300563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 301563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 302563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setCanOpenWindowsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 303563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 3040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 305563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setCanOpenWindows(true); 306563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 307563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 308563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 309563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setCloseRemainingWindowsWhenCompleteCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 310563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 311563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 312563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 313563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 3140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 315563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setCloseRemainingWindowsWhenComplete(JSValueToBoolean(context, arguments[0])); 316563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 317563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 318563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 3192daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochstatic JSValueRef setEncodedAudioDataCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 3202daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 3212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch if (argumentCount < 1) 3222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return JSValueMakeUndefined(context); 3232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 3242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch JSRetainPtr<JSStringRef> encodedAudioData(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 3252daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch ASSERT(!*exception); 3262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 3272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch size_t maxLength = JSStringGetMaximumUTF8CStringSize(encodedAudioData.get()); 3282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch OwnArrayPtr<char> encodedAudioDataBuffer = adoptArrayPtr(new char[maxLength + 1]); 3292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch JSStringGetUTF8CString(encodedAudioData.get(), encodedAudioDataBuffer.get(), maxLength + 1); 3302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 3312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 3322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch controller->setEncodedAudioData(encodedAudioDataBuffer.get()); 3332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch controller->setDumpAsAudio(true); 3342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 3352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return JSValueMakeUndefined(context); 3362daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 3372daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 338563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef testOnscreenCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 339563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 3400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 341563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setTestOnscreen(true); 342563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 343563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 344563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 345563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef testRepaintCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 346563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 3470bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 348563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setTestRepaint(true); 349563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 350563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 351563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 352563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef addDisallowedURLCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 353563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 354563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 355563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 356563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 357563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 358563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 359563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 360563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 3610bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 362563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->addDisallowedURL(url.get()); 363563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 364563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 365563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 366563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 36765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochstatic JSValueRef addURLToRedirectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 36865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{ 36965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch if (argumentCount < 2) 37065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch return JSValueMakeUndefined(context); 37165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 37265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch JSRetainPtr<JSStringRef> origin(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 37365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch ASSERT(!*exception); 37465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 37565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch JSRetainPtr<JSStringRef> destination(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 37665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch ASSERT(!*exception); 37765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 37865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch size_t maxLength = JSStringGetMaximumUTF8CStringSize(origin.get()); 3792bde8e466a4451c7319e3a072d118917957d6554Steve Block OwnArrayPtr<char> originBuffer = adoptArrayPtr(new char[maxLength + 1]); 3802bde8e466a4451c7319e3a072d118917957d6554Steve Block JSStringGetUTF8CString(origin.get(), originBuffer.get(), maxLength + 1); 38165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 38265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch maxLength = JSStringGetMaximumUTF8CStringSize(destination.get()); 3832bde8e466a4451c7319e3a072d118917957d6554Steve Block OwnArrayPtr<char> destinationBuffer = adoptArrayPtr(new char[maxLength + 1]); 3842bde8e466a4451c7319e3a072d118917957d6554Steve Block JSStringGetUTF8CString(destination.get(), destinationBuffer.get(), maxLength + 1); 38565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 38665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 3872bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->addURLToRedirect(originBuffer.get(), destinationBuffer.get()); 38865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 38965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch return JSValueMakeUndefined(context); 39065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch} 39165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 392dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef callShouldCloseOnWebViewCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 393dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 394dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Has mac & windows implementation 395dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 396dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 397dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeBoolean(context, controller->callShouldCloseOnWebView()); 398dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 399dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 400dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochstatic JSValueRef clearAllApplicationCachesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 401dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 402dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch // Has mac implementation 403dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 404dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch controller->clearAllApplicationCaches(); 405dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 406dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 407dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 408dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 4092bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef clearApplicationCacheForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4102bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4112bde8e466a4451c7319e3a072d118917957d6554Steve Block if (argumentCount < 1) 4122bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4132bde8e466a4451c7319e3a072d118917957d6554Steve Block 4142bde8e466a4451c7319e3a072d118917957d6554Steve Block JSRetainPtr<JSStringRef> originURL(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 4152bde8e466a4451c7319e3a072d118917957d6554Steve Block ASSERT(!*exception); 4162bde8e466a4451c7319e3a072d118917957d6554Steve Block 4172bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4182bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->clearApplicationCacheForOrigin(originURL.get()); 4192bde8e466a4451c7319e3a072d118917957d6554Steve Block 4202bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4212bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4222bde8e466a4451c7319e3a072d118917957d6554Steve Block 4232bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef originsWithApplicationCacheCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4242bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4252bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4262bde8e466a4451c7319e3a072d118917957d6554Steve Block return controller->originsWithApplicationCache(context); 4272bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4282bde8e466a4451c7319e3a072d118917957d6554Steve Block 429563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef clearAllDatabasesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 430563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 431563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 4320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 433563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->clearAllDatabases(); 434563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 435563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 436563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 437563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 4382bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef syncLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4392bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4402bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4412bde8e466a4451c7319e3a072d118917957d6554Steve Block 4422bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->syncLocalStorage(); 4432bde8e466a4451c7319e3a072d118917957d6554Steve Block 4442bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4452bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4462bde8e466a4451c7319e3a072d118917957d6554Steve Block 4472bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef observeStorageTrackerNotificationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4482bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4492bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4502bde8e466a4451c7319e3a072d118917957d6554Steve Block 4512bde8e466a4451c7319e3a072d118917957d6554Steve Block if (argumentCount < 1) 4522bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4532bde8e466a4451c7319e3a072d118917957d6554Steve Block 4542bde8e466a4451c7319e3a072d118917957d6554Steve Block unsigned numNotifications = JSValueToNumber(context, arguments[0], exception); 4552bde8e466a4451c7319e3a072d118917957d6554Steve Block 4562bde8e466a4451c7319e3a072d118917957d6554Steve Block ASSERT(!*exception); 4572bde8e466a4451c7319e3a072d118917957d6554Steve Block 4582bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->observeStorageTrackerNotifications(numNotifications); 4592bde8e466a4451c7319e3a072d118917957d6554Steve Block 4602bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4612bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4622bde8e466a4451c7319e3a072d118917957d6554Steve Block 4632bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef deleteAllLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4642bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4652bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4662bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->deleteAllLocalStorage(); 4672bde8e466a4451c7319e3a072d118917957d6554Steve Block 4682bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4692bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4702bde8e466a4451c7319e3a072d118917957d6554Steve Block 4712bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef deleteLocalStorageForOriginCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4722bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4732bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4742bde8e466a4451c7319e3a072d118917957d6554Steve Block 4752bde8e466a4451c7319e3a072d118917957d6554Steve Block if (argumentCount < 1) 4762bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4772bde8e466a4451c7319e3a072d118917957d6554Steve Block 4782bde8e466a4451c7319e3a072d118917957d6554Steve Block JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 4792bde8e466a4451c7319e3a072d118917957d6554Steve Block ASSERT(!*exception); 4802bde8e466a4451c7319e3a072d118917957d6554Steve Block 4812bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->deleteLocalStorageForOrigin(url.get()); 4822bde8e466a4451c7319e3a072d118917957d6554Steve Block 4832bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 4842bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4852bde8e466a4451c7319e3a072d118917957d6554Steve Block 4862bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef originsWithLocalStorageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 4872bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 4882bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 4892bde8e466a4451c7319e3a072d118917957d6554Steve Block return controller->originsWithLocalStorage(context); 4902bde8e466a4451c7319e3a072d118917957d6554Steve Block} 4912bde8e466a4451c7319e3a072d118917957d6554Steve Block 492563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef clearBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 493563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 494563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 4950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 496563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->clearBackForwardList(); 497563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 498563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 499563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 500563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 501563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef clearPersistentUserStyleSheetCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 502563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 503563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 5040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 505563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->clearPersistentUserStyleSheet(); 506563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 507563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 508563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 509563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 510563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef decodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 511563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 512563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 513563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 514563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 515563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 516563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 517563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 518563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 5190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 520563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> decodedHostName(Adopt, controller->copyDecodedHostName(name.get())); 521563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeString(context, decodedHostName.get()); 522563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 523563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 5240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef disableImageLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 5250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 5260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has mac implementation, needs windows implementation 5270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 5280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->disableImageLoading(); 5290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 5300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 5310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 5320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 5330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef dispatchPendingLoadRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 5340bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 5350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has mac implementation, needs windows implementation 5360bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 5370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->dispatchPendingLoadRequests(); 5380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 5390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 5400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 5410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 542563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef displayCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 543563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 544563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 5450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 546563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->display(); 547563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 548563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 549563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 550563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 5512fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockstatic JSValueRef displayInvalidatedRegionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 5522fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{ 5532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // Has mac & windows implementation 5542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 5552fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // LayoutTestController::display() only renders the invalidated region so 5562fc2651226baac27029e38c9d6ef883fa32084dbSteve Block // we can just use that. 5572fc2651226baac27029e38c9d6ef883fa32084dbSteve Block controller->display(); 5582fc2651226baac27029e38c9d6ef883fa32084dbSteve Block 5592fc2651226baac27029e38c9d6ef883fa32084dbSteve Block return JSValueMakeUndefined(context); 5602fc2651226baac27029e38c9d6ef883fa32084dbSteve Block} 5612fc2651226baac27029e38c9d6ef883fa32084dbSteve Block 562563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef encodeHostNameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 563563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 564563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 565563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 566563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 567563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 568563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 569563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 570563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 5710bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 572563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> encodedHostName(Adopt, controller->copyEncodedHostName(name.get())); 573563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeString(context, encodedHostName.get()); 574563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 575563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 576563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef execCommandCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 577563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 578563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has Mac & Windows implementations. 579563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 580563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 581563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 582563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 583563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 584563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 585563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Ignoring the second parameter (userInterface), as this command emulates a manual action. 586563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 587563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> value; 588563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount >= 3) { 589563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark value.adopt(JSValueToStringCopy(context, arguments[2], exception)); 590563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 591563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark } else 592563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark value.adopt(JSStringCreateWithUTF8CString("")); 593563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 594563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 5950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 596563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->execCommand(name.get(), value.get()); 597563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 598563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 599563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 600563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 601f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef findStringCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 602f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{ 603f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch // Has Mac implementation. 604f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (argumentCount < 2) 605f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 606f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 607f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch JSRetainPtr<JSStringRef> target(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 608f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch ASSERT(!*exception); 609f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 610f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch JSObjectRef options = JSValueToObject(context, arguments[1], exception); 611f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch ASSERT(!*exception); 612f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 613f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 614f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeBoolean(context, controller->findString(context, target.get(), options)); 615f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch} 616f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 617cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Blockstatic JSValueRef counterValueForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 618cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block{ 619cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (argumentCount < 1) 620cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeUndefined(context); 621cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 622cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 623cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (*exception) 624cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeUndefined(context); 625cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 626cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 627cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block JSRetainPtr<JSStringRef> counterValue(controller->counterValueForElementById(elementId.get())); 628cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block if (!counterValue.get()) 629cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeUndefined(context); 630cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeString(context, counterValue.get()); 631cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block} 632cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 633231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef grantDesktopNotificationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 634231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 635231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has Windows implementation 636231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 637231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 638231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 639231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 640231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 641231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->grantDesktopNotificationPermission(JSValueToStringCopy(context, arguments[0], NULL)); 642231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 643231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 644231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 645231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 646563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef isCommandEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 647563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 648563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has Mac implementation. 649563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 650563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 651563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 652563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 653563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> name(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 654563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 655563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 6560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 657563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 658563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeBoolean(context, controller->isCommandEnabled(name.get())); 659563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 660563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 661231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef overridePreferenceCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 662231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 663231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 2) 664231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 665231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 666231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> key(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 667231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 668231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> value(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 669231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 670231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 671231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 672231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->overridePreference(key.get(), value.get()); 673231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 674231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 675231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 676231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 677563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef keepWebHistoryCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 678563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 679563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 6800bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 681563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->keepWebHistory(); 682563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 683563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 684563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 685563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 686dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef computedStyleIncludingVisitedInfoCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 687dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 688dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount != 1) 689dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 690dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 691dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Has mac implementation 692dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 693dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return controller->computedStyleIncludingVisitedInfo(context, arguments[0]); 694dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 695dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 696bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsenstatic JSValueRef nodesFromRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 697bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen{ 698bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen if (argumentCount != 8) 699bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen return JSValueMakeUndefined(context); 700bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 701bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int x = JSValueToNumber(context, arguments[1], NULL); 702bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int y = JSValueToNumber(context, arguments[2], NULL); 703bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int top = static_cast<unsigned>(JSValueToNumber(context, arguments[3], NULL)); 704bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int right = static_cast<unsigned>(JSValueToNumber(context, arguments[4], NULL)); 705bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int bottom = static_cast<unsigned>(JSValueToNumber(context, arguments[5], NULL)); 706bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen int left = static_cast<unsigned>(JSValueToNumber(context, arguments[6], NULL)); 707bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen bool ignoreClipping = JSValueToBoolean(context, arguments[7]); 708bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 709bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen // Has mac implementation. 710bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 711bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen return controller->nodesFromRect(context, arguments[0], x, y, top, right, bottom, left, ignoreClipping); 712bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen} 713bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen 714dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef layerTreeAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 715dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 716dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Has mac & windows implementation 717dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 718dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeString(context, controller->layerTreeAsText().get()); 719dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 720dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 721563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 722563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 723563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 724563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 7250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 726563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->notifyDone(); 727563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 728563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 729563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 7308a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Blockstatic bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels) 7315e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block{ 732692e5dbf12901edacf14812a6fae25462920af42Steve Block pageWidthInPixels = LayoutTestController::maxViewWidth; 733692e5dbf12901edacf14812a6fae25462920af42Steve Block pageHeightInPixels = LayoutTestController::maxViewHeight; 7345e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block switch (argumentCount) { 7358a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block case 2: 7368a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception)); 7375e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block if (*exception) 7388a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return false; 7398a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); 7405e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block if (*exception) 7418a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return false; 7428a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block case 0: // Fall through. 7435e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block break; 7445e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block default: 7458a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return false; 7465e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block } 7478a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return true; 7488a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block} 7498a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 75006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen// Caller needs to delete[] propertyName. 75106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenstatic bool parsePagePropertyParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, char*& propertyName, int& pageNumber) 75206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 75306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen pageNumber = 0; 75406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen switch (argumentCount) { 75506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen case 2: 75606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen pageNumber = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); 75706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen if (*exception) 75806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return false; 75906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen // Fall through. 76006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen case 1: { 76106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 76206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen if (*exception) 76306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return false; 76406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 76506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen size_t maxLength = JSStringGetMaximumUTF8CStringSize(propertyNameString.get()); 76606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen propertyName = new char[maxLength + 1]; 76706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen JSStringGetUTF8CString(propertyNameString.get(), propertyName, maxLength + 1); 76806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return true; 76906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen } 77006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen case 0: 77106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen default: 77206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return false; 77306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen } 77406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 77506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 77606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenstatic bool parsePageNumber(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber) 77706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 77806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen pageNumber = 0; 779ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block switch (argumentCount) { 780ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 1: 781ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); 782ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 783ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 784ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 785ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 0: 786ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return true; 787ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block default: 788ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 789ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block } 790ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block} 791ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block 792ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Blockstatic 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) 793ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block{ 794ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block pageNumber = 0; 795ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block width = height = 0; 796ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block marginTop = marginRight = marginBottom = marginLeft = 0; 797ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block 798ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block switch (argumentCount) { 799ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 7: 800ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block marginLeft = static_cast<int>(JSValueToNumber(context, arguments[6], exception)); 801ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 802ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 803ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 804ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 6: 805ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block marginBottom = static_cast<int>(JSValueToNumber(context, arguments[5], exception)); 806ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 807ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 808ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 809ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 5: 810ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block marginRight = static_cast<int>(JSValueToNumber(context, arguments[4], exception)); 811ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 812ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 813ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 814ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 4: 815ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block marginTop = static_cast<int>(JSValueToNumber(context, arguments[3], exception)); 816ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 817ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 818ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 819ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 3: 820ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block height = static_cast<int>(JSValueToNumber(context, arguments[2], exception)); 821ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 822ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 823ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 824ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 2: 825ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block width = static_cast<int>(JSValueToNumber(context, arguments[1], exception)); 826ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 827ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 828ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 829ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block case 1: 830ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception)); 831ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (*exception) 832ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return false; 833ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block // Fall through. 834ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return true; 835ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block default: 83606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return false; 837ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block } 83806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 83906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 8408a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Blockstatic JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 8418a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block{ 8428a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block float pageWidthInPixels = 0; 8438a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block float pageHeightInPixels = 0; 8448a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels)) 8458a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return JSValueMakeUndefined(context); 8465e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 8475e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 8485e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block if (*exception) 8495e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block return JSValueMakeUndefined(context); 8505e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 8515e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 8525e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block int pageNumber = controller->pageNumberForElementById(elementId.get(), pageWidthInPixels, pageHeightInPixels); 8535e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block return JSValueMakeNumber(context, pageNumber); 8545e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block} 8555e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 8568a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Blockstatic JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 8578a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block{ 8588a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block float pageWidthInPixels = 0; 8598a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block float pageHeightInPixels = 0; 8608a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels)) 8618a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return JSValueMakeUndefined(context); 8628a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 8638a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 8648a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels)); 8658a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block} 8668a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 8672bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef numberOfPendingGeolocationPermissionRequestsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 8682bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 8692bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 8702bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeNumber(context, controller->numberOfPendingGeolocationPermissionRequests()); 8712bde8e466a4451c7319e3a072d118917957d6554Steve Block} 8722bde8e466a4451c7319e3a072d118917957d6554Steve Block 87306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenstatic JSValueRef pagePropertyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 87406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 87506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen char* propertyName = 0; 87606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen int pageNumber = 0; 87706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen if (!parsePagePropertyParameters(context, argumentCount, arguments, exception, propertyName, pageNumber)) 87806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return JSValueMakeUndefined(context); 87906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 88006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 88106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen JSValueRef value = JSValueMakeString(context, controller->pageProperty(propertyName, pageNumber).get()); 88206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 88306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen delete[] propertyName; 88406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return value; 88506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 88606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 88706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenstatic JSValueRef isPageBoxVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 88806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 88906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen int pageNumber = 0; 89006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber)) 89106ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return JSValueMakeUndefined(context); 89206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 89306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 89406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return JSValueMakeBoolean(context, controller->isPageBoxVisible(pageNumber)); 89506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 89606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 897ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Blockstatic JSValueRef pageSizeAndMarginsInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 89806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 89906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen int pageNumber = 0; 900ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int width = 0, height = 0; 901ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block int marginTop = 0, marginRight = 0, marginBottom = 0, marginLeft = 0; 902ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block if (!parsePageNumberSizeMarings(context, argumentCount, arguments, exception, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft)) 90306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return JSValueMakeUndefined(context); 90406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 90506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 906ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block return JSValueMakeString(context, controller->pageSizeAndMarginsInPixels(pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft).get()); 90706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 90806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 909563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 910563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 911563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 912563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 913563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 914563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 915563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 916563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark double howFarBackDouble = JSValueToNumber(context, arguments[0], exception); 917563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 918563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 9190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 920563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->queueBackNavigation(static_cast<int>(howFarBackDouble)); 921563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 922563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 923563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 924563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 925563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef queueForwardNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 926563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 927563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 928563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 929563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 930563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 931563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 932563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark double howFarForwardDouble = JSValueToNumber(context, arguments[0], exception); 933563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 934563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 9350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 936563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->queueForwardNavigation(static_cast<int>(howFarForwardDouble)); 937563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 938563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 939563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 940563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 941563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef queueLoadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 942563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 943563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 944563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 945563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 946563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 947563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 948563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 949563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 950563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 951563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> target; 952563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount >= 2) { 953563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark target.adopt(JSValueToStringCopy(context, arguments[1], exception)); 954563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 955563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark } else 956563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark target.adopt(JSStringCreateWithUTF8CString("")); 957563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 9580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 959563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->queueLoad(url.get(), target.get()); 960563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 961563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 962563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 963563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 964967717af5423377c967781471ee106e2bb4e11c8Ben Murdochstatic JSValueRef queueLoadHTMLStringCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 965967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch{ 966967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch // Has Mac & Windows implementation 967967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (argumentCount < 1) 968967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch return JSValueMakeUndefined(context); 969967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 970967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch JSRetainPtr<JSStringRef> content(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 971967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch ASSERT(!*exception); 972967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 973967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch JSRetainPtr<JSStringRef> baseURL; 974967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (argumentCount >= 2) { 975967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch baseURL.adopt(JSValueToStringCopy(context, arguments[1], exception)); 976967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch ASSERT(!*exception); 977967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch } else 978967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch baseURL.adopt(JSStringCreateWithUTF8CString("")); 979967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 980967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 981967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 98265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch if (argumentCount >= 3) { 98365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch JSRetainPtr<JSStringRef> unreachableURL; 98465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch unreachableURL.adopt(JSValueToStringCopy(context, arguments[2], exception)); 98565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch ASSERT(!*exception); 98665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch controller->queueLoadAlternateHTMLString(content.get(), baseURL.get(), unreachableURL.get()); 98765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch return JSValueMakeUndefined(context); 98865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch } 98965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 99065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch controller->queueLoadHTMLString(content.get(), baseURL.get()); 991967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch return JSValueMakeUndefined(context); 992967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch} 993967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 994563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef queueReloadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 995563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 996563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 997563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 998563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 9990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1000563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->queueReload(); 1001563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1002563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1003563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1004563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 10050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef queueLoadingScriptCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1006563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1007563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1008563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // May be able to be made platform independant by using shared WorkQueue 1009563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1010563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1011563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1012563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1013563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1014563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 10150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 10160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->queueLoadingScript(script.get()); 10170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 10180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 10190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 10200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 10210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef queueNonLoadingScriptCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 10220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 10230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has mac & windows implementation 10240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // May be able to be made platform independant by using shared WorkQueue 10250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (argumentCount < 1) 10260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 10270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 10280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 10290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(!*exception); 10300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 10310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 10320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->queueNonLoadingScript(script.get()); 1033563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1034563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1035563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1036563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1037563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setAcceptsEditingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1038563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1039563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1040563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1041563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1042563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 10430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1044563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setAcceptsEditing(JSValueToBoolean(context, arguments[0])); 1045563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1046563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1047563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1048563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1049231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setAlwaysAcceptCookiesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1050231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1051231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has mac & windows implementation 1052231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1053231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1054231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1055231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1056231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setAlwaysAcceptCookies(JSValueToBoolean(context, arguments[0])); 1057231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1058231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1059231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1060231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1061c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescustatic JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1062c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu{ 1063c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu // Has mac implementation 1064c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu if (argumentCount < 1) 1065c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu return JSValueMakeUndefined(context); 1066c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu 1067c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1068c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu 1069c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu double size = JSValueToNumber(context, arguments[0], NULL); 1070c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu if (!isnan(size)) 1071c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu controller->setAppCacheMaximumSize(static_cast<unsigned long long>(size)); 1072c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu 1073c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu return JSValueMakeUndefined(context); 1074dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 1075dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 1076dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochstatic JSValueRef setApplicationCacheOriginQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1077dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 1078dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch // Has mac implementation 1079dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch if (argumentCount < 1) 1080dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 1081c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu 1082dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1083dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 1084dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch double size = JSValueToNumber(context, arguments[0], NULL); 1085dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch if (!isnan(size)) 1086dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch controller->setApplicationCacheOriginQuota(static_cast<unsigned long long>(size)); 1087dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 1088dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 1089c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu} 1090c60802dd50f86c37e0596d41c3ef6fc2c8804da4Andrei Popescu 1091231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setAuthenticationPasswordCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1092231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1093231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has mac & windows implementation 1094231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1095231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1096231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1097231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> password(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1098231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1099231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1100231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block size_t maxLength = JSStringGetMaximumUTF8CStringSize(password.get()); 1101231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block char* passwordBuffer = new char[maxLength + 1]; 1102231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSStringGetUTF8CString(password.get(), passwordBuffer, maxLength + 1); 1103231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1104231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setAuthenticationPassword(passwordBuffer); 1106231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block delete[] passwordBuffer; 1107231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1108231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1109231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1110231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1111231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setAuthenticationUsernameCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1112231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1113231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has mac & windows implementation 1114231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1115231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1116231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1117231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> username(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1119231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1120231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block size_t maxLength = JSStringGetMaximumUTF8CStringSize(username.get()); 1121231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block char* usernameBuffer = new char[maxLength + 1]; 1122231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSStringGetUTF8CString(username.get(), usernameBuffer, maxLength + 1); 1123231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1124231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1125231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setAuthenticationUsername(usernameBuffer); 1126231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block delete[] usernameBuffer; 1127231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1128231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1129231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1130231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1131563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setAuthorAndUserStylesEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1132563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1133563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1134563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1135563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1136563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 11370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1138563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setAuthorAndUserStylesEnabled(JSValueToBoolean(context, arguments[0])); 1139563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1140563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1141563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1142563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 11432bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef setAutofilledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 11442bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 11452bde8e466a4451c7319e3a072d118917957d6554Steve Block if (argumentCount != 2 || !arguments[0]) 11462bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 11472bde8e466a4451c7319e3a072d118917957d6554Steve Block 11482bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 11492bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->setAutofilled(context, arguments[0], JSValueToBoolean(context, arguments[1])); 11502bde8e466a4451c7319e3a072d118917957d6554Steve Block 11512bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 11522bde8e466a4451c7319e3a072d118917957d6554Steve Block} 11532bde8e466a4451c7319e3a072d118917957d6554Steve Block 11540bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef setCacheModelCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 11550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 11560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has Mac implementation. 11570bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (argumentCount < 1) 11580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 11590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 11600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch int cacheModel = JSValueToNumber(context, arguments[0], exception); 11610bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch ASSERT(!*exception); 11620bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 11630bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 11640bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->setCacheModel(cacheModel); 11650bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 11660bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 11670bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 11680bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1169563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setCustomPolicyDelegateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1170563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1171563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1172563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1173563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1174563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1175563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark bool permissive = false; 1176563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount >= 2) 1177563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark permissive = JSValueToBoolean(context, arguments[1]); 1178563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 11790bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1180563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setCustomPolicyDelegate(JSValueToBoolean(context, arguments[0]), permissive); 1181563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1182563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1183563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1184563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1185563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setDatabaseQuotaCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1186563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1187563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1188563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1189563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1190563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 11910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1192563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1193563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark double quota = JSValueToNumber(context, arguments[0], NULL); 1194563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (!isnan(quota)) 1195563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setDatabaseQuota(static_cast<unsigned long long>(quota)); 1196563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1197563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1198231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1199231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1200967717af5423377c967781471ee106e2bb4e11c8Ben Murdochstatic JSValueRef setDeferMainResourceDataLoadCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1201967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch{ 1202967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch // Has Mac and Windows implementation 1203967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch if (argumentCount < 1) 1204967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch return JSValueMakeUndefined(context); 1205967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 1206967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1207967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch controller->setDeferMainResourceDataLoad(JSValueToBoolean(context, arguments[0])); 1208967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 1209967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch return JSValueMakeUndefined(context); 1210967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch} 1211967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 1212d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1213d0825bca7fe65beaee391d30da42e937db621564Steve Block{ 1214d0825bca7fe65beaee391d30da42e937db621564Steve Block // Has Mac and Windows implementation 1215d0825bca7fe65beaee391d30da42e937db621564Steve Block if (argumentCount < 2) 1216d0825bca7fe65beaee391d30da42e937db621564Steve Block return JSValueMakeUndefined(context); 1217d0825bca7fe65beaee391d30da42e937db621564Steve Block 1218d0825bca7fe65beaee391d30da42e937db621564Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1219d0825bca7fe65beaee391d30da42e937db621564Steve Block 1220d0825bca7fe65beaee391d30da42e937db621564Steve Block bool forbidden = JSValueToBoolean(context, arguments[0]); 1221d0825bca7fe65beaee391d30da42e937db621564Steve Block JSRetainPtr<JSStringRef> scheme(Adopt, JSValueToStringCopy(context, arguments[1], 0)); 1222d0825bca7fe65beaee391d30da42e937db621564Steve Block controller->setDomainRelaxationForbiddenForURLScheme(forbidden, scheme.get()); 1223d0825bca7fe65beaee391d30da42e937db621564Steve Block 1224d0825bca7fe65beaee391d30da42e937db621564Steve Block return JSValueMakeUndefined(context); 1225d0825bca7fe65beaee391d30da42e937db621564Steve Block} 1226d0825bca7fe65beaee391d30da42e937db621564Steve Block 1227db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Blockstatic JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1228db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block{ 1229db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block if (argumentCount < 6) 1230db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block return JSValueMakeUndefined(context); 1231db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 1232db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block bool canProvideAlpha = JSValueToBoolean(context, arguments[0]); 1233db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block double alpha = JSValueToNumber(context, arguments[1], exception); 1234db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block ASSERT(!*exception); 1235db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block bool canProvideBeta = JSValueToBoolean(context, arguments[2]); 1236db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block double beta = JSValueToNumber(context, arguments[3], exception); 1237db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block ASSERT(!*exception); 1238db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block bool canProvideGamma = JSValueToBoolean(context, arguments[4]); 1239db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block double gamma = JSValueToNumber(context, arguments[5], exception); 1240db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block ASSERT(!*exception); 1241db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 1242db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1243db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); 1244db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 1245db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block return JSValueMakeUndefined(context); 1246db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block} 1247db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block 1248231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1249231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1250231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 3) 1251231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1252231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1253231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1254231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setMockGeolocationPosition(JSValueToNumber(context, arguments[0], NULL), // latitude 1255231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSValueToNumber(context, arguments[1], NULL), // longitude 1256231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSValueToNumber(context, arguments[2], NULL)); // accuracy 1257231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1258231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1259231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1260231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1261231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setMockGeolocationErrorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1262231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1263231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 2) 1264231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1265231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1266231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block int code = JSValueToNumber(context, arguments[0], NULL); 1267231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> message(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1268231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1269231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1270231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1271231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setMockGeolocationError(code, message.get()); 1272231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1273231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1274231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1275231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 12764576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wangstatic JSValueRef addMockSpeechInputResultCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1277dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch{ 12784576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang if (argumentCount < 3) 1279dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 1280dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 1281dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch JSRetainPtr<JSStringRef> result(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1282dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch ASSERT(!*exception); 1283dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 12844576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang double confidence = JSValueToNumber(context, arguments[1], exception); 12854576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang 12864576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang JSRetainPtr<JSStringRef> language(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1287e14391e94c850b8bd03680c23b38978db68687a8John Reck ASSERT(!*exception); 1288e14391e94c850b8bd03680c23b38978db68687a8John Reck 1289dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 12904576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang controller->addMockSpeechInputResult(result.get(), confidence, language.get()); 1291dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 1292dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch return JSValueMakeUndefined(context); 1293dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch} 1294dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 12955e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Blockstatic JSValueRef setNewWindowsCopyBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 12965e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block{ 12975e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block // Has mac implementation 12985e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block if (argumentCount < 1) 12995e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block return JSValueMakeUndefined(context); 13005e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 13015e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 13025e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block controller->setNewWindowsCopyBackForwardList(JSValueToBoolean(context, arguments[0])); 13035e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 13045e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block return JSValueMakeUndefined(context); 13055e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block} 13065e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block 1307231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setGeolocationPermissionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1308231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1309231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has mac implementation 1310231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1311231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1312231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1313231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1314231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setGeolocationPermission(JSValueToBoolean(context, arguments[0])); 1315231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1316231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1317231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1318231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1319231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setHandlesAuthenticationChallengesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1320231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1321231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block // Has mac & windows implementation 1322231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1323231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1324231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1325231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1326231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setHandlesAuthenticationChallenges(JSValueToBoolean(context, arguments[0])); 1327231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1328231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1329231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1330231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1331231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef setPOSIXLocaleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1332231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1333231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount < 1) 1334231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1335231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1336231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1337231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> locale(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1338231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1339231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->setPOSIXLocale(locale.get()); 1340563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1341231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1342563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1343563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1344563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setIconDatabaseEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1345563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1346563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1347563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1348563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1349563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 13500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1351563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setIconDatabaseEnabled(JSValueToBoolean(context, arguments[0])); 1352563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1353563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1354563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1355563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1356563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setJavaScriptProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1357563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1358563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1359563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1360563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 13610bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1362563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setJavaScriptProfilingEnabled(JSValueToBoolean(context, arguments[0])); 1363563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1364563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1365563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1366563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1367563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setMainFrameIsFirstResponderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1368563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1369563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1370563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1371563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1372563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 13730bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1374563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setMainFrameIsFirstResponder(JSValueToBoolean(context, arguments[0])); 1375563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1376563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1377563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1378563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1379563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setPersistentUserStyleSheetLocationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1380563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1381563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1382563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1383563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1384563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1385563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> path(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1386563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1387563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 13880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1389563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setPersistentUserStyleSheetLocation(path.get()); 1390563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1391563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1392563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1393563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1394563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setPrivateBrowsingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1395563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1396563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1397563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1398563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1399563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 14000bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1401563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setPrivateBrowsingEnabled(JSValueToBoolean(context, arguments[0])); 1402563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1403563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1404563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1405563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 140621939df44de1705786c545cd1bf519d47250322dBen Murdochstatic JSValueRef setJavaScriptCanAccessClipboardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 140721939df44de1705786c545cd1bf519d47250322dBen Murdoch{ 140821939df44de1705786c545cd1bf519d47250322dBen Murdoch // Has mac & windows implementation 140921939df44de1705786c545cd1bf519d47250322dBen Murdoch if (argumentCount < 1) 141021939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 141121939df44de1705786c545cd1bf519d47250322dBen Murdoch 141221939df44de1705786c545cd1bf519d47250322dBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 141321939df44de1705786c545cd1bf519d47250322dBen Murdoch controller->setJavaScriptCanAccessClipboard(JSValueToBoolean(context, arguments[0])); 141421939df44de1705786c545cd1bf519d47250322dBen Murdoch 141521939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 141621939df44de1705786c545cd1bf519d47250322dBen Murdoch} 141721939df44de1705786c545cd1bf519d47250322dBen Murdoch 14180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 14190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 14200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has mac & windows implementation 14210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (argumentCount < 1) 14220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 14230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 14240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 14250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->setXSSAuditorEnabled(JSValueToBoolean(context, arguments[0])); 14260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 14270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 14280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 14290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1430dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef setSpatialNavigationEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1431dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1432a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch // Has mac implementation. 1433dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount < 1) 1434dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1435dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1436dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1437dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->setSpatialNavigationEnabled(JSValueToBoolean(context, arguments[0])); 1438dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1439dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1440dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1441dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 144221939df44de1705786c545cd1bf519d47250322dBen Murdochstatic JSValueRef setPrintingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 144321939df44de1705786c545cd1bf519d47250322dBen Murdoch{ 144421939df44de1705786c545cd1bf519d47250322dBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 144521939df44de1705786c545cd1bf519d47250322dBen Murdoch controller->setIsPrinting(true); 144621939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 144721939df44de1705786c545cd1bf519d47250322dBen Murdoch} 144821939df44de1705786c545cd1bf519d47250322dBen Murdoch 1449dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1450dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef setFrameFlatteningEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 14518a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block{ 14528a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block // Has mac & windows implementation 14538a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block if (argumentCount < 1) 14548a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return JSValueMakeUndefined(context); 14558a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 14568a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1457dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->setFrameFlatteningEnabled(JSValueToBoolean(context, arguments[0])); 14588a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 14598a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block return JSValueMakeUndefined(context); 14608a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block} 14618a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block 1462643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1463643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 1464643ca7872b450ea4efacab6188849e5aac2ba161Steve Block // Has mac & windows implementation 1465643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (argumentCount < 1) 1466643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeUndefined(context); 1467643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1468643ca7872b450ea4efacab6188849e5aac2ba161Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1469643ca7872b450ea4efacab6188849e5aac2ba161Steve Block controller->setAllowUniversalAccessFromFileURLs(JSValueToBoolean(context, arguments[0])); 1470643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1471643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeUndefined(context); 1472643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 1473643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1474692e5dbf12901edacf14812a6fae25462920af42Steve Blockstatic JSValueRef setAllowFileAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1475692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 1476692e5dbf12901edacf14812a6fae25462920af42Steve Block // Has mac & windows implementation 1477692e5dbf12901edacf14812a6fae25462920af42Steve Block if (argumentCount < 1) 1478692e5dbf12901edacf14812a6fae25462920af42Steve Block return JSValueMakeUndefined(context); 1479692e5dbf12901edacf14812a6fae25462920af42Steve Block 1480692e5dbf12901edacf14812a6fae25462920af42Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1481692e5dbf12901edacf14812a6fae25462920af42Steve Block controller->setAllowFileAccessFromFileURLs(JSValueToBoolean(context, arguments[0])); 1482692e5dbf12901edacf14812a6fae25462920af42Steve Block 1483692e5dbf12901edacf14812a6fae25462920af42Steve Block return JSValueMakeUndefined(context); 1484692e5dbf12901edacf14812a6fae25462920af42Steve Block} 1485692e5dbf12901edacf14812a6fae25462920af42Steve Block 1486563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1487563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1488563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1489563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1490563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1491563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 14920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1493563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setTabKeyCyclesThroughElements(JSValueToBoolean(context, arguments[0])); 1494563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1495563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1496563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1497563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1498643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef setTimelineProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1499643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 1500643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (argumentCount < 1) 1501643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeUndefined(context); 1502643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1503643ca7872b450ea4efacab6188849e5aac2ba161Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1504643ca7872b450ea4efacab6188849e5aac2ba161Steve Block controller->setTimelineProfilingEnabled(JSValueToBoolean(context, arguments[0])); 1505643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeUndefined(context); 1506643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 1507643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1508563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setUseDashboardCompatibilityModeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1509563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1510563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1511563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1512563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1513563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 15140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1515563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setUseDashboardCompatibilityMode(JSValueToBoolean(context, arguments[0])); 1516563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1517563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1518563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1519563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1520563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setUserStyleSheetEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1521563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1522563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1523563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1524563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1525563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 15260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1527563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setUserStyleSheetEnabled(JSValueToBoolean(context, arguments[0])); 1528563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1529563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1530563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1531563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1532563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setUserStyleSheetLocationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1533563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1534563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1535563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1536563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1537563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1538563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> path(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1539563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1540563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 15410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1542563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setUserStyleSheetLocation(path.get()); 1543563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1544563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1545563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1546563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 154781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochstatic JSValueRef setValueForUserCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 154881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{ 154981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // Has mac implementation 155081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch if (argumentCount != 2) 155181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 155281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 155381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch JSRetainPtr<JSStringRef> value(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 155481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch ASSERT(!*exception); 155581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 155681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 155781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch controller->setValueForUser(context, arguments[0], value.get()); 155881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 155981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 156081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch} 156181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 1562e8b154fd68f9b33be40a3590e58347f353835f5cSteve Blockstatic JSValueRef setViewModeMediaFeatureCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1563e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block{ 1564e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block // Has mac implementation 1565e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block if (argumentCount < 1) 1566e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block return JSValueMakeUndefined(context); 1567e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block 1568e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block JSRetainPtr<JSStringRef> mode(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1569e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block ASSERT(!*exception); 1570e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block 1571e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1572e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block controller->setViewModeMediaFeature(mode.get()); 1573e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block 1574e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block return JSValueMakeUndefined(context); 1575e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block} 1576e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block 1577dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef setWillSendRequestClearHeaderCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1578dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1579dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Has mac & windows implementation 1580dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount < 1) 1581dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1582dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1583dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> header(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1584dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1585dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1586dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block size_t maxLength = JSStringGetMaximumUTF8CStringSize(header.get()); 15872bde8e466a4451c7319e3a072d118917957d6554Steve Block OwnArrayPtr<char> headerBuffer = adoptArrayPtr(new char[maxLength + 1]); 15882bde8e466a4451c7319e3a072d118917957d6554Steve Block JSStringGetUTF8CString(header.get(), headerBuffer.get(), maxLength + 1); 1589dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1590dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 15912bde8e466a4451c7319e3a072d118917957d6554Steve Block controller->setWillSendRequestClearHeader(headerBuffer.get()); 1592dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1593dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1594dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1595dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1596d0825bca7fe65beaee391d30da42e937db621564Steve Blockstatic JSValueRef setWillSendRequestReturnsNullCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1597d0825bca7fe65beaee391d30da42e937db621564Steve Block{ 1598d0825bca7fe65beaee391d30da42e937db621564Steve Block // Has cross-platform implementation 1599d0825bca7fe65beaee391d30da42e937db621564Steve Block if (argumentCount < 1) 1600d0825bca7fe65beaee391d30da42e937db621564Steve Block return JSValueMakeUndefined(context); 1601d0825bca7fe65beaee391d30da42e937db621564Steve Block 1602d0825bca7fe65beaee391d30da42e937db621564Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1603d0825bca7fe65beaee391d30da42e937db621564Steve Block controller->setWillSendRequestReturnsNull(JSValueToBoolean(context, arguments[0])); 1604d0825bca7fe65beaee391d30da42e937db621564Steve Block 1605d0825bca7fe65beaee391d30da42e937db621564Steve Block return JSValueMakeUndefined(context); 1606d0825bca7fe65beaee391d30da42e937db621564Steve Block} 1607d0825bca7fe65beaee391d30da42e937db621564Steve Block 16080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef setWillSendRequestReturnsNullOnRedirectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 16090bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 16100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch // Has cross-platform implementation 16110bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch if (argumentCount < 1) 16120bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 16130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 16140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 16150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->setWillSendRequestReturnsNullOnRedirect(JSValueToBoolean(context, arguments[0])); 16160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 16170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 16180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 16190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1620563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setWindowIsKeyCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1621563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1622563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 1623563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1624563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1625563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 16260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1627563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setWindowIsKey(JSValueToBoolean(context, arguments[0])); 1628563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1629563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1630563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1631563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1632563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef waitUntilDoneCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1633563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1634563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 16350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1636563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setWaitToDump(true); 1637563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1638563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1639563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1640563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1641563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef windowCountCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1642563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1643563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac implementation 16440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1645563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark int windows = controller->windowCount(); 1646563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeNumber(context, windows); 1647563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1648563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1649563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setPopupBlockingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1650563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1651563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark // Has mac & windows implementation 1652563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1653563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1654563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 16550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1656563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setPopupBlockingEnabled(JSValueToBoolean(context, arguments[0])); 1657563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1658563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1659563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1660563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 166121939df44de1705786c545cd1bf519d47250322dBen Murdochstatic JSValueRef setPluginsEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 166221939df44de1705786c545cd1bf519d47250322dBen Murdoch{ 166321939df44de1705786c545cd1bf519d47250322dBen Murdoch // Has mac & windows implementation 166421939df44de1705786c545cd1bf519d47250322dBen Murdoch if (argumentCount < 1) 166521939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 166621939df44de1705786c545cd1bf519d47250322dBen Murdoch 166721939df44de1705786c545cd1bf519d47250322dBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 166821939df44de1705786c545cd1bf519d47250322dBen Murdoch controller->setPluginsEnabled(JSValueToBoolean(context, arguments[0])); 166921939df44de1705786c545cd1bf519d47250322dBen Murdoch 167021939df44de1705786c545cd1bf519d47250322dBen Murdoch return JSValueMakeUndefined(context); 167121939df44de1705786c545cd1bf519d47250322dBen Murdoch} 167221939df44de1705786c545cd1bf519d47250322dBen Murdoch 1673563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setSmartInsertDeleteEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1674563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1675563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1676563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1677563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 16780bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1679563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setSmartInsertDeleteEnabled(JSValueToBoolean(context, arguments[0])); 1680563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1681563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1682563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1683563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setSelectTrailingWhitespaceEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1684563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1685563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount < 1) 1686563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1687563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 16880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1689563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setSelectTrailingWhitespaceEnabled(JSValueToBoolean(context, arguments[0])); 1690563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1691563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1692563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1693563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef setStopProvisionalFrameLoadsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1694563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 16950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1696563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setStopProvisionalFrameLoads(true); 1697563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1698563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1699563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1700f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef setAsynchronousSpellCheckingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1701f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{ 1702f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (argumentCount < 1) 1703f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 1704f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 1705f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1706f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch controller->setAsynchronousSpellCheckingEnabled(JSValueToBoolean(context, arguments[0])); 1707f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 1708f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch} 1709f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 17102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochstatic JSValueRef shadowRootCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 17112daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 17122daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch if (argumentCount != 1) 17132daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return JSValueMakeUndefined(context); 17142daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 17152daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return controller->shadowRoot(context, arguments[0]); 17162daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 17172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1718231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef showWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1719231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1720231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1721231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->showWebInspector(); 1722231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1723231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1724231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1725231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef closeWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1726231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1727231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1728643ca7872b450ea4efacab6188849e5aac2ba161Steve Block controller->setTimelineProfilingEnabled(false); 1729231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->closeWebInspector(); 1730231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1731231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1732231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1733231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef evaluateInWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1734231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1735231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1736231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block double callId = JSValueToNumber(context, arguments[0], exception); 1737231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1738231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1739231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1740231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1741231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block controller->evaluateInWebInspector(static_cast<long>(callId), script.get()); 1742231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1743231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1744231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1745cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Blockstatic JSValueRef evaluateScriptInIsolatedWorldCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1746cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block{ 1747cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1748cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block double worldID = JSValueToNumber(context, arguments[0], exception); 1749cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block ASSERT(!*exception); 1750cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1751cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block ASSERT(!*exception); 1752cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 1753cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block controller->evaluateScriptInIsolatedWorld(static_cast<unsigned>(worldID), JSContextGetGlobalObject(context), script.get()); 1754cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block return JSValueMakeUndefined(context); 1755cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block} 1756cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block 1757563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1758563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 17590bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1760563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1761563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1762563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1763563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark bool autoCompletes = controller->elementDoesAutoCompleteForElementWithId(elementId.get()); 1764563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1765563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeBoolean(context, autoCompletes); 1766563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1767563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1768563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef pauseAnimationAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1769563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1770563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount != 3) 1771563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1772563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1773563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> animationName(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1774563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1775563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark double time = JSValueToNumber(context, arguments[1], exception); 1776563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1777563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1778563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1779563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 17800bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1781563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeBoolean(context, controller->pauseAnimationAtTimeOnElementWithId(animationName.get(), time, elementId.get())); 1782563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1783563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1784563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef pauseTransitionAtTimeOnElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1785563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1786563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount != 3) 1787563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1788563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1789563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> propertyName(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1790563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1791563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark double time = JSValueToNumber(context, arguments[1], exception); 1792563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1793563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1794563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ASSERT(!*exception); 1795563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 17960bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1797563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeBoolean(context, controller->pauseTransitionAtTimeOnElementWithId(propertyName.get(), time, elementId.get())); 1798563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1799563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1800643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockstatic JSValueRef sampleSVGAnimationForElementAtTimeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1801643ca7872b450ea4efacab6188849e5aac2ba161Steve Block{ 1802643ca7872b450ea4efacab6188849e5aac2ba161Steve Block if (argumentCount != 3) 1803643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeUndefined(context); 1804643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1805643ca7872b450ea4efacab6188849e5aac2ba161Steve Block JSRetainPtr<JSStringRef> animationId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1806643ca7872b450ea4efacab6188849e5aac2ba161Steve Block ASSERT(!*exception); 1807643ca7872b450ea4efacab6188849e5aac2ba161Steve Block double time = JSValueToNumber(context, arguments[1], exception); 1808643ca7872b450ea4efacab6188849e5aac2ba161Steve Block ASSERT(!*exception); 1809643ca7872b450ea4efacab6188849e5aac2ba161Steve Block JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1810643ca7872b450ea4efacab6188849e5aac2ba161Steve Block ASSERT(!*exception); 1811643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1812643ca7872b450ea4efacab6188849e5aac2ba161Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1813643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSValueMakeBoolean(context, controller->sampleSVGAnimationForElementAtTime(animationId.get(), time, elementId.get())); 1814643ca7872b450ea4efacab6188849e5aac2ba161Steve Block} 1815643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 1816563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef numberOfActiveAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1817563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 1818563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark if (argumentCount != 0) 1819563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeUndefined(context); 1820563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 18210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1822563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeNumber(context, controller->numberOfActiveAnimations()); 1823563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 1824563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 1825f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrickstatic JSValueRef suspendAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1826f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick{ 1827f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1828f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick controller->suspendAnimations(); 1829f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick return JSValueMakeUndefined(context); 1830f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick} 1831f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick 1832f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrickstatic JSValueRef resumeAnimationsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1833f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick{ 1834f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1835f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick controller->resumeAnimations(); 1836f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick return JSValueMakeUndefined(context); 1837f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick} 1838f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick 18390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochstatic JSValueRef waitForPolicyDelegateCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*) 18400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 18410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 18420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch controller->waitForPolicyDelegate(); 18430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch return JSValueMakeUndefined(context); 18440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 18450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 1846dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef addOriginAccessWhitelistEntryCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1847dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1848dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount != 4) 1849dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1850dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1851dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> sourceOrigin(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1852dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1853dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> destinationProtocol(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1854dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1855dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> destinationHost(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1856dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1857dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block bool allowDestinationSubdomains = JSValueToBoolean(context, arguments[3]); 1858dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1859dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1860dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->addOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains); 1861dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1862dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1863dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1864dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef removeOriginAccessWhitelistEntryCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1865231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1866231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (argumentCount != 4) 1867231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1868231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1869231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> sourceOrigin(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1870231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1871231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> destinationProtocol(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1872231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1873231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> destinationHost(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 1874231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1875231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bool allowDestinationSubdomains = JSValueToBoolean(context, arguments[3]); 1876231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1877231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1878dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->removeOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains); 1879dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1880dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1881dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1882dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef setScrollbarPolicyCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1883dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1884dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount != 2) 1885dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1886dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1887dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> orientation(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1888dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1889dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> policy(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1890dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 1891dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1892dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1893dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->setScrollbarPolicy(orientation.get(), policy.get()); 1894231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1895231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1896231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1897231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef addUserScriptCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1898231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1899e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke if (argumentCount != 3) 1900231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1901231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1902231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> source(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1903231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1904231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bool runAtStart = JSValueToBoolean(context, arguments[1]); 1905e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke bool allFrames = JSValueToBoolean(context, arguments[2]); 1906231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1907231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1908e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke controller->addUserScript(source.get(), runAtStart, allFrames); 1909231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1910231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1911231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1912231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef addUserStyleSheetCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1913231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 1914e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke if (argumentCount != 2) 1915231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1916231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1917231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSRetainPtr<JSStringRef> source(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1918231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ASSERT(!*exception); 1919e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke bool allFrames = JSValueToBoolean(context, arguments[1]); 1920231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1921231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1922e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke controller->addUserStyleSheet(source.get(), allFrames); 1923231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeUndefined(context); 1924231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 1925231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 192681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochstatic JSValueRef setShouldPaintBrokenImageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 192781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{ 192881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // Has Mac implementation 192981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch if (argumentCount < 1) 193081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 193181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 193281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 193381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch controller->setShouldPaintBrokenImage(JSValueToBoolean(context, arguments[0])); 193481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 193581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 193681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch} 193781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 1938692e5dbf12901edacf14812a6fae25462920af42Steve Blockstatic JSValueRef apiTestNewWindowDataLoadBaseURLCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1939692e5dbf12901edacf14812a6fae25462920af42Steve Block{ 1940692e5dbf12901edacf14812a6fae25462920af42Steve Block if (argumentCount != 2) 1941692e5dbf12901edacf14812a6fae25462920af42Steve Block return JSValueMakeUndefined(context); 1942692e5dbf12901edacf14812a6fae25462920af42Steve Block 1943692e5dbf12901edacf14812a6fae25462920af42Steve Block JSRetainPtr<JSStringRef> utf8Data(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 1944692e5dbf12901edacf14812a6fae25462920af42Steve Block ASSERT(!*exception); 1945692e5dbf12901edacf14812a6fae25462920af42Steve Block 1946692e5dbf12901edacf14812a6fae25462920af42Steve Block JSRetainPtr<JSStringRef> baseURL(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 1947692e5dbf12901edacf14812a6fae25462920af42Steve Block ASSERT(!*exception); 1948692e5dbf12901edacf14812a6fae25462920af42Steve Block 1949692e5dbf12901edacf14812a6fae25462920af42Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1950692e5dbf12901edacf14812a6fae25462920af42Steve Block controller->apiTestNewWindowDataLoadBaseURL(utf8Data.get(), baseURL.get()); 1951692e5dbf12901edacf14812a6fae25462920af42Steve Block return JSValueMakeUndefined(context); 1952692e5dbf12901edacf14812a6fae25462920af42Steve Block} 1953692e5dbf12901edacf14812a6fae25462920af42Steve Block 1954dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef apiTestGoToCurrentBackForwardItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1955dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1956dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1957dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->apiTestGoToCurrentBackForwardItem(); 1958dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1959dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1960dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1961dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef setWebViewEditableCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1962dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 1963dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // Has Mac implementation 1964dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount < 1) 1965dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1966dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1967dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1968dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->setWebViewEditable(JSValueToBoolean(context, arguments[0])); 1969dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 1970dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 1971dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 1972dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 197306ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 197406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsenstatic JSValueRef abortModalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 197506ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen{ 197606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 197706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen controller->abortModal(); 197806ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen return JSValueMakeUndefined(context); 197906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen} 198006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen 1981a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochstatic JSValueRef hasSpellingMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 1982a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{ 1983a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch if (argumentCount != 2) 1984a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return JSValueMakeUndefined(context); 1985a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 1986a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int from = JSValueToNumber(context, arguments[0], 0); 1987a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch int length = JSValueToNumber(context, arguments[1], 0); 1988a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 1989a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch bool ok = controller->hasSpellingMarker(from, length); 1990a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 1991a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch return JSValueMakeBoolean(context, ok); 1992a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} 1993a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 19942bde8e466a4451c7319e3a072d118917957d6554Steve Blockstatic JSValueRef hasGrammarMarkerCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 19952bde8e466a4451c7319e3a072d118917957d6554Steve Block{ 19962bde8e466a4451c7319e3a072d118917957d6554Steve Block if (argumentCount != 2) 19972bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeUndefined(context); 19982bde8e466a4451c7319e3a072d118917957d6554Steve Block 19992bde8e466a4451c7319e3a072d118917957d6554Steve Block int from = JSValueToNumber(context, arguments[0], 0); 20002bde8e466a4451c7319e3a072d118917957d6554Steve Block int length = JSValueToNumber(context, arguments[1], 0); 20012bde8e466a4451c7319e3a072d118917957d6554Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 20022bde8e466a4451c7319e3a072d118917957d6554Steve Block bool ok = controller->hasGrammarMarker(from, length); 20032bde8e466a4451c7319e3a072d118917957d6554Steve Block 20042bde8e466a4451c7319e3a072d118917957d6554Steve Block return JSValueMakeBoolean(context, ok); 20052bde8e466a4451c7319e3a072d118917957d6554Steve Block} 20062bde8e466a4451c7319e3a072d118917957d6554Steve Block 2007dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef markerTextForListItemCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2008dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 2009dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2010dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount < 1) 2011dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 2012dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeString(context, controller->markerTextForListItem(context, arguments[0]).get()); 2013dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 2014dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 2015dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockstatic JSValueRef authenticateSessionCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2016dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block{ 2017dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block // authenticateSession(url, username, password) 2018dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (argumentCount != 3) 2019dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 2020dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 2021dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> url(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 2022dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 2023dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> username(Adopt, JSValueToStringCopy(context, arguments[1], exception)); 2024dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 2025dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block JSRetainPtr<JSStringRef> password(Adopt, JSValueToStringCopy(context, arguments[2], exception)); 2026dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ASSERT(!*exception); 2027dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 2028dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2029dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block controller->authenticateSession(url.get(), username.get(), password.get()); 2030dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block return JSValueMakeUndefined(context); 2031dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} 2032dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 2033e78cbe89e6f337f2f1fe40315be88f742b547151Steve Blockstatic JSValueRef setEditingBehaviorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2034e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block{ 2035e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block // The editing behavior string. 2036e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block if (argumentCount < 1) 2037e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block return JSValueMakeUndefined(context); 2038e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2039e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block JSRetainPtr<JSStringRef> editingBehavior(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 2040e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block ASSERT(!*exception); 2041e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2042e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block size_t maxLength = JSStringGetMaximumUTF8CStringSize(editingBehavior.get()); 2043e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block char* behaviorBuffer = new char[maxLength + 1]; 2044e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block JSStringGetUTF8CString(editingBehavior.get(), behaviorBuffer, maxLength); 2045e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 20464576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang if (strcmp(behaviorBuffer, "mac") && strcmp(behaviorBuffer, "win") && strcmp(behaviorBuffer, "unix")) { 20474576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang JSRetainPtr<JSStringRef> invalidArgument(JSStringCreateWithUTF8CString("Passed invalid editing behavior. Must be 'mac', 'win', or 'unix'.")); 2048e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block *exception = JSValueMakeString(context, invalidArgument.get()); 2049e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block return JSValueMakeUndefined(context); 2050e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block } 2051e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2052e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2053e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block controller->setEditingBehavior(behaviorBuffer); 2054e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2055e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block delete [] behaviorBuffer; 2056e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2057e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block return JSValueMakeUndefined(context); 2058e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block} 2059e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block 2060f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochstatic JSValueRef setSerializeHTTPLoadsCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 2061f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch{ 2062f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch bool serialize = true; 2063f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch if (argumentCount == 1) 2064f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch serialize = JSValueToBoolean(context, arguments[0]); 2065f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 2066f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch LayoutTestController::setSerializeHTTPLoads(serialize); 2067f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch return JSValueMakeUndefined(context); 2068f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch} 2069f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch 2070563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Static Values 2071563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2072563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) 2073563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 20740bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2075563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeBoolean(context, controller->globalFlag()); 2076563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2077563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2078563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic JSValueRef getWebHistoryItemCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) 2079563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 20800bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2081563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return JSValueMakeNumber(context, controller->webHistoryItemCount()); 2082563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2083563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2084231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockstatic JSValueRef getWorkerThreadCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) 2085231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2086231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2087231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return JSValueMakeNumber(context, controller->workerThreadCount()); 2088231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2089231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2090563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) 2091563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 20920bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 2093563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->setGlobalFlag(JSValueToBoolean(context, value)); 2094563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return true; 2095563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2096563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 209781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochstatic JSValueRef setMinimumTimerIntervalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 209881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{ 209981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch if (argumentCount < 1) 210081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 210181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 210281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch double minimum = JSValueToNumber(context, arguments[0], exception); 210381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch ASSERT(!*exception); 210481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 210581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 210681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch controller->setMinimumTimerInterval(minimum); 210781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 210881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch return JSValueMakeUndefined(context); 210981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch} 211081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 2111563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkstatic void layoutTestControllerObjectFinalize(JSObjectRef object) 2112563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 21130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(object)); 2114563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark controller->deref(); 2115563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2116563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2117563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark// Object Creation 2118563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2119563af33bc48281d19dce701398dbb88cb54fd7ecCary Clarkvoid LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) 2120563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2121563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController")); 2122563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark ref(); 2123643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 2124643ca7872b450ea4efacab6188849e5aac2ba161Steve Block JSClassRef classRef = getJSClass(); 2125643ca7872b450ea4efacab6188849e5aac2ba161Steve Block JSValueRef layoutTestContollerObject = JSObjectMake(context, classRef, this); 2126643ca7872b450ea4efacab6188849e5aac2ba161Steve Block JSClassRelease(classRef); 2127643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 2128563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); 2129563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2130563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2131563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkJSClassRef LayoutTestController::getJSClass() 2132563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2133643ca7872b450ea4efacab6188849e5aac2ba161Steve Block static JSStaticValue* staticValues = LayoutTestController::staticValues(); 2134643ca7872b450ea4efacab6188849e5aac2ba161Steve Block static JSStaticFunction* staticFunctions = LayoutTestController::staticFunctions(); 2135643ca7872b450ea4efacab6188849e5aac2ba161Steve Block static JSClassDefinition classDefinition = { 2136643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 0, kJSClassAttributeNone, "LayoutTestController", 0, staticValues, staticFunctions, 2137643ca7872b450ea4efacab6188849e5aac2ba161Steve Block 0, layoutTestControllerObjectFinalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 2138643ca7872b450ea4efacab6188849e5aac2ba161Steve Block }; 2139563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2140643ca7872b450ea4efacab6188849e5aac2ba161Steve Block return JSClassCreate(&classDefinition); 2141563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2142563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2143563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkJSStaticValue* LayoutTestController::staticValues() 2144563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2145563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark static JSStaticValue staticValues[] = { 2146563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "globalFlag", getGlobalFlagCallback, setGlobalFlagCallback, kJSPropertyAttributeNone }, 2147563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "webHistoryItemCount", getWebHistoryItemCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2148231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "workerThreadCount", getWorkerThreadCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2149563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { 0, 0, 0, 0 } 2150563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark }; 2151563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return staticValues; 2152563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 2153563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2154563af33bc48281d19dce701398dbb88cb54fd7ecCary ClarkJSStaticFunction* LayoutTestController::staticFunctions() 2155563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark{ 2156563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark static JSStaticFunction staticFunctions[] = { 215706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen { "abortModal", abortModalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2158563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "addDisallowedURL", addDisallowedURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 215965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch { "addURLToRedirect", addURLToRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2160231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "addUserScript", addUserScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2161231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "addUserStyleSheet", addUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2162692e5dbf12901edacf14812a6fae25462920af42Steve Block { "apiTestNewWindowDataLoadBaseURL", apiTestNewWindowDataLoadBaseURLCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2163dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "apiTestGoToCurrentBackForwardItem", apiTestGoToCurrentBackForwardItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2164dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "callShouldCloseOnWebView", callShouldCloseOnWebViewCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2165dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch { "clearAllApplicationCaches", clearAllApplicationCachesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2166563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "clearAllDatabases", clearAllDatabasesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21672bde8e466a4451c7319e3a072d118917957d6554Steve Block { "clearApplicationCacheForOrigin", clearApplicationCacheForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2168563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "clearBackForwardList", clearBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2169563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "clearPersistentUserStyleSheet", clearPersistentUserStyleSheetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2170231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2171dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "computedStyleIncludingVisitedInfo", computedStyleIncludingVisitedInfoCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2172bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen { "nodesFromRect", nodesFromRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2173563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21740bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21750bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "dispatchPendingLoadRequests", dispatchPendingLoadRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2176563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21772fc2651226baac27029e38c9d6ef883fa32084dbSteve Block { "displayInvalidatedRegion", displayInvalidatedRegionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2178dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch { "dumpApplicationCacheDelegateCallbacks", dumpApplicationCacheDelegateCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2179563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2180563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpBackForwardList", dumpBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2181563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpChildFrameScrollPositions", dumpChildFrameScrollPositionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21820bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "dumpChildFramesAsText", dumpChildFramesAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2183f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch { "dumpConfigurationForViewport", dumpConfigurationForViewportCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2184563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpDOMAsWebArchive", dumpDOMAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21850bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "dumpDatabaseCallbacks", dumpDatabaseCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2186563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2187231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "dumpFrameLoadCallbacks", dumpFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2188e14391e94c850b8bd03680c23b38978db68687a8John Reck { "dumpUserGestureInFrameLoadCallbacks", dumpUserGestureInFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2189563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpResourceLoadCallbacks", dumpResourceLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "dumpResourceResponseMIMETypes", dumpResourceResponseMIMETypesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2191563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpSelectionRect", dumpSelectionRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2192563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpSourceAsWebArchive", dumpSourceAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2193563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpStatusCallbacks", dumpStatusCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2194563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "dumpTitleChanges", dumpTitleChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 219521939df44de1705786c545cd1bf519d47250322dBen Murdoch { "dumpIconChanges", dumpIconChangesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21960bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "dumpWillCacheResponse", dumpWillCacheResponseCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 21970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2198563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2199231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2200cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block { "evaluateScriptInIsolatedWorld", evaluateScriptInIsolatedWorldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2201563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2202f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch { "findString", findStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2203cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22042bde8e466a4451c7319e3a072d118917957d6554Steve Block { "originsWithApplicationCache", originsWithApplicationCacheCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2205231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2206a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch { "hasSpellingMarker", hasSpellingMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22072bde8e466a4451c7319e3a072d118917957d6554Steve Block { "hasGrammarMarker", hasGrammarMarkerCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2208563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 220906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2210563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2211dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22128a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22132bde8e466a4451c7319e3a072d118917957d6554Steve Block { "numberOfPendingGeolocationPermissionRequests", numberOfPendingGeolocationPermissionRequestsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2214dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "markerTextForListItem", markerTextForListItemCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2215563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2217f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick { "suspendAnimations", suspendAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2218f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick { "resumeAnimations", resumeAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2219231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22205e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2221ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24Steve Block { "pageSizeAndMarginsInPixels", pageSizeAndMarginsInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 222206ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2223563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2226643ca7872b450ea4efacab6188849e5aac2ba161Steve Block { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2228563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2229563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "queueForwardNavigation", queueForwardNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2230563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "queueLoad", queueLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2231967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch { "queueLoadHTMLString", queueLoadHTMLStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "queueLoadingScript", queueLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "queueNonLoadingScript", queueNonLoadingScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2234563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "queueReload", queueReloadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2235cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block { "removeAllVisitedLinks", removeAllVisitedLinksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2236dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "removeOriginAccessWhitelistEntry", removeOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2237563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2238563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2239643ca7872b450ea4efacab6188849e5aac2ba161Steve Block { "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2240692e5dbf12901edacf14812a6fae25462920af42Steve Block { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2241231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2242dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2243dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch { "setApplicationCacheOriginQuota", setApplicationCacheOriginQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { "setEncodedAudioData", setEncodedAudioDataCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2245231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2246231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2247231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setAuthorAndUserStylesEnabled", setAuthorAndUserStylesEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22482bde8e466a4451c7319e3a072d118917957d6554Steve Block { "setAutofilled", setAutofilledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2249dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setCacheModel", setCacheModelCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2250563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setCallCloseOnWebViews", setCallCloseOnWebViewsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2251563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setCanOpenWindows", setCanOpenWindowsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2252563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2253563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2254563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2255967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch { "setDeferMainResourceDataLoad", setDeferMainResourceDataLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2256d0825bca7fe65beaee391d30da42e937db621564Steve Block { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2257e78cbe89e6f337f2f1fe40315be88f742b547151Steve Block { "setEditingBehavior", setEditingBehaviorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2258dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2259231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2260231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2261563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2262563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2263563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 226481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch { "setMinimumTimerInterval", setMinimumTimerIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2265db14019a23d96bc8a444b6576a5da8bd1cfbc8b0Steve Block { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2266231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2267dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22684576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang { "addMockSpeechInputResult", addMockSpeechInputResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22695e2bc6953fe6923165b8a5d7679939693a1d58d6Steve Block { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2270dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2271563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2272563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 227321939df44de1705786c545cd1bf519d47250322dBen Murdoch { "setPluginsEnabled", setPluginsEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 227421939df44de1705786c545cd1bf519d47250322dBen Murdoch { "setPrinting", setPrintingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22750bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2276563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2277f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch { "setSerializeHTTPLoads", setSerializeHTTPLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22780bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2279dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setSpatialNavigationEnabled", setSpatialNavigationEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2280563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2281563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2282643ca7872b450ea4efacab6188849e5aac2ba161Steve Block { "setTimelineProfilingEnabled", setTimelineProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2283563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2284563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2285563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22862bde8e466a4451c7319e3a072d118917957d6554Steve Block { "setValueForUser", setValueForUserCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2287e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block { "setViewModeMediaFeature", setViewModeMediaFeatureCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2288dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setWebViewEditable", setWebViewEditableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2289dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2290d0825bca7fe65beaee391d30da42e937db621564Steve Block { "setWillSendRequestReturnsNull", setWillSendRequestReturnsNullCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22910bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "setWillSendRequestReturnsNullOnRedirect", setWillSendRequestReturnsNullOnRedirectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2292563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "setWindowIsKey", setWindowIsKeyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 229321939df44de1705786c545cd1bf519d47250322dBen Murdoch { "setJavaScriptCanAccessClipboard", setJavaScriptCanAccessClipboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2294dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2295f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch { "setAsynchronousSpellCheckingEnabled", setAsynchronousSpellCheckingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 22962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { "shadowRoot", shadowRootCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2297231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block { "showWebInspector", showWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2298563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "testOnscreen", testOnscreenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2299563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "testRepaint", testRepaintCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23000bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch { "waitForPolicyDelegate", waitForPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2301563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "waitUntilDone", waitUntilDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2302563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { "windowCount", windowCountCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2303dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "addOriginAccessWhitelistEntry", addOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2304dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "setScrollbarPolicy", setScrollbarPolicyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2305dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { "authenticateSession", authenticateSessionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23062bde8e466a4451c7319e3a072d118917957d6554Steve Block { "deleteAllLocalStorage", deleteAllLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23072bde8e466a4451c7319e3a072d118917957d6554Steve Block { "syncLocalStorage", syncLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23082bde8e466a4451c7319e3a072d118917957d6554Steve Block { "observeStorageTrackerNotifications", observeStorageTrackerNotificationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23092bde8e466a4451c7319e3a072d118917957d6554Steve Block { "deleteLocalStorageForOrigin", deleteLocalStorageForOriginCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 23102bde8e466a4451c7319e3a072d118917957d6554Steve Block { "originsWithLocalStorage", originsWithLocalStorageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 231181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2312563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark { 0, 0, 0 } 2313563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark }; 2314563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark 2315563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark return staticFunctions; 2316563af33bc48281d19dce701398dbb88cb54fd7ecCary Clark} 23170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 2318967717af5423377c967781471ee106e2bb4e11c8Ben Murdochvoid LayoutTestController::queueLoadHTMLString(JSStringRef content, JSStringRef baseURL) 2319967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch{ 2320967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL)); 2321967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch} 2322967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch 232365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochvoid LayoutTestController::queueLoadAlternateHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL) 232465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{ 232565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch WorkQueue::shared()->queue(new LoadHTMLStringItem(content, baseURL, unreachableURL)); 232665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch} 232765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 23280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid LayoutTestController::queueBackNavigation(int howFarBack) 23290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 23300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch WorkQueue::shared()->queue(new BackItem(howFarBack)); 23310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 23320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 23330bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid LayoutTestController::queueForwardNavigation(int howFarForward) 23340bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 23350bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch WorkQueue::shared()->queue(new ForwardItem(howFarForward)); 23360bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 23370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 23380bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid LayoutTestController::queueLoadingScript(JSStringRef script) 23390bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 23400bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch WorkQueue::shared()->queue(new LoadingScriptItem(script)); 23410bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 23420bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 23430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid LayoutTestController::queueNonLoadingScript(JSStringRef script) 23440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 23450bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch WorkQueue::shared()->queue(new NonLoadingScriptItem(script)); 23460bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 23470bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 23480bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochvoid LayoutTestController::queueReload() 23490bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch{ 23500bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch WorkQueue::shared()->queue(new ReloadItem); 23510bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch} 2352231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2353231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid LayoutTestController::grantDesktopNotificationPermission(JSStringRef origin) 2354231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2355231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block m_desktopNotificationAllowedOrigins.push_back(JSStringRetain(origin)); 2356231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2357231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2358231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockbool LayoutTestController::checkDesktopNotificationPermission(JSStringRef origin) 2359231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2360231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block std::vector<JSStringRef>::iterator i; 2361231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block for (i = m_desktopNotificationAllowedOrigins.begin(); 2362231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block i != m_desktopNotificationAllowedOrigins.end(); 2363231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ++i) { 2364231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if (JSStringIsEqual(*i, origin)) 2365231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return true; 2366231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block } 2367231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block return false; 2368231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2369231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2370231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid LayoutTestController::waitToDumpWatchdogTimerFired() 2371231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2372231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block const char* message = "FAIL: Timed out waiting for notifyDone to be called\n"; 2373231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block fprintf(stderr, "%s", message); 2374231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block fprintf(stdout, "%s", message); 2375231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block notifyDone(); 2376231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2377231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2378dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochvoid LayoutTestController::setGeolocationPermissionCommon(bool allow) 2379231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2380231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block m_isGeolocationPermissionSet = true; 2381231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block m_geolocationPermission = allow; 2382231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2383231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 2384231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockvoid LayoutTestController::setPOSIXLocale(JSStringRef locale) 2385231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block{ 2386231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block char localeBuf[32]; 2387231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block JSStringGetUTF8CString(locale, localeBuf, sizeof(localeBuf)); 2388231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block setlocale(LC_ALL, localeBuf); 2389231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block} 2390692e5dbf12901edacf14812a6fae25462920af42Steve Block 239165f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochvoid LayoutTestController::addURLToRedirect(std::string origin, std::string destination) 239265f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{ 239365f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch m_URLsToRedirect[origin] = destination; 239465f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch} 239565f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 239665f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochconst std::string& LayoutTestController::redirectionDestinationForURL(std::string origin) 239765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch{ 239865f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch return m_URLsToRedirect[origin]; 239965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch} 240065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch 240181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochvoid LayoutTestController::setShouldPaintBrokenImage(bool shouldPaintBrokenImage) 240281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch{ 240381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch m_shouldPaintBrokenImage = shouldPaintBrokenImage; 240481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch} 240581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 2406692e5dbf12901edacf14812a6fae25462920af42Steve Blockconst unsigned LayoutTestController::maxViewWidth = 800; 2407692e5dbf12901edacf14812a6fae25462920af42Steve Blockconst unsigned LayoutTestController::maxViewHeight = 600; 2408