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

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

Issue 988293002: platform apps: Disables history.pushState/replaceState in platform_app.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « chrome/test/data/extensions/platform_apps/restrictions/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 var $console = window.console; 5 var $console = window.console;
6 6
7 /** 7 /**
8 * Returns a function that logs a 'not available' error to the console and 8 * Returns a function that logs a 'not available' error to the console and
9 * returns undefined. 9 * returns undefined.
10 * 10 *
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 // Disable benign Document methods. 148 // Disable benign Document methods.
149 disableMethods(HTMLDocument.prototype, 'document', ['open', 'clear', 'close']); 149 disableMethods(HTMLDocument.prototype, 'document', ['open', 'clear', 'close']);
150 150
151 // Replace evil Document methods with exception-throwing stubs. 151 // Replace evil Document methods with exception-throwing stubs.
152 disableMethods(HTMLDocument.prototype, 'document', ['write', 'writeln'], true); 152 disableMethods(HTMLDocument.prototype, 'document', ['write', 'writeln'], true);
153 153
154 // Disable history. 154 // Disable history.
155 Object.defineProperty(window, "history", { value: {} }); 155 Object.defineProperty(window, "history", { value: {} });
156 disableGetters(window.history, 'history', ['back', 'forward', 'go', 'length']); 156 disableGetters(window.history, 'history',
157 ['back', 'forward', 'go', 'length', 'pushState', 'replaceState']);
157 158
158 // Disable find. 159 // Disable find.
159 disableMethods(Window.prototype, 'window', ['find']); 160 disableMethods(Window.prototype, 'window', ['find']);
160 161
161 // Disable modal dialogs. Shell windows disable these anyway, but it's nice to 162 // Disable modal dialogs. Shell windows disable these anyway, but it's nice to
162 // warn. 163 // warn.
163 disableMethods(Window.prototype, 'window', ['alert', 'confirm', 'prompt']); 164 disableMethods(Window.prototype, 'window', ['alert', 'confirm', 'prompt']);
164 165
165 // Disable window.*bar. 166 // Disable window.*bar.
166 disableGetters(window, 'window', 167 disableGetters(window, 'window',
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 // Disable onunload, onbeforeunload. 200 // Disable onunload, onbeforeunload.
200 disableSetters(Window.prototype, 'window', ['onbeforeunload', 'onunload']); 201 disableSetters(Window.prototype, 'window', ['onbeforeunload', 'onunload']);
201 var windowAddEventListener = Window.prototype.addEventListener; 202 var windowAddEventListener = Window.prototype.addEventListener;
202 Window.prototype.addEventListener = function(type) { 203 Window.prototype.addEventListener = function(type) {
203 if (type === 'unload' || type === 'beforeunload') 204 if (type === 'unload' || type === 'beforeunload')
204 generateDisabledMethodStub(type)(); 205 generateDisabledMethodStub(type)();
205 else 206 else
206 return $Function.apply(windowAddEventListener, window, arguments); 207 return $Function.apply(windowAddEventListener, window, arguments);
207 }; 208 };
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/restrictions/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698