OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 397 |
398 results.push(property); | 398 results.push(property); |
399 } | 399 } |
400 completionsReadyCallback(results); | 400 completionsReadyCallback(results); |
401 }, | 401 }, |
402 | 402 |
403 __proto__: WebInspector.TargetAware.prototype | 403 __proto__: WebInspector.TargetAware.prototype |
404 } | 404 } |
405 | 405 |
406 /** | 406 /** |
407 * @constructor | |
408 * @extends {WebInspector.TargetAwareObject} | |
409 * @param {!WebInspector.Target} target | |
410 */ | |
411 WebInspector.ExecutionContextList = function(target) | |
412 { | |
413 WebInspector.TargetAwareObject.call(this, target); | |
414 this._executionContexts = []; | |
415 } | |
416 | |
417 WebInspector.ExecutionContextList.EventTypes = { | |
418 Reset: "Reset", | |
419 ContextAdded: "ContextAdded" | |
420 } | |
421 | |
422 WebInspector.ExecutionContextList.prototype = | |
423 { | |
424 _reset: function() | |
425 { | |
426 this._executionContexts = []; | |
427 this.dispatchEventToListeners(WebInspector.ExecutionContextList.EventTyp
es.Reset, this); | |
428 }, | |
429 | |
430 /** | |
431 * @param {!WebInspector.ExecutionContext} context | |
432 */ | |
433 _addExecutionContext: function(context) | |
434 { | |
435 var insertAt = insertionIndexForObjectInListSortedByFunction(context, th
is._executionContexts, WebInspector.ExecutionContext.comparator); | |
436 this._executionContexts.splice(insertAt, 0, context); | |
437 this.dispatchEventToListeners(WebInspector.ExecutionContextList.EventTyp
es.ContextAdded, this); | |
438 }, | |
439 | |
440 /** | |
441 * @return {!Array.<!WebInspector.ExecutionContext>} | |
442 */ | |
443 executionContexts: function() | |
444 { | |
445 return this._executionContexts; | |
446 }, | |
447 | |
448 /** | |
449 * @return {!WebInspector.ExecutionContext} | |
450 */ | |
451 mainWorldContext: function() | |
452 { | |
453 return this._executionContexts[0]; | |
454 }, | |
455 | |
456 /** | |
457 * @param {string} securityOrigin | |
458 * @return {?WebInspector.ExecutionContext} | |
459 */ | |
460 contextBySecurityOrigin: function(securityOrigin) | |
461 { | |
462 for (var i = 0; i < this._executionContexts.length; ++i) { | |
463 var context = this._executionContexts[i]; | |
464 if (!context.isMainWorldContext && context.name === securityOrigin) | |
465 return context; | |
466 } | |
467 return null; | |
468 }, | |
469 | |
470 /** | |
471 * @return {string} | |
472 */ | |
473 id: function() | |
474 { | |
475 // Overridden by subclasses | |
476 throw "Not implemented"; | |
477 }, | |
478 | |
479 /** | |
480 * @return {string} | |
481 */ | |
482 url: function() | |
483 { | |
484 // Overridden by subclasses | |
485 throw "Not implemented"; | |
486 }, | |
487 | |
488 /** | |
489 * @return {string} | |
490 */ | |
491 displayName: function() | |
492 { | |
493 // Overridden by subclasses | |
494 throw "Not implemented"; | |
495 }, | |
496 | |
497 __proto__: WebInspector.TargetAwareObject.prototype | |
498 } | |
499 | |
500 | |
501 /** | |
502 * @constructor | |
503 * @extends {WebInspector.ExecutionContextList} | |
504 * @param {!WebInspector.Target} target | |
505 * @param {!WebInspector.ResourceTreeFrame} frame | |
506 */ | |
507 WebInspector.FrameExecutionContextList = function(target, frame) | |
508 { | |
509 WebInspector.ExecutionContextList.call(this, target); | |
510 this._frame = frame; | |
511 } | |
512 | |
513 WebInspector.FrameExecutionContextList.prototype = { | |
514 /** | |
515 * @param {!WebInspector.ResourceTreeFrame} frame | |
516 */ | |
517 _frameNavigated: function(frame) | |
518 { | |
519 this._frame = frame; | |
520 this._reset(); | |
521 }, | |
522 | |
523 /** | |
524 * @return {string} | |
525 */ | |
526 id: function() | |
527 { | |
528 return this._frame.id; | |
529 }, | |
530 | |
531 /** | |
532 * @return {string} | |
533 */ | |
534 url: function() | |
535 { | |
536 return this._frame.url; | |
537 }, | |
538 | |
539 /** | |
540 * @return {string} | |
541 */ | |
542 displayName: function() | |
543 { | |
544 return this._frame.displayName(); | |
545 }, | |
546 | |
547 __proto__: WebInspector.ExecutionContextList.prototype | |
548 } | |
549 | |
550 /** | |
551 * @constructor | |
552 * @extends {WebInspector.ExecutionContextList} | |
553 * @param {!WebInspector.Target} target | |
554 * @param {string} id | |
555 * @param {string} url | |
556 */ | |
557 WebInspector.WorkerExecutionContextList = function(target, id, url) | |
558 { | |
559 WebInspector.ExecutionContextList.call(this, target); | |
560 this._url = url; | |
561 this._id = id; | |
562 } | |
563 | |
564 WebInspector.WorkerExecutionContextList.prototype = { | |
565 | |
566 /** | |
567 * @return {string} | |
568 */ | |
569 id: function() | |
570 { | |
571 return this._id; | |
572 }, | |
573 | |
574 /** | |
575 * @return {string} | |
576 */ | |
577 url: function() | |
578 { | |
579 return this._url; | |
580 }, | |
581 | |
582 /** | |
583 * @return {string} | |
584 */ | |
585 displayName: function() | |
586 { | |
587 return this._url; | |
588 }, | |
589 | |
590 __proto__: WebInspector.ExecutionContextList.prototype | |
591 } | |
592 | |
593 /** | |
594 * @type {!WebInspector.RuntimeModel} | 407 * @type {!WebInspector.RuntimeModel} |
595 */ | 408 */ |
596 WebInspector.runtimeModel; | 409 WebInspector.runtimeModel; |
OLD | NEW |