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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2264723002: Fix int overflow in window.moveBy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 3 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 | « no previous file | third_party/WebKit/Source/platform/geometry/IntPoint.h » ('j') | 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, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void LocalDOMWindow::moveBy(int x, int y) const 1226 void LocalDOMWindow::moveBy(int x, int y) const
1227 { 1227 {
1228 if (!frame() || !frame()->isMainFrame()) 1228 if (!frame() || !frame()->isMainFrame())
1229 return; 1229 return;
1230 1230
1231 FrameHost* host = frame()->host(); 1231 FrameHost* host = frame()->host();
1232 if (!host) 1232 if (!host)
1233 return; 1233 return;
1234 1234
1235 IntRect windowRect = host->chromeClient().rootWindowRect(); 1235 IntRect windowRect = host->chromeClient().rootWindowRect();
1236 windowRect.move(x, y); 1236 windowRect.saturatedMove(x, y);
1237 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...) 1237 // Security check (the spec talks about UniversalBrowserWrite to disable thi s check...)
1238 host->chromeClient().setWindowRectWithAdjustment(windowRect, *frame()); 1238 host->chromeClient().setWindowRectWithAdjustment(windowRect, *frame());
1239 } 1239 }
1240 1240
1241 void LocalDOMWindow::moveTo(int x, int y) const 1241 void LocalDOMWindow::moveTo(int x, int y) const
1242 { 1242 {
1243 if (!frame() || !frame()->isMainFrame()) 1243 if (!frame() || !frame()->isMainFrame())
1244 return; 1244 return;
1245 1245
1246 FrameHost* host = frame()->host(); 1246 FrameHost* host = frame()->host();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 { 1542 {
1543 // If the LocalDOMWindow still has a frame reference, that frame must point 1543 // If the LocalDOMWindow still has a frame reference, that frame must point
1544 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1544 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1545 // where script execution leaks between different LocalDOMWindows. 1545 // where script execution leaks between different LocalDOMWindows.
1546 if (m_frameObserver->frame()) 1546 if (m_frameObserver->frame())
1547 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1547 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1548 return m_frameObserver->frame(); 1548 return m_frameObserver->frame();
1549 } 1549 }
1550 1550
1551 } // namespace blink 1551 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/geometry/IntPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698