Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 , m_mutationObserverTypes(0) | 425 , m_mutationObserverTypes(0) |
| 426 , m_visitedLinkState(VisitedLinkState::create(*this)) | 426 , m_visitedLinkState(VisitedLinkState::create(*this)) |
| 427 , m_visuallyOrdered(false) | 427 , m_visuallyOrdered(false) |
| 428 , m_readyState(Complete) | 428 , m_readyState(Complete) |
| 429 , m_parsingState(FinishedParsing) | 429 , m_parsingState(FinishedParsing) |
| 430 , m_gotoAnchorNeededAfterStylesheetsLoad(false) | 430 , m_gotoAnchorNeededAfterStylesheetsLoad(false) |
| 431 , m_containsValidityStyleRules(false) | 431 , m_containsValidityStyleRules(false) |
| 432 , m_containsPlugins(false) | 432 , m_containsPlugins(false) |
| 433 , m_updateFocusAppearanceSelectionBahavior(SelectionBehaviorOnFocus::Reset) | 433 , m_updateFocusAppearanceSelectionBahavior(SelectionBehaviorOnFocus::Reset) |
| 434 , m_ignoreDestructiveWriteCount(0) | 434 , m_ignoreDestructiveWriteCount(0) |
| 435 , m_throwOnDynamicMarkupInsertionCount(0) | |
| 435 , m_markers(new DocumentMarkerController(*this)) | 436 , m_markers(new DocumentMarkerController(*this)) |
| 436 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red) | 437 , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFi red) |
| 437 , m_cssTarget(nullptr) | 438 , m_cssTarget(nullptr) |
| 438 , m_loadEventProgress(LoadEventNotRun) | 439 , m_loadEventProgress(LoadEventNotRun) |
| 439 , m_startTime(currentTime()) | 440 , m_startTime(currentTime()) |
| 440 , m_scriptRunner(ScriptRunner::create(this)) | 441 , m_scriptRunner(ScriptRunner::create(this)) |
| 441 , m_xmlVersion("1.0") | 442 , m_xmlVersion("1.0") |
| 442 , m_xmlStandalone(StandaloneUnspecified) | 443 , m_xmlStandalone(StandaloneUnspecified) |
| 443 , m_hasXMLDeclaration(0) | 444 , m_hasXMLDeclaration(0) |
| 444 , m_designMode(false) | 445 , m_designMode(false) |
| (...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2263 // relationship. This ensures that we don't leave import loads in flight, | 2264 // relationship. This ensures that we don't leave import loads in flight, |
| 2264 // thinking they should have access to a valid frame when they don't. | 2265 // thinking they should have access to a valid frame when they don't. |
| 2265 if (m_importsController) { | 2266 if (m_importsController) { |
| 2266 m_importsController->dispose(); | 2267 m_importsController->dispose(); |
| 2267 setImportsController(nullptr); | 2268 setImportsController(nullptr); |
| 2268 } | 2269 } |
| 2269 | 2270 |
| 2270 m_timers.setTimerTaskRunner( | 2271 m_timers.setTimerTaskRunner( |
| 2271 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->cl one()); | 2272 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->cl one()); |
| 2272 | 2273 |
| 2274 // This is required, as our LocalFrame might delete itself as soon as it det aches | |
| 2275 // us. However, this violates Node::detachLayoutTree() semantics, as it's ne ver | |
| 2276 // possible to re-attach. Eventually Document::detachLayoutTree() should be renamed, | |
| 2277 // or this setting of the frame to 0 could be made explicit in each of the | |
| 2278 // callers of Document::detachLayoutTree(). | |
| 2279 m_frame = nullptr; | |
| 2280 | |
| 2273 if (m_mediaQueryMatcher) | 2281 if (m_mediaQueryMatcher) |
| 2274 m_mediaQueryMatcher->documentDetached(); | 2282 m_mediaQueryMatcher->documentDetached(); |
| 2275 | 2283 |
| 2276 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); | 2284 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); |
| 2277 | 2285 |
| 2278 // FIXME: Currently we call notifyContextDestroyed() only in | 2286 // FIXME: Currently we call notifyContextDestroyed() only in |
| 2279 // Document::detachLayoutTree(), which means that we don't call | 2287 // Document::detachLayoutTree(), which means that we don't call |
| 2280 // notifyContextDestroyed() for a document that doesn't get detached. | 2288 // notifyContextDestroyed() for a document that doesn't get detached. |
| 2281 // If such a document has any observer, the observer won't get | 2289 // If such a document has any observer, the observer won't get |
| 2282 // a contextDestroyed() notification. This can happen for a document | 2290 // a contextDestroyed() notification. This can happen for a document |
| 2283 // created by DOMImplementation::createDocument(). | 2291 // created by DOMImplementation::createDocument(). |
| 2284 ExecutionContext::notifyContextDestroyed(); | 2292 ExecutionContext::notifyContextDestroyed(); |
|
dominicc (has gone to gerrit)
2016/09/28 08:01:03
Just curious--why did you move this?
| |
| 2285 | |
| 2286 // This is required, as our LocalFrame might delete itself as soon as it det aches | |
| 2287 // us. However, this violates Node::detachLayoutTree() semantics, as it's ne ver | |
| 2288 // possible to re-attach. Eventually Document::detachLayoutTree() should be renamed, | |
| 2289 // or this setting of the frame to 0 could be made explicit in each of the | |
| 2290 // callers of Document::detachLayoutTree(). | |
| 2291 m_frame = nullptr; | |
| 2292 } | 2293 } |
| 2293 | 2294 |
| 2294 void Document::removeAllEventListeners() | 2295 void Document::removeAllEventListeners() |
| 2295 { | 2296 { |
| 2296 ContainerNode::removeAllEventListeners(); | 2297 ContainerNode::removeAllEventListeners(); |
| 2297 | 2298 |
| 2298 if (LocalDOMWindow* domWindow = this->domWindow()) | 2299 if (LocalDOMWindow* domWindow = this->domWindow()) |
| 2299 domWindow->removeAllEventListeners(); | 2300 domWindow->removeAllEventListeners(); |
| 2300 } | 2301 } |
| 2301 | 2302 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2386 if (importLoader()) { | 2387 if (importLoader()) { |
| 2387 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support open()."); | 2388 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support open()."); |
| 2388 return; | 2389 return; |
| 2389 } | 2390 } |
| 2390 | 2391 |
| 2391 if (!isHTMLDocument()) { | 2392 if (!isHTMLDocument()) { |
| 2392 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support open()."); | 2393 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support open()."); |
| 2393 return; | 2394 return; |
| 2394 } | 2395 } |
| 2395 | 2396 |
| 2397 if (m_throwOnDynamicMarkupInsertionCount) { | |
| 2398 exceptionState.throwDOMException(InvalidStateError, "Custom Element cons tructor should not use open()."); | |
| 2399 return; | |
| 2400 } | |
| 2401 | |
| 2396 if (enteredDocument) { | 2402 if (enteredDocument) { |
| 2397 if (!getSecurityOrigin()->canAccess(enteredDocument->getSecurityOrigin() )) { | 2403 if (!getSecurityOrigin()->canAccess(enteredDocument->getSecurityOrigin() )) { |
| 2398 exceptionState.throwSecurityError("Can only call open() on same-orig in documents."); | 2404 exceptionState.throwSecurityError("Can only call open() on same-orig in documents."); |
| 2399 return; | 2405 return; |
| 2400 } | 2406 } |
| 2401 setSecurityOrigin(enteredDocument->getSecurityOrigin()); | 2407 setSecurityOrigin(enteredDocument->getSecurityOrigin()); |
| 2402 setURL(enteredDocument->url()); | 2408 setURL(enteredDocument->url()); |
| 2403 m_cookieURL = enteredDocument->cookieURL(); | 2409 m_cookieURL = enteredDocument->cookieURL(); |
| 2404 } | 2410 } |
| 2405 | 2411 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2583 if (importLoader()) { | 2589 if (importLoader()) { |
| 2584 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support close()."); | 2590 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support close()."); |
| 2585 return; | 2591 return; |
| 2586 } | 2592 } |
| 2587 | 2593 |
| 2588 if (!isHTMLDocument()) { | 2594 if (!isHTMLDocument()) { |
| 2589 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support close()."); | 2595 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support close()."); |
| 2590 return; | 2596 return; |
| 2591 } | 2597 } |
| 2592 | 2598 |
| 2599 if (m_throwOnDynamicMarkupInsertionCount) { | |
| 2600 exceptionState.throwDOMException(InvalidStateError, "Custom Element cons tructor should not use close()."); | |
| 2601 return; | |
| 2602 } | |
| 2603 | |
| 2593 close(); | 2604 close(); |
| 2594 } | 2605 } |
| 2595 | 2606 |
| 2596 void Document::close() | 2607 void Document::close() |
| 2597 { | 2608 { |
| 2598 if (!scriptableDocumentParser() || !scriptableDocumentParser()->wasCreatedBy Script() || !scriptableDocumentParser()->isParsing()) | 2609 if (!scriptableDocumentParser() || !scriptableDocumentParser()->wasCreatedBy Script() || !scriptableDocumentParser()->isParsing()) |
| 2599 return; | 2610 return; |
| 2600 | 2611 |
| 2601 if (DocumentParser* parser = m_parser) | 2612 if (DocumentParser* parser = m_parser) |
| 2602 parser->finish(); | 2613 parser->finish(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2846 if (importLoader()) { | 2857 if (importLoader()) { |
| 2847 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support write()."); | 2858 exceptionState.throwDOMException(InvalidStateError, "Imported document d oesn't support write()."); |
| 2848 return; | 2859 return; |
| 2849 } | 2860 } |
| 2850 | 2861 |
| 2851 if (!isHTMLDocument()) { | 2862 if (!isHTMLDocument()) { |
| 2852 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support write()."); | 2863 exceptionState.throwDOMException(InvalidStateError, "Only HTML documents support write()."); |
| 2853 return; | 2864 return; |
| 2854 } | 2865 } |
| 2855 | 2866 |
| 2867 if (m_throwOnDynamicMarkupInsertionCount) { | |
| 2868 exceptionState.throwDOMException(InvalidStateError, "Custom Element cons tructor should not use write()."); | |
| 2869 return; | |
| 2870 } | |
| 2871 | |
| 2856 if (enteredDocument && !getSecurityOrigin()->canAccess(enteredDocument->getS ecurityOrigin())) { | 2872 if (enteredDocument && !getSecurityOrigin()->canAccess(enteredDocument->getS ecurityOrigin())) { |
| 2857 exceptionState.throwSecurityError("Can only call write() on same-origin documents."); | 2873 exceptionState.throwSecurityError("Can only call write() on same-origin documents."); |
| 2858 return; | 2874 return; |
| 2859 } | 2875 } |
| 2860 | 2876 |
| 2861 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth); | 2877 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth); |
| 2862 | 2878 |
| 2863 m_writeRecursionIsTooDeep = (m_writeRecursionDepth > 1) && m_writeRecursionI sTooDeep; | 2879 m_writeRecursionIsTooDeep = (m_writeRecursionDepth > 1) && m_writeRecursionI sTooDeep; |
| 2864 m_writeRecursionIsTooDeep = (m_writeRecursionDepth > cMaxWriteRecursionDepth ) || m_writeRecursionIsTooDeep; | 2880 m_writeRecursionIsTooDeep = (m_writeRecursionDepth > cMaxWriteRecursionDepth ) || m_writeRecursionIsTooDeep; |
| 2865 | 2881 |
| (...skipping 3219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6085 } | 6101 } |
| 6086 | 6102 |
| 6087 void showLiveDocumentInstances() | 6103 void showLiveDocumentInstances() |
| 6088 { | 6104 { |
| 6089 WeakDocumentSet& set = liveDocumentSet(); | 6105 WeakDocumentSet& set = liveDocumentSet(); |
| 6090 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6106 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6091 for (Document* document : set) | 6107 for (Document* document : set) |
| 6092 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); | 6108 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); |
| 6093 } | 6109 } |
| 6094 #endif | 6110 #endif |
| OLD | NEW |