{"action":"created","comment":{"url":"https://api.github.com/repos/alpheios-project/webextension/pulls/comments/237571512","pull_request_review_id":179899540,"id":237571512,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzU3MTUxMg==","diff_hunk":"@@ -74,34 +72,31 @@ let sendStateToBackground = function sendStateToBackground (messageName) {\n \n document.addEventListener('DOMContentLoaded', (event) => {\n   /*\n-  In Safari, content script is loaded for the \"main\" page (the page whose URL is shown in an address bar) AND\n-  for each of the \"derivative\" pages. These could be pages loaded within iframes of the main page.\n-  Safari might also load content script for one or several blank pages that are created during Vue.js component rendering.\n-  We need to filter out loading for the main page (this is when a content process should be created and initialized)\n-  from the calls to the derivative pages (when content process is already created and we should not create it again).\n-  For this, we can use a `URL` prop from `event.currentTarget`.\n+  In Safari, if page contains several documents (as in case with frames), a content script is\n+  loaded for the \"main\" document (the topmost document) AND for each of the child documents\n+  (i.e. frames). Safari might also load content script for one or several blank documents\n+  that are created during Vue.js component rendering.\n+  We will use `HTMLPage.isValidTarget` to filter out documents where an Alpheios UI can and should\n+  be shown from those where it can not. If we're lucky, a single document will be selected.\n+  If not, we should adjust filtering rules to accommodate such cases.\n    */\n-  const SAFARI_BLANK_ADDR = 'about:blank'\n-  const ALPHEIOS_GRAMMAR_ADDR = 'grammars.alpheios.net'\n \n-  if (event.currentTarget.URL.search(`${SAFARI_BLANK_ADDR}|${ALPHEIOS_GRAMMAR_ADDR}`) === -1) {\n-    if (!HTMLPage.hasFrames && !HTMLPage.isFrame) {\n-      let messagingService = new MessagingService()\n-      messagingService.addHandler(Message.types.STATE_REQUEST, handleStateRequest)\n-      safari.self.addEventListener('message', messagingService.listener.bind(messagingService))\n+  if (HTMLPage.isValidTarget) {\n+    initialized = true\n+    console.log(`Activating a messaging service, initialized: ${initialized}`)","path":"src/content/content-safari.js","position":78,"original_position":78,"commit_id":"47f46ad99586011ddc8ae3c028dead7c0cbcdb9d","original_commit_id":"47f46ad99586011ddc8ae3c028dead7c0cbcdb9d","user":{"login":"balmas","id":644870,"node_id":"MDQ6VXNlcjY0NDg3MA==","avatar_url":"https://avatars1.githubusercontent.com/u/644870?v=4","gravatar_id":"","url":"https://api.github.com/users/balmas","html_url":"https://github.com/balmas","followers_url":"https://api.github.com/users/balmas/followers","following_url":"https://api.github.com/users/balmas/following{/other_user}","gists_url":"https://api.github.com/users/balmas/gists{/gist_id}","starred_url":"https://api.github.com/users/balmas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balmas/subscriptions","organizations_url":"https://api.github.com/users/balmas/orgs","repos_url":"https://api.github.com/users/balmas/repos","events_url":"https://api.github.com/users/balmas/events{/privacy}","received_events_url":"https://api.github.com/users/balmas/received_events","type":"User","site_admin":false},"body":"remove debugging print","created_at":"2018-11-29T16:53:47Z","updated_at":"2018-11-29T16:54:54Z","html_url":"https://github.com/alpheios-project/webextension/pull/173#discussion_r237571512","pull_request_url":"https://api.github.com/repos/alpheios-project/webextension/pulls/173","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/comments/237571512"},"html":{"href":"https://github.com/alpheios-project/webextension/pull/173#discussion_r237571512"},"pull_request":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/173"}}},"pull_request":{"url":"https://api.github.com/repos/alpheios-project/webextension/pulls/173","id":234684339,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0Njg0MzM5","html_url":"https://github.com/alpheios-project/webextension/pull/173","diff_url":"https://github.com/alpheios-project/webextension/pull/173.diff","patch_url":"https://github.com/alpheios-project/webextension/pull/173.patch","issue_url":"https://api.github.com/repos/alpheios-project/webextension/issues/173","number":173,"state":"open","locked":false,"title":"Support of frames","user":{"login":"kirlat","id":18631055,"node_id":"MDQ6VXNlcjE4NjMxMDU1","avatar_url":"https://avatars1.githubusercontent.com/u/18631055?v=4","gravatar_id":"","url":"https://api.github.com/users/kirlat","html_url":"https://github.com/kirlat","followers_url":"https://api.github.com/users/kirlat/followers","following_url":"https://api.github.com/users/kirlat/following{/other_user}","gists_url":"https://api.github.com/users/kirlat/gists{/gist_id}","starred_url":"https://api.github.com/users/kirlat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirlat/subscriptions","organizations_url":"https://api.github.com/users/kirlat/orgs","repos_url":"https://api.github.com/users/kirlat/repos","events_url":"https://api.github.com/users/kirlat/events{/privacy}","received_events_url":"https://api.github.com/users/kirlat/received_events","type":"User","site_admin":false},"body":"This release enables support of sites with frames in Safari.","created_at":"2018-11-29T15:40:06Z","updated_at":"2018-11-29T16:54:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alpheios-project/webextension/pulls/173/commits","review_comments_url":"https://api.github.com/repos/alpheios-project/webextension/pulls/173/comments","review_comment_url":"https://api.github.com/repos/alpheios-project/webextension/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alpheios-project/webextension/issues/173/comments","statuses_url":"https://api.github.com/repos/alpheios-project/webextension/statuses/47f46ad99586011ddc8ae3c028dead7c0cbcdb9d","head":{"label":"alpheios-project:webext-i170-171","ref":"webext-i170-171","sha":"47f46ad99586011ddc8ae3c028dead7c0cbcdb9d","user":{"login":"alpheios-project","id":3856688,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NTY2ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/3856688?v=4","gravatar_id":"","url":"https://api.github.com/users/alpheios-project","html_url":"https://github.com/alpheios-project","followers_url":"https://api.github.com/users/alpheios-project/followers","following_url":"https://api.github.com/users/alpheios-project/following{/other_user}","gists_url":"https://api.github.com/users/alpheios-project/gists{/gist_id}","starred_url":"https://api.github.com/users/alpheios-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpheios-project/subscriptions","organizations_url":"https://api.github.com/users/alpheios-project/orgs","repos_url":"https://api.github.com/users/alpheios-project/repos","events_url":"https://api.github.com/users/alpheios-project/events{/privacy}","received_events_url":"https://api.github.com/users/alpheios-project/received_events","type":"Organization","site_admin":false},"repo":{"id":109939597,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk5Mzk1OTc=","name":"webextension","full_name":"alpheios-project/webextension","private":false,"owner":{"login":"alpheios-project","id":3856688,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NTY2ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/3856688?v=4","gravatar_id":"","url":"https://api.github.com/users/alpheios-project","html_url":"https://github.com/alpheios-project","followers_url":"https://api.github.com/users/alpheios-project/followers","following_url":"https://api.github.com/users/alpheios-project/following{/other_user}","gists_url":"https://api.github.com/users/alpheios-project/gists{/gist_id}","starred_url":"https://api.github.com/users/alpheios-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpheios-project/subscriptions","organizations_url":"https://api.github.com/users/alpheios-project/orgs","repos_url":"https://api.github.com/users/alpheios-project/repos","events_url":"https://api.github.com/users/alpheios-project/events{/privacy}","received_events_url":"https://api.github.com/users/alpheios-project/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/alpheios-project/webextension","description":"A WebExtension for displaying a language reference data","fork":false,"url":"https://api.github.com/repos/alpheios-project/webextension","forks_url":"https://api.github.com/repos/alpheios-project/webextension/forks","keys_url":"https://api.github.com/repos/alpheios-project/webextension/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alpheios-project/webextension/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alpheios-project/webextension/teams","hooks_url":"https://api.github.com/repos/alpheios-project/webextension/hooks","issue_events_url":"https://api.github.com/repos/alpheios-project/webextension/issues/events{/number}","events_url":"https://api.github.com/repos/alpheios-project/webextension/events","assignees_url":"https://api.github.com/repos/alpheios-project/webextension/assignees{/user}","branches_url":"https://api.github.com/repos/alpheios-project/webextension/branches{/branch}","tags_url":"https://api.github.com/repos/alpheios-project/webextension/tags","blobs_url":"https://api.github.com/repos/alpheios-project/webextension/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alpheios-project/webextension/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alpheios-project/webextension/git/refs{/sha}","trees_url":"https://api.github.com/repos/alpheios-project/webextension/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alpheios-project/webextension/statuses/{sha}","languages_url":"https://api.github.com/repos/alpheios-project/webextension/languages","stargazers_url":"https://api.github.com/repos/alpheios-project/webextension/stargazers","contributors_url":"https://api.github.com/repos/alpheios-project/webextension/contributors","subscribers_url":"https://api.github.com/repos/alpheios-project/webextension/subscribers","subscription_url":"https://api.github.com/repos/alpheios-project/webextension/subscription","commits_url":"https://api.github.com/repos/alpheios-project/webextension/commits{/sha}","git_commits_url":"https://api.github.com/repos/alpheios-project/webextension/git/commits{/sha}","comments_url":"https://api.github.com/repos/alpheios-project/webextension/comments{/number}","issue_comment_url":"https://api.github.com/repos/alpheios-project/webextension/issues/comments{/number}","contents_url":"https://api.github.com/repos/alpheios-project/webextension/contents/{+path}","compare_url":"https://api.github.com/repos/alpheios-project/webextension/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alpheios-project/webextension/merges","archive_url":"https://api.github.com/repos/alpheios-project/webextension/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alpheios-project/webextension/downloads","issues_url":"https://api.github.com/repos/alpheios-project/webextension/issues{/number}","pulls_url":"https://api.github.com/repos/alpheios-project/webextension/pulls{/number}","milestones_url":"https://api.github.com/repos/alpheios-project/webextension/milestones{/number}","notifications_url":"https://api.github.com/repos/alpheios-project/webextension/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alpheios-project/webextension/labels{/name}","releases_url":"https://api.github.com/repos/alpheios-project/webextension/releases{/id}","deployments_url":"https://api.github.com/repos/alpheios-project/webextension/deployments","created_at":"2017-11-08T06:59:09Z","updated_at":"2018-11-26T18:18:53Z","pushed_at":"2018-11-29T15:45:30Z","git_url":"git://github.com/alpheios-project/webextension.git","ssh_url":"git@github.com:alpheios-project/webextension.git","clone_url":"https://github.com/alpheios-project/webextension.git","svn_url":"https://github.com/alpheios-project/webextension","homepage":"","size":65906,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":27,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":1,"open_issues":27,"watchers":2,"default_branch":"master"}},"base":{"label":"alpheios-project:release-2.1.0.x","ref":"release-2.1.0.x","sha":"9d3b761407fe544092da6a761a331d02fe71c750","user":{"login":"alpheios-project","id":3856688,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NTY2ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/3856688?v=4","gravatar_id":"","url":"https://api.github.com/users/alpheios-project","html_url":"https://github.com/alpheios-project","followers_url":"https://api.github.com/users/alpheios-project/followers","following_url":"https://api.github.com/users/alpheios-project/following{/other_user}","gists_url":"https://api.github.com/users/alpheios-project/gists{/gist_id}","starred_url":"https://api.github.com/users/alpheios-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpheios-project/subscriptions","organizations_url":"https://api.github.com/users/alpheios-project/orgs","repos_url":"https://api.github.com/users/alpheios-project/repos","events_url":"https://api.github.com/users/alpheios-project/events{/privacy}","received_events_url":"https://api.github.com/users/alpheios-project/received_events","type":"Organization","site_admin":false},"repo":{"id":109939597,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk5Mzk1OTc=","name":"webextension","full_name":"alpheios-project/webextension","private":false,"owner":{"login":"alpheios-project","id":3856688,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NTY2ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/3856688?v=4","gravatar_id":"","url":"https://api.github.com/users/alpheios-project","html_url":"https://github.com/alpheios-project","followers_url":"https://api.github.com/users/alpheios-project/followers","following_url":"https://api.github.com/users/alpheios-project/following{/other_user}","gists_url":"https://api.github.com/users/alpheios-project/gists{/gist_id}","starred_url":"https://api.github.com/users/alpheios-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alpheios-project/subscriptions","organizations_url":"https://api.github.com/users/alpheios-project/orgs","repos_url":"https://api.github.com/users/alpheios-project/repos","events_url":"https://api.github.com/users/alpheios-project/events{/privacy}","received_events_url":"https://api.github.com/users/alpheios-project/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/alpheios-project/webextension","description":"A WebExtension for displaying a language reference data","fork":false,"url":"https://api.github.com/repos/alpheios-project/webextension","forks_url":"https://api.github.com/repos/alpheios-project/webextension/forks","keys_url":"https://api.github.com/repos/alpheios-project/webextension/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alpheios-project/webextension/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alpheios-project/webextension/teams","hooks_url":"https://api.github.com/repos/alpheios-project/webextension/hooks","issue_events_url":"https://api.github.com/repos/alpheios-project/webextension/issues/events{/number}","events_url":"https://api.github.com/repos/alpheios-project/webextension/events","assignees_url":"https://api.github.com/repos/alpheios-project/webextension/assignees{/user}","branches_url":"https://api.github.com/repos/alpheios-project/webextension/branches{/branch}","tags_url":"https://api.github.com/repos/alpheios-project/webextension/tags","blobs_url":"https://api.github.com/repos/alpheios-project/webextension/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alpheios-project/webextension/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alpheios-project/webextension/git/refs{/sha}","trees_url":"https://api.github.com/repos/alpheios-project/webextension/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alpheios-project/webextension/statuses/{sha}","languages_url":"https://api.github.com/repos/alpheios-project/webextension/languages","stargazers_url":"https://api.github.com/repos/alpheios-project/webextension/stargazers","contributors_url":"https://api.github.com/repos/alpheios-project/webextension/contributors","subscribers_url":"https://api.github.com/repos/alpheios-project/webextension/subscribers","subscription_url":"https://api.github.com/repos/alpheios-project/webextension/subscription","commits_url":"https://api.github.com/repos/alpheios-project/webextension/commits{/sha}","git_commits_url":"https://api.github.com/repos/alpheios-project/webextension/git/commits{/sha}","comments_url":"https://api.github.com/repos/alpheios-project/webextension/comments{/number}","issue_comment_url":"https://api.github.com/repos/alpheios-project/webextension/issues/comments{/number}","contents_url":"https://api.github.com/repos/alpheios-project/webextension/contents/{+path}","compare_url":"https://api.github.com/repos/alpheios-project/webextension/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alpheios-project/webextension/merges","archive_url":"https://api.github.com/repos/alpheios-project/webextension/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alpheios-project/webextension/downloads","issues_url":"https://api.github.com/repos/alpheios-project/webextension/issues{/number}","pulls_url":"https://api.github.com/repos/alpheios-project/webextension/pulls{/number}","milestones_url":"https://api.github.com/repos/alpheios-project/webextension/milestones{/number}","notifications_url":"https://api.github.com/repos/alpheios-project/webextension/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alpheios-project/webextension/labels{/name}","releases_url":"https://api.github.com/repos/alpheios-project/webextension/releases{/id}","deployments_url":"https://api.github.com/repos/alpheios-project/webextension/deployments","created_at":"2017-11-08T06:59:09Z","updated_at":"2018-11-26T18:18:53Z","pushed_at":"2018-11-29T15:45:30Z","git_url":"git://github.com/alpheios-project/webextension.git","ssh_url":"git@github.com:alpheios-project/webextension.git","clone_url":"https://github.com/alpheios-project/webextension.git","svn_url":"https://github.com/alpheios-project/webextension","homepage":"","size":65906,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":27,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":1,"open_issues":27,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/173"},"html":{"href":"https://github.com/alpheios-project/webextension/pull/173"},"issue":{"href":"https://api.github.com/repos/alpheios-project/webextension/issues/173"},"comments":{"href":"https://api.github.com/repos/alpheios-project/webextension/issues/173/comments"},"review_comments":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/173/comments"},"review_comment":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alpheios-project/webextension/pulls/173/commits"},"statuses":{"href":"https://api.github.com/repos/alpheios-project/webextension/statuses/47f46ad99586011ddc8ae3c028dead7c0cbcdb9d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"balmas"}}