OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 { | 199 { |
200 if (m_documentLoader) | 200 if (m_documentLoader) |
201 m_documentLoader->setDefersLoading(defers); | 201 m_documentLoader->setDefersLoading(defers); |
202 if (m_provisionalDocumentLoader) | 202 if (m_provisionalDocumentLoader) |
203 m_provisionalDocumentLoader->setDefersLoading(defers); | 203 m_provisionalDocumentLoader->setDefersLoading(defers); |
204 if (m_policyDocumentLoader) | 204 if (m_policyDocumentLoader) |
205 m_policyDocumentLoader->setDefersLoading(defers); | 205 m_policyDocumentLoader->setDefersLoading(defers); |
206 history()->setDefersLoading(defers); | 206 history()->setDefersLoading(defers); |
207 | 207 |
208 if (!defers) { | 208 if (!defers) { |
209 m_frame->navigationScheduler()->startTimer(); | 209 m_frame->navigationScheduler().startTimer(); |
210 startCheckCompleteTimer(); | 210 startCheckCompleteTimer(); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 void FrameLoader::stopLoading() | 214 void FrameLoader::stopLoading() |
215 { | 215 { |
216 m_isComplete = true; // to avoid calling completed() in finishedParsing() | 216 m_isComplete = true; // to avoid calling completed() in finishedParsing() |
217 | 217 |
218 if (m_frame->document() && m_frame->document()->parsing()) { | 218 if (m_frame->document() && m_frame->document()->parsing()) { |
219 finishedParsing(); | 219 finishedParsing(); |
220 m_frame->document()->setParsing(false); | 220 m_frame->document()->setParsing(false); |
221 } | 221 } |
222 | 222 |
223 if (Document* doc = m_frame->document()) { | 223 if (Document* doc = m_frame->document()) { |
224 // FIXME: HTML5 doesn't tell us to set the state to complete when aborti
ng, but we do anyway to match legacy behavior. | 224 // FIXME: HTML5 doesn't tell us to set the state to complete when aborti
ng, but we do anyway to match legacy behavior. |
225 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537 | 225 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537 |
226 doc->setReadyState(Document::Complete); | 226 doc->setReadyState(Document::Complete); |
227 | 227 |
228 // FIXME: Should the DatabaseManager watch for something like ActiveDOMO
bject::stop() rather than being special-cased here? | 228 // FIXME: Should the DatabaseManager watch for something like ActiveDOMO
bject::stop() rather than being special-cased here? |
229 DatabaseManager::manager().stopDatabases(doc, 0); | 229 DatabaseManager::manager().stopDatabases(doc, 0); |
230 } | 230 } |
231 | 231 |
232 // FIXME: This will cancel redirection timer, which really needs to be resta
rted when restoring the frame from b/f cache. | 232 // FIXME: This will cancel redirection timer, which really needs to be resta
rted when restoring the frame from b/f cache. |
233 m_frame->navigationScheduler()->cancel(); | 233 m_frame->navigationScheduler().cancel(); |
234 } | 234 } |
235 | 235 |
236 bool FrameLoader::closeURL() | 236 bool FrameLoader::closeURL() |
237 { | 237 { |
238 history()->saveDocumentAndScrollState(); | 238 history()->saveDocumentAndScrollState(); |
239 | 239 |
240 // Should only send the pagehide event here if the current document exists. | 240 // Should only send the pagehide event here if the current document exists. |
241 if (m_frame->document()) | 241 if (m_frame->document()) |
242 m_frame->document()->dispatchUnloadEvents(); | 242 m_frame->document()->dispatchUnloadEvents(); |
243 stopLoading(); | 243 stopLoading(); |
244 | 244 |
245 m_frame->editor().clearUndoRedoOperations(); | 245 m_frame->editor().clearUndoRedoOperations(); |
246 return true; | 246 return true; |
247 } | 247 } |
248 | 248 |
249 void FrameLoader::didExplicitOpen() | 249 void FrameLoader::didExplicitOpen() |
250 { | 250 { |
251 m_isComplete = false; | 251 m_isComplete = false; |
252 | 252 |
253 // Calling document.open counts as committing the first real document load. | 253 // Calling document.open counts as committing the first real document load. |
254 if (!m_stateMachine.committedFirstRealDocumentLoad()) | 254 if (!m_stateMachine.committedFirstRealDocumentLoad()) |
255 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); | 255 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); |
256 | 256 |
257 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing
away results | 257 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing
away results |
258 // from a subsequent window.document.open / window.document.write call. | 258 // from a subsequent window.document.open / window.document.write call. |
259 // Canceling redirection here works for all cases because document.open | 259 // Canceling redirection here works for all cases because document.open |
260 // implicitly precedes document.write. | 260 // implicitly precedes document.write. |
261 m_frame->navigationScheduler()->cancel(); | 261 m_frame->navigationScheduler().cancel(); |
262 } | 262 } |
263 | 263 |
264 void FrameLoader::clear(ClearOptions options) | 264 void FrameLoader::clear(ClearOptions options) |
265 { | 265 { |
266 if (m_stateMachine.creatingInitialEmptyDocument()) | 266 if (m_stateMachine.creatingInitialEmptyDocument()) |
267 return; | 267 return; |
268 | 268 |
269 m_frame->editor().clear(); | 269 m_frame->editor().clear(); |
270 m_frame->document()->cancelParsing(); | 270 m_frame->document()->cancelParsing(); |
271 m_frame->document()->prepareForDestruction(); | 271 m_frame->document()->prepareForDestruction(); |
(...skipping 17 matching lines...) Expand all Loading... |
289 m_frame->setDOMWindow(0); | 289 m_frame->setDOMWindow(0); |
290 } | 290 } |
291 | 291 |
292 m_containsPlugins = false; | 292 m_containsPlugins = false; |
293 | 293 |
294 if (options & ClearScriptObjects) | 294 if (options & ClearScriptObjects) |
295 m_frame->script()->clearScriptObjects(); | 295 m_frame->script()->clearScriptObjects(); |
296 | 296 |
297 m_frame->script()->enableEval(); | 297 m_frame->script()->enableEval(); |
298 | 298 |
299 m_frame->navigationScheduler()->clear(); | 299 m_frame->navigationScheduler().clear(); |
300 | 300 |
301 m_checkTimer.stop(); | 301 m_checkTimer.stop(); |
302 m_shouldCallCheckCompleted = false; | 302 m_shouldCallCheckCompleted = false; |
303 | 303 |
304 if (m_stateMachine.isDisplayingInitialEmptyDocument()) | 304 if (m_stateMachine.isDisplayingInitialEmptyDocument()) |
305 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); | 305 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); |
306 } | 306 } |
307 | 307 |
308 void FrameLoader::receivedFirstData() | 308 void FrameLoader::receivedFirstData() |
309 { | 309 { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 // Any frame that hasn't completed yet? | 433 // Any frame that hasn't completed yet? |
434 if (!allChildrenAreComplete()) | 434 if (!allChildrenAreComplete()) |
435 return; | 435 return; |
436 | 436 |
437 // OK, completed. | 437 // OK, completed. |
438 m_isComplete = true; | 438 m_isComplete = true; |
439 m_frame->document()->setReadyState(Document::Complete); | 439 m_frame->document()->setReadyState(Document::Complete); |
440 if (m_frame->document()->loadEventStillNeeded()) | 440 if (m_frame->document()->loadEventStillNeeded()) |
441 m_frame->document()->implicitClose(); | 441 m_frame->document()->implicitClose(); |
442 | 442 |
443 m_frame->navigationScheduler()->startTimer(); | 443 m_frame->navigationScheduler().startTimer(); |
444 | 444 |
445 completed(); | 445 completed(); |
446 if (m_frame->page()) | 446 if (m_frame->page()) |
447 checkLoadComplete(); | 447 checkLoadComplete(); |
448 | 448 |
449 if (m_frame->view()) | 449 if (m_frame->view()) |
450 m_frame->view()->handleLoadCompleted(); | 450 m_frame->view()->handleLoadCompleted(); |
451 } | 451 } |
452 | 452 |
453 void FrameLoader::checkTimerFired(Timer<FrameLoader>*) | 453 void FrameLoader::checkTimerFired(Timer<FrameLoader>*) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 checkCompleted(); | 598 checkCompleted(); |
599 | 599 |
600 m_frame->document()->statePopped(stateObject ? stateObject : SerializedScrip
tValue::nullValue()); | 600 m_frame->document()->statePopped(stateObject ? stateObject : SerializedScrip
tValue::nullValue()); |
601 } | 601 } |
602 | 602 |
603 void FrameLoader::completed() | 603 void FrameLoader::completed() |
604 { | 604 { |
605 RefPtr<Frame> protect(m_frame); | 605 RefPtr<Frame> protect(m_frame); |
606 | 606 |
607 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant;
descendant = descendant->tree().traverseNext(m_frame)) | 607 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant;
descendant = descendant->tree().traverseNext(m_frame)) |
608 descendant->navigationScheduler()->startTimer(); | 608 descendant->navigationScheduler().startTimer(); |
609 | 609 |
610 if (Frame* parent = m_frame->tree().parent()) | 610 if (Frame* parent = m_frame->tree().parent()) |
611 parent->loader()->checkCompleted(); | 611 parent->loader()->checkCompleted(); |
612 | 612 |
613 if (m_frame->view()) | 613 if (m_frame->view()) |
614 m_frame->view()->maintainScrollPositionAtAnchor(0); | 614 m_frame->view()->maintainScrollPositionAtAnchor(0); |
615 } | 615 } |
616 | 616 |
617 void FrameLoader::started() | 617 void FrameLoader::started() |
618 { | 618 { |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 m_documentLoader->detachFromFrame(); | 903 m_documentLoader->detachFromFrame(); |
904 m_documentLoader = m_provisionalDocumentLoader.release(); | 904 m_documentLoader = m_provisionalDocumentLoader.release(); |
905 m_state = FrameStateCommittedPage; | 905 m_state = FrameStateCommittedPage; |
906 | 906 |
907 if (isLoadingMainFrame()) | 907 if (isLoadingMainFrame()) |
908 m_frame->page()->chrome().client().needTouchEvents(false); | 908 m_frame->page()->chrome().client().needTouchEvents(false); |
909 | 909 |
910 history()->updateForCommit(); | 910 history()->updateForCommit(); |
911 m_client->transitionToCommittedForNewPage(); | 911 m_client->transitionToCommittedForNewPage(); |
912 | 912 |
913 m_frame->navigationScheduler()->cancel(); | 913 m_frame->navigationScheduler().cancel(); |
914 m_frame->editor().clearLastEditCommand(); | 914 m_frame->editor().clearLastEditCommand(); |
915 | 915 |
916 // If we are still in the process of initializing an empty document then | 916 // If we are still in the process of initializing an empty document then |
917 // its frame is not in a consistent state for rendering, so avoid setJSStatu
sBarText | 917 // its frame is not in a consistent state for rendering, so avoid setJSStatu
sBarText |
918 // since it may cause clients to attempt to render the frame. | 918 // since it may cause clients to attempt to render the frame. |
919 if (!m_stateMachine.creatingInitialEmptyDocument()) { | 919 if (!m_stateMachine.creatingInitialEmptyDocument()) { |
920 DOMWindow* window = m_frame->domWindow(); | 920 DOMWindow* window = m_frame->domWindow(); |
921 window->setStatus(String()); | 921 window->setStatus(String()); |
922 window->setDefaultStatus(String()); | 922 window->setDefaultStatus(String()); |
923 } | 923 } |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 // A new navigation is in progress, so don't clear the history's provisional
item. | 1366 // A new navigation is in progress, so don't clear the history's provisional
item. |
1367 stopAllLoaders(); | 1367 stopAllLoaders(); |
1368 | 1368 |
1369 // <rdar://problem/6250856> - In certain circumstances on pages with multipl
e frames, stopAllLoaders() | 1369 // <rdar://problem/6250856> - In certain circumstances on pages with multipl
e frames, stopAllLoaders() |
1370 // might detach the current FrameLoader, in which case we should bail on thi
s newly defunct load. | 1370 // might detach the current FrameLoader, in which case we should bail on thi
s newly defunct load. |
1371 if (!m_frame->page() || !m_policyDocumentLoader) | 1371 if (!m_frame->page() || !m_policyDocumentLoader) |
1372 return; | 1372 return; |
1373 | 1373 |
1374 if (isLoadingMainFrame()) | 1374 if (isLoadingMainFrame()) |
1375 m_frame->page()->inspectorController().resume(); | 1375 m_frame->page()->inspectorController().resume(); |
1376 m_frame->navigationScheduler()->cancel(); | 1376 m_frame->navigationScheduler().cancel(); |
1377 | 1377 |
1378 m_provisionalDocumentLoader = m_policyDocumentLoader.release(); | 1378 m_provisionalDocumentLoader = m_policyDocumentLoader.release(); |
1379 m_loadType = type; | 1379 m_loadType = type; |
1380 m_state = FrameStateProvisional; | 1380 m_state = FrameStateProvisional; |
1381 | 1381 |
1382 if (formState) | 1382 if (formState) |
1383 m_client->dispatchWillSubmitForm(formState); | 1383 m_client->dispatchWillSubmitForm(formState); |
1384 | 1384 |
1385 m_progressTracker->progressStarted(); | 1385 m_progressTracker->progressStarted(); |
1386 if (m_provisionalDocumentLoader->isClientRedirect()) | 1386 if (m_provisionalDocumentLoader->isClientRedirect()) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 { | 1600 { |
1601 SandboxFlags flags = m_forcedSandboxFlags; | 1601 SandboxFlags flags = m_forcedSandboxFlags; |
1602 if (Frame* parentFrame = m_frame->tree().parent()) | 1602 if (Frame* parentFrame = m_frame->tree().parent()) |
1603 flags |= parentFrame->document()->sandboxFlags(); | 1603 flags |= parentFrame->document()->sandboxFlags(); |
1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) | 1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) |
1605 flags |= ownerElement->sandboxFlags(); | 1605 flags |= ownerElement->sandboxFlags(); |
1606 return flags; | 1606 return flags; |
1607 } | 1607 } |
1608 | 1608 |
1609 } // namespace WebCore | 1609 } // namespace WebCore |
OLD | NEW |