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

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

Issue 1161983005: FrameLoader: Prevent reentrancy on dispatchDidClearWindowObjectInMainWorld. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 FrameLoader::FrameLoader(LocalFrame* frame) 111 FrameLoader::FrameLoader(LocalFrame* frame)
112 : m_frame(frame) 112 : m_frame(frame)
113 , m_progressTracker(ProgressTracker::create(frame)) 113 , m_progressTracker(ProgressTracker::create(frame))
114 , m_loadType(FrameLoadTypeStandard) 114 , m_loadType(FrameLoadTypeStandard)
115 , m_inStopAllLoaders(false) 115 , m_inStopAllLoaders(false)
116 , m_checkTimer(this, &FrameLoader::checkTimerFired) 116 , m_checkTimer(this, &FrameLoader::checkTimerFired)
117 , m_didAccessInitialDocument(false) 117 , m_didAccessInitialDocument(false)
118 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) 118 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired)
119 , m_forcedSandboxFlags(SandboxNone) 119 , m_forcedSandboxFlags(SandboxNone)
120 , m_dispatchingDidClearWindowObjectInMainWorld(false)
120 { 121 {
121 } 122 }
122 123
123 FrameLoader::~FrameLoader() 124 FrameLoader::~FrameLoader()
124 { 125 {
125 // Verify that this FrameLoader has been detached. 126 // Verify that this FrameLoader has been detached.
126 ASSERT(!m_progressTracker); 127 ASSERT(!m_progressTracker);
127 } 128 }
128 129
129 DEFINE_TRACE(FrameLoader) 130 DEFINE_TRACE(FrameLoader)
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 // We just cleared the document, not the entire window object, but for the 1369 // We just cleared the document, not the entire window object, but for the
1369 // embedder that's close enough. 1370 // embedder that's close enough.
1370 client()->dispatchDidClearWindowObjectInMainWorld(); 1371 client()->dispatchDidClearWindowObjectInMainWorld();
1371 } 1372 }
1372 1373
1373 void FrameLoader::dispatchDidClearWindowObjectInMainWorld() 1374 void FrameLoader::dispatchDidClearWindowObjectInMainWorld()
1374 { 1375 {
1375 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1376 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1376 return; 1377 return;
1377 1378
1379 if (m_dispatchingDidClearWindowObjectInMainWorld)
1380 return;
1381 m_dispatchingDidClearWindowObjectInMainWorld = true;
Nate Chapin 2015/05/29 21:28:00 TemporaryChange<bool> inDidClearWindowObject(m_dis
tommycli 2015/05/29 21:36:44 Done.
1378 client()->dispatchDidClearWindowObjectInMainWorld(); 1382 client()->dispatchDidClearWindowObjectInMainWorld();
1383 m_dispatchingDidClearWindowObjectInMainWorld = false;
1379 } 1384 }
1380 1385
1381 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1386 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1382 { 1387 {
1383 SandboxFlags flags = m_forcedSandboxFlags; 1388 SandboxFlags flags = m_forcedSandboxFlags;
1384 if (FrameOwner* frameOwner = m_frame->owner()) 1389 if (FrameOwner* frameOwner = m_frame->owner())
1385 flags |= frameOwner->sandboxFlags(); 1390 flags |= frameOwner->sandboxFlags();
1386 // Frames need to inherit the sandbox flags of their parent frame. 1391 // Frames need to inherit the sandbox flags of their parent frame.
1387 if (Frame* parentFrame = m_frame->tree().parent()) 1392 if (Frame* parentFrame = m_frame->tree().parent())
1388 flags |= parentFrame->securityContext()->sandboxFlags(); 1393 flags |= parentFrame->securityContext()->sandboxFlags();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 // FIXME: We need a way to propagate insecure requests policy flags to 1434 // FIXME: We need a way to propagate insecure requests policy flags to
1430 // out-of-process frames. For now, we'll always use default behavior. 1435 // out-of-process frames. For now, we'll always use default behavior.
1431 if (!parentFrame->isLocalFrame()) 1436 if (!parentFrame->isLocalFrame())
1432 return nullptr; 1437 return nullptr;
1433 1438
1434 ASSERT(toLocalFrame(parentFrame)->document()); 1439 ASSERT(toLocalFrame(parentFrame)->document());
1435 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1440 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1436 } 1441 }
1437 1442
1438 } // namespace blink 1443 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698