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

Side by Side Diff: chrome/renderer/resources/extensions/platform_app.js

Issue 17451011: Make the externally connectable browser test clobber all of the builtins, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Returns a function that throws a 'not available' exception when called. 6 * Returns a function that throws a 'not available' exception when called.
7 * 7 *
8 * @param {string} messagePrefix text to prepend to the exception message. 8 * @param {string} messagePrefix text to prepend to the exception message.
9 */ 9 */
10 function generateDisabledMethodStub(messagePrefix, opt_messageSuffix) { 10 function generateDisabledMethodStub(messagePrefix, opt_messageSuffix) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Disable onunload, onbeforeunload. 127 // Disable onunload, onbeforeunload.
128 Window.prototype.__defineSetter__( 128 Window.prototype.__defineSetter__(
129 'onbeforeunload', generateDisabledMethodStub('onbeforeunload')); 129 'onbeforeunload', generateDisabledMethodStub('onbeforeunload'));
130 Window.prototype.__defineSetter__( 130 Window.prototype.__defineSetter__(
131 'onunload', generateDisabledMethodStub('onunload')); 131 'onunload', generateDisabledMethodStub('onunload'));
132 var windowAddEventListener = Window.prototype.addEventListener; 132 var windowAddEventListener = Window.prototype.addEventListener;
133 Window.prototype.addEventListener = function(type) { 133 Window.prototype.addEventListener = function(type) {
134 if (type === 'unload' || type === 'beforeunload') 134 if (type === 'unload' || type === 'beforeunload')
135 generateDisabledMethodStub(type)(); 135 generateDisabledMethodStub(type)();
136 else 136 else
137 return windowAddEventListener.apply(window, arguments); 137 return $Function.apply(windowAddEventListener, window, arguments);
138 }; 138 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698