1 | /* |
2 | * Copyright (C) 2010-2017 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | #include "config.h" |
26 | #include "JSTestRunner.h" |
27 | #include "TestRunner.h" |
28 | #include <JavaScriptCore/JSRetainPtr.h> |
29 | #include <wtf/GetPtr.h> |
30 | |
31 | namespace WTR { |
32 | |
33 | TestRunner* toTestRunner(JSContextRef context, JSValueRef value) |
34 | { |
35 | if (!context || !value || !JSTestRunner::testRunnerClass() || !JSValueIsObjectOfClass(context, value, JSTestRunner::testRunnerClass())) |
36 | return 0; |
37 | return static_cast<TestRunner*>(JSWrapper::unwrap(context, value)); |
38 | } |
39 | |
40 | JSClassRef JSTestRunner::testRunnerClass() |
41 | { |
42 | static JSClassRef jsClass; |
43 | if (!jsClass) { |
44 | JSClassDefinition definition = kJSClassDefinitionEmpty; |
45 | definition.className = "TestRunner" ; |
46 | definition.parentClass = 0; |
47 | definition.staticValues = staticValues(); |
48 | definition.staticFunctions = staticFunctions(); |
49 | definition.initialize = initialize; |
50 | definition.finalize = finalize; |
51 | jsClass = JSClassCreate(&definition); |
52 | } |
53 | return jsClass; |
54 | } |
55 | |
56 | |
57 | // Constants |
58 | static JSValueRef getRENDER_TREE_SHOW_ALL_LAYERS(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
59 | { |
60 | return JSValueMakeNumber(context, 1); |
61 | } |
62 | |
63 | static JSValueRef getRENDER_TREE_SHOW_LAYER_NESTING(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
64 | { |
65 | return JSValueMakeNumber(context, 2); |
66 | } |
67 | |
68 | static JSValueRef getRENDER_TREE_SHOW_COMPOSITED_LAYERS(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
69 | { |
70 | return JSValueMakeNumber(context, 4); |
71 | } |
72 | |
73 | static JSValueRef getRENDER_TREE_SHOW_OVERFLOW(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
74 | { |
75 | return JSValueMakeNumber(context, 8); |
76 | } |
77 | |
78 | static JSValueRef getRENDER_TREE_SHOW_SVG_GEOMETRY(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
79 | { |
80 | return JSValueMakeNumber(context, 16); |
81 | } |
82 | |
83 | static JSValueRef getRENDER_TREE_SHOW_LAYER_FRAGMENTS(JSContextRef context, JSObjectRef, JSStringRef, JSValueRef*) |
84 | { |
85 | return JSValueMakeNumber(context, 32); |
86 | } |
87 | |
88 | const JSStaticFunction* JSTestRunner::staticFunctions() |
89 | { |
90 | static const JSStaticFunction functions[] = { |
91 | { "dumpAsText" , dumpAsText, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
92 | { "dumpChildFramesAsText" , dumpChildFramesAsText, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
93 | { "waitForPolicyDelegate" , waitForPolicyDelegate, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
94 | { "waitUntilDone" , waitUntilDone, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
95 | { "notifyDone" , notifyDone, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
96 | { "preciseTime" , preciseTime, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
97 | { "waitUntilDownloadFinished" , waitUntilDownloadFinished, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
98 | { "setShouldLogDownloadCallbacks" , setShouldLogDownloadCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
99 | { "setRenderTreeDumpOptions" , setRenderTreeDumpOptions, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
100 | { "dumpBackForwardList" , dumpBackForwardList, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
101 | { "dumpChildFrameScrollPositions" , dumpChildFrameScrollPositions, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
102 | { "dumpEditingCallbacks" , dumpEditingCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
103 | { "dumpSelectionRect" , dumpSelectionRect, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
104 | { "dumpStatusCallbacks" , dumpStatusCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
105 | { "dumpTitleChanges" , dumpTitleChanges, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
106 | { "dumpFullScreenCallbacks" , dumpFullScreenCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
107 | { "dumpFrameLoadCallbacks" , dumpFrameLoadCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
108 | { "dumpProgressFinishedCallback" , dumpProgressFinishedCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
109 | { "dumpResourceLoadCallbacks" , dumpResourceLoadCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
110 | { "dumpResourceResponseMIMETypes" , dumpResourceResponseMIMETypes, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
111 | { "dumpWillCacheResponse" , dumpWillCacheResponse, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
112 | { "dumpApplicationCacheDelegateCallbacks" , dumpApplicationCacheDelegateCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
113 | { "dumpDatabaseCallbacks" , dumpDatabaseCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
114 | { "dumpDOMAsWebArchive" , dumpDOMAsWebArchive, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
115 | { "dumpPolicyDelegateCallbacks" , dumpPolicyDelegateCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
116 | { "dumpResourceLoadStatistics" , dumpResourceLoadStatistics, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
117 | { "dumpAdClickAttribution" , dumpAdClickAttribution, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
118 | { "clearDOMCaches" , clearDOMCaches, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
119 | { "clearDOMCache" , clearDOMCache, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
120 | { "hasDOMCache" , hasDOMCache, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
121 | { "domCacheSize" , domCacheSize, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
122 | { "setAllowStorageQuotaIncrease" , setAllowStorageQuotaIncrease, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
123 | { "keepWebHistory" , keepWebHistory, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
124 | { "setAcceptsEditing" , setAcceptsEditing, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
125 | { "setCanOpenWindows" , setCanOpenWindows, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
126 | { "setCloseRemainingWindowsWhenComplete" , setCloseRemainingWindowsWhenComplete, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
127 | { "setXSSAuditorEnabled" , setXSSAuditorEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
128 | { "setAllowUniversalAccessFromFileURLs" , setAllowUniversalAccessFromFileURLs, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
129 | { "setAllowFileAccessFromFileURLs" , setAllowFileAccessFromFileURLs, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
130 | { "setNeedsStorageAccessFromFileURLsQuirk" , setNeedsStorageAccessFromFileURLsQuirk, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
131 | { "setPluginsEnabled" , setPluginsEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
132 | { "setJavaScriptCanAccessClipboard" , setJavaScriptCanAccessClipboard, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
133 | { "setPrivateBrowsingEnabled" , setPrivateBrowsingEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
134 | { "setUseDashboardCompatibilityMode" , setUseDashboardCompatibilityMode, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
135 | { "setPopupBlockingEnabled" , setPopupBlockingEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
136 | { "setAuthorAndUserStylesEnabled" , setAuthorAndUserStylesEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
137 | { "setCustomPolicyDelegate" , setCustomPolicyDelegate, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
138 | { "addOriginAccessWhitelistEntry" , addOriginAccessWhitelistEntry, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
139 | { "removeOriginAccessWhitelistEntry" , removeOriginAccessWhitelistEntry, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
140 | { "setUserStyleSheetEnabled" , setUserStyleSheetEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
141 | { "setUserStyleSheetLocation" , setUserStyleSheetLocation, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
142 | { "setSpatialNavigationEnabled" , setSpatialNavigationEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
143 | { "setTabKeyCyclesThroughElements" , setTabKeyCyclesThroughElements, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
144 | { "setSerializeHTTPLoads" , setSerializeHTTPLoads, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
145 | { "dispatchPendingLoadRequests" , dispatchPendingLoadRequests, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
146 | { "setCacheModel" , setCacheModel, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
147 | { "setAsynchronousSpellCheckingEnabled" , setAsynchronousSpellCheckingEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
148 | { "setPrinting" , setPrinting, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
149 | { "setShouldDecideNavigationPolicyAfterDelay" , setShouldDecideNavigationPolicyAfterDelay, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
150 | { "setShouldDecideResponsePolicyAfterDelay" , setShouldDecideResponsePolicyAfterDelay, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
151 | { "setNavigationGesturesEnabled" , setNavigationGesturesEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
152 | { "setIgnoresViewportScaleLimits" , setIgnoresViewportScaleLimits, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
153 | { "setShouldDownloadUndisplayableMIMETypes" , setShouldDownloadUndisplayableMIMETypes, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
154 | { "clearBackForwardList" , clearBackForwardList, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
155 | { "execCommand" , execCommand, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
156 | { "isCommandEnabled" , isCommandEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
157 | { "windowCount" , windowCount, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
158 | { "setShouldAllowDeviceOrientationAndMotionAccess" , setShouldAllowDeviceOrientationAndMotionAccess, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
159 | { "testRepaint" , testRepaint, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
160 | { "repaintSweepHorizontally" , repaintSweepHorizontally, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
161 | { "display" , display, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
162 | { "displayAndTrackRepaints" , displayAndTrackRepaints, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
163 | { "forceImmediateCompletion" , forceImmediateCompletion, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
164 | { "isPageBoxVisible" , isPageBoxVisible, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
165 | { "dumpAllHTTPRedirectedResponseHeaders" , dumpAllHTTPRedirectedResponseHeaders, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
166 | { "setValueForUser" , setValueForUser, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
167 | { "addUserScript" , addUserScript, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
168 | { "addUserStyleSheet" , addUserStyleSheet, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
169 | { "clearAllDatabases" , clearAllDatabases, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
170 | { "setDatabaseQuota" , setDatabaseQuota, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
171 | { "pathToLocalResource" , pathToLocalResource, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
172 | { "setIDBPerOriginQuota" , setIDBPerOriginQuota, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
173 | { "clearAllApplicationCaches" , clearAllApplicationCaches, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
174 | { "setAppCacheMaximumSize" , setAppCacheMaximumSize, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
175 | { "applicationCacheDiskUsageForOrigin" , applicationCacheDiskUsageForOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
176 | { "clearApplicationCacheForOrigin" , clearApplicationCacheForOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
177 | { "disallowIncreaseForApplicationCacheQuota" , disallowIncreaseForApplicationCacheQuota, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
178 | { "originsWithApplicationCache" , originsWithApplicationCache, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
179 | { "findString" , findString, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
180 | { "findStringMatchesInPage" , findStringMatchesInPage, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
181 | { "replaceFindMatchesAtIndices" , replaceFindMatchesAtIndices, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
182 | { "evaluateScriptInIsolatedWorld" , evaluateScriptInIsolatedWorld, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
183 | { "showWebInspector" , showWebInspector, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
184 | { "closeWebInspector" , closeWebInspector, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
185 | { "evaluateInWebInspector" , evaluateInWebInspector, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
186 | { "setPOSIXLocale" , setPOSIXLocale, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
187 | { "setTextDirection" , setTextDirection, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
188 | { "setWillSendRequestReturnsNull" , setWillSendRequestReturnsNull, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
189 | { "setWillSendRequestReturnsNullOnRedirect" , setWillSendRequestReturnsNullOnRedirect, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
190 | { "setWillSendRequestAddsHTTPBody" , setWillSendRequestAddsHTTPBody, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
191 | { "setShouldStayOnPageAfterHandlingBeforeUnload" , setShouldStayOnPageAfterHandlingBeforeUnload, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
192 | { "setStopProvisionalFrameLoads" , setStopProvisionalFrameLoads, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
193 | { "clearDidReceiveServerRedirectForProvisionalNavigation" , clearDidReceiveServerRedirectForProvisionalNavigation, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
194 | { "addChromeInputField" , addChromeInputField, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
195 | { "removeChromeInputField" , removeChromeInputField, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
196 | { "focusWebView" , focusWebView, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
197 | { "setBackingScaleFactor" , setBackingScaleFactor, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
198 | { "setWindowIsKey" , setWindowIsKey, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
199 | { "setViewSize" , setViewSize, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
200 | { "setAlwaysAcceptCookies" , setAlwaysAcceptCookies, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
201 | { "setOnlyAcceptFirstPartyCookies" , setOnlyAcceptFirstPartyCookies, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
202 | { "overridePreference" , overridePreference, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
203 | { "setPageVisibility" , setPageVisibility, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
204 | { "resetPageVisibility" , resetPageVisibility, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
205 | { "setHasCustomFullScreenBehavior" , setHasCustomFullScreenBehavior, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
206 | { "grantWebNotificationPermission" , grantWebNotificationPermission, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
207 | { "denyWebNotificationPermission" , denyWebNotificationPermission, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
208 | { "removeAllWebNotificationPermissions" , removeAllWebNotificationPermissions, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
209 | { "simulateWebNotificationClick" , simulateWebNotificationClick, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
210 | { "setGeolocationPermission" , setGeolocationPermission, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
211 | { "setMockGeolocationPosition" , setMockGeolocationPosition, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
212 | { "setMockGeolocationPositionUnavailableError" , setMockGeolocationPositionUnavailableError, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
213 | { "isGeolocationProviderActive" , isGeolocationProviderActive, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
214 | { "setUserMediaPermission" , setUserMediaPermission, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
215 | { "resetUserMediaPermission" , resetUserMediaPermission, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
216 | { "setUserMediaPersistentPermissionForOrigin" , setUserMediaPersistentPermissionForOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
217 | { "userMediaPermissionRequestCountForOrigin" , userMediaPermissionRequestCountForOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
218 | { "resetUserMediaPermissionRequestCountForOrigin" , resetUserMediaPermissionRequestCountForOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
219 | { "setAudioResult" , setAudioResult, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
220 | { "callShouldCloseOnWebView" , callShouldCloseOnWebView, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
221 | { "queueBackNavigation" , queueBackNavigation, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
222 | { "queueForwardNavigation" , queueForwardNavigation, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
223 | { "queueLoad" , queueLoad, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
224 | { "queueLoadHTMLString" , queueLoadHTMLString, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
225 | { "queueReload" , queueReload, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
226 | { "queueLoadingScript" , queueLoadingScript, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
227 | { "queueNonLoadingScript" , queueNonLoadingScript, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
228 | { "setRejectsProtectionSpaceAndContinueForAuthenticationChallenges" , setRejectsProtectionSpaceAndContinueForAuthenticationChallenges, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
229 | { "setHandlesAuthenticationChallenges" , setHandlesAuthenticationChallenges, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
230 | { "setShouldLogCanAuthenticateAgainstProtectionSpace" , setShouldLogCanAuthenticateAgainstProtectionSpace, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
231 | { "setAuthenticationUsername" , setAuthenticationUsername, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
232 | { "setAuthenticationPassword" , setAuthenticationPassword, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
233 | { "setAllowsAnySSLCertificate" , setAllowsAnySSLCertificate, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
234 | { "setBlockAllPlugins" , setBlockAllPlugins, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
235 | { "setPluginSupportedMode" , setPluginSupportedMode, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
236 | { "failNextNewCodeBlock" , failNextNewCodeBlock, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
237 | { "numberOfDFGCompiles" , numberOfDFGCompiles, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
238 | { "neverInlineFunction" , neverInlineFunction, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
239 | { "installDidBeginSwipeCallback" , installDidBeginSwipeCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
240 | { "installWillEndSwipeCallback" , installWillEndSwipeCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
241 | { "installDidEndSwipeCallback" , installDidEndSwipeCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
242 | { "installDidRemoveSwipeSnapshotCallback" , installDidRemoveSwipeSnapshotCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
243 | { "imageCountInGeneralPasteboard" , imageCountInGeneralPasteboard, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
244 | { "runUIScript" , runUIScript, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
245 | { "clearTestRunnerCallbacks" , clearTestRunnerCallbacks, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
246 | { "accummulateLogsForChannel" , accummulateLogsForChannel, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
247 | { "setAllowedMenuActions" , setAllowedMenuActions, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
248 | { "installCustomMenuAction" , installCustomMenuAction, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
249 | { "setMockGamepadDetails" , setMockGamepadDetails, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
250 | { "setMockGamepadAxisValue" , setMockGamepadAxisValue, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
251 | { "setMockGamepadButtonValue" , setMockGamepadButtonValue, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
252 | { "connectMockGamepad" , connectMockGamepad, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
253 | { "disconnectMockGamepad" , disconnectMockGamepad, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
254 | { "installStatisticsDidModifyDataRecordsCallback" , installStatisticsDidModifyDataRecordsCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
255 | { "installStatisticsDidScanDataRecordsCallback" , installStatisticsDidScanDataRecordsCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
256 | { "installStatisticsDidRunTelemetryCallback" , installStatisticsDidRunTelemetryCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
257 | { "setStatisticsDebugMode" , setStatisticsDebugMode, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
258 | { "setStatisticsPrevalentResourceForDebugMode" , setStatisticsPrevalentResourceForDebugMode, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
259 | { "setStatisticsLastSeen" , setStatisticsLastSeen, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
260 | { "setStatisticsPrevalentResource" , setStatisticsPrevalentResource, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
261 | { "setStatisticsVeryPrevalentResource" , setStatisticsVeryPrevalentResource, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
262 | { "isStatisticsPrevalentResource" , isStatisticsPrevalentResource, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
263 | { "isStatisticsVeryPrevalentResource" , isStatisticsVeryPrevalentResource, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
264 | { "isStatisticsRegisteredAsSubresourceUnder" , isStatisticsRegisteredAsSubresourceUnder, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
265 | { "isStatisticsRegisteredAsSubFrameUnder" , isStatisticsRegisteredAsSubFrameUnder, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
266 | { "isStatisticsRegisteredAsRedirectingTo" , isStatisticsRegisteredAsRedirectingTo, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
267 | { "setStatisticsHasHadUserInteraction" , setStatisticsHasHadUserInteraction, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
268 | { "isStatisticsHasHadUserInteraction" , isStatisticsHasHadUserInteraction, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
269 | { "setStatisticsGrandfathered" , setStatisticsGrandfathered, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
270 | { "isStatisticsGrandfathered" , isStatisticsGrandfathered, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
271 | { "setStatisticsSubframeUnderTopFrameOrigin" , setStatisticsSubframeUnderTopFrameOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
272 | { "setStatisticsSubresourceUnderTopFrameOrigin" , setStatisticsSubresourceUnderTopFrameOrigin, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
273 | { "setStatisticsSubresourceUniqueRedirectTo" , setStatisticsSubresourceUniqueRedirectTo, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
274 | { "setStatisticsSubresourceUniqueRedirectFrom" , setStatisticsSubresourceUniqueRedirectFrom, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
275 | { "setStatisticsTopFrameUniqueRedirectTo" , setStatisticsTopFrameUniqueRedirectTo, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
276 | { "setStatisticsTopFrameUniqueRedirectFrom" , setStatisticsTopFrameUniqueRedirectFrom, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
277 | { "setStatisticsCrossSiteLoadWithLinkDecoration" , setStatisticsCrossSiteLoadWithLinkDecoration, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
278 | { "setStatisticsTimeToLiveUserInteraction" , setStatisticsTimeToLiveUserInteraction, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
279 | { "statisticsNotifyObserver" , statisticsNotifyObserver, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
280 | { "statisticsProcessStatisticsAndDataRecords" , statisticsProcessStatisticsAndDataRecords, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
281 | { "statisticsUpdateCookieBlocking" , statisticsUpdateCookieBlocking, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
282 | { "statisticsSubmitTelemetry" , statisticsSubmitTelemetry, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
283 | { "setStatisticsNotifyPagesWhenDataRecordsWereScanned" , setStatisticsNotifyPagesWhenDataRecordsWereScanned, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
284 | { "setStatisticsIsRunningTest" , setStatisticsIsRunningTest, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
285 | { "setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval" , setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
286 | { "setStatisticsNotifyPagesWhenTelemetryWasCaptured" , setStatisticsNotifyPagesWhenTelemetryWasCaptured, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
287 | { "setStatisticsMinimumTimeBetweenDataRecordsRemoval" , setStatisticsMinimumTimeBetweenDataRecordsRemoval, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
288 | { "setStatisticsGrandfatheringTime" , setStatisticsGrandfatheringTime, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
289 | { "setStatisticsMaxStatisticsEntries" , setStatisticsMaxStatisticsEntries, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
290 | { "setStatisticsPruneEntriesDownTo" , setStatisticsPruneEntriesDownTo, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
291 | { "statisticsClearInMemoryAndPersistentStore" , statisticsClearInMemoryAndPersistentStore, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
292 | { "statisticsClearInMemoryAndPersistentStoreModifiedSinceHours" , statisticsClearInMemoryAndPersistentStoreModifiedSinceHours, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
293 | { "statisticsClearThroughWebsiteDataRemoval" , statisticsClearThroughWebsiteDataRemoval, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
294 | { "statisticsDeleteCookiesForHost" , statisticsDeleteCookiesForHost, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
295 | { "isStatisticsHasLocalStorage" , isStatisticsHasLocalStorage, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
296 | { "setStatisticsCacheMaxAgeCap" , setStatisticsCacheMaxAgeCap, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
297 | { "statisticsResetToConsistentState" , statisticsResetToConsistentState, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
298 | { "installTextDidChangeInTextFieldCallback" , installTextDidChangeInTextFieldCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
299 | { "installTextFieldDidBeginEditingCallback" , installTextFieldDidBeginEditingCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
300 | { "installTextFieldDidEndEditingCallback" , installTextFieldDidEndEditingCallback, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
301 | { "setStorageAccessAPIEnabled" , setStorageAccessAPIEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
302 | { "getAllStorageAccessEntries" , getAllStorageAccessEntries, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
303 | { "setOpenPanelFiles" , setOpenPanelFiles, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
304 | { "setOpenPanelFilesMediaIcon" , setOpenPanelFilesMediaIcon, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
305 | { "setShouldDismissJavaScriptAlertsAsynchronously" , setShouldDismissJavaScriptAlertsAsynchronously, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
306 | { "abortModal" , abortModal, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
307 | { "setWebRTCMDNSICECandidatesEnabled" , setWebRTCMDNSICECandidatesEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
308 | { "setWebRTCUnifiedPlanEnabled" , setWebRTCUnifiedPlanEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
309 | { "setCustomUserAgent" , setCustomUserAgent, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
310 | { "setWebAPIStatisticsEnabled" , setWebAPIStatisticsEnabled, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
311 | { "terminateNetworkProcess" , terminateNetworkProcess, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
312 | { "terminateServiceWorkerProcess" , terminateServiceWorkerProcess, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
313 | { "setCanHandleHTTPSServerTrustEvaluation" , setCanHandleHTTPSServerTrustEvaluation, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
314 | { "removeAllSessionCredentials" , removeAllSessionCredentials, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
315 | { "getApplicationManifestThen" , getApplicationManifestThen, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
316 | { "installFakeHelvetica" , installFakeHelvetica, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
317 | { "addMockCameraDevice" , addMockCameraDevice, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
318 | { "addMockMicrophoneDevice" , addMockMicrophoneDevice, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
319 | { "addMockScreenDevice" , addMockScreenDevice, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
320 | { "clearMockMediaDevices" , clearMockMediaDevices, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
321 | { "removeMockMediaDevice" , removeMockMediaDevice, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
322 | { "resetMockMediaDevices" , resetMockMediaDevices, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
323 | { "injectUserScript" , injectUserScript, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
324 | { "sendDisplayConfigurationChangedMessageForTesting" , sendDisplayConfigurationChangedMessageForTesting, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
325 | { "setWebAuthenticationMockConfiguration" , setWebAuthenticationMockConfiguration, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
326 | { "addTestKeyToKeychain" , addTestKeyToKeychain, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
327 | { "cleanUpKeychain" , cleanUpKeychain, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
328 | { "keyExistsInKeychain" , keyExistsInKeychain, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
329 | { "clearAdClickAttribution" , clearAdClickAttribution, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
330 | { "clearAdClickAttributionsThroughWebsiteDataRemoval" , clearAdClickAttributionsThroughWebsiteDataRemoval, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
331 | { "setAdClickAttributionOverrideTimerForTesting" , setAdClickAttributionOverrideTimerForTesting, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
332 | { "setAdClickAttributionConversionURLForTesting" , setAdClickAttributionConversionURLForTesting, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
333 | { "markAdClickAttributionsAsExpiredForTesting" , markAdClickAttributionsAsExpiredForTesting, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
334 | { 0, 0, 0 } |
335 | }; |
336 | return functions; |
337 | } |
338 | |
339 | const JSStaticValue* JSTestRunner::staticValues() |
340 | { |
341 | static const JSStaticValue values[] = { |
342 | { "isWebKit2" , isWebKit2, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
343 | { "timeout" , timeout, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
344 | { "globalFlag" , globalFlag, setGlobalFlag, kJSPropertyAttributeDontDelete }, |
345 | { "databaseDefaultQuota" , databaseDefaultQuota, setDatabaseDefaultQuota, kJSPropertyAttributeDontDelete }, |
346 | { "databaseMaxQuota" , databaseMaxQuota, setDatabaseMaxQuota, kJSPropertyAttributeDontDelete }, |
347 | { "inspectorTestStubURL" , inspectorTestStubURL, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
348 | { "didReceiveServerRedirectForProvisionalNavigation" , didReceiveServerRedirectForProvisionalNavigation, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
349 | { "isDoingMediaCapture" , isDoingMediaCapture, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
350 | { "secureEventInputIsEnabled" , secureEventInputIsEnabled, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
351 | { "canDoServerTrustEvaluationInNetworkProcess" , canDoServerTrustEvaluationInNetworkProcess, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
352 | { "serverTrustEvaluationCallbackCallsCount" , serverTrustEvaluationCallbackCallsCount, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
353 | { "didCancelClientRedirect" , didCancelClientRedirect, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
354 | { "userScriptInjectedCount" , userScriptInjectedCount, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
355 | { "RENDER_TREE_SHOW_ALL_LAYERS" , getRENDER_TREE_SHOW_ALL_LAYERS, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
356 | { "RENDER_TREE_SHOW_LAYER_NESTING" , getRENDER_TREE_SHOW_LAYER_NESTING, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
357 | { "RENDER_TREE_SHOW_COMPOSITED_LAYERS" , getRENDER_TREE_SHOW_COMPOSITED_LAYERS, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
358 | { "RENDER_TREE_SHOW_OVERFLOW" , getRENDER_TREE_SHOW_OVERFLOW, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
359 | { "RENDER_TREE_SHOW_SVG_GEOMETRY" , getRENDER_TREE_SHOW_SVG_GEOMETRY, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
360 | { "RENDER_TREE_SHOW_LAYER_FRAGMENTS" , getRENDER_TREE_SHOW_LAYER_FRAGMENTS, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, |
361 | { 0, 0, 0, 0 } |
362 | }; |
363 | return values; |
364 | } |
365 | |
366 | // Functions |
367 | |
368 | JSValueRef JSTestRunner::dumpAsText(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
369 | { |
370 | TestRunner* impl = toTestRunner(context, thisObject); |
371 | if (!impl) |
372 | return JSValueMakeUndefined(context); |
373 | |
374 | bool dumpPixels = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
375 | impl->dumpAsText(dumpPixels); |
376 | |
377 | return JSValueMakeUndefined(context); |
378 | } |
379 | |
380 | JSValueRef JSTestRunner::dumpChildFramesAsText(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
381 | { |
382 | TestRunner* impl = toTestRunner(context, thisObject); |
383 | if (!impl) |
384 | return JSValueMakeUndefined(context); |
385 | |
386 | impl->dumpChildFramesAsText(); |
387 | |
388 | return JSValueMakeUndefined(context); |
389 | } |
390 | |
391 | JSValueRef JSTestRunner::waitForPolicyDelegate(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
392 | { |
393 | TestRunner* impl = toTestRunner(context, thisObject); |
394 | if (!impl) |
395 | return JSValueMakeUndefined(context); |
396 | |
397 | impl->waitForPolicyDelegate(); |
398 | |
399 | return JSValueMakeUndefined(context); |
400 | } |
401 | |
402 | JSValueRef JSTestRunner::waitUntilDone(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
403 | { |
404 | TestRunner* impl = toTestRunner(context, thisObject); |
405 | if (!impl) |
406 | return JSValueMakeUndefined(context); |
407 | |
408 | impl->waitUntilDone(); |
409 | |
410 | return JSValueMakeUndefined(context); |
411 | } |
412 | |
413 | JSValueRef JSTestRunner::notifyDone(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
414 | { |
415 | TestRunner* impl = toTestRunner(context, thisObject); |
416 | if (!impl) |
417 | return JSValueMakeUndefined(context); |
418 | |
419 | impl->notifyDone(); |
420 | |
421 | return JSValueMakeUndefined(context); |
422 | } |
423 | |
424 | JSValueRef JSTestRunner::preciseTime(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
425 | { |
426 | TestRunner* impl = toTestRunner(context, thisObject); |
427 | if (!impl) |
428 | return JSValueMakeUndefined(context); |
429 | |
430 | return JSValueMakeNumber(context, impl->preciseTime()); |
431 | } |
432 | |
433 | JSValueRef JSTestRunner::waitUntilDownloadFinished(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
434 | { |
435 | TestRunner* impl = toTestRunner(context, thisObject); |
436 | if (!impl) |
437 | return JSValueMakeUndefined(context); |
438 | |
439 | impl->waitUntilDownloadFinished(); |
440 | |
441 | return JSValueMakeUndefined(context); |
442 | } |
443 | |
444 | JSValueRef JSTestRunner::setShouldLogDownloadCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
445 | { |
446 | TestRunner* impl = toTestRunner(context, thisObject); |
447 | if (!impl) |
448 | return JSValueMakeUndefined(context); |
449 | |
450 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
451 | impl->setShouldLogDownloadCallbacks(value); |
452 | |
453 | return JSValueMakeUndefined(context); |
454 | } |
455 | |
456 | JSValueRef JSTestRunner::setRenderTreeDumpOptions(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
457 | { |
458 | TestRunner* impl = toTestRunner(context, thisObject); |
459 | if (!impl) |
460 | return JSValueMakeUndefined(context); |
461 | |
462 | double options = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
463 | impl->setRenderTreeDumpOptions(options); |
464 | |
465 | return JSValueMakeUndefined(context); |
466 | } |
467 | |
468 | JSValueRef JSTestRunner::dumpBackForwardList(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
469 | { |
470 | TestRunner* impl = toTestRunner(context, thisObject); |
471 | if (!impl) |
472 | return JSValueMakeUndefined(context); |
473 | |
474 | impl->dumpBackForwardList(); |
475 | |
476 | return JSValueMakeUndefined(context); |
477 | } |
478 | |
479 | JSValueRef JSTestRunner::dumpChildFrameScrollPositions(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
480 | { |
481 | TestRunner* impl = toTestRunner(context, thisObject); |
482 | if (!impl) |
483 | return JSValueMakeUndefined(context); |
484 | |
485 | impl->dumpChildFrameScrollPositions(); |
486 | |
487 | return JSValueMakeUndefined(context); |
488 | } |
489 | |
490 | JSValueRef JSTestRunner::dumpEditingCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
491 | { |
492 | TestRunner* impl = toTestRunner(context, thisObject); |
493 | if (!impl) |
494 | return JSValueMakeUndefined(context); |
495 | |
496 | impl->dumpEditingCallbacks(); |
497 | |
498 | return JSValueMakeUndefined(context); |
499 | } |
500 | |
501 | JSValueRef JSTestRunner::dumpSelectionRect(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
502 | { |
503 | TestRunner* impl = toTestRunner(context, thisObject); |
504 | if (!impl) |
505 | return JSValueMakeUndefined(context); |
506 | |
507 | impl->dumpSelectionRect(); |
508 | |
509 | return JSValueMakeUndefined(context); |
510 | } |
511 | |
512 | JSValueRef JSTestRunner::dumpStatusCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
513 | { |
514 | TestRunner* impl = toTestRunner(context, thisObject); |
515 | if (!impl) |
516 | return JSValueMakeUndefined(context); |
517 | |
518 | impl->dumpStatusCallbacks(); |
519 | |
520 | return JSValueMakeUndefined(context); |
521 | } |
522 | |
523 | JSValueRef JSTestRunner::dumpTitleChanges(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
524 | { |
525 | TestRunner* impl = toTestRunner(context, thisObject); |
526 | if (!impl) |
527 | return JSValueMakeUndefined(context); |
528 | |
529 | impl->dumpTitleChanges(); |
530 | |
531 | return JSValueMakeUndefined(context); |
532 | } |
533 | |
534 | JSValueRef JSTestRunner::dumpFullScreenCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
535 | { |
536 | TestRunner* impl = toTestRunner(context, thisObject); |
537 | if (!impl) |
538 | return JSValueMakeUndefined(context); |
539 | |
540 | impl->dumpFullScreenCallbacks(); |
541 | |
542 | return JSValueMakeUndefined(context); |
543 | } |
544 | |
545 | JSValueRef JSTestRunner::dumpFrameLoadCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
546 | { |
547 | TestRunner* impl = toTestRunner(context, thisObject); |
548 | if (!impl) |
549 | return JSValueMakeUndefined(context); |
550 | |
551 | impl->dumpFrameLoadCallbacks(); |
552 | |
553 | return JSValueMakeUndefined(context); |
554 | } |
555 | |
556 | JSValueRef JSTestRunner::dumpProgressFinishedCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
557 | { |
558 | TestRunner* impl = toTestRunner(context, thisObject); |
559 | if (!impl) |
560 | return JSValueMakeUndefined(context); |
561 | |
562 | impl->dumpProgressFinishedCallback(); |
563 | |
564 | return JSValueMakeUndefined(context); |
565 | } |
566 | |
567 | JSValueRef JSTestRunner::dumpResourceLoadCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
568 | { |
569 | TestRunner* impl = toTestRunner(context, thisObject); |
570 | if (!impl) |
571 | return JSValueMakeUndefined(context); |
572 | |
573 | impl->dumpResourceLoadCallbacks(); |
574 | |
575 | return JSValueMakeUndefined(context); |
576 | } |
577 | |
578 | JSValueRef JSTestRunner::dumpResourceResponseMIMETypes(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
579 | { |
580 | TestRunner* impl = toTestRunner(context, thisObject); |
581 | if (!impl) |
582 | return JSValueMakeUndefined(context); |
583 | |
584 | impl->dumpResourceResponseMIMETypes(); |
585 | |
586 | return JSValueMakeUndefined(context); |
587 | } |
588 | |
589 | JSValueRef JSTestRunner::dumpWillCacheResponse(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
590 | { |
591 | TestRunner* impl = toTestRunner(context, thisObject); |
592 | if (!impl) |
593 | return JSValueMakeUndefined(context); |
594 | |
595 | impl->dumpWillCacheResponse(); |
596 | |
597 | return JSValueMakeUndefined(context); |
598 | } |
599 | |
600 | JSValueRef JSTestRunner::dumpApplicationCacheDelegateCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
601 | { |
602 | TestRunner* impl = toTestRunner(context, thisObject); |
603 | if (!impl) |
604 | return JSValueMakeUndefined(context); |
605 | |
606 | impl->dumpApplicationCacheDelegateCallbacks(); |
607 | |
608 | return JSValueMakeUndefined(context); |
609 | } |
610 | |
611 | JSValueRef JSTestRunner::dumpDatabaseCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
612 | { |
613 | TestRunner* impl = toTestRunner(context, thisObject); |
614 | if (!impl) |
615 | return JSValueMakeUndefined(context); |
616 | |
617 | impl->dumpDatabaseCallbacks(); |
618 | |
619 | return JSValueMakeUndefined(context); |
620 | } |
621 | |
622 | JSValueRef JSTestRunner::dumpDOMAsWebArchive(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
623 | { |
624 | TestRunner* impl = toTestRunner(context, thisObject); |
625 | if (!impl) |
626 | return JSValueMakeUndefined(context); |
627 | |
628 | impl->dumpDOMAsWebArchive(); |
629 | |
630 | return JSValueMakeUndefined(context); |
631 | } |
632 | |
633 | JSValueRef JSTestRunner::dumpPolicyDelegateCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
634 | { |
635 | TestRunner* impl = toTestRunner(context, thisObject); |
636 | if (!impl) |
637 | return JSValueMakeUndefined(context); |
638 | |
639 | impl->dumpPolicyDelegateCallbacks(); |
640 | |
641 | return JSValueMakeUndefined(context); |
642 | } |
643 | |
644 | JSValueRef JSTestRunner::dumpResourceLoadStatistics(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
645 | { |
646 | TestRunner* impl = toTestRunner(context, thisObject); |
647 | if (!impl) |
648 | return JSValueMakeUndefined(context); |
649 | |
650 | impl->dumpResourceLoadStatistics(); |
651 | |
652 | return JSValueMakeUndefined(context); |
653 | } |
654 | |
655 | JSValueRef JSTestRunner::dumpAdClickAttribution(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
656 | { |
657 | TestRunner* impl = toTestRunner(context, thisObject); |
658 | if (!impl) |
659 | return JSValueMakeUndefined(context); |
660 | |
661 | impl->dumpAdClickAttribution(); |
662 | |
663 | return JSValueMakeUndefined(context); |
664 | } |
665 | |
666 | JSValueRef JSTestRunner::clearDOMCaches(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
667 | { |
668 | TestRunner* impl = toTestRunner(context, thisObject); |
669 | if (!impl) |
670 | return JSValueMakeUndefined(context); |
671 | |
672 | impl->clearDOMCaches(); |
673 | |
674 | return JSValueMakeUndefined(context); |
675 | } |
676 | |
677 | JSValueRef JSTestRunner::clearDOMCache(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
678 | { |
679 | TestRunner* impl = toTestRunner(context, thisObject); |
680 | if (!impl) |
681 | return JSValueMakeUndefined(context); |
682 | |
683 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
684 | impl->clearDOMCache(origin.get()); |
685 | |
686 | return JSValueMakeUndefined(context); |
687 | } |
688 | |
689 | JSValueRef JSTestRunner::hasDOMCache(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
690 | { |
691 | TestRunner* impl = toTestRunner(context, thisObject); |
692 | if (!impl) |
693 | return JSValueMakeUndefined(context); |
694 | |
695 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
696 | return JSValueMakeBoolean(context, impl->hasDOMCache(origin.get())); |
697 | } |
698 | |
699 | JSValueRef JSTestRunner::domCacheSize(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
700 | { |
701 | TestRunner* impl = toTestRunner(context, thisObject); |
702 | if (!impl) |
703 | return JSValueMakeUndefined(context); |
704 | |
705 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
706 | return JSValueMakeNumber(context, impl->domCacheSize(origin.get())); |
707 | } |
708 | |
709 | JSValueRef JSTestRunner::setAllowStorageQuotaIncrease(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
710 | { |
711 | TestRunner* impl = toTestRunner(context, thisObject); |
712 | if (!impl) |
713 | return JSValueMakeUndefined(context); |
714 | |
715 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
716 | impl->setAllowStorageQuotaIncrease(value); |
717 | |
718 | return JSValueMakeUndefined(context); |
719 | } |
720 | |
721 | JSValueRef JSTestRunner::keepWebHistory(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
722 | { |
723 | TestRunner* impl = toTestRunner(context, thisObject); |
724 | if (!impl) |
725 | return JSValueMakeUndefined(context); |
726 | |
727 | impl->keepWebHistory(); |
728 | |
729 | return JSValueMakeUndefined(context); |
730 | } |
731 | |
732 | JSValueRef JSTestRunner::setAcceptsEditing(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
733 | { |
734 | TestRunner* impl = toTestRunner(context, thisObject); |
735 | if (!impl) |
736 | return JSValueMakeUndefined(context); |
737 | |
738 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
739 | impl->setAcceptsEditing(value); |
740 | |
741 | return JSValueMakeUndefined(context); |
742 | } |
743 | |
744 | JSValueRef JSTestRunner::setCanOpenWindows(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
745 | { |
746 | TestRunner* impl = toTestRunner(context, thisObject); |
747 | if (!impl) |
748 | return JSValueMakeUndefined(context); |
749 | |
750 | impl->setCanOpenWindows(); |
751 | |
752 | return JSValueMakeUndefined(context); |
753 | } |
754 | |
755 | JSValueRef JSTestRunner::setCloseRemainingWindowsWhenComplete(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
756 | { |
757 | TestRunner* impl = toTestRunner(context, thisObject); |
758 | if (!impl) |
759 | return JSValueMakeUndefined(context); |
760 | |
761 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
762 | impl->setCloseRemainingWindowsWhenComplete(value); |
763 | |
764 | return JSValueMakeUndefined(context); |
765 | } |
766 | |
767 | JSValueRef JSTestRunner::setXSSAuditorEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
768 | { |
769 | TestRunner* impl = toTestRunner(context, thisObject); |
770 | if (!impl) |
771 | return JSValueMakeUndefined(context); |
772 | |
773 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
774 | impl->setXSSAuditorEnabled(value); |
775 | |
776 | return JSValueMakeUndefined(context); |
777 | } |
778 | |
779 | JSValueRef JSTestRunner::setAllowUniversalAccessFromFileURLs(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
780 | { |
781 | TestRunner* impl = toTestRunner(context, thisObject); |
782 | if (!impl) |
783 | return JSValueMakeUndefined(context); |
784 | |
785 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
786 | impl->setAllowUniversalAccessFromFileURLs(value); |
787 | |
788 | return JSValueMakeUndefined(context); |
789 | } |
790 | |
791 | JSValueRef JSTestRunner::setAllowFileAccessFromFileURLs(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
792 | { |
793 | TestRunner* impl = toTestRunner(context, thisObject); |
794 | if (!impl) |
795 | return JSValueMakeUndefined(context); |
796 | |
797 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
798 | impl->setAllowFileAccessFromFileURLs(value); |
799 | |
800 | return JSValueMakeUndefined(context); |
801 | } |
802 | |
803 | JSValueRef JSTestRunner::setNeedsStorageAccessFromFileURLsQuirk(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
804 | { |
805 | TestRunner* impl = toTestRunner(context, thisObject); |
806 | if (!impl) |
807 | return JSValueMakeUndefined(context); |
808 | |
809 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
810 | impl->setNeedsStorageAccessFromFileURLsQuirk(value); |
811 | |
812 | return JSValueMakeUndefined(context); |
813 | } |
814 | |
815 | JSValueRef JSTestRunner::setPluginsEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
816 | { |
817 | TestRunner* impl = toTestRunner(context, thisObject); |
818 | if (!impl) |
819 | return JSValueMakeUndefined(context); |
820 | |
821 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
822 | impl->setPluginsEnabled(value); |
823 | |
824 | return JSValueMakeUndefined(context); |
825 | } |
826 | |
827 | JSValueRef JSTestRunner::setJavaScriptCanAccessClipboard(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
828 | { |
829 | TestRunner* impl = toTestRunner(context, thisObject); |
830 | if (!impl) |
831 | return JSValueMakeUndefined(context); |
832 | |
833 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
834 | impl->setJavaScriptCanAccessClipboard(value); |
835 | |
836 | return JSValueMakeUndefined(context); |
837 | } |
838 | |
839 | JSValueRef JSTestRunner::setPrivateBrowsingEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
840 | { |
841 | TestRunner* impl = toTestRunner(context, thisObject); |
842 | if (!impl) |
843 | return JSValueMakeUndefined(context); |
844 | |
845 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
846 | impl->setPrivateBrowsingEnabled(value); |
847 | |
848 | return JSValueMakeUndefined(context); |
849 | } |
850 | |
851 | JSValueRef JSTestRunner::setUseDashboardCompatibilityMode(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
852 | { |
853 | TestRunner* impl = toTestRunner(context, thisObject); |
854 | if (!impl) |
855 | return JSValueMakeUndefined(context); |
856 | |
857 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
858 | impl->setUseDashboardCompatibilityMode(value); |
859 | |
860 | return JSValueMakeUndefined(context); |
861 | } |
862 | |
863 | JSValueRef JSTestRunner::(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
864 | { |
865 | TestRunner* impl = toTestRunner(context, thisObject); |
866 | if (!impl) |
867 | return JSValueMakeUndefined(context); |
868 | |
869 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
870 | impl->setPopupBlockingEnabled(value); |
871 | |
872 | return JSValueMakeUndefined(context); |
873 | } |
874 | |
875 | JSValueRef JSTestRunner::setAuthorAndUserStylesEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
876 | { |
877 | TestRunner* impl = toTestRunner(context, thisObject); |
878 | if (!impl) |
879 | return JSValueMakeUndefined(context); |
880 | |
881 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
882 | impl->setAuthorAndUserStylesEnabled(value); |
883 | |
884 | return JSValueMakeUndefined(context); |
885 | } |
886 | |
887 | JSValueRef JSTestRunner::setCustomPolicyDelegate(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
888 | { |
889 | TestRunner* impl = toTestRunner(context, thisObject); |
890 | if (!impl) |
891 | return JSValueMakeUndefined(context); |
892 | |
893 | bool enabled = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
894 | bool permissive = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
895 | impl->setCustomPolicyDelegate(enabled, permissive); |
896 | |
897 | return JSValueMakeUndefined(context); |
898 | } |
899 | |
900 | JSValueRef JSTestRunner::addOriginAccessWhitelistEntry(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
901 | { |
902 | TestRunner* impl = toTestRunner(context, thisObject); |
903 | if (!impl) |
904 | return JSValueMakeUndefined(context); |
905 | |
906 | JSRetainPtr<JSStringRef> sourceOrigin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
907 | JSRetainPtr<JSStringRef> destinationProtocol = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
908 | JSRetainPtr<JSStringRef> destinationHost = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
909 | bool allowDestinationSubdomains = argumentCount > 3 && JSValueToBoolean(context, arguments[3]); |
910 | impl->addOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains); |
911 | |
912 | return JSValueMakeUndefined(context); |
913 | } |
914 | |
915 | JSValueRef JSTestRunner::removeOriginAccessWhitelistEntry(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
916 | { |
917 | TestRunner* impl = toTestRunner(context, thisObject); |
918 | if (!impl) |
919 | return JSValueMakeUndefined(context); |
920 | |
921 | JSRetainPtr<JSStringRef> sourceOrigin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
922 | JSRetainPtr<JSStringRef> destinationProtocol = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
923 | JSRetainPtr<JSStringRef> destinationHost = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
924 | bool allowDestinationSubdomains = argumentCount > 3 && JSValueToBoolean(context, arguments[3]); |
925 | impl->removeOriginAccessWhitelistEntry(sourceOrigin.get(), destinationProtocol.get(), destinationHost.get(), allowDestinationSubdomains); |
926 | |
927 | return JSValueMakeUndefined(context); |
928 | } |
929 | |
930 | JSValueRef JSTestRunner::setUserStyleSheetEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
931 | { |
932 | TestRunner* impl = toTestRunner(context, thisObject); |
933 | if (!impl) |
934 | return JSValueMakeUndefined(context); |
935 | |
936 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
937 | impl->setUserStyleSheetEnabled(value); |
938 | |
939 | return JSValueMakeUndefined(context); |
940 | } |
941 | |
942 | JSValueRef JSTestRunner::setUserStyleSheetLocation(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
943 | { |
944 | TestRunner* impl = toTestRunner(context, thisObject); |
945 | if (!impl) |
946 | return JSValueMakeUndefined(context); |
947 | |
948 | JSRetainPtr<JSStringRef> location = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
949 | impl->setUserStyleSheetLocation(location.get()); |
950 | |
951 | return JSValueMakeUndefined(context); |
952 | } |
953 | |
954 | JSValueRef JSTestRunner::setSpatialNavigationEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
955 | { |
956 | TestRunner* impl = toTestRunner(context, thisObject); |
957 | if (!impl) |
958 | return JSValueMakeUndefined(context); |
959 | |
960 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
961 | impl->setSpatialNavigationEnabled(value); |
962 | |
963 | return JSValueMakeUndefined(context); |
964 | } |
965 | |
966 | JSValueRef JSTestRunner::setTabKeyCyclesThroughElements(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
967 | { |
968 | TestRunner* impl = toTestRunner(context, thisObject); |
969 | if (!impl) |
970 | return JSValueMakeUndefined(context); |
971 | |
972 | bool enabled = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
973 | impl->setTabKeyCyclesThroughElements(enabled); |
974 | |
975 | return JSValueMakeUndefined(context); |
976 | } |
977 | |
978 | JSValueRef JSTestRunner::setSerializeHTTPLoads(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
979 | { |
980 | TestRunner* impl = toTestRunner(context, thisObject); |
981 | if (!impl) |
982 | return JSValueMakeUndefined(context); |
983 | |
984 | impl->setSerializeHTTPLoads(); |
985 | |
986 | return JSValueMakeUndefined(context); |
987 | } |
988 | |
989 | JSValueRef JSTestRunner::dispatchPendingLoadRequests(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
990 | { |
991 | TestRunner* impl = toTestRunner(context, thisObject); |
992 | if (!impl) |
993 | return JSValueMakeUndefined(context); |
994 | |
995 | impl->dispatchPendingLoadRequests(); |
996 | |
997 | return JSValueMakeUndefined(context); |
998 | } |
999 | |
1000 | JSValueRef JSTestRunner::setCacheModel(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1001 | { |
1002 | TestRunner* impl = toTestRunner(context, thisObject); |
1003 | if (!impl) |
1004 | return JSValueMakeUndefined(context); |
1005 | |
1006 | double model = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1007 | impl->setCacheModel(model); |
1008 | |
1009 | return JSValueMakeUndefined(context); |
1010 | } |
1011 | |
1012 | JSValueRef JSTestRunner::setAsynchronousSpellCheckingEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1013 | { |
1014 | TestRunner* impl = toTestRunner(context, thisObject); |
1015 | if (!impl) |
1016 | return JSValueMakeUndefined(context); |
1017 | |
1018 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1019 | impl->setAsynchronousSpellCheckingEnabled(value); |
1020 | |
1021 | return JSValueMakeUndefined(context); |
1022 | } |
1023 | |
1024 | JSValueRef JSTestRunner::setPrinting(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1025 | { |
1026 | TestRunner* impl = toTestRunner(context, thisObject); |
1027 | if (!impl) |
1028 | return JSValueMakeUndefined(context); |
1029 | |
1030 | impl->setPrinting(); |
1031 | |
1032 | return JSValueMakeUndefined(context); |
1033 | } |
1034 | |
1035 | JSValueRef JSTestRunner::setShouldDecideNavigationPolicyAfterDelay(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1036 | { |
1037 | TestRunner* impl = toTestRunner(context, thisObject); |
1038 | if (!impl) |
1039 | return JSValueMakeUndefined(context); |
1040 | |
1041 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1042 | impl->setShouldDecideNavigationPolicyAfterDelay(value); |
1043 | |
1044 | return JSValueMakeUndefined(context); |
1045 | } |
1046 | |
1047 | JSValueRef JSTestRunner::setShouldDecideResponsePolicyAfterDelay(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1048 | { |
1049 | TestRunner* impl = toTestRunner(context, thisObject); |
1050 | if (!impl) |
1051 | return JSValueMakeUndefined(context); |
1052 | |
1053 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1054 | impl->setShouldDecideResponsePolicyAfterDelay(value); |
1055 | |
1056 | return JSValueMakeUndefined(context); |
1057 | } |
1058 | |
1059 | JSValueRef JSTestRunner::setNavigationGesturesEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1060 | { |
1061 | TestRunner* impl = toTestRunner(context, thisObject); |
1062 | if (!impl) |
1063 | return JSValueMakeUndefined(context); |
1064 | |
1065 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1066 | impl->setNavigationGesturesEnabled(value); |
1067 | |
1068 | return JSValueMakeUndefined(context); |
1069 | } |
1070 | |
1071 | JSValueRef JSTestRunner::setIgnoresViewportScaleLimits(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1072 | { |
1073 | TestRunner* impl = toTestRunner(context, thisObject); |
1074 | if (!impl) |
1075 | return JSValueMakeUndefined(context); |
1076 | |
1077 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1078 | impl->setIgnoresViewportScaleLimits(value); |
1079 | |
1080 | return JSValueMakeUndefined(context); |
1081 | } |
1082 | |
1083 | JSValueRef JSTestRunner::setShouldDownloadUndisplayableMIMETypes(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1084 | { |
1085 | TestRunner* impl = toTestRunner(context, thisObject); |
1086 | if (!impl) |
1087 | return JSValueMakeUndefined(context); |
1088 | |
1089 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1090 | impl->setShouldDownloadUndisplayableMIMETypes(value); |
1091 | |
1092 | return JSValueMakeUndefined(context); |
1093 | } |
1094 | |
1095 | JSValueRef JSTestRunner::clearBackForwardList(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1096 | { |
1097 | TestRunner* impl = toTestRunner(context, thisObject); |
1098 | if (!impl) |
1099 | return JSValueMakeUndefined(context); |
1100 | |
1101 | impl->clearBackForwardList(); |
1102 | |
1103 | return JSValueMakeUndefined(context); |
1104 | } |
1105 | |
1106 | JSValueRef JSTestRunner::execCommand(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1107 | { |
1108 | TestRunner* impl = toTestRunner(context, thisObject); |
1109 | if (!impl) |
1110 | return JSValueMakeUndefined(context); |
1111 | |
1112 | JSRetainPtr<JSStringRef> name = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1113 | JSRetainPtr<JSStringRef> showUI = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1114 | JSRetainPtr<JSStringRef> value = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
1115 | impl->execCommand(name.get(), showUI.get(), value.get()); |
1116 | |
1117 | return JSValueMakeUndefined(context); |
1118 | } |
1119 | |
1120 | JSValueRef JSTestRunner::isCommandEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1121 | { |
1122 | TestRunner* impl = toTestRunner(context, thisObject); |
1123 | if (!impl) |
1124 | return JSValueMakeUndefined(context); |
1125 | |
1126 | JSRetainPtr<JSStringRef> name = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1127 | return JSValueMakeBoolean(context, impl->isCommandEnabled(name.get())); |
1128 | } |
1129 | |
1130 | JSValueRef JSTestRunner::windowCount(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1131 | { |
1132 | TestRunner* impl = toTestRunner(context, thisObject); |
1133 | if (!impl) |
1134 | return JSValueMakeUndefined(context); |
1135 | |
1136 | return JSValueMakeNumber(context, impl->windowCount()); |
1137 | } |
1138 | |
1139 | JSValueRef JSTestRunner::setShouldAllowDeviceOrientationAndMotionAccess(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1140 | { |
1141 | TestRunner* impl = toTestRunner(context, thisObject); |
1142 | if (!impl) |
1143 | return JSValueMakeUndefined(context); |
1144 | |
1145 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1146 | impl->setShouldAllowDeviceOrientationAndMotionAccess(value); |
1147 | |
1148 | return JSValueMakeUndefined(context); |
1149 | } |
1150 | |
1151 | JSValueRef JSTestRunner::testRepaint(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1152 | { |
1153 | TestRunner* impl = toTestRunner(context, thisObject); |
1154 | if (!impl) |
1155 | return JSValueMakeUndefined(context); |
1156 | |
1157 | impl->testRepaint(); |
1158 | |
1159 | return JSValueMakeUndefined(context); |
1160 | } |
1161 | |
1162 | JSValueRef JSTestRunner::repaintSweepHorizontally(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1163 | { |
1164 | TestRunner* impl = toTestRunner(context, thisObject); |
1165 | if (!impl) |
1166 | return JSValueMakeUndefined(context); |
1167 | |
1168 | impl->repaintSweepHorizontally(); |
1169 | |
1170 | return JSValueMakeUndefined(context); |
1171 | } |
1172 | |
1173 | JSValueRef JSTestRunner::display(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1174 | { |
1175 | TestRunner* impl = toTestRunner(context, thisObject); |
1176 | if (!impl) |
1177 | return JSValueMakeUndefined(context); |
1178 | |
1179 | impl->display(); |
1180 | |
1181 | return JSValueMakeUndefined(context); |
1182 | } |
1183 | |
1184 | JSValueRef JSTestRunner::displayAndTrackRepaints(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1185 | { |
1186 | TestRunner* impl = toTestRunner(context, thisObject); |
1187 | if (!impl) |
1188 | return JSValueMakeUndefined(context); |
1189 | |
1190 | impl->displayAndTrackRepaints(); |
1191 | |
1192 | return JSValueMakeUndefined(context); |
1193 | } |
1194 | |
1195 | JSValueRef JSTestRunner::forceImmediateCompletion(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1196 | { |
1197 | TestRunner* impl = toTestRunner(context, thisObject); |
1198 | if (!impl) |
1199 | return JSValueMakeUndefined(context); |
1200 | |
1201 | impl->forceImmediateCompletion(); |
1202 | |
1203 | return JSValueMakeUndefined(context); |
1204 | } |
1205 | |
1206 | JSValueRef JSTestRunner::isPageBoxVisible(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1207 | { |
1208 | TestRunner* impl = toTestRunner(context, thisObject); |
1209 | if (!impl) |
1210 | return JSValueMakeUndefined(context); |
1211 | |
1212 | double pageIndex = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1213 | return JSValueMakeBoolean(context, impl->isPageBoxVisible(pageIndex)); |
1214 | } |
1215 | |
1216 | JSValueRef JSTestRunner::(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1217 | { |
1218 | TestRunner* impl = toTestRunner(context, thisObject); |
1219 | if (!impl) |
1220 | return JSValueMakeUndefined(context); |
1221 | |
1222 | impl->dumpAllHTTPRedirectedResponseHeaders(); |
1223 | |
1224 | return JSValueMakeUndefined(context); |
1225 | } |
1226 | |
1227 | JSValueRef JSTestRunner::setValueForUser(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1228 | { |
1229 | TestRunner* impl = toTestRunner(context, thisObject); |
1230 | if (!impl) |
1231 | return JSValueMakeUndefined(context); |
1232 | |
1233 | JSValueRef element = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1234 | JSRetainPtr<JSStringRef> value = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1235 | impl->setValueForUser(context, element, value.get()); |
1236 | |
1237 | return JSValueMakeUndefined(context); |
1238 | } |
1239 | |
1240 | JSValueRef JSTestRunner::addUserScript(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1241 | { |
1242 | TestRunner* impl = toTestRunner(context, thisObject); |
1243 | if (!impl) |
1244 | return JSValueMakeUndefined(context); |
1245 | |
1246 | JSRetainPtr<JSStringRef> source = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1247 | bool runAtStart = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
1248 | bool allFrames = argumentCount > 2 && JSValueToBoolean(context, arguments[2]); |
1249 | impl->addUserScript(source.get(), runAtStart, allFrames); |
1250 | |
1251 | return JSValueMakeUndefined(context); |
1252 | } |
1253 | |
1254 | JSValueRef JSTestRunner::addUserStyleSheet(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1255 | { |
1256 | TestRunner* impl = toTestRunner(context, thisObject); |
1257 | if (!impl) |
1258 | return JSValueMakeUndefined(context); |
1259 | |
1260 | JSRetainPtr<JSStringRef> source = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1261 | bool allFrames = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
1262 | impl->addUserStyleSheet(source.get(), allFrames); |
1263 | |
1264 | return JSValueMakeUndefined(context); |
1265 | } |
1266 | |
1267 | JSValueRef JSTestRunner::clearAllDatabases(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1268 | { |
1269 | TestRunner* impl = toTestRunner(context, thisObject); |
1270 | if (!impl) |
1271 | return JSValueMakeUndefined(context); |
1272 | |
1273 | impl->clearAllDatabases(); |
1274 | |
1275 | return JSValueMakeUndefined(context); |
1276 | } |
1277 | |
1278 | JSValueRef JSTestRunner::setDatabaseQuota(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1279 | { |
1280 | TestRunner* impl = toTestRunner(context, thisObject); |
1281 | if (!impl) |
1282 | return JSValueMakeUndefined(context); |
1283 | |
1284 | double quota = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1285 | impl->setDatabaseQuota(quota); |
1286 | |
1287 | return JSValueMakeUndefined(context); |
1288 | } |
1289 | |
1290 | JSValueRef JSTestRunner::pathToLocalResource(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1291 | { |
1292 | TestRunner* impl = toTestRunner(context, thisObject); |
1293 | if (!impl) |
1294 | return JSValueMakeUndefined(context); |
1295 | |
1296 | JSRetainPtr<JSStringRef> url = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1297 | return JSValueMakeStringOrNull(context, impl->pathToLocalResource(url.get()).get()); |
1298 | } |
1299 | |
1300 | JSValueRef JSTestRunner::setIDBPerOriginQuota(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1301 | { |
1302 | TestRunner* impl = toTestRunner(context, thisObject); |
1303 | if (!impl) |
1304 | return JSValueMakeUndefined(context); |
1305 | |
1306 | double quota = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1307 | impl->setIDBPerOriginQuota(quota); |
1308 | |
1309 | return JSValueMakeUndefined(context); |
1310 | } |
1311 | |
1312 | JSValueRef JSTestRunner::clearAllApplicationCaches(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1313 | { |
1314 | TestRunner* impl = toTestRunner(context, thisObject); |
1315 | if (!impl) |
1316 | return JSValueMakeUndefined(context); |
1317 | |
1318 | impl->clearAllApplicationCaches(); |
1319 | |
1320 | return JSValueMakeUndefined(context); |
1321 | } |
1322 | |
1323 | JSValueRef JSTestRunner::setAppCacheMaximumSize(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1324 | { |
1325 | TestRunner* impl = toTestRunner(context, thisObject); |
1326 | if (!impl) |
1327 | return JSValueMakeUndefined(context); |
1328 | |
1329 | double size = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1330 | impl->setAppCacheMaximumSize(size); |
1331 | |
1332 | return JSValueMakeUndefined(context); |
1333 | } |
1334 | |
1335 | JSValueRef JSTestRunner::applicationCacheDiskUsageForOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1336 | { |
1337 | TestRunner* impl = toTestRunner(context, thisObject); |
1338 | if (!impl) |
1339 | return JSValueMakeUndefined(context); |
1340 | |
1341 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1342 | return JSValueMakeNumber(context, impl->applicationCacheDiskUsageForOrigin(origin.get())); |
1343 | } |
1344 | |
1345 | JSValueRef JSTestRunner::clearApplicationCacheForOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1346 | { |
1347 | TestRunner* impl = toTestRunner(context, thisObject); |
1348 | if (!impl) |
1349 | return JSValueMakeUndefined(context); |
1350 | |
1351 | JSRetainPtr<JSStringRef> name = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1352 | impl->clearApplicationCacheForOrigin(name.get()); |
1353 | |
1354 | return JSValueMakeUndefined(context); |
1355 | } |
1356 | |
1357 | JSValueRef JSTestRunner::disallowIncreaseForApplicationCacheQuota(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1358 | { |
1359 | TestRunner* impl = toTestRunner(context, thisObject); |
1360 | if (!impl) |
1361 | return JSValueMakeUndefined(context); |
1362 | |
1363 | impl->disallowIncreaseForApplicationCacheQuota(); |
1364 | |
1365 | return JSValueMakeUndefined(context); |
1366 | } |
1367 | |
1368 | JSValueRef JSTestRunner::originsWithApplicationCache(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1369 | { |
1370 | TestRunner* impl = toTestRunner(context, thisObject); |
1371 | if (!impl) |
1372 | return JSValueMakeUndefined(context); |
1373 | |
1374 | return impl->originsWithApplicationCache(); |
1375 | } |
1376 | |
1377 | JSValueRef JSTestRunner::findString(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1378 | { |
1379 | TestRunner* impl = toTestRunner(context, thisObject); |
1380 | if (!impl) |
1381 | return JSValueMakeUndefined(context); |
1382 | |
1383 | JSRetainPtr<JSStringRef> target = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1384 | JSValueRef optionsArray = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
1385 | return JSValueMakeBoolean(context, impl->findString(target.get(), optionsArray)); |
1386 | } |
1387 | |
1388 | JSValueRef JSTestRunner::findStringMatchesInPage(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1389 | { |
1390 | TestRunner* impl = toTestRunner(context, thisObject); |
1391 | if (!impl) |
1392 | return JSValueMakeUndefined(context); |
1393 | |
1394 | JSRetainPtr<JSStringRef> target = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1395 | JSValueRef optionsArray = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
1396 | impl->findStringMatchesInPage(target.get(), optionsArray); |
1397 | |
1398 | return JSValueMakeUndefined(context); |
1399 | } |
1400 | |
1401 | JSValueRef JSTestRunner::replaceFindMatchesAtIndices(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1402 | { |
1403 | TestRunner* impl = toTestRunner(context, thisObject); |
1404 | if (!impl) |
1405 | return JSValueMakeUndefined(context); |
1406 | |
1407 | JSValueRef matchIndicesArray = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1408 | JSRetainPtr<JSStringRef> replacementText = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1409 | bool selectionOnly = argumentCount > 2 && JSValueToBoolean(context, arguments[2]); |
1410 | impl->replaceFindMatchesAtIndices(matchIndicesArray, replacementText.get(), selectionOnly); |
1411 | |
1412 | return JSValueMakeUndefined(context); |
1413 | } |
1414 | |
1415 | JSValueRef JSTestRunner::evaluateScriptInIsolatedWorld(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1416 | { |
1417 | TestRunner* impl = toTestRunner(context, thisObject); |
1418 | if (!impl) |
1419 | return JSValueMakeUndefined(context); |
1420 | |
1421 | double worldID = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1422 | JSRetainPtr<JSStringRef> script = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1423 | impl->evaluateScriptInIsolatedWorld(context, worldID, script.get()); |
1424 | |
1425 | return JSValueMakeUndefined(context); |
1426 | } |
1427 | |
1428 | JSValueRef JSTestRunner::showWebInspector(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1429 | { |
1430 | TestRunner* impl = toTestRunner(context, thisObject); |
1431 | if (!impl) |
1432 | return JSValueMakeUndefined(context); |
1433 | |
1434 | impl->showWebInspector(); |
1435 | |
1436 | return JSValueMakeUndefined(context); |
1437 | } |
1438 | |
1439 | JSValueRef JSTestRunner::closeWebInspector(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1440 | { |
1441 | TestRunner* impl = toTestRunner(context, thisObject); |
1442 | if (!impl) |
1443 | return JSValueMakeUndefined(context); |
1444 | |
1445 | impl->closeWebInspector(); |
1446 | |
1447 | return JSValueMakeUndefined(context); |
1448 | } |
1449 | |
1450 | JSValueRef JSTestRunner::evaluateInWebInspector(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1451 | { |
1452 | TestRunner* impl = toTestRunner(context, thisObject); |
1453 | if (!impl) |
1454 | return JSValueMakeUndefined(context); |
1455 | |
1456 | JSRetainPtr<JSStringRef> script = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1457 | impl->evaluateInWebInspector(script.get()); |
1458 | |
1459 | return JSValueMakeUndefined(context); |
1460 | } |
1461 | |
1462 | JSValueRef JSTestRunner::setPOSIXLocale(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1463 | { |
1464 | TestRunner* impl = toTestRunner(context, thisObject); |
1465 | if (!impl) |
1466 | return JSValueMakeUndefined(context); |
1467 | |
1468 | JSRetainPtr<JSStringRef> locale = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1469 | impl->setPOSIXLocale(locale.get()); |
1470 | |
1471 | return JSValueMakeUndefined(context); |
1472 | } |
1473 | |
1474 | JSValueRef JSTestRunner::setTextDirection(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1475 | { |
1476 | TestRunner* impl = toTestRunner(context, thisObject); |
1477 | if (!impl) |
1478 | return JSValueMakeUndefined(context); |
1479 | |
1480 | JSRetainPtr<JSStringRef> direction = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1481 | impl->setTextDirection(direction.get()); |
1482 | |
1483 | return JSValueMakeUndefined(context); |
1484 | } |
1485 | |
1486 | JSValueRef JSTestRunner::setWillSendRequestReturnsNull(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1487 | { |
1488 | TestRunner* impl = toTestRunner(context, thisObject); |
1489 | if (!impl) |
1490 | return JSValueMakeUndefined(context); |
1491 | |
1492 | bool flag = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1493 | impl->setWillSendRequestReturnsNull(flag); |
1494 | |
1495 | return JSValueMakeUndefined(context); |
1496 | } |
1497 | |
1498 | JSValueRef JSTestRunner::setWillSendRequestReturnsNullOnRedirect(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1499 | { |
1500 | TestRunner* impl = toTestRunner(context, thisObject); |
1501 | if (!impl) |
1502 | return JSValueMakeUndefined(context); |
1503 | |
1504 | bool flag = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1505 | impl->setWillSendRequestReturnsNullOnRedirect(flag); |
1506 | |
1507 | return JSValueMakeUndefined(context); |
1508 | } |
1509 | |
1510 | JSValueRef JSTestRunner::setWillSendRequestAddsHTTPBody(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1511 | { |
1512 | TestRunner* impl = toTestRunner(context, thisObject); |
1513 | if (!impl) |
1514 | return JSValueMakeUndefined(context); |
1515 | |
1516 | JSRetainPtr<JSStringRef> body = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1517 | impl->setWillSendRequestAddsHTTPBody(body.get()); |
1518 | |
1519 | return JSValueMakeUndefined(context); |
1520 | } |
1521 | |
1522 | JSValueRef JSTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1523 | { |
1524 | TestRunner* impl = toTestRunner(context, thisObject); |
1525 | if (!impl) |
1526 | return JSValueMakeUndefined(context); |
1527 | |
1528 | bool flag = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1529 | impl->setShouldStayOnPageAfterHandlingBeforeUnload(flag); |
1530 | |
1531 | return JSValueMakeUndefined(context); |
1532 | } |
1533 | |
1534 | JSValueRef JSTestRunner::setStopProvisionalFrameLoads(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1535 | { |
1536 | TestRunner* impl = toTestRunner(context, thisObject); |
1537 | if (!impl) |
1538 | return JSValueMakeUndefined(context); |
1539 | |
1540 | impl->setStopProvisionalFrameLoads(); |
1541 | |
1542 | return JSValueMakeUndefined(context); |
1543 | } |
1544 | |
1545 | JSValueRef JSTestRunner::clearDidReceiveServerRedirectForProvisionalNavigation(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1546 | { |
1547 | TestRunner* impl = toTestRunner(context, thisObject); |
1548 | if (!impl) |
1549 | return JSValueMakeUndefined(context); |
1550 | |
1551 | impl->clearDidReceiveServerRedirectForProvisionalNavigation(); |
1552 | |
1553 | return JSValueMakeUndefined(context); |
1554 | } |
1555 | |
1556 | JSValueRef JSTestRunner::addChromeInputField(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1557 | { |
1558 | TestRunner* impl = toTestRunner(context, thisObject); |
1559 | if (!impl) |
1560 | return JSValueMakeUndefined(context); |
1561 | |
1562 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1563 | impl->addChromeInputField(callback); |
1564 | |
1565 | return JSValueMakeUndefined(context); |
1566 | } |
1567 | |
1568 | JSValueRef JSTestRunner::removeChromeInputField(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1569 | { |
1570 | TestRunner* impl = toTestRunner(context, thisObject); |
1571 | if (!impl) |
1572 | return JSValueMakeUndefined(context); |
1573 | |
1574 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1575 | impl->removeChromeInputField(callback); |
1576 | |
1577 | return JSValueMakeUndefined(context); |
1578 | } |
1579 | |
1580 | JSValueRef JSTestRunner::focusWebView(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1581 | { |
1582 | TestRunner* impl = toTestRunner(context, thisObject); |
1583 | if (!impl) |
1584 | return JSValueMakeUndefined(context); |
1585 | |
1586 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1587 | impl->focusWebView(callback); |
1588 | |
1589 | return JSValueMakeUndefined(context); |
1590 | } |
1591 | |
1592 | JSValueRef JSTestRunner::setBackingScaleFactor(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1593 | { |
1594 | TestRunner* impl = toTestRunner(context, thisObject); |
1595 | if (!impl) |
1596 | return JSValueMakeUndefined(context); |
1597 | |
1598 | double backingScaleFactor = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1599 | JSValueRef callback = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
1600 | impl->setBackingScaleFactor(backingScaleFactor, callback); |
1601 | |
1602 | return JSValueMakeUndefined(context); |
1603 | } |
1604 | |
1605 | JSValueRef JSTestRunner::setWindowIsKey(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1606 | { |
1607 | TestRunner* impl = toTestRunner(context, thisObject); |
1608 | if (!impl) |
1609 | return JSValueMakeUndefined(context); |
1610 | |
1611 | bool isKey = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1612 | impl->setWindowIsKey(isKey); |
1613 | |
1614 | return JSValueMakeUndefined(context); |
1615 | } |
1616 | |
1617 | JSValueRef JSTestRunner::setViewSize(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1618 | { |
1619 | TestRunner* impl = toTestRunner(context, thisObject); |
1620 | if (!impl) |
1621 | return JSValueMakeUndefined(context); |
1622 | |
1623 | double width = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1624 | double height = argumentCount > 1 ? JSValueToNumber(context, arguments[1], nullptr) : 0; |
1625 | impl->setViewSize(width, height); |
1626 | |
1627 | return JSValueMakeUndefined(context); |
1628 | } |
1629 | |
1630 | JSValueRef JSTestRunner::setAlwaysAcceptCookies(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1631 | { |
1632 | TestRunner* impl = toTestRunner(context, thisObject); |
1633 | if (!impl) |
1634 | return JSValueMakeUndefined(context); |
1635 | |
1636 | bool accept = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1637 | impl->setAlwaysAcceptCookies(accept); |
1638 | |
1639 | return JSValueMakeUndefined(context); |
1640 | } |
1641 | |
1642 | JSValueRef JSTestRunner::setOnlyAcceptFirstPartyCookies(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1643 | { |
1644 | TestRunner* impl = toTestRunner(context, thisObject); |
1645 | if (!impl) |
1646 | return JSValueMakeUndefined(context); |
1647 | |
1648 | bool accept = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1649 | impl->setOnlyAcceptFirstPartyCookies(accept); |
1650 | |
1651 | return JSValueMakeUndefined(context); |
1652 | } |
1653 | |
1654 | JSValueRef JSTestRunner::overridePreference(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1655 | { |
1656 | TestRunner* impl = toTestRunner(context, thisObject); |
1657 | if (!impl) |
1658 | return JSValueMakeUndefined(context); |
1659 | |
1660 | JSRetainPtr<JSStringRef> preference = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1661 | JSRetainPtr<JSStringRef> value = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1662 | impl->overridePreference(preference.get(), value.get()); |
1663 | |
1664 | return JSValueMakeUndefined(context); |
1665 | } |
1666 | |
1667 | JSValueRef JSTestRunner::setPageVisibility(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1668 | { |
1669 | TestRunner* impl = toTestRunner(context, thisObject); |
1670 | if (!impl) |
1671 | return JSValueMakeUndefined(context); |
1672 | |
1673 | JSRetainPtr<JSStringRef> state = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1674 | impl->setPageVisibility(state.get()); |
1675 | |
1676 | return JSValueMakeUndefined(context); |
1677 | } |
1678 | |
1679 | JSValueRef JSTestRunner::resetPageVisibility(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1680 | { |
1681 | TestRunner* impl = toTestRunner(context, thisObject); |
1682 | if (!impl) |
1683 | return JSValueMakeUndefined(context); |
1684 | |
1685 | impl->resetPageVisibility(); |
1686 | |
1687 | return JSValueMakeUndefined(context); |
1688 | } |
1689 | |
1690 | JSValueRef JSTestRunner::setHasCustomFullScreenBehavior(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1691 | { |
1692 | TestRunner* impl = toTestRunner(context, thisObject); |
1693 | if (!impl) |
1694 | return JSValueMakeUndefined(context); |
1695 | |
1696 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1697 | impl->setHasCustomFullScreenBehavior(value); |
1698 | |
1699 | return JSValueMakeUndefined(context); |
1700 | } |
1701 | |
1702 | JSValueRef JSTestRunner::grantWebNotificationPermission(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1703 | { |
1704 | TestRunner* impl = toTestRunner(context, thisObject); |
1705 | if (!impl) |
1706 | return JSValueMakeUndefined(context); |
1707 | |
1708 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1709 | impl->grantWebNotificationPermission(origin.get()); |
1710 | |
1711 | return JSValueMakeUndefined(context); |
1712 | } |
1713 | |
1714 | JSValueRef JSTestRunner::denyWebNotificationPermission(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1715 | { |
1716 | TestRunner* impl = toTestRunner(context, thisObject); |
1717 | if (!impl) |
1718 | return JSValueMakeUndefined(context); |
1719 | |
1720 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1721 | impl->denyWebNotificationPermission(origin.get()); |
1722 | |
1723 | return JSValueMakeUndefined(context); |
1724 | } |
1725 | |
1726 | JSValueRef JSTestRunner::removeAllWebNotificationPermissions(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1727 | { |
1728 | TestRunner* impl = toTestRunner(context, thisObject); |
1729 | if (!impl) |
1730 | return JSValueMakeUndefined(context); |
1731 | |
1732 | impl->removeAllWebNotificationPermissions(); |
1733 | |
1734 | return JSValueMakeUndefined(context); |
1735 | } |
1736 | |
1737 | JSValueRef JSTestRunner::simulateWebNotificationClick(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1738 | { |
1739 | TestRunner* impl = toTestRunner(context, thisObject); |
1740 | if (!impl) |
1741 | return JSValueMakeUndefined(context); |
1742 | |
1743 | JSValueRef notification = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1744 | impl->simulateWebNotificationClick(notification); |
1745 | |
1746 | return JSValueMakeUndefined(context); |
1747 | } |
1748 | |
1749 | JSValueRef JSTestRunner::setGeolocationPermission(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1750 | { |
1751 | TestRunner* impl = toTestRunner(context, thisObject); |
1752 | if (!impl) |
1753 | return JSValueMakeUndefined(context); |
1754 | |
1755 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1756 | impl->setGeolocationPermission(value); |
1757 | |
1758 | return JSValueMakeUndefined(context); |
1759 | } |
1760 | |
1761 | JSValueRef JSTestRunner::setMockGeolocationPosition(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1762 | { |
1763 | TestRunner* impl = toTestRunner(context, thisObject); |
1764 | if (!impl) |
1765 | return JSValueMakeUndefined(context); |
1766 | |
1767 | double latitude = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1768 | double longitude = argumentCount > 1 ? JSValueToNumber(context, arguments[1], nullptr) : 0; |
1769 | double accuracy = argumentCount > 2 ? JSValueToNumber(context, arguments[2], nullptr) : 0; |
1770 | JSValueRef altitude = argumentCount > 3 ? arguments[3] : JSValueMakeUndefined(context); |
1771 | JSValueRef altitudeAccuracy = argumentCount > 4 ? arguments[4] : JSValueMakeUndefined(context); |
1772 | JSValueRef heading = argumentCount > 5 ? arguments[5] : JSValueMakeUndefined(context); |
1773 | JSValueRef speed = argumentCount > 6 ? arguments[6] : JSValueMakeUndefined(context); |
1774 | JSValueRef floorLevel = argumentCount > 7 ? arguments[7] : JSValueMakeUndefined(context); |
1775 | impl->setMockGeolocationPosition(latitude, longitude, accuracy, altitude, altitudeAccuracy, heading, speed, floorLevel); |
1776 | |
1777 | return JSValueMakeUndefined(context); |
1778 | } |
1779 | |
1780 | JSValueRef JSTestRunner::setMockGeolocationPositionUnavailableError(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1781 | { |
1782 | TestRunner* impl = toTestRunner(context, thisObject); |
1783 | if (!impl) |
1784 | return JSValueMakeUndefined(context); |
1785 | |
1786 | JSRetainPtr<JSStringRef> errorMessage = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1787 | impl->setMockGeolocationPositionUnavailableError(errorMessage.get()); |
1788 | |
1789 | return JSValueMakeUndefined(context); |
1790 | } |
1791 | |
1792 | JSValueRef JSTestRunner::isGeolocationProviderActive(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1793 | { |
1794 | TestRunner* impl = toTestRunner(context, thisObject); |
1795 | if (!impl) |
1796 | return JSValueMakeUndefined(context); |
1797 | |
1798 | return JSValueMakeBoolean(context, impl->isGeolocationProviderActive()); |
1799 | } |
1800 | |
1801 | JSValueRef JSTestRunner::setUserMediaPermission(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1802 | { |
1803 | TestRunner* impl = toTestRunner(context, thisObject); |
1804 | if (!impl) |
1805 | return JSValueMakeUndefined(context); |
1806 | |
1807 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1808 | impl->setUserMediaPermission(value); |
1809 | |
1810 | return JSValueMakeUndefined(context); |
1811 | } |
1812 | |
1813 | JSValueRef JSTestRunner::resetUserMediaPermission(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1814 | { |
1815 | TestRunner* impl = toTestRunner(context, thisObject); |
1816 | if (!impl) |
1817 | return JSValueMakeUndefined(context); |
1818 | |
1819 | impl->resetUserMediaPermission(); |
1820 | |
1821 | return JSValueMakeUndefined(context); |
1822 | } |
1823 | |
1824 | JSValueRef JSTestRunner::setUserMediaPersistentPermissionForOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1825 | { |
1826 | TestRunner* impl = toTestRunner(context, thisObject); |
1827 | if (!impl) |
1828 | return JSValueMakeUndefined(context); |
1829 | |
1830 | bool permission = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1831 | JSRetainPtr<JSStringRef> origin = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1832 | JSRetainPtr<JSStringRef> parentOrigin = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
1833 | impl->setUserMediaPersistentPermissionForOrigin(permission, origin.get(), parentOrigin.get()); |
1834 | |
1835 | return JSValueMakeUndefined(context); |
1836 | } |
1837 | |
1838 | JSValueRef JSTestRunner::userMediaPermissionRequestCountForOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1839 | { |
1840 | TestRunner* impl = toTestRunner(context, thisObject); |
1841 | if (!impl) |
1842 | return JSValueMakeUndefined(context); |
1843 | |
1844 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1845 | JSRetainPtr<JSStringRef> parentOrigin = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1846 | return JSValueMakeNumber(context, impl->userMediaPermissionRequestCountForOrigin(origin.get(), parentOrigin.get())); |
1847 | } |
1848 | |
1849 | JSValueRef JSTestRunner::resetUserMediaPermissionRequestCountForOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1850 | { |
1851 | TestRunner* impl = toTestRunner(context, thisObject); |
1852 | if (!impl) |
1853 | return JSValueMakeUndefined(context); |
1854 | |
1855 | JSRetainPtr<JSStringRef> origin = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1856 | JSRetainPtr<JSStringRef> parentOrigin = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1857 | impl->resetUserMediaPermissionRequestCountForOrigin(origin.get(), parentOrigin.get()); |
1858 | |
1859 | return JSValueMakeUndefined(context); |
1860 | } |
1861 | |
1862 | JSValueRef JSTestRunner::setAudioResult(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1863 | { |
1864 | TestRunner* impl = toTestRunner(context, thisObject); |
1865 | if (!impl) |
1866 | return JSValueMakeUndefined(context); |
1867 | |
1868 | JSValueRef data = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
1869 | impl->setAudioResult(context, data); |
1870 | |
1871 | return JSValueMakeUndefined(context); |
1872 | } |
1873 | |
1874 | JSValueRef JSTestRunner::callShouldCloseOnWebView(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1875 | { |
1876 | TestRunner* impl = toTestRunner(context, thisObject); |
1877 | if (!impl) |
1878 | return JSValueMakeUndefined(context); |
1879 | |
1880 | return JSValueMakeBoolean(context, impl->callShouldCloseOnWebView()); |
1881 | } |
1882 | |
1883 | JSValueRef JSTestRunner::queueBackNavigation(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1884 | { |
1885 | TestRunner* impl = toTestRunner(context, thisObject); |
1886 | if (!impl) |
1887 | return JSValueMakeUndefined(context); |
1888 | |
1889 | double howFarBackward = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1890 | impl->queueBackNavigation(howFarBackward); |
1891 | |
1892 | return JSValueMakeUndefined(context); |
1893 | } |
1894 | |
1895 | JSValueRef JSTestRunner::queueForwardNavigation(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1896 | { |
1897 | TestRunner* impl = toTestRunner(context, thisObject); |
1898 | if (!impl) |
1899 | return JSValueMakeUndefined(context); |
1900 | |
1901 | double howFarForward = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
1902 | impl->queueForwardNavigation(howFarForward); |
1903 | |
1904 | return JSValueMakeUndefined(context); |
1905 | } |
1906 | |
1907 | JSValueRef JSTestRunner::queueLoad(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1908 | { |
1909 | TestRunner* impl = toTestRunner(context, thisObject); |
1910 | if (!impl) |
1911 | return JSValueMakeUndefined(context); |
1912 | |
1913 | JSRetainPtr<JSStringRef> url = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1914 | JSRetainPtr<JSStringRef> target = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1915 | bool shouldOpenExternalURLs = argumentCount > 2 && JSValueToBoolean(context, arguments[2]); |
1916 | impl->queueLoad(url.get(), target.get(), shouldOpenExternalURLs); |
1917 | |
1918 | return JSValueMakeUndefined(context); |
1919 | } |
1920 | |
1921 | JSValueRef JSTestRunner::queueLoadHTMLString(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1922 | { |
1923 | TestRunner* impl = toTestRunner(context, thisObject); |
1924 | if (!impl) |
1925 | return JSValueMakeUndefined(context); |
1926 | |
1927 | JSRetainPtr<JSStringRef> content = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1928 | JSRetainPtr<JSStringRef> baseURL = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
1929 | JSRetainPtr<JSStringRef> unreachableURL = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
1930 | impl->queueLoadHTMLString(content.get(), baseURL.get(), unreachableURL.get()); |
1931 | |
1932 | return JSValueMakeUndefined(context); |
1933 | } |
1934 | |
1935 | JSValueRef JSTestRunner::queueReload(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1936 | { |
1937 | TestRunner* impl = toTestRunner(context, thisObject); |
1938 | if (!impl) |
1939 | return JSValueMakeUndefined(context); |
1940 | |
1941 | impl->queueReload(); |
1942 | |
1943 | return JSValueMakeUndefined(context); |
1944 | } |
1945 | |
1946 | JSValueRef JSTestRunner::queueLoadingScript(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1947 | { |
1948 | TestRunner* impl = toTestRunner(context, thisObject); |
1949 | if (!impl) |
1950 | return JSValueMakeUndefined(context); |
1951 | |
1952 | JSRetainPtr<JSStringRef> script = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1953 | impl->queueLoadingScript(script.get()); |
1954 | |
1955 | return JSValueMakeUndefined(context); |
1956 | } |
1957 | |
1958 | JSValueRef JSTestRunner::queueNonLoadingScript(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1959 | { |
1960 | TestRunner* impl = toTestRunner(context, thisObject); |
1961 | if (!impl) |
1962 | return JSValueMakeUndefined(context); |
1963 | |
1964 | JSRetainPtr<JSStringRef> script = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
1965 | impl->queueNonLoadingScript(script.get()); |
1966 | |
1967 | return JSValueMakeUndefined(context); |
1968 | } |
1969 | |
1970 | JSValueRef JSTestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1971 | { |
1972 | TestRunner* impl = toTestRunner(context, thisObject); |
1973 | if (!impl) |
1974 | return JSValueMakeUndefined(context); |
1975 | |
1976 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1977 | impl->setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(value); |
1978 | |
1979 | return JSValueMakeUndefined(context); |
1980 | } |
1981 | |
1982 | JSValueRef JSTestRunner::setHandlesAuthenticationChallenges(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1983 | { |
1984 | TestRunner* impl = toTestRunner(context, thisObject); |
1985 | if (!impl) |
1986 | return JSValueMakeUndefined(context); |
1987 | |
1988 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
1989 | impl->setHandlesAuthenticationChallenges(value); |
1990 | |
1991 | return JSValueMakeUndefined(context); |
1992 | } |
1993 | |
1994 | JSValueRef JSTestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
1995 | { |
1996 | TestRunner* impl = toTestRunner(context, thisObject); |
1997 | if (!impl) |
1998 | return JSValueMakeUndefined(context); |
1999 | |
2000 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2001 | impl->setShouldLogCanAuthenticateAgainstProtectionSpace(value); |
2002 | |
2003 | return JSValueMakeUndefined(context); |
2004 | } |
2005 | |
2006 | JSValueRef JSTestRunner::setAuthenticationUsername(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2007 | { |
2008 | TestRunner* impl = toTestRunner(context, thisObject); |
2009 | if (!impl) |
2010 | return JSValueMakeUndefined(context); |
2011 | |
2012 | JSRetainPtr<JSStringRef> username = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2013 | impl->setAuthenticationUsername(username.get()); |
2014 | |
2015 | return JSValueMakeUndefined(context); |
2016 | } |
2017 | |
2018 | JSValueRef JSTestRunner::setAuthenticationPassword(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2019 | { |
2020 | TestRunner* impl = toTestRunner(context, thisObject); |
2021 | if (!impl) |
2022 | return JSValueMakeUndefined(context); |
2023 | |
2024 | JSRetainPtr<JSStringRef> password = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2025 | impl->setAuthenticationPassword(password.get()); |
2026 | |
2027 | return JSValueMakeUndefined(context); |
2028 | } |
2029 | |
2030 | JSValueRef JSTestRunner::setAllowsAnySSLCertificate(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2031 | { |
2032 | TestRunner* impl = toTestRunner(context, thisObject); |
2033 | if (!impl) |
2034 | return JSValueMakeUndefined(context); |
2035 | |
2036 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2037 | impl->setAllowsAnySSLCertificate(value); |
2038 | |
2039 | return JSValueMakeUndefined(context); |
2040 | } |
2041 | |
2042 | JSValueRef JSTestRunner::setBlockAllPlugins(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2043 | { |
2044 | TestRunner* impl = toTestRunner(context, thisObject); |
2045 | if (!impl) |
2046 | return JSValueMakeUndefined(context); |
2047 | |
2048 | bool shouldBlock = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2049 | impl->setBlockAllPlugins(shouldBlock); |
2050 | |
2051 | return JSValueMakeUndefined(context); |
2052 | } |
2053 | |
2054 | JSValueRef JSTestRunner::setPluginSupportedMode(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2055 | { |
2056 | TestRunner* impl = toTestRunner(context, thisObject); |
2057 | if (!impl) |
2058 | return JSValueMakeUndefined(context); |
2059 | |
2060 | JSRetainPtr<JSStringRef> mode = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2061 | impl->setPluginSupportedMode(mode.get()); |
2062 | |
2063 | return JSValueMakeUndefined(context); |
2064 | } |
2065 | |
2066 | JSValueRef JSTestRunner::failNextNewCodeBlock(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2067 | { |
2068 | TestRunner* impl = toTestRunner(context, thisObject); |
2069 | if (!impl) |
2070 | return JSValueMakeUndefined(context); |
2071 | |
2072 | return impl->failNextNewCodeBlock(); |
2073 | } |
2074 | |
2075 | JSValueRef JSTestRunner::numberOfDFGCompiles(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2076 | { |
2077 | TestRunner* impl = toTestRunner(context, thisObject); |
2078 | if (!impl) |
2079 | return JSValueMakeUndefined(context); |
2080 | |
2081 | JSValueRef function = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2082 | return impl->numberOfDFGCompiles(function); |
2083 | } |
2084 | |
2085 | JSValueRef JSTestRunner::neverInlineFunction(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2086 | { |
2087 | TestRunner* impl = toTestRunner(context, thisObject); |
2088 | if (!impl) |
2089 | return JSValueMakeUndefined(context); |
2090 | |
2091 | JSValueRef function = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2092 | return impl->neverInlineFunction(function); |
2093 | } |
2094 | |
2095 | JSValueRef JSTestRunner::installDidBeginSwipeCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2096 | { |
2097 | TestRunner* impl = toTestRunner(context, thisObject); |
2098 | if (!impl) |
2099 | return JSValueMakeUndefined(context); |
2100 | |
2101 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2102 | impl->installDidBeginSwipeCallback(callback); |
2103 | |
2104 | return JSValueMakeUndefined(context); |
2105 | } |
2106 | |
2107 | JSValueRef JSTestRunner::installWillEndSwipeCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2108 | { |
2109 | TestRunner* impl = toTestRunner(context, thisObject); |
2110 | if (!impl) |
2111 | return JSValueMakeUndefined(context); |
2112 | |
2113 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2114 | impl->installWillEndSwipeCallback(callback); |
2115 | |
2116 | return JSValueMakeUndefined(context); |
2117 | } |
2118 | |
2119 | JSValueRef JSTestRunner::installDidEndSwipeCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2120 | { |
2121 | TestRunner* impl = toTestRunner(context, thisObject); |
2122 | if (!impl) |
2123 | return JSValueMakeUndefined(context); |
2124 | |
2125 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2126 | impl->installDidEndSwipeCallback(callback); |
2127 | |
2128 | return JSValueMakeUndefined(context); |
2129 | } |
2130 | |
2131 | JSValueRef JSTestRunner::installDidRemoveSwipeSnapshotCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2132 | { |
2133 | TestRunner* impl = toTestRunner(context, thisObject); |
2134 | if (!impl) |
2135 | return JSValueMakeUndefined(context); |
2136 | |
2137 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2138 | impl->installDidRemoveSwipeSnapshotCallback(callback); |
2139 | |
2140 | return JSValueMakeUndefined(context); |
2141 | } |
2142 | |
2143 | JSValueRef JSTestRunner::imageCountInGeneralPasteboard(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2144 | { |
2145 | TestRunner* impl = toTestRunner(context, thisObject); |
2146 | if (!impl) |
2147 | return JSValueMakeUndefined(context); |
2148 | |
2149 | return JSValueMakeNumber(context, impl->imageCountInGeneralPasteboard()); |
2150 | } |
2151 | |
2152 | JSValueRef JSTestRunner::runUIScript(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2153 | { |
2154 | TestRunner* impl = toTestRunner(context, thisObject); |
2155 | if (!impl) |
2156 | return JSValueMakeUndefined(context); |
2157 | |
2158 | JSRetainPtr<JSStringRef> script = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2159 | JSValueRef callback = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
2160 | impl->runUIScript(script.get(), callback); |
2161 | |
2162 | return JSValueMakeUndefined(context); |
2163 | } |
2164 | |
2165 | JSValueRef JSTestRunner::clearTestRunnerCallbacks(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2166 | { |
2167 | TestRunner* impl = toTestRunner(context, thisObject); |
2168 | if (!impl) |
2169 | return JSValueMakeUndefined(context); |
2170 | |
2171 | impl->clearTestRunnerCallbacks(); |
2172 | |
2173 | return JSValueMakeUndefined(context); |
2174 | } |
2175 | |
2176 | JSValueRef JSTestRunner::accummulateLogsForChannel(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2177 | { |
2178 | TestRunner* impl = toTestRunner(context, thisObject); |
2179 | if (!impl) |
2180 | return JSValueMakeUndefined(context); |
2181 | |
2182 | JSRetainPtr<JSStringRef> channel = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2183 | impl->accummulateLogsForChannel(channel.get()); |
2184 | |
2185 | return JSValueMakeUndefined(context); |
2186 | } |
2187 | |
2188 | JSValueRef JSTestRunner::(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2189 | { |
2190 | TestRunner* impl = toTestRunner(context, thisObject); |
2191 | if (!impl) |
2192 | return JSValueMakeUndefined(context); |
2193 | |
2194 | JSValueRef actions = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2195 | impl->setAllowedMenuActions(actions); |
2196 | |
2197 | return JSValueMakeUndefined(context); |
2198 | } |
2199 | |
2200 | JSValueRef JSTestRunner::(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2201 | { |
2202 | TestRunner* impl = toTestRunner(context, thisObject); |
2203 | if (!impl) |
2204 | return JSValueMakeUndefined(context); |
2205 | |
2206 | JSRetainPtr<JSStringRef> name = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2207 | bool dismissesAutomatically = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2208 | JSValueRef callback = argumentCount > 2 ? arguments[2] : JSValueMakeUndefined(context); |
2209 | impl->installCustomMenuAction(name.get(), dismissesAutomatically, callback); |
2210 | |
2211 | return JSValueMakeUndefined(context); |
2212 | } |
2213 | |
2214 | JSValueRef JSTestRunner::setMockGamepadDetails(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2215 | { |
2216 | TestRunner* impl = toTestRunner(context, thisObject); |
2217 | if (!impl) |
2218 | return JSValueMakeUndefined(context); |
2219 | |
2220 | double index = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2221 | JSRetainPtr<JSStringRef> id = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2222 | double axisCount = argumentCount > 2 ? JSValueToNumber(context, arguments[2], nullptr) : 0; |
2223 | double buttonCount = argumentCount > 3 ? JSValueToNumber(context, arguments[3], nullptr) : 0; |
2224 | impl->setMockGamepadDetails(index, id.get(), axisCount, buttonCount); |
2225 | |
2226 | return JSValueMakeUndefined(context); |
2227 | } |
2228 | |
2229 | JSValueRef JSTestRunner::setMockGamepadAxisValue(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2230 | { |
2231 | TestRunner* impl = toTestRunner(context, thisObject); |
2232 | if (!impl) |
2233 | return JSValueMakeUndefined(context); |
2234 | |
2235 | double index = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2236 | double axisIndex = argumentCount > 1 ? JSValueToNumber(context, arguments[1], nullptr) : 0; |
2237 | double value = argumentCount > 2 ? JSValueToNumber(context, arguments[2], nullptr) : 0; |
2238 | impl->setMockGamepadAxisValue(index, axisIndex, value); |
2239 | |
2240 | return JSValueMakeUndefined(context); |
2241 | } |
2242 | |
2243 | JSValueRef JSTestRunner::setMockGamepadButtonValue(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2244 | { |
2245 | TestRunner* impl = toTestRunner(context, thisObject); |
2246 | if (!impl) |
2247 | return JSValueMakeUndefined(context); |
2248 | |
2249 | double index = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2250 | double buttonIndex = argumentCount > 1 ? JSValueToNumber(context, arguments[1], nullptr) : 0; |
2251 | double value = argumentCount > 2 ? JSValueToNumber(context, arguments[2], nullptr) : 0; |
2252 | impl->setMockGamepadButtonValue(index, buttonIndex, value); |
2253 | |
2254 | return JSValueMakeUndefined(context); |
2255 | } |
2256 | |
2257 | JSValueRef JSTestRunner::connectMockGamepad(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2258 | { |
2259 | TestRunner* impl = toTestRunner(context, thisObject); |
2260 | if (!impl) |
2261 | return JSValueMakeUndefined(context); |
2262 | |
2263 | double index = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2264 | impl->connectMockGamepad(index); |
2265 | |
2266 | return JSValueMakeUndefined(context); |
2267 | } |
2268 | |
2269 | JSValueRef JSTestRunner::disconnectMockGamepad(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2270 | { |
2271 | TestRunner* impl = toTestRunner(context, thisObject); |
2272 | if (!impl) |
2273 | return JSValueMakeUndefined(context); |
2274 | |
2275 | double index = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2276 | impl->disconnectMockGamepad(index); |
2277 | |
2278 | return JSValueMakeUndefined(context); |
2279 | } |
2280 | |
2281 | JSValueRef JSTestRunner::installStatisticsDidModifyDataRecordsCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2282 | { |
2283 | TestRunner* impl = toTestRunner(context, thisObject); |
2284 | if (!impl) |
2285 | return JSValueMakeUndefined(context); |
2286 | |
2287 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2288 | impl->installStatisticsDidModifyDataRecordsCallback(callback); |
2289 | |
2290 | return JSValueMakeUndefined(context); |
2291 | } |
2292 | |
2293 | JSValueRef JSTestRunner::installStatisticsDidScanDataRecordsCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2294 | { |
2295 | TestRunner* impl = toTestRunner(context, thisObject); |
2296 | if (!impl) |
2297 | return JSValueMakeUndefined(context); |
2298 | |
2299 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2300 | impl->installStatisticsDidScanDataRecordsCallback(callback); |
2301 | |
2302 | return JSValueMakeUndefined(context); |
2303 | } |
2304 | |
2305 | JSValueRef JSTestRunner::installStatisticsDidRunTelemetryCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2306 | { |
2307 | TestRunner* impl = toTestRunner(context, thisObject); |
2308 | if (!impl) |
2309 | return JSValueMakeUndefined(context); |
2310 | |
2311 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2312 | impl->installStatisticsDidRunTelemetryCallback(callback); |
2313 | |
2314 | return JSValueMakeUndefined(context); |
2315 | } |
2316 | |
2317 | JSValueRef JSTestRunner::setStatisticsDebugMode(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2318 | { |
2319 | TestRunner* impl = toTestRunner(context, thisObject); |
2320 | if (!impl) |
2321 | return JSValueMakeUndefined(context); |
2322 | |
2323 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2324 | JSValueRef completionHandler = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
2325 | impl->setStatisticsDebugMode(value, completionHandler); |
2326 | |
2327 | return JSValueMakeUndefined(context); |
2328 | } |
2329 | |
2330 | JSValueRef JSTestRunner::setStatisticsPrevalentResourceForDebugMode(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2331 | { |
2332 | TestRunner* impl = toTestRunner(context, thisObject); |
2333 | if (!impl) |
2334 | return JSValueMakeUndefined(context); |
2335 | |
2336 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2337 | JSValueRef completionHandler = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
2338 | impl->setStatisticsPrevalentResourceForDebugMode(hostName.get(), completionHandler); |
2339 | |
2340 | return JSValueMakeUndefined(context); |
2341 | } |
2342 | |
2343 | JSValueRef JSTestRunner::setStatisticsLastSeen(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2344 | { |
2345 | TestRunner* impl = toTestRunner(context, thisObject); |
2346 | if (!impl) |
2347 | return JSValueMakeUndefined(context); |
2348 | |
2349 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2350 | double seconds = argumentCount > 1 ? JSValueToNumber(context, arguments[1], nullptr) : 0; |
2351 | JSValueRef completionHandler = argumentCount > 2 ? arguments[2] : JSValueMakeUndefined(context); |
2352 | impl->setStatisticsLastSeen(hostName.get(), seconds, completionHandler); |
2353 | |
2354 | return JSValueMakeUndefined(context); |
2355 | } |
2356 | |
2357 | JSValueRef JSTestRunner::setStatisticsPrevalentResource(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2358 | { |
2359 | TestRunner* impl = toTestRunner(context, thisObject); |
2360 | if (!impl) |
2361 | return JSValueMakeUndefined(context); |
2362 | |
2363 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2364 | bool value = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2365 | JSValueRef completionHandler = argumentCount > 2 ? arguments[2] : JSValueMakeUndefined(context); |
2366 | impl->setStatisticsPrevalentResource(hostName.get(), value, completionHandler); |
2367 | |
2368 | return JSValueMakeUndefined(context); |
2369 | } |
2370 | |
2371 | JSValueRef JSTestRunner::setStatisticsVeryPrevalentResource(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2372 | { |
2373 | TestRunner* impl = toTestRunner(context, thisObject); |
2374 | if (!impl) |
2375 | return JSValueMakeUndefined(context); |
2376 | |
2377 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2378 | bool value = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2379 | JSValueRef completionHandler = argumentCount > 2 ? arguments[2] : JSValueMakeUndefined(context); |
2380 | impl->setStatisticsVeryPrevalentResource(hostName.get(), value, completionHandler); |
2381 | |
2382 | return JSValueMakeUndefined(context); |
2383 | } |
2384 | |
2385 | JSValueRef JSTestRunner::isStatisticsPrevalentResource(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2386 | { |
2387 | TestRunner* impl = toTestRunner(context, thisObject); |
2388 | if (!impl) |
2389 | return JSValueMakeUndefined(context); |
2390 | |
2391 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2392 | return JSValueMakeBoolean(context, impl->isStatisticsPrevalentResource(hostName.get())); |
2393 | } |
2394 | |
2395 | JSValueRef JSTestRunner::isStatisticsVeryPrevalentResource(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2396 | { |
2397 | TestRunner* impl = toTestRunner(context, thisObject); |
2398 | if (!impl) |
2399 | return JSValueMakeUndefined(context); |
2400 | |
2401 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2402 | return JSValueMakeBoolean(context, impl->isStatisticsVeryPrevalentResource(hostName.get())); |
2403 | } |
2404 | |
2405 | JSValueRef JSTestRunner::isStatisticsRegisteredAsSubresourceUnder(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2406 | { |
2407 | TestRunner* impl = toTestRunner(context, thisObject); |
2408 | if (!impl) |
2409 | return JSValueMakeUndefined(context); |
2410 | |
2411 | JSRetainPtr<JSStringRef> subresourceHost = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2412 | JSRetainPtr<JSStringRef> topFrameHost = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2413 | return JSValueMakeBoolean(context, impl->isStatisticsRegisteredAsSubresourceUnder(subresourceHost.get(), topFrameHost.get())); |
2414 | } |
2415 | |
2416 | JSValueRef JSTestRunner::isStatisticsRegisteredAsSubFrameUnder(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2417 | { |
2418 | TestRunner* impl = toTestRunner(context, thisObject); |
2419 | if (!impl) |
2420 | return JSValueMakeUndefined(context); |
2421 | |
2422 | JSRetainPtr<JSStringRef> subFrameHost = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2423 | JSRetainPtr<JSStringRef> topFrameHost = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2424 | return JSValueMakeBoolean(context, impl->isStatisticsRegisteredAsSubFrameUnder(subFrameHost.get(), topFrameHost.get())); |
2425 | } |
2426 | |
2427 | JSValueRef JSTestRunner::isStatisticsRegisteredAsRedirectingTo(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2428 | { |
2429 | TestRunner* impl = toTestRunner(context, thisObject); |
2430 | if (!impl) |
2431 | return JSValueMakeUndefined(context); |
2432 | |
2433 | JSRetainPtr<JSStringRef> hostRedirectedFrom = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2434 | JSRetainPtr<JSStringRef> hostRedirectedTo = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2435 | return JSValueMakeBoolean(context, impl->isStatisticsRegisteredAsRedirectingTo(hostRedirectedFrom.get(), hostRedirectedTo.get())); |
2436 | } |
2437 | |
2438 | JSValueRef JSTestRunner::setStatisticsHasHadUserInteraction(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2439 | { |
2440 | TestRunner* impl = toTestRunner(context, thisObject); |
2441 | if (!impl) |
2442 | return JSValueMakeUndefined(context); |
2443 | |
2444 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2445 | bool value = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2446 | JSValueRef completionHandler = argumentCount > 2 ? arguments[2] : JSValueMakeUndefined(context); |
2447 | impl->setStatisticsHasHadUserInteraction(hostName.get(), value, completionHandler); |
2448 | |
2449 | return JSValueMakeUndefined(context); |
2450 | } |
2451 | |
2452 | JSValueRef JSTestRunner::isStatisticsHasHadUserInteraction(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2453 | { |
2454 | TestRunner* impl = toTestRunner(context, thisObject); |
2455 | if (!impl) |
2456 | return JSValueMakeUndefined(context); |
2457 | |
2458 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2459 | return JSValueMakeBoolean(context, impl->isStatisticsHasHadUserInteraction(hostName.get())); |
2460 | } |
2461 | |
2462 | JSValueRef JSTestRunner::setStatisticsGrandfathered(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2463 | { |
2464 | TestRunner* impl = toTestRunner(context, thisObject); |
2465 | if (!impl) |
2466 | return JSValueMakeUndefined(context); |
2467 | |
2468 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2469 | bool value = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2470 | impl->setStatisticsGrandfathered(hostName.get(), value); |
2471 | |
2472 | return JSValueMakeUndefined(context); |
2473 | } |
2474 | |
2475 | JSValueRef JSTestRunner::isStatisticsGrandfathered(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2476 | { |
2477 | TestRunner* impl = toTestRunner(context, thisObject); |
2478 | if (!impl) |
2479 | return JSValueMakeUndefined(context); |
2480 | |
2481 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2482 | return JSValueMakeBoolean(context, impl->isStatisticsGrandfathered(hostName.get())); |
2483 | } |
2484 | |
2485 | JSValueRef JSTestRunner::setStatisticsSubframeUnderTopFrameOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2486 | { |
2487 | TestRunner* impl = toTestRunner(context, thisObject); |
2488 | if (!impl) |
2489 | return JSValueMakeUndefined(context); |
2490 | |
2491 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2492 | JSRetainPtr<JSStringRef> topFrameHostName = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2493 | impl->setStatisticsSubframeUnderTopFrameOrigin(hostName.get(), topFrameHostName.get()); |
2494 | |
2495 | return JSValueMakeUndefined(context); |
2496 | } |
2497 | |
2498 | JSValueRef JSTestRunner::setStatisticsSubresourceUnderTopFrameOrigin(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2499 | { |
2500 | TestRunner* impl = toTestRunner(context, thisObject); |
2501 | if (!impl) |
2502 | return JSValueMakeUndefined(context); |
2503 | |
2504 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2505 | JSRetainPtr<JSStringRef> topFrameHostName = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2506 | impl->setStatisticsSubresourceUnderTopFrameOrigin(hostName.get(), topFrameHostName.get()); |
2507 | |
2508 | return JSValueMakeUndefined(context); |
2509 | } |
2510 | |
2511 | JSValueRef JSTestRunner::setStatisticsSubresourceUniqueRedirectTo(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2512 | { |
2513 | TestRunner* impl = toTestRunner(context, thisObject); |
2514 | if (!impl) |
2515 | return JSValueMakeUndefined(context); |
2516 | |
2517 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2518 | JSRetainPtr<JSStringRef> hostNameRedirectedTo = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2519 | impl->setStatisticsSubresourceUniqueRedirectTo(hostName.get(), hostNameRedirectedTo.get()); |
2520 | |
2521 | return JSValueMakeUndefined(context); |
2522 | } |
2523 | |
2524 | JSValueRef JSTestRunner::setStatisticsSubresourceUniqueRedirectFrom(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2525 | { |
2526 | TestRunner* impl = toTestRunner(context, thisObject); |
2527 | if (!impl) |
2528 | return JSValueMakeUndefined(context); |
2529 | |
2530 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2531 | JSRetainPtr<JSStringRef> hostNameRedirectedTo = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2532 | impl->setStatisticsSubresourceUniqueRedirectFrom(hostName.get(), hostNameRedirectedTo.get()); |
2533 | |
2534 | return JSValueMakeUndefined(context); |
2535 | } |
2536 | |
2537 | JSValueRef JSTestRunner::setStatisticsTopFrameUniqueRedirectTo(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2538 | { |
2539 | TestRunner* impl = toTestRunner(context, thisObject); |
2540 | if (!impl) |
2541 | return JSValueMakeUndefined(context); |
2542 | |
2543 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2544 | JSRetainPtr<JSStringRef> hostNameRedirectedTo = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2545 | impl->setStatisticsTopFrameUniqueRedirectTo(hostName.get(), hostNameRedirectedTo.get()); |
2546 | |
2547 | return JSValueMakeUndefined(context); |
2548 | } |
2549 | |
2550 | JSValueRef JSTestRunner::setStatisticsTopFrameUniqueRedirectFrom(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2551 | { |
2552 | TestRunner* impl = toTestRunner(context, thisObject); |
2553 | if (!impl) |
2554 | return JSValueMakeUndefined(context); |
2555 | |
2556 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2557 | JSRetainPtr<JSStringRef> hostNameRedirectedTo = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2558 | impl->setStatisticsTopFrameUniqueRedirectFrom(hostName.get(), hostNameRedirectedTo.get()); |
2559 | |
2560 | return JSValueMakeUndefined(context); |
2561 | } |
2562 | |
2563 | JSValueRef JSTestRunner::setStatisticsCrossSiteLoadWithLinkDecoration(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2564 | { |
2565 | TestRunner* impl = toTestRunner(context, thisObject); |
2566 | if (!impl) |
2567 | return JSValueMakeUndefined(context); |
2568 | |
2569 | JSRetainPtr<JSStringRef> fromHost = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2570 | JSRetainPtr<JSStringRef> toHost = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
2571 | impl->setStatisticsCrossSiteLoadWithLinkDecoration(fromHost.get(), toHost.get()); |
2572 | |
2573 | return JSValueMakeUndefined(context); |
2574 | } |
2575 | |
2576 | JSValueRef JSTestRunner::setStatisticsTimeToLiveUserInteraction(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2577 | { |
2578 | TestRunner* impl = toTestRunner(context, thisObject); |
2579 | if (!impl) |
2580 | return JSValueMakeUndefined(context); |
2581 | |
2582 | double seconds = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2583 | impl->setStatisticsTimeToLiveUserInteraction(seconds); |
2584 | |
2585 | return JSValueMakeUndefined(context); |
2586 | } |
2587 | |
2588 | JSValueRef JSTestRunner::statisticsNotifyObserver(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2589 | { |
2590 | TestRunner* impl = toTestRunner(context, thisObject); |
2591 | if (!impl) |
2592 | return JSValueMakeUndefined(context); |
2593 | |
2594 | impl->statisticsNotifyObserver(); |
2595 | |
2596 | return JSValueMakeUndefined(context); |
2597 | } |
2598 | |
2599 | JSValueRef JSTestRunner::statisticsProcessStatisticsAndDataRecords(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2600 | { |
2601 | TestRunner* impl = toTestRunner(context, thisObject); |
2602 | if (!impl) |
2603 | return JSValueMakeUndefined(context); |
2604 | |
2605 | impl->statisticsProcessStatisticsAndDataRecords(); |
2606 | |
2607 | return JSValueMakeUndefined(context); |
2608 | } |
2609 | |
2610 | JSValueRef JSTestRunner::statisticsUpdateCookieBlocking(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2611 | { |
2612 | TestRunner* impl = toTestRunner(context, thisObject); |
2613 | if (!impl) |
2614 | return JSValueMakeUndefined(context); |
2615 | |
2616 | JSValueRef completionHandler = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2617 | impl->statisticsUpdateCookieBlocking(completionHandler); |
2618 | |
2619 | return JSValueMakeUndefined(context); |
2620 | } |
2621 | |
2622 | JSValueRef JSTestRunner::statisticsSubmitTelemetry(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2623 | { |
2624 | TestRunner* impl = toTestRunner(context, thisObject); |
2625 | if (!impl) |
2626 | return JSValueMakeUndefined(context); |
2627 | |
2628 | impl->statisticsSubmitTelemetry(); |
2629 | |
2630 | return JSValueMakeUndefined(context); |
2631 | } |
2632 | |
2633 | JSValueRef JSTestRunner::setStatisticsNotifyPagesWhenDataRecordsWereScanned(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2634 | { |
2635 | TestRunner* impl = toTestRunner(context, thisObject); |
2636 | if (!impl) |
2637 | return JSValueMakeUndefined(context); |
2638 | |
2639 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2640 | impl->setStatisticsNotifyPagesWhenDataRecordsWereScanned(value); |
2641 | |
2642 | return JSValueMakeUndefined(context); |
2643 | } |
2644 | |
2645 | JSValueRef JSTestRunner::setStatisticsIsRunningTest(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2646 | { |
2647 | TestRunner* impl = toTestRunner(context, thisObject); |
2648 | if (!impl) |
2649 | return JSValueMakeUndefined(context); |
2650 | |
2651 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2652 | impl->setStatisticsIsRunningTest(value); |
2653 | |
2654 | return JSValueMakeUndefined(context); |
2655 | } |
2656 | |
2657 | JSValueRef JSTestRunner::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2658 | { |
2659 | TestRunner* impl = toTestRunner(context, thisObject); |
2660 | if (!impl) |
2661 | return JSValueMakeUndefined(context); |
2662 | |
2663 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2664 | impl->setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(value); |
2665 | |
2666 | return JSValueMakeUndefined(context); |
2667 | } |
2668 | |
2669 | JSValueRef JSTestRunner::setStatisticsNotifyPagesWhenTelemetryWasCaptured(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2670 | { |
2671 | TestRunner* impl = toTestRunner(context, thisObject); |
2672 | if (!impl) |
2673 | return JSValueMakeUndefined(context); |
2674 | |
2675 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2676 | impl->setStatisticsNotifyPagesWhenTelemetryWasCaptured(value); |
2677 | |
2678 | return JSValueMakeUndefined(context); |
2679 | } |
2680 | |
2681 | JSValueRef JSTestRunner::setStatisticsMinimumTimeBetweenDataRecordsRemoval(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2682 | { |
2683 | TestRunner* impl = toTestRunner(context, thisObject); |
2684 | if (!impl) |
2685 | return JSValueMakeUndefined(context); |
2686 | |
2687 | double seconds = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2688 | impl->setStatisticsMinimumTimeBetweenDataRecordsRemoval(seconds); |
2689 | |
2690 | return JSValueMakeUndefined(context); |
2691 | } |
2692 | |
2693 | JSValueRef JSTestRunner::setStatisticsGrandfatheringTime(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2694 | { |
2695 | TestRunner* impl = toTestRunner(context, thisObject); |
2696 | if (!impl) |
2697 | return JSValueMakeUndefined(context); |
2698 | |
2699 | double seconds = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2700 | impl->setStatisticsGrandfatheringTime(seconds); |
2701 | |
2702 | return JSValueMakeUndefined(context); |
2703 | } |
2704 | |
2705 | JSValueRef JSTestRunner::setStatisticsMaxStatisticsEntries(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2706 | { |
2707 | TestRunner* impl = toTestRunner(context, thisObject); |
2708 | if (!impl) |
2709 | return JSValueMakeUndefined(context); |
2710 | |
2711 | double entries = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2712 | impl->setStatisticsMaxStatisticsEntries(entries); |
2713 | |
2714 | return JSValueMakeUndefined(context); |
2715 | } |
2716 | |
2717 | JSValueRef JSTestRunner::setStatisticsPruneEntriesDownTo(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2718 | { |
2719 | TestRunner* impl = toTestRunner(context, thisObject); |
2720 | if (!impl) |
2721 | return JSValueMakeUndefined(context); |
2722 | |
2723 | double entries = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2724 | impl->setStatisticsPruneEntriesDownTo(entries); |
2725 | |
2726 | return JSValueMakeUndefined(context); |
2727 | } |
2728 | |
2729 | JSValueRef JSTestRunner::statisticsClearInMemoryAndPersistentStore(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2730 | { |
2731 | TestRunner* impl = toTestRunner(context, thisObject); |
2732 | if (!impl) |
2733 | return JSValueMakeUndefined(context); |
2734 | |
2735 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2736 | impl->statisticsClearInMemoryAndPersistentStore(callback); |
2737 | |
2738 | return JSValueMakeUndefined(context); |
2739 | } |
2740 | |
2741 | JSValueRef JSTestRunner::statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2742 | { |
2743 | TestRunner* impl = toTestRunner(context, thisObject); |
2744 | if (!impl) |
2745 | return JSValueMakeUndefined(context); |
2746 | |
2747 | double hours = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2748 | JSValueRef callback = argumentCount > 1 ? arguments[1] : JSValueMakeUndefined(context); |
2749 | impl->statisticsClearInMemoryAndPersistentStoreModifiedSinceHours(hours, callback); |
2750 | |
2751 | return JSValueMakeUndefined(context); |
2752 | } |
2753 | |
2754 | JSValueRef JSTestRunner::statisticsClearThroughWebsiteDataRemoval(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2755 | { |
2756 | TestRunner* impl = toTestRunner(context, thisObject); |
2757 | if (!impl) |
2758 | return JSValueMakeUndefined(context); |
2759 | |
2760 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2761 | impl->statisticsClearThroughWebsiteDataRemoval(callback); |
2762 | |
2763 | return JSValueMakeUndefined(context); |
2764 | } |
2765 | |
2766 | JSValueRef JSTestRunner::statisticsDeleteCookiesForHost(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2767 | { |
2768 | TestRunner* impl = toTestRunner(context, thisObject); |
2769 | if (!impl) |
2770 | return JSValueMakeUndefined(context); |
2771 | |
2772 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2773 | bool includeHttpOnlyCookies = argumentCount > 1 && JSValueToBoolean(context, arguments[1]); |
2774 | impl->statisticsDeleteCookiesForHost(hostName.get(), includeHttpOnlyCookies); |
2775 | |
2776 | return JSValueMakeUndefined(context); |
2777 | } |
2778 | |
2779 | JSValueRef JSTestRunner::isStatisticsHasLocalStorage(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2780 | { |
2781 | TestRunner* impl = toTestRunner(context, thisObject); |
2782 | if (!impl) |
2783 | return JSValueMakeUndefined(context); |
2784 | |
2785 | JSRetainPtr<JSStringRef> hostName = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2786 | return JSValueMakeBoolean(context, impl->isStatisticsHasLocalStorage(hostName.get())); |
2787 | } |
2788 | |
2789 | JSValueRef JSTestRunner::setStatisticsCacheMaxAgeCap(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2790 | { |
2791 | TestRunner* impl = toTestRunner(context, thisObject); |
2792 | if (!impl) |
2793 | return JSValueMakeUndefined(context); |
2794 | |
2795 | double seconds = argumentCount > 0 ? JSValueToNumber(context, arguments[0], nullptr) : 0; |
2796 | impl->setStatisticsCacheMaxAgeCap(seconds); |
2797 | |
2798 | return JSValueMakeUndefined(context); |
2799 | } |
2800 | |
2801 | JSValueRef JSTestRunner::statisticsResetToConsistentState(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2802 | { |
2803 | TestRunner* impl = toTestRunner(context, thisObject); |
2804 | if (!impl) |
2805 | return JSValueMakeUndefined(context); |
2806 | |
2807 | JSValueRef completionHandler = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2808 | impl->statisticsResetToConsistentState(completionHandler); |
2809 | |
2810 | return JSValueMakeUndefined(context); |
2811 | } |
2812 | |
2813 | JSValueRef JSTestRunner::installTextDidChangeInTextFieldCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2814 | { |
2815 | TestRunner* impl = toTestRunner(context, thisObject); |
2816 | if (!impl) |
2817 | return JSValueMakeUndefined(context); |
2818 | |
2819 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2820 | impl->installTextDidChangeInTextFieldCallback(callback); |
2821 | |
2822 | return JSValueMakeUndefined(context); |
2823 | } |
2824 | |
2825 | JSValueRef JSTestRunner::installTextFieldDidBeginEditingCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2826 | { |
2827 | TestRunner* impl = toTestRunner(context, thisObject); |
2828 | if (!impl) |
2829 | return JSValueMakeUndefined(context); |
2830 | |
2831 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2832 | impl->installTextFieldDidBeginEditingCallback(callback); |
2833 | |
2834 | return JSValueMakeUndefined(context); |
2835 | } |
2836 | |
2837 | JSValueRef JSTestRunner::installTextFieldDidEndEditingCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2838 | { |
2839 | TestRunner* impl = toTestRunner(context, thisObject); |
2840 | if (!impl) |
2841 | return JSValueMakeUndefined(context); |
2842 | |
2843 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2844 | impl->installTextFieldDidEndEditingCallback(callback); |
2845 | |
2846 | return JSValueMakeUndefined(context); |
2847 | } |
2848 | |
2849 | JSValueRef JSTestRunner::setStorageAccessAPIEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2850 | { |
2851 | TestRunner* impl = toTestRunner(context, thisObject); |
2852 | if (!impl) |
2853 | return JSValueMakeUndefined(context); |
2854 | |
2855 | bool enabled = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2856 | impl->setStorageAccessAPIEnabled(enabled); |
2857 | |
2858 | return JSValueMakeUndefined(context); |
2859 | } |
2860 | |
2861 | JSValueRef JSTestRunner::getAllStorageAccessEntries(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2862 | { |
2863 | TestRunner* impl = toTestRunner(context, thisObject); |
2864 | if (!impl) |
2865 | return JSValueMakeUndefined(context); |
2866 | |
2867 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2868 | impl->getAllStorageAccessEntries(callback); |
2869 | |
2870 | return JSValueMakeUndefined(context); |
2871 | } |
2872 | |
2873 | JSValueRef JSTestRunner::setOpenPanelFiles(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2874 | { |
2875 | TestRunner* impl = toTestRunner(context, thisObject); |
2876 | if (!impl) |
2877 | return JSValueMakeUndefined(context); |
2878 | |
2879 | JSValueRef filesArray = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2880 | impl->setOpenPanelFiles(filesArray); |
2881 | |
2882 | return JSValueMakeUndefined(context); |
2883 | } |
2884 | |
2885 | JSValueRef JSTestRunner::setOpenPanelFilesMediaIcon(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2886 | { |
2887 | TestRunner* impl = toTestRunner(context, thisObject); |
2888 | if (!impl) |
2889 | return JSValueMakeUndefined(context); |
2890 | |
2891 | JSValueRef mediaIcon = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
2892 | impl->setOpenPanelFilesMediaIcon(mediaIcon); |
2893 | |
2894 | return JSValueMakeUndefined(context); |
2895 | } |
2896 | |
2897 | JSValueRef JSTestRunner::setShouldDismissJavaScriptAlertsAsynchronously(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2898 | { |
2899 | TestRunner* impl = toTestRunner(context, thisObject); |
2900 | if (!impl) |
2901 | return JSValueMakeUndefined(context); |
2902 | |
2903 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2904 | impl->setShouldDismissJavaScriptAlertsAsynchronously(value); |
2905 | |
2906 | return JSValueMakeUndefined(context); |
2907 | } |
2908 | |
2909 | JSValueRef JSTestRunner::abortModal(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2910 | { |
2911 | TestRunner* impl = toTestRunner(context, thisObject); |
2912 | if (!impl) |
2913 | return JSValueMakeUndefined(context); |
2914 | |
2915 | impl->abortModal(); |
2916 | |
2917 | return JSValueMakeUndefined(context); |
2918 | } |
2919 | |
2920 | JSValueRef JSTestRunner::setWebRTCMDNSICECandidatesEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2921 | { |
2922 | TestRunner* impl = toTestRunner(context, thisObject); |
2923 | if (!impl) |
2924 | return JSValueMakeUndefined(context); |
2925 | |
2926 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2927 | impl->setWebRTCMDNSICECandidatesEnabled(value); |
2928 | |
2929 | return JSValueMakeUndefined(context); |
2930 | } |
2931 | |
2932 | JSValueRef JSTestRunner::setWebRTCUnifiedPlanEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2933 | { |
2934 | TestRunner* impl = toTestRunner(context, thisObject); |
2935 | if (!impl) |
2936 | return JSValueMakeUndefined(context); |
2937 | |
2938 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2939 | impl->setWebRTCUnifiedPlanEnabled(value); |
2940 | |
2941 | return JSValueMakeUndefined(context); |
2942 | } |
2943 | |
2944 | JSValueRef JSTestRunner::setCustomUserAgent(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2945 | { |
2946 | TestRunner* impl = toTestRunner(context, thisObject); |
2947 | if (!impl) |
2948 | return JSValueMakeUndefined(context); |
2949 | |
2950 | JSRetainPtr<JSStringRef> userAgent = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
2951 | impl->setCustomUserAgent(userAgent.get()); |
2952 | |
2953 | return JSValueMakeUndefined(context); |
2954 | } |
2955 | |
2956 | JSValueRef JSTestRunner::setWebAPIStatisticsEnabled(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2957 | { |
2958 | TestRunner* impl = toTestRunner(context, thisObject); |
2959 | if (!impl) |
2960 | return JSValueMakeUndefined(context); |
2961 | |
2962 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2963 | impl->setWebAPIStatisticsEnabled(value); |
2964 | |
2965 | return JSValueMakeUndefined(context); |
2966 | } |
2967 | |
2968 | JSValueRef JSTestRunner::terminateNetworkProcess(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2969 | { |
2970 | TestRunner* impl = toTestRunner(context, thisObject); |
2971 | if (!impl) |
2972 | return JSValueMakeUndefined(context); |
2973 | |
2974 | impl->terminateNetworkProcess(); |
2975 | |
2976 | return JSValueMakeUndefined(context); |
2977 | } |
2978 | |
2979 | JSValueRef JSTestRunner::terminateServiceWorkerProcess(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2980 | { |
2981 | TestRunner* impl = toTestRunner(context, thisObject); |
2982 | if (!impl) |
2983 | return JSValueMakeUndefined(context); |
2984 | |
2985 | impl->terminateServiceWorkerProcess(); |
2986 | |
2987 | return JSValueMakeUndefined(context); |
2988 | } |
2989 | |
2990 | JSValueRef JSTestRunner::setCanHandleHTTPSServerTrustEvaluation(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
2991 | { |
2992 | TestRunner* impl = toTestRunner(context, thisObject); |
2993 | if (!impl) |
2994 | return JSValueMakeUndefined(context); |
2995 | |
2996 | bool canHandle = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
2997 | impl->setCanHandleHTTPSServerTrustEvaluation(canHandle); |
2998 | |
2999 | return JSValueMakeUndefined(context); |
3000 | } |
3001 | |
3002 | JSValueRef JSTestRunner::removeAllSessionCredentials(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3003 | { |
3004 | TestRunner* impl = toTestRunner(context, thisObject); |
3005 | if (!impl) |
3006 | return JSValueMakeUndefined(context); |
3007 | |
3008 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
3009 | impl->removeAllSessionCredentials(callback); |
3010 | |
3011 | return JSValueMakeUndefined(context); |
3012 | } |
3013 | |
3014 | JSValueRef JSTestRunner::getApplicationManifestThen(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3015 | { |
3016 | TestRunner* impl = toTestRunner(context, thisObject); |
3017 | if (!impl) |
3018 | return JSValueMakeUndefined(context); |
3019 | |
3020 | JSValueRef callback = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
3021 | impl->getApplicationManifestThen(callback); |
3022 | |
3023 | return JSValueMakeUndefined(context); |
3024 | } |
3025 | |
3026 | JSValueRef JSTestRunner::installFakeHelvetica(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3027 | { |
3028 | TestRunner* impl = toTestRunner(context, thisObject); |
3029 | if (!impl) |
3030 | return JSValueMakeUndefined(context); |
3031 | |
3032 | JSRetainPtr<JSStringRef> configuration = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3033 | impl->installFakeHelvetica(configuration.get()); |
3034 | |
3035 | return JSValueMakeUndefined(context); |
3036 | } |
3037 | |
3038 | JSValueRef JSTestRunner::addMockCameraDevice(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3039 | { |
3040 | TestRunner* impl = toTestRunner(context, thisObject); |
3041 | if (!impl) |
3042 | return JSValueMakeUndefined(context); |
3043 | |
3044 | JSRetainPtr<JSStringRef> persistentId = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3045 | JSRetainPtr<JSStringRef> label = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
3046 | impl->addMockCameraDevice(persistentId.get(), label.get()); |
3047 | |
3048 | return JSValueMakeUndefined(context); |
3049 | } |
3050 | |
3051 | JSValueRef JSTestRunner::addMockMicrophoneDevice(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3052 | { |
3053 | TestRunner* impl = toTestRunner(context, thisObject); |
3054 | if (!impl) |
3055 | return JSValueMakeUndefined(context); |
3056 | |
3057 | JSRetainPtr<JSStringRef> persistentId = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3058 | JSRetainPtr<JSStringRef> label = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
3059 | impl->addMockMicrophoneDevice(persistentId.get(), label.get()); |
3060 | |
3061 | return JSValueMakeUndefined(context); |
3062 | } |
3063 | |
3064 | JSValueRef JSTestRunner::addMockScreenDevice(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3065 | { |
3066 | TestRunner* impl = toTestRunner(context, thisObject); |
3067 | if (!impl) |
3068 | return JSValueMakeUndefined(context); |
3069 | |
3070 | JSRetainPtr<JSStringRef> persistentId = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3071 | JSRetainPtr<JSStringRef> label = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
3072 | impl->addMockScreenDevice(persistentId.get(), label.get()); |
3073 | |
3074 | return JSValueMakeUndefined(context); |
3075 | } |
3076 | |
3077 | JSValueRef JSTestRunner::clearMockMediaDevices(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3078 | { |
3079 | TestRunner* impl = toTestRunner(context, thisObject); |
3080 | if (!impl) |
3081 | return JSValueMakeUndefined(context); |
3082 | |
3083 | impl->clearMockMediaDevices(); |
3084 | |
3085 | return JSValueMakeUndefined(context); |
3086 | } |
3087 | |
3088 | JSValueRef JSTestRunner::removeMockMediaDevice(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3089 | { |
3090 | TestRunner* impl = toTestRunner(context, thisObject); |
3091 | if (!impl) |
3092 | return JSValueMakeUndefined(context); |
3093 | |
3094 | JSRetainPtr<JSStringRef> persistentId = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3095 | impl->removeMockMediaDevice(persistentId.get()); |
3096 | |
3097 | return JSValueMakeUndefined(context); |
3098 | } |
3099 | |
3100 | JSValueRef JSTestRunner::resetMockMediaDevices(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3101 | { |
3102 | TestRunner* impl = toTestRunner(context, thisObject); |
3103 | if (!impl) |
3104 | return JSValueMakeUndefined(context); |
3105 | |
3106 | impl->resetMockMediaDevices(); |
3107 | |
3108 | return JSValueMakeUndefined(context); |
3109 | } |
3110 | |
3111 | JSValueRef JSTestRunner::injectUserScript(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3112 | { |
3113 | TestRunner* impl = toTestRunner(context, thisObject); |
3114 | if (!impl) |
3115 | return JSValueMakeUndefined(context); |
3116 | |
3117 | JSRetainPtr<JSStringRef> string = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3118 | impl->injectUserScript(string.get()); |
3119 | |
3120 | return JSValueMakeUndefined(context); |
3121 | } |
3122 | |
3123 | JSValueRef JSTestRunner::sendDisplayConfigurationChangedMessageForTesting(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3124 | { |
3125 | TestRunner* impl = toTestRunner(context, thisObject); |
3126 | if (!impl) |
3127 | return JSValueMakeUndefined(context); |
3128 | |
3129 | impl->sendDisplayConfigurationChangedMessageForTesting(); |
3130 | |
3131 | return JSValueMakeUndefined(context); |
3132 | } |
3133 | |
3134 | JSValueRef JSTestRunner::setWebAuthenticationMockConfiguration(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3135 | { |
3136 | TestRunner* impl = toTestRunner(context, thisObject); |
3137 | if (!impl) |
3138 | return JSValueMakeUndefined(context); |
3139 | |
3140 | JSValueRef configuration = argumentCount > 0 ? arguments[0] : JSValueMakeUndefined(context); |
3141 | impl->setWebAuthenticationMockConfiguration(configuration); |
3142 | |
3143 | return JSValueMakeUndefined(context); |
3144 | } |
3145 | |
3146 | JSValueRef JSTestRunner::addTestKeyToKeychain(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3147 | { |
3148 | TestRunner* impl = toTestRunner(context, thisObject); |
3149 | if (!impl) |
3150 | return JSValueMakeUndefined(context); |
3151 | |
3152 | JSRetainPtr<JSStringRef> privateKeyBase64 = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3153 | JSRetainPtr<JSStringRef> attrLabel = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
3154 | JSRetainPtr<JSStringRef> applicationTagBase64 = argumentCount > 2 ? adopt(JSValueToStringCopy(context, arguments[2], nullptr)) : JSRetainPtr<JSStringRef>(); |
3155 | impl->addTestKeyToKeychain(privateKeyBase64.get(), attrLabel.get(), applicationTagBase64.get()); |
3156 | |
3157 | return JSValueMakeUndefined(context); |
3158 | } |
3159 | |
3160 | JSValueRef JSTestRunner::cleanUpKeychain(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3161 | { |
3162 | TestRunner* impl = toTestRunner(context, thisObject); |
3163 | if (!impl) |
3164 | return JSValueMakeUndefined(context); |
3165 | |
3166 | JSRetainPtr<JSStringRef> attrLabel = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3167 | impl->cleanUpKeychain(attrLabel.get()); |
3168 | |
3169 | return JSValueMakeUndefined(context); |
3170 | } |
3171 | |
3172 | JSValueRef JSTestRunner::keyExistsInKeychain(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3173 | { |
3174 | TestRunner* impl = toTestRunner(context, thisObject); |
3175 | if (!impl) |
3176 | return JSValueMakeUndefined(context); |
3177 | |
3178 | JSRetainPtr<JSStringRef> attrLabel = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3179 | JSRetainPtr<JSStringRef> applicationTagBase64 = argumentCount > 1 ? adopt(JSValueToStringCopy(context, arguments[1], nullptr)) : JSRetainPtr<JSStringRef>(); |
3180 | return JSValueMakeBoolean(context, impl->keyExistsInKeychain(attrLabel.get(), applicationTagBase64.get())); |
3181 | } |
3182 | |
3183 | JSValueRef JSTestRunner::clearAdClickAttribution(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3184 | { |
3185 | TestRunner* impl = toTestRunner(context, thisObject); |
3186 | if (!impl) |
3187 | return JSValueMakeUndefined(context); |
3188 | |
3189 | impl->clearAdClickAttribution(); |
3190 | |
3191 | return JSValueMakeUndefined(context); |
3192 | } |
3193 | |
3194 | JSValueRef JSTestRunner::clearAdClickAttributionsThroughWebsiteDataRemoval(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3195 | { |
3196 | TestRunner* impl = toTestRunner(context, thisObject); |
3197 | if (!impl) |
3198 | return JSValueMakeUndefined(context); |
3199 | |
3200 | impl->clearAdClickAttributionsThroughWebsiteDataRemoval(); |
3201 | |
3202 | return JSValueMakeUndefined(context); |
3203 | } |
3204 | |
3205 | JSValueRef JSTestRunner::setAdClickAttributionOverrideTimerForTesting(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3206 | { |
3207 | TestRunner* impl = toTestRunner(context, thisObject); |
3208 | if (!impl) |
3209 | return JSValueMakeUndefined(context); |
3210 | |
3211 | bool value = argumentCount > 0 && JSValueToBoolean(context, arguments[0]); |
3212 | impl->setAdClickAttributionOverrideTimerForTesting(value); |
3213 | |
3214 | return JSValueMakeUndefined(context); |
3215 | } |
3216 | |
3217 | JSValueRef JSTestRunner::setAdClickAttributionConversionURLForTesting(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3218 | { |
3219 | TestRunner* impl = toTestRunner(context, thisObject); |
3220 | if (!impl) |
3221 | return JSValueMakeUndefined(context); |
3222 | |
3223 | JSRetainPtr<JSStringRef> url = argumentCount > 0 ? adopt(JSValueToStringCopy(context, arguments[0], nullptr)) : JSRetainPtr<JSStringRef>(); |
3224 | impl->setAdClickAttributionConversionURLForTesting(url.get()); |
3225 | |
3226 | return JSValueMakeUndefined(context); |
3227 | } |
3228 | |
3229 | JSValueRef JSTestRunner::markAdClickAttributionsAsExpiredForTesting(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
3230 | { |
3231 | TestRunner* impl = toTestRunner(context, thisObject); |
3232 | if (!impl) |
3233 | return JSValueMakeUndefined(context); |
3234 | |
3235 | impl->markAdClickAttributionsAsExpiredForTesting(); |
3236 | |
3237 | return JSValueMakeUndefined(context); |
3238 | } |
3239 | |
3240 | // Attributes |
3241 | |
3242 | JSValueRef JSTestRunner::isWebKit2(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3243 | { |
3244 | TestRunner* impl = toTestRunner(context, object); |
3245 | if (!impl) |
3246 | return JSValueMakeUndefined(context); |
3247 | |
3248 | return JSValueMakeBoolean(context, impl->isWebKit2()); |
3249 | } |
3250 | |
3251 | JSValueRef JSTestRunner::timeout(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3252 | { |
3253 | TestRunner* impl = toTestRunner(context, object); |
3254 | if (!impl) |
3255 | return JSValueMakeUndefined(context); |
3256 | |
3257 | return JSValueMakeNumber(context, impl->timeout()); |
3258 | } |
3259 | |
3260 | JSValueRef JSTestRunner::globalFlag(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3261 | { |
3262 | TestRunner* impl = toTestRunner(context, object); |
3263 | if (!impl) |
3264 | return JSValueMakeUndefined(context); |
3265 | |
3266 | return JSValueMakeBoolean(context, impl->globalFlag()); |
3267 | } |
3268 | |
3269 | bool JSTestRunner::setGlobalFlag(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef value, JSValueRef* exception) |
3270 | { |
3271 | TestRunner* impl = toTestRunner(context, object); |
3272 | if (!impl) |
3273 | return false; |
3274 | |
3275 | impl->setGlobalFlag(JSValueToBoolean(context, value)); |
3276 | |
3277 | return true; |
3278 | } |
3279 | |
3280 | JSValueRef JSTestRunner::databaseDefaultQuota(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3281 | { |
3282 | TestRunner* impl = toTestRunner(context, object); |
3283 | if (!impl) |
3284 | return JSValueMakeUndefined(context); |
3285 | |
3286 | return JSValueMakeNumber(context, impl->databaseDefaultQuota()); |
3287 | } |
3288 | |
3289 | bool JSTestRunner::setDatabaseDefaultQuota(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef value, JSValueRef* exception) |
3290 | { |
3291 | TestRunner* impl = toTestRunner(context, object); |
3292 | if (!impl) |
3293 | return false; |
3294 | |
3295 | impl->setDatabaseDefaultQuota(JSValueToNumber(context, value, nullptr)); |
3296 | |
3297 | return true; |
3298 | } |
3299 | |
3300 | JSValueRef JSTestRunner::databaseMaxQuota(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3301 | { |
3302 | TestRunner* impl = toTestRunner(context, object); |
3303 | if (!impl) |
3304 | return JSValueMakeUndefined(context); |
3305 | |
3306 | return JSValueMakeNumber(context, impl->databaseMaxQuota()); |
3307 | } |
3308 | |
3309 | bool JSTestRunner::setDatabaseMaxQuota(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef value, JSValueRef* exception) |
3310 | { |
3311 | TestRunner* impl = toTestRunner(context, object); |
3312 | if (!impl) |
3313 | return false; |
3314 | |
3315 | impl->setDatabaseMaxQuota(JSValueToNumber(context, value, nullptr)); |
3316 | |
3317 | return true; |
3318 | } |
3319 | |
3320 | JSValueRef JSTestRunner::inspectorTestStubURL(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3321 | { |
3322 | TestRunner* impl = toTestRunner(context, object); |
3323 | if (!impl) |
3324 | return JSValueMakeUndefined(context); |
3325 | |
3326 | return JSValueMakeStringOrNull(context, impl->inspectorTestStubURL().get()); |
3327 | } |
3328 | |
3329 | JSValueRef JSTestRunner::didReceiveServerRedirectForProvisionalNavigation(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3330 | { |
3331 | TestRunner* impl = toTestRunner(context, object); |
3332 | if (!impl) |
3333 | return JSValueMakeUndefined(context); |
3334 | |
3335 | return JSValueMakeBoolean(context, impl->didReceiveServerRedirectForProvisionalNavigation()); |
3336 | } |
3337 | |
3338 | JSValueRef JSTestRunner::isDoingMediaCapture(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3339 | { |
3340 | TestRunner* impl = toTestRunner(context, object); |
3341 | if (!impl) |
3342 | return JSValueMakeUndefined(context); |
3343 | |
3344 | return JSValueMakeBoolean(context, impl->isDoingMediaCapture()); |
3345 | } |
3346 | |
3347 | JSValueRef JSTestRunner::secureEventInputIsEnabled(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3348 | { |
3349 | TestRunner* impl = toTestRunner(context, object); |
3350 | if (!impl) |
3351 | return JSValueMakeUndefined(context); |
3352 | |
3353 | return JSValueMakeBoolean(context, impl->secureEventInputIsEnabled()); |
3354 | } |
3355 | |
3356 | JSValueRef JSTestRunner::canDoServerTrustEvaluationInNetworkProcess(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3357 | { |
3358 | TestRunner* impl = toTestRunner(context, object); |
3359 | if (!impl) |
3360 | return JSValueMakeUndefined(context); |
3361 | |
3362 | return JSValueMakeBoolean(context, impl->canDoServerTrustEvaluationInNetworkProcess()); |
3363 | } |
3364 | |
3365 | JSValueRef JSTestRunner::serverTrustEvaluationCallbackCallsCount(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3366 | { |
3367 | TestRunner* impl = toTestRunner(context, object); |
3368 | if (!impl) |
3369 | return JSValueMakeUndefined(context); |
3370 | |
3371 | return JSValueMakeNumber(context, impl->serverTrustEvaluationCallbackCallsCount()); |
3372 | } |
3373 | |
3374 | JSValueRef JSTestRunner::didCancelClientRedirect(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3375 | { |
3376 | TestRunner* impl = toTestRunner(context, object); |
3377 | if (!impl) |
3378 | return JSValueMakeUndefined(context); |
3379 | |
3380 | return JSValueMakeBoolean(context, impl->didCancelClientRedirect()); |
3381 | } |
3382 | |
3383 | JSValueRef JSTestRunner::userScriptInjectedCount(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception) |
3384 | { |
3385 | TestRunner* impl = toTestRunner(context, object); |
3386 | if (!impl) |
3387 | return JSValueMakeUndefined(context); |
3388 | |
3389 | return JSValueMakeNumber(context, impl->userScriptInjectedCount()); |
3390 | } |
3391 | |
3392 | } // namespace WTR |
3393 | |
3394 | |