757f41ccee41650c963176356e35f6886e9de50d
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / WKPreferences.mm
1 /*
2  * Copyright (C) 2014-2016 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
26 #import "config.h"
27 #import "WKPreferencesInternal.h"
28
29 #if WK_API_ENABLED
30
31 #import "APIArray.h"
32 #import "WKNSArray.h"
33 #import "WebPreferences.h"
34 #import "_WKExperimentalFeature.h"
35 #import "_WKExperimentalFeatureInternal.h"
36 #import <WebCore/SecurityOrigin.h>
37 #import <wtf/RetainPtr.h>
38
39 @implementation WKPreferences
40
41 - (instancetype)init
42 {
43     if (!(self = [super init]))
44         return nil;
45
46     API::Object::constructInWrapper<WebKit::WebPreferences>(self, String(), "WebKit", "WebKitDebug");
47     return self;
48 }
49
50 - (void)dealloc
51 {
52     _preferences->~WebPreferences();
53
54     [super dealloc];
55 }
56
57 // FIXME: We currently only encode/decode API preferences. We should consider whether we should
58 // encode/decode SPI preferences as well.
59
60 - (void)encodeWithCoder:(NSCoder *)coder
61 {
62     [coder encodeDouble:self.minimumFontSize forKey:@"minimumFontSize"];
63     [coder encodeBool:self.javaScriptEnabled forKey:@"javaScriptEnabled"];
64     [coder encodeBool:self.javaScriptCanOpenWindowsAutomatically forKey:@"javaScriptCanOpenWindowsAutomatically"];
65
66 #if PLATFORM(MAC)
67     [coder encodeBool:self.javaEnabled forKey:@"javaEnabled"];
68     [coder encodeBool:self.plugInsEnabled forKey:@"plugInsEnabled"];
69     [coder encodeBool:self.tabFocusesLinks forKey:@"tabFocusesLinks"];
70 #endif
71 }
72
73 - (instancetype)initWithCoder:(NSCoder *)coder
74 {
75     if (!(self = [self init]))
76         return nil;
77
78     self.minimumFontSize = [coder decodeDoubleForKey:@"minimumFontSize"];
79     self.javaScriptEnabled = [coder decodeBoolForKey:@"javaScriptEnabled"];
80     self.javaScriptCanOpenWindowsAutomatically = [coder decodeBoolForKey:@"javaScriptCanOpenWindowsAutomatically"];
81
82 #if PLATFORM(MAC)
83     self.javaEnabled = [coder decodeBoolForKey:@"javaEnabled"];
84     self.plugInsEnabled = [coder decodeBoolForKey:@"plugInsEnabled"];
85     self.tabFocusesLinks = [coder decodeBoolForKey:@"tabFocusesLinks"];
86 #endif
87
88     return self;
89 }
90
91 - (id)copyWithZone:(NSZone *)zone
92 {
93     return wrapper(_preferences->copy().leakRef());
94 }
95
96 - (CGFloat)minimumFontSize
97 {
98     return _preferences->minimumFontSize();
99 }
100
101 - (void)setMinimumFontSize:(CGFloat)minimumFontSize
102 {
103     _preferences->setMinimumFontSize(minimumFontSize);
104 }
105
106 - (BOOL)javaScriptEnabled
107 {
108     return _preferences->javaScriptEnabled();
109 }
110
111 - (void)setJavaScriptEnabled:(BOOL)javaScriptEnabled
112 {
113     _preferences->setJavaScriptEnabled(javaScriptEnabled);
114 }
115
116 - (BOOL)javaScriptCanOpenWindowsAutomatically
117 {
118     return _preferences->javaScriptCanOpenWindowsAutomatically();
119 }
120
121 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)javaScriptCanOpenWindowsAutomatically
122 {
123     _preferences->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically);
124 }
125
126 #pragma mark OS X-specific methods
127
128 #if PLATFORM(MAC)
129
130 - (BOOL)javaEnabled
131 {
132     return _preferences->javaEnabled();
133 }
134
135 - (void)setJavaEnabled:(BOOL)javaEnabled
136 {
137     _preferences->setJavaEnabled(javaEnabled);
138 }
139
140 - (BOOL)plugInsEnabled
141 {
142     return _preferences->pluginsEnabled();
143 }
144
145 - (void)setPlugInsEnabled:(BOOL)plugInsEnabled
146 {
147     _preferences->setPluginsEnabled(plugInsEnabled);
148 }
149
150 - (BOOL)tabFocusesLinks
151 {
152     return _preferences->tabsToLinks();
153 }
154
155 - (void)setTabFocusesLinks:(BOOL)tabFocusesLinks
156 {
157     _preferences->setTabsToLinks(tabFocusesLinks);
158 }
159
160 #endif
161
162 #pragma mark WKObject protocol implementation
163
164 - (API::Object&)_apiObject
165 {
166     return *_preferences;
167 }
168
169 @end
170
171 @implementation WKPreferences (WKPrivate)
172
173 - (BOOL)_telephoneNumberDetectionIsEnabled
174 {
175     return _preferences->telephoneNumberParsingEnabled();
176 }
177
178 - (void)_setTelephoneNumberDetectionIsEnabled:(BOOL)telephoneNumberDetectionIsEnabled
179 {
180     _preferences->setTelephoneNumberParsingEnabled(telephoneNumberDetectionIsEnabled);
181 }
182
183 static WebCore::SecurityOrigin::StorageBlockingPolicy toStorageBlockingPolicy(_WKStorageBlockingPolicy policy)
184 {
185     switch (policy) {
186     case _WKStorageBlockingPolicyAllowAll:
187         return WebCore::SecurityOrigin::AllowAllStorage;
188     case _WKStorageBlockingPolicyBlockThirdParty:
189         return WebCore::SecurityOrigin::BlockThirdPartyStorage;
190     case _WKStorageBlockingPolicyBlockAll:
191         return WebCore::SecurityOrigin::BlockAllStorage;
192     }
193
194     ASSERT_NOT_REACHED();
195     return WebCore::SecurityOrigin::AllowAllStorage;
196 }
197
198 static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPolicy policy)
199 {
200     switch (policy) {
201     case WebCore::SecurityOrigin::AllowAllStorage:
202         return _WKStorageBlockingPolicyAllowAll;
203     case WebCore::SecurityOrigin::BlockThirdPartyStorage:
204         return _WKStorageBlockingPolicyBlockThirdParty;
205     case WebCore::SecurityOrigin::BlockAllStorage:
206         return _WKStorageBlockingPolicyBlockAll;
207     }
208
209     ASSERT_NOT_REACHED();
210     return _WKStorageBlockingPolicyAllowAll;
211 }
212
213 - (_WKStorageBlockingPolicy)_storageBlockingPolicy
214 {
215     return toAPI(static_cast<WebCore::SecurityOrigin::StorageBlockingPolicy>(_preferences->storageBlockingPolicy()));
216 }
217
218 - (void)_setStorageBlockingPolicy:(_WKStorageBlockingPolicy)policy
219 {
220     _preferences->setStorageBlockingPolicy(toStorageBlockingPolicy(policy));
221 }
222
223 - (BOOL)_offlineApplicationCacheIsEnabled
224 {
225     return _preferences->offlineWebApplicationCacheEnabled();
226 }
227
228 - (void)_setOfflineApplicationCacheIsEnabled:(BOOL)offlineApplicationCacheIsEnabled
229 {
230     _preferences->setOfflineWebApplicationCacheEnabled(offlineApplicationCacheIsEnabled);
231 }
232
233 - (BOOL)_fullScreenEnabled
234 {
235     return _preferences->fullScreenEnabled();
236 }
237
238 - (void)_setFullScreenEnabled:(BOOL)fullScreenEnabled
239 {
240     _preferences->setFullScreenEnabled(fullScreenEnabled);
241 }
242
243 - (BOOL)_allowsPictureInPictureMediaPlayback
244 {
245     return _preferences->allowsPictureInPictureMediaPlayback();
246 }
247
248 - (void)_setAllowsPictureInPictureMediaPlayback:(BOOL)allowed
249 {
250     _preferences->setAllowsPictureInPictureMediaPlayback(allowed);
251 }
252
253 - (BOOL)_compositingBordersVisible
254 {
255     return _preferences->compositingBordersVisible();
256 }
257
258 - (void)_setCompositingBordersVisible:(BOOL)compositingBordersVisible
259 {
260     _preferences->setCompositingBordersVisible(compositingBordersVisible);
261 }
262
263 - (BOOL)_compositingRepaintCountersVisible
264 {
265     return _preferences->compositingRepaintCountersVisible();
266 }
267
268 - (void)_setCompositingRepaintCountersVisible:(BOOL)repaintCountersVisible
269 {
270     _preferences->setCompositingRepaintCountersVisible(repaintCountersVisible);
271 }
272
273 - (BOOL)_tiledScrollingIndicatorVisible
274 {
275     return _preferences->tiledScrollingIndicatorVisible();
276 }
277
278 - (void)_setTiledScrollingIndicatorVisible:(BOOL)tiledScrollingIndicatorVisible
279 {
280     _preferences->setTiledScrollingIndicatorVisible(tiledScrollingIndicatorVisible);
281 }
282
283 - (BOOL)_resourceUsageOverlayVisible
284 {
285     return _preferences->resourceUsageOverlayVisible();
286 }
287
288 - (void)_setResourceUsageOverlayVisible:(BOOL)resourceUsageOverlayVisible
289 {
290     _preferences->setResourceUsageOverlayVisible(resourceUsageOverlayVisible);
291 }
292
293 - (_WKDebugOverlayRegions)_visibleDebugOverlayRegions
294 {
295     return _preferences->visibleDebugOverlayRegions();
296 }
297
298 - (void)_setVisibleDebugOverlayRegions:(_WKDebugOverlayRegions)regionFlags
299 {
300     _preferences->setVisibleDebugOverlayRegions(regionFlags);
301 }
302
303 - (BOOL)_simpleLineLayoutEnabled
304 {
305     return _preferences->simpleLineLayoutEnabled();
306 }
307
308 - (void)_setSimpleLineLayoutEnabled:(BOOL)simpleLineLayoutEnabled
309 {
310     _preferences->setSimpleLineLayoutEnabled(simpleLineLayoutEnabled);
311 }
312
313 - (BOOL)_simpleLineLayoutDebugBordersEnabled
314 {
315     return _preferences->simpleLineLayoutDebugBordersEnabled();
316 }
317
318 - (void)_setSimpleLineLayoutDebugBordersEnabled:(BOOL)simpleLineLayoutDebugBordersEnabled
319 {
320     _preferences->setSimpleLineLayoutDebugBordersEnabled(simpleLineLayoutDebugBordersEnabled);
321 }
322
323 - (BOOL)_acceleratedDrawingEnabled
324 {
325     return _preferences->acceleratedDrawingEnabled();
326 }
327
328 - (void)_setAcceleratedDrawingEnabled:(BOOL)acceleratedDrawingEnabled
329 {
330     _preferences->setAcceleratedDrawingEnabled(acceleratedDrawingEnabled);
331 }
332
333 - (BOOL)_displayListDrawingEnabled
334 {
335     return _preferences->displayListDrawingEnabled();
336 }
337
338 - (void)_setDisplayListDrawingEnabled:(BOOL)displayListDrawingEnabled
339 {
340     _preferences->setDisplayListDrawingEnabled(displayListDrawingEnabled);
341 }
342
343 - (BOOL)_visualViewportEnabled
344 {
345     return _preferences->visualViewportEnabled();
346 }
347
348 - (void)_setVisualViewportEnabled:(BOOL)_visualViewportEnabled
349 {
350     _preferences->setVisualViewportEnabled(_visualViewportEnabled);
351 }
352
353 - (BOOL)_largeImageAsyncDecodingEnabled
354 {
355     return _preferences->largeImageAsyncDecodingEnabled();
356 }
357
358 - (void)_setLargeImageAsyncDecodingEnabled:(BOOL)_largeImageAsyncDecodingEnabled
359 {
360     _preferences->setLargeImageAsyncDecodingEnabled(_largeImageAsyncDecodingEnabled);
361 }
362
363 - (BOOL)_animatedImageAsyncDecodingEnabled
364 {
365     return _preferences->animatedImageAsyncDecodingEnabled();
366 }
367
368 - (void)_setAnimatedImageAsyncDecodingEnabled:(BOOL)_animatedImageAsyncDecodingEnabled
369 {
370     _preferences->setAnimatedImageAsyncDecodingEnabled(_animatedImageAsyncDecodingEnabled);
371 }
372
373 - (BOOL)_textAutosizingEnabled
374 {
375     return _preferences->textAutosizingEnabled();
376 }
377
378 - (void)_setTextAutosizingEnabled:(BOOL)enabled
379 {
380     _preferences->setTextAutosizingEnabled(enabled);
381 }
382
383 - (BOOL)_subpixelAntialiasedLayerTextEnabled
384 {
385     return _preferences->subpixelAntialiasedLayerTextEnabled();
386 }
387
388 - (void)_setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
389 {
390     _preferences->setSubpixelAntialiasedLayerTextEnabled(enabled);
391 }
392
393 - (BOOL)_developerExtrasEnabled
394 {
395     return _preferences->developerExtrasEnabled();
396 }
397
398 - (void)_setDeveloperExtrasEnabled:(BOOL)developerExtrasEnabled
399 {
400     _preferences->setDeveloperExtrasEnabled(developerExtrasEnabled);
401 }
402
403 - (BOOL)_logsPageMessagesToSystemConsoleEnabled
404 {
405     return _preferences->logsPageMessagesToSystemConsoleEnabled();
406 }
407
408 - (void)_setLogsPageMessagesToSystemConsoleEnabled:(BOOL)logsPageMessagesToSystemConsoleEnabled
409 {
410     _preferences->setLogsPageMessagesToSystemConsoleEnabled(logsPageMessagesToSystemConsoleEnabled);
411 }
412
413 - (BOOL)_hiddenPageDOMTimerThrottlingEnabled
414 {
415     return _preferences->hiddenPageDOMTimerThrottlingEnabled();
416 }
417
418 - (void)_setHiddenPageDOMTimerThrottlingEnabled:(BOOL)hiddenPageDOMTimerThrottlingEnabled
419 {
420     _preferences->setHiddenPageDOMTimerThrottlingEnabled(hiddenPageDOMTimerThrottlingEnabled);
421 }
422
423 - (BOOL)_hiddenPageDOMTimerThrottlingAutoIncreases
424 {
425     return _preferences->hiddenPageDOMTimerThrottlingAutoIncreases();
426 }
427
428 - (void)_setHiddenPageDOMTimerThrottlingAutoIncreases:(BOOL)hiddenPageDOMTimerThrottlingAutoIncreases
429 {
430     _preferences->setHiddenPageDOMTimerThrottlingAutoIncreases(hiddenPageDOMTimerThrottlingAutoIncreases);
431 }
432
433 - (BOOL)_pageVisibilityBasedProcessSuppressionEnabled
434 {
435     return _preferences->pageVisibilityBasedProcessSuppressionEnabled();
436 }
437
438 - (void)_setPageVisibilityBasedProcessSuppressionEnabled:(BOOL)pageVisibilityBasedProcessSuppressionEnabled
439 {
440     _preferences->setPageVisibilityBasedProcessSuppressionEnabled(pageVisibilityBasedProcessSuppressionEnabled);
441 }
442
443 - (BOOL)_allowFileAccessFromFileURLs
444 {
445     return _preferences->allowFileAccessFromFileURLs();
446 }
447
448 - (void)_setAllowFileAccessFromFileURLs:(BOOL)allowFileAccessFromFileURLs
449 {
450     _preferences->setAllowFileAccessFromFileURLs(allowFileAccessFromFileURLs);
451 }
452
453 - (_WKJavaScriptRuntimeFlags)_javaScriptRuntimeFlags
454 {
455     return _preferences->javaScriptRuntimeFlags();
456 }
457
458 - (void)_setJavaScriptRuntimeFlags:(_WKJavaScriptRuntimeFlags)javaScriptRuntimeFlags
459 {
460     _preferences->setJavaScriptRuntimeFlags(javaScriptRuntimeFlags);
461 }
462
463 - (BOOL)_isStandalone
464 {
465     return _preferences->standalone();
466 }
467
468 - (void)_setStandalone:(BOOL)standalone
469 {
470     _preferences->setStandalone(standalone);
471 }
472
473 - (BOOL)_diagnosticLoggingEnabled
474 {
475     return _preferences->diagnosticLoggingEnabled();
476 }
477
478 - (void)_setDiagnosticLoggingEnabled:(BOOL)diagnosticLoggingEnabled
479 {
480     _preferences->setDiagnosticLoggingEnabled(diagnosticLoggingEnabled);
481 }
482
483 - (NSUInteger)_defaultFontSize
484 {
485     return _preferences->defaultFontSize();
486 }
487
488 - (void)_setDefaultFontSize:(NSUInteger)defaultFontSize
489 {
490     _preferences->setDefaultFontSize(defaultFontSize);
491 }
492
493 - (NSUInteger)_defaultFixedPitchFontSize
494 {
495     return _preferences->defaultFixedFontSize();
496 }
497
498 - (void)_setDefaultFixedPitchFontSize:(NSUInteger)defaultFixedPitchFontSize
499 {
500     _preferences->setDefaultFixedFontSize(defaultFixedPitchFontSize);
501 }
502
503 - (NSString *)_fixedPitchFontFamily
504 {
505     return _preferences->fixedFontFamily();
506 }
507
508 - (void)_setFixedPitchFontFamily:(NSString *)fixedPitchFontFamily
509 {
510     _preferences->setFixedFontFamily(fixedPitchFontFamily);
511 }
512
513 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures
514 {
515     auto features = WebKit::WebPreferences::experimentalFeatures();
516     return [wrapper(API::Array::create(WTFMove(features)).leakRef()) autorelease];
517 }
518
519 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature
520 {
521     return _preferences->isEnabledForFeature(*feature->_experimentalFeature);
522 }
523
524 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature
525 {
526     _preferences->setEnabledForFeature(value, *feature->_experimentalFeature);
527 }
528
529 - (BOOL)_applePayCapabilityDisclosureAllowed
530 {
531 #if ENABLE(APPLE_PAY)
532     return _preferences->applePayCapabilityDisclosureAllowed();
533 #else
534     return NO;
535 #endif
536 }
537
538 - (void)_setApplePayCapabilityDisclosureAllowed:(BOOL)applePayCapabilityDisclosureAllowed
539 {
540 #if ENABLE(APPLE_PAY)
541     _preferences->setApplePayCapabilityDisclosureAllowed(applePayCapabilityDisclosureAllowed);
542 #endif
543 }
544
545 - (BOOL)_shouldSuppressKeyboardInputDuringProvisionalNavigation
546 {
547     return _preferences->shouldSuppressKeyboardInputDuringProvisionalNavigation();
548 }
549
550 - (void)_setShouldSuppressKeyboardInputDuringProvisionalNavigation:(BOOL)shouldSuppress
551 {
552     _preferences->setShouldSuppressKeyboardInputDuringProvisionalNavigation(shouldSuppress);
553 }
554
555 - (BOOL)_loadsImagesAutomatically
556 {
557     return _preferences->loadsImagesAutomatically();
558 }
559
560 - (void)_setLoadsImagesAutomatically:(BOOL)loadsImagesAutomatically
561 {
562     _preferences->setLoadsImagesAutomatically(loadsImagesAutomatically);
563 }
564
565 - (BOOL)_peerConnectionEnabled
566 {
567     return _preferences->peerConnectionEnabled();
568 }
569
570 - (void)_setPeerConnectionEnabled:(BOOL)enabled
571 {
572     _preferences->setPeerConnectionEnabled(enabled);
573 }
574
575 - (BOOL)_mediaDevicesEnabled
576 {
577     return _preferences->mediaDevicesEnabled();
578 }
579
580 - (void)_setMediaDevicesEnabled:(BOOL)enabled
581 {
582     _preferences->setMediaDevicesEnabled(enabled);
583 }
584
585 - (BOOL)_mockCaptureDevicesEnabled
586 {
587     return _preferences->mockCaptureDevicesEnabled();
588 }
589
590 - (void)_setMockCaptureDevicesEnabled:(BOOL)enabled
591 {
592     _preferences->setMockCaptureDevicesEnabled(enabled);
593 }
594
595 - (BOOL)_mockCaptureDevicesPromptEnabled
596 {
597     return _preferences->mockCaptureDevicesPromptEnabled();
598 }
599
600 - (void)_setMockCaptureDevicesPromptEnabled:(BOOL)enabled
601 {
602     _preferences->setMockCaptureDevicesPromptEnabled(enabled);
603 }
604
605 - (BOOL)_mediaCaptureRequiresSecureConnection
606 {
607     return _preferences->mediaCaptureRequiresSecureConnection();
608 }
609
610 - (void)_setMediaCaptureRequiresSecureConnection:(BOOL)requiresSecureConnection
611 {
612     _preferences->setMediaCaptureRequiresSecureConnection(requiresSecureConnection);
613 }
614
615 - (BOOL)_enumeratingAllNetworkInterfacesEnabled
616 {
617     return _preferences->enumeratingAllNetworkInterfacesEnabled();
618 }
619
620 - (void)_setEnumeratingAllNetworkInterfacesEnabled:(BOOL)enabled
621 {
622     _preferences->setEnumeratingAllNetworkInterfacesEnabled(enabled);
623 }
624
625 - (BOOL)_iceCandidateFilteringEnabled
626 {
627     return _preferences->iceCandidateFilteringEnabled();
628 }
629
630 - (void)_setICECandidateFilteringEnabled:(BOOL)enabled
631 {
632     _preferences->setICECandidateFilteringEnabled(enabled);
633 }
634
635 - (BOOL)_webRTCLegacyAPIEnabled
636 {
637     return !_preferences->webRTCLegacyAPIDisabled();
638 }
639
640 - (void)_setWebRTCLegacyAPIEnabled:(BOOL)enabled
641 {
642     _preferences->setWebRTCLegacyAPIDisabled(!enabled);
643 }
644
645 - (void)_setJavaScriptCanAccessClipboard:(BOOL)javaScriptCanAccessClipboard
646 {
647     _preferences->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
648 }
649
650 #if PLATFORM(MAC)
651 - (void)_setPlugInsEnabled:(BOOL)enabled
652 {
653     _preferences->setPluginsEnabled(enabled);
654 }
655
656 - (BOOL)_plugInsEnabled
657 {
658     return _preferences->pluginsEnabled();
659 }
660
661 - (void)_setWebGLEnabled:(BOOL)enabled
662 {
663     _preferences->setWebGLEnabled(enabled);
664 }
665
666 - (BOOL)_webGLEnabled
667 {
668     return _preferences->webGLEnabled();
669 }
670 #endif // PLATFORM(MAC)
671
672 - (BOOL)_javaScriptCanAccessClipboard
673 {
674     return _preferences->javaScriptCanAccessClipboard();
675 }
676
677 - (void)_setDOMPasteAllowed:(BOOL)domPasteAllowed
678 {
679     _preferences->setDOMPasteAllowed(domPasteAllowed);
680 }
681
682 - (BOOL)_domPasteAllowed
683 {
684     return _preferences->domPasteAllowed();
685 }
686
687 @end
688
689 #endif // WK_API_ENABLED