Commit d23194f9 authored by caseq@chromium.org's avatar caseq@chromium.org

Fix null pointer exception when attempting to load an image without the target

- properly annotated TracingModel.Event fields to let compiler catch the problem;
- check target is not null before using it.

BUG=424503

Review URL: https://codereview.chromium.org/658363002

git-svn-id: svn://svn.chromium.org/blink/trunk@183889 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7d170e9c
......@@ -659,7 +659,7 @@ WebInspector.LayerPaintEvent.prototype = {
*/
function onGotObject(result)
{
if (!result || !result["skp64"]) {
if (!result || !result["skp64"] || !target) {
callback(null, null);
return;
}
......
......@@ -321,16 +321,21 @@ WebInspector.TracingModel.Loader.prototype = {
* @constructor
* @param {string} category
* @param {string} name
* @param {string} phase
* @param {!WebInspector.TracingModel.Phase} phase
* @param {number} startTime
* @param {?WebInspector.TracingModel.Thread} thread
* @param {!WebInspector.TracingModel.Thread} thread
*/
WebInspector.TracingModel.Event = function(category, name, phase, startTime, thread)
{
/** @type {string} */
this.category = category;
/** @type {string} */
this.name = name;
/** @type {!WebInspector.TracingModel.Phase} */
this.phase = phase;
/** @type {number} */
this.startTime = startTime;
/** @type {!WebInspector.TracingModel.Thread} */
this.thread = thread;
this.args = {};
......@@ -353,12 +358,12 @@ WebInspector.TracingModel.Event = function(category, name, phase, startTime, thr
/**
* @param {!WebInspector.TracingManager.EventPayload} payload
* @param {?WebInspector.TracingModel.Thread} thread
* @param {!WebInspector.TracingModel.Thread} thread
* @return {!WebInspector.TracingModel.Event}
*/
WebInspector.TracingModel.Event.fromPayload = function(payload, thread)
{
var event = new WebInspector.TracingModel.Event(payload.cat, payload.name, payload.ph, payload.ts / 1000, thread);
var event = new WebInspector.TracingModel.Event(payload.cat, payload.name, /** @type {!WebInspector.TracingModel.Phase} */ (payload.ph), payload.ts / 1000, thread);
if (payload.args)
event.addArgs(payload.args);
else
......@@ -448,7 +453,7 @@ WebInspector.TracingModel.Event.orderedCompareStartTime = function (a, b)
* @param {string} category
* @param {string} name
* @param {number} startTime
* @param {?WebInspector.TracingModel.Thread} thread
* @param {!WebInspector.TracingModel.Thread} thread
*/
WebInspector.TracingModel.ObjectSnapshot = function(category, name, startTime, thread)
{
......@@ -457,7 +462,7 @@ WebInspector.TracingModel.ObjectSnapshot = function(category, name, startTime, t
/**
* @param {!WebInspector.TracingManager.EventPayload} payload
* @param {?WebInspector.TracingModel.Thread} thread
* @param {!WebInspector.TracingModel.Thread} thread
* @return {!WebInspector.TracingModel.ObjectSnapshot}
*/
WebInspector.TracingModel.ObjectSnapshot.fromPayload = function(payload, thread)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment