gecko/browser/devtools/webconsole/test/browser_gcli_web.js
Ed Morley f9869b4f92 Bug 692625 - Move browser/devtools/webconsole/test/browser/ to browser/devtools/webconsole/test/; r=rcampbell
--HG--
rename : browser/devtools/webconsole/test/browser/Makefile.in => browser/devtools/webconsole/test/Makefile.in
rename : browser/devtools/webconsole/test/browser/browser_gcli_inspect.html => browser/devtools/webconsole/test/browser_gcli_inspect.html
rename : browser/devtools/webconsole/test/browser/browser_gcli_inspect.js => browser/devtools/webconsole/test/browser_gcli_inspect.js
rename : browser/devtools/webconsole/test/browser/browser_gcli_integrate.js => browser/devtools/webconsole/test/browser_gcli_integrate.js
rename : browser/devtools/webconsole/test/browser/browser_gcli_require.js => browser/devtools/webconsole/test/browser_gcli_require.js
rename : browser/devtools/webconsole/test/browser/browser_gcli_web.js => browser/devtools/webconsole/test/browser_gcli_web.js
rename : browser/devtools/webconsole/test/browser/browser_warn_user_about_replaced_api.js => browser/devtools/webconsole/test/browser_warn_user_about_replaced_api.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_abbreviate_source_url.js => browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_basic_net_logging.js => browser/devtools/webconsole/test/browser_webconsole_basic_net_logging.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_578437_page_reload.js => browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_579412_input_focus.js => browser/devtools/webconsole/test/browser_webconsole_bug_579412_input_focus.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_580001_closing_after_completion.js => browser/devtools/webconsole/test/browser_webconsole_bug_580001_closing_after_completion.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_580030_errors_after_page_reload.js => browser/devtools/webconsole/test/browser_webconsole_bug_580030_errors_after_page_reload.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_580400_groups.js => browser/devtools/webconsole/test/browser_webconsole_bug_580400_groups.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_580454_timestamp_l10n.js => browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_581231_close_button.js => browser/devtools/webconsole/test/browser_webconsole_bug_581231_close_button.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_582201_duplicate_errors.js => browser/devtools/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_583816_tab_focus.js => browser/devtools/webconsole/test/browser_webconsole_bug_583816_tab_focus.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_585237_line_limit.js => browser/devtools/webconsole/test/browser_webconsole_bug_585237_line_limit.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_585956_console_trace.js => browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_585991_autocomplete_keys.js => browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_585991_autocomplete_popup.js => browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_popup.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_586388_select_all.js => browser/devtools/webconsole/test/browser_webconsole_bug_586388_select_all.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_587617_output_copy.js => browser/devtools/webconsole/test/browser_webconsole_bug_587617_output_copy.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_588342_document_focus.js => browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_588730_text_node_insertion.js => browser/devtools/webconsole/test/browser_webconsole_bug_588730_text_node_insertion.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_588967_input_expansion.js => browser/devtools/webconsole/test/browser_webconsole_bug_588967_input_expansion.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_589162_css_filter.js => browser/devtools/webconsole/test/browser_webconsole_bug_589162_css_filter.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_592442_closing_brackets.js => browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_593003_iframe_wrong_hud.js => browser/devtools/webconsole/test/browser_webconsole_bug_593003_iframe_wrong_hud.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_594477_clickable_output.js => browser/devtools/webconsole/test/browser_webconsole_bug_594477_clickable_output.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_594497_history_arrow_keys.js => browser/devtools/webconsole/test/browser_webconsole_bug_594497_history_arrow_keys.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_595223_file_uri.js => browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_595350_multiple_windows_and_tabs.js => browser/devtools/webconsole/test/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_595934_message_categories.js => browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js => browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_external_script_errors.js => browser/devtools/webconsole/test/browser_webconsole_bug_597136_external_script_errors.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_network_requests_from_chrome.js => browser/devtools/webconsole/test/browser_webconsole_bug_597136_network_requests_from_chrome.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_597460_filter_scroll.js => browser/devtools/webconsole/test/browser_webconsole_bug_597460_filter_scroll.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_597756_reopen_closed_tab.js => browser/devtools/webconsole/test/browser_webconsole_bug_597756_reopen_closed_tab.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_598357_jsterm_output.js => browser/devtools/webconsole/test/browser_webconsole_bug_598357_jsterm_output.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_599725_response_headers.js => browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_600183_charset.js => browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_601177_log_levels.js => browser/devtools/webconsole/test/browser_webconsole_bug_601177_log_levels.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_601352_scroll.js => browser/devtools/webconsole/test/browser_webconsole_bug_601352_scroll.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_601667_filter_buttons.js => browser/devtools/webconsole/test/browser_webconsole_bug_601667_filter_buttons.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_601909_remember_height.js => browser/devtools/webconsole/test/browser_webconsole_bug_601909_remember_height.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_602572_log_bodies_checkbox.js => browser/devtools/webconsole/test/browser_webconsole_bug_602572_log_bodies_checkbox.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_603750_websocket.js => browser/devtools/webconsole/test/browser_webconsole_bug_603750_websocket.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_611795.js => browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_613013_console_api_iframe.js => browser/devtools/webconsole/test/browser_webconsole_bug_613013_console_api_iframe.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_613280_jsterm_copy.js => browser/devtools/webconsole/test/browser_webconsole_bug_613280_jsterm_copy.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_613642_maintain_scroll.js => browser/devtools/webconsole/test/browser_webconsole_bug_613642_maintain_scroll.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_613642_prune_scroll.js => browser/devtools/webconsole/test/browser_webconsole_bug_613642_prune_scroll.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_614793_jsterm_scroll.js => browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_618078_network_exceptions.js => browser/devtools/webconsole/test/browser_webconsole_bug_618078_network_exceptions.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_618311_close_panels.js => browser/devtools/webconsole/test/browser_webconsole_bug_618311_close_panels.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_618311_private_browsing.js => browser/devtools/webconsole/test/browser_webconsole_bug_618311_private_browsing.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_621644_jsterm_dollar.js => browser/devtools/webconsole/test/browser_webconsole_bug_621644_jsterm_dollar.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_622303_persistent_filters.js => browser/devtools/webconsole/test/browser_webconsole_bug_622303_persistent_filters.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_626484_output_copy_order.js => browser/devtools/webconsole/test/browser_webconsole_bug_626484_output_copy_order.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_630733_response_redirect_headers.js => browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_632275_getters_document_width.js => browser/devtools/webconsole/test/browser_webconsole_bug_632275_getters_document_width.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_632347_iterators_generators.js => browser/devtools/webconsole/test/browser_webconsole_bug_632347_iterators_generators.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_632817.js => browser/devtools/webconsole/test/browser_webconsole_bug_632817.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_642108_pruneTest.js => browser/devtools/webconsole/test/browser_webconsole_bug_642108_pruneTest.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_642615_autocomplete.js => browser/devtools/webconsole/test/browser_webconsole_bug_642615_autocomplete.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_644419_log_limits.js => browser/devtools/webconsole/test/browser_webconsole_bug_644419_log_limits.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_646025_console_file_location.js => browser/devtools/webconsole/test/browser_webconsole_bug_646025_console_file_location.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_651501_document_body_autocomplete.js => browser/devtools/webconsole/test/browser_webconsole_bug_651501_document_body_autocomplete.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_653531_highlighter_console_helper.js => browser/devtools/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_658368_time_methods.js => browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_659907_console_dir.js => browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_660806_history_nav.js => browser/devtools/webconsole/test/browser_webconsole_bug_660806_history_nav.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_663443_panel_title.js => browser/devtools/webconsole/test/browser_webconsole_bug_663443_panel_title.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_664131_console_group.js => browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_678816.js => browser/devtools/webconsole/test/browser_webconsole_bug_678816.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_bug_704295.js => browser/devtools/webconsole/test/browser_webconsole_bug_704295.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_chrome.js => browser/devtools/webconsole/test/browser_webconsole_chrome.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_completion.js => browser/devtools/webconsole/test/browser_webconsole_completion.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_console_extras.js => browser/devtools/webconsole/test/browser_webconsole_console_extras.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_console_logging_api.js => browser/devtools/webconsole/test/browser_webconsole_console_logging_api.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_consoleonpage.js => browser/devtools/webconsole/test/browser_webconsole_consoleonpage.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js => browser/devtools/webconsole/test/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_execution_scope.js => browser/devtools/webconsole/test/browser_webconsole_execution_scope.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_history.js => browser/devtools/webconsole/test/browser_webconsole_history.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_hud_getters.js => browser/devtools/webconsole/test/browser_webconsole_hud_getters.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_js_input_and_output_styling.js => browser/devtools/webconsole/test/browser_webconsole_js_input_and_output_styling.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_js_input_expansion.js => browser/devtools/webconsole/test/browser_webconsole_js_input_expansion.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_jsterm.js => browser/devtools/webconsole/test/browser_webconsole_jsterm.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_live_filtering_of_message_types.js => browser/devtools/webconsole/test/browser_webconsole_live_filtering_of_message_types.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_live_filtering_on_search_strings.js => browser/devtools/webconsole/test/browser_webconsole_live_filtering_on_search_strings.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_log_node_classes.js => browser/devtools/webconsole/test/browser_webconsole_log_node_classes.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_message_node_id.js => browser/devtools/webconsole/test/browser_webconsole_message_node_id.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_netlogging.js => browser/devtools/webconsole/test/browser_webconsole_netlogging.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_network_panel.js => browser/devtools/webconsole/test/browser_webconsole_network_panel.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_notifications.js => browser/devtools/webconsole/test/browser_webconsole_notifications.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_null_and_undefined_output.js => browser/devtools/webconsole/test/browser_webconsole_null_and_undefined_output.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_output_order.js => browser/devtools/webconsole/test/browser_webconsole_output_order.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_position_ui.js => browser/devtools/webconsole/test/browser_webconsole_position_ui.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_property_panel.js => browser/devtools/webconsole/test/browser_webconsole_property_panel.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_property_provider.js => browser/devtools/webconsole/test/browser_webconsole_property_provider.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_registries.js => browser/devtools/webconsole/test/browser_webconsole_registries.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js => browser/devtools/webconsole/test/browser_webconsole_view_source.js
rename : browser/devtools/webconsole/test/browser/browser_webconsole_window_zombie.js => browser/devtools/webconsole/test/browser_webconsole_window_zombie.js
rename : browser/devtools/webconsole/test/browser/head.js => browser/devtools/webconsole/test/head.js
rename : browser/devtools/webconsole/test/browser/test-bug-585956-console-trace.html => browser/devtools/webconsole/test/test-bug-585956-console-trace.html
rename : browser/devtools/webconsole/test/browser/test-bug-593003-iframe-wrong-hud-iframe.html => browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html
rename : browser/devtools/webconsole/test/browser/test-bug-593003-iframe-wrong-hud.html => browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-canvas-css.html => browser/devtools/webconsole/test/test-bug-595934-canvas-css.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-canvas-css.js => browser/devtools/webconsole/test/test-bug-595934-canvas-css.js
rename : browser/devtools/webconsole/test/browser/test-bug-595934-canvas.html => browser/devtools/webconsole/test/test-bug-595934-canvas.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-canvas.js => browser/devtools/webconsole/test/test-bug-595934-canvas.js
rename : browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.css => browser/devtools/webconsole/test/test-bug-595934-css-loader.css
rename : browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.css^headers^ => browser/devtools/webconsole/test/test-bug-595934-css-loader.css^headers^
rename : browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.html => browser/devtools/webconsole/test/test-bug-595934-css-loader.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-css-parser.css => browser/devtools/webconsole/test/test-bug-595934-css-parser.css
rename : browser/devtools/webconsole/test/browser/test-bug-595934-css-parser.html => browser/devtools/webconsole/test/test-bug-595934-css-parser.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-events-external2.html => browser/devtools/webconsole/test/test-bug-595934-dom-events-external2.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-events-external2.js => browser/devtools/webconsole/test/test-bug-595934-dom-events-external2.js
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-events.html => browser/devtools/webconsole/test/test-bug-595934-dom-events.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-html-external.html => browser/devtools/webconsole/test/test-bug-595934-dom-html-external.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-html-external.js => browser/devtools/webconsole/test/test-bug-595934-dom-html-external.js
rename : browser/devtools/webconsole/test/browser/test-bug-595934-dom-html.html => browser/devtools/webconsole/test/test-bug-595934-dom-html.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-empty-getelementbyid.html => browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-empty-getelementbyid.js => browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.js
rename : browser/devtools/webconsole/test/browser/test-bug-595934-html.html => browser/devtools/webconsole/test/test-bug-595934-html.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-image.html => browser/devtools/webconsole/test/test-bug-595934-image.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-image.jpg => browser/devtools/webconsole/test/test-bug-595934-image.jpg
rename : browser/devtools/webconsole/test/browser/test-bug-595934-imagemap.html => browser/devtools/webconsole/test/test-bug-595934-imagemap.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml-external.html => browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml-external.xml => browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.xml
rename : browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml.xhtml => browser/devtools/webconsole/test/test-bug-595934-malformedxml.xhtml
rename : browser/devtools/webconsole/test/browser/test-bug-595934-svg.xhtml => browser/devtools/webconsole/test/test-bug-595934-svg.xhtml
rename : browser/devtools/webconsole/test/browser/test-bug-595934-workers.html => browser/devtools/webconsole/test/test-bug-595934-workers.html
rename : browser/devtools/webconsole/test/browser/test-bug-595934-workers.js => browser/devtools/webconsole/test/test-bug-595934-workers.js
rename : browser/devtools/webconsole/test/browser/test-bug-597136-external-script-errors.html => browser/devtools/webconsole/test/test-bug-597136-external-script-errors.html
rename : browser/devtools/webconsole/test/browser/test-bug-597136-external-script-errors.js => browser/devtools/webconsole/test/test-bug-597136-external-script-errors.js
rename : browser/devtools/webconsole/test/browser/test-bug-597756-reopen-closed-tab.html => browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html
rename : browser/devtools/webconsole/test/browser/test-bug-599725-response-headers.sjs => browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs
rename : browser/devtools/webconsole/test/browser/test-bug-600183-charset.html => browser/devtools/webconsole/test/test-bug-600183-charset.html
rename : browser/devtools/webconsole/test/browser/test-bug-600183-charset.html^headers^ => browser/devtools/webconsole/test/test-bug-600183-charset.html^headers^
rename : browser/devtools/webconsole/test/browser/test-bug-601177-log-levels.html => browser/devtools/webconsole/test/test-bug-601177-log-levels.html
rename : browser/devtools/webconsole/test/browser/test-bug-601177-log-levels.js => browser/devtools/webconsole/test/test-bug-601177-log-levels.js
rename : browser/devtools/webconsole/test/browser/test-bug-603750-websocket.html => browser/devtools/webconsole/test/test-bug-603750-websocket.html
rename : browser/devtools/webconsole/test/browser/test-bug-603750-websocket.js => browser/devtools/webconsole/test/test-bug-603750-websocket.js
rename : browser/devtools/webconsole/test/browser/test-bug-613013-console-api-iframe.html => browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html
rename : browser/devtools/webconsole/test/browser/test-bug-618078-network-exceptions.html => browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html
rename : browser/devtools/webconsole/test/browser/test-bug-621644-jsterm-dollar.html => browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html
rename : browser/devtools/webconsole/test/browser/test-bug-630733-response-redirect-headers.sjs => browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs
rename : browser/devtools/webconsole/test/browser/test-bug-632275-getters.html => browser/devtools/webconsole/test/test-bug-632275-getters.html
rename : browser/devtools/webconsole/test/browser/test-bug-632347-iterators-generators.html => browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html
rename : browser/devtools/webconsole/test/browser/test-bug-644419-log-limits.html => browser/devtools/webconsole/test/test-bug-644419-log-limits.html
rename : browser/devtools/webconsole/test/browser/test-bug-646025-console-file-location.html => browser/devtools/webconsole/test/test-bug-646025-console-file-location.html
rename : browser/devtools/webconsole/test/browser/test-bug-658368-time-methods.html => browser/devtools/webconsole/test/test-bug-658368-time-methods.html
rename : browser/devtools/webconsole/test/browser/test-bug-678816-content.js => browser/devtools/webconsole/test/test-bug-678816-content.js
rename : browser/devtools/webconsole/test/browser/test-console-extras.html => browser/devtools/webconsole/test/test-console-extras.html
rename : browser/devtools/webconsole/test/browser/test-console-replaced-api.html => browser/devtools/webconsole/test/test-console-replaced-api.html
rename : browser/devtools/webconsole/test/browser/test-console.html => browser/devtools/webconsole/test/test-console.html
rename : browser/devtools/webconsole/test/browser/test-data.json => browser/devtools/webconsole/test/test-data.json
rename : browser/devtools/webconsole/test/browser/test-duplicate-error.html => browser/devtools/webconsole/test/test-duplicate-error.html
rename : browser/devtools/webconsole/test/browser/test-encoding-ISO-8859-1.html => browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html
rename : browser/devtools/webconsole/test/browser/test-error.html => browser/devtools/webconsole/test/test-error.html
rename : browser/devtools/webconsole/test/browser/test-file-location.js => browser/devtools/webconsole/test/test-file-location.js
rename : browser/devtools/webconsole/test/browser/test-filter.html => browser/devtools/webconsole/test/test-filter.html
rename : browser/devtools/webconsole/test/browser/test-image.png => browser/devtools/webconsole/test/test-image.png
rename : browser/devtools/webconsole/test/browser/test-mutation.html => browser/devtools/webconsole/test/test-mutation.html
rename : browser/devtools/webconsole/test/browser/test-network-request.html => browser/devtools/webconsole/test/test-network-request.html
rename : browser/devtools/webconsole/test/browser/test-network.html => browser/devtools/webconsole/test/test-network.html
rename : browser/devtools/webconsole/test/browser/test-observe-http-ajax.html => browser/devtools/webconsole/test/test-observe-http-ajax.html
rename : browser/devtools/webconsole/test/browser/test-own-console.html => browser/devtools/webconsole/test/test-own-console.html
rename : browser/devtools/webconsole/test/browser/test-property-provider.html => browser/devtools/webconsole/test/test-property-provider.html
rename : browser/devtools/webconsole/test/browser/testscript.js => browser/devtools/webconsole/test/testscript.js
2011-12-16 09:11:23 +00:00

