{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/shumway/pulls/comments/25471747","id":25471747,"diff_hunk":"@@ -0,0 +1,701 @@\n+/*\n+ * Copyright 2014 Mozilla Foundation\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+var EXPORTED_SYMBOLS = ['ShumwayCom'];\n+\n+Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');\n+Components.utils.import('resource://gre/modules/Services.jsm');\n+Components.utils.import('resource://gre/modules/Promise.jsm');\n+Components.utils.import('resource://gre/modules/NetUtil.jsm');\n+\n+Components.utils.import('chrome://shumway/content/SpecialInflate.jsm');\n+Components.utils.import('chrome://shumway/content/RtmpUtils.jsm');\n+\n+XPCOMUtils.defineLazyModuleGetter(this, 'ShumwayTelemetry',\n+  'resource://shumway/ShumwayTelemetry.jsm');\n+\n+const MAX_USER_INPUT_TIMEOUT = 250; // ms\n+\n+function getBoolPref(pref, def) {\n+  try {\n+    return Services.prefs.getBoolPref(pref);\n+  } catch (ex) {\n+    return def;\n+  }\n+}\n+\n+function getStringPref(pref, def) {\n+  try {\n+    return Services.prefs.getComplexValue(pref, Components.interfaces.nsISupportsString).data;\n+  } catch (ex) {\n+    return def;\n+  }\n+}\n+\n+function log(aMsg) {\n+  let msg = 'ShumwayCom.js: ' + (aMsg.join ? aMsg.join('') : aMsg);\n+  Services.console.logStringMessage(msg);\n+  dump(msg + '\\n');\n+}\n+\n+var ShumwayCom = {\n+  createAdapter: function (content, callbacks) {\n+    function setFullscreen(value) {\n+      callbacks.sendMessage('setFullscreen', value, false);\n+    }\n+\n+    function endActivation() {\n+      callbacks.sendMessage('endActivation', null, false);\n+    }\n+\n+    function fallback() {\n+      callbacks.sendMessage('fallback', null, false);\n+    }\n+\n+    function getSettings() {\n+      return Components.utils.cloneInto(\n+        callbacks.sendMessage('getSettings', null, true), content);\n+    }\n+\n+    function getPluginParams() {\n+      return Components.utils.cloneInto(\n+        callbacks.sendMessage('getPluginParams', null, true), content);\n+    }\n+\n+    function reportIssue() {\n+      callbacks.sendMessage('reportIssue', null, false);\n+    }\n+\n+    function externalCom(args) {\n+      var result = String(callbacks.sendMessage('externalCom', args, true));\n+      return Components.utils.cloneInto(result, content);\n+    }\n+\n+    function loadFile(args) {\n+      callbacks.sendMessage('loadFile', args, false);\n+    }\n+\n+    function reportTelemetry(args) {\n+      callbacks.sendMessage('reportTelemetry', args, false);\n+    }\n+\n+    function setClipboard(args) {\n+      callbacks.sendMessage('setClipboard', args, false);\n+    }\n+\n+    function navigateTo(args) {\n+      callbacks.sendMessage('navigateTo', args, false);\n+    }\n+\n+    function userInput() {\n+      callbacks.sendMessage('userInput', null, true);\n+    }\n+\n+    // Exposing ShumwayCom object/adapter to the unprivileged content -- setting\n+    // up Xray wrappers.\n+    var shumwayComAdapter = Components.utils.createObjectIn(content, {defineAs: 'ShumwayCom'});\n+    Components.utils.exportFunction(callbacks.enableDebug, shumwayComAdapter, {defineAs: 'enableDebug'});\n+    Components.utils.exportFunction(setFullscreen, shumwayComAdapter, {defineAs: 'setFullscreen'});\n+    Components.utils.exportFunction(endActivation, shumwayComAdapter, {defineAs: 'endActivation'});\n+    Components.utils.exportFunction(fallback, shumwayComAdapter, {defineAs: 'fallback'});\n+    Components.utils.exportFunction(getSettings, shumwayComAdapter, {defineAs: 'getSettings'});\n+    Components.utils.exportFunction(getPluginParams, shumwayComAdapter, {defineAs: 'getPluginParams'});\n+    Components.utils.exportFunction(reportIssue, shumwayComAdapter, {defineAs: 'reportIssue'});\n+    Components.utils.exportFunction(externalCom, shumwayComAdapter, {defineAs: 'externalCom'});\n+    Components.utils.exportFunction(loadFile, shumwayComAdapter, {defineAs: 'loadFile'});\n+    Components.utils.exportFunction(reportTelemetry, shumwayComAdapter, {defineAs: 'reportTelemetry'});\n+    Components.utils.exportFunction(setClipboard, shumwayComAdapter, {defineAs: 'setClipboard'});\n+    Components.utils.exportFunction(navigateTo, shumwayComAdapter, {defineAs: 'navigateTo'});\n+    Components.utils.exportFunction(userInput, shumwayComAdapter, {defineAs: 'userInput'});\n+\n+    Object.defineProperties(shumwayComAdapter, {\n+      onLoadFileCallback: { value: null, writable: true },\n+      onExternalCallback: { value: null, writable: true },\n+    });\n+\n+    // Exposing createSpecialInflate function for DEFLATE stream decoding using\n+    // Gecko API.\n+    if (SpecialInflateUtils.isSpecialInflateEnabled) {\n+      Components.utils.exportFunction(function () {\n+        return SpecialInflateUtils.createWrappedSpecialInflate(content);\n+      }, shumwayComAdapter, {defineAs: 'createSpecialInflate'});\n+    }\n+\n+    if (RtmpUtils.isRtmpEnabled) {\n+      Components.utils.exportFunction(function (params) {\n+        return RtmpUtils.createSocket(content, params);\n+      }, shumwayComAdapter, {defineAs: 'createRtmpSocket'});\n+      Components.utils.exportFunction(function () {\n+        return RtmpUtils.createXHR(content);\n+      }, shumwayComAdapter, {defineAs: 'createRtmpXHR'});\n+    }\n+\n+    Components.utils.makeObjectPropsNormal(shumwayComAdapter);\n+\n+    return shumwayComAdapter;\n+  },\n+\n+  createActions: function (startupInfo, window, document) {\n+    return new ShumwayChromeActions(startupInfo, window, document);\n+  }\n+};\n+\n+\n+// All the priviledged actions.\n+function ShumwayChromeActions(startupInfo, window, document) {\n+  this.url = startupInfo.url;\n+  this.objectParams = startupInfo.objectParams;\n+  this.movieParams = startupInfo.movieParams;\n+  this.baseUrl = startupInfo.baseUrl;\n+  this.isOverlay = startupInfo.isOverlay;\n+  this.embedTag = startupInfo.embedTag;\n+  this.isPausedAtStart = startupInfo.isPausedAtStart;\n+  this.window = window;\n+  this.document = document;\n+  this.externalComInitialized = false;\n+  this.allowScriptAccess = startupInfo.allowScriptAccess;\n+  this.lastUserInput = 0;\n+  this.crossdomainRequestsCache = Object.create(null);\n+  this.telemetry = {\n+    startTime: Date.now(),\n+    features: [],\n+    errors: []\n+  };\n+\n+  this.onLoadFileCallback = null;\n+  this.onExternalCallback = null;\n+}\n+\n+ShumwayChromeActions.prototype = {\n+  invoke: function (name, args) {","path":"extension/firefox/chrome/ShumwayCom.jsm","position":183,"original_position":183,"commit_id":"1a07fd54622eac316038472ece39256f492b7214","original_commit_id":"1a07fd54622eac316038472ece39256f492b7214","user":{"login":"tschneidereit","id":56359,"avatar_url":"https://avatars.githubusercontent.com/u/56359?v=3","gravatar_id":"","url":"https://api.github.com/users/tschneidereit","html_url":"https://github.com/tschneidereit","followers_url":"https://api.github.com/users/tschneidereit/followers","following_url":"https://api.github.com/users/tschneidereit/following{/other_user}","gists_url":"https://api.github.com/users/tschneidereit/gists{/gist_id}","starred_url":"https://api.github.com/users/tschneidereit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschneidereit/subscriptions","organizations_url":"https://api.github.com/users/tschneidereit/orgs","repos_url":"https://api.github.com/users/tschneidereit/repos","events_url":"https://api.github.com/users/tschneidereit/events{/privacy}","received_events_url":"https://api.github.com/users/tschneidereit/received_events","type":"User","site_admin":false},"body":"At least this function should have a comment explaining what it's for and why it's safe.","created_at":"2015-02-26T22:30:24Z","updated_at":"2015-02-26T22:30:24Z","html_url":"https://github.com/mozilla/shumway/pull/2090#discussion_r25471747","pull_request_url":"https://api.github.com/repos/mozilla/shumway/pulls/2090","_links":{"self":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/comments/25471747"},"html":{"href":"https://github.com/mozilla/shumway/pull/2090#discussion_r25471747"},"pull_request":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/2090"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/shumway/pulls/2090","id":30104218,"html_url":"https://github.com/mozilla/shumway/pull/2090","diff_url":"https://github.com/mozilla/shumway/pull/2090.diff","patch_url":"https://github.com/mozilla/shumway/pull/2090.patch","issue_url":"https://api.github.com/repos/mozilla/shumway/issues/2090","number":2090,"state":"open","locked":false,"title":"Refactoring of the ShumwayCom","user":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"body":"* Removes FirefoxCom\r\n* Moves Chrome privileged features from the stream converter\r\n* Simplifies ShumwayCom","created_at":"2015-02-26T18:43:29Z","updated_at":"2015-02-26T22:30:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2a825374f5f1c24f0824aa7cb42783442505de4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/shumway/pulls/2090/commits","review_comments_url":"https://api.github.com/repos/mozilla/shumway/pulls/2090/comments","review_comment_url":"https://api.github.com/repos/mozilla/shumway/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/shumway/issues/2090/comments","statuses_url":"https://api.github.com/repos/mozilla/shumway/statuses/1a07fd54622eac316038472ece39256f492b7214","head":{"label":"yurydelendik:firefoxcom","ref":"firefoxcom","sha":"1a07fd54622eac316038472ece39256f492b7214","user":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"repo":{"id":3913129,"name":"shumway","full_name":"yurydelendik/shumway","owner":{"login":"yurydelendik","id":1523410,"avatar_url":"https://avatars.githubusercontent.com/u/1523410?v=3","gravatar_id":"","url":"https://api.github.com/users/yurydelendik","html_url":"https://github.com/yurydelendik","followers_url":"https://api.github.com/users/yurydelendik/followers","following_url":"https://api.github.com/users/yurydelendik/following{/other_user}","gists_url":"https://api.github.com/users/yurydelendik/gists{/gist_id}","starred_url":"https://api.github.com/users/yurydelendik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurydelendik/subscriptions","organizations_url":"https://api.github.com/users/yurydelendik/orgs","repos_url":"https://api.github.com/users/yurydelendik/repos","events_url":"https://api.github.com/users/yurydelendik/events{/privacy}","received_events_url":"https://api.github.com/users/yurydelendik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yurydelendik/shumway","description":"Shumway is a Flash VM and runtime written in JavaScript","fork":true,"url":"https://api.github.com/repos/yurydelendik/shumway","forks_url":"https://api.github.com/repos/yurydelendik/shumway/forks","keys_url":"https://api.github.com/repos/yurydelendik/shumway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yurydelendik/shumway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yurydelendik/shumway/teams","hooks_url":"https://api.github.com/repos/yurydelendik/shumway/hooks","issue_events_url":"https://api.github.com/repos/yurydelendik/shumway/issues/events{/number}","events_url":"https://api.github.com/repos/yurydelendik/shumway/events","assignees_url":"https://api.github.com/repos/yurydelendik/shumway/assignees{/user}","branches_url":"https://api.github.com/repos/yurydelendik/shumway/branches{/branch}","tags_url":"https://api.github.com/repos/yurydelendik/shumway/tags","blobs_url":"https://api.github.com/repos/yurydelendik/shumway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yurydelendik/shumway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yurydelendik/shumway/git/refs{/sha}","trees_url":"https://api.github.com/repos/yurydelendik/shumway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yurydelendik/shumway/statuses/{sha}","languages_url":"https://api.github.com/repos/yurydelendik/shumway/languages","stargazers_url":"https://api.github.com/repos/yurydelendik/shumway/stargazers","contributors_url":"https://api.github.com/repos/yurydelendik/shumway/contributors","subscribers_url":"https://api.github.com/repos/yurydelendik/shumway/subscribers","subscription_url":"https://api.github.com/repos/yurydelendik/shumway/subscription","commits_url":"https://api.github.com/repos/yurydelendik/shumway/commits{/sha}","git_commits_url":"https://api.github.com/repos/yurydelendik/shumway/git/commits{/sha}","comments_url":"https://api.github.com/repos/yurydelendik/shumway/comments{/number}","issue_comment_url":"https://api.github.com/repos/yurydelendik/shumway/issues/comments{/number}","contents_url":"https://api.github.com/repos/yurydelendik/shumway/contents/{+path}","compare_url":"https://api.github.com/repos/yurydelendik/shumway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yurydelendik/shumway/merges","archive_url":"https://api.github.com/repos/yurydelendik/shumway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yurydelendik/shumway/downloads","issues_url":"https://api.github.com/repos/yurydelendik/shumway/issues{/number}","pulls_url":"https://api.github.com/repos/yurydelendik/shumway/pulls{/number}","milestones_url":"https://api.github.com/repos/yurydelendik/shumway/milestones{/number}","notifications_url":"https://api.github.com/repos/yurydelendik/shumway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yurydelendik/shumway/labels{/name}","releases_url":"https://api.github.com/repos/yurydelendik/shumway/releases{/id}","created_at":"2012-04-03T00:31:22Z","updated_at":"2015-01-28T17:10:49Z","pushed_at":"2015-02-26T22:01:25Z","git_url":"git://github.com/yurydelendik/shumway.git","ssh_url":"git@github.com:yurydelendik/shumway.git","clone_url":"https://github.com/yurydelendik/shumway.git","svn_url":"https://github.com/yurydelendik/shumway","homepage":"","size":152891,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"10e222fa945af2548bf524243dbc2f02a15457ba","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":3006455,"name":"shumway","full_name":"mozilla/shumway","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/shumway","description":"Shumway is a Flash VM and runtime written in JavaScript","fork":false,"url":"https://api.github.com/repos/mozilla/shumway","forks_url":"https://api.github.com/repos/mozilla/shumway/forks","keys_url":"https://api.github.com/repos/mozilla/shumway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/shumway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/shumway/teams","hooks_url":"https://api.github.com/repos/mozilla/shumway/hooks","issue_events_url":"https://api.github.com/repos/mozilla/shumway/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/shumway/events","assignees_url":"https://api.github.com/repos/mozilla/shumway/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/shumway/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/shumway/tags","blobs_url":"https://api.github.com/repos/mozilla/shumway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/shumway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/shumway/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/shumway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/shumway/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/shumway/languages","stargazers_url":"https://api.github.com/repos/mozilla/shumway/stargazers","contributors_url":"https://api.github.com/repos/mozilla/shumway/contributors","subscribers_url":"https://api.github.com/repos/mozilla/shumway/subscribers","subscription_url":"https://api.github.com/repos/mozilla/shumway/subscription","commits_url":"https://api.github.com/repos/mozilla/shumway/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/shumway/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/shumway/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/shumway/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/shumway/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/shumway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/shumway/merges","archive_url":"https://api.github.com/repos/mozilla/shumway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/shumway/downloads","issues_url":"https://api.github.com/repos/mozilla/shumway/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/shumway/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/shumway/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/shumway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/shumway/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/shumway/releases{/id}","created_at":"2011-12-18T15:22:51Z","updated_at":"2015-02-26T15:56:27Z","pushed_at":"2015-02-26T16:01:47Z","git_url":"git://github.com/mozilla/shumway.git","ssh_url":"git@github.com:mozilla/shumway.git","clone_url":"https://github.com/mozilla/shumway.git","svn_url":"https://github.com/mozilla/shumway","homepage":"","size":219534,"stargazers_count":2937,"watchers_count":2937,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":265,"mirror_url":null,"open_issues_count":441,"forks":265,"open_issues":441,"watchers":2937,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/2090"},"html":{"href":"https://github.com/mozilla/shumway/pull/2090"},"issue":{"href":"https://api.github.com/repos/mozilla/shumway/issues/2090"},"comments":{"href":"https://api.github.com/repos/mozilla/shumway/issues/2090/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/2090/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/shumway/pulls/2090/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/shumway/statuses/1a07fd54622eac316038472ece39256f492b7214"}}}}