Changeset 231622 in webkit
- Timestamp:
- May 9, 2018, 5:33:37 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 37 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/cross-origin-options (added)
-
LayoutTests/http/wpt/cross-origin-options/allow-postmessage-expected.txt (added)
-
LayoutTests/http/wpt/cross-origin-options/allow-postmessage-from-deny-expected.txt (added)
-
LayoutTests/http/wpt/cross-origin-options/allow-postmessage-from-deny.html (added)
-
LayoutTests/http/wpt/cross-origin-options/allow-postmessage-from-deny.html.headers (added)
-
LayoutTests/http/wpt/cross-origin-options/allow-postmessage.html (added)
-
LayoutTests/http/wpt/cross-origin-options/cross-origin-options-header-expected.txt (added)
-
LayoutTests/http/wpt/cross-origin-options/cross-origin-options-header.html (added)
-
LayoutTests/http/wpt/cross-origin-options/resources (added)
-
LayoutTests/http/wpt/cross-origin-options/resources/cross-origin-options-allow-postmessage-pong.html (added)
-
LayoutTests/http/wpt/cross-origin-options/resources/cross-origin-options-allow-postmessage-pong.html.headers (added)
-
LayoutTests/http/wpt/cross-origin-options/resources/serve-cross-origin-options-header.py (added)
-
LayoutTests/http/wpt/cross-origin-options/resources/utils.js (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSDOMBindingSecurity.h (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (modified) (14 diffs)
-
Source/WebCore/bindings/js/JSDOMWindowCustom.h (modified) (2 diffs)
-
Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp (modified) (4 diffs)
-
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (modified) (4 diffs)
-
Source/WebCore/bindings/scripts/IDLAttributes.json (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (2 diffs)
-
Source/WebCore/dom/Document.h (modified) (3 diffs)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (1 diff)
-
Source/WebCore/page/AbstractDOMWindow.cpp (modified) (1 diff)
-
Source/WebCore/page/AbstractDOMWindow.h (modified) (3 diffs)
-
Source/WebCore/page/DOMWindow.cpp (modified) (2 diffs)
-
Source/WebCore/page/DOMWindow.idl (modified) (3 diffs)
-
Source/WebCore/page/Frame.h (modified) (1 diff)
-
Source/WebCore/page/RemoteDOMWindow.cpp (modified) (1 diff)
-
Source/WebCore/page/RemoteDOMWindow.h (modified) (2 diffs)
-
Source/WebCore/page/Settings.yaml (modified) (1 diff)
-
Source/WebCore/platform/network/HTTPHeaderNames.in (modified) (1 diff)
-
Source/WebCore/platform/network/HTTPParsers.cpp (modified) (1 diff)
-
Source/WebCore/platform/network/HTTPParsers.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/WebPreferences.yaml (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
-
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebView/WebPreferences.mm (modified) (2 diffs)
-
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebView/WebView.mm (modified) (1 diff)
-
Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl (modified) (1 diff)
-
Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h (modified) (1 diff)
-
Source/WebKitLegacy/win/WebPreferences.cpp (modified) (2 diffs)
-
Source/WebKitLegacy/win/WebPreferences.h (modified) (1 diff)
-
Source/WebKitLegacy/win/WebView.cpp (modified) (2 diffs)
-
Tools/DumpRenderTree/mac/DumpRenderTree.mm (modified) (1 diff)
-
Tools/DumpRenderTree/win/DumpRenderTree.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r231621 r231622 1 2018-05-09 Chris Dumez <cdumez@apple.com> 2 3 Add initial support for 'Cross-Origin-Options' HTTP response header 4 https://bugs.webkit.org/show_bug.cgi?id=184996 5 <rdar://problem/39664620> 6 7 Reviewed by Geoff Garen. 8 9 Add layout test coverage. 10 11 * http/wpt/cross-origin-options/allow-postmessage-expected.txt: Added. 12 * http/wpt/cross-origin-options/allow-postmessage-from-deny-expected.txt: Added. 13 * http/wpt/cross-origin-options/allow-postmessage-from-deny.html: Added. 14 * http/wpt/cross-origin-options/allow-postmessage-from-deny.html.headers: Added. 15 * http/wpt/cross-origin-options/allow-postmessage.html: Added. 16 * http/wpt/cross-origin-options/cross-origin-options-header-expected.txt: Added. 17 * http/wpt/cross-origin-options/cross-origin-options-header.html: Added. 18 * http/wpt/cross-origin-options/resources/cross-origin-options-allow-postmessage-pong.html: Added. 19 * http/wpt/cross-origin-options/resources/cross-origin-options-allow-postmessage-pong.html.headers: Added. 20 * http/wpt/cross-origin-options/resources/serve-cross-origin-options-header.py: Added. 21 1 22 2018-05-09 Ryosuke Niwa <rniwa@webkit.org> 2 23 -
trunk/Source/WebCore/ChangeLog
r231621 r231622 1 2018-05-09 Chris Dumez <cdumez@apple.com> 2 3 Add initial support for 'Cross-Origin-Options' HTTP response header 4 https://bugs.webkit.org/show_bug.cgi?id=184996 5 <rdar://problem/39664620> 6 7 Reviewed by Geoff Garen. 8 9 Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental 10 feature flag, on by default. When the HTTP server services this HTTP response header for a 11 main resource, we'll set these options on the corresponding Document. This will impact the 12 behavior of the Document's associated Window API when cross-origin. 13 14 The HTTP header has 3 possible values: 15 - allow: This is the default. Regular cross-origin Window API is available. 16 - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to 17 access anything else will throw a SecurityError. 18 - deny: Trying to do anything with a cross-origin window will throw a SecurityError. 19 20 The header has no effect when accessing same origin windows. 21 22 Note that on cross-origin access from Window A to Window B, we check the cross-origin 23 options for both Window A and Window B and use the lowest common denominator as effective 24 cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and 25 tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage', 26 we will throw a SecurityError. This is because Window A's more restrictive options (deny) 27 apply. 28 29 Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html 30 http/wpt/cross-origin-options/allow-postmessage.html 31 http/wpt/cross-origin-options/cross-origin-options-header.html 32 33 * bindings/js/JSDOMBindingSecurity.cpp: 34 (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions): 35 * bindings/js/JSDOMBindingSecurity.h: 36 * bindings/js/JSDOMWindowCustom.cpp: 37 (WebCore::effectiveCrossOriginOptionsForAccess): 38 (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): 39 (WebCore::JSDOMWindow::getOwnPropertySlot): 40 (WebCore::JSDOMWindow::getOwnPropertySlotByIndex): 41 (WebCore::addCrossOriginWindowPropertyNames): 42 (WebCore::addScopedChildrenIndexes): 43 (WebCore::addCrossOriginWindowOwnPropertyNames): 44 (WebCore::JSDOMWindow::getOwnPropertyNames): 45 * bindings/js/JSDOMWindowCustom.h: 46 * bindings/js/JSRemoteDOMWindowCustom.cpp: 47 (WebCore::JSRemoteDOMWindow::getOwnPropertySlot): 48 (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex): 49 (WebCore::JSRemoteDOMWindow::getOwnPropertyNames): 50 * bindings/scripts/CodeGeneratorJS.pm: 51 (GenerateAttributeGetterBodyDefinition): 52 (GetCrossOriginsOptionsFromExtendedAttributeValue): 53 (GenerateAttributeSetterBodyDefinition): 54 (GenerateOperationBodyDefinition): 55 * bindings/scripts/IDLAttributes.json: 56 * dom/Document.cpp: 57 (WebCore::Document::setCrossOriginOptions): 58 * dom/Document.h: 59 (WebCore::Document::crossOriginOptions const): 60 * loader/FrameLoader.cpp: 61 (WebCore::FrameLoader::didBeginDocument): 62 * page/AbstractDOMWindow.cpp: 63 (WebCore::AbstractDOMWindow::AbstractDOMWindow): 64 * page/AbstractDOMWindow.h: 65 (WebCore::AbstractDOMWindow::crossOriginOptions): 66 (WebCore::AbstractDOMWindow::setCrossOriginOptions): 67 * page/DOMWindow.cpp: 68 (WebCore::DOMWindow::DOMWindow): 69 (WebCore::DOMWindow::didSecureTransitionTo): 70 * page/DOMWindow.idl: 71 * page/Frame.h: 72 * page/RemoteDOMWindow.cpp: 73 (WebCore::RemoteDOMWindow::RemoteDOMWindow): 74 * page/RemoteDOMWindow.h: 75 * page/Settings.yaml: 76 * platform/network/HTTPHeaderNames.in: 77 * platform/network/HTTPParsers.cpp: 78 (WebCore::parseCrossOriginOptionsHeader): 79 * platform/network/HTTPParsers.h: 80 1 81 2018-05-09 Ryosuke Niwa <rniwa@webkit.org> 2 82 -
trunk/Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp
r230864 r231622 26 26 #include "Document.h" 27 27 #include "Frame.h" 28 #include "HTTPParsers.h" 28 29 #include "JSDOMExceptionHandling.h" 29 30 #include "JSDOMWindowBase.h" … … 100 101 } 101 102 103 bool BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions(JSC::ExecState* state, DOMWindow& target, CrossOriginOptions minimumCrossOriginOptions, SecurityReportingOption reportingOption) 104 { 105 DOMWindow& source = activeDOMWindow(*state); 106 ASSERT(minimumCrossOriginOptions > CrossOriginOptions::Deny); 107 108 static_assert(CrossOriginOptions::Deny < CrossOriginOptions::AllowPostMessage && CrossOriginOptions::AllowPostMessage < CrossOriginOptions::Allow, "More restrictive cross-origin options should have lower values"); 109 110 // Fast path. 111 auto effectiveCrossOriginOptions = std::min(source.crossOriginOptions(), target.crossOriginOptions()); 112 if (effectiveCrossOriginOptions >= minimumCrossOriginOptions) 113 return true; 114 115 return shouldAllowAccessToDOMWindow(state, target, reportingOption); 116 } 117 102 118 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDOMBindingSecurity.h
r211403 r231622 37 37 class Node; 38 38 39 enum class CrossOriginOptions; 40 39 41 void printErrorMessageForFrame(Frame*, const String& message); 40 42 … … 53 55 bool shouldAllowAccessToFrame(JSC::ExecState&, Frame&, String& message); 54 56 bool shouldAllowAccessToNode(JSC::ExecState&, Node*); 57 58 bool shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions(JSC::ExecState*, DOMWindow&, CrossOriginOptions, SecurityReportingOption = LogSecurityError); 55 59 56 60 }; -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r231037 r231622 27 27 #include "HTMLDocument.h" 28 28 #include "HTMLFrameOwnerElement.h" 29 #include "HTTPParsers.h" 29 30 #include "JSDOMBindingSecurity.h" 30 31 #include "JSDOMConvertNullable.h" … … 56 57 using namespace JSC; 57 58 59 static CrossOriginOptions effectiveCrossOriginOptionsForAccess(ExecState& state, AbstractDOMWindow& target) 60 { 61 static_assert(CrossOriginOptions::Deny < CrossOriginOptions::AllowPostMessage && CrossOriginOptions::AllowPostMessage < CrossOriginOptions::Allow, "More restrictive cross-origin options should have lower values"); 62 return std::min(activeDOMWindow(state).crossOriginOptions(), target.crossOriginOptions()); 63 } 64 58 65 EncodedJSValue JSC_HOST_CALL jsDOMWindowInstanceFunctionShowModalDialog(ExecState*); 59 66 … … 81 88 82 89 template <DOMWindowType windowType> 83 bool jsDOMWindowGetOwnPropertySlotRestrictedAccess(JSDOMGlobalObject* thisObject, Abstract Frame* frame, ExecState* exec, PropertyName propertyName, PropertySlot& slot, const String& errorMessage)84 { 85 VM& vm = exec->vm();90 bool jsDOMWindowGetOwnPropertySlotRestrictedAccess(JSDOMGlobalObject* thisObject, AbstractDOMWindow& window, ExecState& state, PropertyName propertyName, PropertySlot& slot, const String& errorMessage) 91 { 92 VM& vm = state.vm(); 86 93 auto scope = DECLARE_THROW_SCOPE(vm); 87 94 … … 92 99 slot.setValue(thisObject, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum, jsUndefined()); 93 100 return true; 101 } 102 103 switch (effectiveCrossOriginOptionsForAccess(state, window)) { 104 case CrossOriginOptions::AllowPostMessage: 105 if (propertyName == builtinNames.postMessagePublicName()) { 106 slot.setCustom(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum), windowType == DOMWindowType::Remote ? nonCachingStaticFunctionGetter<jsRemoteDOMWindowInstanceFunctionPostMessage, 0> : nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>); 107 return true; 108 } 109 FALLTHROUGH; 110 case CrossOriginOptions::Deny: 111 throwSecurityError(state, scope, errorMessage); 112 slot.setUndefined(); 113 return false; 114 case CrossOriginOptions::Allow: 115 break; 94 116 } 95 117 … … 137 159 // named getter from returning frames with matching names - this seems a little questionable, see 138 160 // FIXME comment on prototype search below.) 139 throwSecurityError( *exec, scope, errorMessage);161 throwSecurityError(state, scope, errorMessage); 140 162 slot.setUndefined(); 141 163 return false; … … 147 169 // the Moz way. 148 170 // FIXME: Add support to named attributes on RemoteFrames. 171 auto* frame = window.frame(); 149 172 if (frame && is<Frame>(*frame)) { 150 173 if (auto* scopedChild = downcast<Frame>(*frame).tree().scopedChild(propertyNameToAtomicString(propertyName))) { 151 slot.setValue(thisObject, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::DontEnum, toJS( exec, scopedChild->document()->domWindow()));174 slot.setValue(thisObject, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::DontEnum, toJS(&state, scopedChild->document()->domWindow())); 152 175 return true; 153 176 } 154 177 } 155 178 156 throwSecurityError( *exec, scope, errorMessage);179 throwSecurityError(state, scope, errorMessage); 157 180 slot.setUndefined(); 158 181 return false; 159 182 } 160 template bool jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(JSDOMGlobalObject*, Abstract Frame*, ExecState*, PropertyName, PropertySlot&, const String&);161 template bool jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(JSDOMGlobalObject*, Abstract Frame*, ExecState*, PropertyName, PropertySlot&, const String&);183 template bool jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(JSDOMGlobalObject*, AbstractDOMWindow&, ExecState&, PropertyName, PropertySlot&, const String&); 184 template bool jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(JSDOMGlobalObject*, AbstractDOMWindow&, ExecState&, PropertyName, PropertySlot&, const String&); 162 185 163 186 // Property access sequence is: … … 173 196 174 197 auto* thisObject = jsCast<JSDOMWindow*>(object); 175 auto* frame = thisObject->wrapped().frame();176 198 177 199 // Hand off all cross-domain access to jsDOMWindowGetOwnPropertySlotRestrictedAccess. 178 200 String errorMessage; 179 201 if (!BindingSecurity::shouldAllowAccessToDOMWindow(*state, thisObject->wrapped(), errorMessage)) 180 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(thisObject, frame,state, propertyName, slot, errorMessage);181 202 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(thisObject, thisObject->wrapped(), *state, propertyName, slot, errorMessage); 203 182 204 // FIXME: this need more explanation. 183 205 // (Particularly, is it correct that this exists here but not in getOwnPropertySlotByIndex?) … … 187 209 PropertySlot slotCopy = slot; 188 210 if (Base::getOwnPropertySlot(thisObject, state, propertyName, slot)) { 211 auto* frame = thisObject->wrapped().frame(); 212 189 213 // Detect when we're getting the property 'showModalDialog', this is disabled, and has its original value. 190 214 bool isShowModalDialogAndShouldHide = propertyName == static_cast<JSVMClientData*>(state->vm().clientData)->builtinNames().showModalDialogPublicName() … … 214 238 { 215 239 auto* thisObject = jsCast<JSDOMWindow*>(object); 216 auto* frame = thisObject->wrapped().frame(); 240 auto& window = thisObject->wrapped(); 241 auto* frame = window.frame(); 217 242 218 243 // Indexed getters take precendence over regular properties, so caching would be invalid. 219 244 slot.disableCaching(); 220 245 246 String errorMessage; 247 std::optional<bool> cachedIsCrossOriginAccess; 248 auto isCrossOriginAccess = [&] { 249 if (!cachedIsCrossOriginAccess) 250 cachedIsCrossOriginAccess = !BindingSecurity::shouldAllowAccessToDOMWindow(*state, window, errorMessage); 251 return *cachedIsCrossOriginAccess; 252 }; 253 221 254 // (1) First, indexed properties. 222 // These are also allowed cross-orgin, so come before the access check. 223 if (frame && index < frame->tree().scopedChildCount()) { 224 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), toJS(state, frame->tree().scopedChild(index)->document()->domWindow())); 225 return true; 255 // These are also allowed cross-origin, so come before the access check. 256 switch (effectiveCrossOriginOptionsForAccess(*state, window)) { 257 case CrossOriginOptions::Deny: 258 case CrossOriginOptions::AllowPostMessage: 259 if (isCrossOriginAccess()) 260 break; 261 FALLTHROUGH; 262 case CrossOriginOptions::Allow: 263 if (frame && index < frame->tree().scopedChildCount()) { 264 slot.setValue(thisObject, static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly), toJS(state, frame->tree().scopedChild(index)->document()->domWindow())); 265 return true; 266 } 267 break; 226 268 } 227 269 228 270 // Hand off all cross-domain/frameless access to jsDOMWindowGetOwnPropertySlotRestrictedAccess. 229 String errorMessage; 230 if (!BindingSecurity::shouldAllowAccessToDOMWindow(*state, thisObject->wrapped(), errorMessage)) 231 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(thisObject, frame, state, Identifier::from(state, index), slot, errorMessage); 271 if (isCrossOriginAccess()) 272 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Local>(thisObject, window, *state, Identifier::from(state, index), slot, errorMessage); 232 273 233 274 // (2) Regular own properties. … … 288 329 289 330 // https://html.spec.whatwg.org/#crossoriginproperties-(-o-) 290 static void addCrossOriginWindowPropertyNames(VM& vm, PropertyNameArray& propertyNames) 291 { 331 static void addCrossOriginWindowPropertyNames(ExecState& state, AbstractDOMWindow& window, PropertyNameArray& propertyNames) 332 { 333 auto& vm = state.vm(); 334 292 335 static const Identifier* const properties[] = { 293 336 &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().blurPublicName(), … … 305 348 &static_cast<JSVMClientData*>(vm.clientData)->builtinNames().windowPublicName() 306 349 }; 307 for (auto* property : properties) 308 propertyNames.add(*property); 350 351 switch (effectiveCrossOriginOptionsForAccess(state, window)) { 352 case CrossOriginOptions::Allow: 353 for (auto* property : properties) 354 propertyNames.add(*property); 355 break; 356 case CrossOriginOptions::AllowPostMessage: 357 propertyNames.add(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().postMessagePublicName()); 358 break; 359 case CrossOriginOptions::Deny: 360 break; 361 } 309 362 } 310 363 … … 319 372 return; 320 373 374 switch (effectiveCrossOriginOptionsForAccess(state, window)) { 375 case CrossOriginOptions::Allow: 376 break; 377 case CrossOriginOptions::Deny: 378 case CrossOriginOptions::AllowPostMessage: 379 return; 380 } 381 321 382 unsigned scopedChildCount = frame->tree().scopedChildCount(); 322 383 for (unsigned i = 0; i < scopedChildCount; ++i) … … 325 386 326 387 // https://html.spec.whatwg.org/#crossoriginownpropertykeys-(-o-) 327 void addCrossOriginWindowOwnPropertyNames(ExecState& state, PropertyNameArray& propertyNames)328 { 329 VM& vm = state.vm();330 addCrossOriginWindowPropertyNames(vm, propertyNames); 331 388 void addCrossOriginWindowOwnPropertyNames(ExecState& state, AbstractDOMWindow& window, PropertyNameArray& propertyNames) 389 { 390 addCrossOriginWindowPropertyNames(state, window, propertyNames); 391 392 auto& vm = state.vm(); 332 393 propertyNames.add(vm.propertyNames->toStringTagSymbol); 333 394 propertyNames.add(vm.propertyNames->hasInstanceSymbol); … … 344 405 if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped(), DoNotReportSecurityError)) { 345 406 if (mode.includeDontEnumProperties()) 346 addCrossOriginWindowOwnPropertyNames(*exec, propertyNames);407 addCrossOriginWindowOwnPropertyNames(*exec, thisObject->wrapped(), propertyNames); 347 408 return; 348 409 } -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.h
r230715 r231622 23 23 namespace WebCore { 24 24 25 class AbstractDOMWindow; 25 26 class AbstractFrame; 26 27 … … 38 39 39 40 template <DOMWindowType windowType> 40 bool jsDOMWindowGetOwnPropertySlotRestrictedAccess(JSDOMGlobalObject*, Abstract Frame*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&, const String&);41 bool jsDOMWindowGetOwnPropertySlotRestrictedAccess(JSDOMGlobalObject*, AbstractDOMWindow&, JSC::ExecState&, JSC::PropertyName, JSC::PropertySlot&, const String&); 41 42 42 void addCrossOriginWindowOwnPropertyNames(JSC::ExecState&, JSC::PropertyNameArray&);43 void addCrossOriginWindowOwnPropertyNames(JSC::ExecState&, AbstractDOMWindow&, JSC::PropertyNameArray&); 43 44 44 45 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSRemoteDOMWindowCustom.cpp
r230715 r231622 38 38 39 39 auto* thisObject = jsCast<JSRemoteDOMWindow*>(object); 40 auto* frame = thisObject->wrapped().frame(); 41 42 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(thisObject, frame, state, propertyName, slot, String()); 40 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(thisObject, thisObject->wrapped(), *state, propertyName, slot, String()); 43 41 } 44 42 … … 46 44 { 47 45 auto* thisObject = jsCast<JSRemoteDOMWindow*>(object); 48 auto* frame = thisObject->wrapped().frame();49 46 50 47 // Indexed getters take precendence over regular properties, so caching would be invalid. … … 53 50 // FIXME: Add support for indexed properties. 54 51 55 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(thisObject, frame,state, Identifier::from(state, index), slot, String());52 return jsDOMWindowGetOwnPropertySlotRestrictedAccess<DOMWindowType::Remote>(thisObject, thisObject->wrapped(), *state, Identifier::from(state, index), slot, String()); 56 53 } 57 54 … … 101 98 } 102 99 103 void JSRemoteDOMWindow::getOwnPropertyNames(JSObject* , ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)100 void JSRemoteDOMWindow::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) 104 101 { 102 auto* thisObject = jsCast<JSRemoteDOMWindow*>(object); 103 105 104 // FIXME: Add scoped children indexes. 106 105 107 106 if (mode.includeDontEnumProperties()) 108 addCrossOriginWindowOwnPropertyNames(*exec, propertyNames);107 addCrossOriginWindowOwnPropertyNames(*exec, thisObject->wrapped(), propertyNames); 109 108 } 110 109 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r231114 r231622 4707 4707 AddToImplIncludes("JSDOMBindingSecurity.h", $conditional); 4708 4708 if ($interface->type->name eq "DOMWindow") { 4709 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n"); 4709 if ($attribute->extendedAttributes->{DoNotCheckSecurityIf}) { 4710 my $crossOriginOptions = GetCrossOriginsOptionsFromExtendedAttributeValue($attribute->extendedAttributes->{DoNotCheckSecurityIf}); 4711 AddToImplIncludes("HTTPParsers.h", $conditional); 4712 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions(&state, thisObject.wrapped(), $crossOriginOptions, ThrowSecurityError))\n"); 4713 } else { 4714 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n"); 4715 } 4710 4716 } else { 4711 4717 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToFrame(&state, thisObject.wrapped().frame(), ThrowSecurityError))\n"); … … 4815 4821 } 4816 4822 4823 sub GetCrossOriginsOptionsFromExtendedAttributeValue 4824 { 4825 my $extendedAttributeValue = shift; 4826 4827 return "CrossOriginOptions::Allow" if $extendedAttributeValue eq "CrossOriginOptionsAllow"; 4828 return "CrossOriginOptions::AllowPostMessage" if $extendedAttributeValue eq "CrossOriginOptionsAllowPostMessage"; 4829 die "Unsupported CrossOriginOptions: " + $extendedAttributeValue; 4830 } 4831 4817 4832 sub GenerateAttributeSetterBodyDefinition 4818 4833 { … … 4837 4852 AddToImplIncludes("JSDOMBindingSecurity.h", $conditional); 4838 4853 if ($interface->type->name eq "DOMWindow") { 4839 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n"); 4854 if ($attribute->extendedAttributes->{DoNotCheckSecurityIf}) { 4855 my $crossOriginOptions = GetCrossOriginsOptionsFromExtendedAttributeValue($attribute->extendedAttributes->{DoNotCheckSecurityIf}); 4856 AddToImplIncludes("HTTPParsers.h", $conditional); 4857 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions(&state, thisObject.wrapped(), $crossOriginOptions, ThrowSecurityError))\n"); 4858 } else { 4859 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n"); 4860 } 4840 4861 } else { 4841 4862 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToFrame(&state, thisObject.wrapped().frame(), ThrowSecurityError))\n"); … … 5058 5079 AddToImplIncludes("JSDOMBindingSecurity.h", $conditional); 5059 5080 if ($interface->type->name eq "DOMWindow") { 5060 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError))\n"); 5081 if ($operation->extendedAttributes->{DoNotCheckSecurityIf}) { 5082 my $crossOriginOptions = GetCrossOriginsOptionsFromExtendedAttributeValue($operation->extendedAttributes->{DoNotCheckSecurityIf}); 5083 AddToImplIncludes("HTTPParsers.h", $conditional); 5084 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions(state, castedThis->wrapped(), $crossOriginOptions, ThrowSecurityError))\n"); 5085 } else { 5086 push(@$outputArray, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError))\n"); 5087 } 5061 5088 push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); 5062 5089 } else { -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.json
r226088 r231622 162 162 "contextsAllowed": ["attribute", "operation"] 163 163 }, 164 "DoNotCheckSecurityIf": { 165 "contextsAllowed": ["attribute", "operation"], 166 "values": ["CrossOriginOptionsAllow", "CrossOriginOptionsAllowPostMessage"] 167 }, 164 168 "DoNotCheckSecurityOnGetter": { 165 169 "contextsAllowed": ["attribute"] -
trunk/Source/WebCore/dom/Document.cpp
r231557 r231622 518 518 , m_cookieCacheExpiryTimer(*this, &Document::invalidateDOMCookieCache) 519 519 , m_socketProvider(page() ? &page()->socketProvider() : nullptr) 520 , m_crossOriginOptions { CrossOriginOptions::Allow } 520 521 , m_isSynthesized(constructionFlags & Synthesized) 521 522 , m_isNonRenderedPlaceholder(constructionFlags & NonRenderedPlaceholder) … … 7807 7808 } 7808 7809 7810 void Document::setCrossOriginOptions(CrossOriginOptions value) 7811 { 7812 m_crossOriginOptions = value; 7813 if (auto* window = domWindow()) 7814 window->setCrossOriginOptions(value); 7815 } 7816 7809 7817 } // namespace WebCore -
trunk/Source/WebCore/dom/Document.h
r231557 r231622 195 195 196 196 enum CollectionType; 197 enum class CrossOriginOptions; 197 198 enum class ShouldOpenExternalURLsPolicy; 198 199 … … 1431 1432 String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&); 1432 1433 1434 CrossOriginOptions crossOriginOptions() const { return m_crossOriginOptions; } 1435 void setCrossOriginOptions(CrossOriginOptions value); 1436 1433 1437 protected: 1434 1438 enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 }; … … 1816 1820 unsigned m_writeRecursionDepth { 0 }; 1817 1821 1822 CrossOriginOptions m_crossOriginOptions; 1823 1818 1824 InheritedBool m_designMode { inherit }; 1819 1825 MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying }; -
trunk/Source/WebCore/loader/FrameLoader.cpp
r231548 r231622 743 743 m_frame.document()->setContentLanguage(headerContentLanguage); 744 744 } 745 746 if (m_frame.settings().crossOriginOptionsSupportEnabled()) { 747 String crossOriginOptionsHeader = m_documentLoader->response().httpHeaderField(HTTPHeaderName::CrossOriginOptions); 748 if (!crossOriginOptionsHeader.isEmpty()) 749 m_frame.document()->setCrossOriginOptions(parseCrossOriginOptionsHeader(crossOriginOptionsHeader)); 750 } 745 751 } 746 752 -
trunk/Source/WebCore/page/AbstractDOMWindow.cpp
r230613 r231622 38 38 } 39 39 40 AbstractDOMWindow::AbstractDOMWindow(GlobalWindowIdentifier&& identifier )40 AbstractDOMWindow::AbstractDOMWindow(GlobalWindowIdentifier&& identifier, CrossOriginOptions crossOriginOptions) 41 41 : m_identifier(WTFMove(identifier)) 42 , m_crossOriginOptions(crossOriginOptions) 42 43 { 43 44 ASSERT(!allWindows().contains(identifier)); -
trunk/Source/WebCore/page/AbstractDOMWindow.h
r230613 r231622 36 36 class AbstractFrame; 37 37 38 enum class CrossOriginOptions; 39 38 40 // FIXME: Rename DOMWindow to LocalWindow and AbstractDOMWindow to DOMWindow. 39 41 class AbstractDOMWindow : public RefCounted<AbstractDOMWindow>, public EventTargetWithInlineData { … … 53 55 using RefCounted::deref; 54 56 57 CrossOriginOptions crossOriginOptions() { return m_crossOriginOptions; } 58 void setCrossOriginOptions(CrossOriginOptions value) { m_crossOriginOptions = value; } 59 55 60 protected: 56 explicit AbstractDOMWindow(GlobalWindowIdentifier&&);61 AbstractDOMWindow(GlobalWindowIdentifier&&, CrossOriginOptions); 57 62 58 63 EventTargetInterface eventTargetInterface() const final { return DOMWindowEventTargetInterfaceType; } … … 62 67 private: 63 68 GlobalWindowIdentifier m_identifier; 69 CrossOriginOptions m_crossOriginOptions; 64 70 }; 65 71 -
trunk/Source/WebCore/page/DOMWindow.cpp
r231114 r231622 403 403 404 404 DOMWindow::DOMWindow(Document& document) 405 : AbstractDOMWindow(GlobalWindowIdentifier { Process::identifier(), generateObjectIdentifier<WindowIdentifierType>() } )405 : AbstractDOMWindow(GlobalWindowIdentifier { Process::identifier(), generateObjectIdentifier<WindowIdentifierType>() }, document.crossOriginOptions()) 406 406 , ContextDestructionObserver(&document) 407 407 , FrameDestructionObserver(document.frame()) … … 414 414 { 415 415 observeContext(&document); 416 setCrossOriginOptions(document.crossOriginOptions()); 416 417 } 417 418 -
trunk/Source/WebCore/page/DOMWindow.idl
r230867 r231622 50 50 ] interface DOMWindow : EventTarget { 51 51 // The current browsing context. 52 [DoNotCheckSecurity , Unforgeable, ImplementedAs=self] readonly attribute WindowProxy window;53 [Replaceable, DoNotCheckSecurity OnGetter] readonly attribute WindowProxy self;52 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, Unforgeable, ImplementedAs=self] readonly attribute WindowProxy window; 53 [Replaceable, DoNotCheckSecurityIf=CrossOriginOptionsAllow] readonly attribute WindowProxy self; 54 54 [Unforgeable] readonly attribute Document document; 55 55 attribute DOMString name; 56 [DoNotCheckSecurity , PutForwards=href, Unforgeable] readonly attribute Location? location; // FIXME: Should not be nullable.56 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, PutForwards=href, Unforgeable] readonly attribute Location? location; // FIXME: Should not be nullable. 57 57 readonly attribute History history; 58 58 [EnabledAtRuntime=CustomElements, ImplementedAs=ensureCustomElementRegistry] readonly attribute CustomElementRegistry customElements; … … 64 64 [Replaceable] readonly attribute BarProp toolbar; 65 65 attribute DOMString status; 66 [DoNotCheckSecurity , CallWith=IncumbentDocument, ForwardDeclareInHeader] void close();67 [DoNotCheckSecurity , ForwardDeclareInHeader] readonly attribute boolean closed;66 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, CallWith=IncumbentDocument, ForwardDeclareInHeader] void close(); 67 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, ForwardDeclareInHeader] readonly attribute boolean closed; 68 68 void stop(); 69 [DoNotCheckSecurity , CallWith=IncumbentWindow, ForwardDeclareInHeader] void focus();70 [DoNotCheckSecurity , ForwardDeclareInHeader] void blur();69 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, CallWith=IncumbentWindow, ForwardDeclareInHeader] void focus(); 70 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, ForwardDeclareInHeader] void blur(); 71 71 72 72 // Other browsing contexts. 73 [Replaceable, DoNotCheckSecurity OnGetter, ImplementedAs=self] readonly attribute WindowProxy frames;74 [Replaceable, DoNotCheckSecurity OnGetter] readonly attribute unsigned long length;75 [DoNotCheckSecurity OnGetter, Unforgeable] readonly attribute WindowProxy? top;76 [DoNotCheckSecurity OnGetter, CustomSetter] attribute WindowProxy? opener;77 [Replaceable, DoNotCheckSecurity OnGetter] readonly attribute WindowProxy? parent;73 [Replaceable, DoNotCheckSecurityIf=CrossOriginOptionsAllow, ImplementedAs=self] readonly attribute WindowProxy frames; 74 [Replaceable, DoNotCheckSecurityIf=CrossOriginOptionsAllow] readonly attribute unsigned long length; 75 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, Unforgeable] readonly attribute WindowProxy? top; 76 [DoNotCheckSecurityIf=CrossOriginOptionsAllow, CustomSetter] attribute WindowProxy? opener; 77 [Replaceable, DoNotCheckSecurityIf=CrossOriginOptionsAllow] readonly attribute WindowProxy? parent; 78 78 [CheckSecurityForNode] readonly attribute Element? frameElement; 79 79 [CallWith=ActiveWindow&FirstWindow] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", optional [TreatNullAs=EmptyString] DOMString features = ""); … … 93 93 void cancelAnimationFrame(long handle); // FIXME: handle should be an unsigned long. 94 94 95 [CallWith=ScriptState&IncumbentWindow, DoNotCheckSecurity , ForwardDeclareInHeader, MayThrowException] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);95 [CallWith=ScriptState&IncumbentWindow, DoNotCheckSecurityIf=CrossOriginOptionsAllowPostMessage, ForwardDeclareInHeader, MayThrowException] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); 96 96 97 97 // Obsolete members, still part of the HTML specification (https://html.spec.whatwg.org/#Window-partial). -
trunk/Source/WebCore/page/Frame.h
r230764 r231622 137 137 WEBCORE_EXPORT ~Frame(); 138 138 139 DOMWindow* window() const;139 WEBCORE_EXPORT DOMWindow* window() const; 140 140 141 141 void addDestructionObserver(FrameDestructionObserver*); -
trunk/Source/WebCore/page/RemoteDOMWindow.cpp
r231037 r231622 33 33 namespace WebCore { 34 34 35 RemoteDOMWindow::RemoteDOMWindow(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier )36 : AbstractDOMWindow(WTFMove(identifier) )35 RemoteDOMWindow::RemoteDOMWindow(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier, CrossOriginOptions crossOriginOptions) 36 : AbstractDOMWindow(WTFMove(identifier), crossOriginOptions) 37 37 , m_frame(WTFMove(frame)) 38 38 { -
trunk/Source/WebCore/page/RemoteDOMWindow.h
r231037 r231622 45 45 class RemoteDOMWindow final : public AbstractDOMWindow { 46 46 public: 47 static Ref<RemoteDOMWindow> create(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier )47 static Ref<RemoteDOMWindow> create(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier, CrossOriginOptions crossOriginOptions) 48 48 { 49 return adoptRef(*new RemoteDOMWindow(WTFMove(frame), WTFMove(identifier) ));49 return adoptRef(*new RemoteDOMWindow(WTFMove(frame), WTFMove(identifier), crossOriginOptions)); 50 50 } 51 51 … … 69 69 70 70 private: 71 WEBCORE_EXPORT RemoteDOMWindow(Ref<RemoteFrame>&&, GlobalWindowIdentifier&& );71 WEBCORE_EXPORT RemoteDOMWindow(Ref<RemoteFrame>&&, GlobalWindowIdentifier&&, CrossOriginOptions); 72 72 73 73 bool isRemoteDOMWindow() const final { return true; } -
trunk/Source/WebCore/page/Settings.yaml
r231479 r231622 743 743 onChange: setNeedsRecalcStyleInAllFrames 744 744 745 crossOriginOptionsSupportEnabled: 746 initial: true 747 745 748 accessibilityEventsEnabled: 746 749 initial: true -
trunk/Source/WebCore/platform/network/HTTPHeaderNames.in
r230968 r231622 51 51 Cookie 52 52 Cookie2 53 Cross-Origin-Options 53 54 Date 54 55 DNT -
trunk/Source/WebCore/platform/network/HTTPParsers.cpp
r230968 r231622 914 914 } 915 915 916 } 916 CrossOriginOptions parseCrossOriginOptionsHeader(StringView header) 917 { 918 auto strippedHeader = stripLeadingAndTrailingHTTPSpaces(header); 919 if (strippedHeader.isEmpty()) 920 return CrossOriginOptions::Allow; 921 922 if (equalLettersIgnoringASCIICase(strippedHeader, "deny")) 923 return CrossOriginOptions::Deny; 924 925 if (equalLettersIgnoringASCIICase(strippedHeader, "allow-postmessage")) 926 return CrossOriginOptions::AllowPostMessage; 927 928 return CrossOriginOptions::Allow; 929 } 930 931 } -
trunk/Source/WebCore/platform/network/HTTPParsers.h
r231479 r231622 72 72 }; 73 73 74 // Should be sorted from most restrictive to most permissive. 75 enum class CrossOriginOptions { 76 Deny, 77 AllowPostMessage, 78 Allow, 79 }; 80 74 81 bool isValidReasonPhrase(const String&); 75 82 bool isValidHTTPHeaderValue(const String&); … … 112 119 113 120 WEBCORE_EXPORT FromOriginDisposition parseFromOriginHeader(const String&); 121 CrossOriginOptions parseCrossOriginOptionsHeader(StringView); 114 122 115 123 inline bool isHTTPSpace(UChar character) -
trunk/Source/WebKit/ChangeLog
r231606 r231622 1 2018-05-09 Chris Dumez <cdumez@apple.com> 2 3 Add initial support for 'Cross-Origin-Options' HTTP response header 4 https://bugs.webkit.org/show_bug.cgi?id=184996 5 <rdar://problem/39664620> 6 7 Reviewed by Geoff Garen. 8 9 * Shared/WebPreferences.yaml: 10 Add this as an experimental feature, on by default. 11 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::frameBecameRemote): 14 Make sure we pass the cross-origin options from the local Window 15 to the remote one when transitioning. 16 1 17 2018-05-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 18 -
trunk/Source/WebKit/Shared/WebPreferences.yaml
r231457 r231622 1098 1098 category: experimental 1099 1099 1100 CrossOriginOptionsSupportEnabled: 1101 type: bool 1102 defaultValue: true 1103 humanReadableName: "Cross-Origin-Options HTTP Header" 1104 humanReadableDescription: "Enable support for Cross-Origin-Options HTTP Header" 1105 category: experimental 1106 1100 1107 SpringTimingFunctionEnabled: 1101 1108 type: bool -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r231479 r231622 5906 5906 return; 5907 5907 5908 auto* coreFrame = frame->coreFrame(); 5909 auto* previousWindow = coreFrame->window(); 5910 if (!previousWindow) 5911 return; 5912 5908 5913 auto remoteFrame = RemoteFrame::create(WTFMove(remoteFrameIdentifier)); 5909 auto remoteWindow = RemoteDOMWindow::create(remoteFrame.copyRef(), WTFMove(remoteWindowIdentifier) );5914 auto remoteWindow = RemoteDOMWindow::create(remoteFrame.copyRef(), WTFMove(remoteWindowIdentifier), previousWindow->crossOriginOptions()); 5910 5915 UNUSED_PARAM(remoteWindow); 5911 5916 … … 5916 5921 remoteFrame->windowProxy().setDOMWindow(remoteWindow.ptr()); 5917 5922 5918 auto* coreFrame = frame->coreFrame();5919 5923 coreFrame->setView(nullptr); 5920 5924 coreFrame->willDetachPage(); -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
r231082 r231622 174 174 #define WebKitCustomPasteboardDataEnabledPreferenceKey @"WebKitCustomPasteboardDataEnabled" 175 175 #define WebKitCacheAPIEnabledPreferenceKey @"WebKitCacheAPIEnabled" 176 #define WebKitCrossOriginOptionsSupportEnabledPreferenceKey @"WebKitCrossOriginOptionsSupportEnabled" 176 177 #define WebKitFetchAPIEnabledPreferenceKey @"WebKitFetchAPIEnabled" 177 178 #define WebKitWritableStreamAPIEnabledPreferenceKey @"WebKitWritableStreamAPIEnabled" -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm
r231082 r231622 635 635 #endif 636 636 [NSNumber numberWithBool:NO], WebKitCacheAPIEnabledPreferenceKey, 637 [NSNumber numberWithBool:NO], WebKitCrossOriginOptionsSupportEnabledPreferenceKey, 637 638 [NSNumber numberWithBool:YES], WebKitFetchAPIEnabledPreferenceKey, 638 639 … … 3010 3011 } 3011 3012 3013 - (BOOL)crossOriginOptionsSupportEnabled 3014 { 3015 return [self _boolValueForKey:WebKitCrossOriginOptionsSupportEnabledPreferenceKey]; 3016 } 3017 3018 - (void)setCrossOriginOptionsSupportEnabled:(BOOL)flag 3019 { 3020 [self _setBoolValue:flag forKey:WebKitCrossOriginOptionsSupportEnabledPreferenceKey]; 3021 } 3022 3012 3023 - (BOOL)fetchAPIEnabled 3013 3024 { -
trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
r231383 r231622 544 544 - (void)setCacheAPIEnabled:(BOOL)enabled; 545 545 546 - (BOOL)crossOriginOptionsSupportEnabled; 547 - (void)setCrossOriginOptionsSupportEnabled:(BOOL)enabled; 548 546 549 - (void)setFetchAPIEnabled:(BOOL)flag; 547 550 - (BOOL)fetchAPIEnabled; -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r231201 r231622 3063 3063 settings.setConstantPropertiesEnabled([preferences constantPropertiesEnabled]); 3064 3064 settings.setColorFilterEnabled([preferences colorFilterEnabled]); 3065 settings.setCrossOriginOptionsSupportEnabled([preferences crossOriginOptionsSupportEnabled]); 3065 3066 3066 3067 #if ENABLE(GAMEPAD) -
trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
r229578 r231622 229 229 HRESULT setMenuItemElementEnabled([in] BOOL enabled); 230 230 } 231 232 [uuid(9A49D1DE-53DD-11E8-95E6-003EE1C28AB6)] 233 interface IWebPreferencesPrivate7 : IWebPreferencesPrivate6 234 { 235 HRESULT crossOriginOptionsSupportEnabled([out, retval] BOOL* enabled); 236 HRESULT setCrossOriginOptionsSupportEnabled([in] BOOL enabled); 237 } -
trunk/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
r229578 r231622 181 181 #define WebKitMenuItemElementEnabledPreferenceKey "WebKitMenuItemElementEnabled" 182 182 183 #define WebKitCrossOriginOptionsSupportEnabledPreferenceKey "WebKitCrossOriginOptionsSupportEnabled" 184 183 185 #define WebKitModernMediaControlsEnabledPreferenceKey "WebKitModernMediaControlsEnabled" 184 186 -
trunk/Source/WebKitLegacy/win/WebPreferences.cpp
r230736 r231622 250 250 CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayCaptionsPreferenceKey), kCFBooleanFalse); 251 251 CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayTextDescriptionsPreferenceKey), kCFBooleanFalse); 252 CFDictionaryAddValue(defaults, CFSTR(WebKitCrossOriginOptionsSupportEnabledPreferenceKey), kCFBooleanFalse); 252 253 253 254 RetainPtr<CFStringRef> linkBehaviorStringRef = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebKitEditableLinkDefaultBehavior)); … … 2030 2031 } 2031 2032 2033 HRESULT WebPreferences::crossOriginOptionsSupportEnabled(_Out_ BOOL* enabled) 2034 { 2035 if (!enabled) 2036 return E_POINTER; 2037 *enabled = boolValueForKey(WebKitCrossOriginOptionsSupportEnabledPreferenceKey); 2038 return S_OK; 2039 } 2040 2041 HRESULT WebPreferences::setCrossOriginOptionsSupportEnabled(BOOL enabled) 2042 { 2043 setBoolValue(WebKitCrossOriginOptionsSupportEnabledPreferenceKey, enabled); 2044 return S_OK; 2045 } 2046 2032 2047 HRESULT WebPreferences::setModernMediaControlsEnabled(BOOL enabled) 2033 2048 { -
trunk/Source/WebKitLegacy/win/WebPreferences.h
r229578 r231622 277 277 virtual HRESULT STDMETHODCALLTYPE setMenuItemElementEnabled(BOOL); 278 278 279 // IWebPreferencesPrivate7 280 virtual HRESULT STDMETHODCALLTYPE crossOriginOptionsSupportEnabled(_Out_ BOOL*); 281 virtual HRESULT STDMETHODCALLTYPE setCrossOriginOptionsSupportEnabled(BOOL); 282 279 283 // WebPreferences 280 284 -
trunk/Source/WebKitLegacy/win/WebView.cpp
r230211 r231622 5151 5151 #endif 5152 5152 5153 COMPtr<IWebPreferencesPrivate 6> prefsPrivate { Query, preferences };5153 COMPtr<IWebPreferencesPrivate7> prefsPrivate { Query, preferences }; 5154 5154 if (prefsPrivate) { 5155 5155 hr = prefsPrivate->localStorageDatabasePath(&str); … … 5279 5279 return hr; 5280 5280 settings.setVisualViewportAPIEnabled(!!enabled); 5281 5282 hr = prefsPrivate->crossOriginOptionsSupportEnabled(&enabled); 5283 if (FAILED(hr)) 5284 return hr; 5285 settings.setCrossOriginOptionsSupportEnabled(!!enabled); 5281 5286 5282 5287 hr = preferences->privateBrowsingEnabled(&enabled); -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r231082 r231622 863 863 [preferences setVisualViewportAPIEnabled:YES]; 864 864 [preferences setColorFilterEnabled:YES]; 865 [preferences setCrossOriginOptionsSupportEnabled:YES]; 865 866 } 866 867 -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r229578 r231622 789 789 // FIXME: WebGL2 790 790 // FIXME: WebRTC 791 prefsPrivate->setCrossOriginOptionsSupportEnabled(TRUE); 791 792 } 792 793
Note:
See TracChangeset
for help on using the changeset viewer.