@@ -142,6 +142,7 @@ window.cls.Client = function()
142142
143143 this . setup = function ( )
144144 {
145+ window . services . scope . reset ( ) ;
145146 var port = _get_port_number ( ) ;
146147 var client = {
147148 id : clients . length + 1 ,
@@ -157,6 +158,7 @@ window.cls.Client = function()
157158 {
158159 // implement the scope DOM API
159160 cls . ScopeHTTPInterface . call ( opera /*, force_stp_0 */ ) ;
161+ cls . ScopeHTTPInterface . is_enabled = true ;
160162 }
161163
162164 if ( ! opera . stpVersion )
@@ -333,8 +335,12 @@ window.cls.Client = function()
333335 new CompositeView ( 'console_panel' ,
334336 ui_strings . M_VIEW_LABEL_COMMAND_LINE ,
335337 layouts . console_rough_layout ) ;
336-
337- } ;
338+ new CompositeView ( 'profiler_mode' ,
339+ ui_strings . M_VIEW_LABEL_PROFILER ,
340+ layouts . profiler_rough_layout ,
341+ null ,
342+ services ) ;
343+ }
338344
339345 this . create_window_controls = function ( )
340346 {
@@ -361,7 +367,8 @@ window.cls.Client = function()
361367 controls . push ( new Button ( "top-window-close" , "" , ui_strings . S_BUTTON_LABEL_CLOSE_WINDOW ) ) ;
362368 }
363369
364- document . documentElement . render ( templates . window_controls ( controls ) ) ;
370+ var win_ctrls = document . documentElement . render ( templates . window_controls ( controls ) ) ;
371+ window . messages . post ( "window-controls-created" , { window_controls : win_ctrls } ) ;
365372
366373 var button = UI . get_instance ( ) . get_button ( "toggle-remote-debug-overlay" ) ;
367374 if ( this . current_client && this . connection_is_remote ( this . current_client ) )
@@ -450,31 +457,41 @@ window.cls.Client = function()
450457 if ( last_selected_view )
451458 {
452459 var esdi = window . services [ 'ecmascript-debugger' ] ;
453- var cb = this . _on_ecmascript_enabled . bind ( this , last_selected_view ) ;
454- esdi . add_listener ( 'enable-success' , cb ) ;
460+ this . _on_profile_enabled_cb = this . _profile_enabled . bind ( this , last_selected_view ) ;
461+ window . messages . addListener ( "profile-enabled" , this . _on_profile_enabled_cb ) ;
455462 }
456463 } ;
457464
458- this . _on_ecmascript_enabled = function ( last_selected_view )
465+ this . _profile_enabled = function ( last_selected_view , msg )
459466 {
460- var tag = tagManager . set_callback ( null , function ( status , message )
467+ if ( msg . profile == window . app . profiles . DEFAULT )
461468 {
462- const OBJECT_ID = 0 ;
463- if ( ! message [ OBJECT_ID ] )
469+ var tag = window . tag_manager . set_callback ( this , function ( status , message )
464470 {
465- // if last_selected_view is hidden and the tab has a fallback_view_id, use that.
466- if (
467- views [ last_selected_view ] &&
468- views [ last_selected_view ] . is_hidden &&
469- views [ last_selected_view ] . fallback_view_id
470- )
471- {
472- last_selected_view = views [ last_selected_view ] . fallback_view_id ;
473- }
474- UI . get_instance ( ) . show_view ( last_selected_view ) ;
475- }
476- } ) ;
477- window . services [ 'ecmascript-debugger' ] . requestGetSelectedObject ( tag ) ;
471+ const OBJECT_ID = 0 ;
472+ if ( ! message [ OBJECT_ID ] )
473+ this . _show_last_selected_view ( last_selected_view ) ;
474+ } ) ;
475+ var esdi = window . services [ "ecmascript-debugger" ] ;
476+ esdi . requestGetSelectedObject ( tag ) ;
477+ }
478+ else
479+ this . _show_last_selected_view ( last_selected_view ) ;
480+
481+ window . messages . removeListener ( "profile-enabled" , this . _on_profile_enabled_cb ) ;
482+
483+ } ;
484+
485+ this . _show_last_selected_view = function ( last_selected_view )
486+ {
487+ // if last_selected_view is hidden and the tab has a fallback_view_id, use that.
488+ if ( window . views [ last_selected_view ] &&
489+ window . views [ last_selected_view ] . is_hidden &&
490+ window . views [ last_selected_view ] . fallback_view_id )
491+ {
492+ last_selected_view = window . views [ last_selected_view ] . fallback_view_id ;
493+ }
494+ UI . get_instance ( ) . show_view ( last_selected_view ) ;
478495 } ;
479496
480497 window . app . addListener ( 'services-created' , this . on_services_created . bind ( this ) ) ;
@@ -498,7 +515,15 @@ ui_framework.layouts.error_console_rough_layout =
498515 ]
499516 }
500517 ]
501- } ;
518+ }
519+
520+ ui_framework . layouts . profiler_rough_layout =
521+ {
522+ dir : 'v' ,
523+ width : 1000 ,
524+ height : 1000 ,
525+ children : [ { height : 1000 , tabbar : { tabs : [ "profiler_all" ] , is_hidden : true } } ]
526+ }
502527
503528ui_framework . layouts . environment_rough_layout =
504529{
@@ -657,6 +682,7 @@ ui_framework.layouts.main_layout =
657682 'network_mode' ,
658683 'resource_panel' ,
659684 'storage' ,
685+ 'profiler_mode' ,
660686 { view : 'console_mode' , tab_class : ErrorConsoleTab } ,
661687 'utils' ,
662688 'console_panel'
0 commit comments