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

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
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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1365
1366 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame); 1366 InspectorInstrumentation::didClearDocumentOfWindowObject(m_frame);
1367 1367
1368 // We just cleared the document, not the entire window object, but for the 1368 // We just cleared the document, not the entire window object, but for the
1369 // embedder that's close enough. 1369 // embedder that's close enough.
1370 client()->dispatchDidClearWindowObjectInMainWorld(); 1370 client()->dispatchDidClearWindowObjectInMainWorld();
1371 } 1371 }
1372 1372
1373 void FrameLoader::dispatchDidClearWindowObjectInMainWorld() 1373 void FrameLoader::dispatchDidClearWindowObjectInMainWorld()
1374 { 1374 {
1375 if (m_dispatchingDidClearWindowObjectInMainWorld)
chrishtr 2015/05/28 22:09:25 I think you should do this instead: if (m_dispatc
tommycli 2015/05/28 22:19:36 Done.
1376 return;
1377 m_dispatchingDidClearWindowObjectInMainWorld = true;
1378
1375 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1379 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1376 return; 1380 return;
1377 1381
1378 client()->dispatchDidClearWindowObjectInMainWorld(); 1382 client()->dispatchDidClearWindowObjectInMainWorld();
1383
1384 m_dispatchingDidClearWindowObjectInMainWorld = false;
1379 } 1385 }
1380 1386
1381 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1387 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1382 { 1388 {
1383 SandboxFlags flags = m_forcedSandboxFlags; 1389 SandboxFlags flags = m_forcedSandboxFlags;
1384 if (FrameOwner* frameOwner = m_frame->owner()) 1390 if (FrameOwner* frameOwner = m_frame->owner())
1385 flags |= frameOwner->sandboxFlags(); 1391 flags |= frameOwner->sandboxFlags();
1386 // Frames need to inherit the sandbox flags of their parent frame. 1392 // Frames need to inherit the sandbox flags of their parent frame.
1387 if (Frame* parentFrame = m_frame->tree().parent()) 1393 if (Frame* parentFrame = m_frame->tree().parent())
1388 flags |= parentFrame->securityContext()->sandboxFlags(); 1394 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 1435 // 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. 1436 // out-of-process frames. For now, we'll always use default behavior.
1431 if (!parentFrame->isLocalFrame()) 1437 if (!parentFrame->isLocalFrame())
1432 return nullptr; 1438 return nullptr;
1433 1439
1434 ASSERT(toLocalFrame(parentFrame)->document()); 1440 ASSERT(toLocalFrame(parentFrame)->document());
1435 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1441 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1436 } 1442 }
1437 1443
1438 } // namespace blink 1444 } // namespace blink
OLDNEW
« Source/core/loader/FrameLoader.h ('K') | « Source/core/loader/FrameLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698