Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29838555: Issue 6808 - Default to top frame of page if parent can't be found (Closed)
Patch Set: Created July 25, 2018, 7:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
diff --git a/ext/background.js b/ext/background.js
index 31370f37dca8d1709896220ff9adca983ec1d7ae..c984c1c1f4f1177979ed1751a0d34ea9617d2c22 100644
--- a/ext/background.js
+++ b/ext/background.js
@@ -160,7 +160,11 @@
let frame = createFrame(tabId, frameId);
frame.url = new URL(url);
- let parentFrame = framesOfTabs.get(tabId).get(parentFrameId);
+ let frames = framesOfTabs.get(tabId);
+ let parentFrame = frames.get(parentFrameId);
+ if (!parentFrame && parentFrameId > 0)
+ parentFrame = frames.get(0);
+
if (parentFrame)
frame.parent = parentFrame;
}
@@ -528,7 +532,12 @@
frames.set(detail.frameId, frame);
if (detail.parentFrameId != -1)
+ {
frame.parent = frames.get(detail.parentFrameId);
+
+ if (!frame.parent && detail.parentFrameId != 0)
Sebastian Noack 2018/07/25 19:31:24 Why not falling back to the top-level frame here i
Sebastian Noack 2018/07/25 19:31:24 Nit: Above you check for parentFrameId > 0, here y
kzar 2018/07/25 20:28:25 Well, if the parentFrameId is -1 I figure it's the
kzar 2018/07/25 20:28:25 Done.
+ frame.parent = frames.get(0);
+ }
}
}
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld