Changeset 252894 in webkit
- Timestamp:
- Nov 26, 2019 5:53:00 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252892 r252894 1 2019-11-26 Chris Dumez <cdumez@apple.com> 2 3 Drop ActiveDOMObject::shouldPreventEnteringBackForwardCache_DEPRECATED() 4 https://bugs.webkit.org/show_bug.cgi?id=204626 5 6 Reviewed by Ryosuke Niwa. 7 8 * http/tests/security/navigate-when-restoring-cached-page.html: 9 1 10 2019-11-26 Jonathan Bedard <jbedard@apple.com> 2 11 -
trunk/LayoutTests/http/tests/security/navigate-when-restoring-cached-page.html
r251220 r252894 62 62 clearInterval(interval_id); 63 63 64 // Prevent entering PageCache.65 64 if (w.internals) 66 w.internals.preventDocumentF orEnteringBackForwardCache();65 w.internals.preventDocumentFromEnteringBackForwardCache(); 67 66 68 67 child_frame = w.document.body.appendChild(document.createElement('iframe')); -
trunk/Source/WebCore/ChangeLog
r252893 r252894 1 2019-11-26 Chris Dumez <cdumez@apple.com> 2 3 Drop ActiveDOMObject::shouldPreventEnteringBackForwardCache_DEPRECATED() 4 https://bugs.webkit.org/show_bug.cgi?id=204626 5 6 Reviewed by Ryosuke Niwa. 7 8 Drop ActiveDOMObject::shouldPreventEnteringBackForwardCache_DEPRECATED() now that it is no longer 9 used. 10 11 * dom/ActiveDOMObject.h: 12 * dom/Document.h: 13 (WebCore::Document::shouldPreventEnteringBackForwardCacheForTesting const): 14 (WebCore::Document::preventEnteringBackForwardCacheForTesting): 15 * dom/ScriptExecutionContext.cpp: 16 (WebCore::ScriptExecutionContext::forEachActiveDOMObject const): 17 (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension): Deleted. 18 * dom/ScriptExecutionContext.h: 19 * history/BackForwardCache.cpp: 20 (WebCore::canCacheFrame): 21 * testing/Internals.cpp: 22 (WebCore::Internals::Internals): 23 (WebCore::Internals::preventDocumentFromEnteringBackForwardCache): 24 (WebCore::Internals::preventDocumentForEnteringBackForwardCache): Deleted. 25 * testing/Internals.h: 26 * testing/Internals.idl: 27 1 28 2019-11-26 Antti Koivisto <antti@apple.com> 2 29 -
trunk/Source/WebCore/dom/ActiveDOMObject.h
r252607 r252894 64 64 virtual const char* activeDOMObjectName() const = 0; 65 65 66 // These threefunctions must not have a side effect of creating or destroying66 // These functions must not have a side effect of creating or destroying 67 67 // any ActiveDOMObject. That means they must not result in calls to arbitrary JavaScript. 68 virtual bool shouldPreventEnteringBackForwardCache_DEPRECATED() const { return false; } // Please do not add new overrides for this function.69 68 virtual void suspend(ReasonForSuspension); 70 69 virtual void resume(); -
trunk/Source/WebCore/dom/Document.h
r252828 r252894 490 490 bool hasXMLDeclaration() const { return m_hasXMLDeclaration; } 491 491 492 bool shouldPreventEnteringBackForwardCacheForTesting() const { return m_shouldPreventEnteringBackForwardCacheForTesting; } 493 void preventEnteringBackForwardCacheForTesting() { m_shouldPreventEnteringBackForwardCacheForTesting = true; } 494 492 495 void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser 493 496 WEBCORE_EXPORT ExceptionOr<void> setXMLVersion(const String&); … … 2079 2082 bool m_isRunningUserScripts { false }; 2080 2083 bool m_mayBeDetachedFromFrame { true }; 2084 bool m_shouldPreventEnteringBackForwardCacheForTesting { false }; 2081 2085 #if ENABLE(APPLE_PAY) 2082 2086 bool m_hasStartedApplePaySession { false }; -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r251425 r252894 223 223 } 224 224 225 bool ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension(Vector<ActiveDOMObject*>* unsuspendableObjects)226 {227 checkConsistency();228 229 bool canSuspend = true;230 231 forEachActiveDOMObject([&](auto& activeDOMObject) {232 if (activeDOMObject.shouldPreventEnteringBackForwardCache_DEPRECATED()) {233 canSuspend = false;234 if (unsuspendableObjects)235 unsuspendableObjects->append(&activeDOMObject);236 else237 return ShouldContinue::No;238 }239 return ShouldContinue::Yes;240 });241 242 if (unsuspendableObjects) {243 // Remove activeDOMObjects that have been destroyed while we were iterating above.244 unsuspendableObjects->removeAllMatching([&](auto* activeDOMObject) {245 return !m_activeDOMObjects.contains(activeDOMObject);246 });247 }248 249 return canSuspend;250 }251 252 225 void ScriptExecutionContext::forEachActiveDOMObject(const Function<ShouldContinue(ActiveDOMObject&)>& apply) const 253 226 { 254 227 // It is not allowed to run arbitrary script or construct new ActiveDOMObjects while we are iterating over ActiveDOMObjects. 255 228 // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code 256 // canSuspendActiveDOMObjectsForDocumentSuspension() /suspend() / resume() / stop() functions so it will not happen!229 // suspend() / resume() / stop() functions so it will not happen! 257 230 ScriptDisallowedScope scriptDisallowedScope; 258 231 SetForScope<bool> activeDOMObjectAdditionForbiddenScope(m_activeDOMObjectAdditionForbidden, true); -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r252824 r252894 127 127 PublicURLManager& publicURLManager(); 128 128 129 // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.130 WEBCORE_EXPORT bool canSuspendActiveDOMObjectsForDocumentSuspension(Vector<ActiveDOMObject*>* unsuspendableObjects = nullptr);131 132 // Active objects can be asked to suspend even if canSuspendActiveDOMObjectsForDocumentSuspension() returns 'false' -133 // step-by-step JS debugging is one example.134 129 virtual void suspendActiveDOMObjects(ReasonForSuspension); 135 130 virtual void resumeActiveDOMObjects(ReasonForSuspension); -
trunk/Source/WebCore/history/BackForwardCache.cpp
r252301 r252894 97 97 } 98 98 99 if (frame.document()->shouldPreventEnteringBackForwardCacheForTesting()) { 100 PCLOG(" -Back/Forward caching is disabled for testing"); 101 return false; 102 } 103 99 104 if (!frame.document()->frame()) { 100 105 PCLOG(" -Document is detached from frame"); … … 159 164 PCLOG(" -DocumentLoader is in the middle of stopping"); 160 165 logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::documentLoaderStoppingKey()); 161 isCacheable = false;162 }163 164 Vector<ActiveDOMObject*> unsuspendableObjects;165 if (frame.document() && !frame.document()->canSuspendActiveDOMObjectsForDocumentSuspension(&unsuspendableObjects)) {166 PCLOG(" -The document cannot suspend its active DOM Objects");167 for (auto* activeDOMObject : unsuspendableObjects) {168 PCLOG(" - Unsuspendable: ", activeDOMObject->activeDOMObjectName());169 diagnosticLoggingClient.logDiagnosticMessage(DiagnosticLoggingKeys::unsuspendableDOMObjectKey(), activeDOMObject->activeDOMObjectName(), ShouldSample::No);170 UNUSED_PARAM(activeDOMObject);171 }172 logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::cannotSuspendActiveDOMObjectsKey());173 166 isCacheable = false; 174 167 } -
trunk/Source/WebCore/testing/Internals.cpp
r252820 r252894 581 581 #endif 582 582 583 m_unsuspendableActiveDOMObject = nullptr;584 585 583 #if PLATFORM(COCOA) && ENABLE(WEB_AUDIO) 586 584 AudioDestinationCocoa::createOverride = nullptr; … … 939 937 } 940 938 941 class UnsuspendableActiveDOMObject final : public ActiveDOMObject, public RefCounted<UnsuspendableActiveDOMObject> { 942 public: 943 static Ref<UnsuspendableActiveDOMObject> create(ScriptExecutionContext& context) { return adoptRef(*new UnsuspendableActiveDOMObject { &context }); } 944 945 private: 946 explicit UnsuspendableActiveDOMObject(ScriptExecutionContext* context) 947 : ActiveDOMObject(context) 948 { 949 suspendIfNeeded(); 950 } 951 952 bool shouldPreventEnteringBackForwardCache_DEPRECATED() const final { return true; } 953 const char* activeDOMObjectName() const { return "UnsuspendableActiveDOMObject"; } 954 }; 955 956 void Internals::preventDocumentForEnteringBackForwardCache() 957 { 958 if (auto* context = contextDocument()) 959 m_unsuspendableActiveDOMObject = UnsuspendableActiveDOMObject::create(*context); 939 void Internals::preventDocumentFromEnteringBackForwardCache() 940 { 941 if (auto* document = contextDocument()) 942 document->preventEnteringBackForwardCacheForTesting(); 960 943 } 961 944 -
trunk/Source/WebCore/testing/Internals.h
r252221 r252894 173 173 void clearBackForwardCache(); 174 174 unsigned backForwardCacheSize() const; 175 void preventDocumentF orEnteringBackForwardCache();175 void preventDocumentFromEnteringBackForwardCache(); 176 176 177 177 void disableTileSizeUpdateDelay(); … … 927 927 std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend; 928 928 RefPtr<CacheStorageConnection> m_cacheStorageConnection; 929 930 RefPtr<UnsuspendableActiveDOMObject> m_unsuspendableActiveDOMObject;931 929 }; 932 930 -
trunk/Source/WebCore/testing/Internals.idl
r252221 r252894 219 219 void clearBackForwardCache(); 220 220 unsigned long backForwardCacheSize(); 221 void preventDocumentF orEnteringBackForwardCache();221 void preventDocumentFromEnteringBackForwardCache(); 222 222 223 223 CSSStyleDeclaration computedStyleIncludingVisitedInfo(Element element); -
trunk/Source/WebKitLegacy/mac/ChangeLog
r252746 r252894 1 2019-11-26 Chris Dumez <cdumez@apple.com> 2 3 Drop ActiveDOMObject::shouldPreventEnteringBackForwardCache_DEPRECATED() 4 https://bugs.webkit.org/show_bug.cgi?id=204626 5 6 Reviewed by Ryosuke Niwa. 7 8 * WebView/WebFrame.mm: 9 (-[WebFrame _cacheabilityDictionary]): 10 1 11 2019-11-21 Daniel Bates <dabates@apple.com> 2 12 -
trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm
r251425 r252894 2060 2060 if (WebCore::DatabaseManager::singleton().hasOpenDatabases(*document)) 2061 2061 [result setObject:@YES forKey:WebFrameUsesDatabases]; 2062 if (!document->canSuspendActiveDOMObjectsForDocumentSuspension())2063 [result setObject:@YES forKey:WebFrameCanSuspendActiveDOMObjects];2064 2062 } 2065 2063
Note: See TracChangeset
for help on using the changeset viewer.