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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @suppressGlobalPropertiesCheck 33 * @suppressGlobalPropertiesCheck
34 */ 34 */
35 WebInspector.Main = function() 35 WebInspector.Main = function()
36 { 36 {
37 WebInspector.Main._instanceForTest = this; 37 WebInspector.Main._instanceForTest = this;
38 runOnWindowLoad(this._loaded.bind(this)); 38 runOnWindowLoad(this._loaded.bind(this));
39 } 39 };
40 40
41 WebInspector.Main.prototype = { 41 WebInspector.Main.prototype = {
42 _loaded: function() 42 _loaded: function()
43 { 43 {
44 console.timeStamp("Main._loaded"); 44 console.timeStamp("Main._loaded");
45 45
46 if (InspectorFrontendHost.isUnderTest()) 46 if (InspectorFrontendHost.isUnderTest())
47 self.runtime.useTestBase(); 47 self.runtime.useTestBase();
48 Runtime.setPlatform(WebInspector.platform()); 48 Runtime.setPlatform(WebInspector.platform());
49 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); 49 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this));
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 { 539 {
540 var hard = /** @type {boolean} */ (event.data); 540 var hard = /** @type {boolean} */ (event.data);
541 WebInspector.Main._reloadPage(hard); 541 WebInspector.Main._reloadPage(hard);
542 }, 542 },
543 543
544 _onSuspendStateChanged: function() 544 _onSuspendStateChanged: function()
545 { 545 {
546 var suspended = WebInspector.targetManager.allTargetsSuspended(); 546 var suspended = WebInspector.targetManager.allTargetsSuspended();
547 WebInspector.inspectorView.onSuspendStateChanged(suspended); 547 WebInspector.inspectorView.onSuspendStateChanged(suspended);
548 } 548 }
549 } 549 };
550 550
551 /** 551 /**
552 * @constructor 552 * @constructor
553 * @implements {InspectorAgent.Dispatcher} 553 * @implements {InspectorAgent.Dispatcher}
554 * @param {!WebInspector.Target} target 554 * @param {!WebInspector.Target} target
555 */ 555 */
556 WebInspector.Main.InspectorDomainDispatcher = function(target) 556 WebInspector.Main.InspectorDomainDispatcher = function(target)
557 { 557 {
558 this._target = target; 558 this._target = target;
559 } 559 };
560 560
561 WebInspector.Main.InspectorDomainDispatcher.prototype = { 561 WebInspector.Main.InspectorDomainDispatcher.prototype = {
562 /** 562 /**
563 * @override 563 * @override
564 * @param {string} reason 564 * @param {string} reason
565 */ 565 */
566 detached: function(reason) 566 detached: function(reason)
567 { 567 {
568 WebInspector._disconnectedScreenWithReasonWasShown = true; 568 WebInspector._disconnectedScreenWithReasonWasShown = true;
569 WebInspector.RemoteDebuggingTerminatedScreen.show(reason); 569 WebInspector.RemoteDebuggingTerminatedScreen.show(reason);
570 }, 570 },
571 571
572 /** 572 /**
573 * @override 573 * @override
574 */ 574 */
575 targetCrashed: function() 575 targetCrashed: function()
576 { 576 {
577 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); 577 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target);
578 if (debuggerModel) 578 if (debuggerModel)
579 WebInspector.TargetCrashedScreen.show(debuggerModel); 579 WebInspector.TargetCrashedScreen.show(debuggerModel);
580 } 580 }
581 } 581 };
582 582
583 583
584 /** 584 /**
585 * @constructor 585 * @constructor
586 * @implements {WebInspector.ActionDelegate} 586 * @implements {WebInspector.ActionDelegate}
587 */ 587 */
588 WebInspector.Main.ReloadActionDelegate = function() 588 WebInspector.Main.ReloadActionDelegate = function()
589 { 589 {
590 } 590 };
591 591
592 WebInspector.Main.ReloadActionDelegate.prototype = { 592 WebInspector.Main.ReloadActionDelegate.prototype = {
593 /** 593 /**
594 * @override 594 * @override
595 * @param {!WebInspector.Context} context 595 * @param {!WebInspector.Context} context
596 * @param {string} actionId 596 * @param {string} actionId
597 * @return {boolean} 597 * @return {boolean}
598 */ 598 */
599 handleAction: function(context, actionId) 599 handleAction: function(context, actionId)
600 { 600 {
601 switch (actionId) { 601 switch (actionId) {
602 case "main.reload": 602 case "main.reload":
603 WebInspector.Main._reloadPage(false); 603 WebInspector.Main._reloadPage(false);
604 return true; 604 return true;
605 case "main.hard-reload": 605 case "main.hard-reload":
606 WebInspector.Main._reloadPage(true); 606 WebInspector.Main._reloadPage(true);
607 return true; 607 return true;
608 case "main.debug-reload": 608 case "main.debug-reload":
609 WebInspector.reload(); 609 WebInspector.reload();
610 return true; 610 return true;
611 } 611 }
612 return false; 612 return false;
613 } 613 }
614 } 614 };
615 615
616 /** 616 /**
617 * @constructor 617 * @constructor
618 * @implements {WebInspector.ActionDelegate} 618 * @implements {WebInspector.ActionDelegate}
619 */ 619 */
620 WebInspector.Main.ZoomActionDelegate = function() 620 WebInspector.Main.ZoomActionDelegate = function()
621 { 621 {
622 } 622 };
623 623
624 WebInspector.Main.ZoomActionDelegate.prototype = { 624 WebInspector.Main.ZoomActionDelegate.prototype = {
625 /** 625 /**
626 * @override 626 * @override
627 * @param {!WebInspector.Context} context 627 * @param {!WebInspector.Context} context
628 * @param {string} actionId 628 * @param {string} actionId
629 * @return {boolean} 629 * @return {boolean}
630 */ 630 */
631 handleAction: function(context, actionId) 631 handleAction: function(context, actionId)
632 { 632 {
633 if (InspectorFrontendHost.isHostedMode()) 633 if (InspectorFrontendHost.isHostedMode())
634 return false; 634 return false;
635 635
636 switch (actionId) { 636 switch (actionId) {
637 case "main.zoom-in": 637 case "main.zoom-in":
638 InspectorFrontendHost.zoomIn(); 638 InspectorFrontendHost.zoomIn();
639 return true; 639 return true;
640 case "main.zoom-out": 640 case "main.zoom-out":
641 InspectorFrontendHost.zoomOut(); 641 InspectorFrontendHost.zoomOut();
642 return true; 642 return true;
643 case "main.zoom-reset": 643 case "main.zoom-reset":
644 InspectorFrontendHost.resetZoom(); 644 InspectorFrontendHost.resetZoom();
645 return true; 645 return true;
646 } 646 }
647 return false; 647 return false;
648 } 648 }
649 } 649 };
650 650
651 /** 651 /**
652 * @constructor 652 * @constructor
653 * @implements {WebInspector.ActionDelegate} 653 * @implements {WebInspector.ActionDelegate}
654 */ 654 */
655 WebInspector.Main.SearchActionDelegate = function() 655 WebInspector.Main.SearchActionDelegate = function()
656 { 656 {
657 } 657 };
658 658
659 WebInspector.Main.SearchActionDelegate.prototype = { 659 WebInspector.Main.SearchActionDelegate.prototype = {
660 /** 660 /**
661 * @override 661 * @override
662 * @param {!WebInspector.Context} context 662 * @param {!WebInspector.Context} context
663 * @param {string} actionId 663 * @param {string} actionId
664 * @return {boolean} 664 * @return {boolean}
665 * @suppressGlobalPropertiesCheck 665 * @suppressGlobalPropertiesCheck
666 */ 666 */
667 handleAction: function(context, actionId) 667 handleAction: function(context, actionId)
668 { 668 {
669 var searchableView = WebInspector.SearchableView.fromElement(document.de epActiveElement()) || WebInspector.inspectorView.currentPanelDeprecated().search ableView(); 669 var searchableView = WebInspector.SearchableView.fromElement(document.de epActiveElement()) || WebInspector.inspectorView.currentPanelDeprecated().search ableView();
670 if (!searchableView) 670 if (!searchableView)
671 return false; 671 return false;
672 switch (actionId) { 672 switch (actionId) {
673 case "main.search-in-panel.find": 673 case "main.search-in-panel.find":
674 return searchableView.handleFindShortcut(); 674 return searchableView.handleFindShortcut();
675 case "main.search-in-panel.cancel": 675 case "main.search-in-panel.cancel":
676 return searchableView.handleCancelSearchShortcut(); 676 return searchableView.handleCancelSearchShortcut();
677 case "main.search-in-panel.find-next": 677 case "main.search-in-panel.find-next":
678 return searchableView.handleFindNextShortcut(); 678 return searchableView.handleFindNextShortcut();
679 case "main.search-in-panel.find-previous": 679 case "main.search-in-panel.find-previous":
680 return searchableView.handleFindPreviousShortcut(); 680 return searchableView.handleFindPreviousShortcut();
681 } 681 }
682 return false; 682 return false;
683 } 683 }
684 } 684 };
685 685
686 /** 686 /**
687 * @param {boolean} hard 687 * @param {boolean} hard
688 */ 688 */
689 WebInspector.Main._reloadPage = function(hard) 689 WebInspector.Main._reloadPage = function(hard)
690 { 690 {
691 var mainTarget = WebInspector.targetManager.mainTarget(); 691 var mainTarget = WebInspector.targetManager.mainTarget();
692 if (mainTarget && mainTarget.hasBrowserCapability()) 692 if (mainTarget && mainTarget.hasBrowserCapability())
693 WebInspector.targetManager.reloadPage(hard); 693 WebInspector.targetManager.reloadPage(hard);
694 } 694 };
695 695
696 /** 696 /**
697 * @constructor 697 * @constructor
698 * @implements {WebInspector.ToolbarItem.Provider} 698 * @implements {WebInspector.ToolbarItem.Provider}
699 */ 699 */
700 WebInspector.Main.WarningErrorCounter = function() 700 WebInspector.Main.WarningErrorCounter = function()
701 { 701 {
702 WebInspector.Main.WarningErrorCounter._instanceForTest = this; 702 WebInspector.Main.WarningErrorCounter._instanceForTest = this;
703 703
704 this._counter = createElement("div"); 704 this._counter = createElement("div");
705 this._counter.addEventListener("click", WebInspector.console.show.bind(WebIn spector.console), false); 705 this._counter.addEventListener("click", WebInspector.console.show.bind(WebIn spector.console), false);
706 this._toolbarItem = new WebInspector.ToolbarItem(this._counter); 706 this._toolbarItem = new WebInspector.ToolbarItem(this._counter);
707 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(this._counter, "main/errorWarningCounter.css"); 707 var shadowRoot = WebInspector.createShadowRootWithCoreStyles(this._counter, "main/errorWarningCounter.css");
708 708
709 this._errors = this._createItem(shadowRoot, "error-icon"); 709 this._errors = this._createItem(shadowRoot, "error-icon");
710 this._revokedErrors = this._createItem(shadowRoot, "revokedError-icon"); 710 this._revokedErrors = this._createItem(shadowRoot, "revokedError-icon");
711 this._warnings = this._createItem(shadowRoot, "warning-icon"); 711 this._warnings = this._createItem(shadowRoot, "warning-icon");
712 this._titles = []; 712 this._titles = [];
713 713
714 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._update, this); 714 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.ConsoleCleared, this._update, this);
715 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._update, this); 715 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageAdded, this._update, this);
716 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageUpdated, this._update, this); 716 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo del.Events.MessageUpdated, this._update, this);
717 this._update(); 717 this._update();
718 } 718 };
719 719
720 WebInspector.Main.WarningErrorCounter.prototype = { 720 WebInspector.Main.WarningErrorCounter.prototype = {
721 /** 721 /**
722 * @param {!Node} shadowRoot 722 * @param {!Node} shadowRoot
723 * @param {string} iconType 723 * @param {string} iconType
724 * @return {!{item: !Element, text: !Element}} 724 * @return {!{item: !Element, text: !Element}}
725 */ 725 */
726 _createItem: function(shadowRoot, iconType) 726 _createItem: function(shadowRoot, iconType)
727 { 727 {
728 var item = createElementWithClass("span", "counter-item"); 728 var item = createElementWithClass("span", "counter-item");
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 }, 770 },
771 771
772 /** 772 /**
773 * @override 773 * @override
774 * @return {?WebInspector.ToolbarItem} 774 * @return {?WebInspector.ToolbarItem}
775 */ 775 */
776 item: function() 776 item: function()
777 { 777 {
778 return this._toolbarItem; 778 return this._toolbarItem;
779 } 779 }
780 } 780 };
781 781
782 /** 782 /**
783 * @constructor 783 * @constructor
784 * @implements {WebInspector.ToolbarItem.Provider} 784 * @implements {WebInspector.ToolbarItem.Provider}
785 */ 785 */
786 WebInspector.Main.MainMenuItem = function() 786 WebInspector.Main.MainMenuItem = function()
787 { 787 {
788 this._item = new WebInspector.ToolbarButton(WebInspector.UIString("Customize and control DevTools"), "menu-toolbar-item"); 788 this._item = new WebInspector.ToolbarButton(WebInspector.UIString("Customize and control DevTools"), "menu-toolbar-item");
789 this._item.addEventListener("mousedown", this._mouseDown, this); 789 this._item.addEventListener("mousedown", this._mouseDown, this);
790 } 790 };
791 791
792 WebInspector.Main.MainMenuItem.prototype = { 792 WebInspector.Main.MainMenuItem.prototype = {
793 /** 793 /**
794 * @override 794 * @override
795 * @return {?WebInspector.ToolbarItem} 795 * @return {?WebInspector.ToolbarItem}
796 */ 796 */
797 item: function() 797 item: function()
798 { 798 {
799 return this._item; 799 return this._item;
800 }, 800 },
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 var descriptor = extension.descriptor(); 851 var descriptor = extension.descriptor();
852 if (descriptor["persistence"] !== "closeable") 852 if (descriptor["persistence"] !== "closeable")
853 continue; 853 continue;
854 if (descriptor["location"] !== "drawer-view" && descriptor["location "] !== "panel") 854 if (descriptor["location"] !== "drawer-view" && descriptor["location "] !== "panel")
855 continue; 855 continue;
856 moreTools.appendItem(extension.title(), WebInspector.viewManager.sho wView.bind(WebInspector.viewManager, descriptor["id"])); 856 moreTools.appendItem(extension.title(), WebInspector.viewManager.sho wView.bind(WebInspector.viewManager, descriptor["id"]));
857 } 857 }
858 858
859 contextMenu.show(); 859 contextMenu.show();
860 } 860 }
861 } 861 };
862 862
863 /** 863 /**
864 * @constructor 864 * @constructor
865 */ 865 */
866 WebInspector.NetworkPanelIndicator = function() 866 WebInspector.NetworkPanelIndicator = function()
867 { 867 {
868 // TODO: we should not access network from other modules. 868 // TODO: we should not access network from other modules.
869 if (!WebInspector.inspectorView.hasPanel("network")) 869 if (!WebInspector.inspectorView.hasPanel("network"))
870 return; 870 return;
871 var manager = WebInspector.multitargetNetworkManager; 871 var manager = WebInspector.multitargetNetworkManager;
872 manager.addEventListener(WebInspector.MultitargetNetworkManager.Events.Condi tionsChanged, updateVisibility); 872 manager.addEventListener(WebInspector.MultitargetNetworkManager.Events.Condi tionsChanged, updateVisibility);
873 var blockedURLsSetting = WebInspector.moduleSetting("blockedURLs"); 873 var blockedURLsSetting = WebInspector.moduleSetting("blockedURLs");
874 blockedURLsSetting.addChangeListener(updateVisibility); 874 blockedURLsSetting.addChangeListener(updateVisibility);
875 updateVisibility(); 875 updateVisibility();
876 876
877 function updateVisibility() 877 function updateVisibility()
878 { 878 {
879 if (manager.isThrottling()) { 879 if (manager.isThrottling()) {
880 WebInspector.inspectorView.setPanelIcon("network", "warning-icon", W ebInspector.UIString("Network throttling is enabled")); 880 WebInspector.inspectorView.setPanelIcon("network", "warning-icon", W ebInspector.UIString("Network throttling is enabled"));
881 } else if (blockedURLsSetting.get().length) { 881 } else if (blockedURLsSetting.get().length) {
882 WebInspector.inspectorView.setPanelIcon("network", "warning-icon", W ebInspector.UIString("Requests may be blocked")); 882 WebInspector.inspectorView.setPanelIcon("network", "warning-icon", W ebInspector.UIString("Requests may be blocked"));
883 } else { 883 } else {
884 WebInspector.inspectorView.setPanelIcon("network", "", ""); 884 WebInspector.inspectorView.setPanelIcon("network", "", "");
885 } 885 }
886 } 886 }
887 } 887 };
888 888
889 /** 889 /**
890 * @constructor 890 * @constructor
891 */ 891 */
892 WebInspector.SourcesPanelIndicator = function() 892 WebInspector.SourcesPanelIndicator = function()
893 { 893 {
894 WebInspector.moduleSetting("javaScriptDisabled").addChangeListener(javaScrip tDisabledChanged); 894 WebInspector.moduleSetting("javaScriptDisabled").addChangeListener(javaScrip tDisabledChanged);
895 javaScriptDisabledChanged(); 895 javaScriptDisabledChanged();
896 896
897 function javaScriptDisabledChanged() 897 function javaScriptDisabledChanged()
898 { 898 {
899 var javaScriptDisabled = WebInspector.moduleSetting("javaScriptDisabled" ).get(); 899 var javaScriptDisabled = WebInspector.moduleSetting("javaScriptDisabled" ).get();
900 if (javaScriptDisabled) { 900 if (javaScriptDisabled) {
901 WebInspector.inspectorView.setPanelIcon("sources", "warning-icon", W ebInspector.UIString("JavaScript is disabled")); 901 WebInspector.inspectorView.setPanelIcon("sources", "warning-icon", W ebInspector.UIString("JavaScript is disabled"));
902 } else { 902 } else {
903 WebInspector.inspectorView.setPanelIcon("sources", "", ""); 903 WebInspector.inspectorView.setPanelIcon("sources", "", "");
904 } 904 }
905 } 905 }
906 } 906 };
907 907
908 /** 908 /**
909 * @constructor 909 * @constructor
910 */ 910 */
911 WebInspector.Main.PauseListener = function() 911 WebInspector.Main.PauseListener = function()
912 { 912 {
913 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); 913 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
914 } 914 };
915 915
916 WebInspector.Main.PauseListener.prototype = { 916 WebInspector.Main.PauseListener.prototype = {
917 /** 917 /**
918 * @param {!WebInspector.Event} event 918 * @param {!WebInspector.Event} event
919 */ 919 */
920 _debuggerPaused: function(event) 920 _debuggerPaused: function(event)
921 { 921 {
922 WebInspector.targetManager.removeModelListener(WebInspector.DebuggerMode l, WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this) ; 922 WebInspector.targetManager.removeModelListener(WebInspector.DebuggerMode l, WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this) ;
923 var debuggerPausedDetails = /** @type {!WebInspector.DebuggerPausedDetai ls} */ (event.data); 923 var debuggerPausedDetails = /** @type {!WebInspector.DebuggerPausedDetai ls} */ (event.data);
924 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.ta rget); 924 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.ta rget);
925 WebInspector.context.setFlavor(WebInspector.Target, debuggerModel.target ()); 925 WebInspector.context.setFlavor(WebInspector.Target, debuggerModel.target ());
926 WebInspector.Revealer.reveal(debuggerPausedDetails); 926 WebInspector.Revealer.reveal(debuggerPausedDetails);
927 } 927 }
928 } 928 };
929 929
930 /** 930 /**
931 * @constructor 931 * @constructor
932 */ 932 */
933 WebInspector.Main.InspectedNodeRevealer = function() 933 WebInspector.Main.InspectedNodeRevealer = function()
934 { 934 {
935 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeInspected, this._inspectNode, this); 935 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec tor.DOMModel.Events.NodeInspected, this._inspectNode, this);
936 } 936 };
937 937
938 WebInspector.Main.InspectedNodeRevealer.prototype = { 938 WebInspector.Main.InspectedNodeRevealer.prototype = {
939 /** 939 /**
940 * @param {!WebInspector.Event} event 940 * @param {!WebInspector.Event} event
941 */ 941 */
942 _inspectNode: function(event) 942 _inspectNode: function(event)
943 { 943 {
944 var deferredNode = /** @type {!WebInspector.DeferredDOMNode} */ (event.d ata); 944 var deferredNode = /** @type {!WebInspector.DeferredDOMNode} */ (event.d ata);
945 WebInspector.Revealer.reveal(deferredNode); 945 WebInspector.Revealer.reveal(deferredNode);
946 } 946 }
947 } 947 };
948 948
949 /** 949 /**
950 * @param {string} method 950 * @param {string} method
951 * @param {?Object} params 951 * @param {?Object} params
952 * @return {!Promise} 952 * @return {!Promise}
953 */ 953 */
954 WebInspector.sendOverProtocol = function(method, params) 954 WebInspector.sendOverProtocol = function(method, params)
955 { 955 {
956 var connection = WebInspector.targetManager.mainTarget().connection(); 956 var connection = WebInspector.targetManager.mainTarget().connection();
957 return new Promise((resolve, reject) => { 957 return new Promise((resolve, reject) => {
958 connection.sendRawMessageForTesting(method, params, (err, result) => { 958 connection.sendRawMessageForTesting(method, params, (err, result) => {
959 if (err) 959 if (err)
960 return reject(err); 960 return reject(err);
961 return resolve(result); 961 return resolve(result);
962 }); 962 });
963 }); 963 });
964 } 964 };
965 965
966 /** 966 /**
967 * @constructor 967 * @constructor
968 * @extends {WebInspector.VBox} 968 * @extends {WebInspector.VBox}
969 * @param {string} reason 969 * @param {string} reason
970 */ 970 */
971 WebInspector.RemoteDebuggingTerminatedScreen = function(reason) 971 WebInspector.RemoteDebuggingTerminatedScreen = function(reason)
972 { 972 {
973 WebInspector.VBox.call(this, true); 973 WebInspector.VBox.call(this, true);
974 this.registerRequiredCSS("main/remoteDebuggingTerminatedScreen.css"); 974 this.registerRequiredCSS("main/remoteDebuggingTerminatedScreen.css");
975 var message = this.contentElement.createChild("div", "message"); 975 var message = this.contentElement.createChild("div", "message");
976 message.createChild("span").textContent = WebInspector.UIString("Debugging c onnection was closed. Reason: "); 976 message.createChild("span").textContent = WebInspector.UIString("Debugging c onnection was closed. Reason: ");
977 message.createChild("span", "reason").textContent = reason; 977 message.createChild("span", "reason").textContent = reason;
978 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("Reconnect when ready by reopening DevTools."); 978 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("Reconnect when ready by reopening DevTools.");
979 var button = createTextButton(WebInspector.UIString("Reconnect DevTools"), ( ) => window.location.reload()); 979 var button = createTextButton(WebInspector.UIString("Reconnect DevTools"), ( ) => window.location.reload());
980 this.contentElement.createChild("div", "button").appendChild(button); 980 this.contentElement.createChild("div", "button").appendChild(button);
981 } 981 };
982 982
983 /** 983 /**
984 * @param {string} reason 984 * @param {string} reason
985 */ 985 */
986 WebInspector.RemoteDebuggingTerminatedScreen.show = function(reason) 986 WebInspector.RemoteDebuggingTerminatedScreen.show = function(reason)
987 { 987 {
988 var dialog = new WebInspector.Dialog(); 988 var dialog = new WebInspector.Dialog();
989 dialog.setWrapsContent(true); 989 dialog.setWrapsContent(true);
990 dialog.addCloseButton(); 990 dialog.addCloseButton();
991 dialog.setDimmed(true); 991 dialog.setDimmed(true);
992 new WebInspector.RemoteDebuggingTerminatedScreen(reason).show(dialog.element ); 992 new WebInspector.RemoteDebuggingTerminatedScreen(reason).show(dialog.element );
993 dialog.show(); 993 dialog.show();
994 } 994 };
995 995
996 WebInspector.RemoteDebuggingTerminatedScreen.prototype = { 996 WebInspector.RemoteDebuggingTerminatedScreen.prototype = {
997 __proto__: WebInspector.VBox.prototype 997 __proto__: WebInspector.VBox.prototype
998 } 998 };
999 999
1000 /** 1000 /**
1001 * @constructor 1001 * @constructor
1002 * @param {function()} hideCallback 1002 * @param {function()} hideCallback
1003 * @extends {WebInspector.VBox} 1003 * @extends {WebInspector.VBox}
1004 */ 1004 */
1005 WebInspector.TargetCrashedScreen = function(hideCallback) 1005 WebInspector.TargetCrashedScreen = function(hideCallback)
1006 { 1006 {
1007 WebInspector.VBox.call(this, true); 1007 WebInspector.VBox.call(this, true);
1008 this.registerRequiredCSS("main/targetCrashedScreen.css"); 1008 this.registerRequiredCSS("main/targetCrashedScreen.css");
1009 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("DevTools was disconnected from the page."); 1009 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("DevTools was disconnected from the page.");
1010 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("Once page is reloaded, DevTools will automatically reconnect."); 1010 this.contentElement.createChild("div", "message").textContent = WebInspector .UIString("Once page is reloaded, DevTools will automatically reconnect.");
1011 this._hideCallback = hideCallback; 1011 this._hideCallback = hideCallback;
1012 } 1012 };
1013 1013
1014 /** 1014 /**
1015 * @param {!WebInspector.DebuggerModel} debuggerModel 1015 * @param {!WebInspector.DebuggerModel} debuggerModel
1016 */ 1016 */
1017 WebInspector.TargetCrashedScreen.show = function(debuggerModel) 1017 WebInspector.TargetCrashedScreen.show = function(debuggerModel)
1018 { 1018 {
1019 var dialog = new WebInspector.Dialog(); 1019 var dialog = new WebInspector.Dialog();
1020 dialog.setWrapsContent(true); 1020 dialog.setWrapsContent(true);
1021 dialog.addCloseButton(); 1021 dialog.addCloseButton();
1022 dialog.setDimmed(true); 1022 dialog.setDimmed(true);
1023 var hideBound = dialog.detach.bind(dialog); 1023 var hideBound = dialog.detach.bind(dialog);
1024 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, hideBound); 1024 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec tCleared, hideBound);
1025 1025
1026 new WebInspector.TargetCrashedScreen(onHide).show(dialog.element); 1026 new WebInspector.TargetCrashedScreen(onHide).show(dialog.element);
1027 dialog.show(); 1027 dialog.show();
1028 1028
1029 function onHide() 1029 function onHide()
1030 { 1030 {
1031 debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.Glob alObjectCleared, hideBound); 1031 debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.Glob alObjectCleared, hideBound);
1032 } 1032 }
1033 } 1033 };
1034 1034
1035 WebInspector.TargetCrashedScreen.prototype = { 1035 WebInspector.TargetCrashedScreen.prototype = {
1036 /** 1036 /**
1037 * @override 1037 * @override
1038 */ 1038 */
1039 willHide: function() 1039 willHide: function()
1040 { 1040 {
1041 this._hideCallback.call(null); 1041 this._hideCallback.call(null);
1042 }, 1042 },
1043 1043
1044 __proto__: WebInspector.VBox.prototype 1044 __proto__: WebInspector.VBox.prototype
1045 } 1045 };
1046 1046
1047 /** 1047 /**
1048 * @constructor 1048 * @constructor
1049 * @implements {WebInspector.TargetManager.Observer} 1049 * @implements {WebInspector.TargetManager.Observer}
1050 */ 1050 */
1051 WebInspector.BackendSettingsSync = function() 1051 WebInspector.BackendSettingsSync = function()
1052 { 1052 {
1053 this._autoAttachSetting = WebInspector.settings.moduleSetting("autoAttachToC reatedPages"); 1053 this._autoAttachSetting = WebInspector.settings.moduleSetting("autoAttachToC reatedPages");
1054 this._autoAttachSetting.addChangeListener(this._update, this); 1054 this._autoAttachSetting.addChangeListener(this._update, this);
1055 this._disableJavascriptSetting = WebInspector.settings.moduleSetting("javaSc riptDisabled"); 1055 this._disableJavascriptSetting = WebInspector.settings.moduleSetting("javaSc riptDisabled");
1056 this._disableJavascriptSetting.addChangeListener(this._update, this); 1056 this._disableJavascriptSetting.addChangeListener(this._update, this);
1057 this._blockedEventsWarningSetting = WebInspector.settings.moduleSetting("blo ckedEventsWarningEnabled"); 1057 this._blockedEventsWarningSetting = WebInspector.settings.moduleSetting("blo ckedEventsWarningEnabled");
1058 this._blockedEventsWarningSetting.addChangeListener(this._update, this); 1058 this._blockedEventsWarningSetting.addChangeListener(this._update, this);
1059 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser); 1059 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili ty.Browser);
1060 } 1060 };
1061 1061
1062 WebInspector.BackendSettingsSync.prototype = { 1062 WebInspector.BackendSettingsSync.prototype = {
1063 /** 1063 /**
1064 * @param {!WebInspector.Target} target 1064 * @param {!WebInspector.Target} target
1065 */ 1065 */
1066 _updateTarget: function(target) 1066 _updateTarget: function(target)
1067 { 1067 {
1068 var blockedEventsWarningThresholdSeconds = 0.1; 1068 var blockedEventsWarningThresholdSeconds = 0.1;
1069 target.pageAgent().setBlockedEventsWarningThreshold(this._blockedEventsW arningSetting.get() ? blockedEventsWarningThresholdSeconds : 0); 1069 target.pageAgent().setBlockedEventsWarningThreshold(this._blockedEventsW arningSetting.get() ? blockedEventsWarningThresholdSeconds : 0);
1070 target.pageAgent().setAutoAttachToCreatedPages(this._autoAttachSetting.g et()); 1070 target.pageAgent().setAutoAttachToCreatedPages(this._autoAttachSetting.g et());
(...skipping 15 matching lines...) Expand all
1086 target.renderingAgent().setShowViewportSizeOnResize(true); 1086 target.renderingAgent().setShowViewportSizeOnResize(true);
1087 }, 1087 },
1088 1088
1089 /** 1089 /**
1090 * @param {!WebInspector.Target} target 1090 * @param {!WebInspector.Target} target
1091 * @override 1091 * @override
1092 */ 1092 */
1093 targetRemoved: function(target) 1093 targetRemoved: function(target)
1094 { 1094 {
1095 } 1095 }
1096 } 1096 };
1097 1097
1098 /** 1098 /**
1099 * @constructor 1099 * @constructor
1100 * @implements {WebInspector.SettingUI} 1100 * @implements {WebInspector.SettingUI}
1101 */ 1101 */
1102 WebInspector.ShowMetricsRulersSettingUI = function() 1102 WebInspector.ShowMetricsRulersSettingUI = function()
1103 { 1103 {
1104 } 1104 };
1105 1105
1106 WebInspector.ShowMetricsRulersSettingUI.prototype = { 1106 WebInspector.ShowMetricsRulersSettingUI.prototype = {
1107 /** 1107 /**
1108 * @override 1108 * @override
1109 * @return {?Element} 1109 * @return {?Element}
1110 */ 1110 */
1111 settingElement: function() 1111 settingElement: function()
1112 { 1112 {
1113 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers")); 1113 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers"));
1114 } 1114 }
1115 } 1115 };
1116 1116
1117 new WebInspector.Main(); 1117 new WebInspector.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698