From 8eda31fb236b9506d577a25908d4e5334d3289d5 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 5 Jun 2015 07:07:02 +0100 Subject: Global marks; global marks are always recorded for the top frame only. With global marks, we may later create a new tab when the mark is used. When doing so, we should always be using the URL and scroll position of the top frame within the tab. For example, if a global mark is created from within the Hangouts frame of Google's Inbox and the mark is later used, then we should create a new tab for Inbox's URL and scroll position, not for the Hangout's URL and scroll position. --- content_scripts/marks.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'content_scripts/marks.coffee') diff --git a/content_scripts/marks.coffee b/content_scripts/marks.coffee index 3b5814da..f569e1ea 100644 --- a/content_scripts/marks.coffee +++ b/content_scripts/marks.coffee @@ -36,11 +36,14 @@ Marks = # characters. @exit => if event.shiftKey + # We record the current scroll position, but only if this is the top frame within the tab. + # Otherwise, we'll fetch the scroll position of the top frame from the background page later. + [ scrollX, scrollY ] = [ window.scrollX, window.scrollY ] if DomUtils.isTopFrame() chrome.runtime.sendMessage handler: 'createMark' markName: keyChar - scrollX: window.scrollX - scrollY: window.scrollY + scrollX: scrollX + scrollY: scrollY , => @showMessage "Created global mark", keyChar else localStorage[@getLocationKey keyChar] = @getMarkString() -- cgit v1.2.3