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: Consistent > 0 Created July 25, 2018, 8:27 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..11132924c9127e4de30e24d4c7972a2413b3f979 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)
+ 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