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

Unified Diff: safari/ext/background.js

Issue 29336084: Issue 2426 - Open block.html as a popup window (Closed)
Patch Set: Pass tab directly instead of getTab callback Created Feb. 11, 2016, 3:19 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
Index: safari/ext/background.js
diff --git a/safari/ext/background.js b/safari/ext/background.js
index 2c3d5ec9aa8fd4b992efd1e8d38e493cc21b2ca5..ce6b8c8b65820cef23dbcd9e512ef61afc26095b 100644
--- a/safari/ext/background.js
+++ b/safari/ext/background.js
@@ -179,7 +179,7 @@
var Page = function(id, tab, url)
{
- this._id = id;
+ this.id = id;
this._tab = tab;
this._frames = [{url: new URL(url), parent: null}];
@@ -204,11 +204,11 @@
},
sendMessage: function(message, responseCallback)
{
- this._messageProxy.sendMessage(message, responseCallback, {pageId: this._id});
+ this._messageProxy.sendMessage(message, responseCallback, {pageId: this.id});
}
};
- ext._getPage = function(id)
+ ext.getPage = function(id)
{
return pages[id];
};
@@ -222,6 +222,8 @@
var forgetPage = function(id)
{
+ ext.pages.onRemoved._dispatch(id);
+
ext._removeFromAllPageMaps(id);
delete pages[id]._tab._pages[id];
@@ -235,7 +237,7 @@
for (var id in tab._pages)
{
- if (id != page._id)
+ if (id != page.id)
forgetPage(id);
}
@@ -305,6 +307,7 @@
},
onLoading: new ext._EventTarget(),
onActivated: new ext._EventTarget(),
+ onRemoved: new ext._EventTarget()
};
safari.application.addEventListener("close", function(event)
@@ -754,4 +757,15 @@
ext.pages.open(optionsUrl, callback);
};
+
+ /* Windows */
+ ext.windows = {
+ // Safari doesn't provide as rich a windows API as Chrome does, so instead
+ // of chrome.windows.create we have to fall back to just opening a new tab.
+ create: function(createData, callback)
+ {
+ if (createData)
+ ext.pages.open(createData.url, callback);
+ }
+ };
})();
« chrome/ext/background.js ('K') | « popup.js ('k') | subscriptionLink.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld