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

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

Issue 1333303002: bindings: Fixes exposed JS APIs for platform apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/platform_app.js
diff --git a/extensions/renderer/resources/platform_app.js b/extensions/renderer/resources/platform_app.js
index b34a303e04895cdc9b248f555682d6428ab6a281..caf935a3ca5f03dba118208bbd07344f8ba3a23f 100644
--- a/extensions/renderer/resources/platform_app.js
+++ b/extensions/renderer/resources/platform_app.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var $console = window.console;
-
/**
* Returns a function that logs a 'not available' error to the console and
* returns undefined.
@@ -14,7 +12,7 @@ function generateDisabledMethodStub(messagePrefix, opt_messageSuffix) {
var message = messagePrefix + ' is not available in packaged apps.';
if (opt_messageSuffix) message = message + ' ' + opt_messageSuffix;
return function() {
- $console.error(message);
+ console.error(message);
return;
};
}
@@ -157,10 +155,12 @@ disableGetters(window.history, 'history',
['back', 'forward', 'go', 'length', 'pushState', 'replaceState']);
// Disable find.
+disableMethods(window, 'window', ['find']);
disableMethods(Window.prototype, 'window', ['find']);
// Disable modal dialogs. Shell windows disable these anyway, but it's nice to
// warn.
+disableMethods(window, 'window', ['alert', 'confirm', 'prompt']);
disableMethods(Window.prototype, 'window', ['alert', 'confirm', 'prompt']);
// Disable window.*bar.
@@ -198,11 +198,12 @@ window.addEventListener('readystatechange', function(event) {
}, true);
// Disable onunload, onbeforeunload.
+disableSetters(window, 'window', ['onbeforeunload', 'onunload']);
disableSetters(Window.prototype, 'window', ['onbeforeunload', 'onunload']);
-var windowAddEventListener = Window.prototype.addEventListener;
-Window.prototype.addEventListener = function(type) {
+var eventTargetAddEventListener = EventTarget.prototype.addEventListener;
+EventTarget.prototype.addEventListener = function(type) {
if (type === 'unload' || type === 'beforeunload')
generateDisabledMethodStub(type)();
else
- return $Function.apply(windowAddEventListener, window, arguments);
+ return $Function.apply(eventTargetAddEventListener, this, arguments);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698