Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 1825873002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "core/page/ChromeClient.h" 76 #include "core/page/ChromeClient.h"
77 #include "core/page/CreateWindow.h" 77 #include "core/page/CreateWindow.h"
78 #include "core/page/FrameTree.h" 78 #include "core/page/FrameTree.h"
79 #include "core/page/Page.h" 79 #include "core/page/Page.h"
80 #include "core/page/WindowFeatures.h" 80 #include "core/page/WindowFeatures.h"
81 #include "core/page/scrolling/ScrollingCoordinator.h" 81 #include "core/page/scrolling/ScrollingCoordinator.h"
82 #include "core/svg/graphics/SVGImage.h" 82 #include "core/svg/graphics/SVGImage.h"
83 #include "core/xml/parser/XMLDocumentParser.h" 83 #include "core/xml/parser/XMLDocumentParser.h"
84 #include "platform/Logging.h" 84 #include "platform/Logging.h"
85 #include "platform/PluginScriptForbiddenScope.h" 85 #include "platform/PluginScriptForbiddenScope.h"
86 #include "platform/ScriptForbiddenScope.h"
86 #include "platform/UserGestureIndicator.h" 87 #include "platform/UserGestureIndicator.h"
87 #include "platform/network/HTTPParsers.h" 88 #include "platform/network/HTTPParsers.h"
88 #include "platform/network/ResourceRequest.h" 89 #include "platform/network/ResourceRequest.h"
89 #include "platform/scroll/ScrollAnimatorBase.h" 90 #include "platform/scroll/ScrollAnimatorBase.h"
90 #include "platform/weborigin/SecurityOrigin.h" 91 #include "platform/weborigin/SecurityOrigin.h"
91 #include "platform/weborigin/SecurityPolicy.h" 92 #include "platform/weborigin/SecurityPolicy.h"
92 #include "public/platform/WebURLRequest.h" 93 #include "public/platform/WebURLRequest.h"
93 #include "wtf/TemporaryChange.h" 94 #include "wtf/TemporaryChange.h"
94 #include "wtf/text/CString.h" 95 #include "wtf/text/CString.h"
95 #include "wtf/text/WTFString.h" 96 #include "wtf/text/WTFString.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 if (m_stateMachine.creatingInitialEmptyDocument()) 486 if (m_stateMachine.creatingInitialEmptyDocument())
486 return; 487 return;
487 488
488 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves 489 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves
489 // because doing so will cause us to re-enter the destructor when protector goes out of scope. 490 // because doing so will cause us to re-enter the destructor when protector goes out of scope.
490 // Null-checking the FrameView indicates whether or not we're in the destruc tor. 491 // Null-checking the FrameView indicates whether or not we're in the destruc tor.
491 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); 492 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr);
492 493
493 m_progressTracker->finishedParsing(); 494 m_progressTracker->finishedParsing();
494 495
496 if (client()) {
497 ScriptForbiddenScope forbidScripts;
498 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true);
499 }
500
495 if (client()) 501 if (client())
496 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true); 502 client()->runScriptsAtDocumentReady();
497 503
498 checkCompleted(); 504 checkCompleted();
499 505
500 if (!m_frame->view()) 506 if (!m_frame->view())
501 return; // We are being destroyed by something checkCompleted called. 507 return; // We are being destroyed by something checkCompleted called.
502 508
503 // Check if the scrollbars are really needed for the content. 509 // Check if the scrollbars are really needed for the content.
504 // If not, remove them, relayout, and repaint. 510 // If not, remove them, relayout, and repaint.
505 m_frame->view()->restoreScrollbar(); 511 m_frame->view()->restoreScrollbar();
506 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); 512 processFragment(m_frame->document()->url(), NavigationToDifferentDocument);
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 if (!url.isAboutSrcdocURL()) 1494 if (!url.isAboutSrcdocURL())
1489 return false; 1495 return false;
1490 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 1496 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
1491 if (!isHTMLIFrameElement(ownerElement)) 1497 if (!isHTMLIFrameElement(ownerElement))
1492 return false; 1498 return false;
1493 return ownerElement->fastHasAttribute(srcdocAttr); 1499 return ownerElement->fastHasAttribute(srcdocAttr);
1494 } 1500 }
1495 1501
1496 void FrameLoader::dispatchDocumentElementAvailable() 1502 void FrameLoader::dispatchDocumentElementAvailable()
1497 { 1503 {
1504 ScriptForbiddenScope forbidScripts;
1498 client()->documentElementAvailable(); 1505 client()->documentElementAvailable();
1499 } 1506 }
1500 1507
1508 void FrameLoader::runScriptsAtDocumentElementAvailable()
1509 {
1510 client()->runScriptsAtDocumentElementAvailable();
1511 // The frame might be detached at this point.
1512 }
1513
1501 void FrameLoader::dispatchDidClearDocumentOfWindowObject() 1514 void FrameLoader::dispatchDidClearDocumentOfWindowObject()
1502 { 1515 {
1503 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1516 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1504 return; 1517 return;
1505 1518
1506 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame); 1519 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame);
1507 1520
1508 if (m_dispatchingDidClearWindowObjectInMainWorld) 1521 if (m_dispatchingDidClearWindowObjectInMainWorld)
1509 return; 1522 return;
1510 TemporaryChange<bool> 1523 TemporaryChange<bool>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 // FIXME: We need a way to propagate insecure requests policy flags to 1584 // FIXME: We need a way to propagate insecure requests policy flags to
1572 // out-of-process frames. For now, we'll always use default behavior. 1585 // out-of-process frames. For now, we'll always use default behavior.
1573 if (!parentFrame->isLocalFrame()) 1586 if (!parentFrame->isLocalFrame())
1574 return nullptr; 1587 return nullptr;
1575 1588
1576 ASSERT(toLocalFrame(parentFrame)->document()); 1589 ASSERT(toLocalFrame(parentFrame)->document());
1577 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1590 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1578 } 1591 }
1579 1592
1580 } // namespace blink 1593 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.h ('k') | third_party/WebKit/Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698