| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 this._agent.enable(); | 48 this._agent.enable(); |
| 49 | 49 |
| 50 this._fetchResourceTree(); | 50 this._fetchResourceTree(); |
| 51 | 51 |
| 52 target.registerPageDispatcher(new WebInspector.PageDispatcher(this)); | 52 target.registerPageDispatcher(new WebInspector.PageDispatcher(this)); |
| 53 | 53 |
| 54 this._securityOriginFrameCount = {}; | 54 this._securityOriginFrameCount = {}; |
| 55 this._inspectedPageURL = ""; | 55 this._inspectedPageURL = ""; |
| 56 this._pendingReloadOptions = null; | 56 this._pendingReloadOptions = null; |
| 57 this._reloadSuspensionCount = 0; | 57 this._reloadSuspensionCount = 0; |
| 58 |
| 59 target.runtimeModel.setExecutionContextComparator(this._executionContextComp
arator.bind(this)); |
| 58 } | 60 } |
| 59 | 61 |
| 60 WebInspector.ResourceTreeModel.EventTypes = { | 62 WebInspector.ResourceTreeModel.EventTypes = { |
| 61 FrameAdded: "FrameAdded", | 63 FrameAdded: "FrameAdded", |
| 62 FrameNavigated: "FrameNavigated", | 64 FrameNavigated: "FrameNavigated", |
| 63 FrameDetached: "FrameDetached", | 65 FrameDetached: "FrameDetached", |
| 64 FrameResized: "FrameResized", | 66 FrameResized: "FrameResized", |
| 65 FrameWillNavigate: "FrameWillNavigate", | 67 FrameWillNavigate: "FrameWillNavigate", |
| 66 MainFrameNavigated: "MainFrameNavigated", | 68 MainFrameNavigated: "MainFrameNavigated", |
| 67 ResourceAdded: "ResourceAdded", | 69 ResourceAdded: "ResourceAdded", |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 */ | 481 */ |
| 480 function myCallback(protocolError, url, errors, data) | 482 function myCallback(protocolError, url, errors, data) |
| 481 { | 483 { |
| 482 if (protocolError) { | 484 if (protocolError) { |
| 483 callback(url, null, []); | 485 callback(url, null, []); |
| 484 return; | 486 return; |
| 485 } | 487 } |
| 486 callback(url, data || null, errors); | 488 callback(url, data || null, errors); |
| 487 } | 489 } |
| 488 }, | 490 }, |
| 491 /** |
| 492 * @param {!WebInspector.ExecutionContext} a |
| 493 * @param {!WebInspector.ExecutionContext} b |
| 494 * @return {number} |
| 495 */ |
| 496 _executionContextComparator: function(a,b) |
| 497 { |
| 498 /** |
| 499 * @param {!WebInspector.ResourceTreeFrame} frame |
| 500 */ |
| 501 function framePath(frame) |
| 502 { |
| 503 var currentFrame = frame; |
| 504 var parents = []; |
| 505 while (currentFrame) { |
| 506 parents.push(currentFrame); |
| 507 currentFrame = currentFrame.parentFrame; |
| 508 } |
| 509 return parents.reverse(); |
| 510 } |
| 511 |
| 512 var framesA = a.frameId ? framePath(this.frameForId(a.frameId)) : []; |
| 513 var framesB = b.frameId ? framePath(this.frameForId(b.frameId)) : []; |
| 514 var frameA; |
| 515 var frameB; |
| 516 for (var i = 0; ; i++) { |
| 517 if (!framesA[i] || !framesB[i] || (framesA[i] !== framesB[i])) { |
| 518 frameA = framesA[i]; |
| 519 frameB = framesB[i]; |
| 520 break; |
| 521 } |
| 522 } |
| 523 if (!frameA && frameB) |
| 524 return -1; |
| 525 |
| 526 if (!frameB && frameA) |
| 527 return 1; |
| 528 |
| 529 if (frameA && frameB) { |
| 530 return frameA.id.localeCompare(frameB.id); |
| 531 } |
| 532 return WebInspector.ExecutionContext.comparator(a,b); |
| 533 }, |
| 489 | 534 |
| 490 __proto__: WebInspector.SDKModel.prototype | 535 __proto__: WebInspector.SDKModel.prototype |
| 491 } | 536 } |
| 492 | 537 |
| 493 /** | 538 /** |
| 494 * @constructor | 539 * @constructor |
| 495 * @param {!WebInspector.ResourceTreeModel} model | 540 * @param {!WebInspector.ResourceTreeModel} model |
| 496 * @param {?WebInspector.ResourceTreeFrame} parentFrame | 541 * @param {?WebInspector.ResourceTreeFrame} parentFrame |
| 497 * @param {!PageAgent.FrameId} frameId | 542 * @param {!PageAgent.FrameId} frameId |
| 498 * @param {!PageAgent.Frame=} payload | 543 * @param {!PageAgent.Frame=} payload |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 }, | 971 }, |
| 927 | 972 |
| 928 /** | 973 /** |
| 929 * @override | 974 * @override |
| 930 */ | 975 */ |
| 931 interstitialHidden: function() | 976 interstitialHidden: function() |
| 932 { | 977 { |
| 933 // Frontend is not interested in interstitials. | 978 // Frontend is not interested in interstitials. |
| 934 } | 979 } |
| 935 } | 980 } |
| OLD | NEW |