1967 lines
54 KiB
JavaScript

/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
/*
*
*
*
*
*
*
*
*********************************** WARNING ***********************************
*
* Do not edit this file without understanding where it comes from,
* Your changes are likely to be overwritten without warning.
*
* This test file is generated using a level 25 wizard spell cast on the
* test files that run in the browser as part of GCLI's test suite.
* For details of how to cast the spell, see GCLI's Makefile.dryice.js
*
* For more information on GCLI see:
* - https://github.com/mozilla/gcli/blob/master/docs/index.md
* - https://wiki.mozilla.org/DevTools/Features/GCLI
*
* The original source for this file is:
* https://github.com/mozilla/gcli/
*
*******************************************************************************
*
*
*
*
*
*
*
*
*
*/
///////////////////////////////////////////////////////////////////////////////
var obj = {};
Components.utils.import("resource:///modules/gcli.jsm", obj);
var define = obj.gcli._internal.define;
var console = obj.gcli._internal.console;
var Node = Components.interfaces.nsIDOMNode;
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
// We need to make sure GCLI is initialized before we begin testing it
require('gcli/index');
var examiner = require('test/examiner');
// It's tempting to want to unify these strings and make addSuite() do the
// call to require(), however that breaks the build system which looks for
// the strings passed to require
examiner.addSuite('gclitest/testTokenize', require('gclitest/testTokenize'));
examiner.addSuite('gclitest/testSplit', require('gclitest/testSplit'));
examiner.addSuite('gclitest/testCli', require('gclitest/testCli'));
examiner.addSuite('gclitest/testExec', require('gclitest/testExec'));
examiner.addSuite('gclitest/testKeyboard', require('gclitest/testKeyboard'));
examiner.addSuite('gclitest/testHistory', require('gclitest/testHistory'));
examiner.addSuite('gclitest/testRequire', require('gclitest/testRequire'));
examiner.addSuite('gclitest/testJs', require('gclitest/testJs'));
examiner.run();
console.log('Completed test suite');
// examiner.log();
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('test/examiner', ['require', 'exports', 'module' ], function(require, exports, module) {
var examiner = exports;
/**
* Test harness data
*/
examiner.suites = {};
/**
* The gap between tests when running async
*/
var delay = 10;
var currentTest = null;
var stati = {
notrun: { index: 0, name: 'Skipped' },
executing: { index: 1, name: 'Executing' },
asynchronous: { index: 2, name: 'Waiting' },
pass: { index: 3, name: 'Pass' },
fail: { index: 4, name: 'Fail' }
};
/**
* Add a test suite. Generally used like:
* test.addSuite('foo', require('path/to/foo'));
*/
examiner.addSuite = function(name, suite) {
examiner.suites[name] = new Suite(name, suite);
};
/**
* Run all the tests synchronously
*/
examiner.run = function() {
Object.keys(examiner.suites).forEach(function(suiteName) {
var suite = examiner.suites[suiteName];
suite.run();
}.bind(this));
return examiner.suites;
};
/**
* Run all the tests asynchronously
*/
examiner.runAsync = function(callback) {
this.runAsyncInternal(0, callback);
};
/**
* Run all the test suits asynchronously
*/
examiner.runAsyncInternal = function(i, callback) {
if (i >= Object.keys(examiner.suites).length) {
if (typeof callback === 'function') {
callback();
}
return;
}
var suiteName = Object.keys(examiner.suites)[i];
examiner.suites[suiteName].runAsync(function() {
setTimeout(function() {
examiner.runAsyncInternal(i + 1, callback);
}.bind(this), delay);
}.bind(this));
};
/**
*
*/
examiner.reportToText = function() {
return JSON.stringify(examiner.toRemote());
};
/**
* Create a JSON object suitable for serialization
*/
examiner.toRemote = function() {
return {
suites: Object.keys(examiner.suites).map(function(suiteName) {
return examiner.suites[suiteName].toRemote();
}.bind(this))
};
};
/**
* Output a test summary to console.log
*/
examiner.log = function() {
var remote = this.toRemote();
remote.suites.forEach(function(suite) {
console.log(suite.name);
suite.tests.forEach(function(test) {
console.log('- ' + test.name, test.status.name, test.message || '');
});
});
};
/**
* Used by assert to record a failure against the current test
*/
examiner.recordError = function(message) {
if (!currentTest) {
console.error('No currentTest for ' + message);
return;
}
currentTest.status = stati.fail;
if (Array.isArray(message)) {
currentTest.messages.push.apply(currentTest.messages, message);
}
else {
currentTest.messages.push(message);
}
};
/**
* A suite is a group of tests
*/
function Suite(suiteName, suite) {
this.name = suiteName;
this.suite = suite;
this.tests = {};
Object.keys(suite).forEach(function(testName) {
if (testName !== 'setup' && testName !== 'shutdown') {
var test = new Test(this, testName, suite[testName]);
this.tests[testName] = test;
}
}.bind(this));
}
/**
* Run all the tests in this suite synchronously
*/
Suite.prototype.run = function() {
if (typeof this.suite.setup == "function") {
this.suite.setup();
}
Object.keys(this.tests).forEach(function(testName) {
var test = this.tests[testName];
test.run();
}.bind(this));
if (typeof this.suite.shutdown == "function") {
this.suite.shutdown();
}
};
/**
* Run all the tests in this suite asynchronously
*/
Suite.prototype.runAsync = function(callback) {
if (typeof this.suite.setup == "function") {
this.suite.setup();
}
this.runAsyncInternal(0, function() {
if (typeof this.suite.shutdown == "function") {
this.suite.shutdown();
}
if (typeof callback === 'function') {
callback();
}
}.bind(this));
};
/**
* Function used by the async runners that can handle async recursion.
*/
Suite.prototype.runAsyncInternal = function(i, callback) {
if (i >= Object.keys(this.tests).length) {
if (typeof callback === 'function') {
callback();
}
return;
}
var testName = Object.keys(this.tests)[i];
this.tests[testName].runAsync(function() {
setTimeout(function() {
this.runAsyncInternal(i + 1, callback);
}.bind(this), delay);
}.bind(this));
};
/**
* Create a JSON object suitable for serialization
*/
Suite.prototype.toRemote = function() {
return {
name: this.name,
tests: Object.keys(this.tests).map(function(testName) {
return this.tests[testName].toRemote();
}.bind(this))
};
};
/**
* A test represents data about a single test function
*/
function Test(suite, name, func) {
this.suite = suite;
this.name = name;
this.func = func;
this.title = name.replace(/^test/, '').replace(/([A-Z])/g, ' $1');
this.messages = [];
this.status = stati.notrun;
}
/**
* Run just a single test
*/
Test.prototype.run = function() {
currentTest = this;
this.status = stati.executing;
this.messages = [];
try {
this.func.apply(this.suite);
}
catch (ex) {
this.status = stati.fail;
this.messages.push('' + ex);
console.error(ex);
if (ex.stack) {
console.error(ex.stack);
}
}
if (this.status === stati.executing) {
this.status = stati.pass;
}
currentTest = null;
};
/**
* Run all the tests in this suite asynchronously
*/
Test.prototype.runAsync = function(callback) {
setTimeout(function() {
this.run();
if (typeof callback === 'function') {
callback();
}
}.bind(this), delay);
};
/**
* Create a JSON object suitable for serialization
*/
Test.prototype.toRemote = function() {
return {
name: this.name,
title: this.title,
status: this.status,
messages: this.messages
};
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testTokenize', ['require', 'exports', 'module' , 'test/assert', 'gcli/cli', 'gcli/argument'], function(require, exports, module) {
var test = require('test/assert');
var Requisition = require('gcli/cli').Requisition;
var Argument = require('gcli/argument').Argument;
var ScriptArgument = require('gcli/argument').ScriptArgument;
exports.testBlanks = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('');
test.is(1, args.length);
test.is('', args[0].text);
test.is('', args[0].prefix);
test.is('', args[0].suffix);
args = requ._tokenize(' ');
test.is(1, args.length);
test.is('', args[0].text);
test.is(' ', args[0].prefix);
test.is('', args[0].suffix);
};
exports.testSimple = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('s');
test.is(1, args.length);
test.is('s', args[0].text);
test.is('', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof Argument);
args = requ._tokenize('s s');
test.is(2, args.length);
test.is('s', args[0].text);
test.is('', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof Argument);
test.is('s', args[1].text);
test.is(' ', args[1].prefix);
test.is('', args[1].suffix);
test.ok(args[1] instanceof Argument);
};
exports.testJavascript = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('{x}');
test.is(1, args.length);
test.is('x', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{ x }');
test.is(1, args.length);
test.is('x', args[0].text);
test.is('{ ', args[0].prefix);
test.is(' }', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{x} {y}');
test.is(2, args.length);
test.is('x', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
test.is('y', args[1].text);
test.is(' {', args[1].prefix);
test.is('}', args[1].suffix);
test.ok(args[1] instanceof ScriptArgument);
args = requ._tokenize('{x}{y}');
test.is(2, args.length);
test.is('x', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
test.is('y', args[1].text);
test.is('{', args[1].prefix);
test.is('}', args[1].suffix);
test.ok(args[1] instanceof ScriptArgument);
args = requ._tokenize('{');
test.is(1, args.length);
test.is('', args[0].text);
test.is('{', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{ ');
test.is(1, args.length);
test.is('', args[0].text);
test.is('{ ', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{x');
test.is(1, args.length);
test.is('x', args[0].text);
test.is('{', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
};
exports.testRegularNesting = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('{"x"}');
test.is(1, args.length);
test.is('"x"', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{\'x\'}');
test.is(1, args.length);
test.is('\'x\'', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('"{x}"');
test.is(1, args.length);
test.is('{x}', args[0].text);
test.is('"', args[0].prefix);
test.is('"', args[0].suffix);
test.ok(args[0] instanceof Argument);
args = requ._tokenize('\'{x}\'');
test.is(1, args.length);
test.is('{x}', args[0].text);
test.is('\'', args[0].prefix);
test.is('\'', args[0].suffix);
test.ok(args[0] instanceof Argument);
};
exports.testDeepNesting = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('{{}}');
test.is(1, args.length);
test.is('{}', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{{x} {y}}');
test.is(1, args.length);
test.is('{x} {y}', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
args = requ._tokenize('{{w} {{{x}}}} {y} {{{z}}}');
test.is(3, args.length);
test.is('{w} {{{x}}}', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
test.is('y', args[1].text);
test.is(' {', args[1].prefix);
test.is('}', args[1].suffix);
test.ok(args[1] instanceof ScriptArgument);
test.is('{{z}}', args[2].text);
test.is(' {', args[2].prefix);
test.is('}', args[2].suffix);
test.ok(args[2] instanceof ScriptArgument);
args = requ._tokenize('{{w} {{{x}}} {y} {{{z}}}');
test.is(1, args.length);
test.is('{w} {{{x}}} {y} {{{z}}}', args[0].text);
test.is('{', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
};
exports.testStrangeNesting = function() {
var args;
var requ = new Requisition();
// Note: When we get real JS parsing this should break
args = requ._tokenize('{"x}"}');
test.is(2, args.length);
test.is('"x', args[0].text);
test.is('{', args[0].prefix);
test.is('}', args[0].suffix);
test.ok(args[0] instanceof ScriptArgument);
test.is('}', args[1].text);
test.is('"', args[1].prefix);
test.is('', args[1].suffix);
test.ok(args[1] instanceof Argument);
};
exports.testComplex = function() {
var args;
var requ = new Requisition();
args = requ._tokenize(' 1234 \'12 34\'');
test.is(2, args.length);
test.is('1234', args[0].text);
test.is(' ', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof Argument);
test.is('12 34', args[1].text);
test.is(' \'', args[1].prefix);
test.is('\'', args[1].suffix);
test.ok(args[1] instanceof Argument);
args = requ._tokenize('12\'34 "12 34" \\'); // 12'34 "12 34" \
test.is(3, args.length);
test.is('12\'34', args[0].text);
test.is('', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof Argument);
test.is('12 34', args[1].text);
test.is(' "', args[1].prefix);
test.is('"', args[1].suffix);
test.ok(args[1] instanceof Argument);
test.is('\\', args[2].text);
test.is(' ', args[2].prefix);
test.is('', args[2].suffix);
test.ok(args[2] instanceof Argument);
};
exports.testPathological = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('a\\ b \\t\\n\\r \\\'x\\\" \'d'); // a_b \t\n\r \'x\" 'd
test.is(4, args.length);
test.is('a b', args[0].text);
test.is('', args[0].prefix);
test.is('', args[0].suffix);
test.ok(args[0] instanceof Argument);
test.is('\t\n\r', args[1].text);
test.is(' ', args[1].prefix);
test.is('', args[1].suffix);
test.ok(args[1] instanceof Argument);
test.is('\'x"', args[2].text);
test.is(' ', args[2].prefix);
test.is('', args[2].suffix);
test.ok(args[2] instanceof Argument);
test.is('d', args[3].text);
test.is(' \'', args[3].prefix);
test.is('', args[3].suffix);
test.ok(args[3] instanceof Argument);
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('test/assert', ['require', 'exports', 'module' ], function(require, exports, module) {
exports.ok = ok;
exports.is = is;
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testSplit', ['require', 'exports', 'module' , 'test/assert', 'gclitest/commands', 'gcli/cli'], function(require, exports, module) {
var test = require('test/assert');
var commands = require('gclitest/commands');
var Requisition = require('gcli/cli').Requisition;
exports.setup = function() {
commands.setup();
};
exports.shutdown = function() {
commands.shutdown();
};
exports.testSimple = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('s');
requ._split(args);
test.is(0, args.length);
test.is('s', requ.commandAssignment.getArg().text);
};
exports.testFlatCommand = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('tsv');
requ._split(args);
test.is(0, args.length);
test.is('tsv', requ.commandAssignment.getValue().name);
args = requ._tokenize('tsv a b');
requ._split(args);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is(2, args.length);
test.is('a', args[0].text);
test.is('b', args[1].text);
};
exports.testJavascript = function() {
var args;
var requ = new Requisition();
args = requ._tokenize('{');
requ._split(args);
test.is(1, args.length);
test.is('', args[0].text);
test.is('', requ.commandAssignment.getArg().text);
test.is('{', requ.commandAssignment.getValue().name);
};
// BUG 663081 - add tests for sub commands
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/commands', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/util', 'gcli/types/basic', 'gcli/types'], function(require, exports, module) {
var commands = exports;
var canon = require('gcli/canon');
var util = require('gcli/util');
var SelectionType = require('gcli/types/basic').SelectionType;
var DeferredType = require('gcli/types/basic').DeferredType;
var types = require('gcli/types');
/**
* Registration and de-registration.
*/
commands.setup = function() {
commands.option1.type = types.getType('number');
commands.option2.type = types.getType('boolean');
types.registerType(commands.optionType);
types.registerType(commands.optionValue);
canon.addCommand(commands.tsv);
canon.addCommand(commands.tsr);
canon.addCommand(commands.tse);
canon.addCommand(commands.tsj);
canon.addCommand(commands.tsb);
canon.addCommand(commands.tss);
canon.addCommand(commands.tsu);
canon.addCommand(commands.tsn);
canon.addCommand(commands.tsnDif);
canon.addCommand(commands.tsnExt);
canon.addCommand(commands.tsnExte);
canon.addCommand(commands.tsnExten);
canon.addCommand(commands.tsnExtend);
canon.addCommand(commands.tselarr);
canon.addCommand(commands.tsm);
canon.addCommand(commands.tsg);
};
commands.shutdown = function() {
canon.removeCommand(commands.tsv);
canon.removeCommand(commands.tsr);
canon.removeCommand(commands.tse);
canon.removeCommand(commands.tsj);
canon.removeCommand(commands.tsb);
canon.removeCommand(commands.tss);
canon.removeCommand(commands.tsu);
canon.removeCommand(commands.tsn);
canon.removeCommand(commands.tsnDif);
canon.removeCommand(commands.tsnExt);
canon.removeCommand(commands.tsnExte);
canon.removeCommand(commands.tsnExten);
canon.removeCommand(commands.tsnExtend);
canon.removeCommand(commands.tselarr);
canon.removeCommand(commands.tsm);
canon.removeCommand(commands.tsg);
types.deregisterType(commands.optionType);
types.deregisterType(commands.optionValue);
};
commands.option1 = { type: types.getType('string') };
commands.option2 = { type: types.getType('number') };
commands.optionType = new SelectionType({
name: 'optionType',
lookup: [
{ name: 'option1', value: commands.option1 },
{ name: 'option2', value: commands.option2 }
],
noMatch: function() {
this.lastOption = null;
},
stringify: function(option) {
this.lastOption = option;
return SelectionType.prototype.stringify.call(this, option);
},
parse: function(arg) {
var conversion = SelectionType.prototype.parse.call(this, arg);
this.lastOption = conversion.value;
return conversion;
}
});
commands.optionValue = new DeferredType({
name: 'optionValue',
defer: function() {
if (commands.optionType.lastOption) {
return commands.optionType.lastOption.type;
}
else {
return types.getType('blank');
}
}
});
commands.commandExec = util.createEvent('commands.commandExec');
function createExec(name) {
return function(args, context) {
var data = {
command: commands[name],
args: args,
context: context
};
commands.commandExec(data);
return data;
};
}
commands.tsv = {
name: 'tsv',
params: [
{ name: 'optionType', type: 'optionType' },
{ name: 'optionValue', type: 'optionValue' }
],
exec: createExec('tsv')
};
commands.tsr = {
name: 'tsr',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('tsr')
};
commands.tse = {
name: 'tse',
params: [ { name: 'node', type: 'node' } ],
exec: createExec('tse')
};
commands.tsj = {
name: 'tsj',
params: [ { name: 'javascript', type: 'javascript' } ],
exec: createExec('tsj')
};
commands.tsb = {
name: 'tsb',
params: [ { name: 'toggle', type: 'boolean' } ],
exec: createExec('tsb')
};
commands.tss = {
name: 'tss',
exec: createExec('tss')
};
commands.tsu = {
name: 'tsu',
params: [ { name: 'num', type: { name: 'number', max: 10, min: -5, step: 3 } } ],
exec: createExec('tsu')
};
commands.tsn = {
name: 'tsn'
};
commands.tsnDif = {
name: 'tsn dif',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('tsnDif')
};
commands.tsnExt = {
name: 'tsn ext',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('tsnExt')
};
commands.tsnExte = {
name: 'tsn exte',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('')
};
commands.tsnExten = {
name: 'tsn exten',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('tsnExte')
};
commands.tsnExtend = {
name: 'tsn extend',
params: [ { name: 'text', type: 'string' } ],
exec: createExec('tsnExtend')
};
commands.tselarr = {
name: 'tselarr',
params: [
{ name: 'num', type: { name: 'selection', data: [ '1', '2', '3' ] } },
{ name: 'arr', type: { name: 'array', subtype: 'string' } },
],
exec: createExec('tselarr')
};
commands.tsm = {
name: 'tsm',
hidden: true,
description: 'a 3-param test selection|string|number',
params: [
{ name: 'abc', type: { name: 'selection', data: [ 'a', 'b', 'c' ] } },
{ name: 'txt', type: 'string' },
{ name: 'num', type: { name: 'number', max: 42, min: 0 } },
],
exec: createExec('tsm')
};
commands.tsg = {
name: 'tsg',
hidden: true,
description: 'a param group test',
params: [
{ name: 'solo', type: { name: 'selection', data: [ 'aaa', 'bbb', 'ccc' ] } },
{
group: 'First',
params: [
{ name: 'txt1', type: 'string', defaultValue: null },
{ name: 'boolean1', type: 'boolean' }
]
},
{
group: 'Second',
params: [
{ name: 'txt2', type: 'string', defaultValue: 'd' },
{ name: 'num2', type: { name: 'number', defaultValue: 42 } }
]
}
],
exec: createExec('tsg')
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testCli', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gclitest/commands', 'test/assert'], function(require, exports, module) {
var Requisition = require('gcli/cli').Requisition;
var Status = require('gcli/types').Status;
var commands = require('gclitest/commands');
var test = require('test/assert');
exports.setup = function() {
commands.setup();
};
exports.shutdown = function() {
commands.shutdown();
};
var assign1;
var assign2;
var assignC;
var requ;
var debug = false;
var status;
var statuses;
function update(input) {
if (!requ) {
requ = new Requisition();
}
requ.update(input);
if (debug) {
console.log('####### TEST: typed="' + input.typed +
'" cur=' + input.cursor.start +
' cli=', requ);
}
status = requ.getStatus();
assignC = requ.getAssignmentAt(input.cursor.start);
statuses = requ.getInputStatusMarkup(input.cursor.start).map(function(s) {
return s.toString()[0];
}).join('');
if (requ.commandAssignment.getValue()) {
assign1 = requ.getAssignment(0);
assign2 = requ.getAssignment(1);
}
else {
assign1 = undefined;
assign2 = undefined;
}
}
function verifyPredictionsContains(name, predictions) {
return predictions.every(function(prediction) {
return name === prediction.name;
}, this);
}
exports.testBlank = function() {
update({ typed: '', cursor: { start: 0, end: 0 } });
test.is( '', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is(null, requ.commandAssignment.getValue());
update({ typed: ' ', cursor: { start: 1, end: 1 } });
test.is( 'V', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is(null, requ.commandAssignment.getValue());
update({ typed: ' ', cursor: { start: 0, end: 0 } });
test.is( 'V', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is(null, requ.commandAssignment.getValue());
};
exports.testIncompleteMultiMatch = function() {
update({ typed: 't', cursor: { start: 1, end: 1 } });
test.is( 'I', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.ok(assignC.getPredictions().length > 0);
test.ok(assignC.getPredictions().length < 20); // could break ...
verifyPredictionsContains('tsv', assignC.getPredictions());
verifyPredictionsContains('tsr', assignC.getPredictions());
test.is(null, requ.commandAssignment.getValue());
};
exports.testIncompleteSingleMatch = function() {
update({ typed: 'tselar', cursor: { start: 6, end: 6 } });
test.is( 'IIIIII', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is(1, assignC.getPredictions().length);
test.is('tselarr', assignC.getPredictions()[0].name);
test.is(null, requ.commandAssignment.getValue());
};
exports.testTsv = function() {
update({ typed: 'tsv', cursor: { start: 3, end: 3 } });
test.is( 'VVV', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is('tsv', requ.commandAssignment.getValue().name);
update({ typed: 'tsv ', cursor: { start: 4, end: 4 } });
test.is( 'VVVV', statuses);
test.is(Status.ERROR, status);
test.is(0, assignC.paramIndex);
test.is('tsv', requ.commandAssignment.getValue().name);
update({ typed: 'tsv ', cursor: { start: 2, end: 2 } });
test.is( 'VVVV', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is('tsv', requ.commandAssignment.getValue().name);
update({ typed: 'tsv o', cursor: { start: 5, end: 5 } });
test.is( 'VVVVI', statuses);
test.is(Status.ERROR, status);
test.is(0, assignC.paramIndex);
test.is(2, assignC.getPredictions().length);
test.is(commands.option1, assignC.getPredictions()[0].value);
test.is(commands.option2, assignC.getPredictions()[1].value);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('o', assign1.getArg().text);
test.is(null, assign1.getValue());
update({ typed: 'tsv option', cursor: { start: 10, end: 10 } });
test.is( 'VVVVIIIIII', statuses);
test.is(Status.ERROR, status);
test.is(0, assignC.paramIndex);
test.is(2, assignC.getPredictions().length);
test.is(commands.option1, assignC.getPredictions()[0].value);
test.is(commands.option2, assignC.getPredictions()[1].value);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option', assign1.getArg().text);
test.is(null, assign1.getValue());
update({ typed: 'tsv option', cursor: { start: 1, end: 1 } });
test.is( 'VVVVEEEEEE', statuses);
test.is(Status.ERROR, status);
test.is(-1, assignC.paramIndex);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option', assign1.getArg().text);
test.is(null, assign1.getValue());
update({ typed: 'tsv option ', cursor: { start: 11, end: 11 } });
test.is( 'VVVVEEEEEEV', statuses);
test.is(Status.ERROR, status);
test.is(1, assignC.paramIndex);
test.is(0, assignC.getPredictions().length);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option', assign1.getArg().text);
test.is(null, assign1.getValue());
update({ typed: 'tsv option1', cursor: { start: 11, end: 11 } });
test.is( 'VVVVVVVVVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option1', assign1.getArg().text);
test.is(commands.option1, assign1.getValue());
test.is(0, assignC.paramIndex);
update({ typed: 'tsv option1 ', cursor: { start: 12, end: 12 } });
test.is( 'VVVVVVVVVVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option1', assign1.getArg().text);
test.is(commands.option1, assign1.getValue());
test.is(1, assignC.paramIndex);
update({ typed: 'tsv option1 6', cursor: { start: 13, end: 13 } });
test.is( 'VVVVVVVVVVVVV', statuses);
test.is(Status.VALID, status);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option1', assign1.getArg().text);
test.is(commands.option1, assign1.getValue());
test.is('6', assign2.getArg().text);
test.is(6, assign2.getValue());
test.is('number', typeof assign2.getValue());
test.is(1, assignC.paramIndex);
update({ typed: 'tsv option2 6', cursor: { start: 13, end: 13 } });
test.is( 'VVVVVVVVVVVVE', statuses);
test.is(Status.ERROR, status);
test.is('tsv', requ.commandAssignment.getValue().name);
test.is('option2', assign1.getArg().text);
test.is(commands.option2, assign1.getValue());
test.is('6', assign2.getArg().text);
test.is(null, assign2.getValue());
test.is(1, assignC.paramIndex);
};
exports.testInvalid = function() {
update({ typed: 'fred', cursor: { start: 4, end: 4 } });
test.is( 'EEEE', statuses);
test.is('fred', requ.commandAssignment.getArg().text);
test.is('', requ._unassigned.getArg().text);
test.is(-1, assignC.paramIndex);
update({ typed: 'fred ', cursor: { start: 5, end: 5 } });
test.is( 'EEEEV', statuses);
test.is('fred', requ.commandAssignment.getArg().text);
test.is('', requ._unassigned.getArg().text);
test.is(-1, assignC.paramIndex);
update({ typed: 'fred one', cursor: { start: 8, end: 8 } });
test.is( 'EEEEVEEE', statuses);
test.is('fred', requ.commandAssignment.getArg().text);
test.is('one', requ._unassigned.getArg().text);
};
exports.testSingleString = function() {
update({ typed: 'tsr', cursor: { start: 3, end: 3 } });
test.is( 'VVV', statuses);
test.is(Status.ERROR, status);
test.is('tsr', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
//test.is(undefined, assign1.getValue());
test.is(undefined, assign2);
update({ typed: 'tsr ', cursor: { start: 4, end: 4 } });
test.is( 'VVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsr', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
//test.is(undefined, assign1.getValue());
test.is(undefined, assign2);
update({ typed: 'tsr h', cursor: { start: 5, end: 5 } });
test.is( 'VVVVV', statuses);
test.is(Status.VALID, status);
test.is('tsr', requ.commandAssignment.getValue().name);
test.is('h', assign1.getArg().text);
test.is('h', assign1.getValue());
update({ typed: 'tsr "h h"', cursor: { start: 9, end: 9 } });
test.is( 'VVVVVVVVV', statuses);
test.is(Status.VALID, status);
test.is('tsr', requ.commandAssignment.getValue().name);
test.is('h h', assign1.getArg().text);
test.is('h h', assign1.getValue());
update({ typed: 'tsr h h h', cursor: { start: 9, end: 9 } });
test.is( 'VVVVVVVVV', statuses);
test.is('tsr', requ.commandAssignment.getValue().name);
test.is('h h h', assign1.getArg().text);
test.is('h h h', assign1.getValue());
};
// BUG 664203: Add test to see that a command without mandatory param -> ERROR
exports.testSingleNumber = function() {
update({ typed: 'tsu', cursor: { start: 3, end: 3 } });
test.is( 'VVV', statuses);
test.is(Status.ERROR, status);
test.is('tsu', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
test.is(null, assign1.getValue());
update({ typed: 'tsu ', cursor: { start: 4, end: 4 } });
test.is( 'VVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsu', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
test.is(null, assign1.getValue());
update({ typed: 'tsu 1', cursor: { start: 5, end: 5 } });
test.is( 'VVVVV', statuses);
test.is(Status.VALID, status);
test.is('tsu', requ.commandAssignment.getValue().name);
test.is('1', assign1.getArg().text);
test.is(1, assign1.getValue());
test.is('number', typeof assign1.getValue());
update({ typed: 'tsu x', cursor: { start: 5, end: 5 } });
test.is( 'VVVVE', statuses);
test.is(Status.ERROR, status);
test.is('tsu', requ.commandAssignment.getValue().name);
test.is('x', assign1.getArg().text);
test.is(null, assign1.getValue());
};
exports.testNestedCommand = function() {
update({ typed: 'tsn', cursor: { start: 3, end: 3 } });
test.is( 'III', statuses);
test.is(Status.ERROR, status);
test.is('tsn', requ.commandAssignment.getValue().name);
test.is(undefined, assign1);
update({ typed: 'tsn ', cursor: { start: 4, end: 4 } });
test.is( 'IIIV', statuses);
test.is(Status.ERROR, status);
test.is('tsn', requ.commandAssignment.getValue().name);
test.is(undefined, assign1);
update({ typed: 'tsn x', cursor: { start: 5, end: 5 } });
test.is( 'EEEVE', statuses);
test.is(Status.ERROR, status);
test.is('tsn x', requ.commandAssignment.getArg().text);
test.is(undefined, assign1);
update({ typed: 'tsn dif', cursor: { start: 7, end: 7 } });
test.is( 'VVVVVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsn dif', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
//test.is(undefined, assign1.getValue());
update({ typed: 'tsn dif ', cursor: { start: 8, end: 8 } });
test.is( 'VVVVVVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsn dif', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
//test.is(undefined, assign1.getValue());
update({ typed: 'tsn dif x', cursor: { start: 9, end: 9 } });
test.is( 'VVVVVVVVV', statuses);
test.is(Status.VALID, status);
test.is('tsn dif', requ.commandAssignment.getValue().name);
test.is('x', assign1.getArg().text);
test.is('x', assign1.getValue());
update({ typed: 'tsn ext', cursor: { start: 7, end: 7 } });
test.is( 'VVVVVVV', statuses);
test.is(Status.ERROR, status);
test.is('tsn ext', requ.commandAssignment.getValue().name);
//test.is(undefined, assign1.getArg());
//test.is(undefined, assign1.getValue());
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testExec', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gcli/canon', 'gclitest/commands', 'gcli/types/node', 'test/assert'], function(require, exports, module) {
var Requisition = require('gcli/cli').Requisition;
var Status = require('gcli/types').Status;
var canon = require('gcli/canon');
var commands = require('gclitest/commands');
var nodetype = require('gcli/types/node');
var test = require('test/assert');
var actualExec;
var actualOutput;
exports.setup = function() {
commands.setup();
commands.commandExec.add(onCommandExec);
canon.commandOutputManager.addListener(onCommandOutput);
};
exports.shutdown = function() {
commands.shutdown();
commands.commandExec.remove(onCommandExec);
canon.commandOutputManager.removeListener(onCommandOutput);
};
function onCommandExec(ev) {
actualExec = ev;
}
function onCommandOutput(ev) {
actualOutput = ev.output;
}
function exec(command, expectedArgs) {
var environment = {};
var requisition = new Requisition(environment);
var reply = requisition.exec({ typed: command });
test.is(command.indexOf(actualExec.command.name), 0, 'Command name: ' + command);
if (reply !== true) {
test.ok(false, 'reply = false for command: ' + command);
}
if (expectedArgs == null) {
test.ok(false, 'expectedArgs == null for ' + command);
return;
}
if (actualExec.args == null) {
test.ok(false, 'actualExec.args == null for ' + command);
return;
}
test.is(Object.keys(expectedArgs).length, Object.keys(actualExec.args).length,
'Arg count: ' + command);
Object.keys(expectedArgs).forEach(function(arg) {
var expectedArg = expectedArgs[arg];
var actualArg = actualExec.args[arg];
if (Array.isArray(expectedArg)) {
if (!Array.isArray(actualArg)) {
test.ok(false, 'actual is not an array. ' + command + '/' + arg);
return;
}
test.is(expectedArg.length, actualArg.length,
'Array length: ' + command + '/' + arg);
for (var i = 0; i < expectedArg.length; i++) {
test.is(expectedArg[i], actualArg[i],
'Member: "' + command + '/' + arg + '/' + i);
}
}
else {
test.is(expectedArg, actualArg, 'Command: "' + command + '" arg: ' + arg);
}
});
test.is(environment, actualExec.context.environment, 'Environment');
test.is(false, actualOutput.error, 'output error is false');
test.is(command, actualOutput.typed, 'command is typed');
test.ok(typeof actualOutput.canonical === 'string', 'canonical exists');
test.is(actualExec.args, actualOutput.args, 'actualExec.args is actualOutput.args');
}
exports.testExec = function() {
exec('tss', {});
// Bug 707008 - GCLI defered types don't work properly
// exec('tsv option1 10', { optionType: commands.option1, optionValue: '10' });
// exec('tsv option2 10', { optionType: commands.option1, optionValue: 10 });
exec('tsr fred', { text: 'fred' });
exec('tsr fred bloggs', { text: 'fred bloggs' });
exec('tsr "fred bloggs"', { text: 'fred bloggs' });
exec('tsb', { toggle: false });
exec('tsb --toggle', { toggle: true });
exec('tsu 10', { num: 10 });
exec('tsu --num 10', { num: 10 });
// Bug 704829 - Enable GCLI Javascript parameters
// The answer to this should be 2
exec('tsj { 1 + 1 }', { javascript: '1 + 1' });
var origDoc = nodetype.getDocument();
nodetype.setDocument(mockDoc);
exec('tse :root', { node: mockBody });
nodetype.setDocument(origDoc);
exec('tsn dif fred', { text: 'fred' });
exec('tsn exten fred', { text: 'fred' });
exec('tsn extend fred', { text: 'fred' });
exec('tselarr 1', { num: '1', arr: [ ] });
exec('tselarr 1 a', { num: '1', arr: [ 'a' ] });
exec('tselarr 1 a b', { num: '1', arr: [ 'a', 'b' ] });
exec('tsm a 10 10', { abc: 'a', txt: '10', num: 10 });
// Bug 707009 - GCLI doesn't always fill in default parameters properly
// exec('tsg a', { solo: 'a', txt1: null, boolean1: false, txt2: 'd', num2: 42 });
};
var mockBody = {
style: {}
};
var mockDoc = {
querySelectorAll: function(css) {
if (css === ':root') {
return {
length: 1,
item: function(i) {
return mockBody;
}
};
}
throw new Error('mockDoc.querySelectorAll(\'' + css + '\') error');
}
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testKeyboard', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gcli/canon', 'gclitest/commands', 'gcli/types/node', 'test/assert'], function(require, exports, module) {
var Requisition = require('gcli/cli').Requisition;
var Status = require('gcli/types').Status;
var canon = require('gcli/canon');
var commands = require('gclitest/commands');
var nodetype = require('gcli/types/node');
var test = require('test/assert');
exports.setup = function() {
commands.setup();
};
exports.shutdown = function() {
commands.shutdown();
};
var COMPLETES_TO = 'complete';
var KEY_UPS_TO = 'keyup';
var KEY_DOWNS_TO = 'keydown';
function check(initial, action, after) {
var requisition = new Requisition();
requisition.update({
typed: initial,
cursor: { start: initial.length, end: initial.length }
});
var assignment = requisition.getAssignmentAt(initial.length);
switch (action) {
case COMPLETES_TO:
assignment.complete();
break;
case KEY_UPS_TO:
assignment.increment();
break;
case KEY_DOWNS_TO:
assignment.decrement();
break;
}
test.is(after, requisition.toString(), initial + ' + ' + action + ' -> ' + after);
}
exports.testComplete = function() {
check('tsela', COMPLETES_TO, 'tselarr ');
check('tsn di', COMPLETES_TO, 'tsn dif ');
check('tsg a', COMPLETES_TO, 'tsg aaa ');
check('{ wind', COMPLETES_TO, '{ window');
check('{ window.docum', COMPLETES_TO, '{ window.document');
check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
};
exports.testIncrDecr = function() {
check('tsu -70', KEY_UPS_TO, 'tsu -5');
check('tsu -7', KEY_UPS_TO, 'tsu -5');
check('tsu -6', KEY_UPS_TO, 'tsu -5');
check('tsu -5', KEY_UPS_TO, 'tsu -3');
check('tsu -4', KEY_UPS_TO, 'tsu -3');
check('tsu -3', KEY_UPS_TO, 'tsu 0');
check('tsu -2', KEY_UPS_TO, 'tsu 0');
check('tsu -1', KEY_UPS_TO, 'tsu 0');
check('tsu 0', KEY_UPS_TO, 'tsu 3');
check('tsu 1', KEY_UPS_TO, 'tsu 3');
check('tsu 2', KEY_UPS_TO, 'tsu 3');
check('tsu 3', KEY_UPS_TO, 'tsu 6');
check('tsu 4', KEY_UPS_TO, 'tsu 6');
check('tsu 5', KEY_UPS_TO, 'tsu 6');
check('tsu 6', KEY_UPS_TO, 'tsu 9');
check('tsu 7', KEY_UPS_TO, 'tsu 9');
check('tsu 8', KEY_UPS_TO, 'tsu 9');
check('tsu 9', KEY_UPS_TO, 'tsu 10');
check('tsu 10', KEY_UPS_TO, 'tsu 10');
check('tsu 100', KEY_UPS_TO, 'tsu -5');
check('tsu -70', KEY_DOWNS_TO, 'tsu 10');
check('tsu -7', KEY_DOWNS_TO, 'tsu 10');
check('tsu -6', KEY_DOWNS_TO, 'tsu 10');
check('tsu -5', KEY_DOWNS_TO, 'tsu -5');
check('tsu -4', KEY_DOWNS_TO, 'tsu -5');
check('tsu -3', KEY_DOWNS_TO, 'tsu -5');
check('tsu -2', KEY_DOWNS_TO, 'tsu -3');
check('tsu -1', KEY_DOWNS_TO, 'tsu -3');
check('tsu 0', KEY_DOWNS_TO, 'tsu -3');
check('tsu 1', KEY_DOWNS_TO, 'tsu 0');
check('tsu 2', KEY_DOWNS_TO, 'tsu 0');
check('tsu 3', KEY_DOWNS_TO, 'tsu 0');
check('tsu 4', KEY_DOWNS_TO, 'tsu 3');
check('tsu 5', KEY_DOWNS_TO, 'tsu 3');
check('tsu 6', KEY_DOWNS_TO, 'tsu 3');
check('tsu 7', KEY_DOWNS_TO, 'tsu 6');
check('tsu 8', KEY_DOWNS_TO, 'tsu 6');
check('tsu 9', KEY_DOWNS_TO, 'tsu 6');
check('tsu 10', KEY_DOWNS_TO, 'tsu 9');
check('tsu 100', KEY_DOWNS_TO, 'tsu 10');
// Bug 707007 - GCLI increment and decrement operations cycle through
// selection options in the wrong order
check('tselarr 1', KEY_DOWNS_TO, 'tselarr 2');
check('tselarr 2', KEY_DOWNS_TO, 'tselarr 3');
check('tselarr 3', KEY_DOWNS_TO, 'tselarr 1');
check('tselarr 3', KEY_UPS_TO, 'tselarr 2');
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testHistory', ['require', 'exports', 'module' , 'test/assert', 'gcli/history'], function(require, exports, module) {
var test = require('test/assert');
var History = require('gcli/history').History;
exports.setup = function() {
};
exports.shutdown = function() {
};
exports.testSimpleHistory = function () {
var history = new History({});
history.add('foo');
history.add('bar');
test.is('bar', history.backward());
test.is('foo', history.backward());
// Adding to the history again moves us back to the start of the history.
history.add('quux');
test.is('quux', history.backward());
test.is('bar', history.backward());
test.is('foo', history.backward());
};
exports.testBackwardsPastIndex = function () {
var history = new History({});
history.add('foo');
history.add('bar');
test.is('bar', history.backward());
test.is('foo', history.backward());
// Moving backwards past recorded history just keeps giving you the last
// item.
test.is('foo', history.backward());
};
exports.testForwardsPastIndex = function () {
var history = new History({});
history.add('foo');
history.add('bar');
test.is('bar', history.backward());
test.is('foo', history.backward());
// Going forward through the history again.
test.is('bar', history.forward());
// 'Present' time.
test.is('', history.forward());
// Going to the 'future' just keeps giving us the empty string.
test.is('', history.forward());
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testRequire', ['require', 'exports', 'module' , 'test/assert', 'gclitest/requirable'], function(require, exports, module) {
var test = require('test/assert');
exports.testWorking = function() {
// There are lots of requirement tests that we could be doing here
// The fact that we can get anything at all working is a testament to
// require doing what it should - we don't need to test the
var requireable = require('gclitest/requirable');
test.is('thing1', requireable.thing1);
test.is(2, requireable.thing2);
test.is(undefined, requireable.thing3);
};
exports.testDomains = function() {
var requireable = require('gclitest/requirable');
test.is(undefined, requireable.status);
requireable.setStatus(null);
test.is(null, requireable.getStatus());
test.is(undefined, requireable.status);
requireable.setStatus('42');
test.is('42', requireable.getStatus());
test.is(undefined, requireable.status);
if (define.Domain) {
var domain = new define.Domain();
var requireable2 = domain.require('gclitest/requirable');
test.is(undefined, requireable2.status);
test.is('initial', requireable2.getStatus());
requireable2.setStatus(999);
test.is(999, requireable2.getStatus());
test.is(undefined, requireable2.status);
test.is('42', requireable.getStatus());
test.is(undefined, requireable.status);
}
};
exports.testLeakage = function() {
var requireable = require('gclitest/requirable');
test.is(undefined, requireable.setup);
test.is(undefined, requireable.shutdown);
test.is(undefined, requireable.testWorking);
};
exports.testMultiImport = function() {
var r1 = require('gclitest/requirable');
var r2 = require('gclitest/requirable');
test.is(r1, r2);
};
exports.testUncompilable = function() {
// This test is commented out because it breaks the RequireJS module
// loader and because it causes console output and because testing failure
// cases such as this is something of a luxury
// It's not totally clear how a module loader should perform with unusable
// modules, however at least it should go into a flat spin ...
// GCLI mini_require reports an error as it should
/*
if (define.Domain) {
try {
var unrequireable = require('gclitest/unrequirable');
t.fail();
}
catch (ex) {
console.error(ex);
}
}
*/
};
exports.testRecursive = function() {
// See Bug 658583
/*
var recurse = require('gclitest/recurse');
*/
};
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/requirable', ['require', 'exports', 'module' ], function(require, exports, module) {
exports.thing1 = 'thing1';
exports.thing2 = 2;
var status = 'initial';
exports.setStatus = function(aStatus) { status = aStatus; };
exports.getStatus = function() { return status; };
});
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
define('gclitest/testJs', ['require', 'exports', 'module' , 'gcli/cli', 'gcli/types', 'gcli/types/javascript', 'test/assert'], function(require, exports, module) {
var Requisition = require('gcli/cli').Requisition;
var Status = require('gcli/types').Status;
var javascript = require('gcli/types/javascript');
var test = require('test/assert');
var debug = false;
var requ;
var assign;
var status;
var statuses;
var globalObject;
exports.setup = function() {
globalObject = javascript.getGlobalObject();
Object.defineProperty(globalObject, 'donteval', {
get: function() {
test.ok(false, 'donteval should not be used');
return { cant: '', touch: '', 'this': '' };
},
enumerable: true,
configurable : true
});
};
exports.shutdown = function() {
delete globalObject.donteval;
globalObject = undefined;
};
function input(typed) {
if (!requ) {
requ = new Requisition();
}
var cursor = { start: typed.length, end: typed.length };
var input = { typed: typed, cursor: cursor };
requ.update(input);
if (debug) {
console.log('####### TEST: typed="' + typed +
'" cur=' + cursor.start +
' cli=', requ);
}
status = requ.getStatus();
statuses = requ.getInputStatusMarkup(input.cursor.start).map(function(s) {
return s.toString()[0];
}).join('');
if (requ.commandAssignment.getValue()) {
assign = requ.getAssignment(0);
}
else {
assign = undefined;
}
}
function predictionsHas(name) {
return assign.getPredictions().some(function(prediction) {
return name === prediction.name;
}, this);
}
function check(expStatuses, expStatus, expAssign, expPredict) {
test.is('{', requ.commandAssignment.getValue().name, 'is exec');
test.is(expStatuses, statuses, 'unexpected status markup');
test.is(expStatus.toString(), status.toString(), 'unexpected status');
test.is(expAssign, assign.getValue(), 'unexpected assignment');
if (expPredict != null) {
var contains;
if (Array.isArray(expPredict)) {
expPredict.forEach(function(p) {
contains = predictionsHas(p);
test.ok(contains, 'missing prediction ' + p);
});
}
else if (typeof expPredict === 'number') {
contains = true;
test.is(assign.getPredictions().length, expPredict, 'prediction count');
}
else {
contains = predictionsHas(expPredict);
test.ok(contains, 'missing prediction ' + expPredict);
}
if (!contains) {
console.log('Predictions: ' + assign.getPredictions().map(function(p) {
return p.name;
}).join(', '));
}
}
}
exports.testBasic = function() {
input('{');
check('V', Status.ERROR, '');
input('{ ');
check('VV', Status.ERROR, '');
input('{ w');
check('VVI', Status.ERROR, 'w', 'window');
input('{ windo');
check('VVIIIII', Status.ERROR, 'windo', 'window');
input('{ window');
check('VVVVVVVV', Status.VALID, 'window', 0);
input('{ window.d');
check('VVIIIIIIII', Status.ERROR, 'window.d', 'window.document');
input('{ window.document.title');
check('VVVVVVVVVVVVVVVVVVVVVVV', Status.VALID, 'window.document.title', 0);
input('{ d');
check('VVI', Status.ERROR, 'd', 'document');
input('{ document.title');
check('VVVVVVVVVVVVVVVV', Status.VALID, 'document.title', 0);
test.ok('donteval' in globalObject, 'donteval exists');
input('{ don');
check('VVIII', Status.ERROR, 'don', 'donteval');
input('{ donteval');
check('VVVVVVVVVV', Status.VALID, 'donteval', 0);
/*
// This is a controversial test - technically we can tell that it's an error
// because 'donteval.' is a syntax error, however donteval is unsafe so we
// are playing safe by bailing out early. It's enough of a corner case that
// I don't think it warrants fixing
input('{ donteval.');
check('VVIIIIIIIII', Status.ERROR, 'donteval.', 0);
*/
input('{ donteval.cant');
check('VVVVVVVVVVVVVVV', Status.VALID, 'donteval.cant', 0);
input('{ donteval.xxx');
check('VVVVVVVVVVVVVV', Status.VALID, 'donteval.xxx', 0);
};
});
function undefine() {
delete define.modules['gclitest/suite'];
delete define.modules['test/examiner'];
delete define.modules['gclitest/testTokenize'];
delete define.modules['test/assert'];
delete define.modules['gclitest/testSplit'];
delete define.modules['gclitest/commands'];
delete define.modules['gclitest/testCli'];
delete define.modules['gclitest/testExec'];
delete define.modules['gclitest/testKeyboard'];
delete define.modules['gclitest/testHistory'];
delete define.modules['gclitest/testRequire'];
delete define.modules['gclitest/requirable'];
delete define.modules['gclitest/testJs'];
delete define.globalDomain.modules['gclitest/suite'];
delete define.globalDomain.modules['test/examiner'];
delete define.globalDomain.modules['gclitest/testTokenize'];
delete define.globalDomain.modules['test/assert'];
delete define.globalDomain.modules['gclitest/testSplit'];
delete define.globalDomain.modules['gclitest/commands'];
delete define.globalDomain.modules['gclitest/testCli'];
delete define.globalDomain.modules['gclitest/testExec'];
delete define.globalDomain.modules['gclitest/testKeyboard'];
delete define.globalDomain.modules['gclitest/testHistory'];
delete define.globalDomain.modules['gclitest/testRequire'];
delete define.globalDomain.modules['gclitest/requirable'];
delete define.globalDomain.modules['gclitest/testJs'];
}
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");
undefine();
obj = undefined;
define = undefined;
console = undefined;
Node = undefined;
});
function test() {
Services.prefs.setBoolPref("devtools.gcli.enable", true);
addTab("http://example.com/browser/browser/devtools/webconsole/test/test-console.html");
browser.addEventListener("DOMContentLoaded", onLoad, false);
}
function onLoad() {
browser.removeEventListener("DOMContentLoaded", onLoad, false);
var failed = false;
try {
openConsole();
define.globalDomain.require("gclitest/index");
}
catch (ex) {
failed = ex;
console.error('Test Failure', ex);
ok(false, '' + ex);
}
finally {
closeConsole();
finish();
}
if (failed) {
throw failed;
}
}