Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3134)

Unified Diff: chrome/renderer/resources/extensions/platform_app.js

Issue 10545070: Make platform app restrictions more robust. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debugging code Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/restrictions/test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/platform_app.js
diff --git a/chrome/renderer/resources/extensions/platform_app.js b/chrome/renderer/resources/extensions/platform_app.js
index fe1fcd67d1ef7a63e9992c170bb05f31befb1aec..f2d3d4dba0c10bca9a6b515dd58313bc656f3f98 100644
--- a/chrome/renderer/resources/extensions/platform_app.js
+++ b/chrome/renderer/resources/extensions/platform_app.js
@@ -6,13 +6,12 @@ var errorMsg = 'Not available for platform apps.';
var stub = function() { throw errorMsg; };
// Disable document.open|close|write.
-document.open = stub;
-document.close = stub;
-document.write = stub;
+HTMLDocument.prototype.open = stub;
+HTMLDocument.prototype.close = stub;
+HTMLDocument.prototype.write = stub;
// Disable history.
window.history = {
- open: stub,
back: stub,
forward: stub,
go: stub,
@@ -23,12 +22,13 @@ window.history = {
};
// Disable find.
-window.find = stub;
+Window.prototype.find = stub;
-// Disable modal dialogs.
-window.alert = stub;
-window.confirm = stub;
-window.prompt = stub;
+// Disable modal dialogs. Shell windows disable these anyway, but it's nice to
+// warn.
+Window.prototype.alert = stub;
+Window.prototype.confirm = stub;
+Window.prototype.prompt = stub;
// Disable window.*bar.
var stubBar = { get visible() { throw errorMsg; } };
@@ -40,11 +40,12 @@ window.statusbar = stubBar;
window.toolbar = stubBar;
// Disable onunload, onbeforeunload.
-window.__defineSetter__('onbeforeunload', stub);
-window.__defineSetter__('onunload', stub);
-window.addEventListener = function(type) {
+Window.prototype.__defineSetter__('onbeforeunload', stub);
+Window.prototype.__defineSetter__('onunload', stub);
+var windowAddEventListener = Window.prototype.addEventListener;
+Window.prototype.addEventListener = function(type) {
if (type === 'unload' || type === 'beforeunload')
stub();
else
- return Window.prototype.addEventListener.apply(window, arguments);
+ return windowAddEventListener.apply(window, arguments);
};
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/restrictions/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698