Bug 91516. Safeguard view traversal in nsObjectFrame so it doesn't walk out the current document. r=peterl,sr=attinasi
This commit is contained in:
@@ -1508,11 +1508,17 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P
|
|||||||
// it may need to be corrected, like after scrolling
|
// it may need to be corrected, like after scrolling
|
||||||
if (aWindowless && parentWithView) {
|
if (aWindowless && parentWithView) {
|
||||||
nsPoint correction(0,0);
|
nsPoint correction(0,0);
|
||||||
|
nsCOMPtr<nsIViewManager> parentVM;
|
||||||
|
parentWithView->GetViewManager(*getter_AddRefs(parentVM));
|
||||||
|
|
||||||
// Walk up all the views and add up their positions. This will give us our
|
// Walk up all the views and add up their positions. This will give us our
|
||||||
// absolute position which is what we want to give the plugin
|
// absolute position which is what we want to give the plugin
|
||||||
nsIView* theView = parentWithView;
|
nsIView* theView = parentWithView;
|
||||||
while (theView) {
|
while (theView) {
|
||||||
|
nsCOMPtr<nsIViewManager> vm;
|
||||||
|
theView->GetViewManager(*getter_AddRefs(vm));
|
||||||
|
if (vm != parentVM)
|
||||||
|
break;
|
||||||
|
|
||||||
theView->GetPosition(&correction.x, &correction.y);
|
theView->GetPosition(&correction.x, &correction.y);
|
||||||
origin += correction;
|
origin += correction;
|
||||||
|
|||||||
@@ -1508,11 +1508,17 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P
|
|||||||
// it may need to be corrected, like after scrolling
|
// it may need to be corrected, like after scrolling
|
||||||
if (aWindowless && parentWithView) {
|
if (aWindowless && parentWithView) {
|
||||||
nsPoint correction(0,0);
|
nsPoint correction(0,0);
|
||||||
|
nsCOMPtr<nsIViewManager> parentVM;
|
||||||
|
parentWithView->GetViewManager(*getter_AddRefs(parentVM));
|
||||||
|
|
||||||
// Walk up all the views and add up their positions. This will give us our
|
// Walk up all the views and add up their positions. This will give us our
|
||||||
// absolute position which is what we want to give the plugin
|
// absolute position which is what we want to give the plugin
|
||||||
nsIView* theView = parentWithView;
|
nsIView* theView = parentWithView;
|
||||||
while (theView) {
|
while (theView) {
|
||||||
|
nsCOMPtr<nsIViewManager> vm;
|
||||||
|
theView->GetViewManager(*getter_AddRefs(vm));
|
||||||
|
if (vm != parentVM)
|
||||||
|
break;
|
||||||
|
|
||||||
theView->GetPosition(&correction.x, &correction.y);
|
theView->GetPosition(&correction.x, &correction.y);
|
||||||
origin += correction;
|
origin += correction;
|
||||||
|
|||||||
Reference in New Issue
Block a user