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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js

Issue 2450663004: DevTools: do not allow using 'this' before call into super. (Closed)
Patch Set: rebaselined Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {!WebInspector.ContextMenu} topLevelMenu 33 * @param {?WebInspector.ContextMenu} topLevelMenu
34 * @param {string} type 34 * @param {string} type
35 * @param {string=} label 35 * @param {string=} label
36 * @param {boolean=} disabled 36 * @param {boolean=} disabled
37 * @param {boolean=} checked 37 * @param {boolean=} checked
38 */ 38 */
39 WebInspector.ContextMenuItem = function(topLevelMenu, type, label, disabled, che cked) 39 WebInspector.ContextMenuItem = function(topLevelMenu, type, label, disabled, che cked)
40 { 40 {
41 this._type = type; 41 this._type = type;
42 this._label = label; 42 this._label = label;
43 this._disabled = disabled; 43 this._disabled = disabled;
44 this._checked = checked; 44 this._checked = checked;
45 this._contextMenu = topLevelMenu; 45 this._contextMenu = topLevelMenu;
46 if (type === "item" || type === "checkbox") 46 if (type === "item" || type === "checkbox")
47 this._id = topLevelMenu._nextId(); 47 this._id = topLevelMenu ? topLevelMenu._nextId() : 0;
48 }; 48 };
49 49
50 WebInspector.ContextMenuItem.prototype = { 50 WebInspector.ContextMenuItem.prototype = {
51 /** 51 /**
52 * @return {number} 52 * @return {number}
53 */ 53 */
54 id: function() 54 id: function()
55 { 55 {
56 return this._id; 56 return this._id;
57 }, 57 },
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 */ 106 */
107 setShortcut: function(shortcut) 107 setShortcut: function(shortcut)
108 { 108 {
109 this._shortcut = shortcut; 109 this._shortcut = shortcut;
110 } 110 }
111 }; 111 };
112 112
113 /** 113 /**
114 * @constructor 114 * @constructor
115 * @extends {WebInspector.ContextMenuItem} 115 * @extends {WebInspector.ContextMenuItem}
116 * @param {!WebInspector.ContextMenu} topLevelMenu 116 * @param {?WebInspector.ContextMenu} topLevelMenu
117 * @param {string=} label 117 * @param {string=} label
118 * @param {boolean=} disabled 118 * @param {boolean=} disabled
119 */ 119 */
120 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled) 120 WebInspector.ContextSubMenuItem = function(topLevelMenu, label, disabled)
121 { 121 {
122 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled); 122 WebInspector.ContextMenuItem.call(this, topLevelMenu, "subMenu", label, disa bled);
123 /** @type {!Array.<!WebInspector.ContextMenuItem>} */ 123 /** @type {!Array.<!WebInspector.ContextMenuItem>} */
124 this._items = []; 124 this._items = [];
125 }; 125 };
126 126
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 /** 294 /**
295 * @constructor 295 * @constructor
296 * @extends {WebInspector.ContextSubMenuItem} 296 * @extends {WebInspector.ContextSubMenuItem}
297 * @param {!Event} event 297 * @param {!Event} event
298 * @param {boolean=} useSoftMenu 298 * @param {boolean=} useSoftMenu
299 * @param {number=} x 299 * @param {number=} x
300 * @param {number=} y 300 * @param {number=} y
301 */ 301 */
302 WebInspector.ContextMenu = function(event, useSoftMenu, x, y) 302 WebInspector.ContextMenu = function(event, useSoftMenu, x, y)
303 { 303 {
304 WebInspector.ContextSubMenuItem.call(this, this, ""); 304 WebInspector.ContextSubMenuItem.call(this, null, "");
305 this._contextMenu = this;
305 /** @type {!Array.<!Promise.<!Array.<!WebInspector.ContextMenu.Provider>>>} */ 306 /** @type {!Array.<!Promise.<!Array.<!WebInspector.ContextMenu.Provider>>>} */
306 this._pendingPromises = []; 307 this._pendingPromises = [];
307 /** @type {!Array<!Object>} */ 308 /** @type {!Array<!Object>} */
308 this._pendingTargets = []; 309 this._pendingTargets = [];
309 this._event = event; 310 this._event = event;
310 this._useSoftMenu = !!useSoftMenu; 311 this._useSoftMenu = !!useSoftMenu;
311 this._x = x === undefined ? event.x : x; 312 this._x = x === undefined ? event.x : x;
312 this._y = y === undefined ? event.y : y; 313 this._y = y === undefined ? event.y : y;
313 this._handlers = {}; 314 this._handlers = {};
314 this._id = 0; 315 this._id = 0;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 }; 508 };
508 509
509 WebInspector.ContextMenu.Provider.prototype = { 510 WebInspector.ContextMenu.Provider.prototype = {
510 /** 511 /**
511 * @param {!Event} event 512 * @param {!Event} event
512 * @param {!WebInspector.ContextMenu} contextMenu 513 * @param {!WebInspector.ContextMenu} contextMenu
513 * @param {!Object} target 514 * @param {!Object} target
514 */ 515 */
515 appendApplicableItems: function(event, contextMenu, target) { } 516 appendApplicableItems: function(event, contextMenu, target) { }
516 }; 517 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698