| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 this._mimeType = mimeType; | 52 this._mimeType = mimeType; |
| 53 this._isHidden = isHidden; | 53 this._isHidden = isHidden; |
| 54 | 54 |
| 55 /** @type {?string} */ this._content; | 55 /** @type {?string} */ this._content; |
| 56 /** @type {boolean} */ this._contentEncoded; | 56 /** @type {boolean} */ this._contentEncoded; |
| 57 this._pendingContentCallbacks = []; | 57 this._pendingContentCallbacks = []; |
| 58 if (this._request && !this._request.finished) | 58 if (this._request && !this._request.finished) |
| 59 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._requestFinished, this); | 59 this._request.addEventListener(WebInspector.NetworkRequest.Events.Finish
edLoading, this._requestFinished, this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 WebInspector.Resource.Events = { | |
| 63 MessageAdded: "message-added", | |
| 64 MessagesCleared: "messages-cleared", | |
| 65 } | |
| 66 | |
| 67 /** | 62 /** |
| 68 * @param {?string} content | 63 * @param {?string} content |
| 69 * @param {string} mimeType | 64 * @param {string} mimeType |
| 70 * @param {boolean} contentEncoded | 65 * @param {boolean} contentEncoded |
| 71 * @param {?string=} charset | 66 * @param {?string=} charset |
| 72 * @return {?string} | 67 * @return {?string} |
| 73 */ | 68 */ |
| 74 WebInspector.Resource.contentAsDataURL = function(content, mimeType, contentEnco
ded, charset) | 69 WebInspector.Resource.contentAsDataURL = function(content, mimeType, contentEnco
ded, charset) |
| 75 { | 70 { |
| 76 const maxDataUrlSize = 1024 * 1024; | 71 const maxDataUrlSize = 1024 * 1024; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 167 |
| 173 /** | 168 /** |
| 174 * @return {string} | 169 * @return {string} |
| 175 */ | 170 */ |
| 176 get mimeType() | 171 get mimeType() |
| 177 { | 172 { |
| 178 return this._request ? this._request.mimeType : this._mimeType; | 173 return this._request ? this._request.mimeType : this._mimeType; |
| 179 }, | 174 }, |
| 180 | 175 |
| 181 /** | 176 /** |
| 182 * @return {!Array.<!WebInspector.ConsoleMessage>} | |
| 183 */ | |
| 184 get messages() | |
| 185 { | |
| 186 return this._messages || []; | |
| 187 }, | |
| 188 | |
| 189 /** | |
| 190 * @param {!WebInspector.ConsoleMessage} msg | |
| 191 */ | |
| 192 addMessage: function(msg) | |
| 193 { | |
| 194 if (!msg.isErrorOrWarning() || !msg.messageText) | |
| 195 return; | |
| 196 | |
| 197 if (!this._messages) | |
| 198 this._messages = []; | |
| 199 this._messages.push(msg); | |
| 200 this.dispatchEventToListeners(WebInspector.Resource.Events.MessageAdded,
msg); | |
| 201 }, | |
| 202 | |
| 203 /** | |
| 204 * @return {number} | |
| 205 */ | |
| 206 get errors() | |
| 207 { | |
| 208 return this._errors || 0; | |
| 209 }, | |
| 210 | |
| 211 set errors(x) | |
| 212 { | |
| 213 this._errors = x; | |
| 214 }, | |
| 215 | |
| 216 /** | |
| 217 * @return {number} | |
| 218 */ | |
| 219 get warnings() | |
| 220 { | |
| 221 return this._warnings || 0; | |
| 222 }, | |
| 223 | |
| 224 set warnings(x) | |
| 225 { | |
| 226 this._warnings = x; | |
| 227 }, | |
| 228 | |
| 229 clearErrorsAndWarnings: function() | |
| 230 { | |
| 231 this._messages = []; | |
| 232 this._warnings = 0; | |
| 233 this._errors = 0; | |
| 234 this.dispatchEventToListeners(WebInspector.Resource.Events.MessagesClear
ed); | |
| 235 }, | |
| 236 | |
| 237 /** | |
| 238 * @return {?string} | 177 * @return {?string} |
| 239 */ | 178 */ |
| 240 get content() | 179 get content() |
| 241 { | 180 { |
| 242 return this._content; | 181 return this._content; |
| 243 }, | 182 }, |
| 244 | 183 |
| 245 /** | 184 /** |
| 246 * @return {boolean} | 185 * @return {boolean} |
| 247 */ | 186 */ |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (this._type.isTextType()) | 355 if (this._type.isTextType()) |
| 417 return true; | 356 return true; |
| 418 if (this._type === WebInspector.resourceTypes.Other) | 357 if (this._type === WebInspector.resourceTypes.Other) |
| 419 return !!this._content && !this._contentEncoded; | 358 return !!this._content && !this._contentEncoded; |
| 420 return false; | 359 return false; |
| 421 }, | 360 }, |
| 422 | 361 |
| 423 __proto__: WebInspector.SDKObject.prototype | 362 __proto__: WebInspector.SDKObject.prototype |
| 424 } | 363 } |
| 425 | 364 |
| OLD | NEW |