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

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

Issue 16118002: Avoid cache when deprecating document.all (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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 (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 var forEach = require('utils').forEach; 5 var forEach = require('utils').forEach;
6 6
7 /** 7 /**
8 * Returns a function that throws a 'not available' exception when called. 8 * Returns a function that throws a 'not available' exception when called.
9 * 9 *
10 * @param {string} messagePrefix text to prepend to the exception message. 10 * @param {string} messagePrefix text to prepend to the exception message.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // point to the page's document (it will be reset between now and then). 110 // point to the page's document (it will be reset between now and then).
111 // We can't listen for the "readystatechange" event on the document (because 111 // We can't listen for the "readystatechange" event on the document (because
112 // the object that it's dispatched on doesn't exist yet), but we can instead 112 // the object that it's dispatched on doesn't exist yet), but we can instead
113 // do it at the window level in the capturing phase. 113 // do it at the window level in the capturing phase.
114 window.addEventListener('readystatechange', function(event) { 114 window.addEventListener('readystatechange', function(event) {
115 if (document.readyState != 'loading') 115 if (document.readyState != 'loading')
116 return; 116 return;
117 117
118 // Deprecated document properties from 118 // Deprecated document properties from
119 // https://developer.mozilla.org/en/DOM/document. 119 // https://developer.mozilla.org/en/DOM/document.
120 // To deprecate document.all, simply changing its getter and setter would
121 // activate its cache mechanism, and degrade the performance. Here we assign
122 // it first to 'undefined' to avoid this.
123 document.all = undefined;
not at google - send to devlin 2013/05/29 15:58:05 is this the only property that will ever suffer fr
miket_OOO 2013/05/29 16:19:14 Ben, I'm probably misreading disableGetters (which
not at google - send to devlin 2013/05/29 16:24:31 I mean make disableGetters assign every property t
120 disableGetters(document, 'document', 124 disableGetters(document, 'document',
121 ['alinkColor', 'all', 'bgColor', 'fgColor', 'linkColor', 125 ['alinkColor', 'all', 'bgColor', 'fgColor', 'linkColor',
122 'vlinkColor']); 126 'vlinkColor']);
123 }, true); 127 }, true);
124 128
125 // Disable onunload, onbeforeunload. 129 // Disable onunload, onbeforeunload.
126 Window.prototype.__defineSetter__( 130 Window.prototype.__defineSetter__(
127 'onbeforeunload', generateDisabledMethodStub('onbeforeunload')); 131 'onbeforeunload', generateDisabledMethodStub('onbeforeunload'));
128 Window.prototype.__defineSetter__( 132 Window.prototype.__defineSetter__(
129 'onunload', generateDisabledMethodStub('onunload')); 133 'onunload', generateDisabledMethodStub('onunload'));
130 var windowAddEventListener = Window.prototype.addEventListener; 134 var windowAddEventListener = Window.prototype.addEventListener;
131 Window.prototype.addEventListener = function(type) { 135 Window.prototype.addEventListener = function(type) {
132 if (type === 'unload' || type === 'beforeunload') 136 if (type === 'unload' || type === 'beforeunload')
133 generateDisabledMethodStub(type)(); 137 generateDisabledMethodStub(type)();
134 else 138 else
135 return windowAddEventListener.apply(window, arguments); 139 return windowAddEventListener.apply(window, arguments);
136 }; 140 };
OLDNEW
« 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