summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--browser/base/content/test/Makefile.in371
-rw-r--r--browser/base/content/test/POSTSearchEngine.xml6
-rw-r--r--browser/base/content/test/alltabslistener.html8
-rw-r--r--browser/base/content/test/app_bug575561.html19
-rw-r--r--browser/base/content/test/app_subframe_bug575561.html12
-rw-r--r--browser/base/content/test/audio.oggbin47411 -> 0 bytes
-rw-r--r--browser/base/content/test/authenticate.sjs220
-rw-r--r--browser/base/content/test/blockNoPlugins.xml7
-rw-r--r--browser/base/content/test/blockPluginHard.xml11
-rw-r--r--browser/base/content/test/blockPluginVulnerableNoUpdate.xml11
-rw-r--r--browser/base/content/test/blockPluginVulnerableUpdatable.xml11
-rw-r--r--browser/base/content/test/browser_CTP_context_menu.js103
-rw-r--r--browser/base/content/test/browser_CTP_data_urls.js256
-rw-r--r--browser/base/content/test/browser_CTP_drag_drop.js104
-rw-r--r--browser/base/content/test/browser_URLBarSetURI.js82
-rw-r--r--browser/base/content/test/browser_aboutHealthReport.js105
-rw-r--r--browser/base/content/test/browser_aboutHome.js520
-rw-r--r--browser/base/content/test/browser_aboutSyncProgress.js102
-rw-r--r--browser/base/content/test/browser_addon_bar.js63
-rw-r--r--browser/base/content/test/browser_addon_bar_aomlistener.js67
-rw-r--r--browser/base/content/test/browser_addon_bar_close_button.js19
-rw-r--r--browser/base/content/test/browser_addon_bar_shortcut.js18
-rw-r--r--browser/base/content/test/browser_allTabsPanel.js162
-rw-r--r--browser/base/content/test/browser_alltabslistener.js204
-rw-r--r--browser/base/content/test/browser_blob-channelname.js11
-rw-r--r--browser/base/content/test/browser_bookmark_titles.js86
-rw-r--r--browser/base/content/test/browser_bug304198.js125
-rw-r--r--browser/base/content/test/browser_bug321000.js80
-rw-r--r--browser/base/content/test/browser_bug329212.js43
-rw-r--r--browser/base/content/test/browser_bug356571.js91
-rw-r--r--browser/base/content/test/browser_bug380960.js91
-rw-r--r--browser/base/content/test/browser_bug386835.js89
-rw-r--r--browser/base/content/test/browser_bug405137.js5
-rw-r--r--browser/base/content/test/browser_bug406216.js54
-rw-r--r--browser/base/content/test/browser_bug409481.js83
-rw-r--r--browser/base/content/test/browser_bug409624.js73
-rw-r--r--browser/base/content/test/browser_bug413915.js59
-rw-r--r--browser/base/content/test/browser_bug416661.js43
-rw-r--r--browser/base/content/test/browser_bug417483.js26
-rw-r--r--browser/base/content/test/browser_bug419612.js32
-rw-r--r--browser/base/content/test/browser_bug422590.js50
-rw-r--r--browser/base/content/test/browser_bug423833.js138
-rw-r--r--browser/base/content/test/browser_bug424101.js53
-rw-r--r--browser/base/content/test/browser_bug427559.js40
-rw-r--r--browser/base/content/test/browser_bug432599.js127
-rw-r--r--browser/base/content/test/browser_bug435035.js16
-rw-r--r--browser/base/content/test/browser_bug435325.js72
-rw-r--r--browser/base/content/test/browser_bug441778.js46
-rw-r--r--browser/base/content/test/browser_bug455852.js16
-rw-r--r--browser/base/content/test/browser_bug460146.js51
-rw-r--r--browser/base/content/test/browser_bug462289.js85
-rw-r--r--browser/base/content/test/browser_bug462673.js53
-rw-r--r--browser/base/content/test/browser_bug477014.js55
-rw-r--r--browser/base/content/test/browser_bug479408.js17
-rw-r--r--browser/base/content/test/browser_bug479408_sample.html4
-rw-r--r--browser/base/content/test/browser_bug481560.js27
-rw-r--r--browser/base/content/test/browser_bug484315.js23
-rw-r--r--browser/base/content/test/browser_bug491431.js34
-rw-r--r--browser/base/content/test/browser_bug495058.js43
-rw-r--r--browser/base/content/test/browser_bug517902.js41
-rw-r--r--browser/base/content/test/browser_bug519216.js50
-rw-r--r--browser/base/content/test/browser_bug520538.js15
-rw-r--r--browser/base/content/test/browser_bug521216.js47
-rw-r--r--browser/base/content/test/browser_bug533232.js36
-rw-r--r--browser/base/content/test/browser_bug537474.js8
-rw-r--r--browser/base/content/test/browser_bug550565.js21
-rw-r--r--browser/base/content/test/browser_bug553455.js903
-rw-r--r--browser/base/content/test/browser_bug555224.js40
-rw-r--r--browser/base/content/test/browser_bug555767.js68
-rw-r--r--browser/base/content/test/browser_bug556061.js96
-rw-r--r--browser/base/content/test/browser_bug559991.js42
-rw-r--r--browser/base/content/test/browser_bug561623.js29
-rw-r--r--browser/base/content/test/browser_bug561636.js474
-rw-r--r--browser/base/content/test/browser_bug562649.js27
-rw-r--r--browser/base/content/test/browser_bug563588.js30
-rw-r--r--browser/base/content/test/browser_bug565575.js13
-rw-r--r--browser/base/content/test/browser_bug565667.js59
-rw-r--r--browser/base/content/test/browser_bug567306.js44
-rw-r--r--browser/base/content/test/browser_bug575561.js90
-rw-r--r--browser/base/content/test/browser_bug575830.js33
-rw-r--r--browser/base/content/test/browser_bug577121.js24
-rw-r--r--browser/base/content/test/browser_bug578534.js29
-rw-r--r--browser/base/content/test/browser_bug579872.js29
-rw-r--r--browser/base/content/test/browser_bug580638.js58
-rw-r--r--browser/base/content/test/browser_bug580956.js29
-rw-r--r--browser/base/content/test/browser_bug581242.js21
-rw-r--r--browser/base/content/test/browser_bug581253.js102
-rw-r--r--browser/base/content/test/browser_bug581947.js90
-rw-r--r--browser/base/content/test/browser_bug585558.js152
-rw-r--r--browser/base/content/test/browser_bug585785.js35
-rw-r--r--browser/base/content/test/browser_bug585830.js25
-rw-r--r--browser/base/content/test/browser_bug590206.js136
-rw-r--r--browser/base/content/test/browser_bug592338.js136
-rw-r--r--browser/base/content/test/browser_bug594131.js23
-rw-r--r--browser/base/content/test/browser_bug595507.js39
-rw-r--r--browser/base/content/test/browser_bug596687.js26
-rw-r--r--browser/base/content/test/browser_bug597218.js38
-rw-r--r--browser/base/content/test/browser_bug598923.js33
-rw-r--r--browser/base/content/test/browser_bug599325.js21
-rw-r--r--browser/base/content/test/browser_bug609700.js20
-rw-r--r--browser/base/content/test/browser_bug616836.js4
-rw-r--r--browser/base/content/test/browser_bug623155.js136
-rw-r--r--browser/base/content/test/browser_bug623893.js46
-rw-r--r--browser/base/content/test/browser_bug624734.js23
-rw-r--r--browser/base/content/test/browser_bug647886.js36
-rw-r--r--browser/base/content/test/browser_bug655584.js23
-rw-r--r--browser/base/content/test/browser_bug664672.js19
-rw-r--r--browser/base/content/test/browser_bug676619.js121
-rw-r--r--browser/base/content/test/browser_bug678392-1.html12
-rw-r--r--browser/base/content/test/browser_bug678392-2.html12
-rw-r--r--browser/base/content/test/browser_bug678392.js192
-rw-r--r--browser/base/content/test/browser_bug710878.js29
-rw-r--r--browser/base/content/test/browser_bug719271.js89
-rw-r--r--browser/base/content/test/browser_bug724239.js33
-rw-r--r--browser/base/content/test/browser_bug734076.js107
-rw-r--r--browser/base/content/test/browser_bug743421.js118
-rw-r--r--browser/base/content/test/browser_bug744745.js46
-rw-r--r--browser/base/content/test/browser_bug749738.js36
-rw-r--r--browser/base/content/test/browser_bug752516.js48
-rw-r--r--browser/base/content/test/browser_bug763468_perwindowpb.js64
-rw-r--r--browser/base/content/test/browser_bug767836_perwindowpb.js83
-rw-r--r--browser/base/content/test/browser_bug771331.js82
-rw-r--r--browser/base/content/test/browser_bug783614.js13
-rw-r--r--browser/base/content/test/browser_bug787619.js52
-rw-r--r--browser/base/content/test/browser_bug797677.js47
-rw-r--r--browser/base/content/test/browser_bug812562.js96
-rw-r--r--browser/base/content/test/browser_bug816527.js122
-rw-r--r--browser/base/content/test/browser_bug817947.js56
-rw-r--r--browser/base/content/test/browser_bug818118.js48
-rw-r--r--browser/base/content/test/browser_bug820497.js61
-rw-r--r--browser/base/content/test/browser_bug822367.js196
-rw-r--r--browser/base/content/test/browser_bug832435.js23
-rw-r--r--browser/base/content/test/browser_bug839103.js159
-rw-r--r--browser/base/content/test/browser_bug880101.js50
-rw-r--r--browser/base/content/test/browser_bug902156.js213
-rw-r--r--browser/base/content/test/browser_canonizeURL.js54
-rw-r--r--browser/base/content/test/browser_clearplugindata.html32
-rw-r--r--browser/base/content/test/browser_clearplugindata.js140
-rw-r--r--browser/base/content/test/browser_clearplugindata_noage.html32
-rw-r--r--browser/base/content/test/browser_contentAreaClick.js307
-rw-r--r--browser/base/content/test/browser_contextSearchTabPosition.js68
-rw-r--r--browser/base/content/test/browser_ctrlTab.js151
-rw-r--r--browser/base/content/test/browser_customize.js24
-rw-r--r--browser/base/content/test/browser_customize_popupNotification.js27
-rw-r--r--browser/base/content/test/browser_datareporting_notification.js198
-rw-r--r--browser/base/content/test/browser_disablechrome.js191
-rw-r--r--browser/base/content/test/browser_discovery.js159
-rw-r--r--browser/base/content/test/browser_drag.js45
-rw-r--r--browser/base/content/test/browser_duplicateIDs.js8
-rw-r--r--browser/base/content/test/browser_findbarClose.js40
-rw-r--r--browser/base/content/test/browser_fullscreen-window-open.js394
-rw-r--r--browser/base/content/test/browser_gestureSupport.js671
-rw-r--r--browser/base/content/test/browser_getshortcutoruri.js146
-rw-r--r--browser/base/content/test/browser_hide_removing.js35
-rw-r--r--browser/base/content/test/browser_homeDrop.js91
-rw-r--r--browser/base/content/test/browser_identity_UI.js119
-rw-r--r--browser/base/content/test/browser_keywordBookmarklets.js38
-rw-r--r--browser/base/content/test/browser_keywordSearch.js86
-rw-r--r--browser/base/content/test/browser_keywordSearch_postData.js94
-rw-r--r--browser/base/content/test/browser_lastAccessedTab.js26
-rw-r--r--browser/base/content/test/browser_locationBarCommand.js213
-rw-r--r--browser/base/content/test/browser_locationBarExternalLoad.js65
-rw-r--r--browser/base/content/test/browser_middleMouse_inherit.js55
-rw-r--r--browser/base/content/test/browser_minimize.js37
-rw-r--r--browser/base/content/test/browser_offlineQuotaNotification.js74
-rw-r--r--browser/base/content/test/browser_overflowScroll.js87
-rw-r--r--browser/base/content/test/browser_pageInfo.js38
-rw-r--r--browser/base/content/test/browser_pageInfo_plugins.js187
-rw-r--r--browser/base/content/test/browser_page_style_menu.js67
-rw-r--r--browser/base/content/test/browser_pinnedTabs.js73
-rw-r--r--browser/base/content/test/browser_plainTextLinks.js115
-rw-r--r--browser/base/content/test/browser_pluginCrashCommentAndURL.js154
-rw-r--r--browser/base/content/test/browser_pluginnotification.js841
-rw-r--r--browser/base/content/test/browser_pluginplaypreview.js317
-rw-r--r--browser/base/content/test/browser_pluginplaypreview2.js179
-rw-r--r--browser/base/content/test/browser_plugins_added_dynamically.js179
-rw-r--r--browser/base/content/test/browser_popupNotification.js991
-rw-r--r--browser/base/content/test/browser_popupUI.js57
-rw-r--r--browser/base/content/test/browser_private_browsing_window.js65
-rw-r--r--browser/base/content/test/browser_private_no_prompt.js13
-rw-r--r--browser/base/content/test/browser_relatedTabs.js49
-rw-r--r--browser/base/content/test/browser_removeTabsToTheEnd.js24
-rw-r--r--browser/base/content/test/browser_sanitize-download-history.js142
-rw-r--r--browser/base/content/test/browser_sanitize-passwordDisabledHosts.js41
-rw-r--r--browser/base/content/test/browser_sanitize-sitepermissions.js37
-rw-r--r--browser/base/content/test/browser_sanitize-timespans.js810
-rw-r--r--browser/base/content/test/browser_sanitizeDialog.js1099
-rw-r--r--browser/base/content/test/browser_sanitizeDialog_treeView.js632
-rw-r--r--browser/base/content/test/browser_save_link-perwindowpb.js167
-rw-r--r--browser/base/content/test/browser_save_private_link_perwindowpb.js131
-rw-r--r--browser/base/content/test/browser_save_video.js91
-rw-r--r--browser/base/content/test/browser_scope.js4
-rw-r--r--browser/base/content/test/browser_selectTabAtIndex.js19
-rw-r--r--browser/base/content/test/browser_tabDrop.js71
-rw-r--r--browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js249
-rw-r--r--browser/base/content/test/browser_tab_drag_drop_perwindow.js50
-rw-r--r--browser/base/content/test/browser_tab_dragdrop.js118
-rw-r--r--browser/base/content/test/browser_tab_dragdrop2.js52
-rw-r--r--browser/base/content/test/browser_tab_dragdrop2_frame1.xul167
-rw-r--r--browser/base/content/test/browser_tabfocus.js278
-rw-r--r--browser/base/content/test/browser_tabopen_reflows.js126
-rw-r--r--browser/base/content/test/browser_tabs_isActive.js29
-rw-r--r--browser/base/content/test/browser_tabs_owner.js32
-rw-r--r--browser/base/content/test/browser_typeAheadFind.js28
-rw-r--r--browser/base/content/test/browser_unloaddialogs.js134
-rw-r--r--browser/base/content/test/browser_urlHighlight.js112
-rw-r--r--browser/base/content/test/browser_urlbarAutoFillTrimURLs.js85
-rw-r--r--browser/base/content/test/browser_urlbarCopying.js204
-rw-r--r--browser/base/content/test/browser_urlbarEnter.js69
-rw-r--r--browser/base/content/test/browser_urlbarRevert.js29
-rw-r--r--browser/base/content/test/browser_urlbarStop.js40
-rw-r--r--browser/base/content/test/browser_urlbarTrimURLs.js89
-rw-r--r--browser/base/content/test/browser_urlbar_search_healthreport.js65
-rw-r--r--browser/base/content/test/browser_utilityOverlay.js62
-rw-r--r--browser/base/content/test/browser_visibleFindSelection.js39
-rw-r--r--browser/base/content/test/browser_visibleTabs.js93
-rw-r--r--browser/base/content/test/browser_visibleTabs_bookmarkAllPages.js34
-rw-r--r--browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js66
-rw-r--r--browser/base/content/test/browser_visibleTabs_contextMenu.js54
-rw-r--r--browser/base/content/test/browser_visibleTabs_tabPreview.js41
-rw-r--r--browser/base/content/test/browser_wyciwyg_urlbarCopying.js39
-rw-r--r--browser/base/content/test/browser_zbug569342.js78
-rw-r--r--browser/base/content/test/bug364677-data.xml5
-rw-r--r--browser/base/content/test/bug364677-data.xml^headers^1
-rw-r--r--browser/base/content/test/bug395533-data.txt6
-rw-r--r--browser/base/content/test/bug564387.html11
-rw-r--r--browser/base/content/test/bug564387_video1.ogvbin28942 -> 0 bytes
-rw-r--r--browser/base/content/test/bug564387_video1.ogv^headers^3
-rw-r--r--browser/base/content/test/bug592338.html24
-rw-r--r--browser/base/content/test/bug792517-2.html5
-rw-r--r--browser/base/content/test/bug792517.html5
-rw-r--r--browser/base/content/test/bug792517.sjs13
-rw-r--r--browser/base/content/test/bug839103.css1
-rw-r--r--browser/base/content/test/ctxmenu-image.pngbin5401 -> 0 bytes
-rw-r--r--browser/base/content/test/disablechrome.html4
-rw-r--r--browser/base/content/test/discovery.html8
-rw-r--r--browser/base/content/test/domplate_test.js51
-rw-r--r--browser/base/content/test/download_page.html47
-rw-r--r--browser/base/content/test/dummy_page.html8
-rw-r--r--browser/base/content/test/feed_discovery.html113
-rw-r--r--browser/base/content/test/feed_tab.html17
-rw-r--r--browser/base/content/test/file_bug550565_favicon.icobin1406 -> 0 bytes
-rw-r--r--browser/base/content/test/file_bug550565_popup.html12
-rw-r--r--browser/base/content/test/file_bug822367_1.html18
-rw-r--r--browser/base/content/test/file_bug822367_1.js1
-rw-r--r--browser/base/content/test/file_bug822367_2.html16
-rw-r--r--browser/base/content/test/file_bug822367_3.html27
-rw-r--r--browser/base/content/test/file_bug822367_4.html18
-rw-r--r--browser/base/content/test/file_bug822367_4.js1
-rw-r--r--browser/base/content/test/file_bug822367_4B.html18
-rw-r--r--browser/base/content/test/file_bug822367_5.html24
-rw-r--r--browser/base/content/test/file_bug822367_6.html16
-rw-r--r--browser/base/content/test/file_bug902156.js5
-rw-r--r--browser/base/content/test/file_bug902156_1.html15
-rw-r--r--browser/base/content/test/file_bug902156_2.html17
-rw-r--r--browser/base/content/test/file_bug902156_3.html15
-rw-r--r--browser/base/content/test/file_fullscreen-window-open.html24
-rw-r--r--browser/base/content/test/gZipOfflineChild.cacheManifest2
-rw-r--r--browser/base/content/test/gZipOfflineChild.cacheManifest^headers^1
-rw-r--r--browser/base/content/test/gZipOfflineChild.htmlbin298 -> 0 bytes
-rw-r--r--browser/base/content/test/gZipOfflineChild.html^headers^2
-rw-r--r--browser/base/content/test/gZipOfflineChild_uncompressed.html21
-rw-r--r--browser/base/content/test/head.js400
-rw-r--r--browser/base/content/test/head_plain.js15
-rw-r--r--browser/base/content/test/healthreport_testRemoteCommands.html128
-rw-r--r--browser/base/content/test/moz.build8
-rw-r--r--browser/base/content/test/moz.pngbin580 -> 0 bytes
-rw-r--r--browser/base/content/test/newtab/Makefile.in38
-rw-r--r--browser/base/content/test/newtab/browser_newtab_block.js61
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug721442.js23
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug722273.js68
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug723102.js19
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug723121.js30
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug725996.js23
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug734043.js27
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug735987.js26
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug752841.js53
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug765628.js27
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug876313.js24
-rw-r--r--browser/base/content/test/newtab/browser_newtab_disable.js34
-rw-r--r--browser/base/content/test/newtab/browser_newtab_drag_drop.js74
-rw-r--r--browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js55
-rw-r--r--browser/base/content/test/newtab/browser_newtab_drop_preview.js22
-rw-r--r--browser/base/content/test/newtab/browser_newtab_focus.js57
-rw-r--r--browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js68
-rw-r--r--browser/base/content/test/newtab/browser_newtab_reset.js28
-rw-r--r--browser/base/content/test/newtab/browser_newtab_tabsync.js61
-rw-r--r--browser/base/content/test/newtab/browser_newtab_undo.js49
-rw-r--r--browser/base/content/test/newtab/browser_newtab_unpin.js56
-rw-r--r--browser/base/content/test/newtab/head.js390
-rw-r--r--browser/base/content/test/newtab/moz.build6
-rw-r--r--browser/base/content/test/offlineChild.cacheManifest2
-rw-r--r--browser/base/content/test/offlineChild.cacheManifest^headers^1
-rw-r--r--browser/base/content/test/offlineChild.html20
-rw-r--r--browser/base/content/test/offlineChild2.cacheManifest2
-rw-r--r--browser/base/content/test/offlineChild2.cacheManifest^headers^1
-rw-r--r--browser/base/content/test/offlineChild2.html20
-rw-r--r--browser/base/content/test/offlineEvent.cacheManifest2
-rw-r--r--browser/base/content/test/offlineEvent.cacheManifest^headers^1
-rw-r--r--browser/base/content/test/offlineEvent.html9
-rw-r--r--browser/base/content/test/offlineQuotaNotification.cacheManifest7
-rw-r--r--browser/base/content/test/offlineQuotaNotification.html9
-rw-r--r--browser/base/content/test/page_style_sample.html40
-rw-r--r--browser/base/content/test/pluginCrashCommentAndURL.html27
-rw-r--r--browser/base/content/test/plugin_add_dynamically.html17
-rw-r--r--browser/base/content/test/plugin_alternate_content.html9
-rw-r--r--browser/base/content/test/plugin_both.html10
-rw-r--r--browser/base/content/test/plugin_both2.html10
-rw-r--r--browser/base/content/test/plugin_bug744745.html12
-rw-r--r--browser/base/content/test/plugin_bug749455.html8
-rw-r--r--browser/base/content/test/plugin_bug752516.html24
-rw-r--r--browser/base/content/test/plugin_bug787619.html9
-rw-r--r--browser/base/content/test/plugin_bug797677.html5
-rw-r--r--browser/base/content/test/plugin_bug820497.html17
-rw-r--r--browser/base/content/test/plugin_clickToPlayAllow.html9
-rw-r--r--browser/base/content/test/plugin_clickToPlayDeny.html9
-rw-r--r--browser/base/content/test/plugin_data_url.html11
-rw-r--r--browser/base/content/test/plugin_hidden_to_visible.html11
-rw-r--r--browser/base/content/test/plugin_test.html9
-rw-r--r--browser/base/content/test/plugin_test2.html10
-rw-r--r--browser/base/content/test/plugin_test3.html9
-rw-r--r--browser/base/content/test/plugin_two_types.html9
-rw-r--r--browser/base/content/test/plugin_unknown.html9
-rw-r--r--browser/base/content/test/print_postdata.sjs22
-rw-r--r--browser/base/content/test/privateBrowsingMode.js3
-rw-r--r--browser/base/content/test/redirect_bug623155.sjs16
-rw-r--r--browser/base/content/test/social/Makefile.in47
-rw-r--r--browser/base/content/test/social/blocklist.xml6
-rw-r--r--browser/base/content/test/social/browser_addons.js327
-rw-r--r--browser/base/content/test/social/browser_blocklist.js179
-rw-r--r--browser/base/content/test/social/browser_chat_tearoff.js121
-rw-r--r--browser/base/content/test/social/browser_defaults.js14
-rw-r--r--browser/base/content/test/social/browser_share.js140
-rw-r--r--browser/base/content/test/social/browser_social_activation.js348
-rw-r--r--browser/base/content/test/social/browser_social_chatwindow.js472
-rw-r--r--browser/base/content/test/social/browser_social_chatwindow_resize.js90
-rw-r--r--browser/base/content/test/social/browser_social_chatwindowfocus.js360
-rw-r--r--browser/base/content/test/social/browser_social_errorPage.js183
-rw-r--r--browser/base/content/test/social/browser_social_flyout.js164
-rw-r--r--browser/base/content/test/social/browser_social_isVisible.js67
-rw-r--r--browser/base/content/test/social/browser_social_markButton.js187
-rw-r--r--browser/base/content/test/social/browser_social_mozSocial_API.js81
-rw-r--r--browser/base/content/test/social/browser_social_multiprovider.js111
-rw-r--r--browser/base/content/test/social/browser_social_perwindowPB.js82
-rw-r--r--browser/base/content/test/social/browser_social_sidebar.js105
-rw-r--r--browser/base/content/test/social/browser_social_toolbar.js195
-rw-r--r--browser/base/content/test/social/browser_social_window.js145
-rw-r--r--browser/base/content/test/social/head.js517
-rw-r--r--browser/base/content/test/social/moz.build7
-rw-r--r--browser/base/content/test/social/moz.pngbin580 -> 0 bytes
-rw-r--r--browser/base/content/test/social/opengraph/Makefile.in21
-rw-r--r--browser/base/content/test/social/opengraph/moz.build4
-rw-r--r--browser/base/content/test/social/opengraph/og_invalid_url.html11
-rw-r--r--browser/base/content/test/social/opengraph/opengraph.html13
-rw-r--r--browser/base/content/test/social/opengraph/shortlink_linkrel.html10
-rw-r--r--browser/base/content/test/social/opengraph/shorturl_link.html10
-rw-r--r--browser/base/content/test/social/opengraph/shorturl_linkrel.html25
-rw-r--r--browser/base/content/test/social/share.html18
-rw-r--r--browser/base/content/test/social/social_activate.html45
-rw-r--r--browser/base/content/test/social/social_activate_iframe.html11
-rw-r--r--browser/base/content/test/social/social_chat.html32
-rw-r--r--browser/base/content/test/social/social_flyout.html37
-rw-r--r--browser/base/content/test/social/social_mark_image.pngbin934 -> 0 bytes
-rw-r--r--browser/base/content/test/social/social_panel.html24
-rw-r--r--browser/base/content/test/social/social_sidebar.html47
-rw-r--r--browser/base/content/test/social/social_window.html17
-rw-r--r--browser/base/content/test/social/social_worker.js149
-rw-r--r--browser/base/content/test/subtst_contextmenu.html71
-rw-r--r--browser/base/content/test/test_bug364677.html32
-rw-r--r--browser/base/content/test/test_bug395533.html39
-rw-r--r--browser/base/content/test/test_bug435035.html1
-rw-r--r--browser/base/content/test/test_bug452451.html96
-rw-r--r--browser/base/content/test/test_bug462673.html18
-rw-r--r--browser/base/content/test/test_bug628179.html10
-rw-r--r--browser/base/content/test/test_bug839103.html10
-rw-r--r--browser/base/content/test/test_contextmenu.html1088
-rw-r--r--browser/base/content/test/test_feed_discovery.html54
-rw-r--r--browser/base/content/test/test_offlineNotification.html126
-rw-r--r--browser/base/content/test/test_offline_gzip.html112
-rw-r--r--browser/base/content/test/test_wyciwyg_copying.html13
-rw-r--r--browser/base/content/test/title_test.svg59
-rw-r--r--browser/base/content/test/video.oggbin285310 -> 0 bytes
-rw-r--r--browser/base/content/test/zoom_test.html14
-rw-r--r--browser/base/moz.build2
-rw-r--r--browser/components/certerror/moz.build2
-rw-r--r--browser/components/certerror/test/Makefile.in19
-rw-r--r--browser/components/certerror/test/browser_bug431826.js41
-rw-r--r--browser/components/certerror/test/browser_bug633691.js25
-rw-r--r--browser/components/certerror/test/moz.build6
-rw-r--r--browser/components/dirprovider/moz.build2
-rw-r--r--browser/components/dirprovider/tests/moz.build9
-rw-r--r--browser/components/dirprovider/tests/unit/head_dirprovider.js20
-rw-r--r--browser/components/dirprovider/tests/unit/test_bookmark_pref.js14
-rw-r--r--browser/components/dirprovider/tests/unit/test_keys.js21
-rw-r--r--browser/components/dirprovider/tests/unit/xpcshell.ini7
-rw-r--r--browser/components/downloads/moz.build2
-rw-r--r--browser/components/downloads/test/browser/Makefile.in19
-rw-r--r--browser/components/downloads/test/browser/browser_basic_functionality.js62
-rw-r--r--browser/components/downloads/test/browser/browser_first_download_panel.js56
-rw-r--r--browser/components/downloads/test/browser/head.js274
-rw-r--r--browser/components/downloads/test/browser/moz.build6
-rw-r--r--browser/components/downloads/test/moz.build9
-rw-r--r--browser/components/downloads/test/unit/head.js18
-rw-r--r--browser/components/downloads/test/unit/test_DownloadsCommon.js37
-rw-r--r--browser/components/downloads/test/unit/xpcshell.ini6
-rw-r--r--browser/components/feeds/moz.build2
-rw-r--r--browser/components/feeds/test/Makefile.in27
-rw-r--r--browser/components/feeds/test/bug368464-data.xml18
-rw-r--r--browser/components/feeds/test/bug408328-data.xml63
-rw-r--r--browser/components/feeds/test/bug436801-data.xml44
-rw-r--r--browser/components/feeds/test/bug494328-data.xml24
-rw-r--r--browser/components/feeds/test/bug589543-data.xml23
-rw-r--r--browser/components/feeds/test/chrome/Makefile.in27
-rw-r--r--browser/components/feeds/test/chrome/moz.build6
-rw-r--r--browser/components/feeds/test/chrome/sample_feed.atom23
-rw-r--r--browser/components/feeds/test/chrome/test_423060.xul56
-rw-r--r--browser/components/feeds/test/chrome/test_bug368464.html32
-rw-r--r--browser/components/feeds/test/chrome/test_bug408328.html37
-rw-r--r--browser/components/feeds/test/chrome/test_maxSniffing.html37
-rw-r--r--browser/components/feeds/test/moz.build11
-rw-r--r--browser/components/feeds/test/test_bug436801.html118
-rw-r--r--browser/components/feeds/test/test_bug494328.html36
-rw-r--r--browser/components/feeds/test/test_bug589543.html33
-rw-r--r--browser/components/feeds/test/test_registerHandler.html85
-rw-r--r--browser/components/feeds/test/unit/head_feeds.js5
-rw-r--r--browser/components/feeds/test/unit/test_355473.js27
-rw-r--r--browser/components/feeds/test/unit/test_758990.js42
-rw-r--r--browser/components/feeds/test/unit/xpcshell.ini7
-rw-r--r--browser/components/feeds/test/valid-feed.xml23
-rw-r--r--browser/components/feeds/test/valid-unsniffable-feed.xml32
-rw-r--r--browser/components/migration/moz.build2
-rw-r--r--browser/components/migration/tests/moz.build7
-rw-r--r--browser/components/migration/tests/unit/head_migration.js64
-rw-r--r--browser/components/migration/tests/unit/test_IE_bookmarks.js56
-rw-r--r--browser/components/migration/tests/unit/xpcshell.ini7
-rw-r--r--browser/components/moz.build1
-rw-r--r--browser/components/places/moz.build1
-rw-r--r--browser/components/places/tests/browser/Makefile.in47
-rw-r--r--browser/components/places/tests/browser/browser_0_library_left_pane_migration.js93
-rw-r--r--browser/components/places/tests/browser/browser_410196_paste_into_tags.js141
-rw-r--r--browser/components/places/tests/browser/browser_416459_cut.js72
-rw-r--r--browser/components/places/tests/browser/browser_423515.js220
-rw-r--r--browser/components/places/tests/browser/browser_425884.js103
-rw-r--r--browser/components/places/tests/browser/browser_475045.js65
-rw-r--r--browser/components/places/tests/browser/browser_555547.js59
-rw-r--r--browser/components/places/tests/browser/browser_bookmarksProperties.js601
-rw-r--r--browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js255
-rw-r--r--browser/components/places/tests/browser/browser_forgetthissite_single.js73
-rw-r--r--browser/components/places/tests/browser/browser_history_sidebar_search.js89
-rw-r--r--browser/components/places/tests/browser/browser_library_batch_delete.js114
-rw-r--r--browser/components/places/tests/browser/browser_library_downloads.js70
-rw-r--r--browser/components/places/tests/browser/browser_library_infoBox.js199
-rw-r--r--browser/components/places/tests/browser/browser_library_left_pane_commands.js156
-rw-r--r--browser/components/places/tests/browser/browser_library_left_pane_fixnames.js94
-rw-r--r--browser/components/places/tests/browser/browser_library_middleclick.js281
-rw-r--r--browser/components/places/tests/browser/browser_library_open_leak.js23
-rw-r--r--browser/components/places/tests/browser/browser_library_panel_leak.js55
-rw-r--r--browser/components/places/tests/browser/browser_library_search.js187
-rw-r--r--browser/components/places/tests/browser/browser_library_views_liveupdate.js301
-rw-r--r--browser/components/places/tests/browser/browser_markPageAsFollowedLink.js86
-rw-r--r--browser/components/places/tests/browser/browser_sidebarpanels_click.js179
-rw-r--r--browser/components/places/tests/browser/browser_sort_in_library.js254
-rw-r--r--browser/components/places/tests/browser/browser_toolbar_migration.js135
-rw-r--r--browser/components/places/tests/browser/browser_views_liveupdate.js474
-rw-r--r--browser/components/places/tests/browser/frameLeft.html8
-rw-r--r--browser/components/places/tests/browser/frameRight.html8
-rw-r--r--browser/components/places/tests/browser/framedPage.html9
-rw-r--r--browser/components/places/tests/browser/head.js147
-rw-r--r--browser/components/places/tests/browser/moz.build6
-rw-r--r--browser/components/places/tests/browser/sidebarpanels_click_test_page.html7
-rw-r--r--browser/components/places/tests/chrome/Makefile.in26
-rw-r--r--browser/components/places/tests/chrome/head.js69
-rw-r--r--browser/components/places/tests/chrome/moz.build6
-rw-r--r--browser/components/places/tests/chrome/test_0_bug510634.xul100
-rw-r--r--browser/components/places/tests/chrome/test_0_multiple_left_pane.xul82
-rw-r--r--browser/components/places/tests/chrome/test_bug427633_no_newfolder_if_noip.xul86
-rw-r--r--browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul85
-rw-r--r--browser/components/places/tests/chrome/test_bug549192.xul115
-rw-r--r--browser/components/places/tests/chrome/test_bug549491.xul97
-rw-r--r--browser/components/places/tests/chrome/test_bug631374_tags_selector_scroll.xul154
-rw-r--r--browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul198
-rw-r--r--browser/components/places/tests/chrome/test_treeview_date.xul188
-rw-r--r--browser/components/places/tests/moz.build11
-rw-r--r--browser/components/places/tests/unit/bookmarks.glue.html16
-rw-r--r--browser/components/places/tests/unit/bookmarks.glue.json1
-rw-r--r--browser/components/places/tests/unit/corruptDB.sqlitebin32772 -> 0 bytes
-rw-r--r--browser/components/places/tests/unit/distribution.ini21
-rw-r--r--browser/components/places/tests/unit/head_bookmarks.js71
-rw-r--r--browser/components/places/tests/unit/test_421483.js94
-rw-r--r--browser/components/places/tests/unit/test_PUIU_makeTransaction.js351
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_corrupt.js85
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup.js81
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup_default.js80
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_distribution.js103
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_migrate.js88
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_prefs.js282
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_restore.js81
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_shutdown.js162
-rw-r--r--browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js346
-rw-r--r--browser/components/places/tests/unit/test_clearHistory_shutdown.js183
-rw-r--r--browser/components/places/tests/unit/test_leftpane_corruption_handling.js198
-rw-r--r--browser/components/places/tests/unit/xpcshell.ini18
-rw-r--r--browser/components/preferences/moz.build2
-rw-r--r--browser/components/preferences/tests/Makefile.in31
-rw-r--r--browser/components/preferences/tests/browser_advanced_update.js36
-rw-r--r--browser/components/preferences/tests/browser_bug410900.js51
-rw-r--r--browser/components/preferences/tests/browser_bug705422.js145
-rw-r--r--browser/components/preferences/tests/browser_chunk_permissions.js150
-rw-r--r--browser/components/preferences/tests/browser_healthreport.js50
-rw-r--r--browser/components/preferences/tests/browser_permissions.js342
-rw-r--r--browser/components/preferences/tests/browser_privacypane_1.js27
-rw-r--r--browser/components/preferences/tests/browser_privacypane_3.js26
-rw-r--r--browser/components/preferences/tests/browser_privacypane_4.js31
-rw-r--r--browser/components/preferences/tests/browser_privacypane_5.js26
-rw-r--r--browser/components/preferences/tests/browser_privacypane_8.js35
-rw-r--r--browser/components/preferences/tests/head.js57
-rw-r--r--browser/components/preferences/tests/moz.build6
-rw-r--r--browser/components/preferences/tests/privacypane_tests_perwindow.js360
-rw-r--r--browser/components/privatebrowsing/moz.build2
-rw-r--r--browser/components/privatebrowsing/test/browser/Makefile.in58
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_DownloadLastDirWithCPS.js279
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js50
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js49
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js53
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js73
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html33
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.html11
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js161
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js59
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js95
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js95
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_toggle.js97
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js69
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html13
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js49
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js53
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js66
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html11
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html10
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html10
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html10
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_noSessionRestoreMenuOption.js34
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_nonbrowser.js33
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js63
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js133
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js100
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.html8
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js123
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js108
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js86
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js65
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html13
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js38
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js82
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js67
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js99
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html9
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js60
-rw-r--r--browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js85
-rw-r--r--browser/components/privatebrowsing/test/browser/head.js40
-rw-r--r--browser/components/privatebrowsing/test/browser/moz.build9
-rw-r--r--browser/components/privatebrowsing/test/browser/popup.html11
-rw-r--r--browser/components/privatebrowsing/test/browser/title.sjs22
-rw-r--r--browser/components/privatebrowsing/test/moz.build10
-rw-r--r--browser/components/safebrowsing/content/test/Makefile.in27
-rw-r--r--browser/components/safebrowsing/content/test/browser_bug400731.js49
-rw-r--r--browser/components/safebrowsing/content/test/browser_bug415846.js62
-rw-r--r--browser/components/safebrowsing/content/test/head.js3
-rw-r--r--browser/components/safebrowsing/content/test/moz.build6
-rw-r--r--browser/components/safebrowsing/moz.build1
-rw-r--r--browser/components/search/moz.build2
-rw-r--r--browser/components/search/test/426329.xml11
-rw-r--r--browser/components/search/test/483086-1.xml10
-rw-r--r--browser/components/search/test/483086-2.xml10
-rw-r--r--browser/components/search/test/Makefile.in40
-rw-r--r--browser/components/search/test/browser_405664.js29
-rw-r--r--browser/components/search/test/browser_426329.js299
-rw-r--r--browser/components/search/test/browser_483086.js51
-rw-r--r--browser/components/search/test/browser_addEngine.js136
-rw-r--r--browser/components/search/test/browser_contextmenu.js99
-rw-r--r--browser/components/search/test/browser_google.js176
-rw-r--r--browser/components/search/test/browser_healthreport.js102
-rw-r--r--browser/components/search/test/browser_private_search_perwindowpb.js116
-rw-r--r--browser/components/search/test/head.js53
-rw-r--r--browser/components/search/test/moz.build6
-rw-r--r--browser/components/search/test/test.html8
-rw-r--r--browser/components/search/test/testEngine.src11
-rw-r--r--browser/components/search/test/testEngine.xml12
-rw-r--r--browser/components/search/test/testEngine_mozsearch.xml15
-rw-r--r--browser/components/sessionstore/moz.build1
-rw-r--r--browser/components/sessionstore/test/Makefile.in169
-rw-r--r--browser/components/sessionstore/test/browser_248970_b_perwindowpb.js167
-rw-r--r--browser/components/sessionstore/test/browser_248970_b_sample.html37
-rw-r--r--browser/components/sessionstore/test/browser_339445.js34
-rw-r--r--browser/components/sessionstore/test/browser_339445_sample.html18
-rw-r--r--browser/components/sessionstore/test/browser_345898.js43
-rw-r--r--browser/components/sessionstore/test/browser_346337.js126
-rw-r--r--browser/components/sessionstore/test/browser_346337_sample.html37
-rw-r--r--browser/components/sessionstore/test/browser_350525.js101
-rw-r--r--browser/components/sessionstore/test/browser_354894_perwindowpb.js513
-rw-r--r--browser/components/sessionstore/test/browser_367052.js38
-rw-r--r--browser/components/sessionstore/test/browser_393716.js74
-rw-r--r--browser/components/sessionstore/test/browser_394759_basic.js75
-rw-r--r--browser/components/sessionstore/test/browser_394759_behavior.js64
-rw-r--r--browser/components/sessionstore/test/browser_394759_perwindowpb.js119
-rw-r--r--browser/components/sessionstore/test/browser_394759_purge.js128
-rw-r--r--browser/components/sessionstore/test/browser_408470.js56
-rw-r--r--browser/components/sessionstore/test/browser_408470_sample.html19
-rw-r--r--browser/components/sessionstore/test/browser_423132.js73
-rw-r--r--browser/components/sessionstore/test/browser_423132_sample.html14
-rw-r--r--browser/components/sessionstore/test/browser_447951.js50
-rw-r--r--browser/components/sessionstore/test/browser_447951_sample.html5
-rw-r--r--browser/components/sessionstore/test/browser_448741.js62
-rw-r--r--browser/components/sessionstore/test/browser_454908.js52
-rw-r--r--browser/components/sessionstore/test/browser_454908_sample.html8
-rw-r--r--browser/components/sessionstore/test/browser_456342.js53
-rw-r--r--browser/components/sessionstore/test/browser_456342_sample.xhtml28
-rw-r--r--browser/components/sessionstore/test/browser_459906.js62
-rw-r--r--browser/components/sessionstore/test/browser_459906_empty.html3
-rw-r--r--browser/components/sessionstore/test/browser_459906_sample.html41
-rw-r--r--browser/components/sessionstore/test/browser_461634.js75
-rw-r--r--browser/components/sessionstore/test/browser_461743.js39
-rw-r--r--browser/components/sessionstore/test/browser_461743_sample.html55
-rw-r--r--browser/components/sessionstore/test/browser_463205.js123
-rw-r--r--browser/components/sessionstore/test/browser_463205_helper.html5
-rw-r--r--browser/components/sessionstore/test/browser_463205_sample.html24
-rw-r--r--browser/components/sessionstore/test/browser_463206.js64
-rw-r--r--browser/components/sessionstore/test/browser_463206_sample.html11
-rw-r--r--browser/components/sessionstore/test/browser_464199.js87
-rw-r--r--browser/components/sessionstore/test/browser_464620_a.html53
-rw-r--r--browser/components/sessionstore/test/browser_464620_a.js48
-rw-r--r--browser/components/sessionstore/test/browser_464620_b.html57
-rw-r--r--browser/components/sessionstore/test/browser_464620_b.js48
-rw-r--r--browser/components/sessionstore/test/browser_464620_xd.html5
-rw-r--r--browser/components/sessionstore/test/browser_465215.js39
-rw-r--r--browser/components/sessionstore/test/browser_465223.js48
-rw-r--r--browser/components/sessionstore/test/browser_466937.js45
-rw-r--r--browser/components/sessionstore/test/browser_466937_sample.html22
-rw-r--r--browser/components/sessionstore/test/browser_467409-backslashplosion.js91
-rw-r--r--browser/components/sessionstore/test/browser_477657.js63
-rw-r--r--browser/components/sessionstore/test/browser_480148.js216
-rw-r--r--browser/components/sessionstore/test/browser_480893.js55
-rw-r--r--browser/components/sessionstore/test/browser_483330.js37
-rw-r--r--browser/components/sessionstore/test/browser_485482.js36
-rw-r--r--browser/components/sessionstore/test/browser_485482_sample.html12
-rw-r--r--browser/components/sessionstore/test/browser_485563.js27
-rw-r--r--browser/components/sessionstore/test/browser_490040.js123
-rw-r--r--browser/components/sessionstore/test/browser_491168.js46
-rw-r--r--browser/components/sessionstore/test/browser_491577.js121
-rw-r--r--browser/components/sessionstore/test/browser_495495.js54
-rw-r--r--browser/components/sessionstore/test/browser_500328.js114
-rw-r--r--browser/components/sessionstore/test/browser_506482.js76
-rw-r--r--browser/components/sessionstore/test/browser_514751.js39
-rw-r--r--browser/components/sessionstore/test/browser_522375.js21
-rw-r--r--browser/components/sessionstore/test/browser_522545.js270
-rw-r--r--browser/components/sessionstore/test/browser_524745.js46
-rw-r--r--browser/components/sessionstore/test/browser_526613.js72
-rw-r--r--browser/components/sessionstore/test/browser_528776.js27
-rw-r--r--browser/components/sessionstore/test/browser_579868.js35
-rw-r--r--browser/components/sessionstore/test/browser_579879.js23
-rw-r--r--browser/components/sessionstore/test/browser_580512.js73
-rw-r--r--browser/components/sessionstore/test/browser_581593.js52
-rw-r--r--browser/components/sessionstore/test/browser_581937.js36
-rw-r--r--browser/components/sessionstore/test/browser_586068-apptabs.js53
-rw-r--r--browser/components/sessionstore/test/browser_586068-apptabs_ondemand.js50
-rw-r--r--browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js108
-rw-r--r--browser/components/sessionstore/test/browser_586068-cascade.js51
-rw-r--r--browser/components/sessionstore/test/browser_586068-multi_window.js66
-rw-r--r--browser/components/sessionstore/test/browser_586068-reload.js140
-rw-r--r--browser/components/sessionstore/test/browser_586068-select.js66
-rw-r--r--browser/components/sessionstore/test/browser_586068-window_state.js60
-rw-r--r--browser/components/sessionstore/test/browser_586068-window_state_override.js60
-rw-r--r--browser/components/sessionstore/test/browser_586147.js52
-rw-r--r--browser/components/sessionstore/test/browser_588426.js41
-rw-r--r--browser/components/sessionstore/test/browser_589246.js243
-rw-r--r--browser/components/sessionstore/test/browser_590268.js136
-rw-r--r--browser/components/sessionstore/test/browser_590563.js78
-rw-r--r--browser/components/sessionstore/test/browser_595601-restore_hidden.js111
-rw-r--r--browser/components/sessionstore/test/browser_597071.js53
-rw-r--r--browser/components/sessionstore/test/browser_597315.js58
-rw-r--r--browser/components/sessionstore/test/browser_597315_a.html5
-rw-r--r--browser/components/sessionstore/test/browser_597315_b.html10
-rw-r--r--browser/components/sessionstore/test/browser_597315_c.html5
-rw-r--r--browser/components/sessionstore/test/browser_597315_c1.html5
-rw-r--r--browser/components/sessionstore/test/browser_597315_c2.html5
-rw-r--r--browser/components/sessionstore/test/browser_597315_index.html10
-rw-r--r--browser/components/sessionstore/test/browser_599909.js113
-rw-r--r--browser/components/sessionstore/test/browser_600545.js84
-rw-r--r--browser/components/sessionstore/test/browser_601955.js54
-rw-r--r--browser/components/sessionstore/test/browser_607016.js117
-rw-r--r--browser/components/sessionstore/test/browser_615394-SSWindowState_events.js359
-rw-r--r--browser/components/sessionstore/test/browser_618151.js62
-rw-r--r--browser/components/sessionstore/test/browser_623779.js7
-rw-r--r--browser/components/sessionstore/test/browser_624727.js39
-rw-r--r--browser/components/sessionstore/test/browser_625016.js125
-rw-r--r--browser/components/sessionstore/test/browser_625257.js85
-rw-r--r--browser/components/sessionstore/test/browser_628270.js51
-rw-r--r--browser/components/sessionstore/test/browser_635418.js54
-rw-r--r--browser/components/sessionstore/test/browser_636279.js99
-rw-r--r--browser/components/sessionstore/test/browser_637020.js74
-rw-r--r--browser/components/sessionstore/test/browser_637020_slow.sjs21
-rw-r--r--browser/components/sessionstore/test/browser_644409-scratchpads.js67
-rw-r--r--browser/components/sessionstore/test/browser_645428.js22
-rw-r--r--browser/components/sessionstore/test/browser_659591.js32
-rw-r--r--browser/components/sessionstore/test/browser_662743.js128
-rw-r--r--browser/components/sessionstore/test/browser_662743_sample.html15
-rw-r--r--browser/components/sessionstore/test/browser_662812.js34
-rw-r--r--browser/components/sessionstore/test/browser_665702-state_session.js24
-rw-r--r--browser/components/sessionstore/test/browser_682507.js16
-rw-r--r--browser/components/sessionstore/test/browser_687710.js44
-rw-r--r--browser/components/sessionstore/test/browser_687710_2.js64
-rw-r--r--browser/components/sessionstore/test/browser_694378.js33
-rw-r--r--browser/components/sessionstore/test/browser_701377.js41
-rw-r--r--browser/components/sessionstore/test/browser_705597.js57
-rw-r--r--browser/components/sessionstore/test/browser_707862.js58
-rw-r--r--browser/components/sessionstore/test/browser_739531.js47
-rw-r--r--browser/components/sessionstore/test/browser_739531_sample.html25
-rw-r--r--browser/components/sessionstore/test/browser_739805.js54
-rw-r--r--browser/components/sessionstore/test/browser_819510_perwindowpb.js189
-rw-r--r--browser/components/sessionstore/test/browser_833286_atomic_backup.js143
-rw-r--r--browser/components/sessionstore/test/browser_attributes.js72
-rw-r--r--browser/components/sessionstore/test/browser_capabilities.js73
-rw-r--r--browser/components/sessionstore/test/browser_dying_cache.js78
-rw-r--r--browser/components/sessionstore/test/browser_form_restore_events.js67
-rw-r--r--browser/components/sessionstore/test/browser_form_restore_events_sample.html99
-rw-r--r--browser/components/sessionstore/test/browser_formdata_format.js115
-rw-r--r--browser/components/sessionstore/test/browser_formdata_format_sample.html7
-rw-r--r--browser/components/sessionstore/test/browser_input.js121
-rw-r--r--browser/components/sessionstore/test/browser_input_sample.html18
-rw-r--r--browser/components/sessionstore/test/browser_pageshow.js87
-rw-r--r--browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js30
-rw-r--r--browser/components/sessionstore/test/head.js342
-rw-r--r--browser/components/sessionstore/test/moz.build7
-rw-r--r--browser/components/sessionstore/test/unit/data/sessionstore_valid.js3
-rw-r--r--browser/components/sessionstore/test/unit/head.js26
-rw-r--r--browser/components/sessionstore/test/unit/test_startup_nosession_async.js22
-rw-r--r--browser/components/sessionstore/test/unit/test_startup_nosession_sync.js15
-rw-r--r--browser/components/sessionstore/test/unit/test_startup_session_async.js23
-rw-r--r--browser/components/sessionstore/test/unit/test_startup_session_sync.js17
-rw-r--r--browser/components/sessionstore/test/unit/xpcshell.ini9
-rw-r--r--browser/components/shell/moz.build2
-rw-r--r--browser/components/shell/test/Makefile.in18
-rw-r--r--browser/components/shell/test/browser_420786.js95
-rw-r--r--browser/components/shell/test/browser_633221.js15
-rw-r--r--browser/components/shell/test/moz.build9
-rw-r--r--browser/components/shell/test/unit/test_421977.js123
-rw-r--r--browser/components/shell/test/unit/xpcshell.ini6
-rw-r--r--browser/components/test/Makefile.in17
-rw-r--r--browser/components/test/browser_bug538331.js427
-rw-r--r--browser/components/test/moz.build6
-rw-r--r--browser/devtools/commandline/moz.build2
-rw-r--r--browser/devtools/commandline/test/Makefile.in74
-rw-r--r--browser/devtools/commandline/test/browser_cmd_addon.js153
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid.js102
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache55
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache^headers^2
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_index.html14
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_page1.html14
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_page2.html14
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html14
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html^headers^2
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid.js179
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache5
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache^headers^2
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html13
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_page1.html13
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_page2.html13
-rw-r--r--browser/devtools/commandline/test/browser_cmd_appcache_valid_page3.html13
-rw-r--r--browser/devtools/commandline/test/browser_cmd_calllog.js114
-rw-r--r--browser/devtools/commandline/test/browser_cmd_calllog_chrome.js113
-rw-r--r--browser/devtools/commandline/test/browser_cmd_commands.js71
-rw-r--r--browser/devtools/commandline/test/browser_cmd_cookie.html18
-rw-r--r--browser/devtools/commandline/test/browser_cmd_cookie.js170
-rw-r--r--browser/devtools/commandline/test/browser_cmd_jsb.js86
-rw-r--r--browser/devtools/commandline/test/browser_cmd_jsb_script.jsi2
-rw-r--r--browser/devtools/commandline/test/browser_cmd_pagemod_export.html25
-rw-r--r--browser/devtools/commandline/test/browser_cmd_pagemod_export.js376
-rw-r--r--browser/devtools/commandline/test/browser_cmd_pref.js502
-rw-r--r--browser/devtools/commandline/test/browser_cmd_restart.js35
-rw-r--r--browser/devtools/commandline/test/browser_cmd_screenshot.html6
-rw-r--r--browser/devtools/commandline/test/browser_cmd_screenshot.js195
-rw-r--r--browser/devtools/commandline/test/browser_cmd_settings.js136
-rw-r--r--browser/devtools/commandline/test/browser_gcli_async.js169
-rw-r--r--browser/devtools/commandline/test/browser_gcli_canon.js271
-rw-r--r--browser/devtools/commandline/test/browser_gcli_cli.js1322
-rw-r--r--browser/devtools/commandline/test/browser_gcli_completion.js537
-rw-r--r--browser/devtools/commandline/test/browser_gcli_context.js276
-rw-r--r--browser/devtools/commandline/test/browser_gcli_date.js247
-rw-r--r--browser/devtools/commandline/test/browser_gcli_exec.js657
-rw-r--r--browser/devtools/commandline/test/browser_gcli_fail.js99
-rw-r--r--browser/devtools/commandline/test/browser_gcli_focus.js80
-rw-r--r--browser/devtools/commandline/test/browser_gcli_history.js84
-rw-r--r--browser/devtools/commandline/test/browser_gcli_incomplete.js398
-rw-r--r--browser/devtools/commandline/test/browser_gcli_inputter.js105
-rw-r--r--browser/devtools/commandline/test/browser_gcli_intro.js85
-rw-r--r--browser/devtools/commandline/test/browser_gcli_js.js475
-rw-r--r--browser/devtools/commandline/test/browser_gcli_keyboard1.js111
-rw-r--r--browser/devtools/commandline/test/browser_gcli_keyboard2.js413
-rw-r--r--browser/devtools/commandline/test/browser_gcli_keyboard3.js91
-rw-r--r--browser/devtools/commandline/test/browser_gcli_menu.js64
-rw-r--r--browser/devtools/commandline/test/browser_gcli_node.js346
-rw-r--r--browser/devtools/commandline/test/browser_gcli_remote.js462
-rw-r--r--browser/devtools/commandline/test/browser_gcli_resource.js160
-rw-r--r--browser/devtools/commandline/test/browser_gcli_scratchpad.js72
-rw-r--r--browser/devtools/commandline/test/browser_gcli_spell.js58
-rw-r--r--browser/devtools/commandline/test/browser_gcli_split.js99
-rw-r--r--browser/devtools/commandline/test/browser_gcli_string.js293
-rw-r--r--browser/devtools/commandline/test/browser_gcli_tokenize.js303
-rw-r--r--browser/devtools/commandline/test/browser_gcli_tooltip.js162
-rw-r--r--browser/devtools/commandline/test/browser_gcli_types.js106
-rw-r--r--browser/devtools/commandline/test/browser_gcli_util.js53
-rw-r--r--browser/devtools/commandline/test/head.js22
-rw-r--r--browser/devtools/commandline/test/helpers.js1038
-rw-r--r--browser/devtools/commandline/test/mockCommands.js575
-rw-r--r--browser/devtools/commandline/test/moz.build6
-rw-r--r--browser/devtools/debugger/moz.build2
-rw-r--r--browser/devtools/debugger/test/Makefile.in164
-rw-r--r--browser/devtools/debugger/test/binary_search.coffee18
-rw-r--r--browser/devtools/debugger/test/binary_search.html12
-rw-r--r--browser/devtools/debugger/test/binary_search.js29
-rw-r--r--browser/devtools/debugger/test/binary_search.map10
-rw-r--r--browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js73
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bfcache.js129
-rw-r--r--browser/devtools/debugger/test/browser_dbg_big-data.html27
-rw-r--r--browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js154
-rw-r--r--browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html20
-rw-r--r--browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js92
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js308
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js466
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js224
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js301
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js241
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js394
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js127
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js121
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js393
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js583
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js129
-rw-r--r--browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js78
-rw-r--r--browser/devtools/debugger/test/browser_dbg_chrome-debugging.js68
-rw-r--r--browser/devtools/debugger/test/browser_dbg_clean-exit.js43
-rw-r--r--browser/devtools/debugger/test/browser_dbg_cmd.html48
-rw-r--r--browser/devtools/debugger/test/browser_dbg_cmd.js108
-rw-r--r--browser/devtools/debugger/test/browser_dbg_cmd_break.html19
-rw-r--r--browser/devtools/debugger/test/browser_dbg_cmd_break.js220
-rw-r--r--browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html30
-rw-r--r--browser/devtools/debugger/test/browser_dbg_createChrome.js93
-rw-r--r--browser/devtools/debugger/test/browser_dbg_debuggerstatement.html18
-rw-r--r--browser/devtools/debugger/test/browser_dbg_debuggerstatement.js70
-rw-r--r--browser/devtools/debugger/test/browser_dbg_displayName.html29
-rw-r--r--browser/devtools/debugger/test/browser_dbg_displayName.js78
-rw-r--r--browser/devtools/debugger/test/browser_dbg_frame-parameters.html36
-rw-r--r--browser/devtools/debugger/test/browser_dbg_function-search-01.html17
-rw-r--r--browser/devtools/debugger/test/browser_dbg_function-search-02.html29
-rw-r--r--browser/devtools/debugger/test/browser_dbg_function-search.js499
-rw-r--r--browser/devtools/debugger/test/browser_dbg_globalactor-01.js65
-rw-r--r--browser/devtools/debugger/test/browser_dbg_iframes.html12
-rw-r--r--browser/devtools/debugger/test/browser_dbg_iframes.js67
-rw-r--r--browser/devtools/debugger/test/browser_dbg_listtabs-01.js102
-rw-r--r--browser/devtools/debugger/test/browser_dbg_listtabs-02.js150
-rw-r--r--browser/devtools/debugger/test/browser_dbg_location-changes-blank.js108
-rw-r--r--browser/devtools/debugger/test/browser_dbg_location-changes-bp.js163
-rw-r--r--browser/devtools/debugger/test/browser_dbg_location-changes-new.js108
-rw-r--r--browser/devtools/debugger/test/browser_dbg_location-changes.js69
-rw-r--r--browser/devtools/debugger/test/browser_dbg_menustatus.js45
-rw-r--r--browser/devtools/debugger/test/browser_dbg_multiple-windows.js115
-rw-r--r--browser/devtools/debugger/test/browser_dbg_nav-01.js54
-rw-r--r--browser/devtools/debugger/test/browser_dbg_pane-collapse.js159
-rw-r--r--browser/devtools/debugger/test/browser_dbg_panesize-inner.js77
-rw-r--r--browser/devtools/debugger/test/browser_dbg_pause-exceptions.html30
-rw-r--r--browser/devtools/debugger/test/browser_dbg_pause-exceptions.js135
-rw-r--r--browser/devtools/debugger/test/browser_dbg_pause-resume.js93
-rw-r--r--browser/devtools/debugger/test/browser_dbg_pause-warning.js97
-rw-r--r--browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js70
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-01.js165
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-02.js134
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-03.js211
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-04.js78
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-05.js95
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-06.js198
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-07.js106
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-08.js244
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-09.js105
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-10.js110
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-11.js241
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-12.js95
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js147
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js352
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js185
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-data.js888
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js119
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js514
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js516
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js438
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js93
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js93
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js284
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js249
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js254
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js324
-rw-r--r--browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js394
-rw-r--r--browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js79
-rw-r--r--browser/devtools/debugger/test/browser_dbg_reload-same-script.js218
-rw-r--r--browser/devtools/debugger/test/browser_dbg_script-switching-02.html13
-rw-r--r--browser/devtools/debugger/test/browser_dbg_script-switching.html14
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js304
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js267
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js337
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js285
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js162
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js150
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js262
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js208
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js693
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js57
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-sorting.js124
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js175
-rw-r--r--browser/devtools/debugger/test/browser_dbg_scripts-switching.js178
-rw-r--r--browser/devtools/debugger/test/browser_dbg_select-line.js122
-rw-r--r--browser/devtools/debugger/test/browser_dbg_source_maps-01.js156
-rw-r--r--browser/devtools/debugger/test/browser_dbg_source_maps-02.js205
-rw-r--r--browser/devtools/debugger/test/browser_dbg_sources-cache.js167
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack-01.js54
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack-02.js86
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack-03.js71
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack-04.js65
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack-05.js114
-rw-r--r--browser/devtools/debugger/test/browser_dbg_stack.html32
-rw-r--r--browser/devtools/debugger/test/browser_dbg_step-out.js132
-rw-r--r--browser/devtools/debugger/test/browser_dbg_tab1.html11
-rw-r--r--browser/devtools/debugger/test/browser_dbg_tab2.html11
-rw-r--r--browser/devtools/debugger/test/browser_dbg_tabactor-01.js47
-rw-r--r--browser/devtools/debugger/test/browser_dbg_tabactor-02.js61
-rw-r--r--browser/devtools/debugger/test/browser_dbg_update-editor-mode.html16
-rw-r--r--browser/devtools/debugger/test/browser_dbg_update-editor-mode.js145
-rw-r--r--browser/devtools/debugger/test/browser_dbg_watch-expressions.html27
-rw-r--r--browser/devtools/debugger/test/browser_dbg_with-frame.html33
-rw-r--r--browser/devtools/debugger/test/head.js207
-rw-r--r--browser/devtools/debugger/test/moz.build6
-rw-r--r--browser/devtools/debugger/test/test-editor-mode6
-rw-r--r--browser/devtools/debugger/test/test-function-search-01.js42
-rw-r--r--browser/devtools/debugger/test/test-function-search-02.js21
-rw-r--r--browser/devtools/debugger/test/test-function-search-03.js32
-rw-r--r--browser/devtools/debugger/test/test-location-changes-bp.html17
-rw-r--r--browser/devtools/debugger/test/test-location-changes-bp.js7
-rw-r--r--browser/devtools/debugger/test/test-script-switching-01.js6
-rw-r--r--browser/devtools/debugger/test/test-script-switching-02.js11
-rw-r--r--browser/devtools/debugger/test/test-step-out.html37
-rw-r--r--browser/devtools/debugger/test/testactors.js31
-rw-r--r--browser/devtools/fontinspector/moz.build2
-rw-r--r--browser/devtools/fontinspector/test/Makefile.in19
-rw-r--r--browser/devtools/fontinspector/test/browser_font.woffbin4704 -> 0 bytes
-rw-r--r--browser/devtools/fontinspector/test/browser_fontinspector.html20
-rw-r--r--browser/devtools/fontinspector/test/browser_fontinspector.js102
-rw-r--r--browser/devtools/fontinspector/test/moz.build6
-rw-r--r--browser/devtools/framework/moz.build2
-rw-r--r--browser/devtools/framework/test/Makefile.in33
-rw-r--r--browser/devtools/framework/test/browser_devtools_api.js122
-rw-r--r--browser/devtools/framework/test/browser_new_activation_workflow.js71
-rw-r--r--browser/devtools/framework/test/browser_target_events.js56
-rw-r--r--browser/devtools/framework/test/browser_toolbox_dynamic_registration.js107
-rw-r--r--browser/devtools/framework/test/browser_toolbox_highlight.js84
-rw-r--r--browser/devtools/framework/test/browser_toolbox_hosts.js132
-rw-r--r--browser/devtools/framework/test/browser_toolbox_options.js163
-rw-r--r--browser/devtools/framework/test/browser_toolbox_options_disablejs.html45
-rw-r--r--browser/devtools/framework/test/browser_toolbox_options_disablejs.js128
-rw-r--r--browser/devtools/framework/test/browser_toolbox_options_disablejs_iframe.html33
-rw-r--r--browser/devtools/framework/test/browser_toolbox_ready.js43
-rw-r--r--browser/devtools/framework/test/browser_toolbox_select_event.js98
-rw-r--r--browser/devtools/framework/test/browser_toolbox_sidebar.js150
-rw-r--r--browser/devtools/framework/test/browser_toolbox_tool_ready.js32
-rw-r--r--browser/devtools/framework/test/browser_toolbox_window_shortcuts.js78
-rw-r--r--browser/devtools/framework/test/browser_toolbox_window_title_changes.js84
-rw-r--r--browser/devtools/framework/test/head.js78
-rw-r--r--browser/devtools/framework/test/moz.build6
-rw-r--r--browser/devtools/inspector/moz.build2
-rw-r--r--browser/devtools/inspector/test/Makefile.in49
-rw-r--r--browser/devtools/inspector/test/browser_inspector_breadcrumbs.html40
-rw-r--r--browser/devtools/inspector/test/browser_inspector_breadcrumbs.js96
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_650804_search.html26
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_650804_search.js115
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_665880.js51
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_672902_keyboard_shortcuts.js95
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_674871.js100
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_699308_iframe_navigation.js65
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_817558_delete_node.js50
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js113
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js115
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html27
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_831693_searchbox_panel_navigation.js156
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_835722_infobar_reappears.js103
-rw-r--r--browser/devtools/inspector/test/browser_inspector_bug_840156_destroy_after_navigation.js54
-rw-r--r--browser/devtools/inspector/test/browser_inspector_changes.js112
-rw-r--r--browser/devtools/inspector/test/browser_inspector_cmd_inspect.html25
-rw-r--r--browser/devtools/inspector/test/browser_inspector_cmd_inspect.js131
-rw-r--r--browser/devtools/inspector/test/browser_inspector_destroyselection.html4
-rw-r--r--browser/devtools/inspector/test/browser_inspector_destroyselection.js48
-rw-r--r--browser/devtools/inspector/test/browser_inspector_highlighter.js156
-rw-r--r--browser/devtools/inspector/test/browser_inspector_highlighter_autohide.js46
-rw-r--r--browser/devtools/inspector/test/browser_inspector_iframeTest.js99
-rw-r--r--browser/devtools/inspector/test/browser_inspector_infobar.js92
-rw-r--r--browser/devtools/inspector/test/browser_inspector_initialization.js140
-rw-r--r--browser/devtools/inspector/test/browser_inspector_invalidate.js50
-rw-r--r--browser/devtools/inspector/test/browser_inspector_menu.html10
-rw-r--r--browser/devtools/inspector/test/browser_inspector_menu.js164
-rw-r--r--browser/devtools/inspector/test/browser_inspector_pseudoClass_menu.js71
-rw-r--r--browser/devtools/inspector/test/browser_inspector_pseudoclass_lock.js160
-rw-r--r--browser/devtools/inspector/test/browser_inspector_scrolling.js75
-rw-r--r--browser/devtools/inspector/test/browser_inspector_sidebarstate.js73
-rw-r--r--browser/devtools/inspector/test/browser_inspector_tree_height.js111
-rw-r--r--browser/devtools/inspector/test/head.js151
-rw-r--r--browser/devtools/inspector/test/moz.build6
-rw-r--r--browser/devtools/layoutview/moz.build2
-rw-r--r--browser/devtools/layoutview/test/Makefile.in17
-rw-r--r--browser/devtools/layoutview/test/browser_layoutview.js130
-rw-r--r--browser/devtools/layoutview/test/moz.build6
-rw-r--r--browser/devtools/markupview/moz.build2
-rw-r--r--browser/devtools/markupview/test/Makefile.in25
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_edit.html44
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_edit.js443
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_mutation.html37
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_mutation.js181
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_navigation.html28
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_navigation.js151
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_subset.html32
-rw-r--r--browser/devtools/markupview/test/browser_inspector_markup_subset.js146
-rw-r--r--browser/devtools/markupview/test/head.js18
-rw-r--r--browser/devtools/markupview/test/moz.build6
-rw-r--r--browser/devtools/netmonitor/moz.build2
-rw-r--r--browser/devtools/netmonitor/test/Makefile.in73
-rw-r--r--browser/devtools/netmonitor/test/browser_net_aaa_leaktest.js28
-rw-r--r--browser/devtools/netmonitor/test/browser_net_accessibility-01.js80
-rw-r--r--browser/devtools/netmonitor/test/browser_net_accessibility-02.js123
-rw-r--r--browser/devtools/netmonitor/test/browser_net_autoscroll.js89
-rw-r--r--browser/devtools/netmonitor/test/browser_net_content-type.js228
-rw-r--r--browser/devtools/netmonitor/test/browser_net_cyrillic-01.js41
-rw-r--r--browser/devtools/netmonitor/test/browser_net_cyrillic-02.js42
-rw-r--r--browser/devtools/netmonitor/test/browser_net_filter-01.js184
-rw-r--r--browser/devtools/netmonitor/test/browser_net_filter-02.js181
-rw-r--r--browser/devtools/netmonitor/test/browser_net_filter-03.js186
-rw-r--r--browser/devtools/netmonitor/test/browser_net_footer-summary.js121
-rw-r--r--browser/devtools/netmonitor/test/browser_net_json-long.js96
-rw-r--r--browser/devtools/netmonitor/test/browser_net_json-malformed.js71
-rw-r--r--browser/devtools/netmonitor/test/browser_net_jsonp.js83
-rw-r--r--browser/devtools/netmonitor/test/browser_net_large-response.js47
-rw-r--r--browser/devtools/netmonitor/test/browser_net_page-nav.js68
-rw-r--r--browser/devtools/netmonitor/test/browser_net_pane-collapse.js66
-rw-r--r--browser/devtools/netmonitor/test/browser_net_pane-toggle.js79
-rw-r--r--browser/devtools/netmonitor/test/browser_net_post-data-01.js153
-rw-r--r--browser/devtools/netmonitor/test/browser_net_post-data-02.js62
-rw-r--r--browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js67
-rw-r--r--browser/devtools/netmonitor/test/browser_net_prefs-reload.js217
-rw-r--r--browser/devtools/netmonitor/test/browser_net_req-resp-bodies.js60
-rw-r--r--browser/devtools/netmonitor/test/browser_net_simple-init.js84
-rw-r--r--browser/devtools/netmonitor/test/browser_net_simple-request-data.js237
-rw-r--r--browser/devtools/netmonitor/test/browser_net_simple-request-details.js239
-rw-r--r--browser/devtools/netmonitor/test/browser_net_simple-request.js60
-rw-r--r--browser/devtools/netmonitor/test/browser_net_sort-01.js248
-rw-r--r--browser/devtools/netmonitor/test/browser_net_sort-02.js249
-rw-r--r--browser/devtools/netmonitor/test/browser_net_sort-03.js177
-rw-r--r--browser/devtools/netmonitor/test/browser_net_status-codes.js155
-rw-r--r--browser/devtools/netmonitor/test/browser_net_timeline_ticks.js135
-rw-r--r--browser/devtools/netmonitor/test/head.js283
-rw-r--r--browser/devtools/netmonitor/test/html_content-type-test-page.html43
-rw-r--r--browser/devtools/netmonitor/test/html_custom-get-page.html39
-rw-r--r--browser/devtools/netmonitor/test/html_cyrillic-test-page.html34
-rw-r--r--browser/devtools/netmonitor/test/html_filter-test-page.html55
-rw-r--r--browser/devtools/netmonitor/test/html_infinite-get-page.html36
-rw-r--r--browser/devtools/netmonitor/test/html_json-long-test-page.html33
-rw-r--r--browser/devtools/netmonitor/test/html_json-malformed-test-page.html33
-rw-r--r--browser/devtools/netmonitor/test/html_jsonp-test-page.html33
-rw-r--r--browser/devtools/netmonitor/test/html_navigate-test-page.html13
-rw-r--r--browser/devtools/netmonitor/test/html_post-data-test-page.html72
-rw-r--r--browser/devtools/netmonitor/test/html_post-raw-test-page.html34
-rw-r--r--browser/devtools/netmonitor/test/html_simple-test-page.html13
-rw-r--r--browser/devtools/netmonitor/test/html_sorting-test-page.html42
-rw-r--r--browser/devtools/netmonitor/test/html_status-codes-test-page.html41
-rw-r--r--browser/devtools/netmonitor/test/moz.build5
-rw-r--r--browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs127
-rw-r--r--browser/devtools/netmonitor/test/sjs_simple-test-server.sjs9
-rw-r--r--browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs18
-rw-r--r--browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs34
-rw-r--r--browser/devtools/netmonitor/test/test-image.pngbin580 -> 0 bytes
-rw-r--r--browser/devtools/profiler/moz.build2
-rw-r--r--browser/devtools/profiler/test/Makefile.in39
-rw-r--r--browser/devtools/profiler/test/browser_profiler_bug_830664_multiple_profiles.js63
-rw-r--r--browser/devtools/profiler/test/browser_profiler_bug_834878_source_buttons.js38
-rw-r--r--browser/devtools/profiler/test/browser_profiler_bug_855244_multiple_tabs.js103
-rw-r--r--browser/devtools/profiler/test/browser_profiler_cmd.js154
-rw-r--r--browser/devtools/profiler/test/browser_profiler_console_api.js64
-rw-r--r--browser/devtools/profiler/test/browser_profiler_console_api_content.js56
-rw-r--r--browser/devtools/profiler/test/browser_profiler_console_api_mixed.js36
-rw-r--r--browser/devtools/profiler/test/browser_profiler_console_api_named.js66
-rw-r--r--browser/devtools/profiler/test/browser_profiler_controller.js64
-rw-r--r--browser/devtools/profiler/test/browser_profiler_profiles.js69
-rw-r--r--browser/devtools/profiler/test/browser_profiler_remote.js55
-rw-r--r--browser/devtools/profiler/test/browser_profiler_run.js66
-rw-r--r--browser/devtools/profiler/test/head.js119
-rw-r--r--browser/devtools/profiler/test/mock_console_api.html21
-rw-r--r--browser/devtools/profiler/test/mock_profiler_bug_834878_page.html14
-rw-r--r--browser/devtools/profiler/test/mock_profiler_bug_834878_script.js7
-rw-r--r--browser/devtools/profiler/test/moz.build6
-rw-r--r--browser/devtools/responsivedesign/moz.build2
-rw-r--r--browser/devtools/responsivedesign/test/Makefile.in22
-rw-r--r--browser/devtools/responsivedesign/test/browser_responsive_cmd.js107
-rw-r--r--browser/devtools/responsivedesign/test/browser_responsivecomputedview.js108
-rw-r--r--browser/devtools/responsivedesign/test/browser_responsiveruleview.js102
-rw-r--r--browser/devtools/responsivedesign/test/browser_responsiveui.js197
-rw-r--r--browser/devtools/responsivedesign/test/browser_responsiveuiaddcustompreset.js202
-rw-r--r--browser/devtools/responsivedesign/test/head.js20
-rw-r--r--browser/devtools/responsivedesign/test/moz.build6
-rw-r--r--browser/devtools/scratchpad/moz.build2
-rw-r--r--browser/devtools/scratchpad/test/Makefile.in44
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug650345_find_ui.js97
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug684546_reset_undo.js158
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js56
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug714942_goto_line_ui.js45
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug740948_reload_and_run.js73
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug756681_display_non_error_exceptions.js107
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js92
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js51
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_650760_help_key.js60
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js355
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js227
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js81
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_661762_wrong_window_focus.js94
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js120
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js68
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js187
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_bug_751744_revert_to_saved.js137
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_contexts.js174
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js138
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_files.js118
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_initialization.js48
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_inspect.js55
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_open.js76
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_restore.js98
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js103
-rw-r--r--browser/devtools/scratchpad/test/browser_scratchpad_ui.js70
-rw-r--r--browser/devtools/scratchpad/test/head.js197
-rw-r--r--browser/devtools/scratchpad/test/moz.build6
-rw-r--r--browser/devtools/shared/moz.build2
-rw-r--r--browser/devtools/shared/test/Makefile.in42
-rw-r--r--browser/devtools/shared/test/browser_eventemitter_basic.js80
-rw-r--r--browser/devtools/shared/test/browser_layoutHelpers.html25
-rw-r--r--browser/devtools/shared/test/browser_layoutHelpers.js99
-rw-r--r--browser/devtools/shared/test/browser_layoutHelpers_iframe.html19
-rw-r--r--browser/devtools/shared/test/browser_require_basic.js140
-rw-r--r--browser/devtools/shared/test/browser_telemetry_buttonsandsidebar.js179
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js110
-rw-r--r--browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js110
-rw-r--r--browser/devtools/shared/test/browser_templater_basic.html13
-rw-r--r--browser/devtools/shared/test/browser_templater_basic.js288
-rw-r--r--browser/devtools/shared/test/browser_toolbar_basic.html35
-rw-r--r--browser/devtools/shared/test/browser_toolbar_basic.js74
-rw-r--r--browser/devtools/shared/test/browser_toolbar_tooltip.js54
-rw-r--r--browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.html32
-rw-r--r--browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.js245
-rw-r--r--browser/devtools/shared/test/head.js121
-rw-r--r--browser/devtools/shared/test/leakhunt.js170
-rw-r--r--browser/devtools/shared/test/moz.build7
-rw-r--r--browser/devtools/shared/test/unit/test_undoStack.js98
-rw-r--r--browser/devtools/shared/test/unit/xpcshell.ini6
-rw-r--r--browser/devtools/sourceeditor/moz.build2
-rw-r--r--browser/devtools/sourceeditor/test/Makefile.in37
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug650345_find.js149
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug684546_reset_undo.js72
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug684862_paste_html.js119
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug687160_line_api.js90
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug687568_pagescroll.js89
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug687573_vscroll.js133
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug687580_drag_and_drop.js162
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js100
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug700893_dirty_state.js94
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug703692_focus_blur.js71
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug707987_debugger_breakpoints.js169
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug712982_line_ruler_click.js74
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js107
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug725392_mouse_coords_char_offset.js160
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug725430_comment_uncomment.js151
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug725618_moveLines_shortcut.js117
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug729480_line_vertical_align.js99
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug729960_block_bracket_jump.js164
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug731721_debugger_stepping.js59
-rw-r--r--browser/devtools/sourceeditor/test/browser_bug744021_next_prev_bracket_jump.js104
-rw-r--r--browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js499
-rw-r--r--browser/devtools/sourceeditor/test/head.js182
-rw-r--r--browser/devtools/sourceeditor/test/moz.build6
-rw-r--r--browser/devtools/styleeditor/moz.build2
-rw-r--r--browser/devtools/styleeditor/test/Makefile.in55
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_bug_740541_iframes.js90
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_bug_851132_middle_click.js68
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_bug_870339.js46
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html50
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js207
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_enabled.js75
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_filesave.js90
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_import.js76
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_import_rule.js43
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_init.js87
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_loading.js39
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_new.js143
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_nostyle.js41
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_pretty.js52
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js62
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_reload.js99
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_sv_keynav.js78
-rw-r--r--browser/devtools/styleeditor/test/browser_styleeditor_sv_resize.js61
-rw-r--r--browser/devtools/styleeditor/test/four.html25
-rw-r--r--browser/devtools/styleeditor/test/head.js108
-rw-r--r--browser/devtools/styleeditor/test/import.css10
-rw-r--r--browser/devtools/styleeditor/test/import.html11
-rw-r--r--browser/devtools/styleeditor/test/import2.css10
-rw-r--r--browser/devtools/styleeditor/test/longload.html28
-rw-r--r--browser/devtools/styleeditor/test/media-small.css5
-rw-r--r--browser/devtools/styleeditor/test/media.html11
-rw-r--r--browser/devtools/styleeditor/test/minified.html17
-rw-r--r--browser/devtools/styleeditor/test/moz.build6
-rw-r--r--browser/devtools/styleeditor/test/nostyle.html5
-rw-r--r--browser/devtools/styleeditor/test/resources_inpage.jsi12
-rw-r--r--browser/devtools/styleeditor/test/resources_inpage1.css11
-rw-r--r--browser/devtools/styleeditor/test/resources_inpage2.css11
-rw-r--r--browser/devtools/styleeditor/test/simple.css9
-rw-r--r--browser/devtools/styleeditor/test/simple.css.gzbin166 -> 0 bytes
-rw-r--r--browser/devtools/styleeditor/test/simple.css.gz^headers^4
-rw-r--r--browser/devtools/styleeditor/test/simple.gz.html23
-rw-r--r--browser/devtools/styleeditor/test/simple.html23
-rw-r--r--browser/devtools/styleeditor/test/test_private.css3
-rw-r--r--browser/devtools/styleeditor/test/test_private.html7
-rw-r--r--browser/devtools/styleinspector/moz.build2
-rw-r--r--browser/devtools/styleinspector/test/Makefile.in60
-rw-r--r--browser/devtools/styleinspector/test/browser_bug589375_keybindings.js141
-rw-r--r--browser/devtools/styleinspector/test/browser_bug683672.html28
-rw-r--r--browser/devtools/styleinspector/test/browser_bug683672.js78
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.html33
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js102
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.xul9
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported.css5
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported2.css3
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_linked.css3
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_script.css5
-rw-r--r--browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_xul.css3
-rw-r--r--browser/devtools/styleinspector/test/browser_bug722196_identify_media_queries.html24
-rw-r--r--browser/devtools/styleinspector/test/browser_bug722196_property_view_media_queries.js68
-rw-r--r--browser/devtools/styleinspector/test/browser_bug722196_rule_view_media_queries.js52
-rw-r--r--browser/devtools/styleinspector/test/browser_bug722691_rule_view_increment.js198
-rw-r--r--browser/devtools/styleinspector/test/browser_bug_592743_specificity.js99
-rw-r--r--browser/devtools/styleinspector/test/browser_bug_692400_element_style.js82
-rw-r--r--browser/devtools/styleinspector/test/browser_computedview_734259_style_editor_link.js175
-rw-r--r--browser/devtools/styleinspector/test/browser_computedview_copy.js148
-rw-r--r--browser/devtools/styleinspector/test/browser_csslogic_inherited.js44
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js175
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_copy.js145
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_editor.js119
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues.js158
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_focus.js71
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_inherit.js99
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_manipulation.js68
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_override.js159
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_ui.js218
-rw-r--r--browser/devtools/styleinspector/test/browser_ruleview_update.js153
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector.js89
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_672744_search_filter.js116
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_672746_default_styles.js116
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.html21
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.js97
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css9
-rw-r--r--browser/devtools/styleinspector/test/browser_styleinspector_bug_689759_no_results_placeholder.js118
-rw-r--r--browser/devtools/styleinspector/test/head.js126
-rw-r--r--browser/devtools/styleinspector/test/moz.build6
-rw-r--r--browser/devtools/styleinspector/test/test-image.pngbin580 -> 0 bytes
-rw-r--r--browser/devtools/tilt/moz.build2
-rw-r--r--browser/devtools/tilt/test/Makefile.in63
-rw-r--r--browser/devtools/tilt/test/browser_tilt_01_lazy_getter.js14
-rw-r--r--browser/devtools/tilt/test/browser_tilt_02_notifications-seq.js100
-rw-r--r--browser/devtools/tilt/test/browser_tilt_02_notifications-tabs.js173
-rw-r--r--browser/devtools/tilt/test/browser_tilt_02_notifications.js132
-rw-r--r--browser/devtools/tilt/test/browser_tilt_03_tab_switch.js106
-rw-r--r--browser/devtools/tilt/test/browser_tilt_04_initialization.js57
-rw-r--r--browser/devtools/tilt/test/browser_tilt_05_destruction-esc.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_05_destruction-url.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_05_destruction.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_arcball-reset-typeahead.js131
-rw-r--r--browser/devtools/tilt/test/browser_tilt_arcball-reset.js129
-rw-r--r--browser/devtools/tilt/test/browser_tilt_arcball.js496
-rw-r--r--browser/devtools/tilt/test/browser_tilt_controller.js134
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl01.js155
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl02.js44
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl03.js67
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl04.js124
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl05.js40
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl06.js57
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl07.js58
-rw-r--r--browser/devtools/tilt/test/browser_tilt_gl08.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math01.js59
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math02.js104
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math03.js33
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math04.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math05.js101
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math06.js42
-rw-r--r--browser/devtools/tilt/test/browser_tilt_math07.js49
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking.js54
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_delete.js76
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_highlight01-offs.js75
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_highlight01.js75
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_highlight02.js70
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_highlight03.js70
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_inspector.js61
-rw-r--r--browser/devtools/tilt/test/browser_tilt_picking_miv.js76
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils01.js69
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils02.js21
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils03.js18
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils04.js54
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils05.js100
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils06.js44
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils07.js158
-rw-r--r--browser/devtools/tilt/test/browser_tilt_utils08.js85
-rw-r--r--browser/devtools/tilt/test/browser_tilt_visualizer.js126
-rw-r--r--browser/devtools/tilt/test/browser_tilt_zoom.js91
-rw-r--r--browser/devtools/tilt/test/head.js206
-rw-r--r--browser/devtools/tilt/test/moz.build6
-rw-r--r--browser/devtools/webconsole/moz.build2
-rw-r--r--browser/devtools/webconsole/test/Makefile.in245
-rw-r--r--browser/devtools/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js113
-rw-r--r--browser/devtools/webconsole/test/browser_bug_638949_copy_link_location.js107
-rw-r--r--browser/devtools/webconsole/test/browser_bug_862916_console_dir_and_filter_off.js34
-rw-r--r--browser/devtools/webconsole/test/browser_bug_865288_repeat_different_objects.js82
-rw-r--r--browser/devtools/webconsole/test/browser_bug_865871_variables_view_close_on_esc_key.js98
-rw-r--r--browser/devtools/webconsole/test/browser_bug_869003_inspect_cross_domain_object.js94
-rw-r--r--browser/devtools/webconsole/test/browser_bug_871156_ctrlw_close_tab.js66
-rw-r--r--browser/devtools/webconsole/test/browser_cached_messages.js76
-rw-r--r--browser/devtools/webconsole/test/browser_console.js102
-rw-r--r--browser/devtools/webconsole/test/browser_console_addonsdk_loader_exception.js93
-rw-r--r--browser/devtools/webconsole/test/browser_console_clear_on_reload.js73
-rw-r--r--browser/devtools/webconsole/test/browser_console_consolejsm_output.js135
-rw-r--r--browser/devtools/webconsole/test/browser_console_dead_objects.js79
-rw-r--r--browser/devtools/webconsole/test/browser_console_error_source_click.js75
-rw-r--r--browser/devtools/webconsole/test/browser_console_filters.js71
-rw-r--r--browser/devtools/webconsole/test/browser_console_keyboard_accessibility.js69
-rw-r--r--browser/devtools/webconsole/test/browser_console_log_inspectable_object.js58
-rw-r--r--browser/devtools/webconsole/test/browser_console_native_getters.js121
-rw-r--r--browser/devtools/webconsole/test/browser_console_nsiconsolemessage.js95
-rw-r--r--browser/devtools/webconsole/test/browser_console_private_browsing.js199
-rw-r--r--browser/devtools/webconsole/test/browser_console_variables_view.js177
-rw-r--r--browser/devtools/webconsole/test/browser_console_variables_view_while_debugging.js132
-rw-r--r--browser/devtools/webconsole/test/browser_console_variables_view_while_debugging_and_inspecting.js127
-rw-r--r--browser/devtools/webconsole/test/browser_eval_in_debugger_stackframe.js150
-rw-r--r--browser/devtools/webconsole/test/browser_jsterm_inspect.js35
-rw-r--r--browser/devtools/webconsole/test/browser_longstring_hang.js73
-rw-r--r--browser/devtools/webconsole/test/browser_netpanel_longstring_expand.js309
-rw-r--r--browser/devtools/webconsole/test/browser_output_breaks_after_console_dir_uninspectable.js56
-rw-r--r--browser/devtools/webconsole/test/browser_output_longstring_expand.js153
-rw-r--r--browser/devtools/webconsole/test/browser_repeated_messages_accuracy.js120
-rw-r--r--browser/devtools/webconsole/test/browser_result_format_as_string.js49
-rw-r--r--browser/devtools/webconsole/test/browser_warn_user_about_replaced_api.js79
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js21
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_basic_net_logging.js45
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js38
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_579412_input_focus.js25
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_580001_closing_after_completion.js44
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_580030_errors_after_page_reload.js67
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_580400_groups.js78
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js36
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js68
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js35
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_585237_line_limit.js109
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js50
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js283
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_popup.js95
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_586388_select_all.js81
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_587617_output_copy.js91
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js39
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_588730_text_node_insertion.js49
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_588967_input_expansion.js44
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_589162_css_filter.js62
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js41
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_593003_iframe_wrong_hud.js75
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_594477_clickable_output.js132
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_594497_history_arrow_keys.js157
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js54
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_595350_multiple_windows_and_tabs.js101
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js209
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js106
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_597136_external_script_errors.js43
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_597136_network_requests_from_chrome.js47
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_597460_filter_scroll.js81
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_597756_reopen_closed_tab.js63
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_598357_jsterm_output.js275
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js76
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js53
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_601177_log_levels.js82
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_601352_scroll.js75
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_601667_filter_buttons.js146
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_602572_log_bodies_checkbox.js182
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_603750_websocket.js39
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_611795.js93
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_613013_console_api_iframe.js52
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_613280_jsterm_copy.js85
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_613642_maintain_scroll.js104
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_613642_prune_scroll.js101
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js68
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_618078_network_exceptions.js70
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_618311_close_panels.js89
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_621644_jsterm_dollar.js68
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_622303_persistent_filters.js123
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_623749_ctrl_a_select_all_winnt.js32
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_626484_output_copy_order.js70
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js129
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_632275_getters_document_width.js44
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_632347_iterators_generators.js88
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_632817.js196
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_642108_pruneTest.js89
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_642615_autocomplete.js102
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_644419_log_limits.js217
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_646025_console_file_location.js56
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_651501_document_body_autocomplete.js106
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js144
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js103
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js29
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_660806_history_nav.js48
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js133
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_704295.js42
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_734061_No_input_change_and_Tab_key_pressed.js39
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js96
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_764572_output_open_url.js119
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js113
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.js55
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_770099_violation.js46
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js150
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_804845_ctrl_key_nav.js214
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_817834_add_edited_input_to_history.js61
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_821877_csp_errors.js28
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_bug_837351_securityerrors.js34
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_change_font_size.js44
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_chrome.js35
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_completion.js120
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_console_extras.js39
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_console_logging_api.js146
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js67
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_execution_scope.js45
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_for_of.js35
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_history.js66
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_js_input_and_output_styling.js48
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_js_input_expansion.js60
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_jsterm.js194
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_live_filtering_of_message_types.js66
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_live_filtering_on_search_strings.js106
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_log_node_classes.js71
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_message_node_id.js29
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_netlogging.js211
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_network_panel.js543
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_notifications.js70
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_null_and_undefined_output.js62
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_output_order.js44
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_property_provider.js42
-rw-r--r--browser/devtools/webconsole/test/browser_webconsole_view_source.js66
-rw-r--r--browser/devtools/webconsole/test/head.js1247
-rw-r--r--browser/devtools/webconsole/test/moz.build6
-rw-r--r--browser/devtools/webconsole/test/test-bug-585956-console-trace.html27
-rw-r--r--browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html13
-rw-r--r--browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html14
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-canvas-css.html17
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-canvas-css.js10
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-canvas.html15
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-canvas.js11
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-css-loader.css10
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-css-loader.css^headers^1
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-css-loader.html13
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-css-parser.css10
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-css-parser.html14
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.html16
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.js8
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-html.html16
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-image.html15
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-image.jpgbin2532 -> 0 bytes
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-imagemap.html17
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.html19
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.xml8
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-malformedxml.xhtml10
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-svg.xhtml17
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-workers.html18
-rw-r--r--browser/devtools/webconsole/test/test-bug-595934-workers.js9
-rw-r--r--browser/devtools/webconsole/test/test-bug-597136-external-script-errors.html25
-rw-r--r--browser/devtools/webconsole/test/test-bug-597136-external-script-errors.js14
-rw-r--r--browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html18
-rw-r--r--browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs25
-rw-r--r--browser/devtools/webconsole/test/test-bug-600183-charset.html9
-rw-r--r--browser/devtools/webconsole/test/test-bug-600183-charset.html^headers^1
-rw-r--r--browser/devtools/webconsole/test/test-bug-601177-log-levels.html20
-rw-r--r--browser/devtools/webconsole/test/test-bug-601177-log-levels.js8
-rw-r--r--browser/devtools/webconsole/test/test-bug-603750-websocket.html14
-rw-r--r--browser/devtools/webconsole/test/test-bug-603750-websocket.js18
-rw-r--r--browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html21
-rw-r--r--browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html24
-rw-r--r--browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html23
-rw-r--r--browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs16
-rw-r--r--browser/devtools/webconsole/test/test-bug-632275-getters.html20
-rw-r--r--browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html54
-rw-r--r--browser/devtools/webconsole/test/test-bug-644419-log-limits.html21
-rw-r--r--browser/devtools/webconsole/test/test-bug-646025-console-file-location.html12
-rw-r--r--browser/devtools/webconsole/test/test-bug-658368-time-methods.html24
-rw-r--r--browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html15
-rw-r--r--browser/devtools/webconsole/test/test-bug-766001-console-log.js8
-rw-r--r--browser/devtools/webconsole/test/test-bug-766001-js-console-links.html14
-rw-r--r--browser/devtools/webconsole/test/test-bug-766001-js-errors.js7
-rw-r--r--browser/devtools/webconsole/test/test-bug-782653-css-errors-1.css10
-rw-r--r--browser/devtools/webconsole/test/test-bug-782653-css-errors-2.css10
-rw-r--r--browser/devtools/webconsole/test/test-bug-782653-css-errors.html14
-rw-r--r--browser/devtools/webconsole/test/test-bug-821877-csperrors.html12
-rw-r--r--browser/devtools/webconsole/test/test-bug-821877-csperrors.html^headers^1
-rw-r--r--browser/devtools/webconsole/test/test-bug-837351-security-errors.html15
-rw-r--r--browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html23
-rw-r--r--browser/devtools/webconsole/test/test-bug-869003-iframe.html20
-rw-r--r--browser/devtools/webconsole/test/test-bug-869003-top-window.html14
-rw-r--r--browser/devtools/webconsole/test/test-console-extras.html25
-rw-r--r--browser/devtools/webconsole/test/test-console-replaced-api.html12
-rw-r--r--browser/devtools/webconsole/test/test-console.html23
-rw-r--r--browser/devtools/webconsole/test/test-data.json1
-rw-r--r--browser/devtools/webconsole/test/test-data.json^headers^1
-rw-r--r--browser/devtools/webconsole/test/test-duplicate-error.html21
-rw-r--r--browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html7
-rw-r--r--browser/devtools/webconsole/test/test-error.html21
-rw-r--r--browser/devtools/webconsole/test/test-eval-in-stackframe.html39
-rw-r--r--browser/devtools/webconsole/test/test-file-location.js9
-rw-r--r--browser/devtools/webconsole/test/test-filter.html11
-rw-r--r--browser/devtools/webconsole/test/test-for-of.html8
-rw-r--r--browser/devtools/webconsole/test/test-image.pngbin580 -> 0 bytes
-rw-r--r--browser/devtools/webconsole/test/test-mutation.html16
-rw-r--r--browser/devtools/webconsole/test/test-network-request.html36
-rw-r--r--browser/devtools/webconsole/test/test-network.html11
-rw-r--r--browser/devtools/webconsole/test/test-observe-http-ajax.html17
-rw-r--r--browser/devtools/webconsole/test/test-own-console.html24
-rw-r--r--browser/devtools/webconsole/test/test-property-provider.html14
-rw-r--r--browser/devtools/webconsole/test/test-repeated-messages.html35
-rw-r--r--browser/devtools/webconsole/test/test-result-format-as-string.html24
-rw-r--r--browser/devtools/webconsole/test/test-webconsole-error-observer.html25
-rw-r--r--browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html12
-rw-r--r--browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html^headers^2
-rw-r--r--browser/devtools/webconsole/test/test_bug_770099_violation.html13
-rw-r--r--browser/devtools/webconsole/test/test_bug_770099_violation.html^headers^1
-rw-r--r--browser/devtools/webconsole/test/testscript.js1
-rw-r--r--browser/extensions/moz.build2
-rw-r--r--browser/extensions/pdfjs/test/Makefile.in20
-rw-r--r--browser/extensions/pdfjs/test/browser_pdfjs_main.js81
-rw-r--r--browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js65
-rw-r--r--browser/extensions/pdfjs/test/browser_pdfjs_views.js74
-rw-r--r--browser/extensions/pdfjs/test/file_pdfjs_test.pdfbin150611 -> 0 bytes
-rw-r--r--browser/extensions/pdfjs/test/moz.build6
-rw-r--r--browser/fuel/moz.build2
-rw-r--r--browser/fuel/test/ContentA.html12
-rw-r--r--browser/fuel/test/ContentB.html12
-rw-r--r--browser/fuel/test/ContentWithFrames.html12
-rw-r--r--browser/fuel/test/Makefile.in25
-rw-r--r--browser/fuel/test/browser_Application.js79
-rw-r--r--browser/fuel/test/browser_ApplicationPrefs.js179
-rw-r--r--browser/fuel/test/browser_ApplicationQuitting.js17
-rw-r--r--browser/fuel/test/browser_ApplicationStorage.js30
-rw-r--r--browser/fuel/test/browser_Bookmarks.js253
-rw-r--r--browser/fuel/test/browser_Browser.js148
-rw-r--r--browser/fuel/test/moz.build6
-rw-r--r--browser/modules/moz.build2
-rw-r--r--browser/modules/test/Makefile.in26
-rw-r--r--browser/modules/test/browser_NetworkPrioritizer.js154
-rw-r--r--browser/modules/test/browser_SignInToWebsite.js549
-rw-r--r--browser/modules/test/browser_taskbar_preview.js139
-rw-r--r--browser/modules/test/chrome/Makefile.in18
-rw-r--r--browser/modules/test/chrome/moz.build6
-rw-r--r--browser/modules/test/chrome/sharedframe.xul174
-rw-r--r--browser/modules/test/chrome/test_sharedframe.xul41
-rw-r--r--browser/modules/test/moz.build7
1575 files changed, 28 insertions, 137009 deletions
diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in
deleted file mode 100644
index 5efcc5606..000000000
--- a/browser/base/content/test/Makefile.in
+++ /dev/null
@@ -1,371 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_FILES = \
- head_plain.js \
- test_feed_discovery.html \
- feed_discovery.html \
- test_bug395533.html \
- bug395533-data.txt \
- ctxmenu-image.png \
- video.ogg \
- test_offlineNotification.html \
- offlineChild.html \
- offlineChild.cacheManifest \
- offlineChild.cacheManifest^headers^ \
- offlineChild2.html \
- offlineChild2.cacheManifest \
- offlineChild2.cacheManifest^headers^ \
- offlineEvent.html \
- offlineEvent.cacheManifest \
- offlineEvent.cacheManifest^headers^ \
- test_bug364677.html \
- bug364677-data.xml \
- bug364677-data.xml^headers^ \
- test_offline_gzip.html \
- gZipOfflineChild.html \
- gZipOfflineChild.html^headers^ \
- gZipOfflineChild.cacheManifest \
- gZipOfflineChild.cacheManifest^headers^ \
- $(NULL)
-
-# test_contextmenu.html is disabled on Linux due to bug 513558
-ifndef MOZ_WIDGET_GTK
-MOCHITEST_FILES += \
- audio.ogg \
- test_contextmenu.html \
- subtst_contextmenu.html \
- privateBrowsingMode.js \
- $(NULL)
-endif
-
-# The following tests are disabled because they are unreliable:
-# browser_bug423833.js is bug 428712
-# browser_sanitize-download-history.js is bug 432425
-#
-# browser_sanitizeDialog_treeView.js is disabled until the tree view is added
-# back to the clear recent history dialog (sanitize.xul), if it ever is (bug
-# 480169)
-
-# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
-
-# browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_typeAheadFind.js \
- browser_keywordSearch.js \
- browser_keywordSearch_postData.js \
- POSTSearchEngine.xml \
- print_postdata.sjs \
- browser_aboutHome.js \
- browser_alltabslistener.js \
- browser_bug304198.js \
- title_test.svg \
- browser_bug329212.js \
- browser_bug356571.js \
- browser_bug380960.js \
- browser_bug386835.js \
- browser_bug405137.js \
- browser_bug406216.js \
- browser_bug409481.js \
- browser_bug409624.js \
- browser_bug413915.js \
- browser_bug416661.js \
- browser_bug417483.js \
- browser_bug419612.js \
- browser_identity_UI.js \
- browser_bug422590.js \
- browser_bug424101.js \
- browser_bug427559.js \
- browser_bug432599.js \
- browser_bug435035.js \
- browser_bug435325.js \
- browser_bug441778.js \
- browser_bug455852.js \
- browser_bug460146.js \
- browser_bug462673.js \
- browser_bug477014.js \
- browser_bug479408.js \
- browser_bug479408_sample.html \
- browser_bug481560.js \
- browser_bug484315.js \
- browser_bug491431.js \
- browser_bug495058.js \
- browser_bug517902.js \
- browser_bug519216.js \
- browser_bug520538.js \
- browser_bug521216.js \
- browser_bug533232.js \
- browser_bug537474.js \
- browser_bug550565.js \
- browser_bug553455.js \
- browser_bug555224.js \
- browser_bug555767.js \
- browser_bug556061.js \
- browser_bug559991.js \
- browser_bug561623.js \
- browser_bug561636.js \
- browser_bug562649.js \
- browser_bug563588.js \
- browser_bug565575.js \
- browser_bug567306.js \
- browser_zbug569342.js \
- browser_bug575561.js \
- browser_bug575830.js \
- browser_bug577121.js \
- browser_bug578534.js \
- browser_bug579872.js \
- browser_bug580638.js \
- browser_bug580956.js \
- browser_bug581242.js \
- browser_bug581253.js \
- browser_bug581947.js \
- browser_bug585558.js \
- browser_bug585785.js \
- browser_bug585830.js \
- browser_bug590206.js \
- browser_bug592338.js \
- browser_bug594131.js \
- browser_bug595507.js \
- browser_bug596687.js \
- browser_bug597218.js \
- browser_bug598923.js \
- browser_bug599325.js \
- browser_bug609700.js \
- browser_bug616836.js \
- browser_bug623155.js \
- browser_bug623893.js \
- browser_bug624734.js \
- browser_bug647886.js \
- browser_bug655584.js \
- browser_bug664672.js \
- browser_bug678392.js \
- browser_bug678392-1.html \
- browser_bug678392-2.html \
- browser_bug710878.js \
- browser_bug719271.js \
- browser_bug724239.js \
- browser_bug743421.js \
- browser_bug749738.js \
- browser_bug752516.js \
- browser_bug763468_perwindowpb.js \
- browser_bug767836_perwindowpb.js \
- browser_bug771331.js \
- browser_bug783614.js \
- browser_bug797677.js \
- browser_bug816527.js \
- browser_bug817947.js \
- browser_bug822367.js \
- browser_bug902156.js \
- browser_bug832435.js \
- browser_bug839103.js \
- browser_bug880101.js \
- browser_canonizeURL.js \
- browser_customize.js \
- browser_findbarClose.js \
- browser_homeDrop.js \
- browser_keywordBookmarklets.js \
- browser_contextSearchTabPosition.js \
- browser_ctrlTab.js \
- browser_customize_popupNotification.js \
- browser_disablechrome.js \
- browser_discovery.js \
- browser_duplicateIDs.js \
- browser_fullscreen-window-open.js \
- file_fullscreen-window-open.html \
- browser_gestureSupport.js \
- browser_getshortcutoruri.js \
- browser_hide_removing.js \
- browser_overflowScroll.js \
- browser_locationBarCommand.js \
- browser_locationBarExternalLoad.js \
- browser_page_style_menu.js \
- browser_pinnedTabs.js \
- browser_plainTextLinks.js \
- browser_pluginnotification.js \
- browser_plugins_added_dynamically.js \
- browser_CTP_drag_drop.js \
- browser_CTP_data_urls.js \
- browser_pluginplaypreview.js \
- browser_pluginplaypreview2.js \
- browser_private_browsing_window.js \
- browser_relatedTabs.js \
- browser_removeTabsToTheEnd.js \
- browser_sanitize-passwordDisabledHosts.js \
- browser_sanitize-sitepermissions.js \
- browser_sanitize-timespans.js \
- browser_tabopen_reflows.js \
- browser_clearplugindata.js \
- browser_clearplugindata.html \
- browser_clearplugindata_noage.html \
- browser_popupUI.js \
- browser_sanitizeDialog.js \
- browser_save_link-perwindowpb.js \
- browser_save_private_link_perwindowpb.js \
- browser_save_video.js \
- browser_tabMatchesInAwesomebar_perwindowpb.js \
- browser_tab_drag_drop_perwindow.js \
- bug564387.html \
- bug564387_video1.ogv \
- bug564387_video1.ogv^headers^ \
- bug792517.html \
- bug792517-2.html \
- bug792517.sjs \
- test_bug839103.html \
- bug839103.css \
- browser_scope.js \
- browser_selectTabAtIndex.js \
- browser_tab_dragdrop.js \
- browser_tab_dragdrop2.js \
- browser_tab_dragdrop2_frame1.xul \
- browser_tabfocus.js \
- browser_tabs_isActive.js \
- browser_tabs_owner.js \
- browser_unloaddialogs.js \
- browser_urlbarAutoFillTrimURLs.js \
- browser_urlbarCopying.js \
- browser_urlbarEnter.js \
- browser_urlbarRevert.js \
- browser_urlbarStop.js \
- browser_urlbarTrimURLs.js \
- browser_urlbar_search_healthreport.js \
- browser_urlHighlight.js \
- browser_visibleFindSelection.js \
- browser_visibleTabs.js \
- browser_visibleTabs_contextMenu.js \
- browser_visibleTabs_bookmarkAllPages.js \
- browser_visibleTabs_bookmarkAllTabs.js \
- browser_visibleTabs_tabPreview.js \
- bug592338.html \
- disablechrome.html \
- discovery.html \
- domplate_test.js \
- file_bug822367_1.html \
- file_bug822367_1.js \
- file_bug822367_2.html \
- file_bug822367_3.html \
- file_bug822367_4.html \
- file_bug822367_4.js \
- file_bug822367_4B.html \
- file_bug822367_5.html \
- file_bug822367_6.html \
- file_bug902156_1.html \
- file_bug902156_2.html \
- file_bug902156_3.html \
- file_bug902156.js \
- moz.png \
- video.ogg \
- test_bug435035.html \
- test_bug462673.html \
- page_style_sample.html \
- plugin_unknown.html \
- plugin_test.html \
- plugin_test2.html \
- plugin_test3.html \
- plugin_alternate_content.html \
- plugin_both.html \
- plugin_both2.html \
- plugin_add_dynamically.html \
- plugin_clickToPlayAllow.html \
- plugin_clickToPlayDeny.html \
- plugin_bug744745.html \
- plugin_bug749455.html \
- plugin_bug752516.html \
- plugin_bug787619.html \
- plugin_bug797677.html \
- plugin_bug820497.html \
- plugin_hidden_to_visible.html \
- plugin_two_types.html \
- plugin_data_url.html \
- alltabslistener.html \
- zoom_test.html \
- dummy_page.html \
- file_bug550565_popup.html \
- file_bug550565_favicon.ico \
- app_bug575561.html \
- app_subframe_bug575561.html \
- browser_contentAreaClick.js \
- browser_addon_bar_close_button.js \
- browser_addon_bar_shortcut.js \
- browser_addon_bar_aomlistener.js \
- test_bug628179.html \
- browser_wyciwyg_urlbarCopying.js \
- test_wyciwyg_copying.html \
- authenticate.sjs \
- browser_minimize.js \
- browser_aboutSyncProgress.js \
- browser_middleMouse_inherit.js \
- redirect_bug623155.sjs \
- browser_tabDrop.js \
- browser_lastAccessedTab.js \
- browser_bug734076.js \
- browser_bug744745.js \
- browser_bug787619.js \
- browser_bug812562.js \
- browser_bug818118.js \
- browser_bug820497.js \
- blockPluginVulnerableUpdatable.xml \
- blockPluginVulnerableNoUpdate.xml \
- blockNoPlugins.xml \
- blockPluginHard.xml \
- browser_utilityOverlay.js \
- browser_bug676619.js \
- download_page.html \
- browser_URLBarSetURI.js \
- browser_pageInfo_plugins.js \
- browser_pageInfo.js \
- feed_tab.html \
- browser_pluginCrashCommentAndURL.js \
- pluginCrashCommentAndURL.html \
- browser_private_no_prompt.js \
- browser_blob-channelname.js \
- healthreport_testRemoteCommands.html \
- browser_offlineQuotaNotification.js \
- offlineQuotaNotification.html \
- offlineQuotaNotification.cacheManifest \
- $(NULL)
-
-# Disable tests on Windows due to frequent failures (bugs 825739, 841341)
-ifneq (windows,$(MOZ_WIDGET_TOOLKIT))
-MOCHITEST_BROWSER_FILES += \
- browser_bookmark_titles.js \
- browser_popupNotification.js \
- $(NULL)
-endif
-
-ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-MOCHITEST_BROWSER_FILES += \
- browser_bug462289.js \
- $(NULL)
-else
-MOCHITEST_BROWSER_FILES += \
- browser_bug565667.js \
- $(NULL)
-endif
-
-ifdef MOZ_DATA_REPORTING
-MOCHITEST_BROWSER_FILES += \
- browser_datareporting_notification.js \
- $(NULL)
-endif
-
-# browser_aboutHealthReport.js disabled for frequent failures on Linux (bug 924307)
-# browser_CTP_context_menu.js fails intermittently on Linux (bug 909342)
-ifndef MOZ_WIDGET_GTK
-MOCHITEST_BROWSER_FILES += \
- browser_aboutHealthReport.js \
- browser_CTP_context_menu.js \
- $(NULL)
-endif
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/base/content/test/POSTSearchEngine.xml b/browser/base/content/test/POSTSearchEngine.xml
deleted file mode 100644
index 85557d854..000000000
--- a/browser/base/content/test/POSTSearchEngine.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
- <ShortName>POST Search</ShortName>
- <Url type="text/html" method="POST" template="http://mochi.test:8888/browser/browser/base/content/test/print_postdata.sjs">
- <Param name="searchterms" value="{searchTerms}"/>
- </Url>
-</OpenSearchDescription>
diff --git a/browser/base/content/test/alltabslistener.html b/browser/base/content/test/alltabslistener.html
deleted file mode 100644
index 166c31037..000000000
--- a/browser/base/content/test/alltabslistener.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>Test page for bug 463387</title>
-</head>
-<body>
-<p>Test page for bug 463387</p>
-</body>
-</html>
diff --git a/browser/base/content/test/app_bug575561.html b/browser/base/content/test/app_bug575561.html
deleted file mode 100644
index 00f2e5488..000000000
--- a/browser/base/content/test/app_bug575561.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=575561
--->
- <head>
- <title>Test for links in app tabs</title>
- </head>
- <body>
- <a href="http://example.com/browser/browser/base/content/test/dummy_page.html">same domain</a>
- <a href="http://test1.example.com/browser/browser/base/content/test/dummy_page.html">same domain (different subdomain)</a>
- <a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
- <a href="http://example.org/browser/browser/base/content/test/dummy_page.html" target="foo">different domain (with target)</a>
- <a href="http://www.example.com/browser/browser/base/content/test/dummy_page.html">same domain (www prefix)</a>
- <a href="data:text/html,<!DOCTYPE html><html><body>Another Page</body></html>">data: URI</a>
- <a href="about:mozilla">about: URI</a>
- <iframe src="app_subframe_bug575561.html"></iframe>
- </body>
-</html>
diff --git a/browser/base/content/test/app_subframe_bug575561.html b/browser/base/content/test/app_subframe_bug575561.html
deleted file mode 100644
index 754f3806e..000000000
--- a/browser/base/content/test/app_subframe_bug575561.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=575561
--->
- <head>
- <title>Test for links in app tab subframes</title>
- </head>
- <body>
- <a href="http://example.org/browser/browser/base/content/test/dummy_page.html">different domain</a>
- </body>
-</html>
diff --git a/browser/base/content/test/audio.ogg b/browser/base/content/test/audio.ogg
deleted file mode 100644
index 7e6ef77ec..000000000
--- a/browser/base/content/test/audio.ogg
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/authenticate.sjs b/browser/base/content/test/authenticate.sjs
deleted file mode 100644
index 58da655cf..000000000
--- a/browser/base/content/test/authenticate.sjs
+++ /dev/null
@@ -1,220 +0,0 @@
-function handleRequest(request, response)
-{
- try {
- reallyHandleRequest(request, response);
- } catch (e) {
- response.setStatusLine("1.0", 200, "AlmostOK");
- response.write("Error handling request: " + e);
- }
-}
-
-
-function reallyHandleRequest(request, response) {
- var match;
- var requestAuth = true, requestProxyAuth = true;
-
- // Allow the caller to drive how authentication is processed via the query.
- // Eg, http://localhost:8888/authenticate.sjs?user=foo&realm=bar
- // The extra ? allows the user/pass/realm checks to succeed if the name is
- // at the beginning of the query string.
- var query = "?" + request.queryString;
-
- var expected_user = "", expected_pass = "", realm = "mochitest";
- var proxy_expected_user = "", proxy_expected_pass = "", proxy_realm = "mochi-proxy";
- var huge = false, plugin = false, anonymous = false;
- var authHeaderCount = 1;
- // user=xxx
- match = /[^_]user=([^&]*)/.exec(query);
- if (match)
- expected_user = match[1];
-
- // pass=xxx
- match = /[^_]pass=([^&]*)/.exec(query);
- if (match)
- expected_pass = match[1];
-
- // realm=xxx
- match = /[^_]realm=([^&]*)/.exec(query);
- if (match)
- realm = match[1];
-
- // proxy_user=xxx
- match = /proxy_user=([^&]*)/.exec(query);
- if (match)
- proxy_expected_user = match[1];
-
- // proxy_pass=xxx
- match = /proxy_pass=([^&]*)/.exec(query);
- if (match)
- proxy_expected_pass = match[1];
-
- // proxy_realm=xxx
- match = /proxy_realm=([^&]*)/.exec(query);
- if (match)
- proxy_realm = match[1];
-
- // huge=1
- match = /huge=1/.exec(query);
- if (match)
- huge = true;
-
- // plugin=1
- match = /plugin=1/.exec(query);
- if (match)
- plugin = true;
-
- // multiple=1
- match = /multiple=([^&]*)/.exec(query);
- if (match)
- authHeaderCount = match[1]+0;
-
- // anonymous=1
- match = /anonymous=1/.exec(query);
- if (match)
- anonymous = true;
-
- // Look for an authentication header, if any, in the request.
- //
- // EG: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
- //
- // This test only supports Basic auth. The value sent by the client is
- // "username:password", obscured with base64 encoding.
-
- var actual_user = "", actual_pass = "", authHeader, authPresent = false;
- if (request.hasHeader("Authorization")) {
- authPresent = true;
- authHeader = request.getHeader("Authorization");
- match = /Basic (.+)/.exec(authHeader);
- if (match.length != 2)
- throw "Couldn't parse auth header: " + authHeader;
-
- var userpass = base64ToString(match[1]); // no atob() :-(
- match = /(.*):(.*)/.exec(userpass);
- if (match.length != 3)
- throw "Couldn't decode auth header: " + userpass;
- actual_user = match[1];
- actual_pass = match[2];
- }
-
- var proxy_actual_user = "", proxy_actual_pass = "";
- if (request.hasHeader("Proxy-Authorization")) {
- authHeader = request.getHeader("Proxy-Authorization");
- match = /Basic (.+)/.exec(authHeader);
- if (match.length != 2)
- throw "Couldn't parse auth header: " + authHeader;
-
- var userpass = base64ToString(match[1]); // no atob() :-(
- match = /(.*):(.*)/.exec(userpass);
- if (match.length != 3)
- throw "Couldn't decode auth header: " + userpass;
- proxy_actual_user = match[1];
- proxy_actual_pass = match[2];
- }
-
- // Don't request authentication if the credentials we got were what we
- // expected.
- if (expected_user == actual_user &&
- expected_pass == actual_pass) {
- requestAuth = false;
- }
- if (proxy_expected_user == proxy_actual_user &&
- proxy_expected_pass == proxy_actual_pass) {
- requestProxyAuth = false;
- }
-
- if (anonymous) {
- if (authPresent) {
- response.setStatusLine("1.0", 400, "Unexpected authorization header found");
- } else {
- response.setStatusLine("1.0", 200, "Authorization header not found");
- }
- } else {
- if (requestProxyAuth) {
- response.setStatusLine("1.0", 407, "Proxy authentication required");
- for (i = 0; i < authHeaderCount; ++i)
- response.setHeader("Proxy-Authenticate", "basic realm=\"" + proxy_realm + "\"", true);
- } else if (requestAuth) {
- response.setStatusLine("1.0", 401, "Authentication required");
- for (i = 0; i < authHeaderCount; ++i)
- response.setHeader("WWW-Authenticate", "basic realm=\"" + realm + "\"", true);
- } else {
- response.setStatusLine("1.0", 200, "OK");
- }
- }
-
- response.setHeader("Content-Type", "application/xhtml+xml", false);
- response.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
- response.write("<p>Login: <span id='ok'>" + (requestAuth ? "FAIL" : "PASS") + "</span></p>\n");
- response.write("<p>Proxy: <span id='proxy'>" + (requestProxyAuth ? "FAIL" : "PASS") + "</span></p>\n");
- response.write("<p>Auth: <span id='auth'>" + authHeader + "</span></p>\n");
- response.write("<p>User: <span id='user'>" + actual_user + "</span></p>\n");
- response.write("<p>Pass: <span id='pass'>" + actual_pass + "</span></p>\n");
-
- if (huge) {
- response.write("<div style='display: none'>");
- for (i = 0; i < 100000; i++) {
- response.write("123456789\n");
- }
- response.write("</div>");
- response.write("<span id='footnote'>This is a footnote after the huge content fill</span>");
- }
-
- if (plugin) {
- response.write("<embed id='embedtest' style='width: 400px; height: 100px;' " +
- "type='application/x-test'></embed>\n");
- }
-
- response.write("</html>");
-}
-
-
-// base64 decoder
-//
-// Yoinked from extensions/xml-rpc/src/nsXmlRpcClient.js because btoa()
-// doesn't seem to exist. :-(
-/* Convert Base64 data to a string */
-const toBinaryTable = [
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
- 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
- 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
- -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
- 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
-];
-const base64Pad = '=';
-
-function base64ToString(data) {
-
- var result = '';
- var leftbits = 0; // number of bits decoded, but yet to be appended
- var leftdata = 0; // bits decoded, but yet to be appended
-
- // Convert one by one.
- for (var i = 0; i < data.length; i++) {
- var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
- var padding = (data[i] == base64Pad);
- // Skip illegal characters and whitespace
- if (c == -1) continue;
-
- // Collect data into leftdata, update bitcount
- leftdata = (leftdata << 6) | c;
- leftbits += 6;
-
- // If we have 8 or more bits, append 8 bits to the result
- if (leftbits >= 8) {
- leftbits -= 8;
- // Append if not padding.
- if (!padding)
- result += String.fromCharCode((leftdata >> leftbits) & 0xff);
- leftdata &= (1 << leftbits) - 1;
- }
- }
-
- // If there are any bits left, the base64 string was corrupted
- if (leftbits)
- throw Components.Exception('Corrupted base64 string');
-
- return result;
-}
diff --git a/browser/base/content/test/blockNoPlugins.xml b/browser/base/content/test/blockNoPlugins.xml
deleted file mode 100644
index e4e191b37..000000000
--- a/browser/base/content/test/blockNoPlugins.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
- <emItems>
- </emItems>
- <pluginItems>
- </pluginItems>
-</blocklist>
diff --git a/browser/base/content/test/blockPluginHard.xml b/browser/base/content/test/blockPluginHard.xml
deleted file mode 100644
index 24eb5bc6f..000000000
--- a/browser/base/content/test/blockPluginHard.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
- <emItems>
- </emItems>
- <pluginItems>
- <pluginItem blockID="p9999">
- <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
- <versionRange severity="2"></versionRange>
- </pluginItem>
- </pluginItems>
-</blocklist>
diff --git a/browser/base/content/test/blockPluginVulnerableNoUpdate.xml b/browser/base/content/test/blockPluginVulnerableNoUpdate.xml
deleted file mode 100644
index bf8545afe..000000000
--- a/browser/base/content/test/blockPluginVulnerableNoUpdate.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
- <emItems>
- </emItems>
- <pluginItems>
- <pluginItem blockID="p9999">
- <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
- <versionRange severity="0" vulnerabilitystatus="2"></versionRange>
- </pluginItem>
- </pluginItems>
-</blocklist>
diff --git a/browser/base/content/test/blockPluginVulnerableUpdatable.xml b/browser/base/content/test/blockPluginVulnerableUpdatable.xml
deleted file mode 100644
index 5545162b1..000000000
--- a/browser/base/content/test/blockPluginVulnerableUpdatable.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
- <emItems>
- </emItems>
- <pluginItems>
- <pluginItem blockID="p9999">
- <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
- <versionRange severity="0" vulnerabilitystatus="1"></versionRange>
- </pluginItem>
- </pluginItems>
-</blocklist>
diff --git a/browser/base/content/test/browser_CTP_context_menu.js b/browser/base/content/test/browser_CTP_context_menu.js
deleted file mode 100644
index 3dcff2b8b..000000000
--- a/browser/base/content/test/browser_CTP_context_menu.js
+++ /dev/null
@@ -1,103 +0,0 @@
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
- let newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- prepareTest(runAfterPluginBindingAttached(test1), gHttpTestRoot + "plugin_test.html");
-}
-
-function finishTest() {
- clearAllPluginPermissions();
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Due to layout being async, "PluginBindAttached" may trigger later.
-// This wraps a function to force a layout flush, thus triggering it,
-// and schedules the function execution so they're definitely executed
-// afterwards.
-function runAfterPluginBindingAttached(func) {
- return function() {
- let doc = gTestBrowser.contentDocument;
- let elems = doc.getElementsByTagName('embed');
- if (elems.length < 1) {
- elems = doc.getElementsByTagName('object');
- }
- elems[0].clientTop;
- executeSoon(func);
- };
-}
-
-// Test that the activate action in content menus for CTP plugins works
-function test1() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 1, Should have a click-to-play notification");
-
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 1, Plugin should not be activated");
-
- window.document.addEventListener("popupshown", test2, false);
- EventUtils.synthesizeMouseAtCenter(plugin,
- { type: "contextmenu", button: 2 },
- gTestBrowser.contentWindow);
-}
-
-function test2() {
- window.document.removeEventListener("popupshown", test2, false);
- let activate = window.document.getElementById("context-ctp-play");
- ok(activate, "Test 2, Should have a context menu entry for activating the plugin");
-
- // Trigger the click-to-play popup
- activate.doCommand();
-
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 2, Should have a click-to-play notification");
- ok(!notification.dismissed, "Test 2, The click-to-play notification should not be dismissed");
-
- // Activate the plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- waitForCondition(() => objLoadingContent.activated, test3, "Waited too long for plugin to activate");
-}
-
-function test3() {
- finishTest();
-}
diff --git a/browser/base/content/test/browser_CTP_data_urls.js b/browser/base/content/test/browser_CTP_data_urls.js
deleted file mode 100644
index 188f488ba..000000000
--- a/browser/base/content/test/browser_CTP_data_urls.js
+++ /dev/null
@@ -1,256 +0,0 @@
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-// This listens for the next opened tab and checks it is of the right url.
-// opencallback is called when the new tab is fully loaded
-// closecallback is called when the tab is closed
-function TabOpenListener(url, opencallback, closecallback) {
- this.url = url;
- this.opencallback = opencallback;
- this.closecallback = closecallback;
-
- gBrowser.tabContainer.addEventListener("TabOpen", this, false);
-}
-
-TabOpenListener.prototype = {
- url: null,
- opencallback: null,
- closecallback: null,
- tab: null,
- browser: null,
-
- handleEvent: function(event) {
- if (event.type == "TabOpen") {
- gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
- this.tab = event.originalTarget;
- this.browser = this.tab.linkedBrowser;
- gBrowser.addEventListener("pageshow", this, false);
- } else if (event.type == "pageshow") {
- if (event.target.location.href != this.url)
- return;
- gBrowser.removeEventListener("pageshow", this, false);
- this.tab.addEventListener("TabClose", this, false);
- var url = this.browser.contentDocument.location.href;
- is(url, this.url, "Should have opened the correct tab");
- this.opencallback(this.tab, this.browser.contentWindow);
- } else if (event.type == "TabClose") {
- if (event.originalTarget != this.tab)
- return;
- this.tab.removeEventListener("TabClose", this, false);
- this.opencallback = null;
- this.tab = null;
- this.browser = null;
- // Let the window close complete
- executeSoon(this.closecallback);
- this.closecallback = null;
- }
- }
-};
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- prepareTest(test1a, gHttpTestRoot + "plugin_data_url.html");
-}
-
-function finishTest() {
- clearAllPluginPermissions();
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Due to layout being async, "PluginBindAttached" may trigger later.
-// This wraps a function to force a layout flush, thus triggering it,
-// and schedules the function execution so they're definitely executed
-// afterwards.
-function runAfterPluginBindingAttached(func) {
- return function() {
- let doc = gTestBrowser.contentDocument;
- let elems = doc.getElementsByTagName('embed');
- if (elems.length < 1) {
- elems = doc.getElementsByTagName('object');
- }
- elems[0].clientTop;
- executeSoon(func);
- };
-}
-
-// Test that the click-to-play doorhanger still works when navigating to data URLs
-function test1a() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 1a, Should have a click-to-play notification");
-
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
-
- gNextTest = runAfterPluginBindingAttached(test1b);
- gTestBrowser.contentDocument.getElementById("data-link-1").click();
-}
-
-function test1b() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 1b, Should have a click-to-play notification");
-
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
-
- // Simulate clicking the "Allow Always" button.
- popupNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1c, "Test 1b, Waited too long for plugin to activate");
-}
-
-function test1c() {
- clearAllPluginPermissions();
- prepareTest(runAfterPluginBindingAttached(test2a), gHttpTestRoot + "plugin_data_url.html");
-}
-
-// Test that the click-to-play notification doesn't break when navigating to data URLs with multiple plugins
-function test2a() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 2a, Should have a click-to-play notification");
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 2a, Plugin should not be activated");
-
- gNextTest = runAfterPluginBindingAttached(test2b);
- gTestBrowser.contentDocument.getElementById("data-link-2").click();
-}
-
-function test2b() {
- let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 2b, Should have a click-to-play notification");
-
- // Simulate choosing "Allow now" for the test plugin
- notification.reshow();
- is(notification.options.centerActions.length, 2, "Test 2b, Should have two types of plugin in the notification");
-
- var centerAction = null;
- for (var action of notification.options.centerActions) {
- if (action.pluginName == "Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 2b, found center action for the Test plugin");
-
- var centerItem = null;
- for (var item of PopupNotifications.panel.firstChild.childNodes) {
- is(item.value, "block", "Test 2b, all plugins should start out blocked");
- if (item.action == centerAction) {
- centerItem = item;
- break;
- }
- }
- ok(centerItem, "Test 2b, found center item for the Test plugin");
-
- // "click" the button to activate the Test plugin
- centerItem.value = "allownow";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let plugin = gTestBrowser.contentDocument.getElementById("test1");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- let condition = function() objLoadingContent.activated;
- waitForCondition(condition, test2c, "Test 2b, Waited too long for plugin to activate");
-}
-
-function test2c() {
- let plugin = gTestBrowser.contentDocument.getElementById("test1");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
-
- clearAllPluginPermissions();
- prepareTest(runAfterPluginBindingAttached(test3a), gHttpTestRoot + "plugin_data_url.html");
-}
-
-// Test that when navigating to a data url, the plugin permission is inherited
-function test3a() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 3a, Should have a click-to-play notification");
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
-
- // Simulate clicking the "Allow Always" button.
- popupNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let condition = function() objLoadingContent.activated;
- waitForCondition(condition, test3b, "Test 3a, Waited too long for plugin to activate");
-}
-
-function test3b() {
- gNextTest = test3c;
- gTestBrowser.contentDocument.getElementById("data-link-1").click();
-}
-
-function test3c() {
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 3c, Plugin should be activated");
-
- clearAllPluginPermissions();
- prepareTest(runAfterPluginBindingAttached(test4b),
- 'data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>');
-}
-
-// Test that the click-to-play doorhanger still works when directly navigating to data URLs
-function test4a() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 4a, Should have a click-to-play notification");
- let plugin = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
-
- // Simulate clicking the "Allow Always" button.
- popupNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let condition = function() objLoadingContent.activated;
- waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to activate");
-}
-
-function test4b() {
- clearAllPluginPermissions();
- finishTest();
-}
diff --git a/browser/base/content/test/browser_CTP_drag_drop.js b/browser/base/content/test/browser_CTP_drag_drop.js
deleted file mode 100644
index 85305bd94..000000000
--- a/browser/base/content/test/browser_CTP_drag_drop.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-let gNextTest = null;
-let gNewWindow = null;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("plugins.click_to_play");
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("PluginBindingAttached", handleEvent, true, true);
- gNextTest = part1;
- gBrowser.selectedBrowser.contentDocument.location = gHttpTestRoot + "plugin_test.html";
-}
-
-function handleEvent() {
- gNextTest();
-}
-
-function part1() {
- gBrowser.selectedBrowser.removeEventListener("PluginBindingAttached", handleEvent);
- ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab");
-
- gNextTest = part2;
- gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
- gNewWindow.addEventListener("load", handleEvent, true);
-}
-
-function part2() {
- gNewWindow.removeEventListener("load", handleEvent);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
- waitForCondition(condition, part3, "Waited too long for click-to-play notification");
-}
-
-function part3() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
- ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, gNewWindow.gBrowser.selectedTab);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
- waitForCondition(condition, part4, "Waited too long for click-to-play notification");
-}
-
-function part4() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab again");
-
- gBrowser.selectedBrowser.addEventListener("PluginBindingAttached", handleEvent, true, true);
- gNextTest = part5;
- gBrowser.selectedBrowser.contentDocument.location = gHttpTestRoot + "plugin_test.html";
-}
-
-function part5() {
- gBrowser.selectedBrowser.removeEventListener("PluginBindingAttached", handleEvent);
- ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab");
-
- gNextTest = part6;
- gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
- gNewWindow.addEventListener("load", handleEvent, true);
-}
-
-function part6() {
- gNewWindow.removeEventListener("load", handleEvent);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
- waitForCondition(condition, part7, "Waited too long for click-to-play notification");
-}
-
-function part7() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
- ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
-
- let plugin = gNewWindow.gBrowser.selectedBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "plugin should not be activated");
-
- EventUtils.synthesizeMouseAtCenter(plugin, {}, gNewWindow.gBrowser.selectedBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser).dismissed && gNewWindow.PopupNotifications.panel.firstChild;
- waitForCondition(condition, part8, "waited too long for plugin to activate");
-}
-
-function part8() {
- // Click the activate button on doorhanger to make sure it works
- gNewWindow.PopupNotifications.panel.firstChild._primaryButton.click();
-
- let plugin = gNewWindow.gBrowser.selectedBrowser.contentDocument.getElementById("test");
- let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "plugin should be activated now");
-
- gNewWindow.close();
- finish();
-}
diff --git a/browser/base/content/test/browser_URLBarSetURI.js b/browser/base/content/test/browser_URLBarSetURI.js
deleted file mode 100644
index f98dbc5f0..000000000
--- a/browser/base/content/test/browser_URLBarSetURI.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- // avoid prompting about phishing
- Services.prefs.setIntPref(phishyUserPassPref, 32);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(phishyUserPassPref);
- });
-
- nextTest();
-}
-
-const phishyUserPassPref = "network.http.phishy-userpass-length";
-
-function nextTest() {
- let test = tests.shift();
- if (test) {
- test(function () {
- executeSoon(nextTest);
- });
- } else {
- executeSoon(finish);
- }
-}
-
-let tests = [
- function revert(next) {
- loadTabInWindow(window, function (tab) {
- gURLBar.handleRevert();
- is(gURLBar.value, "example.com", "URL bar had user/pass stripped after reverting");
- gBrowser.removeTab(tab);
- next();
- });
- },
- function customize(next) {
- whenNewWindowLoaded(undefined, function (win) {
- // Need to wait for delayedStartup for the customization part of the test,
- // since that's where BrowserToolboxCustomizeDone is set.
- whenDelayedStartupFinished(win, function () {
- loadTabInWindow(win, function () {
- openToolbarCustomizationUI(function () {
- closeToolbarCustomizationUI(function () {
- is(win.gURLBar.value, "example.com", "URL bar had user/pass stripped after customize");
- win.close();
- next();
- }, win);
- }, win);
- });
- });
- });
- },
- function pageloaderror(next) {
- loadTabInWindow(window, function (tab) {
- // Load a new URL and then immediately stop it, to simulate a page load
- // error.
- tab.linkedBrowser.loadURI("http://test1.example.com");
- tab.linkedBrowser.stop();
- is(gURLBar.value, "example.com", "URL bar had user/pass stripped after load error");
- gBrowser.removeTab(tab);
- next();
- });
- }
-];
-
-function loadTabInWindow(win, callback) {
- info("Loading tab");
- let url = "http://user:pass@example.com/";
- let tab = win.gBrowser.selectedTab = win.gBrowser.addTab(url);
- tab.linkedBrowser.addEventListener("load", function listener() {
- info("Tab loaded");
- if (tab.linkedBrowser.currentURI.spec != url)
- return;
- tab.linkedBrowser.removeEventListener("load", listener, true);
-
- is(win.gURLBar.value, "example.com", "URL bar had user/pass stripped initially");
- callback(tab);
- }, true);
-}
diff --git a/browser/base/content/test/browser_aboutHealthReport.js b/browser/base/content/test/browser_aboutHealthReport.js
deleted file mode 100644
index b2e74140b..000000000
--- a/browser/base/content/test/browser_aboutHealthReport.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/commonjs/sdk/core/promise.js");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-
-registerCleanupFunction(function() {
- // Ensure we don't pollute prefs for next tests.
- try {
- Services.prefs.clearUserPref("datareporting.healthreport.about.reportUrl");
- let policy = Cc["@mozilla.org/datareporting/service;1"]
- .getService(Ci.nsISupports)
- .wrappedJSObject
- .policy;
- policy.recordHealthReportUploadEnabled(true,
- "Resetting after tests.");
- } catch (ex) {}
-});
-
-let gTests = [
-
-{
- desc: "Test the remote commands",
- setup: function ()
- {
- Services.prefs.setCharPref("datareporting.healthreport.about.reportUrl",
- "https://example.com/browser/browser/base/content/test/healthreport_testRemoteCommands.html");
- },
- run: function ()
- {
- let deferred = Promise.defer();
-
- let policy = Cc["@mozilla.org/datareporting/service;1"]
- .getService(Ci.nsISupports)
- .wrappedJSObject
- .policy;
-
- let results = 0;
- try {
- let win = gBrowser.contentWindow;
- win.addEventListener("message", function testLoad(e) {
- if (e.data.type == "testResult") {
- ok(e.data.pass, e.data.info);
- results++;
- }
- else if (e.data.type == "testsComplete") {
- is(results, e.data.count, "Checking number of results received matches the number of tests that should have run");
- win.removeEventListener("message", testLoad, false, true);
- deferred.resolve();
- }
-
- }, false, true);
-
- } catch(e) {
- ok(false, "Failed to get all commands");
- deferred.reject();
- }
- return deferred.promise;
- }
-},
-
-
-]; // gTests
-
-function test()
-{
- waitForExplicitFinish();
-
- // xxxmpc leaving this here until we resolve bug 854038 and bug 854060
- requestLongerTimeout(10);
-
- Task.spawn(function () {
- for (let test of gTests) {
- info(test.desc);
- test.setup();
-
- yield promiseNewTabLoadEvent("about:healthreport");
-
- yield test.run();
-
- gBrowser.removeCurrentTab();
- }
-
- finish();
- });
-}
-
-function promiseNewTabLoadEvent(aUrl, aEventType="load")
-{
- let deferred = Promise.defer();
- let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
- tab.linkedBrowser.addEventListener(aEventType, function load(event) {
- tab.linkedBrowser.removeEventListener(aEventType, load, true);
- let iframe = tab.linkedBrowser.contentDocument.getElementById("remote-report");
- iframe.addEventListener("load", function frameLoad(e) {
- iframe.removeEventListener("load", frameLoad, false);
- deferred.resolve();
- }, false);
- }, true);
- return deferred.promise;
-}
-
diff --git a/browser/base/content/test/browser_aboutHome.js b/browser/base/content/test/browser_aboutHome.js
deleted file mode 100644
index 3edbc5613..000000000
--- a/browser/base/content/test/browser_aboutHome.js
+++ /dev/null
@@ -1,520 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/commonjs/sdk/core/promise.js");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
- "resource:///modules/AboutHomeUtils.jsm");
-
-let gRightsVersion = Services.prefs.getIntPref("browser.rights.version");
-
-registerCleanupFunction(function() {
- // Ensure we don't pollute prefs for next tests.
- Services.prefs.clearUserPref("network.cookies.cookieBehavior");
- Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
- Services.prefs.clearUserPref("browser.rights.override");
- Services.prefs.clearUserPref("browser.rights." + gRightsVersion + ".shown");
-});
-
-let gTests = [
-
-{
- desc: "Check that clearing cookies does not clear storage",
- setup: function ()
- {
- Cc["@mozilla.org/observer-service;1"]
- .getService(Ci.nsIObserverService)
- .notifyObservers(null, "cookie-changed", "cleared");
- },
- run: function (aSnippetsMap)
- {
- isnot(aSnippetsMap.get("snippets-last-update"), null,
- "snippets-last-update should have a value");
- }
-},
-
-{
- desc: "Check default snippets are shown",
- setup: function () { },
- run: function ()
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let snippetsElt = doc.getElementById("snippets");
- ok(snippetsElt, "Found snippets element")
- is(snippetsElt.getElementsByTagName("span").length, 1,
- "A default snippet is present.");
- }
-},
-
-{
- desc: "Check default snippets are shown if snippets are invalid xml",
- setup: function (aSnippetsMap)
- {
- // This must be some incorrect xhtml code.
- aSnippetsMap.set("snippets", "<p><b></p></b>");
- },
- run: function (aSnippetsMap)
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
-
- let snippetsElt = doc.getElementById("snippets");
- ok(snippetsElt, "Found snippets element");
- is(snippetsElt.getElementsByTagName("span").length, 1,
- "A default snippet is present.");
-
- aSnippetsMap.delete("snippets");
- }
-},
-
-{
- desc: "Check that search engine logo has alt text",
- setup: function () { },
- run: function ()
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
-
- let searchEngineLogoElt = doc.getElementById("searchEngineLogo");
- ok(searchEngineLogoElt, "Found search engine logo");
-
- let altText = searchEngineLogoElt.alt;
- ok(typeof altText == "string" && altText.length > 0,
- "Search engine logo's alt text is a nonempty string");
-
- isnot(altText, "undefined",
- "Search engine logo's alt text shouldn't be the string 'undefined'");
- }
-},
-
-// Disabled on Linux for intermittent issues with FHR, see Bug 945667.
-// Disabled always due to bug 992485
-{
- desc: "Check that performing a search fires a search event and records to " +
- "Firefox Health Report.",
- setup: function () { },
- run: function () {
- // Skip this test always for now since it loads google.com and that causes bug 992485
- return;
-
- // Skip this test on Linux.
- if (navigator.platform.indexOf("Linux") == 0) { return; }
-
- try {
- let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
- cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
- } catch (ex) {
- // Health Report disabled, or no SearchesProvider.
- return Promise.resolve();
- }
-
- let numSearchesBefore = 0;
- let deferred = Promise.defer();
- let doc = gBrowser.contentDocument;
- let engineName = doc.documentElement.getAttribute("searchEngineName");
-
- // We rely on the listener in browser.js being installed and fired before
- // this one. If this ever changes, we should add an executeSoon() or similar.
- doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) {
- is(e.detail, engineName, "Detail is search engine name");
-
- getNumberOfSearches(engineName).then(num => {
- is(num, numSearchesBefore + 1, "One more search recorded.");
- deferred.resolve();
- });
- }, true, true);
-
- // Get the current number of recorded searches.
- getNumberOfSearches(engineName).then(num => {
- numSearchesBefore = num;
-
- info("Perform a search.");
- doc.getElementById("searchText").value = "a search";
- doc.getElementById("searchSubmit").click();
- gBrowser.stop();
- });
-
- return deferred.promise;
- }
-},
-
-{
- desc: "Check snippets map is cleared if cached version is old",
- setup: function (aSnippetsMap)
- {
- aSnippetsMap.set("snippets", "test");
- aSnippetsMap.set("snippets-cached-version", 0);
- },
- run: function (aSnippetsMap)
- {
- ok(!aSnippetsMap.has("snippets"), "snippets have been properly cleared");
- ok(!aSnippetsMap.has("snippets-cached-version"),
- "cached-version has been properly cleared");
- }
-},
-
-{
- desc: "Check cached snippets are shown if cached version is current",
- setup: function (aSnippetsMap)
- {
- aSnippetsMap.set("snippets", "test");
- },
- run: function (aSnippetsMap)
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
-
- let snippetsElt = doc.getElementById("snippets");
- ok(snippetsElt, "Found snippets element");
- is(snippetsElt.innerHTML, "test", "Cached snippet is present.");
-
- is(aSnippetsMap.get("snippets"), "test", "snippets still cached");
- is(aSnippetsMap.get("snippets-cached-version"),
- AboutHomeUtils.snippetsVersion,
- "cached-version is correct");
- ok(aSnippetsMap.has("snippets-last-update"), "last-update still exists");
- }
-},
-
-{
- desc: "Check if the 'Know Your Rights default snippet is shown when 'browser.rights.override' pref is set",
- beforeRun: function ()
- {
- Services.prefs.setBoolPref("browser.rights.override", false);
- },
- setup: function () { },
- run: function (aSnippetsMap)
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let showRights = AboutHomeUtils.showKnowYourRights;
-
- ok(showRights, "AboutHomeUtils.showKnowYourRights should be TRUE");
-
- let snippetsElt = doc.getElementById("snippets");
- ok(snippetsElt, "Found snippets element");
- is(snippetsElt.getElementsByTagName("a")[0].href, "about:rights", "Snippet link is present.");
-
- Services.prefs.clearUserPref("browser.rights.override");
- }
-},
-
-{
- desc: "Check if the 'Know Your Rights default snippet is NOT shown when 'browser.rights.override' pref is NOT set",
- beforeRun: function ()
- {
- Services.prefs.setBoolPref("browser.rights.override", true);
- },
- setup: function () { },
- run: function (aSnippetsMap)
- {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let rightsData = AboutHomeUtils.knowYourRightsData;
-
- ok(!rightsData, "AboutHomeUtils.knowYourRightsData should be FALSE");
-
- let snippetsElt = doc.getElementById("snippets");
- ok(snippetsElt, "Found snippets element");
- ok(snippetsElt.getElementsByTagName("a")[0].href != "about:rights", "Snippet link should not point to about:rights.");
-
- Services.prefs.clearUserPref("browser.rights.override");
- }
-},
-
-{
- desc: "Check that the search UI/ action is updated when the search engine is changed",
- setup: function() {},
- run: function()
- {
- let currEngine = Services.search.currentEngine;
- let unusedEngines = [].concat(Services.search.getVisibleEngines()).filter(x => x != currEngine);
- let searchbar = document.getElementById("searchbar");
-
- function checkSearchUI(engine) {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let searchText = doc.getElementById("searchText");
- let logoElt = doc.getElementById("searchEngineLogo");
- let engineName = doc.documentElement.getAttribute("searchEngineName");
-
- is(engineName, engine.name, "Engine name should've been updated");
-
- if (!logoElt.parentNode.hidden) {
- is(logoElt.alt, engineName, "Alt text of logo image should match search engine name")
- } else {
- is(searchText.placeholder, engineName, "Placeholder text should match search engine name");
- }
- }
- // Do a sanity check that all attributes are correctly set to begin with
- checkSearchUI(currEngine);
-
- let deferred = Promise.defer();
- promiseBrowserAttributes(gBrowser.selectedTab).then(function() {
- // Test if the update propagated
- checkSearchUI(unusedEngines[0]);
- searchbar.currentEngine = currEngine;
- deferred.resolve();
- });
-
- // The following cleanup function will set currentEngine back to the previous
- // engine if we fail to do so above.
- registerCleanupFunction(function() {
- searchbar.currentEngine = currEngine;
- });
- // Set the current search engine to an unused one
- searchbar.currentEngine = unusedEngines[0];
- searchbar.select();
- return deferred.promise;
- }
-},
-
-{
- desc: "Check POST search engine support",
- setup: function() {},
- run: function()
- {
- let deferred = Promise.defer();
- let currEngine = Services.search.defaultEngine;
- let searchObserver = function search_observer(aSubject, aTopic, aData) {
- let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
- info("Observer: " + aData + " for " + engine.name);
-
- if (aData != "engine-added")
- return;
-
- if (engine.name != "POST Search")
- return;
-
- Services.search.defaultEngine = engine;
-
- registerCleanupFunction(function() {
- Services.search.removeEngine(engine);
- Services.search.defaultEngine = currEngine;
- });
-
- let needle = "Search for something awesome.";
-
- // Ready to execute the tests!
- promiseBrowserAttributes(gBrowser.selectedTab).then(function() {
- let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let searchText = document.getElementById("searchText");
-
- waitForLoad(function() {
- let loadedText = gBrowser.contentDocument.body.textContent;
- ok(loadedText, "search page loaded");
- is(loadedText, "searchterms=" + escape(needle.replace(/\s/g, "+")),
- "Search text should arrive correctly");
- deferred.resolve();
- });
-
- searchText.value = needle;
- searchText.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
- });
- };
- Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
- registerCleanupFunction(function () {
- Services.obs.removeObserver(searchObserver, "browser-search-engine-modified");
- });
- Services.search.addEngine("http://test:80/browser/browser/base/content/test/POSTSearchEngine.xml",
- Ci.nsISearchEngine.DATA_XML, null, false);
- return deferred.promise;
- }
-}
-
-];
-
-function test()
-{
- waitForExplicitFinish();
- requestLongerTimeout(2);
- ignoreAllUncaughtExceptions();
-
- Task.spawn(function () {
- for (let test of gTests) {
- info(test.desc);
-
- if (test.beforeRun)
- yield test.beforeRun();
-
- let tab = yield promiseNewTabLoadEvent("about:home", "DOMContentLoaded");
-
- // Must wait for both the snippets map and the browser attributes, since
- // can't guess the order they will happen.
- // So, start listening now, but verify the promise is fulfilled only
- // after the snippets map setup.
- let promise = promiseBrowserAttributes(tab);
- // Prepare the snippets map with default values, then run the test setup.
- let snippetsMap = yield promiseSetupSnippetsMap(tab, test.setup);
- // Ensure browser has set attributes already, or wait for them.
- yield promise;
- info("Running test");
- yield test.run(snippetsMap);
- info("Cleanup");
- gBrowser.removeCurrentTab();
- }
- }).then(finish, ex => {
- ok(false, "Unexpected Exception: " + ex);
- finish();
- });
-}
-
-/**
- * Creates a new tab and waits for a load event.
- *
- * @param aUrl
- * The url to load in a new tab.
- * @param aEvent
- * The load event type to wait for. Defaults to "load".
- * @return {Promise} resolved when the event is handled. Gets the new tab.
- */
-function promiseNewTabLoadEvent(aUrl, aEventType="load")
-{
- let deferred = Promise.defer();
- let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
- info("Wait tab event: " + aEventType);
- tab.linkedBrowser.addEventListener(aEventType, function load(event) {
- if (event.originalTarget != tab.linkedBrowser.contentDocument ||
- event.target.location.href == "about:blank") {
- info("skipping spurious load event");
- return;
- }
- tab.linkedBrowser.removeEventListener(aEventType, load, true);
- info("Tab event received: " + aEventType);
- deferred.resolve(tab);
- }, true);
- return deferred.promise;
-}
-
-/**
- * Cleans up snippets and ensures that by default we don't try to check for
- * remote snippets since that may cause network bustage or slowness.
- *
- * @param aTab
- * The tab containing about:home.
- * @param aSetupFn
- * The setup function to be run.
- * @return {Promise} resolved when the snippets are ready. Gets the snippets map.
- */
-function promiseSetupSnippetsMap(aTab, aSetupFn)
-{
- let deferred = Promise.defer();
- let cw = aTab.linkedBrowser.contentWindow.wrappedJSObject;
- info("Waiting for snippets map");
- cw.ensureSnippetsMapThen(function (aSnippetsMap) {
- info("Got snippets map: " +
- "{ last-update: " + aSnippetsMap.get("snippets-last-update") +
- ", cached-version: " + aSnippetsMap.get("snippets-cached-version") +
- " }");
- // Don't try to update.
- aSnippetsMap.set("snippets-last-update", Date.now());
- aSnippetsMap.set("snippets-cached-version", AboutHomeUtils.snippetsVersion);
- // Clear snippets.
- aSnippetsMap.delete("snippets");
- aSetupFn(aSnippetsMap);
- // Must be sure to continue after the page snippets map setup.
- executeSoon(function() deferred.resolve(aSnippetsMap));
- });
- return deferred.promise;
-}
-
-/**
- * Waits for the attributes being set by browser.js and overwrites snippetsURL
- * to ensure we won't try to hit the network and we can force xhr to throw.
- *
- * @param aTab
- * The tab containing about:home.
- * @return {Promise} resolved when the attributes are ready.
- */
-function promiseBrowserAttributes(aTab)
-{
- let deferred = Promise.defer();
-
- let docElt = aTab.linkedBrowser.contentDocument.documentElement;
- //docElt.setAttribute("snippetsURL", "nonexistent://test");
- let observer = new MutationObserver(function (mutations) {
- for (let mutation of mutations) {
- info("Got attribute mutation: " + mutation.attributeName +
- " from " + mutation.oldValue);
- if (mutation.attributeName == "snippetsURL" &&
- docElt.getAttribute("snippetsURL") != "nonexistent://test") {
- docElt.setAttribute("snippetsURL", "nonexistent://test");
- }
-
- // Now we just have to wait for the last attribute.
- if (mutation.attributeName == "searchEngineURL") {
- info("Remove attributes observer");
- observer.disconnect();
- // Must be sure to continue after the page mutation observer.
- executeSoon(function() deferred.resolve());
- break;
- }
- }
- });
- info("Add attributes observer");
- observer.observe(docElt, { attributes: true });
-
- return deferred.promise;
-}
-
-/**
- * Retrieves the number of about:home searches recorded for the current day.
- *
- * @param aEngineName
- * name of the setup search engine.
- *
- * @return {Promise} Returns a promise resolving to the number of searches.
- */
-function getNumberOfSearches(aEngineName) {
- let reporter = Components.classes["@mozilla.org/datareporting/service;1"]
- .getService()
- .wrappedJSObject
- .healthReporter;
- ok(reporter, "Health Reporter instance available.");
-
- return reporter.onInit().then(function onInit() {
- let provider = reporter.getProvider("org.mozilla.searches");
- ok(provider, "Searches provider is available.");
-
- let m = provider.getMeasurement("counts", 2);
- return m.getValues().then(data => {
- let now = new Date();
- let yday = new Date(now);
- yday.setDate(yday.getDate() - 1);
-
- // Add the number of searches recorded yesterday to the number of searches
- // recorded today. This makes the test not fail intermittently when it is
- // run at midnight and we accidentally compare the number of searches from
- // different days. Tests are always run with an empty profile so there
- // are no searches from yesterday, normally. Should the test happen to run
- // past midnight we make sure to count them in as well.
- return getNumberOfSearchesByDate(aEngineName, data, now) +
- getNumberOfSearchesByDate(aEngineName, data, yday);
- });
- });
-}
-
-function getNumberOfSearchesByDate(aEngineName, aData, aDate) {
- if (aData.days.hasDay(aDate)) {
- let id = Services.search.getEngineByName(aEngineName).identifier;
-
- let day = aData.days.getDay(aDate);
- let field = id + ".abouthome";
-
- if (day.has(field)) {
- return day.get(field) || 0;
- }
- }
-
- return 0; // No records found.
-}
-
-function waitForLoad(cb) {
- let browser = gBrowser.selectedBrowser;
- browser.addEventListener("load", function listener() {
- if (browser.currentURI.spec == "about:blank")
- return;
- info("Page loaded: " + browser.currentURI.spec);
- browser.removeEventListener("load", listener, true);
-
- cb();
- }, true);
-}
diff --git a/browser/base/content/test/browser_aboutSyncProgress.js b/browser/base/content/test/browser_aboutSyncProgress.js
deleted file mode 100644
index 49a2fd803..000000000
--- a/browser/base/content/test/browser_aboutSyncProgress.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource://services-sync/main.js");
-
-let gTests = [ {
- desc: "Makes sure the progress bar appears if firstSync pref is set",
- setup: function () {
- Services.prefs.setCharPref("services.sync.firstSync", "newAccount");
- },
- run: function () {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let progressBar = doc.getElementById("uploadProgressBar");
-
- let win = doc.defaultView;
- isnot(win.getComputedStyle(progressBar).display, "none", "progress bar should be visible");
- executeSoon(runNextTest);
- }
-},
-
-{
- desc: "Makes sure the progress bar is hidden if firstSync pref is not set",
- setup: function () {
- Services.prefs.clearUserPref("services.sync.firstSync");
- is(Services.prefs.getPrefType("services.sync.firstSync"),
- Ci.nsIPrefBranch.PREF_INVALID, "pref DNE" );
- },
- run: function () {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let progressBar = doc.getElementById("uploadProgressBar");
-
- let win = doc.defaultView;
- is(win.getComputedStyle(progressBar).display, "none",
- "progress bar should not be visible");
- executeSoon(runNextTest);
- }
-},
-{
- desc: "Makes sure the observer updates are reflected in the progress bar",
- setup: function () {
- },
- run: function () {
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let progressBar = doc.getElementById("uploadProgressBar");
-
- Services.obs.notifyObservers(null, "weave:engine:sync:finish", null);
- Services.obs.notifyObservers(null, "weave:engine:sync:error", null);
-
- let received = progressBar.getAttribute("value");
-
- is(received, 2, "progress bar received correct notifications");
- executeSoon(runNextTest);
- }
-},
-{
- desc: "Close button should close tab",
- setup: function (){
- },
- run: function () {
- function onTabClosed() {
- ok(true, "received TabClose notification");
- gBrowser.tabContainer.removeEventListener("TabClose", onTabClosed, false);
- executeSoon(runNextTest);
- }
- let doc = gBrowser.selectedTab.linkedBrowser.contentDocument;
- let button = doc.getElementById('closeButton');
- let window = doc.defaultView;
- gBrowser.tabContainer.addEventListener("TabClose", onTabClosed, false);
- EventUtils.sendMouseEvent({type: "click"}, button, window);
- }
-},
-];
-
-function test () {
- waitForExplicitFinish();
- executeSoon(runNextTest);
-}
-
-function runNextTest()
-{
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-
- if (gTests.length) {
- let test = gTests.shift();
- info(test.desc);
- test.setup();
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:sync-progress");
- tab.linkedBrowser.addEventListener("load", function (event) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- // Some part of the page is populated on load, so enqueue on it.
- executeSoon(test.run);
- }, true);
- }
- else {
- finish();
- }
-}
-
diff --git a/browser/base/content/test/browser_addon_bar.js b/browser/base/content/test/browser_addon_bar.js
deleted file mode 100644
index 3607eb122..000000000
--- a/browser/base/content/test/browser_addon_bar.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let addonbar = document.getElementById("addon-bar");
- ok(addonbar.collapsed, "addon bar is collapsed by default");
-
- let topMenu, toolbarMenu;
-
- function onTopMenuShown(event) {
- ok(1, "top menu popupshown listener called");
- event.currentTarget.removeEventListener("popupshown", arguments.callee, false);
- // open the customize or toolbars menu
- toolbarMenu = document.getElementById("appmenu_customizeMenu") ||
- document.getElementById("viewToolbarsMenu").firstElementChild;
- toolbarMenu.addEventListener("popupshown", onToolbarMenuShown, false);
- toolbarMenu.addEventListener("popuphidden", onToolbarMenuHidden, false);
- toolbarMenu.openPopup();
- }
-
- function onTopMenuHidden(event) {
- ok(1, "top menu popuphidden listener called");
- event.currentTarget.removeEventListener("popuphidden", arguments.callee, false);
- finish();
- }
-
- function onToolbarMenuShown(event) {
- ok(1, "sub menu popupshown listener called");
- event.currentTarget.removeEventListener("popupshown", arguments.callee, false);
-
- // test the menu item's default state
- let menuitem = document.getElementById("toggle_addon-bar");
- ok(menuitem, "found the menu item");
- is(menuitem.getAttribute("checked"), "false", "menuitem is not checked by default");
-
- // click on the menu item
- // TODO: there's got to be a way to check+command in one shot
- menuitem.setAttribute("checked", "true");
- menuitem.click();
-
- // now the addon bar should be visible and the menu checked
- is(addonbar.getAttribute("collapsed"), "false", "addon bar is visible after executing the command");
- is(menuitem.getAttribute("checked"), "true", "menuitem is checked after executing the command");
-
- toolbarMenu.hidePopup();
- }
-
- function onToolbarMenuHidden(event) {
- ok(1, "toolbar menu popuphidden listener called");
- event.currentTarget.removeEventListener("popuphidden", arguments.callee, false);
- topMenu.hidePopup();
- }
-
- // open the appmenu or view menu
- topMenu = document.getElementById("appmenu-popup") ||
- document.getElementById("menu_viewPopup");
- topMenu.addEventListener("popupshown", onTopMenuShown, false);
- topMenu.addEventListener("popuphidden", onTopMenuHidden, false);
- topMenu.openPopup();
-}
diff --git a/browser/base/content/test/browser_addon_bar_aomlistener.js b/browser/base/content/test/browser_addon_bar_aomlistener.js
deleted file mode 100644
index 75a539e07..000000000
--- a/browser/base/content/test/browser_addon_bar_aomlistener.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
-
- let addonbar = document.getElementById("addon-bar");
- ok(addonbar.collapsed, "addon bar is collapsed by default");
-
- function addItem(id) {
- let button = document.createElement("toolbarbutton");
- button.id = id;
- let palette = document.getElementById("navigator-toolbox").palette;
- palette.appendChild(button);
- addonbar.insertItem(id, null, null, false);
- }
-
- // call onInstalling
- AddonsMgrListener.onInstalling();
-
- // add item to the bar
- let id = "testbutton";
- addItem(id);
-
- // call onInstalled
- AddonsMgrListener.onInstalled();
-
- // confirm bar is visible
- ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
-
- // call onUninstalling
- AddonsMgrListener.onUninstalling();
-
- // remove item from the bar
- addonbar.currentSet = addonbar.currentSet.replace("," + id, "");
-
- // call onUninstalled
- AddonsMgrListener.onUninstalled();
-
- // confirm bar is not visible
- ok(addonbar.collapsed, "addon bar is collapsed after toggle");
-
- // call onEnabling
- AddonsMgrListener.onEnabling();
-
- // add item to the bar
- let id = "testbutton";
- addItem(id);
-
- // call onEnabled
- AddonsMgrListener.onEnabled();
-
- // confirm bar is visible
- ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
-
- // call onDisabling
- AddonsMgrListener.onDisabling();
-
- // remove item from the bar
- addonbar.currentSet = addonbar.currentSet.replace("," + id, "");
-
- // call onDisabled
- AddonsMgrListener.onDisabled();
-
- // confirm bar is not visible
- ok(addonbar.collapsed, "addon bar is collapsed after toggle");
-}
diff --git a/browser/base/content/test/browser_addon_bar_close_button.js b/browser/base/content/test/browser_addon_bar_close_button.js
deleted file mode 100644
index 7d3afb333..000000000
--- a/browser/base/content/test/browser_addon_bar_close_button.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let addonbar = document.getElementById("addon-bar");
- ok(addonbar.collapsed, "addon bar is collapsed by default");
-
- // make add-on bar visible
- setToolbarVisibility(addonbar, true);
- ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
-
- // click the close button
- let closeButton = document.getElementById("addonbar-closebutton");
- EventUtils.synthesizeMouseAtCenter(closeButton, {});
-
- // confirm addon bar is closed
- ok(addonbar.collapsed, "addon bar is collapsed after clicking close button");
-}
diff --git a/browser/base/content/test/browser_addon_bar_shortcut.js b/browser/base/content/test/browser_addon_bar_shortcut.js
deleted file mode 100644
index 847f96721..000000000
--- a/browser/base/content/test/browser_addon_bar_shortcut.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let addonbar = document.getElementById("addon-bar");
- ok(addonbar.collapsed, "addon bar is collapsed by default");
-
- // show the add-on bar
- EventUtils.synthesizeKey("/", { accelKey: true }, window);
- ok(!addonbar.collapsed, "addon bar is not collapsed after toggle");
-
- // hide the add-on bar
- EventUtils.synthesizeKey("/", { accelKey: true }, window);
-
- // confirm addon bar is closed
- ok(addonbar.collapsed, "addon bar is collapsed after toggle");
-}
diff --git a/browser/base/content/test/browser_allTabsPanel.js b/browser/base/content/test/browser_allTabsPanel.js
deleted file mode 100644
index eb82c0d1a..000000000
--- a/browser/base/content/test/browser_allTabsPanel.js
+++ /dev/null
@@ -1,162 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(allTabs.prefName, true);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(allTabs.prefName);
- });
-
- allTabs.init();
- nextSequence();
-}
-
-var sequences = 3;
-var chars = "ABCDEFGHI";
-var closedTabs;
-var history;
-var steps;
-var whenOpen = [
- startSearch,
- clearSearch, clearSearch,
- closeTab,
- moveTab,
- closePanel,
-];
-var whenClosed = [
- openPanel, openPanel, openPanel, openPanel, openPanel, openPanel,
- closeTab, closeTab, closeTab,
- moveTab, moveTab, moveTab,
- selectTab, selectTab,
- undoCloseTab,
- openTab,
-];
-
-function rand(min, max) {
- return min + Math.floor(Math.random() * (max - min + 1));
-}
-function pickOne(array) {
- return array[rand(0, array.length - 1)];
-}
-function pickOneTab() {
- var tab = pickOne(gBrowser.tabs);
- return [tab, Array.indexOf(gBrowser.tabs, tab)];
-}
-function nextSequence() {
- while (gBrowser.browsers.length > 1)
- gBrowser.removeCurrentTab();
- if (sequences-- <= 0) {
- allTabs.close();
- gBrowser.addTab();
- gBrowser.removeCurrentTab();
- finish();
- return;
- }
- closedTabs = 0;
- steps = rand(10, 20);
- var initialTabs = "";
- while (gBrowser.browsers.length < rand(3, 20)) {
- let tabChar = pickOne(chars);
- initialTabs += tabChar;
- gBrowser.addTab("data:text/plain," + tabChar);
- }
- history = [initialTabs];
- gBrowser.removeCurrentTab();
- next();
-}
-function next() {
- executeSoon(function () {
- is(allTabs.previews.length, gBrowser.browsers.length,
- history.join(", "));
- if (steps-- <= 0) {
- nextSequence();
- return;
- }
- var step;
- var rv;
- do {
- step = pickOne(allTabs.isOpen ? whenOpen : whenClosed);
- info(step.name);
- rv = step();
- } while (rv === false);
- history.push(step.name + (rv !== true && rv !== undefined ? " " + rv : ""));
- });
-}
-
-function openPanel() {
- if (allTabs.isOpen)
- return false;
- allTabs.panel.addEventListener("popupshown", function () {
- allTabs.panel.removeEventListener("popupshown", arguments.callee, false);
- next();
- }, false);
- allTabs.open();
- return true;
-}
-
-function closePanel() {
- allTabs.panel.addEventListener("popuphidden", function () {
- allTabs.panel.removeEventListener("popuphidden", arguments.callee, false);
- next();
- }, false);
- allTabs.close();
-}
-
-function closeTab() {
- if (gBrowser.browsers.length == 1)
- return false;
- var [tab, index] = pickOneTab();
- gBrowser.removeTab(tab);
- closedTabs++;
- next();
- return index;
-}
-
-function startSearch() {
- allTabs.filterField.value = pickOne(chars);
- info(allTabs.filterField.value);
- allTabs.filter();
- next();
- return allTabs.filterField.value;
-}
-
-function clearSearch() {
- if (!allTabs.filterField.value)
- return false;
- allTabs.filterField.value = "";
- allTabs.filter();
- next();
- return true;
-}
-
-function undoCloseTab() {
- if (!closedTabs)
- return false;
- window.undoCloseTab(0);
- closedTabs--;
- next();
- return true;
-}
-
-function selectTab() {
- var [tab, index] = pickOneTab();
- gBrowser.selectedTab = tab;
- next();
- return index;
-}
-
-function openTab() {
- BrowserOpenTab();
- next();
-}
-
-function moveTab() {
- if (gBrowser.browsers.length == 1)
- return false;
- var [tab, currentIndex] = pickOneTab();
- do {
- var [, newIndex] = pickOneTab();
- } while (newIndex == currentIndex);
- gBrowser.moveTabTo(tab, newIndex);
- next();
- return currentIndex + "->" + newIndex;
-}
diff --git a/browser/base/content/test/browser_alltabslistener.js b/browser/base/content/test/browser_alltabslistener.js
deleted file mode 100644
index 4d7d11435..000000000
--- a/browser/base/content/test/browser_alltabslistener.js
+++ /dev/null
@@ -1,204 +0,0 @@
-const Ci = Components.interfaces;
-
-const gCompleteState = Ci.nsIWebProgressListener.STATE_STOP +
- Ci.nsIWebProgressListener.STATE_IS_NETWORK;
-
-var gFrontProgressListener = {
- onProgressChange: function (aWebProgress, aRequest,
- aCurSelfProgress, aMaxSelfProgress,
- aCurTotalProgress, aMaxTotalProgress) {
- },
-
- onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
- var state = "onStateChange";
- info("FrontProgress: " + state + " 0x" + aStateFlags.toString(16));
- ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
- is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
- gFrontNotificationsPos++;
- },
-
- onLocationChange: function (aWebProgress, aRequest, aLocationURI, aFlags) {
- var state = "onLocationChange";
- info("FrontProgress: " + state + " " + aLocationURI.spec);
- ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
- is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
- gFrontNotificationsPos++;
- },
-
- onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
- },
-
- onSecurityChange: function (aWebProgress, aRequest, aState) {
- var state = "onSecurityChange";
- info("FrontProgress: " + state + " 0x" + aState.toString(16));
- ok(gFrontNotificationsPos < gFrontNotifications.length, "Got an expected notification for the front notifications listener");
- is(state, gFrontNotifications[gFrontNotificationsPos], "Got a notification for the front notifications listener");
- gFrontNotificationsPos++;
- }
-}
-
-var gAllProgressListener = {
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- var state = "onStateChange";
- info("AllProgress: " + state + " 0x" + aStateFlags.toString(16));
- ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
- ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
- is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
- gAllNotificationsPos++;
-
- if ((aStateFlags & gCompleteState) == gCompleteState) {
- ok(gAllNotificationsPos == gAllNotifications.length, "Saw the expected number of notifications");
- ok(gFrontNotificationsPos == gFrontNotifications.length, "Saw the expected number of frontnotifications");
- executeSoon(gNextTest);
- }
- },
-
- onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI,
- aFlags) {
- var state = "onLocationChange";
- info("AllProgress: " + state + " " + aLocationURI.spec);
- ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
- ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
- is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
- gAllNotificationsPos++;
- },
-
- onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
- var state = "onStatusChange";
- ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
- },
-
- onSecurityChange: function (aBrowser, aWebProgress, aRequest, aState) {
- var state = "onSecurityChange";
- info("AllProgress: " + state + " 0x" + aState.toString(16));
- ok(aBrowser == gTestBrowser, state + " notification came from the correct browser");
- ok(gAllNotificationsPos < gAllNotifications.length, "Got an expected notification for the all notifications listener");
- is(state, gAllNotifications[gAllNotificationsPos], "Got a notification for the all notifications listener");
- gAllNotificationsPos++;
- }
-}
-
-var gFrontNotifications, gAllNotifications, gFrontNotificationsPos, gAllNotificationsPos;
-var gBackgroundTab, gForegroundTab, gBackgroundBrowser, gForegroundBrowser, gTestBrowser;
-var gTestPage = "/browser/browser/base/content/test/alltabslistener.html";
-var gNextTest;
-
-function test() {
- waitForExplicitFinish();
-
- gBackgroundTab = gBrowser.addTab("about:blank");
- gForegroundTab = gBrowser.addTab("about:blank");
- gBackgroundBrowser = gBrowser.getBrowserForTab(gBackgroundTab);
- gForegroundBrowser = gBrowser.getBrowserForTab(gForegroundTab);
- gBrowser.selectedTab = gForegroundTab;
-
- // We must wait until the about:blank page has completed loading before
- // starting tests or we get notifications from that
- gForegroundBrowser.addEventListener("load", startTests, true);
-}
-
-function runTest(browser, url, next) {
- gFrontNotificationsPos = 0;
- gAllNotificationsPos = 0;
- gNextTest = next;
- gTestBrowser = browser;
- browser.loadURI(url);
-}
-
-function startTests() {
- gForegroundBrowser.removeEventListener("load", startTests, true);
- executeSoon(startTest1);
-}
-
-function startTest1() {
- info("\nTest 1");
- gBrowser.addProgressListener(gFrontProgressListener);
- gBrowser.addTabsProgressListener(gAllProgressListener);
-
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = gAllNotifications;
- runTest(gForegroundBrowser, "http://example.org" + gTestPage, startTest2);
-}
-
-function startTest2() {
- info("\nTest 2");
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = gAllNotifications;
- runTest(gForegroundBrowser, "https://example.com" + gTestPage, startTest3);
-}
-
-function startTest3() {
- info("\nTest 3");
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = [];
- runTest(gBackgroundBrowser, "http://example.org" + gTestPage, startTest4);
-}
-
-function startTest4() {
- info("\nTest 4");
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = [];
- runTest(gBackgroundBrowser, "https://example.com" + gTestPage, startTest5);
-}
-
-function startTest5() {
- info("\nTest 5");
- // Switch the foreground browser
- [gForegroundBrowser, gBackgroundBrowser] = [gBackgroundBrowser, gForegroundBrowser];
- [gForegroundTab, gBackgroundTab] = [gBackgroundTab, gForegroundTab];
- // Avoid the onLocationChange this will fire
- gBrowser.removeProgressListener(gFrontProgressListener);
- gBrowser.selectedTab = gForegroundTab;
- gBrowser.addProgressListener(gFrontProgressListener);
-
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = gAllNotifications;
- runTest(gForegroundBrowser, "http://example.org" + gTestPage, startTest6);
-}
-
-function startTest6() {
- info("\nTest 6");
- gAllNotifications = [
- "onStateChange",
- "onLocationChange",
- "onSecurityChange",
- "onStateChange"
- ];
- gFrontNotifications = [];
- runTest(gBackgroundBrowser, "http://example.org" + gTestPage, finishTest);
-}
-
-function finishTest() {
- gBrowser.removeProgressListener(gFrontProgressListener);
- gBrowser.removeTabsProgressListener(gAllProgressListener);
- gBrowser.removeTab(gBackgroundTab);
- gBrowser.removeTab(gForegroundTab);
- finish();
-}
diff --git a/browser/base/content/test/browser_blob-channelname.js b/browser/base/content/test/browser_blob-channelname.js
deleted file mode 100644
index fbeaeeb21..000000000
--- a/browser/base/content/test/browser_blob-channelname.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
-function test() {
- var file = new File(new Blob(['test'], {type: 'text/plain'}), {name: 'test-name'});
- var url = URL.createObjectURL(file);
- var channel = NetUtil.newChannel(url);
-
- is(channel.contentDispositionFilename, 'test-name', "filename matches");
-}
diff --git a/browser/base/content/test/browser_bookmark_titles.js b/browser/base/content/test/browser_bookmark_titles.js
deleted file mode 100644
index 5f7c11053..000000000
--- a/browser/base/content/test/browser_bookmark_titles.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This file is tests for the default titles that new bookmarks get.
-
-let tests = [
- // Common page.
- ['http://example.com/browser/browser/base/content/test/dummy_page.html',
- 'Dummy test page'],
- // Data URI.
- ['data:text/html;charset=utf-8,<title>test%20data:%20url</title>',
- 'test data: url'],
- // about:neterror
- ['data:application/vnd.mozilla.xul+xml,',
- 'data:application/vnd.mozilla.xul+xml,'],
- // about:certerror
- ['https://untrusted.example.com/somepage.html',
- 'https://untrusted.example.com/somepage.html']
-];
-
-function generatorTest() {
- gBrowser.selectedTab = gBrowser.addTab();
- let browser = gBrowser.selectedBrowser;
- browser.stop(); // stop the about:blank load.
-
- browser.addEventListener("DOMContentLoaded", event => {
- if (event.originalTarget != browser.contentDocument ||
- event.target.location.href == "about:blank") {
- info("skipping spurious load event");
- return;
- }
- nextStep();
- }, true);
- registerCleanupFunction(function () {
- browser.removeEventListener("DOMContentLoaded", nextStep, true);
- gBrowser.removeCurrentTab();
- });
-
- // Test that a bookmark of each URI gets the corresponding default title.
- for (let i = 0; i < tests.length; ++i) {
- let [uri, title] = tests[i];
- content.location = uri;
- yield;
- checkBookmark(uri, title);
- }
-
- // Network failure test: now that dummy_page.html is in history, bookmarking
- // it should give the last known page title as the default bookmark title.
-
- // Simulate a network outage with offline mode. (Localhost is still
- // accessible in offline mode, so disable the test proxy as well.)
- BrowserOffline.toggleOfflineStatus();
- let proxy = Services.prefs.getIntPref('network.proxy.type');
- Services.prefs.setIntPref('network.proxy.type', 0);
- registerCleanupFunction(function () {
- BrowserOffline.toggleOfflineStatus();
- Services.prefs.setIntPref('network.proxy.type', proxy);
- });
-
- // LOAD_FLAGS_BYPASS_CACHE isn't good enough. So clear the cache.
- Services.cache.evictEntries(Services.cache.STORE_ANYWHERE);
-
- let [uri, title] = tests[0];
- content.location = uri;
- yield;
- // The offline mode test is only good if the page failed to load.
- is(content.document.documentURI.substring(0, 14), 'about:neterror',
- "Offline mode successfully simulated network outage.");
- checkBookmark(uri, title);
-}
-
-// Bookmark the current page and confirm that the new bookmark has the expected
-// title. (Then delete the bookmark.)
-function checkBookmark(uri, expected_title) {
- is(gBrowser.selectedBrowser.currentURI.spec, uri,
- "Trying to bookmark the expected uri");
- PlacesCommandHook.bookmarkCurrentPage(false);
-
- let id = PlacesUtils.getMostRecentBookmarkForURI(PlacesUtils._uri(uri));
- ok(id > 0, "Found the expected bookmark");
- let title = PlacesUtils.bookmarks.getItemTitle(id);
- is(title, expected_title, "Bookmark got a good default title.");
-
- PlacesUtils.bookmarks.removeItem(id);
-}
diff --git a/browser/base/content/test/browser_bug304198.js b/browser/base/content/test/browser_bug304198.js
deleted file mode 100644
index a40034148..000000000
--- a/browser/base/content/test/browser_bug304198.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
-
- charsToDelete = 5;
- deletedURLTab = gBrowser.addTab();
- fullURLTab = gBrowser.addTab();
- partialURLTab = gBrowser.addTab();
- testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-
- function cleanUp() {
- gBrowser.removeTab(fullURLTab);
- gBrowser.removeTab(partialURLTab);
- gBrowser.removeTab(deletedURLTab);
- }
-
- function cycleTabs() {
- gBrowser.selectedTab = fullURLTab;
- is(gURLBar.value, testURL, 'gURLBar.value should be testURL after switching back to fullURLTab');
-
- gBrowser.selectedTab = partialURLTab;
- is(gURLBar.value, testPartialURL, 'gURLBar.value should be testPartialURL after switching back to partialURLTab');
-
- gBrowser.selectedTab = deletedURLTab;
- is(gURLBar.value, '', 'gURLBar.value should be "" after switching back to deletedURLTab');
-
- gBrowser.selectedTab = fullURLTab;
- is(gURLBar.value, testURL, 'gURLBar.value should be testURL after switching back to fullURLTab');
- }
-
- // function borrowed from browser_bug386835.js
- function load(tab, url, cb) {
- tab.linkedBrowser.addEventListener("load", function (event) {
- event.currentTarget.removeEventListener("load", arguments.callee, true);
- cb();
- }, true);
- tab.linkedBrowser.loadURI(url);
- }
-
- function urlbarBackspace(cb) {
- gBrowser.selectedBrowser.focus();
- gURLBar.addEventListener("focus", function () {
- gURLBar.removeEventListener("focus", arguments.callee, false);
- gURLBar.addEventListener("input", function () {
- gURLBar.removeEventListener("input", arguments.callee, false);
- cb();
- }, false);
- executeSoon(function () {
- EventUtils.synthesizeKey("VK_BACK_SPACE", {});
- });
- }, false);
- gURLBar.focus();
- }
-
- function prepareDeletedURLTab(cb) {
- gBrowser.selectedTab = deletedURLTab;
- is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to deletedURLTab');
-
- // simulate the user removing the whole url from the location bar
- gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", true);
-
- urlbarBackspace(function () {
- is(gURLBar.value, "", 'gURLBar.value should be "" (just set)');
- if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll"))
- gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
- cb();
- });
- }
-
- function prepareFullURLTab(cb) {
- gBrowser.selectedTab = fullURLTab;
- is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to fullURLTab');
- cb();
- }
-
- function preparePartialURLTab(cb) {
- gBrowser.selectedTab = partialURLTab;
- is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to partialURLTab');
-
- // simulate the user removing part of the url from the location bar
- gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
-
- var deleted = 0;
- urlbarBackspace(function () {
- deleted++;
- if (deleted < charsToDelete) {
- urlbarBackspace(arguments.callee);
- } else {
- is(gURLBar.value, testPartialURL, "gURLBar.value should be testPartialURL (just set)");
- if (gPrefService.prefHasUserValue("browser.urlbar.clickSelectsAll"))
- gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
- cb();
- }
- });
- }
-
- function runTests() {
- testURL = gURLBar.trimValue(testURL);
- testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
-
- // prepare the three tabs required by this test
- prepareFullURLTab(function () {
- preparePartialURLTab(function () {
- prepareDeletedURLTab(function () {
- // now cycle the tabs and make sure everything looks good
- cycleTabs();
- cleanUp();
- finish();
- });
- });
- });
- }
-
- load(deletedURLTab, testURL, function() {
- load(fullURLTab, testURL, function() {
- load(partialURLTab, testURL, runTests);
- });
- });
-}
-
diff --git a/browser/base/content/test/browser_bug321000.js b/browser/base/content/test/browser_bug321000.js
deleted file mode 100644
index 99c1d51a5..000000000
--- a/browser/base/content/test/browser_bug321000.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const kTestString = " hello hello \n world\nworld ";
-
-var gTests = [
-
- { desc: "Urlbar strips newlines and surrounding whitespace",
- element: gURLBar,
- expected: kTestString.replace(/\s*\n\s*/g,'')
- },
-
- { desc: "Searchbar replaces newlines with spaces",
- element: document.getElementById('searchbar'),
- expected: kTestString.replace('\n',' ','g')
- },
-
-];
-
-// Test for bug 23485 and bug 321000.
-// Urlbar should strip newlines,
-// search bar should replace newlines with spaces.
-function test() {
- waitForExplicitFinish();
-
- let cbHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
- getService(Ci.nsIClipboardHelper);
-
- // Put a multi-line string in the clipboard.
- // Setting the clipboard value is an async OS operation, so we need to poll
- // the clipboard for valid data before going on.
- waitForClipboard(kTestString, function() { cbHelper.copyString(kTestString, document); },
- next_test, finish);
-}
-
-function next_test() {
- if (gTests.length)
- test_paste(gTests.shift());
- else
- finish();
-}
-
-function test_paste(aCurrentTest) {
- var element = aCurrentTest.element;
-
- // Register input listener.
- var inputListener = {
- test: aCurrentTest,
- handleEvent: function(event) {
- element.removeEventListener(event.type, this, false);
-
- is(element.value, this.test.expected, this.test.desc);
-
- // Clear the field and go to next test.
- element.value = "";
- setTimeout(next_test, 0);
- }
- }
- element.addEventListener("input", inputListener, false);
-
- // Focus the window.
- window.focus();
- gBrowser.selectedBrowser.focus();
-
- // Focus the element and wait for focus event.
- info("About to focus " + element.id);
- element.addEventListener("focus", function() {
- element.removeEventListener("focus", arguments.callee, false);
- executeSoon(function() {
- // Pasting is async because the Accel+V codepath ends up going through
- // nsDocumentViewer::FireClipboardEvent.
- info("Pasting into " + element.id);
- EventUtils.synthesizeKey("v", { accelKey: true });
- });
- }, false);
- element.focus();
-}
diff --git a/browser/base/content/test/browser_bug329212.js b/browser/base/content/test/browser_bug329212.js
deleted file mode 100644
index 5dc22c4aa..000000000
--- a/browser/base/content/test/browser_bug329212.js
+++ /dev/null
@@ -1,43 +0,0 @@
-function test () {
-
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("svg1")), "should get title");
- is(tooltip.getAttribute("label"), "This is a non-root SVG element title");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("text1")), "should get title");
- is(tooltip.getAttribute("label"), "\n\n\n This is a title\n\n ");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text2")), "should not get title");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text3")), "should not get title");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("link1")), "should get title");
- is(tooltip.getAttribute("label"), "\n This is a title\n ");
- ok(tooltip.fillInPageTooltip(doc.getElementById("text4")), "should get title");
- is(tooltip.getAttribute("label"), "\n This is a title\n ");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("link2")), "should not get title");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("link3")), "should get title");
- isnot(tooltip.getAttribute("label"), "");
-
- ok(tooltip.fillInPageTooltip(doc.getElementById("link4")), "should get title");
- is(tooltip.getAttribute("label"), "This is an xlink:title attribute");
-
- ok(!tooltip.fillInPageTooltip(doc.getElementById("text5")), "should not get title");
-
- gBrowser.removeCurrentTab();
- finish();
- }, true);
-
- content.location =
- "http://mochi.test:8888/browser/browser/base/content/test/title_test.svg";
-}
-
diff --git a/browser/base/content/test/browser_bug356571.js b/browser/base/content/test/browser_bug356571.js
deleted file mode 100644
index aeb07c785..000000000
--- a/browser/base/content/test/browser_bug356571.js
+++ /dev/null
@@ -1,91 +0,0 @@
-// Bug 356571 - loadOneOrMoreURIs gives up if one of the URLs has an unknown protocol
-
-const Cr = Components.results;
-const Cm = Components.manager;
-
-// Set to true when docShell alerts for unknown protocol error
-var didFail = false;
-
-// Override Alert to avoid blocking the test due to unknown protocol error
-const kPromptServiceUUID = "{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}";
-const kPromptServiceContractID = "@mozilla.org/embedcomp/prompt-service;1";
-
-// Save original prompt service factory
-const kPromptServiceFactory = Cm.getClassObject(Cc[kPromptServiceContractID],
- Ci.nsIFactory);
-
-let fakePromptServiceFactory = {
- createInstance: function(aOuter, aIid) {
- if (aOuter != null)
- throw Cr.NS_ERROR_NO_AGGREGATION;
- return promptService.QueryInterface(aIid);
- }
-};
-
-let promptService = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]),
- alert: function() {
- didFail = true;
- }
-};
-
-/* FIXME
-Cm.QueryInterface(Ci.nsIComponentRegistrar)
- .registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
- kPromptServiceContractID, fakePromptServiceFactory);
-*/
-
-const kCompleteState = Ci.nsIWebProgressListener.STATE_STOP +
- Ci.nsIWebProgressListener.STATE_IS_NETWORK;
-
-const kDummyPage = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-const kURIs = [
- "bad://www.mozilla.org/",
- kDummyPage,
- kDummyPage,
-];
-
-var gProgressListener = {
- _runCount: 0,
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if ((aStateFlags & kCompleteState) == kCompleteState) {
- if (++this._runCount != kURIs.length)
- return;
- // Check we failed on unknown protocol (received an alert from docShell)
- ok(didFail, "Correctly failed on unknown protocol");
- // Check we opened all tabs
- ok(gBrowser.tabs.length == kURIs.length, "Correctly opened all expected tabs");
- finishTest();
- }
- }
-}
-
-function test() {
- todo(false, "temp. disabled");
- return; /* FIXME */
- waitForExplicitFinish();
- // Wait for all tabs to finish loading
- gBrowser.addTabsProgressListener(gProgressListener);
- loadOneOrMoreURIs(kURIs.join("|"));
-}
-
-function finishTest() {
- // Unregister the factory so we do not leak
- Cm.QueryInterface(Ci.nsIComponentRegistrar)
- .unregisterFactory(Components.ID(kPromptServiceUUID),
- fakePromptServiceFactory);
-
- // Restore the original factory
- Cm.QueryInterface(Ci.nsIComponentRegistrar)
- .registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
- kPromptServiceContractID, kPromptServiceFactory);
-
- // Remove the listener
- gBrowser.removeTabsProgressListener(gProgressListener);
-
- // Close opened tabs
- for (var i = gBrowser.tabs.length-1; i > 0; i--)
- gBrowser.removeTab(gBrowser.tabs[i]);
-
- finish();
-}
diff --git a/browser/base/content/test/browser_bug380960.js b/browser/base/content/test/browser_bug380960.js
deleted file mode 100644
index e5be919b1..000000000
--- a/browser/base/content/test/browser_bug380960.js
+++ /dev/null
@@ -1,91 +0,0 @@
-function test() {
- gBrowser.tabContainer.addEventListener("TabOpen", tabAdded, false);
-
- var tab = gBrowser.addTab("about:blank", { skipAnimation: true });
- gBrowser.removeTab(tab);
- is(tab.parentNode, null, "tab removed immediately");
-
- tab = gBrowser.addTab("about:blank", { skipAnimation: true });
- gBrowser.removeTab(tab, { animate: true });
- gBrowser.removeTab(tab);
- is(tab.parentNode, null, "tab removed immediately when calling removeTab again after the animation was kicked off");
-
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref("browser.tabs.animate", true);
-
-// preperForNextText();
- todo(false, "async tests disabled because of intermittent failures (bug 585361)");
- cleanup();
-}
-
-function tabAdded() {
- info("tab added");
-}
-
-function cleanup() {
- if (Services.prefs.prefHasUserValue("browser.tabs.animate"))
- Services.prefs.clearUserPref("browser.tabs.animate");
- gBrowser.tabContainer.removeEventListener("TabOpen", tabAdded, false);
- finish();
-}
-
-var asyncTests = [
- function (tab) {
- info("closing tab with middle click");
- EventUtils.synthesizeMouse(tab, 2, 2, { button: 1 });
- },
- function (tab) {
- info("closing tab with accel+w");
- gBrowser.selectedTab = tab;
- gBrowser.selectedBrowser.focus();
- EventUtils.synthesizeKey("w", { accelKey: true });
- },
- function (tab) {
- info("closing tab by clicking the tab close button");
- gBrowser.selectedTab = tab;
- var button = document.getAnonymousElementByAttribute(tab, "anonid", "close-button");
- EventUtils.synthesizeMouse(button, 2, 2, {});
- }
-];
-
-function preperForNextText() {
- info("tests left: " + asyncTests.length + "; starting next");
- var tab = gBrowser.addTab("about:blank", { skipAnimation: true });
- executeSoon(function () {
- nextAsyncText(tab);
- });
-}
-
-function nextAsyncText(tab) {
- var gotCloseEvent = false;
-
- tab.addEventListener("TabClose", function () {
- tab.removeEventListener("TabClose", arguments.callee, false);
- info("got TabClose event");
- gotCloseEvent = true;
-
- const DEFAULT_ANIMATION_LENGTH = 250;
- const MAX_WAIT_TIME = DEFAULT_ANIMATION_LENGTH * 7;
- var polls = Math.ceil(MAX_WAIT_TIME / DEFAULT_ANIMATION_LENGTH);
- var pollTabRemoved = setInterval(function () {
- --polls;
- if (tab.parentNode && polls > 0)
- return;
- clearInterval(pollTabRemoved);
-
- is(tab.parentNode, null, "tab removed after at most " + MAX_WAIT_TIME + " ms");
-
- if (asyncTests.length)
- preperForNextText();
- else
- cleanup();
- }, DEFAULT_ANIMATION_LENGTH);
- }, false);
-
- asyncTests.shift()(tab);
-
- ok(gotCloseEvent, "got the close event syncronously");
-
- is(tab.parentNode, gBrowser.tabContainer, "tab still exists when it's about to be removed asynchronously");
-}
diff --git a/browser/base/content/test/browser_bug386835.js b/browser/base/content/test/browser_bug386835.js
deleted file mode 100644
index 0f0bae2aa..000000000
--- a/browser/base/content/test/browser_bug386835.js
+++ /dev/null
@@ -1,89 +0,0 @@
-var gTestPage = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-var gTestImage = "http://example.org/browser/browser/base/content/test/moz.png";
-var gTab1, gTab2, gTab3;
-var gLevel;
-const BACK = 0;
-const FORWARD = 1;
-
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function () {
- gTab1 = gBrowser.addTab(gTestPage);
- gTab2 = gBrowser.addTab();
- gTab3 = gBrowser.addTab();
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- yield FullZoomHelper.load(gTab1, gTestPage);
- yield FullZoomHelper.load(gTab2, gTestPage);
- }).then(secondPageLoaded, FullZoomHelper.failAndContinue(finish));
-}
-
-function secondPageLoaded() {
- Task.spawn(function () {
- FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
- FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
- FullZoomHelper.zoomTest(gTab3, 1, "Initial zoom of tab 3 should be 1");
-
- // Now have three tabs, two with the test page, one blank. Tab 1 is selected
- // Zoom tab 1
- FullZoom.enlarge();
- gLevel = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab1));
-
- ok(gLevel > 1, "New zoom for tab 1 should be greater than 1");
- FullZoomHelper.zoomTest(gTab2, 1, "Zooming tab 1 should not affect tab 2");
- FullZoomHelper.zoomTest(gTab3, 1, "Zooming tab 1 should not affect tab 3");
-
- yield FullZoomHelper.load(gTab3, gTestPage);
- }).then(thirdPageLoaded, FullZoomHelper.failAndContinue(finish));
-}
-
-function thirdPageLoaded() {
- Task.spawn(function () {
- FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
- FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 should still not be affected");
- FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should have zoomed as it was loading in the background");
-
- // Switching to tab 2 should update its zoom setting.
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
- FullZoomHelper.zoomTest(gTab1, gLevel, "Tab 1 should still be zoomed");
- FullZoomHelper.zoomTest(gTab2, gLevel, "Tab 2 should be zoomed now");
- FullZoomHelper.zoomTest(gTab3, gLevel, "Tab 3 should still be zoomed");
-
- yield FullZoomHelper.load(gTab1, gTestImage);
- }).then(imageLoaded, FullZoomHelper.failAndContinue(finish));
-}
-
-function imageLoaded() {
- Task.spawn(function () {
- FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when image was loaded in the background");
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- FullZoomHelper.zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
- }).then(imageZoomSwitch, FullZoomHelper.failAndContinue(finish));
-}
-
-function imageZoomSwitch() {
- Task.spawn(function () {
- yield FullZoomHelper.navigate(BACK);
- yield FullZoomHelper.navigate(FORWARD);
- FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
- FullZoomHelper.zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
- }).then(finishTest, FullZoomHelper.failAndContinue(finish));
-}
-
-var finishTestStarted = false;
-function finishTest() {
- Task.spawn(function () {
- ok(!finishTestStarted, "finishTest called more than once");
- finishTestStarted = true;
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab2);
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab3);
- }).then(finish, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug405137.js b/browser/base/content/test/browser_bug405137.js
deleted file mode 100644
index a28d1c030..000000000
--- a/browser/base/content/test/browser_bug405137.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function test(){
- var tab = gBrowser.addTab();
- ok(tab.getAttribute("closetabtext") != "", "tab has non-empty closetabtext");
- gBrowser.removeTab(tab);
-}
diff --git a/browser/base/content/test/browser_bug406216.js b/browser/base/content/test/browser_bug406216.js
deleted file mode 100644
index db3b1bffa..000000000
--- a/browser/base/content/test/browser_bug406216.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * "TabClose" event is possibly used for closing related tabs of the current.
- * "removeTab" method should work correctly even if the number of tabs are
- * changed while "TabClose" event.
- */
-
-var count = 0;
-const URIS = ["about:config",
- "about:plugins",
- "about:buildconfig",
- "data:text/html,<title>OK</title>"];
-
-function test() {
- waitForExplicitFinish();
- URIS.forEach(addTab);
-}
-
-function addTab(aURI, aIndex) {
- var tab = gBrowser.addTab(aURI);
- if (aIndex == 0)
- gBrowser.removeTab(gBrowser.tabs[0]);
-
- tab.linkedBrowser.addEventListener("load", function (event) {
- event.currentTarget.removeEventListener("load", arguments.callee, true);
- if (++count == URIS.length)
- executeSoon(doTabsTest);
- }, true);
-}
-
-function doTabsTest() {
- is(gBrowser.tabs.length, URIS.length, "Correctly opened all expected tabs");
-
- // sample of "close related tabs" feature
- gBrowser.tabContainer.addEventListener("TabClose", function (event) {
- event.currentTarget.removeEventListener("TabClose", arguments.callee, true);
- var closedTab = event.originalTarget;
- var scheme = closedTab.linkedBrowser.currentURI.scheme;
- Array.slice(gBrowser.tabs).forEach(function (aTab) {
- if (aTab != closedTab && aTab.linkedBrowser.currentURI.scheme == scheme)
- gBrowser.removeTab(aTab);
- });
- }, true);
-
- gBrowser.removeTab(gBrowser.tabs[0]);
- is(gBrowser.tabs.length, 1, "Related tabs are not closed unexpectedly");
-
- gBrowser.addTab("about:blank");
- gBrowser.removeTab(gBrowser.tabs[0]);
- finish();
-}
diff --git a/browser/base/content/test/browser_bug409481.js b/browser/base/content/test/browser_bug409481.js
deleted file mode 100644
index ade9d2099..000000000
--- a/browser/base/content/test/browser_bug409481.js
+++ /dev/null
@@ -1,83 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- // XXX This looks a bit odd, but is needed to avoid throwing when removing the
- // event listeners below. See bug 310955.
- document.getElementById("sidebar").addEventListener("load", delayedOpenUrl, true);
- toggleSidebar("viewWebPanelsSidebar", true);
-}
-
-function delayedOpenUrl() {
- ok(true, "Ran delayedOpenUrl");
- setTimeout(openPanelUrl, 100);
-}
-
-function openPanelUrl(event) {
- ok(!document.getElementById("sidebar-box").hidden, "Sidebar showing");
-
- var sidebar = document.getElementById("sidebar");
- var root = sidebar.contentDocument.documentElement;
- ok(root.nodeName != "parsererror", "Sidebar is well formed");
-
- sidebar.removeEventListener("load", delayedOpenUrl, true);
- // XXX See comment above
- sidebar.contentDocument.addEventListener("load", delayedRunTest, true);
- var url = 'data:text/html,<div%20id="test_bug409481">Content!</div><a id="link" href="http://www.example.com/ctest">Link</a><input id="textbox">';
- sidebar.contentWindow.loadWebPanel(url);
-}
-
-function delayedRunTest() {
- ok(true, "Ran delayedRunTest");
- setTimeout(runTest, 100);
-}
-
-function runTest(event) {
- var sidebar = document.getElementById("sidebar");
- sidebar.contentDocument.removeEventListener("load", delayedRunTest, true);
-
- var browser = sidebar.contentDocument.getElementById("web-panels-browser");
- var div = browser && browser.contentDocument.getElementById("test_bug409481");
- ok(div && div.textContent == "Content!", "Sidebar content loaded");
-
- var link = browser && browser.contentDocument.getElementById("link");
- sidebar.contentDocument.addEventListener("popupshown", contextMenuOpened, false);
-
- EventUtils.synthesizeMouseAtCenter(link, { type: "contextmenu", button: 2 }, browser.contentWindow);
-}
-
-function contextMenuOpened()
-{
- var sidebar = document.getElementById("sidebar");
- sidebar.contentDocument.removeEventListener("popupshown", contextMenuOpened, false);
-
- var copyLinkCommand = sidebar.contentDocument.getElementById("context-copylink");
- copyLinkCommand.addEventListener("command", copyLinkCommandExecuted, false);
- copyLinkCommand.doCommand();
-}
-
-function copyLinkCommandExecuted(event)
-{
- event.target.removeEventListener("command", copyLinkCommandExecuted, false);
-
- var sidebar = document.getElementById("sidebar");
- var browser = sidebar.contentDocument.getElementById("web-panels-browser");
- var textbox = browser && browser.contentDocument.getElementById("textbox");
- textbox.focus();
- document.commandDispatcher.getControllerForCommand("cmd_paste").doCommand("cmd_paste");
- is(textbox.value, "http://www.example.com/ctest", "copy link command");
-
- sidebar.contentDocument.addEventListener("popuphidden", contextMenuClosed, false);
- event.target.parentNode.hidePopup();
-}
-
-function contextMenuClosed()
-{
- var sidebar = document.getElementById("sidebar");
- sidebar.contentDocument.removeEventListener("popuphidden", contextMenuClosed, false);
-
- toggleSidebar("viewWebPanelsSidebar");
-
- ok(document.getElementById("sidebar-box").hidden, "Sidebar successfully hidden");
-
- finish();
-}
diff --git a/browser/base/content/test/browser_bug409624.js b/browser/base/content/test/browser_bug409624.js
deleted file mode 100644
index 2ea177794..000000000
--- a/browser/base/content/test/browser_bug409624.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
- "resource://gre/modules/FormHistory.jsm");
-
-function test() {
- waitForExplicitFinish();
-
- // This test relies on the form history being empty to start with delete
- // all the items first.
- FormHistory.update({ op: "remove" },
- { handleError: function (error) {
- do_throw("Error occurred updating form history: " + error);
- },
- handleCompletion: function (reason) { if (!reason) test2(); },
- });
-}
-
-function test2()
-{
- let prefService = Cc["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch2);
-
- let findBar = gFindBar;
- let textbox = gFindBar.getElement("findbar-textbox");
-
- let tempScope = {};
- Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
- let Sanitizer = tempScope.Sanitizer;
- let s = new Sanitizer();
- s.prefDomain = "privacy.cpd.";
- let prefBranch = prefService.getBranch(s.prefDomain);
-
- prefBranch.setBoolPref("cache", false);
- prefBranch.setBoolPref("cookies", false);
- prefBranch.setBoolPref("downloads", false);
- prefBranch.setBoolPref("formdata", true);
- prefBranch.setBoolPref("history", false);
- prefBranch.setBoolPref("offlineApps", false);
- prefBranch.setBoolPref("passwords", false);
- prefBranch.setBoolPref("sessions", false);
- prefBranch.setBoolPref("siteSettings", false);
-
- // Sanitize now so we can test that canClear is correct. Formdata is cleared asynchronously.
- s.sanitize().then(function() {
- s.canClearItem("formdata", clearDone1, s);
- });
-}
-
-function clearDone1(aItemName, aResult, aSanitizer)
-{
- ok(!aResult, "pre-test baseline for sanitizer");
- gFindBar.getElement("findbar-textbox").value = "m";
- aSanitizer.canClearItem("formdata", inputEntered, aSanitizer);
-}
-
-function inputEntered(aItemName, aResult, aSanitizer)
-{
- ok(aResult, "formdata can be cleared after input");
- aSanitizer.sanitize().then(function() {
- aSanitizer.canClearItem("formdata", clearDone2);
- });
-}
-
-function clearDone2(aItemName, aResult)
-{
- is(gFindBar.getElement("findbar-textbox").value, "", "findBar textbox should be empty after sanitize");
- ok(!aResult, "canClear now false after sanitize");
- finish();
-}
diff --git a/browser/base/content/test/browser_bug413915.js b/browser/base/content/test/browser_bug413915.js
deleted file mode 100644
index 1f22043b9..000000000
--- a/browser/base/content/test/browser_bug413915.js
+++ /dev/null
@@ -1,59 +0,0 @@
-function test() {
- var exampleUri = makeURI("http://example.com/");
- var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
- var principal = secman.getSimpleCodebasePrincipal(exampleUri);
-
- function testIsFeed(aTitle, aHref, aType, aKnown) {
- var link = { title: aTitle, href: aHref, type: aType };
- return isValidFeed(link, principal, aKnown);
- }
-
- var href = "http://example.com/feed/";
- var atomType = "application/atom+xml";
- var funkyAtomType = " aPPLICAtion/Atom+XML ";
- var rssType = "application/rss+xml";
- var funkyRssType = " Application/RSS+XML ";
- var rdfType = "application/rdf+xml";
- var texmlType = "text/xml";
- var appxmlType = "application/xml";
- var noRss = "Foo";
- var rss = "RSS";
-
- // things that should be valid
- ok(testIsFeed(noRss, href, atomType, false) == atomType,
- "detect Atom feed");
- ok(testIsFeed(noRss, href, funkyAtomType, false) == atomType,
- "clean up and detect Atom feed");
- ok(testIsFeed(noRss, href, rssType, false) == rssType,
- "detect RSS feed");
- ok(testIsFeed(noRss, href, funkyRssType, false) == rssType,
- "clean up and detect RSS feed");
-
- // things that should not be feeds
- ok(testIsFeed(noRss, href, rdfType, false) == null,
- "should not detect RDF non-feed");
- ok(testIsFeed(rss, href, rdfType, false) == null,
- "should not detect RDF feed from type and title");
- ok(testIsFeed(noRss, href, texmlType, false) == null,
- "should not detect text/xml non-feed");
- ok(testIsFeed(rss, href, texmlType, false) == null,
- "should not detect text/xml feed from type and title");
- ok(testIsFeed(noRss, href, appxmlType, false) == null,
- "should not detect application/xml non-feed");
- ok(testIsFeed(rss, href, appxmlType, false) == null,
- "should not detect application/xml feed from type and title");
-
- // security check only, returns cleaned up type or "application/rss+xml"
- ok(testIsFeed(noRss, href, atomType, true) == atomType,
- "feed security check should return Atom type");
- ok(testIsFeed(noRss, href, funkyAtomType, true) == atomType,
- "feed security check should return cleaned up Atom type");
- ok(testIsFeed(noRss, href, rssType, true) == rssType,
- "feed security check should return RSS type");
- ok(testIsFeed(noRss, href, funkyRssType, true) == rssType,
- "feed security check should return cleaned up RSS type");
- ok(testIsFeed(noRss, href, "", true) == rssType,
- "feed security check without type should return RSS type");
- ok(testIsFeed(noRss, href, "garbage", true) == "garbage",
- "feed security check with garbage type should return garbage");
-}
diff --git a/browser/base/content/test/browser_bug416661.js b/browser/base/content/test/browser_bug416661.js
deleted file mode 100644
index 0324ce0f3..000000000
--- a/browser/base/content/test/browser_bug416661.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var tabElm, zoomLevel;
-function start_test_prefNotSet() {
- Task.spawn(function () {
- is(ZoomManager.zoom, 1, "initial zoom level should be 1");
- FullZoom.enlarge();
-
- //capture the zoom level to test later
- zoomLevel = ZoomManager.zoom;
- isnot(zoomLevel, 1, "zoom level should have changed");
-
- yield FullZoomHelper.load(gBrowser.selectedTab, "http://mochi.test:8888/browser/browser/base/content/test/moz.png");
- }).then(continue_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
-}
-
-function continue_test_prefNotSet () {
- Task.spawn(function () {
- is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
- FullZoom.reset();
-
- yield FullZoomHelper.load(gBrowser.selectedTab, "http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html");
- }).then(end_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
-}
-
-function end_test_prefNotSet() {
- Task.spawn(function () {
- is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
-
- // Reset the zoom so that other tests have a fresh zoom level
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange();
- finish();
- });
-}
-
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function () {
- tabElm = gBrowser.addTab();
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
- yield FullZoomHelper.load(tabElm, "http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html");
- }).then(start_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug417483.js b/browser/base/content/test/browser_bug417483.js
deleted file mode 100644
index ab6d73ae5..000000000
--- a/browser/base/content/test/browser_bug417483.js
+++ /dev/null
@@ -1,26 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var htmlContent = "data:text/html, <iframe src='data:text/html,text text'></iframe>";
- gBrowser.addEventListener("pageshow", onPageShow, false);
- gBrowser.loadURI(htmlContent);
-}
-
-function onPageShow() {
- gBrowser.removeEventListener("pageshow", onPageShow, false);
- var frame = content.frames[0];
- var sel = frame.getSelection();
- var range = frame.document.createRange();
- var tn = frame.document.body.childNodes[0];
- range.setStart(tn , 4);
- range.setEnd(tn , 5);
- sel.addRange(range);
- frame.focus();
-
- document.popupNode = frame.document.body;
- var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- var contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- ok(document.getElementById("frame-sep").hidden, "'frame-sep' should be hidden if the selection contains only spaces");
- finish();
-}
diff --git a/browser/base/content/test/browser_bug419612.js b/browser/base/content/test/browser_bug419612.js
deleted file mode 100644
index 1dee59ece..000000000
--- a/browser/base/content/test/browser_bug419612.js
+++ /dev/null
@@ -1,32 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function () {
- let testPage = "http://example.org/browser/browser/base/content/test/dummy_page.html";
- let tab1 = gBrowser.addTab();
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
- yield FullZoomHelper.load(tab1, testPage);
-
- let tab2 = gBrowser.addTab();
- yield FullZoomHelper.load(tab2, testPage);
-
- FullZoom.enlarge();
- let tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab2);
- let tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
- is(tab2Zoom, tab1Zoom, "Zoom should affect background tabs");
-
- gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", false);
- FullZoom.reset();
- gBrowser.selectedTab = tab1;
- tab1Zoom = ZoomManager.getZoomForBrowser(tab1.linkedBrowser);
- tab2Zoom = ZoomManager.getZoomForBrowser(tab2.linkedBrowser);
- isnot(tab1Zoom, tab2Zoom, "Zoom should not affect background tabs");
-
- if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
- gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
- yield FullZoomHelper.removeTabAndWaitForLocationChange(tab1);
- yield FullZoomHelper.removeTabAndWaitForLocationChange(tab2);
- }).then(finish, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug422590.js b/browser/base/content/test/browser_bug422590.js
deleted file mode 100644
index 2ecb4c0b9..000000000
--- a/browser/base/content/test/browser_bug422590.js
+++ /dev/null
@@ -1,50 +0,0 @@
-function test() {
- waitForExplicitFinish();
- // test the main (normal) browser window
- testCustomize(window, testChromeless);
-}
-
-function testChromeless() {
- // test a chromeless window
- var newWin = openDialog(getBrowserURL(), "_blank",
- "chrome,dialog=no,toolbar=no", "about:blank");
- ok(newWin, "got new window");
-
- whenDelayedStartupFinished(newWin, function () {
- // Check that the search bar is hidden
- var searchBar = newWin.BrowserSearch.searchBar;
- ok(searchBar, "got search bar");
-
- var searchBarBO = searchBar.boxObject;
- is(searchBarBO.width, 0, "search bar hidden");
- is(searchBarBO.height, 0, "search bar hidden");
-
- testCustomize(newWin, function () {
- newWin.close();
- finish();
- });
- });
-}
-
-function testCustomize(aWindow, aCallback) {
- var fileMenu = aWindow.document.getElementById("file-menu");
- ok(fileMenu, "got file menu");
- is(fileMenu.disabled, false, "file menu initially enabled");
-
- openToolbarCustomizationUI(function () {
- // Can't use the property, since the binding may have since been removed
- // if the element is hidden (see bug 422590)
- is(fileMenu.getAttribute("disabled"), "true",
- "file menu is disabled during toolbar customization");
-
- closeToolbarCustomizationUI(onClose, aWindow);
- }, aWindow);
-
- function onClose() {
- is(fileMenu.getAttribute("disabled"), "false",
- "file menu is enabled after toolbar customization");
-
- if (aCallback)
- aCallback();
- }
-}
diff --git a/browser/base/content/test/browser_bug423833.js b/browser/base/content/test/browser_bug423833.js
deleted file mode 100644
index d4069338b..000000000
--- a/browser/base/content/test/browser_bug423833.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Tests for proper behaviour of "Show this frame" context menu options */
-
-// Two frames, one with text content, the other an error page
-var invalidPage = 'http://127.0.0.1:55555/';
-var validPage = 'http://example.com/';
-var testPage = 'data:text/html,<frameset cols="400,400"><frame src="' + validPage + '"><frame src="' + invalidPage + '"></frameset>';
-
-// Store the tab and window created in tests 2 and 3 respectively
-var test2tab;
-var test3window;
-
-// We use setInterval instead of setTimeout to avoid race conditions on error doc loads
-var intervalID;
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", test1Setup, true);
- content.location = testPage;
-}
-
-function test1Setup() {
- if (content.frames.length < 2 ||
- content.frames[1].location != invalidPage)
- // The error frame hasn't loaded yet
- return;
-
- gBrowser.selectedBrowser.removeEventListener("load", test1Setup, true);
-
- var badFrame = content.frames[1];
- document.popupNode = badFrame.document.firstChild;
-
- var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- var contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- // We'd like to use another load listener here, but error pages don't fire load events
- contextMenu.showOnlyThisFrame();
- intervalID = setInterval(testShowOnlyThisFrame, 3000);
-}
-
-function testShowOnlyThisFrame() {
- if (content.location.href == testPage)
- // This is a stale event from the original page loading
- return;
-
- // We should now have loaded the error page frame content directly
- // in the tab, make sure the URL is right.
- clearInterval(intervalID);
-
- is(content.location.href, invalidPage, "Should navigate to page url, not about:neterror");
-
- // Go back to the frames page
- gBrowser.addEventListener("load", test2Setup, true);
- content.location = testPage;
-}
-
-function test2Setup() {
- if (content.frames.length < 2 ||
- content.frames[1].location != invalidPage)
- // The error frame hasn't loaded yet
- return;
-
- gBrowser.removeEventListener("load", test2Setup, true);
-
- // Now let's do the whole thing again, but this time for "Open frame in new tab"
- var badFrame = content.frames[1];
-
- document.popupNode = badFrame.document.firstChild;
-
- var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- var contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- gBrowser.tabContainer.addEventListener("TabOpen", function (event) {
- test2tab = event.target;
- gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee, false);
- }, false);
- contextMenu.openFrameInTab();
- ok(test2tab, "openFrameInTab() opened a tab");
-
- gBrowser.selectedTab = test2tab;
-
- intervalID = setInterval(testOpenFrameInTab, 3000);
-}
-
-function testOpenFrameInTab() {
- if (gBrowser.contentDocument.location.href == "about:blank")
- // Wait another cycle
- return;
-
- clearInterval(intervalID);
-
- // We should now have the error page in a new, active tab.
- is(gBrowser.contentDocument.location.href, invalidPage, "New tab should have page url, not about:neterror");
-
- // Clear up the new tab, and punt to test 3
- gBrowser.removeCurrentTab();
-
- test3Setup();
-}
-
-function test3Setup() {
- // One more time, for "Open frame in new window"
- var badFrame = content.frames[1];
- document.popupNode = badFrame.document.firstChild;
-
- var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- var contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- Services.ww.registerNotification(function (aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened")
- test3window = aSubject;
- Services.ww.unregisterNotification(arguments.callee);
- });
-
- contextMenu.openFrame();
-
- intervalID = setInterval(testOpenFrame, 3000);
-}
-
-function testOpenFrame() {
- if (!test3window || test3window.content.location.href == "about:blank") {
- info("testOpenFrame: Wait another cycle");
- return;
- }
-
- clearInterval(intervalID);
-
- is(test3window.content.location.href, invalidPage, "New window should have page url, not about:neterror");
-
- test3window.close();
- cleanup();
-}
-
-function cleanup() {
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/base/content/test/browser_bug424101.js b/browser/base/content/test/browser_bug424101.js
deleted file mode 100644
index 7c9599e69..000000000
--- a/browser/base/content/test/browser_bug424101.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Make sure that the context menu appears on form elements */
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- let doc = gBrowser.contentDocument;
- let testInput = function(type, expected) {
- let element = doc.createElement("input");
- element.setAttribute("type", type);
- doc.body.appendChild(element);
- document.popupNode = element;
-
- let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- let contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- is(contextMenu.shouldDisplay, expected, "context menu behavior for <input type=" + type + "> is wrong");
- };
- let testElement = function(tag, expected) {
- let element = doc.createElement(tag);
- doc.body.appendChild(element);
- document.popupNode = element;
-
- let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- let contextMenu = new nsContextMenu(contentAreaContextMenu);
-
- is(contextMenu.shouldDisplay, expected, "context menu behavior for <" + tag + "> is wrong");
- };
-
- testInput("text", true);
- testInput("password", true);
- testInput("image", true);
- testInput("button", true);
- testInput("submit", true);
- testInput("reset", true);
- testInput("checkbox", true);
- testInput("radio", true);
- testElement("button", true);
- testElement("select", true);
- testElement("option", true);
- testElement("optgroup", true);
-
- // cleanup
- document.popupNode = null;
- gBrowser.removeCurrentTab();
- finish();
- }, true);
- content.location = "data:text/html,test";
-}
diff --git a/browser/base/content/test/browser_bug427559.js b/browser/base/content/test/browser_bug427559.js
deleted file mode 100644
index 50993f9b9..000000000
--- a/browser/base/content/test/browser_bug427559.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Test bug 427559 to make sure focused elements that are no longer on the page
- * will have focus transferred to the window when changing tabs back to that
- * tab with the now-gone element.
- */
-
-// Default focus on a button and have it kill itself on blur
-let testPage = 'data:text/html,<body><button onblur="this.parentNode.removeChild(this);"><script>document.body.firstChild.focus();</script></body>';
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- setTimeout(function () {
- var testPageWin = content;
-
- // The test page loaded, so open an empty tab, select it, then restore
- // the test tab. This causes the test page's focused element to be removed
- // from its document.
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.removeCurrentTab();
-
- // Make sure focus is given to the window because the element is now gone
- is(document.commandDispatcher.focusedWindow, testPageWin,
- "content window is focused");
-
- gBrowser.removeCurrentTab();
- finish();
- }, 0);
- }, true);
-
- content.location = testPage;
-}
diff --git a/browser/base/content/test/browser_bug432599.js b/browser/base/content/test/browser_bug432599.js
deleted file mode 100644
index d23df4bbe..000000000
--- a/browser/base/content/test/browser_bug432599.js
+++ /dev/null
@@ -1,127 +0,0 @@
-function invokeUsingCtrlD(phase) {
- switch (phase) {
- case 1:
- EventUtils.synthesizeKey("d", { accelKey: true });
- break;
- case 2:
- case 4:
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- break;
- case 3:
- EventUtils.synthesizeKey("d", { accelKey: true });
- EventUtils.synthesizeKey("d", { accelKey: true });
- break;
- }
-}
-
-function invokeUsingStarButton(phase) {
- switch (phase) {
- case 1:
- EventUtils.synthesizeMouseAtCenter(BookmarkingUI.star, {});
- break;
- case 2:
- case 4:
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- break;
- case 3:
- EventUtils.synthesizeMouseAtCenter(BookmarkingUI.star,
- { clickCount: 2 });
- break;
- }
-}
-
-var testURL = "data:text/plain,Content";
-var bookmarkId;
-
-function add_bookmark(aURI, aTitle) {
- return PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- aURI, PlacesUtils.bookmarks.DEFAULT_INDEX,
- aTitle);
-}
-
-// test bug 432599
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- waitForStarChange(false, initTest);
- }, true);
-
- content.location = testURL;
-}
-
-function initTest() {
- // First, bookmark the page.
- bookmarkId = add_bookmark(makeURI(testURL), "Bug 432599 Test");
-
- checkBookmarksPanel(invokers[currentInvoker], 1);
-}
-
-function waitForStarChange(aValue, aCallback) {
- let expectedStatus = aValue ? BookmarkingUI.STATUS_STARRED
- : BookmarkingUI.STATUS_UNSTARRED;
- if (BookmarkingUI.status == BookmarkingUI.STATUS_UPDATING ||
- BookmarkingUI.status != expectedStatus) {
- info("Waiting for star button change.");
- setTimeout(waitForStarChange, 50, aValue, aCallback);
- return;
- }
- aCallback();
-}
-
-let invokers = [invokeUsingStarButton, invokeUsingCtrlD];
-let currentInvoker = 0;
-
-let initialValue;
-let initialRemoveHidden;
-
-let popupElement = document.getElementById("editBookmarkPanel");
-let titleElement = document.getElementById("editBookmarkPanelTitle");
-let removeElement = document.getElementById("editBookmarkPanelRemoveButton");
-
-function checkBookmarksPanel(invoker, phase)
-{
- let onPopupShown = function(aEvent) {
- if (aEvent.originalTarget == popupElement) {
- popupElement.removeEventListener("popupshown", arguments.callee, false);
- checkBookmarksPanel(invoker, phase + 1);
- }
- };
- let onPopupHidden = function(aEvent) {
- if (aEvent.originalTarget == popupElement) {
- popupElement.removeEventListener("popuphidden", arguments.callee, false);
- if (phase < 4) {
- checkBookmarksPanel(invoker, phase + 1);
- } else {
- ++currentInvoker;
- if (currentInvoker < invokers.length) {
- checkBookmarksPanel(invokers[currentInvoker], 1);
- } else {
- gBrowser.removeCurrentTab();
- PlacesUtils.bookmarks.removeItem(bookmarkId);
- executeSoon(finish);
- }
- }
- }
- };
-
- switch (phase) {
- case 1:
- case 3:
- popupElement.addEventListener("popupshown", onPopupShown, false);
- break;
- case 2:
- popupElement.addEventListener("popuphidden", onPopupHidden, false);
- initialValue = titleElement.value;
- initialRemoveHidden = removeElement.hidden;
- break;
- case 4:
- popupElement.addEventListener("popuphidden", onPopupHidden, false);
- is(titleElement.value, initialValue, "The bookmark panel's title should be the same");
- is(removeElement.hidden, initialRemoveHidden, "The bookmark panel's visibility should not change");
- break;
- }
- invoker(phase);
-}
diff --git a/browser/base/content/test/browser_bug435035.js b/browser/base/content/test/browser_bug435035.js
deleted file mode 100644
index ae865ef12..000000000
--- a/browser/base/content/test/browser_bug435035.js
+++ /dev/null
@@ -1,16 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- is(document.getElementById("identity-box").className,
- gIdentityHandler.IDENTITY_MODE_MIXED_CONTENT,
- "identity box has class name for mixed content");
-
- gBrowser.removeCurrentTab();
- finish();
- }, true);
-
- content.location = "https://example.com/browser/browser/base/content/test/test_bug435035.html";
-}
diff --git a/browser/base/content/test/browser_bug435325.js b/browser/base/content/test/browser_bug435325.js
deleted file mode 100644
index fe05c757a..000000000
--- a/browser/base/content/test/browser_bug435325.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* Ensure that clicking the button in the Offline mode neterror page makes the browser go online. See bug 435325. */
-
-let proxyPrefValue;
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- // Go offline and disable the proxy and cache, then try to load the test URL.
- Services.io.offline = true;
-
- // Tests always connect to localhost, and per bug 87717, localhost is now
- // reachable in offline mode. To avoid this, disable any proxy.
- proxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
- Services.prefs.setIntPref("network.proxy.type", 0);
-
- Services.prefs.setBoolPref("browser.cache.disk.enable", false);
- Services.prefs.setBoolPref("browser.cache.memory.enable", false);
- content.location = "http://example.com/";
-
- window.addEventListener("DOMContentLoaded", function load() {
- if (content.location == "about:blank") {
- info("got about:blank, which is expected once, so return");
- return;
- }
- window.removeEventListener("DOMContentLoaded", load, false);
-
- let observer = new MutationObserver(function (mutations) {
- for (let mutation of mutations) {
- if (mutation.attributeName == "hasBrowserHandlers") {
- observer.disconnect();
- checkPage();
- return;
- }
- }
- });
- let docElt = tab.linkedBrowser.contentDocument.documentElement;
- observer.observe(docElt, { attributes: true });
- }, false);
-}
-
-function checkPage() {
- ok(Services.io.offline, "Setting Services.io.offline to true.");
- is(gBrowser.contentDocument.documentURI.substring(0,27),
- "about:neterror?e=netOffline", "Loading the Offline mode neterror page.");
-
- // Now press the "Try Again" button
- ok(gBrowser.contentDocument.getElementById("errorTryAgain"),
- "The error page has got a #errorTryAgain element");
-
- // Re-enable the proxy so example.com is resolved to localhost, rather than
- // the actual example.com.
- Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
-
- gBrowser.contentDocument.getElementById("errorTryAgain").click();
-
- ok(!Services.io.offline, "After clicking the Try Again button, we're back " +
- "online.");
-
- finish();
-}
-
-registerCleanupFunction(function() {
- Services.prefs.setBoolPref("browser.cache.disk.enable", true);
- Services.prefs.setBoolPref("browser.cache.memory.enable", true);
- Services.io.offline = false;
- gBrowser.removeCurrentTab();
-});
diff --git a/browser/base/content/test/browser_bug441778.js b/browser/base/content/test/browser_bug441778.js
deleted file mode 100644
index ef68018a0..000000000
--- a/browser/base/content/test/browser_bug441778.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Test the fix for bug 441778 to ensure site-specific page zoom doesn't get
- * modified by sub-document loads of content from a different domain.
- */
-
-function test() {
- waitForExplicitFinish();
-
- const TEST_PAGE_URL = 'data:text/html,<body><iframe src=""></iframe></body>';
- const TEST_IFRAME_URL = "http://test2.example.org/";
-
- Task.spawn(function () {
- // Prepare the test tab
- let tab = gBrowser.addTab();
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);
-
- let testBrowser = tab.linkedBrowser;
-
- yield FullZoomHelper.load(tab, TEST_PAGE_URL);
-
- // Change the zoom level and then save it so we can compare it to the level
- // after loading the sub-document.
- FullZoom.enlarge();
- var zoomLevel = ZoomManager.zoom;
-
- // Start the sub-document load.
- let deferred = Promise.defer();
- executeSoon(function () {
- testBrowser.addEventListener("load", function (e) {
- testBrowser.removeEventListener("load", arguments.callee, true);
-
- is(e.target.defaultView.location, TEST_IFRAME_URL, "got the load event for the iframe");
- is(ZoomManager.zoom, zoomLevel, "zoom is retained after sub-document load");
-
- FullZoomHelper.removeTabAndWaitForLocationChange().
- then(() => deferred.resolve());
- }, true);
- content.document.querySelector("iframe").src = TEST_IFRAME_URL;
- });
- yield deferred.promise;
- }).then(finish, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug455852.js b/browser/base/content/test/browser_bug455852.js
deleted file mode 100644
index 52798f102..000000000
--- a/browser/base/content/test/browser_bug455852.js
+++ /dev/null
@@ -1,16 +0,0 @@
-function test() {
- is(gBrowser.tabs.length, 1, "one tab is open");
-
- gBrowser.selectedBrowser.focus();
- isnot(document.activeElement, gURLBar.inputField, "location bar is not focused");
-
- var tab = gBrowser.selectedTab;
- gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
- EventUtils.synthesizeKey("w", { accelKey: true });
- is(tab.parentNode, null, "ctrl+w removes the tab");
- is(gBrowser.tabs.length, 1, "a new tab has been opened");
- is(document.activeElement, gURLBar.inputField, "location bar is focused for the new tab");
-
- if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
- gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
-}
diff --git a/browser/base/content/test/browser_bug460146.js b/browser/base/content/test/browser_bug460146.js
deleted file mode 100644
index 3ddaae97e..000000000
--- a/browser/base/content/test/browser_bug460146.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Check proper image url retrieval from all kinds of elements/styles */
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- var doc = gBrowser.contentDocument;
- var pageInfo = BrowserPageInfo(doc, "mediaTab");
-
- pageInfo.addEventListener("load", function () {
- pageInfo.removeEventListener("load", arguments.callee, true);
- pageInfo.onFinished.push(function () {
- executeSoon(function () {
- var imageTree = pageInfo.document.getElementById("imagetree");
- var imageRowsNum = imageTree.view.rowCount;
-
- ok(imageTree, "Image tree is null (media tab is broken)");
-
- ok(imageRowsNum == 7, "Number of images listed: " +
- imageRowsNum + ", should be 7");
-
- pageInfo.close();
- gBrowser.removeCurrentTab();
- finish();
- });
- });
- }, true);
- }, true);
-
- content.location =
- "data:text/html," +
- "<html>" +
- " <head>" +
- " <title>Test for media tab</title>" +
- " <link rel='shortcut icon' href='file:///dummy_icon.ico'>" + // Icon
- " </head>" +
- " <body style='background-image:url(about:logo?a);'>" + // Background
- " <img src='file:///dummy_image.gif'>" + // Image
- " <ul>" +
- " <li style='list-style:url(about:logo?b);'>List Item 1</li>" + // Bullet
- " </ul> " +
- " <div style='-moz-border-image: url(about:logo?c) 20 20 20 20;'>test</div>" + // Border
- " <a href='' style='cursor: url(about:logo?d),default;'>test link</a>" + // Cursor
- " <object type='image/svg+xml' width=20 height=20 data='file:///dummy_object.svg'></object>" + // Object
- " </body>" +
- "</html>";
-}
diff --git a/browser/base/content/test/browser_bug462289.js b/browser/base/content/test/browser_bug462289.js
deleted file mode 100644
index fcde120ff..000000000
--- a/browser/base/content/test/browser_bug462289.js
+++ /dev/null
@@ -1,85 +0,0 @@
-var tab1, tab2;
-
-function focus_in_navbar()
-{
- var parent = document.activeElement.parentNode;
- while (parent && parent.id != "nav-bar")
- parent = parent.parentNode;
-
- return parent != null;
-}
-
-function test()
-{
- waitForExplicitFinish();
-
- tab1 = gBrowser.addTab("about:blank", {skipAnimation: true});
- tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
-
- EventUtils.synthesizeMouseAtCenter(tab1, {});
- setTimeout(step2, 0);
-}
-
-function step2()
-{
- is(gBrowser.selectedTab, tab1, "1st click on tab1 selects tab");
- isnot(document.activeElement, tab1, "1st click on tab1 does not activate tab");
-
- EventUtils.synthesizeMouseAtCenter(tab1, {});
- setTimeout(step3, 0);
-}
-
-function step3()
-{
- is(gBrowser.selectedTab, tab1, "2nd click on selected tab1 keeps tab selected");
- isnot(document.activeElement, tab1, "2nd click on selected tab1 does not activate tab");
-
- if (gNavToolbox.getAttribute("tabsontop") == "true") {
- ok(true, "[tabsontop=true] focusing URLBar then sending 1 Shift+Tab.");
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
- } else {
- ok(true, "[tabsontop=false] focusing SearchBar then sending Tab(s) until out of nav-bar.");
- document.getElementById("searchbar").focus();
- while (focus_in_navbar())
- EventUtils.synthesizeKey("VK_TAB", { });
- }
- is(gBrowser.selectedTab, tab1, "tab key to selected tab1 keeps tab selected");
- is(document.activeElement, tab1, "tab key to selected tab1 activates tab");
-
- EventUtils.synthesizeMouseAtCenter(tab1, {});
- setTimeout(step4, 0);
-}
-
-function step4()
-{
- is(gBrowser.selectedTab, tab1, "3rd click on activated tab1 keeps tab selected");
- is(document.activeElement, tab1, "3rd click on activated tab1 keeps tab activated");
-
- EventUtils.synthesizeMouseAtCenter(tab2, {});
- setTimeout(step5, 0);
-}
-
-function step5()
-{
- // The tabbox selects a tab within a setTimeout in a bubbling mousedown event
- // listener, and focuses the current tab if another tab previously had focus.
- is(gBrowser.selectedTab, tab2, "click on tab2 while tab1 is activated selects tab");
- is(document.activeElement, tab2, "click on tab2 while tab1 is activated activates tab");
-
- ok(true, "focusing content then sending middle-button mousedown to tab2.");
- gBrowser.selectedBrowser.focus();
- EventUtils.synthesizeMouseAtCenter(tab2, {button: 1, type: "mousedown"});
- setTimeout(step6, 0);
-}
-
-function step6()
-{
- is(gBrowser.selectedTab, tab2, "middle-button mousedown on selected tab2 keeps tab selected");
- isnot(document.activeElement, tab2, "middle-button mousedown on selected tab2 does not activate tab");
-
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab1);
-
- finish();
-}
diff --git a/browser/base/content/test/browser_bug462673.js b/browser/base/content/test/browser_bug462673.js
deleted file mode 100644
index 83bec6f6f..000000000
--- a/browser/base/content/test/browser_bug462673.js
+++ /dev/null
@@ -1,53 +0,0 @@
-var runs = [
- function (win, tabbrowser, tab) {
- is(tabbrowser.browsers.length, 2, "test_bug462673.html has opened a second tab");
- is(tabbrowser.selectedTab, tab.nextSibling, "dependent tab is selected");
- tabbrowser.removeTab(tab);
- ok(win.closed, "Window is closed");
- },
- function (win, tabbrowser, tab) {
- var newTab = tabbrowser.addTab();
- var newBrowser = newTab.linkedBrowser;
- tabbrowser.removeTab(tab);
- ok(!win.closed, "Window stays open");
- if (!win.closed) {
- is(tabbrowser.tabContainer.childElementCount, 1, "Window has one tab");
- is(tabbrowser.browsers.length, 1, "Window has one browser");
- is(tabbrowser.selectedTab, newTab, "Remaining tab is selected");
- is(tabbrowser.selectedBrowser, newBrowser, "Browser for remaining tab is selected");
- is(tabbrowser.mTabBox.selectedPanel, newBrowser.parentNode.parentNode.parentNode.parentNode, "Panel for remaining tab is selected");
- }
- }
-];
-
-function test() {
- waitForExplicitFinish();
- runOneTest();
-}
-
-function runOneTest() {
- var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
-
- win.addEventListener("load", function () {
- win.removeEventListener("load", arguments.callee, false);
-
- var tab = win.gBrowser.tabContainer.firstChild;
- var browser = tab.linkedBrowser;
-
- browser.addEventListener("load", function () {
- browser.removeEventListener("load", arguments.callee, true);
-
- executeSoon(function () {
- runs.shift()(win, win.gBrowser, tab);
- win.close();
- if (runs.length)
- runOneTest();
- else
- finish();
- });
- }, true);
-
- var rootDir = getRootDirectory(gTestPath);
- browser.contentWindow.location = rootDir + "test_bug462673.html"
- }, false);
-}
diff --git a/browser/base/content/test/browser_bug477014.js b/browser/base/content/test/browser_bug477014.js
deleted file mode 100644
index 77770e199..000000000
--- a/browser/base/content/test/browser_bug477014.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// That's a gecko!
-const iconURLSpec = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
-var testPage="data:text/plain,test bug 477014";
-
-function test() {
- waitForExplicitFinish();
-
- var newWindow;
- var tabToDetach;
- var documentToDetach;
-
- function onPageShow(event) {
- // we get here if the test is executed before the pageshow
- // event for the window's first tab
- if (!tabToDetach || documentToDetach != event.target)
- return;
-
- event.currentTarget.removeEventListener("pageshow", onPageShow, false);
-
- if (!newWindow) {
- // prepare the tab (set icon and busy state)
- // we have to set these only after onState* notification, otherwise
- // they're overriden
- setTimeout(function() {
- gBrowser.setIcon(tabToDetach, iconURLSpec);
- tabToDetach.setAttribute("busy", "true");
-
- // detach and set the listener on the new window
- newWindow = gBrowser.replaceTabWithWindow(tabToDetach);
- // wait for gBrowser to come along
- newWindow.addEventListener("load", function () {
- newWindow.removeEventListener("load", arguments.callee, false);
- newWindow.gBrowser.addEventListener("pageshow", onPageShow, false);
- }, false);
- }, 0);
- return;
- }
-
- is(newWindow.gBrowser.selectedTab.hasAttribute("busy"), true);
- is(newWindow.gBrowser.getIcon(), iconURLSpec);
- newWindow.close();
- finish();
- }
-
- tabToDetach = gBrowser.addTab(testPage);
- tabToDetach.linkedBrowser.addEventListener("load", function onLoad() {
- tabToDetach.linkedBrowser.removeEventListener("load", onLoad, true);
- documentToDetach = tabToDetach.linkedBrowser.contentDocument;
- gBrowser.addEventListener("pageshow", onPageShow, false);
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug479408.js b/browser/base/content/test/browser_bug479408.js
deleted file mode 100644
index 0a14e2259..000000000
--- a/browser/base/content/test/browser_bug479408.js
+++ /dev/null
@@ -1,17 +0,0 @@
-function test() {
- waitForExplicitFinish();
- let tab = gBrowser.selectedTab = gBrowser.addTab(
- "http://mochi.test:8888/browser/browser/base/content/test/browser_bug479408_sample.html");
-
- gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
- gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
-
- executeSoon(function() {
- ok(!tab.linkedBrowser.engines,
- "the subframe's search engine wasn't detected");
-
- gBrowser.removeTab(tab);
- finish();
- });
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug479408_sample.html b/browser/base/content/test/browser_bug479408_sample.html
deleted file mode 100644
index f83f02bb9..000000000
--- a/browser/base/content/test/browser_bug479408_sample.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<!DOCTYPE html>
-<title>Testcase for bug 479408</title>
-
-<iframe src='data:text/html,<link%20rel="search"%20type="application/opensearchdescription+xml"%20title="Search%20bug%20479408"%20href="http://example.com/search.xml">'>
diff --git a/browser/base/content/test/browser_bug481560.js b/browser/base/content/test/browser_bug481560.js
deleted file mode 100644
index e3d281b1b..000000000
--- a/browser/base/content/test/browser_bug481560.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
-
- win.addEventListener("load", function () {
- win.removeEventListener("load", arguments.callee, false);
-
- win.content.addEventListener("focus", function () {
- win.content.removeEventListener("focus", arguments.callee, false);
-
- function onTabClose() {
- ok(false, "shouldn't have gotten the TabClose event for the last tab");
- }
- var tab = win.gBrowser.selectedTab;
- tab.addEventListener("TabClose", onTabClose, false);
-
- EventUtils.synthesizeKey("w", { accelKey: true }, win);
-
- ok(win.closed, "accel+w closed the window immediately");
-
- tab.removeEventListener("TabClose", onTabClose, false);
-
- finish();
- }, false);
- }, false);
-}
diff --git a/browser/base/content/test/browser_bug484315.js b/browser/base/content/test/browser_bug484315.js
deleted file mode 100644
index fb23ae33a..000000000
--- a/browser/base/content/test/browser_bug484315.js
+++ /dev/null
@@ -1,23 +0,0 @@
-function test() {
- var contentWin = window.open("about:blank", "", "width=100,height=100");
- var enumerator = Services.wm.getEnumerator("navigator:browser");
-
- while (enumerator.hasMoreElements()) {
- let win = enumerator.getNext();
- if (win.content == contentWin) {
- gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
- win.gBrowser.removeCurrentTab();
- ok(win.closed, "popup is closed");
-
- // clean up
- if (!win.closed)
- win.close();
- if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
- gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
-
- return;
- }
- }
-
- throw "couldn't find the content window";
-}
diff --git a/browser/base/content/test/browser_bug491431.js b/browser/base/content/test/browser_bug491431.js
deleted file mode 100644
index 357e55bfc..000000000
--- a/browser/base/content/test/browser_bug491431.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let testPage = "data:text/plain,test bug 491431 Page";
-
-function test() {
- waitForExplicitFinish();
-
- let newWin, tabA, tabB;
-
- // test normal close
- tabA = gBrowser.addTab(testPage);
- gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
- ok(!aEvent.detail, "This was a normal tab close");
-
- // test tab close by moving
- tabB = gBrowser.addTab(testPage);
- gBrowser.tabContainer.addEventListener("TabClose", function(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
- executeSoon(function() {
- ok(aEvent.detail, "This was a tab closed by moving");
-
- // cleanup
- newWin.close();
- executeSoon(finish);
- });
- }, true);
- newWin = gBrowser.replaceTabWithWindow(tabB);
- }, true);
- gBrowser.removeTab(tabA);
-}
-
diff --git a/browser/base/content/test/browser_bug495058.js b/browser/base/content/test/browser_bug495058.js
deleted file mode 100644
index 0d4680058..000000000
--- a/browser/base/content/test/browser_bug495058.js
+++ /dev/null
@@ -1,43 +0,0 @@
-function test() {
- waitForExplicitFinish();
- next();
-}
-
-var uris = [
- "about:blank",
- "about:sessionrestore",
- "about:privatebrowsing",
-];
-
-function next() {
- var tab = gBrowser.addTab();
- var uri = uris.shift();
-
- if (uri == "about:blank") {
- detach();
- } else {
- let browser = tab.linkedBrowser;
- browser.addEventListener("load", function () {
- browser.removeEventListener("load", arguments.callee, true);
- detach();
- }, true);
- browser.loadURI(uri);
- }
-
- function detach() {
- var win = gBrowser.replaceTabWithWindow(tab);
-
- whenDelayedStartupFinished(win, function () {
- is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
- is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
- is(win.gURLBar.value, "", uri + ": urlbar is empty");
- ok(win.gURLBar.placeholder, uri + ": placeholder text is present");
-
- win.close();
- if (uris.length)
- next();
- else
- executeSoon(finish);
- });
- }
-}
diff --git a/browser/base/content/test/browser_bug517902.js b/browser/base/content/test/browser_bug517902.js
deleted file mode 100644
index 525b68aab..000000000
--- a/browser/base/content/test/browser_bug517902.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Make sure that "View Image Info" loads the correct image data */
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- var doc = gBrowser.contentDocument;
- var testImg = doc.getElementById("test-image");
- var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
-
- pageInfo.addEventListener("load", function () {
- pageInfo.removeEventListener("load", arguments.callee, true);
- pageInfo.onImagePreviewShown.push(function () {
- executeSoon(function () {
- var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
-
- is(pageInfoImg.src, testImg.src, "selected image has the correct source");
- is(pageInfoImg.width, testImg.width, "selected image has the correct width");
- is(pageInfoImg.height, testImg.height, "selected image has the correct height");
-
- pageInfo.close();
- gBrowser.removeCurrentTab();
- finish();
- });
- });
- }, true);
- }, true);
-
- content.location =
- "data:text/html," +
- "<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" +
- "<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" +
- "<img src='about:logo?b' height=300 width=350 alt=2>" +
- "<img src='about:logo?a' height=200 width=250>" +
- "<img src='about:logo?b' height=200 width=250 alt=1>" +
- "<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>";
-}
diff --git a/browser/base/content/test/browser_bug519216.js b/browser/base/content/test/browser_bug519216.js
deleted file mode 100644
index a924f7a09..000000000
--- a/browser/base/content/test/browser_bug519216.js
+++ /dev/null
@@ -1,50 +0,0 @@
-function test() {
- waitForExplicitFinish();
- gBrowser.stop();
- gBrowser.addProgressListener(progressListener1);
- gBrowser.addProgressListener(progressListener2);
- gBrowser.addProgressListener(progressListener3);
- gBrowser.loadURI("data:text/plain,bug519216");
-}
-
-var calledListener1 = false;
-var progressListener1 = {
- onLocationChange: function onLocationChange() {
- calledListener1 = true;
- gBrowser.removeProgressListener(this);
- }
-};
-
-var calledListener2 = false;
-var progressListener2 = {
- onLocationChange: function onLocationChange() {
- ok(calledListener1, "called progressListener1 before progressListener2");
- calledListener2 = true;
- gBrowser.removeProgressListener(this);
- }
-};
-
-var progressListener3 = {
- onLocationChange: function onLocationChange() {
- ok(calledListener2, "called progressListener2 before progressListener3");
- gBrowser.removeProgressListener(this);
- gBrowser.addProgressListener(progressListener4);
- executeSoon(function () {
- expectListener4 = true;
- gBrowser.reload();
- });
- }
-};
-
-var expectListener4 = false;
-var progressListener4 = {
- onLocationChange: function onLocationChange() {
- ok(expectListener4, "didn't call progressListener4 for the first location change");
- gBrowser.removeProgressListener(this);
- executeSoon(function () {
- gBrowser.addTab();
- gBrowser.removeCurrentTab();
- finish();
- });
- }
-};
diff --git a/browser/base/content/test/browser_bug520538.js b/browser/base/content/test/browser_bug520538.js
deleted file mode 100644
index 4489b64c3..000000000
--- a/browser/base/content/test/browser_bug520538.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function test() {
- var tabCount = gBrowser.tabs.length;
- gBrowser.selectedBrowser.focus();
- browserDOMWindow.openURI(makeURI("about:blank"),
- null,
- Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
- Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
- is(gBrowser.tabs.length, tabCount + 1,
- "'-new-tab about:blank' opens a new tab");
- is(gBrowser.selectedTab, gBrowser.tabs[tabCount],
- "'-new-tab about:blank' selects the new tab");
- is(document.activeElement, gURLBar.inputField,
- "'-new-tab about:blank' focuses the location bar");
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_bug521216.js b/browser/base/content/test/browser_bug521216.js
deleted file mode 100644
index c39ff741f..000000000
--- a/browser/base/content/test/browser_bug521216.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"];
-var actual = [];
-var tabIndex = -1;
-this.__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
-
-function test() {
- waitForExplicitFinish();
- tabIndex = gBrowser.tabs.length;
- gBrowser.addTabsProgressListener(progressListener);
- gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false);
- gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");
-}
-
-function record(aName) {
- info("got " + aName);
- if (actual.indexOf(aName) == -1)
- actual.push(aName);
- if (actual.length == expected.length) {
- is(actual.toString(), expected.toString(),
- "got events and progress notifications in expected order");
- gBrowser.removeTab(tab);
- gBrowser.removeTabsProgressListener(progressListener);
- gBrowser.tabContainer.removeEventListener("TabOpen", TabOpen, false);
- finish();
- }
-}
-
-function TabOpen(aEvent) {
- if (aEvent.target == tab)
- record(arguments.callee.name);
-}
-
-var progressListener = {
- onLocationChange: function onLocationChange(aBrowser) {
- if (aBrowser == tab.linkedBrowser)
- record(arguments.callee.name);
- },
- onStateChange: function onStateChange(aBrowser) {
- if (aBrowser == tab.linkedBrowser)
- record(arguments.callee.name);
- },
- onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) {
- if (aBrowser == tab.linkedBrowser &&
- aIconURL == "about:logo")
- record(arguments.callee.name);
- }
-};
diff --git a/browser/base/content/test/browser_bug533232.js b/browser/base/content/test/browser_bug533232.js
deleted file mode 100644
index fdee75ba2..000000000
--- a/browser/base/content/test/browser_bug533232.js
+++ /dev/null
@@ -1,36 +0,0 @@
-function test() {
- var tab1 = gBrowser.selectedTab;
- var tab2 = gBrowser.addTab();
- var childTab1;
- var childTab2;
-
- childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
- gBrowser.selectedTab = childTab1;
- gBrowser.removeCurrentTab();
- is(idx(gBrowser.selectedTab), idx(tab1),
- "closing a tab next to its parent selects the parent");
-
- childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
- gBrowser.selectedTab = tab2;
- gBrowser.selectedTab = childTab1;
- gBrowser.removeCurrentTab();
- is(idx(gBrowser.selectedTab), idx(tab2),
- "closing a tab next to its parent doesn't select the parent if another tab had been selected ad interim");
-
- gBrowser.selectedTab = tab1;
- childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
- childTab2 = gBrowser.addTab("about:blank", { relatedToCurrent: true });
- gBrowser.selectedTab = childTab1;
- gBrowser.removeCurrentTab();
- is(idx(gBrowser.selectedTab), idx(childTab2),
- "closing a tab next to its parent selects the next tab with the same parent");
- gBrowser.removeCurrentTab();
- is(idx(gBrowser.selectedTab), idx(tab2),
- "closing the last tab in a set of child tabs doesn't go back to the parent");
-
- gBrowser.removeTab(tab2);
-}
-
-function idx(tab) {
- return Array.indexOf(gBrowser.tabs, tab);
-}
diff --git a/browser/base/content/test/browser_bug537474.js b/browser/base/content/test/browser_bug537474.js
deleted file mode 100644
index 3c471e1d2..000000000
--- a/browser/base/content/test/browser_bug537474.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function test() {
- var currentWin = content;
- var newWin =
- browserDOMWindow.openURI(makeURI("about:"), null,
- Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW, null)
- is(newWin, currentWin, "page loads in the current content window");
- gBrowser.stop();
-}
diff --git a/browser/base/content/test/browser_bug550565.js b/browser/base/content/test/browser_bug550565.js
deleted file mode 100644
index 0dfa4ed4a..000000000
--- a/browser/base/content/test/browser_bug550565.js
+++ /dev/null
@@ -1,21 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- let testPath = getRootDirectory(gTestPath);
-
- let tab = gBrowser.addTab(testPath + "file_bug550565_popup.html");
-
- tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
- tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
-
- let expectedIcon = testPath + "file_bug550565_favicon.ico";
-
- is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before pushState.");
- tab.linkedBrowser.contentWindow.history.pushState("page2", "page2", "page2");
- is(gBrowser.getIcon(tab), expectedIcon, "Correct icon after pushState.");
-
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug553455.js b/browser/base/content/test/browser_bug553455.js
deleted file mode 100644
index ddfba9fd3..000000000
--- a/browser/base/content/test/browser_bug553455.js
+++ /dev/null
@@ -1,903 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
-const TESTROOT2 = "http://example.org/browser/toolkit/mozapps/extensions/test/xpinstall/";
-const SECUREROOT = "https://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
-const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
-const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
-
-var rootDir = getRootDirectory(gTestPath);
-var path = rootDir.split('/');
-var chromeName = path[0] + '//' + path[2];
-var croot = chromeName + "/content/browser/toolkit/mozapps/extensions/test/xpinstall/";
-var jar = getJar(croot);
-if (jar) {
- var tmpdir = extractJarToTmp(jar);
- croot = 'file://' + tmpdir.path + '/';
-}
-const CHROMEROOT = croot;
-
-var gApp = document.getElementById("bundle_brand").getString("brandShortName");
-var gVersion = Services.appinfo.version;
-var check_notification;
-
-function wait_for_notification(aCallback) {
- info("Waiting for notification");
- check_notification = function() {
- PopupNotifications.panel.removeEventListener("popupshown", check_notification, false);
- info("Saw notification");
- is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
- aCallback(PopupNotifications.panel);
- };
- PopupNotifications.panel.addEventListener("popupshown", check_notification, false);
-}
-
-function wait_for_notification_close(aCallback) {
- info("Waiting for notification to close");
- PopupNotifications.panel.addEventListener("popuphidden", function() {
- PopupNotifications.panel.removeEventListener("popuphidden", arguments.callee, false);
- aCallback();
- }, false);
-}
-
-function wait_for_install_dialog(aCallback) {
- info("Waiting for install dialog");
- Services.wm.addListener({
- onOpenWindow: function(aXULWindow) {
- info("Install dialog opened, waiting for focus");
- Services.wm.removeListener(this);
-
- var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- waitForFocus(function() {
- info("Saw install dialog");
- is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");
-
- // Override the countdown timer on the accept button
- var button = domwindow.document.documentElement.getButton("accept");
- button.disabled = false;
-
- aCallback(domwindow);
- }, domwindow);
- },
-
- onCloseWindow: function(aXULWindow) {
- },
-
- onWindowTitleChange: function(aXULWindow, aNewTitle) {
- }
- });
-}
-
-function wait_for_single_notification(aCallback) {
- function inner_waiter() {
- info("Waiting for single notification");
- // Notification should never close while we wait
- ok(PopupNotifications.isPanelOpen, "Notification should still be open");
- if (PopupNotifications.panel.childNodes.length == 2) {
- executeSoon(inner_waiter);
- return;
- }
-
- aCallback();
- }
-
- executeSoon(inner_waiter);
-}
-
-function setup_redirect(aSettings) {
- var url = "https://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/redirect.sjs?mode=setup";
- for (var name in aSettings) {
- url += "&" + name + "=" + aSettings[name];
- }
-
- var req = new XMLHttpRequest();
- req.open("GET", url, false);
- req.send(null);
-}
-
-var TESTS = [
-function test_disabled_install() {
- Services.prefs.setBoolPref("xpinstall.enabled", false);
-
- // Wait for the disabled notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "xpinstall-disabled-notification", "Should have seen installs disabled");
- is(notification.button.label, "Enable", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "Software installation is currently disabled. Click Enable and try again.");
-
- wait_for_notification_close(function() {
- try {
- ok(Services.prefs.getBoolPref("xpinstall.enabled"), "Installation should be enabled");
- }
- catch (e) {
- ok(false, "xpinstall.enabled should be set");
- }
-
- gBrowser.removeTab(gBrowser.selectedTab);
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should have been one install created");
- aInstalls[0].cancel();
-
- runNextTest();
- });
- });
-
- // Click on Enable
- EventUtils.synthesizeMouseAtCenter(notification.button, {});
- });
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_blocked_install() {
- // Wait for the blocked notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-blocked-notification", "Should have seen the install blocked");
- is(notification.button.label, "Allow", "Should have seen the right button");
- is(notification.getAttribute("label"),
- gApp + " prevented this site (example.com) from asking you to install " +
- "software on your computer.",
- "Should have seen the right message");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "XPI Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
-
- // Click on Allow
- EventUtils.synthesizeMouse(notification.button, 20, 10, {});
-
- // Notification should have changed to progress notification
- ok(PopupNotifications.isPanelOpen, "Notification should still be open");
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- });
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_whitelisted_install() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "XPI Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_failed_download() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the failed notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
- is(notification.getAttribute("label"),
- "The add-on could not be downloaded because of a connection failure " +
- "on example.com.",
- "Should have seen the right message");
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "missing.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_corrupt_file() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the failed notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
- is(notification.getAttribute("label"),
- "The add-on downloaded from example.com could not be installed " +
- "because it appears to be corrupt.",
- "Should have seen the right message");
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "corrupt.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_incompatible() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the failed notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
- is(notification.getAttribute("label"),
- "XPI Test could not be installed because it is not compatible with " +
- gApp + " " + gVersion + ".",
- "Should have seen the right message");
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "incompatible.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_restartless() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.getAttribute("label"),
- "XPI Test has been installed successfully.",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 0, "Should be no pending installs");
-
- AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "restartless.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_multiple() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "2 add-ons will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- AddonManager.getAddonByID("restartless-xpi@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "Unsigned XPI": "unsigned.xpi",
- "Restartless XPI": "restartless.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_url() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "XPI Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "unsigned.xpi");
-},
-
-function test_localfile() {
- // Wait for the install to fail
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addon-install-failed");
-
- // Wait for the browser code to add the failure notification
- wait_for_single_notification(function() {
- let notification = PopupNotifications.panel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
- is(notification.getAttribute("label"),
- "This add-on could not be installed because it appears to be corrupt.",
- "Should have seen the right message");
-
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- }, "addon-install-failed", false);
-
- var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIChromeRegistry);
- try {
- var path = cr.convertChromeURL(makeURI(CHROMEROOT + "corrupt.xpi")).spec;
- } catch (ex) {
- var path = CHROMEROOT + "corrupt.xpi";
- }
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(path);
-},
-
-function test_wronghost() {
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.addEventListener("load", function() {
- if (gBrowser.currentURI.spec != TESTROOT2 + "enabled.html")
- return;
-
- gBrowser.removeEventListener("load", arguments.callee, true);
-
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
- is(notification.getAttribute("label"),
- "The add-on downloaded from example.com could not be installed " +
- "because it appears to be corrupt.",
- "Should have seen the right message");
-
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- gBrowser.loadURI(TESTROOT + "corrupt.xpi");
- }, true);
- gBrowser.loadURI(TESTROOT2 + "enabled.html");
-},
-
-function test_reload() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "XPI Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- function test_fail() {
- ok(false, "Reloading should not have hidden the notification");
- }
-
- PopupNotifications.panel.addEventListener("popuphiding", test_fail, false);
-
- gBrowser.addEventListener("load", function() {
- if (gBrowser.currentURI.spec != TESTROOT2 + "enabled.html")
- return;
-
- gBrowser.removeEventListener("load", arguments.callee, true);
-
- PopupNotifications.panel.removeEventListener("popuphiding", test_fail, false);
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- }, true);
- gBrowser.loadURI(TESTROOT2 + "enabled.html");
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "Unsigned XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_theme() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "Theme Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAddonByID("{972ce4c6-7e08-4474-a285-3208198ce6fd}", function(aAddon) {
- ok(aAddon.userDisabled, "Should be switching away from the default theme.");
- // Undo the pending theme switch
- aAddon.userDisabled = false;
-
- AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
- isnot(aAddon, null, "Test theme will have been installed");
- aAddon.uninstall();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "Theme XPI": "theme.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_renotify_blocked() {
- // Wait for the blocked notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-blocked-notification", "Should have seen the install blocked");
-
- wait_for_notification_close(function () {
- info("Timeouts after this probably mean bug 589954 regressed");
- executeSoon(function () {
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-blocked-notification",
- "Should have seen the install blocked - 2nd time");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 2, "Should be two pending installs");
- aInstalls[0].cancel();
- aInstalls[1].cancel();
-
- info("Closing browser tab");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
- });
- });
-
- // hide the panel (this simulates the user dismissing it)
- aPanel.hidePopup();
- });
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_renotify_installed() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
-
- // Dismiss the notification
- wait_for_notification_close(function () {
- // Install another
- executeSoon(function () {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- info("Timeouts after this probably mean bug 589954 regressed");
-
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the second install complete");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending installs");
- aInstalls[0].cancel();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
- });
- });
-
- // hide the panel (this simulates the user dismissing it)
- aPanel.hidePopup();
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_cancel_restart() {
- // Wait for the progress notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Close the notification
- let anchor = document.getElementById("addons-notification-icon");
- anchor.click();
- // Reopen the notification
- anchor.click();
-
- ok(PopupNotifications.isPanelOpen, "Notification should still be open");
- is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
- isnot(notification, aPanel.childNodes[0], "Should have reconstructed the notification UI");
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
- let button = document.getAnonymousElementByAttribute(notification, "anonid", "cancel");
-
- // Cancel the download
- EventUtils.synthesizeMouse(button, 2, 2, {});
-
- // Notification should have changed to cancelled
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-cancelled-notification", "Should have seen the cancelled notification");
-
- // Wait for the install confirmation dialog
- wait_for_install_dialog(function(aWindow) {
- // Wait for the complete notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-complete-notification", "Should have seen the install complete");
- is(notification.button.label, "Restart Now", "Should have seen the right button");
- is(notification.getAttribute("label"),
- "XPI Test will be installed after you restart " + gApp + ".",
- "Should have seen the right message");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 1, "Should be one pending install");
- aInstalls[0].cancel();
-
- Services.perms.remove("example.com", "install");
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- });
-
- aWindow.document.documentElement.acceptDialog();
- });
-
- // Restart the download
- EventUtils.synthesizeMouse(notification.button, 20, 10, {});
-
- // Should be back to a progress notification
- ok(PopupNotifications.isPanelOpen, "Notification should still be open");
- is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
- });
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "unsigned.xpi"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-},
-
-function test_failed_security() {
- Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
-
- setup_redirect({
- "Location": TESTROOT + "unsigned.xpi"
- });
-
- // Wait for the blocked notification
- wait_for_notification(function(aPanel) {
- let notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-blocked-notification", "Should have seen the install blocked");
-
- // Click on Allow
- EventUtils.synthesizeMouse(notification.button, 20, 10, {});
-
- // Notification should have changed to progress notification
- ok(PopupNotifications.isPanelOpen, "Notification should still be open");
- is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-progress-notification", "Should have seen the progress notification");
-
- // Wait for it to fail
- Services.obs.addObserver(function() {
- Services.obs.removeObserver(arguments.callee, "addon-install-failed");
-
- // Allow the browser code to add the failure notification and then wait
- // for the progress notification to dismiss itself
- wait_for_single_notification(function() {
- is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
- notification = aPanel.childNodes[0];
- is(notification.id, "addon-install-failed-notification", "Should have seen the install fail");
-
- Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, true);
- wait_for_notification_close(runNextTest);
- gBrowser.removeTab(gBrowser.selectedTab);
- });
- }, "addon-install-failed", false);
- });
-
- var triggers = encodeURIComponent(JSON.stringify({
- "XPI": "redirect.sjs?mode=redirect"
- }));
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(SECUREROOT + "installtrigger.html?" + triggers);
-}
-];
-
-var gTestStart = null;
-
-function runNextTest() {
- if (gTestStart)
- info("Test part took " + (Date.now() - gTestStart) + "ms");
-
- ok(!PopupNotifications.isPanelOpen, "Notification should be closed");
-
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 0, "Should be no active installs");
-
- if (TESTS.length == 0) {
- finish();
- return;
- }
-
- info("Running " + TESTS[0].name);
- gTestStart = Date.now();
- TESTS.shift()();
- });
-};
-
-var XPInstallObserver = {
- observe: function (aSubject, aTopic, aData) {
- var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
- info("Observed " + aTopic + " for " + installInfo.installs.length + " installs");
- installInfo.installs.forEach(function(aInstall) {
- info("Install of " + aInstall.sourceURI.spec + " was in state " + aInstall.state);
- });
- }
-};
-
-function test() {
- requestLongerTimeout(4);
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref("extensions.logging.enabled", true);
- Services.prefs.setBoolPref("extensions.strictCompatibility", true);
-
- Services.obs.addObserver(XPInstallObserver, "addon-install-started", false);
- Services.obs.addObserver(XPInstallObserver, "addon-install-blocked", false);
- Services.obs.addObserver(XPInstallObserver, "addon-install-failed", false);
- Services.obs.addObserver(XPInstallObserver, "addon-install-complete", false);
-
- registerCleanupFunction(function() {
- // Make sure no more test parts run in case we were timed out
- TESTS = [];
- PopupNotifications.panel.removeEventListener("popupshown", check_notification, false);
-
- AddonManager.getAllInstalls(function(aInstalls) {
- aInstalls.forEach(function(aInstall) {
- aInstall.cancel();
- });
- });
-
- Services.prefs.clearUserPref("extensions.logging.enabled");
- Services.prefs.clearUserPref("extensions.strictCompatibility");
-
- Services.obs.removeObserver(XPInstallObserver, "addon-install-started");
- Services.obs.removeObserver(XPInstallObserver, "addon-install-blocked");
- Services.obs.removeObserver(XPInstallObserver, "addon-install-failed");
- Services.obs.removeObserver(XPInstallObserver, "addon-install-complete");
- });
-
- runNextTest();
-}
diff --git a/browser/base/content/test/browser_bug555224.js b/browser/base/content/test/browser_bug555224.js
deleted file mode 100644
index dbf3464a5..000000000
--- a/browser/base/content/test/browser_bug555224.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const TEST_PAGE = "/browser/browser/base/content/test/dummy_page.html";
-var gTestTab, gBgTab, gTestZoom;
-
-function testBackgroundLoad() {
- Task.spawn(function () {
- is(ZoomManager.zoom, gTestZoom, "opening a background tab should not change foreground zoom");
-
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gBgTab);
-
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTestTab);
- finish();
- });
-}
-
-function testInitialZoom() {
- Task.spawn(function () {
- is(ZoomManager.zoom, 1, "initial zoom level should be 1");
- FullZoom.enlarge();
-
- gTestZoom = ZoomManager.zoom;
- isnot(gTestZoom, 1, "zoom level should have changed");
-
- gBgTab = gBrowser.addTab();
- yield FullZoomHelper.load(gBgTab, "http://mochi.test:8888" + TEST_PAGE);
- }).then(testBackgroundLoad, FullZoomHelper.failAndContinue(finish));
-}
-
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function () {
- gTestTab = gBrowser.addTab();
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTestTab);
- yield FullZoomHelper.load(gTestTab, "http://example.org" + TEST_PAGE);
- }).then(testInitialZoom, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug555767.js b/browser/base/content/test/browser_bug555767.js
deleted file mode 100644
index cfd1904a0..000000000
--- a/browser/base/content/test/browser_bug555767.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
- let tabSelected = false;
-
- // Open the base tab
- let baseTab = gBrowser.addTab(testURL);
- baseTab.linkedBrowser.addEventListener("load", function() {
- // Wait for the tab to be fully loaded so matching happens correctly
- if (baseTab.linkedBrowser.currentURI.spec == "about:blank")
- return;
- baseTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let testTab = gBrowser.addTab();
-
- // Select the testTab
- gBrowser.selectedTab = testTab;
-
- // Ensure that this tab has no history entries
- ok(testTab.linkedBrowser.sessionHistory.count < 2,
- "The test tab has 1 or less history entries");
- // Ensure that this tab is on about:blank
- is(testTab.linkedBrowser.currentURI.spec, "about:blank",
- "The test tab is on about:blank");
- // Ensure that this tab's document has no child nodes
- ok(!testTab.linkedBrowser.contentDocument.body.hasChildNodes(),
- "The test tab has no child nodes");
- ok(!testTab.hasAttribute("busy"),
- "The test tab doesn't have the busy attribute");
-
- // Set the urlbar to include the moz-action
- gURLBar.value = "moz-action:switchtab," + testURL;
- // Focus the urlbar so we can press enter
- gURLBar.focus();
-
- // Functions for TabClose and TabSelect
- function onTabClose(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, false);
- // Make sure we get the TabClose event for testTab
- is(aEvent.originalTarget, testTab, "Got the TabClose event for the right tab");
- // Confirm that we did select the tab
- ok(tabSelected, "Confirming that the tab was selected");
- gBrowser.removeTab(baseTab);
- finish();
- }
- function onTabSelect(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabSelect", onTabSelect, false);
- // Make sure we got the TabSelect event for baseTab
- is(aEvent.originalTarget, baseTab, "Got the TabSelect event for the right tab");
- // Confirm that the selected tab is in fact base tab
- is(gBrowser.selectedTab, baseTab, "We've switched to the correct tab");
- tabSelected = true;
- }
-
- // Add the TabClose, TabSelect event listeners before we press enter
- gBrowser.tabContainer.addEventListener("TabClose", onTabClose, false);
- gBrowser.tabContainer.addEventListener("TabSelect", onTabSelect, false);
-
- // Press enter!
- EventUtils.synthesizeKey("VK_RETURN", {});
- }, true);
-}
-
diff --git a/browser/base/content/test/browser_bug556061.js b/browser/base/content/test/browser_bug556061.js
deleted file mode 100644
index 21046d079..000000000
--- a/browser/base/content/test/browser_bug556061.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-let testActionURL = "moz-action:switchtab," + testURL;
-testURL = gURLBar.trimValue(testURL);
-let testTab;
-
-function runNextTest() {
- if (tests.length) {
- let t = tests.shift();
- waitForClipboard(t.expected, t.setup, function() {
- t.success();
- runNextTest();
- }, cleanup);
- }
- else {
- cleanup();
- }
-}
-
-function cleanup() {
- gBrowser.removeTab(testTab);
- finish();
-}
-
-let tests = [
- {
- expected: testURL,
- setup: function() {
- gURLBar.value = testActionURL;
- gURLBar.valueIsTyped = true;
- is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
-
- // Focus the urlbar so we can select it all & copy
- gURLBar.focus();
- gURLBar.select();
- goDoCommand("cmd_copy");
- },
- success: function() {
- is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
- }
- },
- {
- expected: testURL.substring(0, 10),
- setup: function() {
- // Set selectionStart/End manually and make sure it matches the substring
- gURLBar.selectionStart = 0;
- gURLBar.selectionEnd = 10;
- goDoCommand("cmd_copy");
- },
- success: function() {
- is(gURLBar.value, testActionURL, "gURLBar.value didn't change when copying");
- }
- },
- {
- expected: testURL,
- setup: function() {
- // Setup for cut test...
- // Select all
- gURLBar.select();
- goDoCommand("cmd_cut");
- },
- success: function() {
- is(gURLBar.value, "", "gURLBar.value is now empty");
- }
- },
- {
- expected: testURL.substring(testURL.length - 10, testURL.length),
- setup: function() {
- // Reset urlbar value
- gURLBar.value = testActionURL;
- gURLBar.valueIsTyped = true;
- // Sanity check that we have the right value
- is(gURLBar.value, testActionURL, "gURLBar.value starts with correct value");
-
- // Now just select part of the value & cut that.
- gURLBar.selectionStart = testURL.length - 10;
- gURLBar.selectionEnd = testURL.length;
- goDoCommand("cmd_cut");
- },
- success: function() {
- is(gURLBar.value, testURL.substring(0, testURL.length - 10), "gURLBar.value has the correct value");
- }
- }
-];
-
-function test() {
- waitForExplicitFinish();
- testTab = gBrowser.addTab();
- gBrowser.selectedTab = testTab;
-
- // Kick off the testing
- runNextTest();
-}
diff --git a/browser/base/content/test/browser_bug559991.js b/browser/base/content/test/browser_bug559991.js
deleted file mode 100644
index 60b2621d0..000000000
--- a/browser/base/content/test/browser_bug559991.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var tab;
-
-function test() {
-
- // ----------
- // Test setup
-
- waitForExplicitFinish();
-
- gPrefService.setBoolPref("browser.zoom.updateBackgroundTabs", true);
- gPrefService.setBoolPref("browser.zoom.siteSpecific", true);
-
- let uri = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-
- Task.spawn(function () {
- tab = gBrowser.addTab();
- yield FullZoomHelper.load(tab, uri);
-
- // -------------------------------------------------------------------
- // Test - Trigger a tab switch that should update the zoom level
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab);
- ok(true, "applyPrefToSetting was called");
- }).then(endTest, FullZoomHelper.failAndContinue(endTest));
-}
-
-// -------------
-// Test clean-up
-function endTest() {
- Task.spawn(function () {
- yield FullZoomHelper.removeTabAndWaitForLocationChange(tab);
-
- tab = null;
-
- if (gPrefService.prefHasUserValue("browser.zoom.updateBackgroundTabs"))
- gPrefService.clearUserPref("browser.zoom.updateBackgroundTabs");
-
- if (gPrefService.prefHasUserValue("browser.zoom.siteSpecific"))
- gPrefService.clearUserPref("browser.zoom.siteSpecific");
-
- finish();
- });
-}
diff --git a/browser/base/content/test/browser_bug561623.js b/browser/base/content/test/browser_bug561623.js
deleted file mode 100644
index 6f7fc85c7..000000000
--- a/browser/base/content/test/browser_bug561623.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let i = doc.getElementById("i");
-
- ok(!tooltip.fillInPageTooltip(i),
- "No tooltip should be shown when @title is null");
-
- i.title = "foo";
- ok(tooltip.fillInPageTooltip(i),
- "A tooltip should be shown when @title is not the empty string");
-
- i.pattern = "bar";
- ok(tooltip.fillInPageTooltip(i),
- "A tooltip should be shown when @title is not the empty string");
-
- gBrowser.removeCurrentTab();
- finish();
- }, true);
-
- content.location =
- "data:text/html,<!DOCTYPE html><html><body><input id='i'></body></html>";
-}
-
diff --git a/browser/base/content/test/browser_bug561636.js b/browser/base/content/test/browser_bug561636.js
deleted file mode 100644
index 1cf689390..000000000
--- a/browser/base/content/test/browser_bug561636.js
+++ /dev/null
@@ -1,474 +0,0 @@
-var gInvalidFormPopup = document.getElementById('invalid-form-popup');
-ok(gInvalidFormPopup,
- "The browser should have a popup to show when a form is invalid");
-
-function checkPopupShow()
-{
- ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open',
- "[Test " + testId + "] The invalid form popup should be shown");
-}
-
-function checkPopupHide()
-{
- ok(gInvalidFormPopup.state != 'showing' && gInvalidFormPopup.state != 'open',
- "[Test " + testId + "] The invalid form popup should not be shown");
-}
-
-function checkPopupMessage(doc)
-{
- is(gInvalidFormPopup.firstChild.textContent,
- doc.getElementById('i').validationMessage,
- "[Test " + testId + "] The panel should show the message from validationMessage");
-}
-
-let gObserver = {
- QueryInterface : XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]),
-
- notifyInvalidSubmit : function (aFormElement, aInvalidElements)
- {
- }
-};
-
-var testId = -1;
-
-function nextTest()
-{
- testId++;
- if (testId >= tests.length) {
- finish();
- return;
- }
- executeSoon(tests[testId]);
-}
-
-function test()
-{
- waitForExplicitFinish();
- waitForFocus(nextTest);
-}
-
-var tests = [
-
-/**
- * In this test, we check that no popup appears if the form is valid.
- */
-function()
-{
- let uri = "data:text/html,<html><body><iframe name='t'></iframe><form target='t' action='data:text/html,'><input><input id='s' type='submit'></form></body></html>";
- let tab = gBrowser.addTab();
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = gBrowser.contentDocument;
-
- doc.getElementById('s').click();
-
- executeSoon(function() {
- checkPopupHide();
-
- // Clean-up
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that, when an invalid form is submitted,
- * the invalid element is focused and a popup appears.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input required id='i'><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that, when an invalid form is submitted,
- * the first invalid element is focused and a popup appears.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input><input id='i' required><input required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that, we hide the popup by interacting with the
- * invalid element if the element becomes valid.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- EventUtils.synthesizeKey("a", {});
-
- executeSoon(function () {
- checkPopupHide();
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that, we don't hide the popup by interacting with the
- * invalid element if the element is still invalid.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- EventUtils.synthesizeKey("a", {});
-
- executeSoon(function () {
- checkPopupShow();
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that we can hide the popup by blurring the invalid
- * element.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- doc.getElementById('i').blur();
-
- executeSoon(function () {
- checkPopupHide();
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that we can hide the popup by pressing TAB.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- EventUtils.synthesizeKey("VK_TAB", {});
-
- executeSoon(function () {
- checkPopupHide();
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that the popup will hide if we move to another tab.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
- checkPopupMessage(doc);
-
- // Create a new tab and move to it.
- gBrowser.selectedTab = gBrowser.addTab("about:blank", {skipAnimation: true});
-
- executeSoon(function() {
- checkPopupHide();
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that nothing happen (no focus nor popup) if the
- * invalid form is submitted in another tab than the current focused one
- * (submitted in background).
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gObserver.notifyInvalidSubmit = function() {
- executeSoon(function() {
- let doc = tab.linkedBrowser.contentDocument;
- isnot(doc.activeElement, doc.getElementById('i'),
- "We should not focus the invalid element when the form is submitted in background");
-
- checkPopupHide();
-
- // Clean-up
- Services.obs.removeObserver(gObserver, "invalidformsubmit");
- gObserver.notifyInvalidSubmit = function () {};
- gBrowser.removeTab(tab);
-
- nextTest();
- });
- };
-
- Services.obs.addObserver(gObserver, "invalidformsubmit", false);
-
- tab.linkedBrowser.addEventListener("load", function(e) {
- // Ignore load events from the iframe.
- if (tab.linkedBrowser.contentDocument == e.target) {
- let browser = e.currentTarget;
- browser.removeEventListener("load", arguments.callee, true);
-
- isnot(gBrowser.selectedTab.linkedBrowser, browser,
- "This tab should have been loaded in background");
- browser.contentDocument.getElementById('s').click();
- }
- }, true);
-
- tab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that the author defined error message is shown.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input x-moz-errormessage='foo' required id='i'><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- checkPopupShow();
-
- is(gInvalidFormPopup.firstChild.textContent, "foo",
- "The panel should show the author defined error message");
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-/**
- * In this test, we check that the message is correctly updated when it changes.
- */
-function()
-{
- let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input type='email' required id='i'><input id='s' type='submit'></form>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument;
- let input = doc.getElementById('i');
- is(doc.activeElement, input, "First invalid element should be focused");
-
- checkPopupShow();
-
- is(gInvalidFormPopup.firstChild.textContent, input.validationMessage,
- "The panel should show the current validation message");
-
- input.addEventListener('input', function() {
- input.removeEventListener('input', arguments.callee, false);
-
- executeSoon(function() {
- // Now, the element suffers from another error, the message should have
- // been updated.
- is(gInvalidFormPopup.firstChild.textContent, input.validationMessage,
- "The panel should show the current validation message");
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab);
- nextTest();
- });
- }, false);
-
- EventUtils.synthesizeKey('f', {});
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-},
-
-];
diff --git a/browser/base/content/test/browser_bug562649.js b/browser/base/content/test/browser_bug562649.js
deleted file mode 100644
index af7cdaeb1..000000000
--- a/browser/base/content/test/browser_bug562649.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function test() {
- const URI = "data:text/plain,bug562649";
- browserDOMWindow.openURI(makeURI(URI),
- null,
- Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
- Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
-
- ok(XULBrowserWindow.isBusy, "window is busy loading a page");
- is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
- is(gURLBar.value, URI, "location bar value matches test URI");
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.removeCurrentTab();
- is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI after switching tabs");
- is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
-
- waitForExplicitFinish();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- is(gBrowser.userTypedValue, null, "userTypedValue is null as the page has loaded");
- is(gURLBar.value, URI, "location bar value matches test URI as the page has loaded");
-
- gBrowser.removeCurrentTab();
- finish();
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug563588.js b/browser/base/content/test/browser_bug563588.js
deleted file mode 100644
index a1774fb7e..000000000
--- a/browser/base/content/test/browser_bug563588.js
+++ /dev/null
@@ -1,30 +0,0 @@
-function press(key, expectedPos) {
- var originalSelectedTab = gBrowser.selectedTab;
- EventUtils.synthesizeKey("VK_" + key.toUpperCase(), { accelKey: true });
- is(gBrowser.selectedTab, originalSelectedTab,
- "accel+" + key + " doesn't change which tab is selected");
- is(gBrowser.tabContainer.selectedIndex, expectedPos,
- "accel+" + key + " moves the tab to the expected position");
- is(document.activeElement, gBrowser.selectedTab,
- "accel+" + key + " leaves the selected tab focused");
-}
-
-function test() {
- gBrowser.addTab();
- gBrowser.addTab();
- is(gBrowser.tabs.length, 3, "got three tabs");
- is(gBrowser.tabs[0], gBrowser.selectedTab, "first tab is selected");
-
- gBrowser.selectedTab.focus();
- is(document.activeElement, gBrowser.selectedTab, "selected tab is focused");
-
- press("right", 1);
- press("down", 2);
- press("left", 1);
- press("up", 0);
- press("end", 2);
- press("home", 0);
-
- gBrowser.removeCurrentTab();
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_bug565575.js b/browser/base/content/test/browser_bug565575.js
deleted file mode 100644
index a6a227010..000000000
--- a/browser/base/content/test/browser_bug565575.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function test() {
- gBrowser.selectedBrowser.focus();
- BrowserOpenTab();
- ok(gURLBar.focused, "location bar is focused for a new tab");
-
- gBrowser.selectedTab = gBrowser.tabs[0];
- ok(!gURLBar.focused, "location bar isn't focused for the previously selected tab");
-
- gBrowser.selectedTab = gBrowser.tabs[1];
- ok(gURLBar.focused, "location bar is re-focused when selecting the new tab");
-
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_bug565667.js b/browser/base/content/test/browser_bug565667.js
deleted file mode 100644
index 6fac026c8..000000000
--- a/browser/base/content/test/browser_bug565667.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
-
-function test() {
- waitForExplicitFinish();
- // Open the javascript console. It has the mac menu overlay, so browser.js is
- // loaded in it.
- let consoleWin = window.open("chrome://global/content/console.xul", "_blank",
- "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
- testWithOpenWindow(consoleWin);
-}
-
-function testWithOpenWindow(consoleWin) {
- // Add a tab so we don't open the url into the current tab
- let newTab = gBrowser.addTab("http://example.com");
- gBrowser.selectedTab = newTab;
-
- let numTabs = gBrowser.tabs.length;
-
- waitForFocus(function() {
- // Sanity check
- is(fm.activeWindow, consoleWin,
- "the console window is focused");
-
- gBrowser.tabContainer.addEventListener("TabOpen", function(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee, true);
- let browser = aEvent.originalTarget.linkedBrowser;
- browser.addEventListener("pageshow", function(event) {
- if (event.target.location.href != "about:addons")
- return;
- browser.removeEventListener("pageshow", arguments.callee, true);
-
- is(fm.activeWindow, window,
- "the browser window was focused");
- is(browser.currentURI.spec, "about:addons",
- "about:addons was loaded in the window");
- is(gBrowser.tabs.length, numTabs + 1,
- "a new tab was added");
-
- // Cleanup.
- executeSoon(function() {
- consoleWin.close();
- gBrowser.removeTab(gBrowser.selectedTab);
- gBrowser.removeTab(newTab);
- finish();
- });
- }, true);
- }, true);
-
- // Open the addons manager, uses switchToTabHavingURI.
- consoleWin.BrowserOpenAddonsMgr();
- }, consoleWin);
-}
-
-// Ideally we'd also check that the case for no open windows works, but we can't
-// due to limitations with the testing framework.
diff --git a/browser/base/content/test/browser_bug567306.js b/browser/base/content/test/browser_bug567306.js
deleted file mode 100644
index 1fa35efa8..000000000
--- a/browser/base/content/test/browser_bug567306.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-let Ci = Components.interfaces;
-
-function test() {
- waitForExplicitFinish();
-
- whenNewWindowLoaded(undefined, function (win) {
- whenDelayedStartupFinished(win, function () {
- let selectedBrowser = win.gBrowser.selectedBrowser;
- selectedBrowser.addEventListener("pageshow", function() {
- selectedBrowser.removeEventListener("pageshow", arguments.callee, true);
- ok(true, "pageshow listener called: " + win.content.location);
- waitForFocus(function () {
- onFocus(win);
- }, selectedBrowser.contentWindow);
- }, true);
- selectedBrowser.loadURI("data:text/html,<h1 id='h1'>Select Me</h1>");
- });
- });
-}
-
-function selectText(win) {
- let elt = win.document.getElementById("h1");
- let selection = win.getSelection();
- let range = win.document.createRange();
- range.setStart(elt, 0);
- range.setEnd(elt, 1);
- selection.removeAllRanges();
- selection.addRange(range);
-}
-
-function onFocus(win) {
- ok(!win.gFindBarInitialized, "find bar is not yet initialized");
- let findBar = win.gFindBar;
- selectText(win.content);
- findBar.onFindCommand();
- is(findBar._findField.value, "Select Me", "Findbar is initialized with selection");
- findBar.close();
- win.close();
- finish();
-}
diff --git a/browser/base/content/test/browser_bug575561.js b/browser/base/content/test/browser_bug575561.js
deleted file mode 100644
index 61c2676e4..000000000
--- a/browser/base/content/test/browser_bug575561.js
+++ /dev/null
@@ -1,90 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- // Pinned: Link to the same domain should not open a new tab
- // Tests link to http://example.com/browser/browser/base/content/test/dummy_page.html
- testLink(0, true, false, function() {
- // Pinned: Link to a different subdomain should open a new tab
- // Tests link to http://test1.example.com/browser/browser/base/content/test/dummy_page.html
- testLink(1, true, true, function() {
- // Pinned: Link to a different domain should open a new tab
- // Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
- testLink(2, true, true, function() {
- // Not Pinned: Link to a different domain should not open a new tab
- // Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html
- testLink(2, false, false, function() {
- // Pinned: Targetted link should open a new tab
- // Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html with target="foo"
- testLink(3, true, true, function() {
- // Pinned: Link in a subframe should not open a new tab
- // Tests link to http://example.org/browser/browser/base/content/test/dummy_page.html in subframe
- testLink(0, true, false, function() {
- // Pinned: Link to the same domain (with www prefix) should not open a new tab
- // Tests link to http://www.example.com/browser/browser/base/content/test/dummy_page.html
- testLink(4, true, false, function() {
- // Pinned: Link to a data: URI should not open a new tab
- // Tests link to data:text/html,<!DOCTYPE html><html><body>Another Page</body></html>
- testLink(5, true, false, function() {
- // Pinned: Link to an about: URI should not open a new tab
- // Tests link to about:mozilla
- testLink(6, true, false, finish);
- });
- });
- }, true);
- });
- });
- });
- });
- });
-}
-
-function testLink(aLinkIndex, pinTab, expectNewTab, nextTest, testSubFrame) {
- let appTab = gBrowser.addTab("http://example.com/browser/browser/base/content/test/app_bug575561.html", {skipAnimation: true});
- if (pinTab)
- gBrowser.pinTab(appTab);
- gBrowser.selectedTab = appTab;
- appTab.linkedBrowser.addEventListener("load", onLoad, true);
-
- let loadCount = 0;
- function onLoad() {
- loadCount++;
- if (loadCount < 2)
- return;
-
- appTab.linkedBrowser.removeEventListener("load", onLoad, true);
-
- let browser = gBrowser.getBrowserForTab(appTab);
- if (testSubFrame)
- browser = browser.contentDocument.getElementsByTagName("iframe")[0];
-
- let links = browser.contentDocument.getElementsByTagName("a");
-
- if (expectNewTab)
- gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
- else
- browser.addEventListener("load", onPageLoad, true);
-
- info("Clicking " + links[aLinkIndex].textContent);
- EventUtils.sendMouseEvent({type:"click"}, links[aLinkIndex], browser.contentWindow);
- let linkLocation = links[aLinkIndex].href;
-
- function onPageLoad() {
- browser.removeEventListener("load", onPageLoad, true);
- is(browser.contentDocument.location.href, linkLocation, "Link should not open in a new tab");
- executeSoon(function(){
- gBrowser.removeTab(appTab);
- nextTest();
- });
- }
-
- function onTabOpen(event) {
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
- ok(true, "Link should open a new tab");
- executeSoon(function(){
- gBrowser.removeTab(appTab);
- gBrowser.removeCurrentTab();
- nextTest();
- });
- }
- }
-}
diff --git a/browser/base/content/test/browser_bug575830.js b/browser/base/content/test/browser_bug575830.js
deleted file mode 100644
index 506da4a17..000000000
--- a/browser/base/content/test/browser_bug575830.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-function test() {
- let tab1, tab2;
- const TEST_IMAGE = "http://example.org/browser/browser/base/content/test/moz.png";
-
- waitForExplicitFinish();
-
- Task.spawn(function () {
- tab1 = gBrowser.addTab();
- tab2 = gBrowser.addTab();
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
- yield FullZoomHelper.load(tab1, TEST_IMAGE);
-
- is(ZoomManager.zoom, 1, "initial zoom level for first should be 1");
-
- FullZoom.enlarge();
- let zoom = ZoomManager.zoom;
- isnot(zoom, 1, "zoom level should have changed");
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab2);
- is(ZoomManager.zoom, 1, "initial zoom level for second tab should be 1");
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
- is(ZoomManager.zoom, zoom, "zoom level for first tab should not have changed");
-
- yield FullZoomHelper.removeTabAndWaitForLocationChange(tab1);
- yield FullZoomHelper.removeTabAndWaitForLocationChange(tab2);
- }).then(finish, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug577121.js b/browser/base/content/test/browser_bug577121.js
deleted file mode 100644
index 94d169be0..000000000
--- a/browser/base/content/test/browser_bug577121.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // Open 2 other tabs, and pin the second one. Like that, the initial tab
- // should get closed.
- let testTab1 = gBrowser.addTab();
- let testTab2 = gBrowser.addTab();
- gBrowser.pinTab(testTab2);
-
- // Now execute "Close other Tabs" on the first manually opened tab (tab1).
- // -> tab2 ist pinned, tab1 should remain open and the initial tab should
- // get closed.
- gBrowser.removeAllTabsBut(testTab1);
-
- is(gBrowser.tabs.length, 2, "there are two remaining tabs open");
- is(gBrowser.tabs[0], testTab2, "pinned tab2 stayed open");
- is(gBrowser.tabs[1], testTab1, "tab1 stayed open");
-
- // Cleanup. Close only one tab because we need an opened tab at the end of
- // the test.
- gBrowser.removeTab(testTab2);
-}
diff --git a/browser/base/content/test/browser_bug578534.js b/browser/base/content/test/browser_bug578534.js
deleted file mode 100644
index 5cf83cc66..000000000
--- a/browser/base/content/test/browser_bug578534.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let uriString = "http://example.com/";
- let cookieBehavior = "network.cookie.cookieBehavior";
- let uriObj = Services.io.newURI(uriString, null, null)
- let cp = Components.classes["@mozilla.org/cookie/permission;1"]
- .getService(Components.interfaces.nsICookiePermission);
-
- Services.prefs.setIntPref(cookieBehavior, 2);
-
- cp.setAccess(uriObj, cp.ACCESS_ALLOW);
- gBrowser.selectedTab = gBrowser.addTab(uriString);
- waitForExplicitFinish();
- gBrowser.selectedBrowser.addEventListener("load", onTabLoaded, true);
-
- function onTabLoaded() {
- is(gBrowser.selectedBrowser.contentWindow.navigator.cookieEnabled, true,
- "navigator.cookieEnabled should be true");
- // Clean up
- gBrowser.selectedBrowser.removeEventListener("load", onTabLoaded, true);
- gBrowser.removeTab(gBrowser.selectedTab);
- Services.prefs.setIntPref(cookieBehavior, 0);
- cp.setAccess(uriObj, cp.ACCESS_DEFAULT);
- finish();
- }
-}
diff --git a/browser/base/content/test/browser_bug579872.js b/browser/base/content/test/browser_bug579872.js
deleted file mode 100644
index 63f64598d..000000000
--- a/browser/base/content/test/browser_bug579872.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let newTab = gBrowser.addTab();
- waitForExplicitFinish();
- newTab.linkedBrowser.addEventListener("load", mainPart, true);
-
- function mainPart() {
- gBrowser.pinTab(newTab);
- gBrowser.selectedTab = newTab;
-
- openUILinkIn("javascript:var x=0;", "current");
- is(gBrowser.tabs.length, 2, "Should open in current tab");
-
- openUILinkIn("http://example.com/1", "current");
- is(gBrowser.tabs.length, 2, "Should open in current tab");
-
- openUILinkIn("http://example.org/", "current");
- is(gBrowser.tabs.length, 3, "Should open in new tab");
-
- newTab.removeEventListener("load", mainPart, true);
- gBrowser.removeTab(newTab);
- gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
- finish();
- }
- newTab.linkedBrowser.loadURI("http://example.com");
-}
diff --git a/browser/base/content/test/browser_bug580638.js b/browser/base/content/test/browser_bug580638.js
deleted file mode 100644
index ead51105e..000000000
--- a/browser/base/content/test/browser_bug580638.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- function testState(aPinned) {
- function elemAttr(id, attr) document.getElementById(id).getAttribute(attr);
-
- if (aPinned) {
- is(elemAttr("key_close", "disabled"), "true",
- "key_close should be disabled when a pinned-tab is selected");
- is(elemAttr("menu_close", "key"), "",
- "menu_close shouldn't have a key set when a pinned is selected");
- }
- else {
- is(elemAttr("key_close", "disabled"), "",
- "key_closed shouldn't have disabled state set when a non-pinned tab is selected");
- is(elemAttr("menu_close", "key"), "key_close",
- "menu_close should have key_close set as its key when a non-pinned tab is selected");
- }
- }
-
- let lastSelectedTab = gBrowser.selectedTab;
- ok(!lastSelectedTab.pinned, "We should have started with a regular tab selected");
-
- testState(false);
-
- let pinnedTab = gBrowser.addTab("about:blank");
- gBrowser.pinTab(pinnedTab);
-
- // Just pinning the tab shouldn't change the key state.
- testState(false);
-
- // Test updating key state after selecting a tab.
- gBrowser.selectedTab = pinnedTab;
- testState(true);
-
- gBrowser.selectedTab = lastSelectedTab;
- testState(false);
-
- gBrowser.selectedTab = pinnedTab;
- testState(true);
-
- // Test updating the key state after un/pinning the tab.
- gBrowser.unpinTab(pinnedTab);
- testState(false);
-
- gBrowser.pinTab(pinnedTab);
- testState(true);
-
- // Test updating the key state after removing the tab.
- gBrowser.removeTab(pinnedTab);
- testState(false);
-
- finish();
-}
diff --git a/browser/base/content/test/browser_bug580956.js b/browser/base/content/test/browser_bug580956.js
deleted file mode 100644
index f7cc3c3fe..000000000
--- a/browser/base/content/test/browser_bug580956.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function numClosedTabs()
- Cc["@mozilla.org/browser/sessionstore;1"].
- getService(Ci.nsISessionStore).
- getClosedTabCount(window);
-
-function isUndoCloseEnabled() {
- updateTabContextMenu();
- return !document.getElementById("context_undoCloseTab").disabled;
-}
-
-function test() {
- waitForExplicitFinish();
-
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
- is(numClosedTabs(), 0, "There should be 0 closed tabs.");
- ok(!isUndoCloseEnabled(), "Undo Close Tab should be disabled.");
-
- var tab = gBrowser.addTab("http://mochi.test:8888/");
- var browser = gBrowser.getBrowserForTab(tab);
- browser.addEventListener("load", function() {
- browser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.removeTab(tab);
- ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
-
- finish();
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug581242.js b/browser/base/content/test/browser_bug581242.js
deleted file mode 100644
index 668c0cd41..000000000
--- a/browser/base/content/test/browser_bug581242.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // Create a new tab and load about:addons
- let blanktab = gBrowser.addTab();
- gBrowser.selectedTab = blanktab;
- BrowserOpenAddonsMgr();
-
- is(blanktab, gBrowser.selectedTab, "Current tab should be blank tab");
- // Verify that about:addons loads
- waitForExplicitFinish();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- let browser = blanktab.linkedBrowser;
- is(browser.currentURI.spec, "about:addons", "about:addons should load into blank tab.");
- gBrowser.removeTab(blanktab);
- finish();
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug581253.js b/browser/base/content/test/browser_bug581253.js
deleted file mode 100644
index 3d2575118..000000000
--- a/browser/base/content/test/browser_bug581253.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-let testURL = "data:text/plain,nothing but plain text";
-let testTag = "581253_tag";
-let timerID = -1;
-
-function test() {
- registerCleanupFunction(function() {
- PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- if (timerID > 0) {
- clearTimeout(timerID);
- }
- });
- waitForExplicitFinish();
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", (function(event) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let uri = makeURI(testURL);
- let bmTxn =
- new PlacesCreateBookmarkTransaction(uri,
- PlacesUtils.unfiledBookmarksFolderId,
- -1, "", null, []);
- PlacesUtils.transactionManager.doTransaction(bmTxn);
-
- ok(PlacesUtils.bookmarks.isBookmarked(uri), "the test url is bookmarked");
- waitForStarChange(true, onStarred);
- }), true);
-
- content.location = testURL;
-}
-
-function waitForStarChange(aValue, aCallback) {
- let expectedStatus = aValue ? BookmarkingUI.STATUS_STARRED
- : BookmarkingUI.STATUS_UNSTARRED;
- if (BookmarkingUI.status == BookmarkingUI.STATUS_UPDATING ||
- BookmarkingUI.status != expectedStatus) {
- info("Waiting for star button change.");
- setTimeout(waitForStarChange, 50, aValue, aCallback);
- return;
- }
- aCallback();
-}
-
-function onStarred() {
- is(BookmarkingUI.status, BookmarkingUI.STATUS_STARRED,
- "star button indicates that the page is bookmarked");
-
- let uri = makeURI(testURL);
- let tagTxn = new PlacesTagURITransaction(uri, [testTag]);
- PlacesUtils.transactionManager.doTransaction(tagTxn);
-
- StarUI.panel.addEventListener("popupshown", onPanelShown, false);
- BookmarkingUI.star.click();
-}
-
-function onPanelShown(aEvent) {
- if (aEvent.target == StarUI.panel) {
- StarUI.panel.removeEventListener("popupshown", arguments.callee, false);
- let tagsField = document.getElementById("editBMPanel_tagsField");
- ok(tagsField.value == testTag, "tags field value was set");
- tagsField.focus();
-
- StarUI.panel.addEventListener("popuphidden", onPanelHidden, false);
- let removeButton = document.getElementById("editBookmarkPanelRemoveButton");
- removeButton.click();
- }
-}
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback)
-{
- let observer = {
- observe: function(aSubject, aTopic, aData)
- {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback(aSubject, aTopic, aData);
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
-function onPanelHidden(aEvent) {
- if (aEvent.target == StarUI.panel) {
- StarUI.panel.removeEventListener("popuphidden", arguments.callee, false);
-
- executeSoon(function() {
- ok(!PlacesUtils.bookmarks.isBookmarked(makeURI(testURL)),
- "the bookmark for the test url has been removed");
- is(BookmarkingUI.status, BookmarkingUI.STATUS_UNSTARRED,
- "star button indicates that the bookmark has been removed");
- gBrowser.removeCurrentTab();
- waitForClearHistory(finish);
- });
- }
-}
diff --git a/browser/base/content/test/browser_bug581947.js b/browser/base/content/test/browser_bug581947.js
deleted file mode 100644
index 458cb7473..000000000
--- a/browser/base/content/test/browser_bug581947.js
+++ /dev/null
@@ -1,90 +0,0 @@
-function check(aElementName, aBarred) {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let content = doc.getElementById('content');
-
- let e = doc.createElement(aElementName);
- content.appendChild(e);
-
- ok(!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown when the element is valid");
-
- e.setCustomValidity('foo');
- if (aBarred) {
- ok(!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown when the element is barred from constraint validation");
- } else {
- ok(tooltip.fillInPageTooltip(e),
- e.tagName + " " +"A tooltip should be shown when the element isn't valid");
- }
-
- e.setAttribute('title', '');
- ok (!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown if the title attribute is set");
-
- e.removeAttribute('title');
- content.setAttribute('novalidate', '');
- ok (!tooltip.fillInPageTooltip(e),
- "No tooltip should be shown if the novalidate attribute is set on the form owner");
- content.removeAttribute('novalidate');
-
- content.removeChild(e);
-}
-
-function todo_check(aElementName, aBarred) {
- let doc = gBrowser.contentDocument;
- let tooltip = document.getElementById("aHTMLTooltip");
- let content = doc.getElementById('content');
-
- let e = doc.createElement(aElementName);
- content.appendChild(e);
-
- let cought = false;
- try {
- e.setCustomValidity('foo');
- } catch (e) {
- cought = true;
- }
-
- todo(!cought, "setCustomValidity should exist for " + aElementName);
-
- content.removeChild(e);
-}
-
-function test () {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- let testData = [
- /* element name, barred */
- [ 'input', false ],
- [ 'textarea', false ],
- [ 'button', true ],
- [ 'select', false ],
- [ 'output', true ],
- [ 'fieldset', true ],
- [ 'object', true ],
- ];
-
- for each (let data in testData) {
- check(data[0], data[1]);
- }
-
- let todo_testData = [
- [ 'keygen', 'false' ],
- ];
-
- for each(let data in todo_testData) {
- todo_check(data[0], data[1]);
- }
-
- gBrowser.removeCurrentTab();
- finish();
- }, true);
-
- content.location =
- "data:text/html,<!DOCTYPE html><html><body><form id='content'></form></body></html>";
-}
-
diff --git a/browser/base/content/test/browser_bug585558.js b/browser/base/content/test/browser_bug585558.js
deleted file mode 100644
index f2ed7fd94..000000000
--- a/browser/base/content/test/browser_bug585558.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-let tabs = [];
-
-function addTab(aURL) {
- tabs.push(gBrowser.addTab(aURL, {skipAnimation: true}));
-}
-
-function testAttrib(elem, attrib, attribValue, msg) {
- is(elem.hasAttribute(attrib), attribValue, msg);
-}
-
-function test() {
- waitForExplicitFinish();
- is(gBrowser.tabs.length, 1, "one tab is open initially");
-
- // Add several new tabs in sequence, hiding some, to ensure that the
- // correct attributes get set
-
- addTab("http://mochi.test:8888/#0");
- addTab("http://mochi.test:8888/#1");
- addTab("http://mochi.test:8888/#2");
- addTab("http://mochi.test:8888/#3");
-
- gBrowser.selectedTab = gBrowser.tabs[0];
- testAttrib(gBrowser.tabs[0], "first-visible-tab", true,
- "First tab marked first-visible-tab!");
- testAttrib(gBrowser.tabs[4], "last-visible-tab", true,
- "Fifth tab marked last-visible-tab!");
- testAttrib(gBrowser.tabs[0], "selected", true, "First tab marked selected!");
- testAttrib(gBrowser.tabs[0], "afterselected-visible", false,
- "First tab not marked afterselected-visible!");
- testAttrib(gBrowser.tabs[1], "afterselected-visible", true,
- "Second tab marked afterselected-visible!");
- gBrowser.hideTab(gBrowser.tabs[1]);
- executeSoon(test_hideSecond);
-}
-
-function test_hideSecond() {
- testAttrib(gBrowser.tabs[2], "afterselected-visible", true,
- "Third tab marked afterselected-visible!");
- gBrowser.showTab(gBrowser.tabs[1])
- executeSoon(test_showSecond);
-}
-
-function test_showSecond() {
- testAttrib(gBrowser.tabs[1], "afterselected-visible", true,
- "Second tab marked afterselected-visible!");
- testAttrib(gBrowser.tabs[2], "afterselected-visible", false,
- "Third tab not marked as afterselected-visible!");
- gBrowser.selectedTab = gBrowser.tabs[1];
- gBrowser.hideTab(gBrowser.tabs[0]);
- executeSoon(test_hideFirst);
-}
-
-function test_hideFirst() {
- testAttrib(gBrowser.tabs[0], "first-visible-tab", false,
- "Hidden first tab not marked first-visible-tab!");
- testAttrib(gBrowser.tabs[1], "first-visible-tab", true,
- "Second tab marked first-visible-tab!");
- gBrowser.showTab(gBrowser.tabs[0]);
- executeSoon(test_showFirst);
-}
-
-function test_showFirst() {
- testAttrib(gBrowser.tabs[0], "first-visible-tab", true,
- "First tab marked first-visible-tab!");
- gBrowser.selectedTab = gBrowser.tabs[2];
- testAttrib(gBrowser.tabs[3], "afterselected-visible", true,
- "Fourth tab marked afterselected-visible!");
-
- gBrowser.moveTabTo(gBrowser.selectedTab, 1);
- executeSoon(test_movedLower);
-}
-
-function test_movedLower() {
- testAttrib(gBrowser.tabs[2], "afterselected-visible", true,
- "Third tab marked afterselected-visible!");
- test_hoverOne();
-}
-
-function test_hoverOne() {
- EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[4], { type: "mousemove" });
- testAttrib(gBrowser.tabs[3], "beforehovered", true, "Fourth tab marked beforehovered");
- EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[3], { type: "mousemove" });
- testAttrib(gBrowser.tabs[2], "beforehovered", true, "Third tab marked beforehovered!");
- testAttrib(gBrowser.tabs[2], "afterhovered", false, "Third tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[4], "afterhovered", true, "Fifth tab marked afterhovered!");
- testAttrib(gBrowser.tabs[4], "beforehovered", false, "Fifth tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[0], "beforehovered", false, "First tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[0], "afterhovered", false, "First tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[1], "beforehovered", false, "Second tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[1], "afterhovered", false, "Second tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[3], "beforehovered", false, "Fourth tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[3], "afterhovered", false, "Fourth tab not marked afterhovered!");
- gBrowser.removeTab(tabs.pop());
- executeSoon(test_hoverStatePersistence);
-}
-
-function test_hoverStatePersistence() {
- // Test that the afterhovered and beforehovered attributes are still there when
- // a tab is selected and then unselected again. See bug 856107.
-
- function assertState() {
- testAttrib(gBrowser.tabs[0], "beforehovered", true, "First tab still marked beforehovered!");
- testAttrib(gBrowser.tabs[0], "afterhovered", false, "First tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[2], "afterhovered", true, "Third tab still marked afterhovered!");
- testAttrib(gBrowser.tabs[2], "beforehovered", false, "Third tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[1], "beforehovered", false, "Second tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[1], "afterhovered", false, "Second tab not marked afterhovered!");
- testAttrib(gBrowser.tabs[3], "beforehovered", false, "Fourth tab not marked beforehovered!");
- testAttrib(gBrowser.tabs[3], "afterhovered", false, "Fourth tab not marked afterhovered!");
- }
-
- gBrowser.selectedTab = gBrowser.tabs[3];
- EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[1], { type: "mousemove" });
- assertState();
- gBrowser.selectedTab = gBrowser.tabs[1];
- assertState();
- gBrowser.selectedTab = gBrowser.tabs[3];
- assertState();
- executeSoon(test_pinning);
-}
-
-function test_pinning() {
- gBrowser.selectedTab = gBrowser.tabs[3];
- testAttrib(gBrowser.tabs[3], "last-visible-tab", true,
- "Fourth tab marked last-visible-tab!");
- testAttrib(gBrowser.tabs[3], "selected", true, "Fourth tab marked selected!");
- testAttrib(gBrowser.tabs[3], "afterselected-visible", false,
- "Fourth tab not marked afterselected-visible!");
- // Causes gBrowser.tabs to change indices
- gBrowser.pinTab(gBrowser.tabs[3]);
- testAttrib(gBrowser.tabs[3], "last-visible-tab", true,
- "Fourth tab marked last-visible-tab!");
- testAttrib(gBrowser.tabs[1], "afterselected-visible", true,
- "Second tab marked afterselected-visible!");
- testAttrib(gBrowser.tabs[0], "first-visible-tab", true,
- "First tab marked first-visible-tab!");
- testAttrib(gBrowser.tabs[0], "selected", true, "First tab marked selected!");
- gBrowser.selectedTab = gBrowser.tabs[1];
- testAttrib(gBrowser.tabs[2], "afterselected-visible", true,
- "Third tab marked afterselected-visible!");
- test_cleanUp();
-}
-
-function test_cleanUp() {
- tabs.forEach(gBrowser.removeTab, gBrowser);
- finish();
-}
diff --git a/browser/base/content/test/browser_bug585785.js b/browser/base/content/test/browser_bug585785.js
deleted file mode 100644
index adbb5a47e..000000000
--- a/browser/base/content/test/browser_bug585785.js
+++ /dev/null
@@ -1,35 +0,0 @@
-var tab;
-
-function test() {
- waitForExplicitFinish();
-
- tab = gBrowser.addTab();
- isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in");
-
- // Try to remove the tab right before the opening animation's first frame
- window.mozRequestAnimationFrame(checkAnimationState);
-}
-
-function checkAnimationState() {
- is(tab.getAttribute("fadein"), "true", "tab opening animation initiated");
-
- info(window.getComputedStyle(tab).maxWidth);
- gBrowser.removeTab(tab, { animate: true });
- if (!tab.parentNode) {
- ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
- finish();
- return;
- }
-
- info("tab didn't close immediately, so the tab opening animation must have started moving");
- info("waiting for the tab to close asynchronously");
- tab.addEventListener("transitionend", function (event) {
- if (event.propertyName == "max-width") {
- tab.removeEventListener("transitionend", arguments.callee, false);
- executeSoon(function () {
- ok(!tab.parentNode, "tab removed asynchronously");
- finish();
- });
- }
- }, false);
-}
diff --git a/browser/base/content/test/browser_bug585830.js b/browser/base/content/test/browser_bug585830.js
deleted file mode 100644
index bf99c2c90..000000000
--- a/browser/base/content/test/browser_bug585830.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let tab1 = gBrowser.selectedTab;
- let tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
- let tab3 = gBrowser.addTab();
- gBrowser.selectedTab = tab2;
-
- gBrowser.removeCurrentTab({animate: true});
- gBrowser.tabContainer.advanceSelectedTab(-1, true);
- is(gBrowser.selectedTab, tab1, "First tab should be selected");
- gBrowser.removeTab(tab2);
-
- // test for "null has no properties" fix. See Bug 585830 Comment 13
- gBrowser.removeCurrentTab({animate: true});
- try {
- gBrowser.tabContainer.advanceSelectedTab(-1, false);
- } catch(err) {
- ok(false, "Shouldn't throw");
- }
-
- gBrowser.removeTab(tab1);
-}
diff --git a/browser/base/content/test/browser_bug590206.js b/browser/base/content/test/browser_bug590206.js
deleted file mode 100644
index dc9e48ad8..000000000
--- a/browser/base/content/test/browser_bug590206.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const DUMMY = "browser/browser/base/content/test/dummy_page.html";
-
-function loadNewTab(aURL, aCallback) {
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.loadURI(aURL);
-
- gBrowser.selectedBrowser.addEventListener("load", function() {
- if (gBrowser.selectedBrowser.currentURI.spec != aURL)
- return;
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- aCallback(gBrowser.selectedTab);
- }, true);
-}
-
-function getIdentityMode() {
- return document.getElementById("identity-box").className;
-}
-
-var TESTS = [
-function test_webpage() {
- let oldTab = gBrowser.selectedTab;
-
- loadNewTab("http://example.com/" + DUMMY, function(aNewTab) {
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = oldTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = aNewTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.removeTab(aNewTab);
-
- runNextTest();
- });
-},
-
-function test_blank() {
- let oldTab = gBrowser.selectedTab;
-
- loadNewTab("about:blank", function(aNewTab) {
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = oldTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = aNewTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.removeTab(aNewTab);
-
- runNextTest();
- });
-},
-
-function test_chrome() {
- let oldTab = gBrowser.selectedTab;
-
- loadNewTab("chrome://mozapps/content/extensions/extensions.xul", function(aNewTab) {
- is(getIdentityMode(), "chromeUI", "Identity should be chrome");
-
- gBrowser.selectedTab = oldTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = aNewTab;
- is(getIdentityMode(), "chromeUI", "Identity should be chrome");
-
- gBrowser.removeTab(aNewTab);
-
- runNextTest();
- });
-},
-
-function test_https() {
- let oldTab = gBrowser.selectedTab;
-
- loadNewTab("https://example.com/" + DUMMY, function(aNewTab) {
- is(getIdentityMode(), "verifiedDomain", "Identity should be verified");
-
- gBrowser.selectedTab = oldTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = aNewTab;
- is(getIdentityMode(), "verifiedDomain", "Identity should be verified");
-
- gBrowser.removeTab(aNewTab);
-
- runNextTest();
- });
-},
-
-function test_addons() {
- let oldTab = gBrowser.selectedTab;
-
- loadNewTab("about:addons", function(aNewTab) {
- is(getIdentityMode(), "chromeUI", "Identity should be chrome");
-
- gBrowser.selectedTab = oldTab;
- is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
-
- gBrowser.selectedTab = aNewTab;
- is(getIdentityMode(), "chromeUI", "Identity should be chrome");
-
- gBrowser.removeTab(aNewTab);
-
- runNextTest();
- });
-}
-];
-
-var gTestStart = null;
-
-function runNextTest() {
- if (gTestStart)
- info("Test part took " + (Date.now() - gTestStart) + "ms");
-
- if (TESTS.length == 0) {
- finish();
- return;
- }
-
- info("Running " + TESTS[0].name);
- gTestStart = Date.now();
- TESTS.shift()();
-};
-
-function test() {
- waitForExplicitFinish();
-
- runNextTest();
-}
diff --git a/browser/base/content/test/browser_bug592338.js b/browser/base/content/test/browser_bug592338.js
deleted file mode 100644
index a9ec62566..000000000
--- a/browser/base/content/test/browser_bug592338.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
-
-var tempScope = {};
-Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
-var LightweightThemeManager = tempScope.LightweightThemeManager;
-
-function wait_for_notification(aCallback) {
- PopupNotifications.panel.addEventListener("popupshown", function() {
- PopupNotifications.panel.removeEventListener("popupshown", arguments.callee, false);
- aCallback(PopupNotifications.panel);
- }, false);
-}
-
-var TESTS = [
-function test_install_lwtheme() {
- is(LightweightThemeManager.currentTheme, null, "Should be no lightweight theme selected");
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- gBrowser.selectedTab = gBrowser.addTab("http://example.com/browser/browser/base/content/test/bug592338.html");
- gBrowser.selectedBrowser.addEventListener("pageshow", function() {
- if (gBrowser.contentDocument.location.href == "about:blank")
- return;
-
- gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
-
- executeSoon(function() {
- var link = gBrowser.contentDocument.getElementById("theme-install");
- EventUtils.synthesizeMouse(link, 2, 2, {}, gBrowser.contentWindow);
-
- is(LightweightThemeManager.currentTheme.id, "test", "Should have installed the test theme");
-
- LightweightThemeManager.currentTheme = null;
- gBrowser.removeTab(gBrowser.selectedTab);
-
- Services.perms.remove("example.com", "install");
-
- runNextTest();
- });
- }, false);
-},
-
-function test_lwtheme_switch_theme() {
- is(LightweightThemeManager.currentTheme, null, "Should be no lightweight theme selected");
-
- AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
- aAddon.userDisabled = false;
- ok(aAddon.isActive, "Theme should have immediately enabled");
- Services.prefs.setBoolPref("extensions.dss.enabled", false);
-
- var pm = Services.perms;
- pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
- gBrowser.selectedTab = gBrowser.addTab("http://example.com/browser/browser/base/content/test/bug592338.html");
- gBrowser.selectedBrowser.addEventListener("pageshow", function() {
- if (gBrowser.contentDocument.location.href == "about:blank")
- return;
-
- gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
-
- executeSoon(function() {
- var link = gBrowser.contentDocument.getElementById("theme-install");
- wait_for_notification(function(aPanel) {
- is(LightweightThemeManager.currentTheme, null, "Should not have installed the test lwtheme");
- ok(aAddon.isActive, "Test theme should still be active");
-
- let notification = aPanel.childNodes[0];
- is(notification.button.label, "Restart Now", "Should have seen the right button");
-
- ok(aAddon.userDisabled, "Should be waiting to disable the test theme");
- aAddon.userDisabled = false;
- Services.prefs.setBoolPref("extensions.dss.enabled", true);
-
- gBrowser.removeTab(gBrowser.selectedTab);
-
- Services.perms.remove("example.com", "install");
-
- runNextTest();
- });
- EventUtils.synthesizeMouse(link, 2, 2, {}, gBrowser.contentWindow);
- });
- }, false);
- });
-}
-];
-
-function runNextTest() {
- AddonManager.getAllInstalls(function(aInstalls) {
- is(aInstalls.length, 0, "Should be no active installs");
-
- if (TESTS.length == 0) {
- AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
- aAddon.uninstall();
-
- Services.prefs.setBoolPref("extensions.logging.enabled", false);
- Services.prefs.setBoolPref("extensions.dss.enabled", false);
-
- finish();
- });
- return;
- }
-
- info("Running " + TESTS[0].name);
- TESTS.shift()();
- });
-};
-
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref("extensions.logging.enabled", true);
-
- AddonManager.getInstallForURL(TESTROOT + "theme.xpi", function(aInstall) {
- aInstall.addListener({
- onInstallEnded: function(aInstall, aAddon) {
- AddonManager.getAddonByID("theme-xpi@tests.mozilla.org", function(aAddon) {
- isnot(aAddon, null, "Should have installed the test theme.");
-
- // In order to switch themes while the test is running we turn on dynamic
- // theme switching. This means the test isn't exactly correct but should
- // do some good
- Services.prefs.setBoolPref("extensions.dss.enabled", true);
-
- runNextTest();
- });
- }
- });
-
- aInstall.install();
- }, "application/x-xpinstall");
-}
diff --git a/browser/base/content/test/browser_bug594131.js b/browser/base/content/test/browser_bug594131.js
deleted file mode 100644
index d68d1979a..000000000
--- a/browser/base/content/test/browser_bug594131.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let newTab = gBrowser.addTab("http://example.com");
- waitForExplicitFinish();
- newTab.linkedBrowser.addEventListener("load", mainPart, true);
-
- function mainPart() {
- newTab.linkedBrowser.removeEventListener("load", mainPart, true);
-
- gBrowser.pinTab(newTab);
- gBrowser.selectedTab = newTab;
-
- openUILinkIn("http://example.org/", "current", { inBackground: true });
- isnot(gBrowser.selectedTab, newTab, "shouldn't load in background");
-
- gBrowser.removeTab(newTab);
- gBrowser.removeTab(gBrowser.tabs[1]); // example.org tab
- finish();
- }
-}
diff --git a/browser/base/content/test/browser_bug595507.js b/browser/base/content/test/browser_bug595507.js
deleted file mode 100644
index 65a10eace..000000000
--- a/browser/base/content/test/browser_bug595507.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var gInvalidFormPopup = document.getElementById('invalid-form-popup');
-ok(gInvalidFormPopup,
- "The browser should have a popup to show when a form is invalid");
-
-/**
- * Make sure that the form validation error message shows even if the form is in an iframe.
- */
-function test()
-{
- waitForExplicitFinish();
-
- let uri = "data:text/html,<iframe src=\"data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input required id='i'><input id='s' type='submit'></form>\"</iframe>";
- let tab = gBrowser.addTab();
-
- gInvalidFormPopup.addEventListener("popupshown", function() {
- gInvalidFormPopup.removeEventListener("popupshown", arguments.callee, false);
-
- let doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument;
- is(doc.activeElement, doc.getElementById('i'),
- "First invalid element should be focused");
-
- ok(gInvalidFormPopup.state == 'showing' || gInvalidFormPopup.state == 'open',
- "The invalid form popup should be shown");
-
- // Clean-up and next test.
- gBrowser.removeTab(gBrowser.selectedTab, {animate: false});
- executeSoon(finish);
- }, false);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument
- .getElementById('s').click();
- }, true);
-
- gBrowser.selectedTab = tab;
- gBrowser.selectedTab.linkedBrowser.loadURI(uri);
-}
diff --git a/browser/base/content/test/browser_bug596687.js b/browser/base/content/test/browser_bug596687.js
deleted file mode 100644
index ccf6f5e35..000000000
--- a/browser/base/content/test/browser_bug596687.js
+++ /dev/null
@@ -1,26 +0,0 @@
-function test() {
- var tab = gBrowser.addTab(null, {skipAnimation: true});
- gBrowser.selectedTab = tab;
-
- var gotTabAttrModified = false;
- var gotTabClose = false;
-
- function onTabClose() {
- gotTabClose = true;
- tab.addEventListener("TabAttrModified", onTabAttrModified, false);
- }
-
- function onTabAttrModified() {
- gotTabAttrModified = true;
- }
-
- tab.addEventListener("TabClose", onTabClose, false);
-
- gBrowser.removeTab(tab);
-
- ok(gotTabClose, "should have got the TabClose event");
- ok(!gotTabAttrModified, "shouldn't have got the TabAttrModified event after TabClose");
-
- tab.removeEventListener("TabClose", onTabClose, false);
- tab.removeEventListener("TabAttrModified", onTabAttrModified, false);
-}
diff --git a/browser/base/content/test/browser_bug597218.js b/browser/base/content/test/browser_bug597218.js
deleted file mode 100644
index f00e99f72..000000000
--- a/browser/base/content/test/browser_bug597218.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- // establish initial state
- is(gBrowser.tabs.length, 1, "we start with one tab");
-
- // create a tab
- let tab = gBrowser.loadOneTab("about:blank");
- ok(!tab.hidden, "tab starts out not hidden");
- is(gBrowser.tabs.length, 2, "we now have two tabs");
-
- // make sure .hidden is read-only
- tab.hidden = true;
- ok(!tab.hidden, "can't set .hidden directly");
-
- // hide the tab
- gBrowser.hideTab(tab);
- ok(tab.hidden, "tab is hidden");
-
- // now pin it and make sure it gets unhidden
- gBrowser.pinTab(tab);
- ok(tab.pinned, "tab was pinned");
- ok(!tab.hidden, "tab was unhidden");
-
- // try hiding it now that it's pinned; shouldn't be able to
- gBrowser.hideTab(tab);
- ok(!tab.hidden, "tab did not hide");
-
- // clean up
- gBrowser.removeTab(tab);
- is(gBrowser.tabs.length, 1, "we finish with one tab");
-
- finish();
-}
diff --git a/browser/base/content/test/browser_bug598923.js b/browser/base/content/test/browser_bug598923.js
deleted file mode 100644
index 35e9c09f0..000000000
--- a/browser/base/content/test/browser_bug598923.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test:
-// * if add-on is installed to the add-on bar, the bar is made visible.
-// * if add-on is uninstalled from the add-on bar, and no more add-ons there,
-// the bar is hidden.
-
-function test() {
- let aml = AddonsMgrListener;
- ok(aml, "AddonsMgrListener exists");
- // check is hidden
- is(aml.addonBar.collapsed, true, "add-on bar is hidden initially");
- // aob gets the count
- AddonsMgrListener.onInstalling();
- // add an item
- let element = document.createElement("toolbaritem");
- element.id = "bug598923-addon-item";
- aml.addonBar.appendChild(element);
- // aob checks the count, makes visible
- AddonsMgrListener.onInstalled();
- // check is visible
- is(aml.addonBar.collapsed, false, "add-on bar has been made visible");
- // aob gets the count
- AddonsMgrListener.onUninstalling();
- // remove an item
- aml.addonBar.removeChild(element);
- // aob checks the count, makes hidden
- AddonsMgrListener.onUninstalled();
- // check is hidden
- is(aml.addonBar.collapsed, true, "add-on bar is hidden again");
-}
diff --git a/browser/base/content/test/browser_bug599325.js b/browser/base/content/test/browser_bug599325.js
deleted file mode 100644
index d721fc663..000000000
--- a/browser/base/content/test/browser_bug599325.js
+++ /dev/null
@@ -1,21 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- let addonBar = document.getElementById("addon-bar");
- ok(addonBar, "got addon bar");
- ok(!isElementVisible(addonBar), "addon bar initially hidden");
-
- openToolbarCustomizationUI(function () {
- ok(isElementVisible(addonBar),
- "add-on bar is visible during toolbar customization");
-
- closeToolbarCustomizationUI(onClose);
- });
-
- function onClose() {
- ok(!isElementVisible(addonBar),
- "addon bar is hidden after toolbar customization");
-
- finish();
- }
-}
diff --git a/browser/base/content/test/browser_bug609700.js b/browser/base/content/test/browser_bug609700.js
deleted file mode 100644
index 8b4f1ea91..000000000
--- a/browser/base/content/test/browser_bug609700.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- Services.ww.registerNotification(function (aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- Services.ww.unregisterNotification(arguments.callee);
-
- ok(true, "duplicateTabIn opened a new window");
-
- whenDelayedStartupFinished(aSubject, function () {
- executeSoon(function () {
- aSubject.close();
- finish();
- });
- }, false);
- }
- });
-
- duplicateTabIn(gBrowser.selectedTab, "window");
-}
diff --git a/browser/base/content/test/browser_bug616836.js b/browser/base/content/test/browser_bug616836.js
deleted file mode 100644
index efaaa837a..000000000
--- a/browser/base/content/test/browser_bug616836.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function test() {
- is(document.querySelectorAll("#appmenu-popup [accesskey]").length, 0,
- "there should be no items with access keys in the app menu popup");
-}
diff --git a/browser/base/content/test/browser_bug623155.js b/browser/base/content/test/browser_bug623155.js
deleted file mode 100644
index 52ee73b07..000000000
--- a/browser/base/content/test/browser_bug623155.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const REDIRECT_FROM = "https://example.com/browser/browser/base/content/test/" +
- "redirect_bug623155.sjs";
-
-const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
-
-function isRedirectedURISpec(aURISpec) {
- return isRedirectedURI(Services.io.newURI(aURISpec, null, null));
-}
-
-function isRedirectedURI(aURI) {
- // Compare only their before-hash portion.
- return Services.io.newURI(REDIRECT_TO, null, null)
- .equalsExceptRef(aURI);
-}
-
-/*
- Test.
-
-1. Load
-https://example.com/browser/browser/base/content/test/redirect_bug623155.sjs#BG
- in a background tab.
-
-2. The redirected URI is <https://www.bank1.com/#BG>, which displayes a cert
- error page.
-
-3. Switch the tab to foreground.
-
-4. Check the URLbar's value, expecting <https://www.bank1.com/#BG>
-
-5. Load
-https://example.com/browser/browser/base/content/test/redirect_bug623155.sjs#FG
- in the foreground tab.
-
-6. The redirected URI is <https://www.bank1.com/#FG>. And this is also
- a cert-error page.
-
-7. Check the URLbar's value, expecting <https://www.bank1.com/#FG>
-
-8. End.
-
- */
-
-var gNewTab;
-
-function test() {
- waitForExplicitFinish();
-
- // Load a URI in the background.
- gNewTab = gBrowser.addTab(REDIRECT_FROM + "#BG");
- gBrowser.getBrowserForTab(gNewTab)
- .webProgress
- .addProgressListener(gWebProgressListener,
- Components.interfaces.nsIWebProgress
- .NOTIFY_LOCATION);
-}
-
-var gWebProgressListener = {
- QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
- return this;
- throw Components.results.NS_NOINTERFACE;
- },
-
- // ---------------------------------------------------------------------------
- // NOTIFY_LOCATION mode should work fine without these methods.
- //
- //onStateChange: function() {},
- //onStatusChange: function() {},
- //onProgressChange: function() {},
- //onSecurityChange: function() {},
- //----------------------------------------------------------------------------
-
- onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
- if (!aRequest) {
- // This is bug 673752, or maybe initial "about:blank".
- return;
- }
-
- ok(gNewTab, "There is a new tab.");
- ok(isRedirectedURI(aLocation),
- "onLocationChange catches only redirected URI.");
-
- if (aLocation.ref == "BG") {
- // This is background tab's request.
- isnot(gNewTab, gBrowser.selectedTab, "This is a background tab.");
- } else if (aLocation.ref == "FG") {
- // This is foreground tab's request.
- is(gNewTab, gBrowser.selectedTab, "This is a foreground tab.");
- }
- else {
- // We shonuld not reach here.
- ok(false, "This URI hash is not expected:" + aLocation.ref);
- }
-
- let isSelectedTab = gNewTab.selected;
- setTimeout(delayed, 0, isSelectedTab);
- }
-};
-
-function delayed(aIsSelectedTab) {
- // Switch tab and confirm URL bar.
- if (!aIsSelectedTab) {
- gBrowser.selectedTab = gNewTab;
- }
-
- ok(isRedirectedURISpec(content.location.href),
- "The content area is redirected. aIsSelectedTab:" + aIsSelectedTab);
- is(gURLBar.value, content.location.href,
- "The URL bar shows the content URI. aIsSelectedTab:" + aIsSelectedTab);
-
- if (!aIsSelectedTab) {
- // If this was a background request, go on a foreground request.
- content.location = REDIRECT_FROM + "#FG";
- }
- else {
- // Othrewise, nothing to do remains.
- finish();
- }
-}
-
-/* Cleanup */
-registerCleanupFunction(function() {
- if (gNewTab) {
- gBrowser.getBrowserForTab(gNewTab)
- .webProgress
- .removeProgressListener(gWebProgressListener);
-
- gBrowser.removeTab(gNewTab);
- }
- gNewTab = null;
-});
diff --git a/browser/base/content/test/browser_bug623893.js b/browser/base/content/test/browser_bug623893.js
deleted file mode 100644
index 800b8fad5..000000000
--- a/browser/base/content/test/browser_bug623893.js
+++ /dev/null
@@ -1,46 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- loadAndWait("data:text/plain,1", function () {
- loadAndWait("data:text/plain,2", function () {
- loadAndWait("data:text/plain,3", runTests);
- });
- });
-}
-
-function runTests() {
- duplicate(0, "maintained the original index", function () {
- gBrowser.removeCurrentTab();
-
- duplicate(-1, "went back", function () {
- duplicate(1, "went forward", function () {
- gBrowser.removeCurrentTab();
- gBrowser.removeCurrentTab();
- gBrowser.addTab();
- gBrowser.removeCurrentTab();
- finish();
- });
- });
- });
-}
-
-function duplicate(delta, msg, cb) {
- var start = gBrowser.sessionHistory.index;
-
- duplicateTabIn(gBrowser.selectedTab, "tab", delta);
-
- gBrowser.selectedBrowser.addEventListener("pageshow", function () {
- gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
- is(gBrowser.sessionHistory.index, start + delta, msg);
- executeSoon(cb);
- }, false);
-}
-
-function loadAndWait(url, cb) {
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- executeSoon(cb);
- }, true);
-
- gBrowser.loadURI(url);
-}
diff --git a/browser/base/content/test/browser_bug624734.js b/browser/base/content/test/browser_bug624734.js
deleted file mode 100644
index 13369a310..000000000
--- a/browser/base/content/test/browser_bug624734.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Bug 624734 - Star UI has no tooltip until bookmarked page is visited
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", (function(event) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- is(BookmarkingUI.star.getAttribute("tooltiptext"),
- BookmarkingUI._unstarredTooltip,
- "Star icon should have the unstarred tooltip text");
-
- gBrowser.removeCurrentTab();
- finish();
- }), true);
-
- tab.linkedBrowser.loadURI("http://example.com/browser/browser/base/content/test/dummy_page.html");
-}
diff --git a/browser/base/content/test/browser_bug647886.js b/browser/base/content/test/browser_bug647886.js
deleted file mode 100644
index 4a41fc6ad..000000000
--- a/browser/base/content/test/browser_bug647886.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- content.history.pushState({}, "2", "2.html");
-
- testBackButton();
- }, true);
-
- loadURI("http://example.com");
-}
-
-function testBackButton() {
- var backButton = document.getElementById("back-button");
- var rect = backButton.getBoundingClientRect();
-
- info("waiting for the history menu to open");
-
- backButton.addEventListener("popupshown", function (event) {
- backButton.removeEventListener("popupshown", arguments.callee, false);
-
- ok(true, "history menu opened");
- event.target.hidePopup();
- gBrowser.removeTab(gBrowser.selectedTab);
- finish();
- }, false);
-
- EventUtils.synthesizeMouseAtCenter(backButton, {type: "mousedown"});
- EventUtils.synthesizeMouse(backButton, rect.width / 2, rect.height, {type: "mouseup"});
-}
diff --git a/browser/base/content/test/browser_bug655584.js b/browser/base/content/test/browser_bug655584.js
deleted file mode 100644
index 2fb1b4b43..000000000
--- a/browser/base/content/test/browser_bug655584.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Bug 655584 - awesomebar suggestions don't update after tab is closed
-
-function test() {
- var tab1 = gBrowser.addTab();
- var tab2 = gBrowser.addTab();
-
- // When urlbar in a new tab is focused, and a tab switch occurs,
- // the urlbar popup should be closed
- gBrowser.selectedTab = tab2;
- gURLBar.focus(); // focus the urlbar in the tab we will switch to
- gBrowser.selectedTab = tab1;
- gURLBar.openPopup();
- gBrowser.selectedTab = tab2;
- ok(!gURLBar.popupOpen, "urlbar focused in tab to switch to, close popup");
-
- // cleanup
- gBrowser.removeCurrentTab();
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_bug664672.js b/browser/base/content/test/browser_bug664672.js
deleted file mode 100644
index 2064f77d0..000000000
--- a/browser/base/content/test/browser_bug664672.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var tab = gBrowser.addTab();
-
- tab.addEventListener("TabClose", function () {
- tab.removeEventListener("TabClose", arguments.callee, false);
-
- ok(tab.linkedBrowser, "linkedBrowser should still exist during the TabClose event");
-
- executeSoon(function () {
- ok(!tab.linkedBrowser, "linkedBrowser should be gone after the TabClose event");
-
- finish();
- });
- }, false);
-
- gBrowser.removeTab(tab);
-}
diff --git a/browser/base/content/test/browser_bug676619.js b/browser/base/content/test/browser_bug676619.js
deleted file mode 100644
index 23dd66e87..000000000
--- a/browser/base/content/test/browser_bug676619.js
+++ /dev/null
@@ -1,121 +0,0 @@
-function test () {
- waitForExplicitFinish();
-
- var isHTTPS = false;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- if (isHTTPS) {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- }
- let doc = gBrowser.contentDocument;
-
-
- function testLocation(link, url, next) {
- var tabOpenListener = new TabOpenListener(url, function () {
- gBrowser.removeTab(this.tab);
- }, function () {
- next();
- });
-
- doc.getElementById(link).click();
- }
-
- function testLink(link, name, next) {
- addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
- is(doc.getElementById("unload-flag").textContent, "Okay", "beforeunload shouldn't have fired");
- is(win.document.getElementById("location").value, name, "file name should match");
- win.close();
- next();
- });
-
- doc.getElementById(link).click();
- }
-
- testLink("link1", "test.txt",
- testLink.bind(null, "link2", "video.ogg",
- testLink.bind(null, "link3", "just some video",
- testLink.bind(null, "link4", "with-target.txt",
- testLink.bind(null, "link5", "javascript.txt",
- testLink.bind(null, "link6", "test.blob",
- testLocation.bind(null, "link7", "http://example.com/",
- function () {
- if (isHTTPS) {
- gBrowser.removeCurrentTab();
- finish();
- } else {
- // same test again with https:
- isHTTPS = true;
- content.location = "https://example.com:443/browser/browser/base/content/test/download_page.html";
- }
- })))))));
-
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/base/content/test/download_page.html";
-}
-
-
-function addWindowListener(aURL, aCallback) {
- Services.wm.addListener({
- onOpenWindow: function(aXULWindow) {
- info("window opened, waiting for focus");
- Services.wm.removeListener(this);
-
- var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- waitForFocus(function() {
- is(domwindow.document.location.href, aURL, "should have seen the right window open");
- aCallback(domwindow);
- }, domwindow);
- },
- onCloseWindow: function(aXULWindow) { },
- onWindowTitleChange: function(aXULWindow, aNewTitle) { }
- });
-}
-
-// This listens for the next opened tab and checks it is of the right url.
-// opencallback is called when the new tab is fully loaded
-// closecallback is called when the tab is closed
-function TabOpenListener(url, opencallback, closecallback) {
- this.url = url;
- this.opencallback = opencallback;
- this.closecallback = closecallback;
-
- gBrowser.tabContainer.addEventListener("TabOpen", this, false);
-}
-
-TabOpenListener.prototype = {
- url: null,
- opencallback: null,
- closecallback: null,
- tab: null,
- browser: null,
-
- handleEvent: function(event) {
- if (event.type == "TabOpen") {
- gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
- this.tab = event.originalTarget;
- this.browser = this.tab.linkedBrowser;
- gBrowser.addEventListener("pageshow", this, false);
- } else if (event.type == "pageshow") {
- if (event.target.location.href != this.url)
- return;
- gBrowser.removeEventListener("pageshow", this, false);
- this.tab.addEventListener("TabClose", this, false);
- var url = this.browser.contentDocument.location.href;
- is(url, this.url, "Should have opened the correct tab");
- this.opencallback(this.tab, this.browser.contentWindow);
- } else if (event.type == "TabClose") {
- if (event.originalTarget != this.tab)
- return;
- this.tab.removeEventListener("TabClose", this, false);
- this.opencallback = null;
- this.tab = null;
- this.browser = null;
- // Let the window close complete
- executeSoon(this.closecallback);
- this.closecallback = null;
- }
- }
-};
diff --git a/browser/base/content/test/browser_bug678392-1.html b/browser/base/content/test/browser_bug678392-1.html
deleted file mode 100644
index c3b235dd0..000000000
--- a/browser/base/content/test/browser_bug678392-1.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
- <meta content="utf-8" http-equiv="encoding">
- <title>bug678392 - 1</title>
- </head>
- <body>
-bug 678392 test page 1
- </body>
-</html> \ No newline at end of file
diff --git a/browser/base/content/test/browser_bug678392-2.html b/browser/base/content/test/browser_bug678392-2.html
deleted file mode 100644
index 9b18efcf7..000000000
--- a/browser/base/content/test/browser_bug678392-2.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
- <meta content="utf-8" http-equiv="encoding">
- <title>bug678392 - 2</title>
- </head>
- <body>
-bug 678392 test page 2
- </body>
-</html> \ No newline at end of file
diff --git a/browser/base/content/test/browser_bug678392.js b/browser/base/content/test/browser_bug678392.js
deleted file mode 100644
index 3b670dc4a..000000000
--- a/browser/base/content/test/browser_bug678392.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let HTTPROOT = "http://example.com/browser/browser/base/content/test/";
-
-function maxSnapshotOverride() {
- return 5;
-}
-
-function test() {
- waitForExplicitFinish();
-
- BrowserOpenTab();
- let tab = gBrowser.selectedTab;
- registerCleanupFunction(function () { gBrowser.removeTab(tab); });
-
- ok(gHistorySwipeAnimation, "gHistorySwipeAnimation exists.");
-
- if (!gHistorySwipeAnimation._isSupported()) {
- is(gHistorySwipeAnimation.active, false, "History swipe animation is not " +
- "active when not supported by the platform.");
- finish();
- return;
- }
-
- gHistorySwipeAnimation._getMaxSnapshots = maxSnapshotOverride;
- gHistorySwipeAnimation.init();
-
- is(gHistorySwipeAnimation.active, true, "History swipe animation support " +
- "was successfully initialized when supported.");
-
- cleanupArray();
- load(gBrowser.selectedTab, HTTPROOT + "browser_bug678392-2.html", test0);
-}
-
-function load(aTab, aUrl, aCallback) {
- aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
- aEvent.currentTarget.removeEventListener("load", onload, true);
- waitForFocus(aCallback, content);
- }, true);
- aTab.linkedBrowser.loadURI(aUrl);
-}
-
-function cleanupArray() {
- let arr = gHistorySwipeAnimation._trackedSnapshots;
- while (arr.length > 0) {
- delete arr[0].browser.snapshots[arr[0].index]; // delete actual snapshot
- arr.splice(0, 1);
- }
-}
-
-function testArrayCleanup() {
- // Test cleanup of array of tracked snapshots.
- let arr = gHistorySwipeAnimation._trackedSnapshots;
- is(arr.length, 0, "Snapshots were removed correctly from the array of " +
- "tracked snapshots.");
-}
-
-function test0() {
- // Test growing of array of tracked snapshots.
- let tab = gBrowser.selectedTab;
-
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- ok(gHistorySwipeAnimation._trackedSnapshots, "Array for snapshot " +
- "tracking is initialized.");
- is(gHistorySwipeAnimation._trackedSnapshots.length, 1, "Snapshot array " +
- "has correct length of 1 after loading one page.");
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Snapshot array " +
- " has correct length of 2 after loading two pages.");
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- is(gHistorySwipeAnimation._trackedSnapshots.length, 3, "Snapshot " +
- "array has correct length of 3 after loading three pages.");
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Snapshot " +
- "array has correct length of 4 after loading four pages.");
- cleanupArray();
- testArrayCleanup();
- test1();
- });
- });
- });
- });
-}
-
-function verifyRefRemoved(aIndex, aBrowser) {
- let wasFound = false;
- let arr = gHistorySwipeAnimation._trackedSnapshots;
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].index == aIndex && arr[i].browser == aBrowser)
- wasFound = true;
- }
- is(wasFound, false, "The reference that was previously removed was " +
- "still found in the array of tracked snapshots.");
-}
-
-function test1() {
- // Test presence of snpashots in per-tab array of snapshots and removal of
- // individual snapshots (and corresponding references in the array of
- // tracked snapshots).
- let tab = gBrowser.selectedTab;
-
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- var historyIndex = gBrowser.webNavigation.sessionHistory.index - 1;
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- let browser = gBrowser.selectedBrowser;
- ok(browser.snapshots, "Array of snapshots exists in browser.");
- ok(browser.snapshots[historyIndex], "First page exists in snapshot " +
- "array.");
- ok(browser.snapshots[historyIndex + 1], "Second page exists in " +
- "snapshot array.");
- ok(browser.snapshots[historyIndex + 2], "Third page exists in " +
- "snapshot array.");
- ok(browser.snapshots[historyIndex + 3], "Fourth page exists in " +
- "snapshot array.");
- is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Length of " +
- "array of tracked snapshots is equal to 4 after loading four " +
- "pages.");
-
- // Test removal of reference in the middle of the array.
- gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex + 1,
- browser);
- verifyRefRemoved(historyIndex + 1, browser);
- is(gHistorySwipeAnimation._trackedSnapshots.length, 3, "Length of " +
- "array of tracked snapshots is equal to 3 after removing one" +
- "reference from the array with length 4.");
-
- // Test removal of reference at end of array.
- gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex + 3,
- browser);
- verifyRefRemoved(historyIndex + 3, browser);
- is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Length of " +
- "array of tracked snapshots is equal to 2 after removing two" +
- "references from the array with length 4.");
-
- // Test removal of reference at head of array.
- gHistorySwipeAnimation._removeTrackedSnapshot(historyIndex,
- browser);
- verifyRefRemoved(historyIndex, browser);
- is(gHistorySwipeAnimation._trackedSnapshots.length, 1, "Length of " +
- "array of tracked snapshots is equal to 1 after removing three" +
- "references from the array with length 4.");
-
- cleanupArray();
- test2();
- });
- });
- });
- });
-}
-
-function test2() {
- // Test growing of snapshot array across tabs.
- let tab = gBrowser.selectedTab;
-
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- var historyIndex = gBrowser.webNavigation.sessionHistory.index - 1;
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- is(gHistorySwipeAnimation._trackedSnapshots.length, 2, "Length of " +
- "snapshot array is equal to 2 after loading two pages");
- let prevTab = tab;
- tab = gBrowser.addTab("about:newtab");
- gBrowser.selectedTab = tab;
- load(tab, HTTPROOT + "browser_bug678392-2.html" /* initial page */,
- function() {
- load(tab, HTTPROOT + "browser_bug678392-1.html", function() {
- load(tab, HTTPROOT + "browser_bug678392-2.html", function() {
- is(gHistorySwipeAnimation._trackedSnapshots.length, 4, "Length " +
- "of snapshot array is equal to 4 after loading two pages in " +
- "two tabs each.");
- gBrowser.removeCurrentTab();
- gBrowser.selectedTab = prevTab;
- cleanupArray();
- test3();
- });
- });
- });
- });
- });
-}
-
-function test3() {
- // Test uninit of gHistorySwipeAnimation.
- // This test MUST be the last one to execute.
- gHistorySwipeAnimation.uninit();
- is(gHistorySwipeAnimation.active, false, "History swipe animation support " +
- "was successfully uninitialized");
- finish();
-}
diff --git a/browser/base/content/test/browser_bug710878.js b/browser/base/content/test/browser_bug710878.js
deleted file mode 100644
index aaec82787..000000000
--- a/browser/base/content/test/browser_bug710878.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- let doc;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(performTest, content);
- }, true);
-
- content.location = "data:text/html,<a href='%23xxx'><span>word1 <span> word2 </span></span><span> word3</span></a>";
-
- function performTest()
- {
- let link = doc.querySelector("a");;
- let text = gatherTextUnder(link);
- is(text, "word1 word2 word3", "Text under link is correctly computed.");
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
-
diff --git a/browser/base/content/test/browser_bug719271.js b/browser/base/content/test/browser_bug719271.js
deleted file mode 100644
index 1c0076ac1..000000000
--- a/browser/base/content/test/browser_bug719271.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const TEST_PAGE = "http://example.org/browser/browser/base/content/test/zoom_test.html";
-const TEST_VIDEO = "http://example.org/browser/browser/base/content/test/video.ogg";
-
-var gTab1, gTab2, gLevel1, gLevel2;
-
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function () {
- gTab1 = gBrowser.addTab();
- gTab2 = gBrowser.addTab();
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- yield FullZoomHelper.load(gTab1, TEST_PAGE);
- yield FullZoomHelper.load(gTab2, TEST_VIDEO);
- }).then(zoomTab1, FullZoomHelper.failAndContinue(finish));
-}
-
-function zoomTab1() {
- Task.spawn(function () {
- is(gBrowser.selectedTab, gTab1, "Tab 1 is selected");
- FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1");
- FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1");
-
- FullZoom.enlarge();
- gLevel1 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab1));
-
- ok(gLevel1 > 1, "New zoom for tab 1 should be greater than 1");
- FullZoomHelper.zoomTest(gTab2, 1, "Zooming tab 1 should not affect tab 2");
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
- FullZoomHelper.zoomTest(gTab2, 1, "Tab 2 is still unzoomed after it is selected");
- FullZoomHelper.zoomTest(gTab1, gLevel1, "Tab 1 is still zoomed");
- }).then(zoomTab2, FullZoomHelper.failAndContinue(finish));
-}
-
-function zoomTab2() {
- Task.spawn(function () {
- is(gBrowser.selectedTab, gTab2, "Tab 2 is selected");
-
- FullZoom.reduce();
- let gLevel2 = ZoomManager.getZoomForBrowser(gBrowser.getBrowserForTab(gTab2));
-
- ok(gLevel2 < 1, "New zoom for tab 2 should be less than 1");
- FullZoomHelper.zoomTest(gTab1, gLevel1, "Zooming tab 2 should not affect tab 1");
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- FullZoomHelper.zoomTest(gTab1, gLevel1, "Tab 1 should have the same zoom after it's selected");
- }).then(testNavigation, FullZoomHelper.failAndContinue(finish));
-}
-
-function testNavigation() {
- Task.spawn(function () {
- yield FullZoomHelper.load(gTab1, TEST_VIDEO);
- FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 when a video was loaded");
- yield waitForNextTurn(); // trying to fix orange bug 806046
- yield FullZoomHelper.navigate(FullZoomHelper.BACK);
- FullZoomHelper.zoomTest(gTab1, gLevel1, "Zoom should be restored when a page is loaded");
- yield waitForNextTurn(); // trying to fix orange bug 806046
- yield FullZoomHelper.navigate(FullZoomHelper.FORWARD);
- FullZoomHelper.zoomTest(gTab1, 1, "Zoom should be 1 again when navigating back to a video");
- }).then(finishTest, FullZoomHelper.failAndContinue(finish));
-}
-
-function waitForNextTurn() {
- let deferred = Promise.defer();
- setTimeout(function () deferred.resolve(), 0);
- return deferred.promise;
-}
-
-var finishTestStarted = false;
-function finishTest() {
- Task.spawn(function () {
- ok(!finishTestStarted, "finishTest called more than once");
- finishTestStarted = true;
-
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab1);
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab1);
- yield FullZoomHelper.selectTabAndWaitForLocationChange(gTab2);
- FullZoom.reset();
- yield FullZoomHelper.removeTabAndWaitForLocationChange(gTab2);
- }).then(finish, FullZoomHelper.failAndContinue(finish));
-}
diff --git a/browser/base/content/test/browser_bug724239.js b/browser/base/content/test/browser_bug724239.js
deleted file mode 100644
index 766002eca..000000000
--- a/browser/base/content/test/browser_bug724239.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
- BrowserOpenTab();
-
- let tab = gBrowser.selectedTab;
- let browser = tab.linkedBrowser;
-
- registerCleanupFunction(function () { gBrowser.removeTab(tab); });
-
- whenBrowserLoaded(browser, function () {
- browser.loadURI("http://example.com/");
-
- whenBrowserLoaded(browser, function () {
- ok(!gBrowser.canGoBack, "about:newtab wasn't added to the session history");
- finish();
- });
- });
-}
-
-function whenBrowserLoaded(aBrowser, aCallback) {
- if (aBrowser.contentDocument.readyState == "complete") {
- executeSoon(aCallback);
- return;
- }
-
- aBrowser.addEventListener("load", function onLoad() {
- aBrowser.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug734076.js b/browser/base/content/test/browser_bug734076.js
deleted file mode 100644
index 3e1cae716..000000000
--- a/browser/base/content/test/browser_bug734076.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
- registerCleanupFunction(function () {
- gBrowser.removeTab(tab);
- });
-
- let browser = tab.linkedBrowser;
- browser.stop(); // stop the about:blank load
-
- let writeDomainURL = encodeURI("data:text/html,<script>document.write(document.domain);</script>");
- let tests = [
- {
- name: "view background image",
- url: "http://mochi.test:8888/",
- go: function (cb) {
- let contentBody = browser.contentDocument.body;
- contentBody.style.backgroundImage = "url('" + writeDomainURL + "')";
- doOnLoad(function () {
- let domain = browser.contentDocument.body.textContent;
- is(domain, "", "no domain was inherited for view background image");
- cb();
- });
-
- let contextMenu = initContextMenu(contentBody);
- contextMenu.viewBGImage();
- }
- },
- {
- name: "view image",
- url: "http://mochi.test:8888/",
- go: function (cb) {
- doOnLoad(function () {
- let domain = browser.contentDocument.body.textContent;
- is(domain, "", "no domain was inherited for view image");
- cb();
- });
-
- let doc = browser.contentDocument;
- let img = doc.createElement("img");
- img.setAttribute("src", writeDomainURL);
- doc.body.appendChild(img);
-
- let contextMenu = initContextMenu(img);
- contextMenu.viewMedia();
- }
- },
- {
- name: "show only this frame",
- url: "http://mochi.test:8888/",
- go: function (cb) {
- doOnLoad(function () {
- let domain = browser.contentDocument.body.textContent;
- is(domain, "", "no domain was inherited for 'show only this frame'");
- cb();
- });
-
- let doc = browser.contentDocument;
- let iframe = doc.createElement("iframe");
- iframe.setAttribute("src", writeDomainURL);
- doc.body.appendChild(iframe);
-
- iframe.addEventListener("load", function onload() {
- let contextMenu = initContextMenu(iframe.contentDocument.body);
- contextMenu.showOnlyThisFrame();
- }, false);
- }
- }
- ];
-
- function doOnLoad(cb) {
- browser.addEventListener("load", function onLoad(e) {
- if (e.target != browser.contentDocument)
- return;
- browser.removeEventListener("load", onLoad, true);
- cb();
- }, true);
- }
-
- function doNext() {
- let test = tests.shift();
- if (test) {
- info("Running test: " + test.name);
- doOnLoad(function () {
- test.go(function () {
- executeSoon(doNext);
- });
- });
- browser.contentDocument.location = test.url;
- } else {
- executeSoon(finish);
- }
- }
-
- doNext();
-}
-
-function initContextMenu(aNode) {
- document.popupNode = aNode;
- let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- let contextMenu = new nsContextMenu(contentAreaContextMenu);
- return contextMenu;
-}
diff --git a/browser/base/content/test/browser_bug743421.js b/browser/base/content/test/browser_bug743421.js
deleted file mode 100644
index 38437589d..000000000
--- a/browser/base/content/test/browser_bug743421.js
+++ /dev/null
@@ -1,118 +0,0 @@
-const gTestRoot = "http://mochi.test:8888/browser/browser/base/content/test/";
-
-var gTestBrowser = null;
-var gNextTest = null;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- prepareTest(test1a, gTestRoot + "plugin_add_dynamically.html");
-}
-
-function finishTest() {
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Tests that navigation within the page and the window.history API doesn't break click-to-play state.
-function test1a() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!popupNotification, "Test 1a, Should not have a click-to-play notification");
- var plugin = new XPCNativeWrapper(XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addPlugin());
-
- var condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, test1b, "Test 1a, Waited too long for plugin notification");
-}
-
-function test1b() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 1b, Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
-
- // Click the activate button on doorhanger to make sure it works
- popupNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- ok(objLoadingContent.activated, "Test 1b, Doorhanger should activate plugin");
-
- test1c();
-}
-
-function test1c() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 1c, Should still have a click-to-play notification");
- var plugin = new XPCNativeWrapper(XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addPlugin());
-
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1d, "Test 1c, Waited too long for plugin activation");
-}
-
-function test1d() {
- var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[1];
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 1d, Plugin should be activated");
-
- gNextTest = test1e;
- gTestBrowser.contentWindow.addEventListener("hashchange", test1e, false);
- gTestBrowser.contentWindow.location += "#anchorNavigation";
-}
-
-function test1e() {
- gTestBrowser.contentWindow.removeEventListener("hashchange", test1e, false);
-
- var plugin = new XPCNativeWrapper(XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addPlugin());
-
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1f, "Test 1e, Waited too long for plugin activation");
-}
-
-function test1f() {
- var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[2];
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 1f, Plugin should be activated");
-
- gTestBrowser.contentWindow.history.replaceState({}, "", "replacedState");
- var plugin = new XPCNativeWrapper(XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addPlugin());
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1g, "Test 1f, Waited too long for plugin activation");
-}
-
-function test1g() {
- var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[3];
- var objLoadingContent2 = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent2.activated, "Test 1g, Plugin should be activated");
- finishTest();
-}
diff --git a/browser/base/content/test/browser_bug744745.js b/browser/base/content/test/browser_bug744745.js
deleted file mode 100644
index 916480c50..000000000
--- a/browser/base/content/test/browser_bug744745.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var gTestBrowser = null;
-var gNumPluginBindingsAttached = 0;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
- gBrowser.removeCurrentTab();
- window.focus();
- });
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
- var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug744745.html";
-}
-
-function pluginBindingAttached() {
- gNumPluginBindingsAttached++;
-
- if (gNumPluginBindingsAttached == 1) {
- var doc = gTestBrowser.contentDocument;
- var testplugin = doc.getElementById("test");
- ok(testplugin, "should have test plugin");
- var style = getComputedStyle(testplugin);
- ok('opacity' in style, "style should have opacity set");
- is(style.opacity, 1, "opacity should be 1");
- finish();
- } else {
- ok(false, "if we've gotten here, something is quite wrong");
- }
-}
diff --git a/browser/base/content/test/browser_bug749738.js b/browser/base/content/test/browser_bug749738.js
deleted file mode 100644
index 2372e7cb3..000000000
--- a/browser/base/content/test/browser_bug749738.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const DUMMY_PAGE = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
-
- load(tab, DUMMY_PAGE, function() {
- gFindBar.onFindCommand();
- EventUtils.sendString("Dummy");
- gBrowser.removeTab(tab);
-
- try {
- gFindBar.close();
- ok(true, "findbar.close should not throw an exception");
- } catch(e) {
- ok(false, "findbar.close threw exception: " + e);
- }
- finish();
- });
-}
-
-function load(aTab, aUrl, aCallback) {
- aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
- aEvent.currentTarget.removeEventListener("load", onload, true);
- waitForFocus(aCallback, content);
- }, true);
- aTab.linkedBrowser.loadURI(aUrl);
-}
diff --git a/browser/base/content/test/browser_bug752516.js b/browser/base/content/test/browser_bug752516.js
deleted file mode 100644
index 8cd69767c..000000000
--- a/browser/base/content/test/browser_bug752516.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-var gTestBrowser = null;
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gBrowser.removeCurrentTab();
- window.focus();
- });
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug752516.html";
-
- gTestBrowser.addEventListener("load", tabLoad, true);
-}
-
-function tabLoad() {
- // Due to layout being async, "PluginBindAttached" may trigger later.
- // This forces a layout flush, thus triggering it, and schedules the
- // test so it is definitely executed afterwards.
- gTestBrowser.contentDocument.getElementById('test').clientTop;
- executeSoon(actualTest);
-}
-
-function actualTest() {
- let doc = gTestBrowser.contentDocument;
- let plugin = doc.getElementById("test");
- ok(!plugin.activated, "Plugin should not be activated");
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Doorhanger should not be open");
-
- EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, finish, "Waited too long for plugin doorhanger to activate");
-}
diff --git a/browser/base/content/test/browser_bug763468_perwindowpb.js b/browser/base/content/test/browser_bug763468_perwindowpb.js
deleted file mode 100644
index bdd6943d9..000000000
--- a/browser/base/content/test/browser_bug763468_perwindowpb.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let newTab;
- let newTabPrefName = "browser.newtab.url";
- let newTabURL;
- let mode;
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- whenNewTabLoaded(aWindow, function () {
- if (aIsPrivateMode) {
- mode = "per window private browsing";
- newTabURL = "about:privatebrowsing";
- } else {
- mode = "normal";
- newTabURL = Services.prefs.getCharPref(newTabPrefName) || "about:blank";
- }
-
- is(aWindow.gBrowser.currentURI.spec, newTabURL,
- "URL of NewTab should be " + newTabURL + " in " + mode + " mode");
-
- aWindow.gBrowser.removeTab(aWindow.gBrowser.selectedTab);
- aCallback()
- });
- };
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- windowsToClose.push(aWin);
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- // this function is called after calling finish() on the test.
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- // test first when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, function() {
- // then test when on private mode
- testOnWindow({private: true}, function(aWin) {
- doTest(true, aWin, function() {
- // then test again when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, finish);
- });
- });
- });
- });
- });
-}
diff --git a/browser/base/content/test/browser_bug767836_perwindowpb.js b/browser/base/content/test/browser_bug767836_perwindowpb.js
deleted file mode 100644
index aef355e61..000000000
--- a/browser/base/content/test/browser_bug767836_perwindowpb.js
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- //initialization
- waitForExplicitFinish();
- let newTabPrefName = "browser.newtab.url";
- let newTabURL;
- let testURL = "http://example.com/";
- let mode;
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- openNewTab(aWindow, function () {
- if (aIsPrivateMode) {
- mode = "per window private browsing";
- newTabURL = "about:privatebrowsing";
- } else {
- mode = "normal";
- newTabURL = Services.prefs.getCharPref(newTabPrefName) || "about:blank";
- }
-
- // Check the new tab opened while in normal/private mode
- is(aWindow.gBrowser.selectedBrowser.currentURI.spec, newTabURL,
- "URL of NewTab should be " + newTabURL + " in " + mode + " mode");
- // Set the custom newtab url
- Services.prefs.setCharPref(newTabPrefName, testURL);
- ok(Services.prefs.prefHasUserValue(newTabPrefName), "Custom newtab url is set");
-
- // Open a newtab after setting the custom newtab url
- openNewTab(aWindow, function () {
- is(aWindow.gBrowser.selectedBrowser.currentURI.spec, testURL,
- "URL of NewTab should be the custom url");
-
- // clear the custom url preference
- Services.prefs.clearUserPref(newTabPrefName);
- ok(!Services.prefs.prefHasUserValue(newTabPrefName), "No custom newtab url is set");
-
- aWindow.gBrowser.removeTab(aWindow.gBrowser.selectedTab);
- aWindow.gBrowser.removeTab(aWindow.gBrowser.selectedTab);
- aWindow.close();
- aCallback()
- });
- });
- }
-
- function testOnWindow(aIsPrivate, aCallback) {
- whenNewWindowLoaded({private: aIsPrivate}, function(win) {
- executeSoon(function() aCallback(win));
- });
- }
-
- // check whether any custom new tab url has been configured
- ok(!Services.prefs.prefHasUserValue(newTabPrefName), "No custom newtab url is set");
-
- // test normal mode
- testOnWindow(false, function(aWindow) {
- doTest(false, aWindow, function() {
- // test private mode
- testOnWindow(true, function(aWindow) {
- doTest(true, aWindow, function() {
- finish();
- });
- });
- });
- });
-}
-
-function openNewTab(aWindow, aCallback) {
- // Open a new tab
- aWindow.BrowserOpenTab();
-
- let browser = aWindow.gBrowser.selectedBrowser;
- if (browser.contentDocument.readyState == "complete") {
- executeSoon(aCallback);
- return;
- }
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
-} \ No newline at end of file
diff --git a/browser/base/content/test/browser_bug771331.js b/browser/base/content/test/browser_bug771331.js
deleted file mode 100644
index 3b1ab552c..000000000
--- a/browser/base/content/test/browser_bug771331.js
+++ /dev/null
@@ -1,82 +0,0 @@
-const HTML_NS = "http://www.w3.org/1999/xhtml";
-
-const INPUT_ID = "input1";
-const FORM1_ID = "form1";
-const FORM2_ID = "form2";
-const CHANGE_INPUT_ID = "input2";
-
-function test() {
- waitForExplicitFinish();
- let tab = gBrowser.selectedTab =
- gBrowser.addTab("data:text/html;charset=utf-8," +
- "<html><body>" +
- "<form id='" + FORM1_ID + "'><input id='" + CHANGE_INPUT_ID + "'></form>" +
- "<form id='" + FORM2_ID + "'></form>" +
- "</body></html>");
- tab.linkedBrowser.addEventListener("load", tabLoad, true);
-}
-
-function unexpectedContentEvent(evt) {
- ok(false, "Received a " + evt.type + " event on content");
-}
-
-var gDoc = null;
-
-function tabLoad() {
- let tab = gBrowser.selectedTab;
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- gDoc = gBrowser.selectedBrowser.contentDocument;
- // These events shouldn't escape to content.
- gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
- gDoc.defaultView.setTimeout(test_inputAdd, 0);
-}
-
-function test_inputAdd() {
- gBrowser.addEventListener("DOMFormHasPassword", test_inputAddHandler, false);
- let input = gDoc.createElementNS(HTML_NS, "input");
- input.setAttribute("type", "password");
- input.setAttribute("id", INPUT_ID);
- input.setAttribute("data-test", "unique-attribute");
- gDoc.getElementById(FORM1_ID).appendChild(input);
- info("Done appending the input element");
-}
-
-function test_inputAddHandler(evt) {
- gBrowser.removeEventListener(evt.type, test_inputAddHandler, false);
- is(evt.target.id, FORM1_ID,
- evt.type + " event targets correct form element (added password element)");
- gDoc.defaultView.setTimeout(test_inputChangeForm, 0);
-}
-
-function test_inputChangeForm() {
- gBrowser.addEventListener("DOMFormHasPassword", test_inputChangeFormHandler, false);
- let input = gDoc.getElementById(INPUT_ID);
- input.setAttribute("form", FORM2_ID);
-}
-
-function test_inputChangeFormHandler(evt) {
- gBrowser.removeEventListener(evt.type, test_inputChangeFormHandler, false);
- is(evt.target.id, FORM2_ID,
- evt.type + " event targets correct form element (changed form)");
- gDoc.defaultView.setTimeout(test_inputChangesType, 0);
-}
-
-function test_inputChangesType() {
- gBrowser.addEventListener("DOMFormHasPassword", test_inputChangesTypeHandler, false);
- let input = gDoc.getElementById(CHANGE_INPUT_ID);
- input.setAttribute("type", "password");
-}
-
-function test_inputChangesTypeHandler(evt) {
- gBrowser.removeEventListener(evt.type, test_inputChangesTypeHandler, false);
- is(evt.target.id, FORM1_ID,
- evt.type + " event targets correct form element (changed type)");
- gDoc.defaultView.setTimeout(completeTest, 0);
-}
-
-function completeTest() {
- ok(true, "Test completed");
- gDoc.removeEventListener("DOMFormHasPassword", unexpectedContentEvent, false);
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/base/content/test/browser_bug783614.js b/browser/base/content/test/browser_bug783614.js
deleted file mode 100644
index ebc62e8fa..000000000
--- a/browser/base/content/test/browser_bug783614.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- gURLBar.focus();
- gURLBar.inputField.value = "https://example.com/";
- gURLBar.selectionStart = 4;
- gURLBar.selectionEnd = 5;
- goDoCommand("cmd_cut");
- is(gURLBar.inputField.value, "http://example.com/", "location bar value after cutting 's' from https");
- gURLBar.handleRevert();
-}
diff --git a/browser/base/content/test/browser_bug787619.js b/browser/base/content/test/browser_bug787619.js
deleted file mode 100644
index 1917100eb..000000000
--- a/browser/base/content/test/browser_bug787619.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-let gTestBrowser = null;
-let gWrapperClickCount = 0;
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- let plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug787619.html";
-}
-
-function pageLoad() {
- // Due to layout being async, "PluginBindAttached" may trigger later.
- // This forces a layout flush, thus triggering it, and schedules the
- // test so it is definitely executed afterwards.
- gTestBrowser.contentDocument.getElementById('plugin').clientTop;
- executeSoon(part1);
-}
-
-function part1() {
- let wrapper = gTestBrowser.contentDocument.getElementById('wrapper');
- wrapper.addEventListener('click', function() ++gWrapperClickCount, false);
-
- let plugin = gTestBrowser.contentDocument.getElementById('plugin');
- ok(plugin, 'got plugin element');
- ok(!plugin.activated, 'plugin should not be activated');
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Doorhanger should not be open");
-
- EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, part2,
- 'waited too long for plugin to activate');
-}
-
-function part2() {
- is(gWrapperClickCount, 0, 'wrapper should not have received any clicks');
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
diff --git a/browser/base/content/test/browser_bug797677.js b/browser/base/content/test/browser_bug797677.js
deleted file mode 100644
index ff9637306..000000000
--- a/browser/base/content/test/browser_bug797677.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var rootDir = getRootDirectory(gTestPath);
-const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-var gTestBrowser = null;
-var gConsoleErrors = 0;
-
-function test() {
- waitForExplicitFinish();
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
- var consoleService = Cc["@mozilla.org/consoleservice;1"]
- .getService(Ci.nsIConsoleService);
- var errorListener = {
- observe: function(aMessage) {
- if (aMessage.message.contains("NS_ERROR"))
- gConsoleErrors++;
- }
- };
- consoleService.registerListener(errorListener);
- registerCleanupFunction(function() {
- gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true);
- consoleService.unregisterListener(errorListener);
- gBrowser.removeCurrentTab();
- window.focus();
- });
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug797677.html";
-}
-
-function pluginBindingAttached() {
- // Let browser-plugins.js handle the PluginNotFound event, then run the test
- executeSoon(runTest);
-}
-
-function runTest() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("plugin");
- ok(plugin, "plugin should be in the page");
- is(gConsoleErrors, 0, "should have no console errors");
- finish();
-}
diff --git a/browser/base/content/test/browser_bug812562.js b/browser/base/content/test/browser_bug812562.js
deleted file mode 100644
index 677558cbe..000000000
--- a/browser/base/content/test/browser_bug812562.js
+++ /dev/null
@@ -1,96 +0,0 @@
-var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gNextTest = null;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- setAndUpdateBlocklist(gHttpTestRoot + "blockPluginVulnerableUpdatable.xml",
- function() {
- prepareTest(function() {
- // Due to layout being async, "PluginBindAttached" may trigger later.
- // This forces a layout flush, thus triggering it, and schedules the
- // test so it is definitely executed afterwards.
- gTestBrowser.contentDocument.getElementById('test').clientTop;
- testPart1();
- },
- gHttpTestRoot + "plugin_test.html");
- });
-}
-
-function finishTest() {
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml",
- function() {
- resetBlocklist();
- finish();
- });
-}
-
-function pageLoad(aEvent) {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- if (gNextTest != null)
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Tests that the going back will reshow the notification for click-to-play
-// blocklisted plugins (part 1/4)
-function testPart1() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "test part 1: Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "test part 1: plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
- ok(!objLoadingContent.activated, "test part 1: plugin should not be activated");
-
- prepareTest(testPart2, "about:blank");
-}
-
-function testPart2() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!popupNotification, "test part 2: Should not have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(!plugin, "test part 2: Should not have a plugin in this page");
-
- Services.obs.addObserver(testPart3, "PopupNotifications-updateNotShowing", false);
- gTestBrowser.contentWindow.history.back();
-}
-
-function testPart3() {
- Services.obs.removeObserver(testPart3, "PopupNotifications-updateNotShowing");
- var condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, testPart4, "test part 3: waited too long for click-to-play-plugin notification");
-}
-
-function testPart4() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "test part 4: Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "test part 4: plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
- ok(!objLoadingContent.activated, "test part 4: plugin should not be activated");
-
- finishTest();
-}
diff --git a/browser/base/content/test/browser_bug816527.js b/browser/base/content/test/browser_bug816527.js
deleted file mode 100644
index 30a4090f2..000000000
--- a/browser/base/content/test/browser_bug816527.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- testOnWindow({}, function(aNormalWindow) {
- testOnWindow({private: true}, function(aPrivateWindow) {
- runTest(aNormalWindow, aPrivateWindow, false, function() {
- aNormalWindow.close();
- aPrivateWindow.close();
- testOnWindow({}, function(aNormalWindow) {
- testOnWindow({private: true}, function(aPrivateWindow) {
- runTest(aPrivateWindow, aNormalWindow, false, function() {
- aNormalWindow.close();
- aPrivateWindow.close();
- testOnWindow({private: true}, function(aPrivateWindow) {
- runTest(aPrivateWindow, aPrivateWindow, false, function() {
- aPrivateWindow.close();
- testOnWindow({}, function(aNormalWindow) {
- runTest(aNormalWindow, aNormalWindow, true, function() {
- aNormalWindow.close();
- finish();
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
-
- function runTest(aSourceWindow, aDestWindow, aExpectSuccess, aCallback) {
- // Open the base tab
- let baseTab = aSourceWindow.gBrowser.addTab(testURL);
- baseTab.linkedBrowser.addEventListener("load", function() {
- // Wait for the tab to be fully loaded so matching happens correctly
- if (baseTab.linkedBrowser.currentURI.spec == "about:blank")
- return;
- baseTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let testTab = aDestWindow.gBrowser.addTab();
-
- waitForFocus(function() {
- // Select the testTab
- aDestWindow.gBrowser.selectedTab = testTab;
-
- // Ensure that this tab has no history entries
- ok(testTab.linkedBrowser.sessionHistory.count < 2,
- "The test tab has 1 or less history entries");
- // Ensure that this tab is on about:blank
- is(testTab.linkedBrowser.currentURI.spec, "about:blank",
- "The test tab is on about:blank");
- // Ensure that this tab's document has no child nodes
- ok(!testTab.linkedBrowser.contentDocument.body.hasChildNodes(),
- "The test tab has no child nodes");
- ok(!testTab.hasAttribute("busy"),
- "The test tab doesn't have the busy attribute");
-
- // Set the urlbar to include the moz-action
- aDestWindow.gURLBar.value = "moz-action:switchtab," + testURL;
- // Focus the urlbar so we can press enter
- aDestWindow.gURLBar.focus();
-
- // We want to see if the switchtab action works. If it does, the
- // current tab will get closed, and that's what we detect with the
- // TabClose handler. If pressing enter triggers a load in that tab,
- // then the load handler will get called. Neither of these are
- // the desired effect here. So if the test goes successfully, it is
- // the timeout handler which gets called.
- //
- // The reason that we can't avoid the timeout here is because we are
- // trying to test something which should not happen, so we just need
- // to wait for a while and then check whether any bad things have
- // happened.
-
- function onTabClose(aEvent) {
- aDestWindow.gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, false);
- aDestWindow.gBrowser.removeEventListener("load", onLoad, false);
- clearTimeout(timeout);
- // Should only happen when we expect success
- ok(aExpectSuccess, "Tab closed as expected");
- aCallback();
- }
- function onLoad(aEvent) {
- aDestWindow.gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, false);
- aDestWindow.gBrowser.removeEventListener("load", onLoad, false);
- clearTimeout(timeout);
- // Should only happen when we expect success
- ok(aExpectSuccess, "Tab loaded as expected");
- aCallback();
- }
-
- aDestWindow.gBrowser.tabContainer.addEventListener("TabClose", onTabClose, false);
- aDestWindow.gBrowser.addEventListener("load", onLoad, false);
- let timeout = setTimeout(function() {
- aDestWindow.gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, false);
- aDestWindow.gBrowser.removeEventListener("load", onLoad, false);
- aCallback();
- }, 500);
-
- // Press enter!
- EventUtils.synthesizeKey("VK_RETURN", {});
- }, aDestWindow);
- }, true);
- }
-}
-
diff --git a/browser/base/content/test/browser_bug817947.js b/browser/base/content/test/browser_bug817947.js
deleted file mode 100644
index 061cd8d18..000000000
--- a/browser/base/content/test/browser_bug817947.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const ss = Cc["@mozilla.org/browser/sessionstore;1"]
- .getService(Ci.nsISessionStore);
-
-const URL = "http://mochi.test:8888/browser/";
-const PREF = "browser.sessionstore.restore_on_demand";
-
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF);
- });
-
- preparePendingTab(function (aTab) {
- let win = gBrowser.replaceTabWithWindow(aTab);
-
- whenDelayedStartupFinished(win, function () {
- let [tab] = win.gBrowser.tabs;
-
- whenLoaded(tab.linkedBrowser, function () {
- is(tab.linkedBrowser.currentURI.spec, URL, "correct url should be loaded");
- ok(!tab.hasAttribute("pending"), "tab should not be pending");
-
- win.close();
- finish();
- });
- });
- });
-}
-
-function preparePendingTab(aCallback) {
- let tab = gBrowser.addTab(URL);
-
- whenLoaded(tab.linkedBrowser, function () {
- let state = ss.getTabState(tab);
- gBrowser.removeTab(tab);
-
- tab = gBrowser.addTab("about:blank");
- whenLoaded(tab.linkedBrowser, function () {
- ss.setTabState(tab, state);
- ok(tab.hasAttribute("pending"), "tab should be pending");
- aCallback(tab);
- });
- });
-}
-
-function whenLoaded(aElement, aCallback) {
- aElement.addEventListener("load", function onLoad() {
- aElement.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
-}
diff --git a/browser/base/content/test/browser_bug818118.js b/browser/base/content/test/browser_bug818118.js
deleted file mode 100644
index 3b781333f..000000000
--- a/browser/base/content/test/browser_bug818118.js
+++ /dev/null
@@ -1,48 +0,0 @@
-var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gTestBrowser.removeEventListener("load", pageLoad, true);
- });
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_both.html";
-}
-
-function pageLoad(aEvent) {
- // Due to layout being async, "PluginBindAttached" may trigger later.
- // This forces a layout flush, thus triggering it, and schedules the
- // test so it is definitely executed afterwards.
- gTestBrowser.contentDocument.getElementById('test').clientTop;
- executeSoon(actualTest);
-}
-
-function actualTest() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(plugin, "should have known plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
- ok(!objLoadingContent.activated, "plugin should not be activated");
-
- var unknown = gTestBrowser.contentDocument.getElementById("unknown");
- ok(unknown, "should have unknown plugin in page");
-
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
diff --git a/browser/base/content/test/browser_bug820497.js b/browser/base/content/test/browser_bug820497.js
deleted file mode 100644
index f6cc2e702..000000000
--- a/browser/base/content/test/browser_bug820497.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var gTestBrowser = null;
-var gNumPluginBindingsAttached = 0;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("plugins.click_to_play");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
- gBrowser.removeCurrentTab();
- window.focus();
- });
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
- var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
- gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug820497.html";
-}
-
-function pluginBindingAttached() {
- gNumPluginBindingsAttached++;
-
- if (gNumPluginBindingsAttached == 1) {
- var doc = gTestBrowser.contentDocument;
- var testplugin = doc.getElementById("test");
- ok(testplugin, "should have test plugin");
- var secondtestplugin = doc.getElementById("secondtest");
- ok(!secondtestplugin, "should not yet have second test plugin");
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "should have popup notification");
- // We don't set up the action list until the notification is shown
- notification.reshow();
- is(notification.options.centerActions.length, 1, "should be 1 type of plugin in the popup notification");
- XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addSecondPlugin();
- } else if (gNumPluginBindingsAttached == 2) {
- var doc = gTestBrowser.contentDocument;
- var testplugin = doc.getElementById("test");
- ok(testplugin, "should have test plugin");
- var secondtestplugin = doc.getElementById("secondtest");
- ok(secondtestplugin, "should have second test plugin");
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "should have popup notification");
- notification.reshow();
- is(notification.options.centerActions.length, 2, "should be 2 types of plugin in the popup notification");
- finish();
- } else {
- ok(false, "if we've gotten here, something is quite wrong");
- }
-}
diff --git a/browser/base/content/test/browser_bug822367.js b/browser/base/content/test/browser_bug822367.js
deleted file mode 100644
index 5ce497919..000000000
--- a/browser/base/content/test/browser_bug822367.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * User Override Mixed Content Block - Tests for Bug 822367
- */
-
-
-const PREF_DISPLAY = "security.mixed_content.block_display_content";
-const PREF_ACTIVE = "security.mixed_content.block_active_content";
-
-// We alternate for even and odd test cases to simulate different hosts
-const gHttpTestRoot = "https://example.com/browser/browser/base/content/test/";
-const gHttpTestRoot2 = "https://test1.example.com/browser/browser/base/content/test/";
-
-var origBlockDisplay;
-var origBlockActive;
-var gTestBrowser = null;
-
-registerCleanupFunction(function() {
- // Set preferences back to their original values
- Services.prefs.setBoolPref(PREF_DISPLAY, origBlockDisplay);
- Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
-});
-
-function MixedTestsCompleted() {
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
-
- origBlockDisplay = Services.prefs.getBoolPref(PREF_DISPLAY);
- origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
-
- Services.prefs.setBoolPref(PREF_DISPLAY, true);
- Services.prefs.setBoolPref(PREF_ACTIVE, true);
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- newTab.linkedBrowser.stop()
-
- // Mixed Script Test
- gTestBrowser.addEventListener("load", MixedTest1A, true);
- var url = gHttpTestRoot + "file_bug822367_1.html";
- gTestBrowser.contentWindow.location = url;
-}
-
-// Mixed Script Test
-function MixedTest1A() {
- gTestBrowser.removeEventListener("load", MixedTest1A, true);
- gTestBrowser.addEventListener("load", MixedTest1B, true);
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger didn't appear");
- notification.secondaryActions[0].callback();
-}
-function MixedTest1B() {
- waitForCondition(function() content.document.getElementById('p1').innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
-}
-function MixedTest1C() {
- ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 1");
- gTestBrowser.removeEventListener("load", MixedTest1B, true);
- MixedTest2();
-}
-
-//Mixed Display Test - Doorhanger should not appear
-function MixedTest2() {
- gTestBrowser.addEventListener("load", MixedTest2A, true);
- var url = gHttpTestRoot2 + "file_bug822367_2.html";
- gTestBrowser.contentWindow.location = url;
-}
-
-function MixedTest2A() {
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(!notification, "Mixed Content Doorhanger appears for mixed display content!");
- MixedTest3();
-}
-
-// Mixed Script and Display Test - User Override should cause both the script and the image to load.
-function MixedTest3() {
- gTestBrowser.removeEventListener("load", MixedTest2A, true);
- gTestBrowser.addEventListener("load", MixedTest3A, true);
- var url = gHttpTestRoot + "file_bug822367_3.html";
- gTestBrowser.contentWindow.location = url;
-}
-function MixedTest3A() {
- gTestBrowser.removeEventListener("load", MixedTest3A, true);
- gTestBrowser.addEventListener("load", MixedTest3B, true);
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger doesn't appear for test 3");
- notification.secondaryActions[0].callback();
-}
-function MixedTest3B() {
- waitForCondition(function() content.document.getElementById('p1').innerHTML == "hello", MixedTest3C, "Waited too long for mixed script to run in Test 3");
-}
-function MixedTest3C() {
- waitForCondition(function() content.document.getElementById('p2').innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
-}
-function MixedTest3D() {
- ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 3");
- ok(content.document.getElementById('p2').innerHTML == "bye","Mixed image didn't load in Test 3");
- MixedTest4();
-}
-
-// Location change - User override on one page doesn't propogate to another page after location change.
-function MixedTest4() {
- gTestBrowser.removeEventListener("load", MixedTest3B, true);
- gTestBrowser.addEventListener("load", MixedTest4A, true);
- var url = gHttpTestRoot2 + "file_bug822367_4.html";
- gTestBrowser.contentWindow.location = url;
-}
-function MixedTest4A() {
- gTestBrowser.removeEventListener("load", MixedTest4A, true);
- gTestBrowser.addEventListener("load", MixedTest4B, true);
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger doesn't appear for Test 4");
- notification.secondaryActions[0].callback();
-}
-function MixedTest4B() {
- waitForCondition(function() content.document.location == gHttpTestRoot + "file_bug822367_4B.html", MixedTest4C, "Waited too long for mixed script to run in Test 4");
-}
-function MixedTest4C() {
- ok(content.document.location == gHttpTestRoot + "file_bug822367_4B.html", "Location didn't change in test 4");
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger doesn't appear after location change in Test 4");
- waitForCondition(function() content.document.getElementById('p1').innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
-}
-function MixedTest4D() {
- ok(content.document.getElementById('p1').innerHTML == "","p1.innerHTML changed; mixed script loaded after location change in Test 4");
- MixedTest5();
-}
-
-// Mixed script attempts to load in a document.open()
-function MixedTest5() {
- gTestBrowser.removeEventListener("load", MixedTest4B, true);
- gTestBrowser.addEventListener("load", MixedTest5A, true);
- var url = gHttpTestRoot + "file_bug822367_5.html";
- gTestBrowser.contentWindow.location = url;
-}
-function MixedTest5A() {
- gTestBrowser.removeEventListener("load", MixedTest5A, true);
- gTestBrowser.addEventListener("load", MixedTest5B, true);
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger doesn't appear for Test 5");
- notification.secondaryActions[0].callback();
-}
-function MixedTest5B() {
- waitForCondition(function() content.document.getElementById('p1').innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
-}
-function MixedTest5C() {
- ok(content.document.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 5");
- MixedTest6();
-}
-
-// Mixed script attempts to load in a document.open() that is within an iframe.
-function MixedTest6() {
- gTestBrowser.removeEventListener("load", MixedTest5B, true);
- gTestBrowser.addEventListener("load", MixedTest6A, true);
- var url = gHttpTestRoot2 + "file_bug822367_6.html";
- gTestBrowser.contentWindow.location = url;
-}
-function MixedTest6A() {
- gTestBrowser.removeEventListener("load", MixedTest6A, true);
- waitForCondition(function() PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser), MixedTest6B, "waited to long for doorhanger");
-}
-
-function MixedTest6B() {
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "Mixed Content Doorhanger doesn't appear for Test 6");
- gTestBrowser.addEventListener("load", MixedTest6C, true);
- notification.secondaryActions[0].callback();
-}
-
-function MixedTest6C() {
- gTestBrowser.removeEventListener("load", MixedTest6C, true);
- waitForCondition(function() content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello", MixedTest6D, "Waited too long for mixed script to run in Test 6");
-}
-function MixedTest6D() {
- ok(content.document.getElementById('f1').contentDocument.getElementById('p1').innerHTML == "hello","Mixed script didn't load in Test 6");
- MixedTestsCompleted();
-}
-
-function waitForCondition(condition, nextTest, errorMsg) {
- var tries = 0;
- var interval = setInterval(function() {
- if (tries >= 30) {
- ok(false, errorMsg);
- moveOn();
- }
- if (condition()) {
- moveOn();
- }
- tries++;
- }, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
-}
diff --git a/browser/base/content/test/browser_bug832435.js b/browser/base/content/test/browser_bug832435.js
deleted file mode 100644
index 6be2604cd..000000000
--- a/browser/base/content/test/browser_bug832435.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
- ok(true, "Starting up");
-
- gBrowser.selectedBrowser.focus();
- gURLBar.addEventListener("focus", function onFocus() {
- gURLBar.removeEventListener("focus", onFocus);
- ok(true, "Invoked onfocus handler");
- EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
-
- // javscript: URIs are evaluated async.
- SimpleTest.executeSoon(function() {
- ok(true, "Evaluated without crashing");
- finish();
- });
- });
- gURLBar.inputField.value = "javascript: var foo = '11111111'; ";
- gURLBar.focus();
-}
diff --git a/browser/base/content/test/browser_bug839103.js b/browser/base/content/test/browser_bug839103.js
deleted file mode 100644
index 2b777c00d..000000000
--- a/browser/base/content/test/browser_bug839103.js
+++ /dev/null
@@ -1,159 +0,0 @@
-const gTestRoot = getRootDirectory(gTestPath);
-const gStyleSheet = "bug839103.css";
-
-var gTab = null;
-var needsInitialApplicableStateEvent = false;
-var needsInitialApplicableStateEventFor = null;
-
-function test() {
- waitForExplicitFinish();
- gBrowser.addEventListener("StyleSheetAdded", initialStylesheetAdded, true);
- gTab = gBrowser.selectedTab = gBrowser.addTab(gTestRoot + "test_bug839103.html");
- gTab.linkedBrowser.addEventListener("load", tabLoad, true);
-}
-
-function initialStylesheetAdded(evt) {
- gBrowser.removeEventListener("StyleSheetAdded", initialStylesheetAdded, true);
- ok(true, "received initial style sheet event");
- is(evt.type, "StyleSheetAdded", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.documentSheet, "style sheet is a document sheet");
-}
-
-function tabLoad(evt) {
- gTab.linkedBrowser.removeEventListener(evt.type, tabLoad, true);
- executeSoon(continueTest);
-}
-
-var gLinkElement = null;
-
-function unexpectedContentEvent(evt) {
- ok(false, "Received a " + evt.type + " event on content");
-}
-
-// We've seen the original stylesheet in the document.
-// Now add a stylesheet on the fly and make sure we see it.
-function continueTest() {
- info("continuing test");
-
- let doc = gBrowser.contentDocument;
- doc.styleSheetChangeEventsEnabled = true;
- doc.addEventListener("StyleSheetAdded", unexpectedContentEvent, false);
- doc.addEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
- doc.addEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
- doc.defaultView.addEventListener("StyleSheetAdded", unexpectedContentEvent, false);
- doc.defaultView.addEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
- doc.defaultView.addEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
- let link = doc.createElement('link');
- link.setAttribute('rel', 'stylesheet');
- link.setAttribute('type', 'text/css');
- link.setAttribute('href', gTestRoot + gStyleSheet);
- gLinkElement = link;
-
- gBrowser.addEventListener("StyleSheetAdded", dynamicStylesheetAdded, true);
- gBrowser.addEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChanged, true);
- doc.body.appendChild(link);
-}
-
-function dynamicStylesheetAdded(evt) {
- gBrowser.removeEventListener("StyleSheetAdded", dynamicStylesheetAdded, true);
- ok(true, "received dynamic style sheet event");
- is(evt.type, "StyleSheetAdded", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.documentSheet, "style sheet is a document sheet");
-}
-
-function dynamicStylesheetApplicableStateChanged(evt) {
- gBrowser.removeEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChanged, true);
- ok(true, "received dynamic style sheet applicable state change event");
- is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- is(evt.stylesheet, gLinkElement.sheet, "evt.stylesheet has the right value");
- is(evt.applicable, true, "evt.applicable has the right value");
-
- gBrowser.addEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChangedToFalse, true);
- gLinkElement.disabled = true;
-}
-
-function dynamicStylesheetApplicableStateChangedToFalse(evt) {
- gBrowser.removeEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChangedToFalse, true);
- is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
- ok(true, "received dynamic style sheet applicable state change event after media=\"\" changed");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- is(evt.stylesheet, gLinkElement.sheet, "evt.stylesheet has the right value");
- is(evt.applicable, false, "evt.applicable has the right value");
-
- gBrowser.addEventListener("StyleSheetRemoved", dynamicStylesheetRemoved, true);
- gBrowser.contentDocument.body.removeChild(gLinkElement);
-}
-
-function dynamicStylesheetRemoved(evt) {
- gBrowser.removeEventListener("StyleSheetRemoved", dynamicStylesheetRemoved, true);
- ok(true, "received dynamic style sheet removal");
- is(evt.type, "StyleSheetRemoved", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.stylesheet.href.contains(gStyleSheet), "evt.stylesheet is the removed stylesheet");
-
- gBrowser.addEventListener("StyleRuleAdded", styleRuleAdded, true);
- gBrowser.contentDocument.querySelector("style").sheet.insertRule("*{color:black}", 0);
-}
-
-function styleRuleAdded(evt) {
- gBrowser.removeEventListener("StyleRuleAdded", styleRuleAdded, true);
- ok(true, "received style rule added event");
- is(evt.type, "StyleRuleAdded", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.rule, "evt.rule is defined");
- is(evt.rule.cssText, "* { color: black; }", "evt.rule.cssText has expected value");
-
- gBrowser.addEventListener("StyleRuleChanged", styleRuleChanged, true);
- evt.rule.style.cssText = "color:green";
-}
-
-function styleRuleChanged(evt) {
- gBrowser.removeEventListener("StyleRuleChanged", styleRuleChanged, true);
- ok(true, "received style rule changed event");
- is(evt.type, "StyleRuleChanged", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.rule, "evt.rule is defined");
- is(evt.rule.cssText, "* { color: green; }", "evt.rule.cssText has expected value");
-
- gBrowser.addEventListener("StyleRuleRemoved", styleRuleRemoved, true);
- evt.stylesheet.deleteRule(0);
-}
-
-function styleRuleRemoved(evt) {
- gBrowser.removeEventListener("StyleRuleRemoved", styleRuleRemoved, true);
- ok(true, "received style rule removed event");
- is(evt.type, "StyleRuleRemoved", "evt.type has expected value");
- is(evt.target, gBrowser.contentDocument, "event targets correct document");
- ok(evt.stylesheet, "evt.stylesheet is defined");
- ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
- ok(evt.rule, "evt.rule is defined");
-
- executeSoon(concludeTest);
-}
-
-function concludeTest() {
- let doc = gBrowser.contentDocument;
- doc.removeEventListener("StyleSheetAdded", unexpectedContentEvent, false);
- doc.removeEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
- doc.removeEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
- doc.defaultView.removeEventListener("StyleSheetAdded", unexpectedContentEvent, false);
- doc.defaultView.removeEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
- doc.defaultView.removeEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
- gBrowser.removeCurrentTab();
- gLinkElement = null;
- gTab = null;
- finish();
-}
diff --git a/browser/base/content/test/browser_bug880101.js b/browser/base/content/test/browser_bug880101.js
deleted file mode 100644
index abe05b864..000000000
--- a/browser/base/content/test/browser_bug880101.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "about:robots";
-
-function test() {
- let win;
-
- let listener = {
- onLocationChange: (webProgress, request, uri, flags) => {
- ok(webProgress.isTopLevel, "Received onLocationChange from top frame");
- is(uri.spec, URL, "Received onLocationChange for correct URL");
- finish();
- }
- };
-
- waitForExplicitFinish();
-
- // Remove the listener and window when we're done.
- registerCleanupFunction(() => {
- win.gBrowser.removeProgressListener(listener);
- win.close();
- });
-
- // Wait for the newly opened window.
- whenNewWindowOpened(w => win = w);
-
- // Open a link in a new window.
- openLinkIn(URL, "window", {});
-
- // On the next tick, but before the window has finished loading, access the
- // window's gBrowser property to force the tabbrowser constructor early.
- (function tryAddProgressListener() {
- executeSoon(() => {
- try {
- win.gBrowser.addProgressListener(listener);
- } catch (e) {
- // win.gBrowser wasn't ready, yet. Try again in a tick.
- tryAddProgressListener();
- }
- });
- })();
-}
-
-function whenNewWindowOpened(cb) {
- Services.obs.addObserver(function obs(win) {
- Services.obs.removeObserver(obs, "domwindowopened");
- cb(win);
- }, "domwindowopened", false);
-}
diff --git a/browser/base/content/test/browser_bug902156.js b/browser/base/content/test/browser_bug902156.js
deleted file mode 100644
index d08f30b09..000000000
--- a/browser/base/content/test/browser_bug902156.js
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Description of the Tests for
- * - Bug 902156: Persist "disable protection" option for Mixed Content Blocker
- *
- * 1. Navigate to the same domain via document.location
- * - Load a html page which has mixed content
- * - Doorhanger to disable protection appears - we disable it
- * - Load a new page from the same origin using document.location
- * - Doorhanger should not appear anymore!
- *
- * 2. Navigate to the same domain via simulateclick for a link on the page
- * - Load a html page which has mixed content
- * - Doorhanger to disable protection appears - we disable it
- * - Load a new page from the same origin simulating a click
- * - Doorhanger should not appear anymore!
- *
- * 3. Navigate to a differnet domain and show the content is still blocked
- * - Load a different html page which has mixed content
- * - Doorhanger to disable protection should appear again because
- * we navigated away from html page where we disabled the protection.
- *
- * Note, for all tests we set gHttpTestRoot to use 'https'.
- */
-
-const PREF_ACTIVE = "security.mixed_content.block_active_content";
-
-// We alternate for even and odd test cases to simulate different hosts
-const gHttpTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/";
-const gHttpTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/";
-
-var origBlockActive;
-var gTestBrowser = null;
-
-registerCleanupFunction(function() {
- // Set preferences back to their original values
- Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
-});
-
-function cleanUpAfterTests() {
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-/*
- * Whenever we disable the Mixed Content Blocker of the page
- * we have to make sure that our condition is properly loaded.
- */
-function waitForCondition(condition, nextTest, errorMsg) {
- var tries = 0;
- var interval = setInterval(function() {
- if (tries >= 30) {
- ok(false, errorMsg);
- moveOn();
- }
- if (condition()) {
- moveOn();
- }
- tries++;
- }, 100);
- var moveOn = function() {
- clearInterval(interval); nextTest();
- };
-}
-
-//------------------------ Test 1 ------------------------------
-
-function test1A() {
- // Removing EventListener because we have to register a new
- // one once the page is loaded with mixed content blocker disabled
- gTestBrowser.removeEventListener("load", test1A, true);
- gTestBrowser.addEventListener("load", test1B, true);
-
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "OK: Mixed Content Doorhanger appeared in Test1A!");
-
- // Disable Mixed Content Protection for the page
- notification.secondaryActions[0].callback();
-}
-
-function test1B() {
- var expected = "Mixed Content Blocker disabled";
- waitForCondition(
- function() content.document.getElementById('mctestdiv').innerHTML == expected,
- test1C, "Error: Waited too long for mixed script to run in Test 1B");
-}
-
-function test1C() {
- gTestBrowser.removeEventListener("load", test1B, true);
- var actual = content.document.getElementById('mctestdiv').innerHTML;
- is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1C");
-
- // The Script loaded after we disabled the page, now we are going to reload the
- // page and see if our decision is persistent
- gTestBrowser.addEventListener("load", test1D, true);
-
- var url = gHttpTestRoot1 + "file_bug902156_2.html";
- gTestBrowser.contentWindow.location = url;
-}
-
-function test1D() {
- gTestBrowser.removeEventListener("load", test1D, true);
-
- // The Doorhanger should not appear, because our decision of disabling the
- // mixed content blocker is persistent.
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(!notification, "OK: Mixed Content Doorhanger did not appear again in Test1D!");
-
- var actual = content.document.getElementById('mctestdiv').innerHTML;
- is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1D");
-
- // move on to Test 2
- test2();
-}
-
-//------------------------ Test 2 ------------------------------
-
-function test2() {
- gTestBrowser.addEventListener("load", test2A, true);
- var url = gHttpTestRoot2 + "file_bug902156_2.html";
- gTestBrowser.contentWindow.location = url;
-}
-
-function test2A() {
- // Removing EventListener because we have to register a new
- // one once the page is loaded with mixed content blocker disabled
- gTestBrowser.removeEventListener("load", test2A, true);
- gTestBrowser.addEventListener("load", test2B, true);
-
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "OK: Mixed Content Doorhanger appeared in Test 2A!");
-
- // Disable Mixed Content Protection for the page
- notification.secondaryActions[0].callback();
-}
-
-function test2B() {
- var expected = "Mixed Content Blocker disabled";
- waitForCondition(
- function() content.document.getElementById('mctestdiv').innerHTML == expected,
- test2C, "Error: Waited too long for mixed script to run in Test 2B");
-}
-
-function test2C() {
- gTestBrowser.removeEventListener("load", test2B, true);
- var actual = content.document.getElementById('mctestdiv').innerHTML;
- is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2C");
-
- // The Script loaded after we disabled the page, now we are going to reload the
- // page and see if our decision is persistent
- gTestBrowser.addEventListener("load", test2D, true);
-
- // reload the page using the provided link in the html file
- var mctestlink = content.document.getElementById("mctestlink");
- mctestlink.click();
-}
-
-function test2D() {
- gTestBrowser.removeEventListener("load", test2D, true);
-
- // The Doorhanger should not appear, because our decision of disabling the
- // mixed content blocker is persistent.
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(!notification, "OK: Mixed Content Doorhanger did not appear again in Test2D!");
-
- var actual = content.document.getElementById('mctestdiv').innerHTML;
- is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2D");
-
- // move on to Test 3
- test3();
-}
-
-//------------------------ Test 3 ------------------------------
-
-function test3() {
- gTestBrowser.addEventListener("load", test3A, true);
- var url = gHttpTestRoot1 + "file_bug902156_3.html";
- gTestBrowser.contentWindow.location = url;
-}
-
-function test3A() {
- // Removing EventListener because we have to register a new
- // one once the page is loaded with mixed content blocker disabled
- gTestBrowser.removeEventListener("load", test3A, true);
-
- var notification = PopupNotifications.getNotification("mixed-content-blocked", gTestBrowser);
- ok(notification, "OK: Mixed Content Doorhanger appeared in Test 3A!");
-
- // We are done with tests, clean up
- cleanUpAfterTests();
-}
-
-//------------------------------------------------------
-
-function test() {
- // Performing async calls, e.g. 'onload', we have to wait till all of them finished
- waitForExplicitFinish();
-
- // Store original preferences so we can restore settings after testing
- origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
-
- Services.prefs.setBoolPref(PREF_ACTIVE, true);
-
- // Not really sure what this is doing
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- newTab.linkedBrowser.stop()
-
- // Starting Test Number 1:
- gTestBrowser.addEventListener("load", test1A, true);
- var url = gHttpTestRoot1 + "file_bug902156_1.html";
- gTestBrowser.contentWindow.location = url;
-}
diff --git a/browser/base/content/test/browser_canonizeURL.js b/browser/base/content/test/browser_canonizeURL.js
deleted file mode 100644
index 983d0941c..000000000
--- a/browser/base/content/test/browser_canonizeURL.js
+++ /dev/null
@@ -1,54 +0,0 @@
-function test() {
- waitForExplicitFinish();
- testNext();
-}
-
-var pairs = [
- ["example", "http://www.example.net/"],
- ["ex-ample", "http://www.ex-ample.net/"],
- [" example ", "http://www.example.net/"],
- [" example/foo ", "http://www.example.net/foo"],
- [" example/foo bar ", "http://www.example.net/foo%20bar"],
- ["example.net", "http://example.net/"],
- ["http://example", "http://example/"],
- ["example:8080", "http://example:8080/"],
- ["ex-ample.foo", "http://ex-ample.foo/"],
- ["example.foo/bar ", "http://example.foo/bar"],
- ["1.1.1.1", "http://1.1.1.1/"],
- ["ftp://example", "ftp://example/"],
- ["ftp.example.bar", "ftp://ftp.example.bar/"],
- ["ex ample", Services.search.defaultEngine.getSubmission("ex ample", null, "keyword").uri.spec],
-];
-
-function testNext() {
- if (!pairs.length) {
- finish();
- return;
- }
-
- let [inputValue, expectedURL] = pairs.shift();
-
- gBrowser.addProgressListener({
- onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
- is(aRequest.originalURI.spec, expectedURL,
- "entering '" + inputValue + "' loads expected URL");
-
- gBrowser.removeProgressListener(this);
- gBrowser.stop();
-
- executeSoon(testNext);
- }
- }
- });
-
- gURLBar.addEventListener("focus", function onFocus() {
- gURLBar.removeEventListener("focus", onFocus);
- EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
- });
-
- gBrowser.selectedBrowser.focus();
- gURLBar.inputField.value = inputValue;
- gURLBar.focus();
-}
diff --git a/browser/base/content/test/browser_clearplugindata.html b/browser/base/content/test/browser_clearplugindata.html
deleted file mode 100644
index d5a6872c8..000000000
--- a/browser/base/content/test/browser_clearplugindata.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html>
- <head>
- <title>Plugin Clear Site Data sanitize test</title>
-
- <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-
- <script type="application/javascript">
- function testSteps()
- {
- // Make sure clearing by timerange is supported.
- var p = document.getElementById("plugin1");
- p.setSitesWithDataCapabilities(true);
-
- p.setSitesWithData(
- "foo.com:0:5," +
- "bar.com:0:100," +
- "baz.com:1:5," +
- "qux.com:1:100"
- );
-
- setTimeout(testFinishedCallback, 0);
- }
- </script>
- </head>
-
- <body onload="testSteps();"></body>
-
-</html>
diff --git a/browser/base/content/test/browser_clearplugindata.js b/browser/base/content/test/browser_clearplugindata.js
deleted file mode 100644
index 4b79bbbb1..000000000
--- a/browser/base/content/test/browser_clearplugindata.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test clearing plugin data using sanitize.js.
-const testURL1 = "http://mochi.test:8888/browser/browser/base/content/test/browser_clearplugindata.html";
-const testURL2 = "http://mochi.test:8888/browser/browser/base/content/test/browser_clearplugindata_noage.html";
-
-let tempScope = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
-let Sanitizer = tempScope.Sanitizer;
-
-const pluginHostIface = Ci.nsIPluginHost;
-var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-pluginHost.QueryInterface(pluginHostIface);
-
-var pluginTag;
-var s;
-
-function stored(needles) {
- var something = pluginHost.siteHasData(this.pluginTag, null);
- if (!needles)
- return something;
-
- if (!something)
- return false;
-
- for (var i = 0; i < needles.length; ++i) {
- if (!pluginHost.siteHasData(this.pluginTag, needles[i]))
- return false;
- }
- return true;
-}
-
-function test() {
- waitForExplicitFinish();
-
- var tags = pluginHost.getPluginTags();
-
- // Find the test plugin
- for (var i = 0; i < tags.length; i++)
- {
- if (tags[i].name == "Test Plug-in")
- {
- pluginTag = tags[i];
- }
- }
-
- s = new Sanitizer();
- s.ignoreTimespan = false;
- s.prefDomain = "privacy.cpd.";
- var itemPrefs = gPrefService.getBranch(s.prefDomain);
- itemPrefs.setBoolPref("history", false);
- itemPrefs.setBoolPref("downloads", false);
- itemPrefs.setBoolPref("cache", false);
- itemPrefs.setBoolPref("cookies", true); // plugin data
- itemPrefs.setBoolPref("formdata", false);
- itemPrefs.setBoolPref("offlineApps", false);
- itemPrefs.setBoolPref("passwords", false);
- itemPrefs.setBoolPref("sessions", false);
- itemPrefs.setBoolPref("siteSettings", false);
-
- executeSoon(test_with_age);
-}
-
-function setFinishedCallback(callback)
-{
- let testPage = gBrowser.selectedBrowser.contentWindow.wrappedJSObject;
- testPage.testFinishedCallback = function() {
- setTimeout(function() {
- info("got finished callback");
- callback();
- }, 0);
- }
-}
-
-function test_with_age()
-{
- // Load page to set data for the plugin.
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- setFinishedCallback(function() {
- ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
- "Data stored for sites");
-
- // Clear 20 seconds ago
- var now_uSec = Date.now() * 1000;
- s.range = [now_uSec - 20*1000000, now_uSec];
- s.sanitize();
-
- ok(stored(["bar.com","qux.com"]), "Data stored for sites");
- ok(!stored(["foo.com"]), "Data cleared for foo.com");
- ok(!stored(["baz.com"]), "Data cleared for baz.com");
-
- // Clear everything
- s.range = null;
- s.sanitize();
-
- ok(!stored(null), "All data cleared");
-
- gBrowser.removeCurrentTab();
-
- executeSoon(test_without_age);
- });
- }, true);
- content.location = testURL1;
-}
-
-function test_without_age()
-{
- // Load page to set data for the plugin.
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- setFinishedCallback(function() {
- ok(stored(["foo.com","bar.com","baz.com","qux.com"]),
- "Data stored for sites");
-
- // Attempt to clear 20 seconds ago. The plugin will throw
- // NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED, which should result in us
- // clearing all data regardless of age.
- var now_uSec = Date.now() * 1000;
- s.range = [now_uSec - 20*1000000, now_uSec];
- s.sanitize();
-
- ok(!stored(null), "All data cleared");
-
- gBrowser.removeCurrentTab();
-
- executeSoon(finish);
- });
- }, true);
- content.location = testURL2;
-}
-
diff --git a/browser/base/content/test/browser_clearplugindata_noage.html b/browser/base/content/test/browser_clearplugindata_noage.html
deleted file mode 100644
index 75e1f2e1f..000000000
--- a/browser/base/content/test/browser_clearplugindata_noage.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html>
- <head>
- <title>Plugin Clear Site Data sanitize test without age</title>
-
- <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-
- <script type="application/javascript">
- function testSteps()
- {
- // Make sure clearing by timerange is disabled.
- var p = document.getElementById("plugin1");
- p.setSitesWithDataCapabilities(false);
-
- p.setSitesWithData(
- "foo.com:0:5," +
- "bar.com:0:100," +
- "baz.com:1:5," +
- "qux.com:1:100"
- );
-
- setTimeout(testFinishedCallback, 0);
- }
- </script>
- </head>
-
- <body onload="testSteps();"></body>
-
-</html>
diff --git a/browser/base/content/test/browser_contentAreaClick.js b/browser/base/content/test/browser_contentAreaClick.js
deleted file mode 100644
index ba89240ea..000000000
--- a/browser/base/content/test/browser_contentAreaClick.js
+++ /dev/null
@@ -1,307 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test for bug 549340.
- * Test for browser.js::contentAreaClick() util.
- *
- * The test opens a new browser window, then replaces browser.js methods invoked
- * by contentAreaClick with a mock function that tracks which methods have been
- * called.
- * Each sub-test synthesizes a mouse click event on links injected in content,
- * the event is collected by a click handler that ensures that contentAreaClick
- * correctly prevent default events, and follows the correct code path.
- */
-
-let gTests = [
-
- {
- desc: "Simple left click",
- setup: function() {},
- clean: function() {},
- event: {},
- targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
- expectedInvokedMethods: [],
- preventDefault: false,
- },
-
- {
- desc: "Ctrl/Cmd left click",
- setup: function() {},
- clean: function() {},
- event: { ctrlKey: true,
- metaKey: true },
- targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
- expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
- preventDefault: true,
- },
-
- // The next test was once handling feedService.forcePreview(). Now it should
- // just be like Alt click.
- {
- desc: "Shift+Alt left click",
- setup: function() {
- gPrefService.setBoolPref("browser.altClickSave", true);
- },
- clean: function() {
- gPrefService.clearUserPref("browser.altClickSave");
- },
- event: { shiftKey: true,
- altKey: true },
- targets: [ "commonlink", "maplink" ],
- expectedInvokedMethods: [ "gatherTextUnder", "saveURL" ],
- preventDefault: true,
- },
-
- {
- desc: "Shift+Alt left click on XLinks",
- setup: function() {
- gPrefService.setBoolPref("browser.altClickSave", true);
- },
- clean: function() {
- gPrefService.clearUserPref("browser.altClickSave");
- },
- event: { shiftKey: true,
- altKey: true },
- targets: [ "mathxlink", "svgxlink"],
- expectedInvokedMethods: [ "saveURL" ],
- preventDefault: true,
- },
-
- {
- desc: "Shift click",
- setup: function() {},
- clean: function() {},
- event: { shiftKey: true },
- targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
- expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
- preventDefault: true,
- },
-
- {
- desc: "Alt click",
- setup: function() {
- gPrefService.setBoolPref("browser.altClickSave", true);
- },
- clean: function() {
- gPrefService.clearUserPref("browser.altClickSave");
- },
- event: { altKey: true },
- targets: [ "commonlink", "maplink" ],
- expectedInvokedMethods: [ "gatherTextUnder", "saveURL" ],
- preventDefault: true,
- },
-
- {
- desc: "Alt click on XLinks",
- setup: function() {
- gPrefService.setBoolPref("browser.altClickSave", true);
- },
- clean: function() {
- gPrefService.clearUserPref("browser.altClickSave");
- },
- event: { altKey: true },
- targets: [ "mathxlink", "svgxlink" ],
- expectedInvokedMethods: [ "saveURL" ],
- preventDefault: true,
- },
-
- {
- desc: "Panel click",
- setup: function() {},
- clean: function() {},
- event: {},
- targets: [ "panellink" ],
- expectedInvokedMethods: [ "urlSecurityCheck", "loadURI" ],
- preventDefault: true,
- },
-
- {
- desc: "Simple middle click opentab",
- setup: function() {},
- clean: function() {},
- event: { button: 1 },
- targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
- expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
- preventDefault: true,
- },
-
- {
- desc: "Simple middle click openwin",
- setup: function() {
- gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
- },
- clean: function() {
- gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
- },
- event: { button: 1 },
- targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
- expectedInvokedMethods: [ "urlSecurityCheck", "openLinkIn" ],
- preventDefault: true,
- },
-
- {
- desc: "Middle mouse paste",
- setup: function() {
- gPrefService.setBoolPref("middlemouse.contentLoadURL", true);
- gPrefService.setBoolPref("general.autoScroll", false);
- },
- clean: function() {
- gPrefService.clearUserPref("middlemouse.contentLoadURL");
- gPrefService.clearUserPref("general.autoScroll");
- },
- event: { button: 1 },
- targets: [ "emptylink" ],
- expectedInvokedMethods: [ "middleMousePaste" ],
- preventDefault: true,
- },
-
-];
-
-// Array of method names that will be replaced in the new window.
-let gReplacedMethods = [
- "middleMousePaste",
- "urlSecurityCheck",
- "loadURI",
- "gatherTextUnder",
- "saveURL",
- "openLinkIn",
- "getShortcutOrURI",
-];
-
-// Reference to the new window.
-let gTestWin = null;
-
-// List of methods invoked by a specific call to contentAreaClick.
-let gInvokedMethods = [];
-
-// The test currently running.
-let gCurrentTest = null;
-
-function test() {
- waitForExplicitFinish();
-
- gTestWin = openDialog(location, "", "chrome,all,dialog=no", "about:blank");
- whenDelayedStartupFinished(gTestWin, function () {
- info("Browser window opened");
- waitForFocus(function() {
- info("Browser window focused");
- waitForFocus(function() {
- info("Setting up browser...");
- setupTestBrowserWindow();
- info("Running tests...");
- executeSoon(runNextTest);
- }, gTestWin.content, true);
- }, gTestWin);
- });
-}
-
-// Click handler used to steal click events.
-let gClickHandler = {
- handleEvent: function (event) {
- let linkId = event.target.id || event.target.localName;
- is(event.type, "click",
- gCurrentTest.desc + ":Handler received a click event on " + linkId);
-
- let isPanelClick = linkId == "panellink";
- gTestWin.contentAreaClick(event, isPanelClick);
- let prevent = event.defaultPrevented;
- is(prevent, gCurrentTest.preventDefault,
- gCurrentTest.desc + ": event.defaultPrevented is correct (" + prevent + ")")
-
- // Check that all required methods have been called.
- gCurrentTest.expectedInvokedMethods.forEach(function(aExpectedMethodName) {
- isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1,
- gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked");
- });
-
- if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) {
- ok(false, "Wrong number of invoked methods");
- gInvokedMethods.forEach(function (method) info(method + " was invoked"));
- }
-
- event.preventDefault();
- event.stopPropagation();
-
- executeSoon(runNextTest);
- }
-}
-
-// Wraps around the methods' replacement mock function.
-function wrapperMethod(aInvokedMethods, aMethodName) {
- return function () {
- aInvokedMethods.push(aMethodName);
- // At least getShortcutOrURI requires to return url that is the first param.
- return arguments[0];
- }
-}
-
-function setupTestBrowserWindow() {
- // Steal click events and don't propagate them.
- gTestWin.addEventListener("click", gClickHandler, true);
-
- // Replace methods.
- gReplacedMethods.forEach(function (aMethodName) {
- gTestWin["old_" + aMethodName] = gTestWin[aMethodName];
- gTestWin[aMethodName] = wrapperMethod(gInvokedMethods, aMethodName);
- });
-
- // Inject links in content.
- let doc = gTestWin.content.document;
- let mainDiv = doc.createElement("div");
- mainDiv.innerHTML =
- '<p><a id="commonlink" href="http://mochi.test/moz/">Common link</a></p>' +
- '<p><a id="panellink" href="http://mochi.test/moz/">Panel link</a></p>' +
- '<p><a id="emptylink">Empty link</a></p>' +
- '<p><math id="mathxlink" xmlns="http://www.w3.org/1998/Math/MathML" xlink:type="simple" xlink:href="http://mochi.test/moz/"><mtext>MathML XLink</mtext></math></p>' +
- '<p><svg id="svgxlink" xmlns="http://www.w3.org/2000/svg" width="100px" height="50px" version="1.1"><a xlink:type="simple" xlink:href="http://mochi.test/moz/"><text transform="translate(10, 25)">SVG XLink</text></a></svg></p>' +
- '<p><map name="map" id="map"><area href="http://mochi.test/moz/" shape="rect" coords="0,0,128,128" /></map><img id="maplink" usemap="#map" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAABGdBTUEAALGPC%2FxhBQAAAOtJREFUeF7t0IEAAAAAgKD9qRcphAoDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGDAgAEDBgwYMGBgwIAAAT0N51AAAAAASUVORK5CYII%3D"/></p>'
- doc.body.appendChild(mainDiv);
-}
-
-function runNextTest() {
- if (!gCurrentTest) {
- gCurrentTest = gTests.shift();
- gCurrentTest.setup();
- }
-
- if (gCurrentTest.targets.length == 0) {
- info(gCurrentTest.desc + ": cleaning up...")
- gCurrentTest.clean();
-
- if (gTests.length > 0) {
- gCurrentTest = gTests.shift();
- gCurrentTest.setup();
- }
- else {
- finishTest();
- return;
- }
- }
-
- // Move to next target.
- gInvokedMethods.length = 0;
- let target = gCurrentTest.targets.shift();
-
- info(gCurrentTest.desc + ": testing " + target);
-
- // Fire click event.
- let targetElt = gTestWin.content.document.getElementById(target);
- ok(targetElt, gCurrentTest.desc + ": target is valid (" + targetElt.id + ")");
- EventUtils.synthesizeMouseAtCenter(targetElt, gCurrentTest.event, gTestWin.content);
-}
-
-function finishTest() {
- info("Restoring browser...");
- gTestWin.removeEventListener("click", gClickHandler, true);
-
- // Restore original methods.
- gReplacedMethods.forEach(function (aMethodName) {
- gTestWin[aMethodName] = gTestWin["old_" + aMethodName];
- delete gTestWin["old_" + aMethodName];
- });
-
- gTestWin.close();
- finish();
-}
diff --git a/browser/base/content/test/browser_contextSearchTabPosition.js b/browser/base/content/test/browser_contextSearchTabPosition.js
deleted file mode 100644
index 38dbc2adf..000000000
--- a/browser/base/content/test/browser_contextSearchTabPosition.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- function tabAdded(event) {
- let tab = event.target;
- tabs.push(tab);
- }
-
- let tabs = [];
-
- let container = gBrowser.tabContainer;
- container.addEventListener("TabOpen", tabAdded, false);
-
- gBrowser.addTab("about:blank");
- BrowserSearch.loadSearchFromContext("mozilla");
- BrowserSearch.loadSearchFromContext("firefox");
-
- is(tabs[0], gBrowser.tabs[3], "blank tab has been pushed to the end");
- is(tabs[1], gBrowser.tabs[1], "first search tab opens next to the current tab");
- is(tabs[2], gBrowser.tabs[2], "second search tab opens next to the first search tab");
-
- container.removeEventListener("TabOpen", tabAdded, false);
- tabs.forEach(gBrowser.removeTab, gBrowser);
-
- try {
- let cm = Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Components.interfaces.nsICategoryManager);
- cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
- } catch (ex) {
- // Health Report disabled, or no SearchesProvider.
- finish();
- return;
- }
-
- let reporter = Components.classes["@mozilla.org/datareporting/service;1"]
- .getService()
- .wrappedJSObject
- .healthReporter;
-
- // reporter should always be available in automation.
- ok(reporter, "Health Reporter available.");
- reporter.onInit().then(function onInit() {
- let provider = reporter.getProvider("org.mozilla.searches");
- ok(provider, "Searches provider is available.");
-
- let m = provider.getMeasurement("counts", 2);
- m.getValues().then(function onValues(data) {
- let now = new Date();
- ok(data.days.hasDay(now), "Have data for today.");
- let day = data.days.getDay(now);
-
- // Will need to be changed if Google isn't the default search engine.
- let field = "google.contextmenu";
- ok(day.has(field), "Have search recorded for context menu.");
-
- // If any other mochitests perform a context menu search, this will fail.
- // The solution will be to look up count at test start and ensure it is
- // incremented by two.
- is(day.get(field), 2, "2 searches recorded in FHR.");
- finish();
- });
- });
-}
-
diff --git a/browser/base/content/test/browser_ctrlTab.js b/browser/base/content/test/browser_ctrlTab.js
deleted file mode 100644
index 61937a5ff..000000000
--- a/browser/base/content/test/browser_ctrlTab.js
+++ /dev/null
@@ -1,151 +0,0 @@
-function test() {
- gPrefService.setBoolPref("browser.ctrlTab.previews", true);
-
- gBrowser.addTab();
- gBrowser.addTab();
- gBrowser.addTab();
-
- checkTabs(4);
-
- ctrlTabTest([2] , 1, 0);
- ctrlTabTest([2, 3, 1], 2, 2);
- ctrlTabTest([] , 5, 2);
-
- {
- let selectedIndex = gBrowser.tabContainer.selectedIndex;
- pressCtrlTab();
- pressCtrlTab(true);
- releaseCtrl();
- is(gBrowser.tabContainer.selectedIndex, selectedIndex,
- "Ctrl+Tab -> Ctrl+Shift+Tab keeps the selected tab");
- }
-
- { // test for bug 445369
- let tabs = gBrowser.tabs.length;
- pressCtrlTab();
- EventUtils.synthesizeKey("w", { ctrlKey: true });
- is(gBrowser.tabs.length, tabs - 1, "Ctrl+Tab -> Ctrl+W removes one tab");
- releaseCtrl();
- }
-
- { // test for bug 667314
- let tabs = gBrowser.tabs.length;
- pressCtrlTab();
- pressCtrlTab(true);
- EventUtils.synthesizeKey("w", { ctrlKey: true });
- is(gBrowser.tabs.length, tabs - 1, "Ctrl+Tab -> Ctrl+W removes the selected tab");
- releaseCtrl();
- }
-
- gBrowser.addTab();
- checkTabs(3);
- ctrlTabTest([2, 1, 0], 9, 1);
-
- gBrowser.addTab();
- checkTabs(4);
-
- { // test for bug 445369
- selectTabs([1, 2, 0]);
-
- let selectedTab = gBrowser.selectedTab;
- let tabToRemove = gBrowser.tabs[1];
-
- pressCtrlTab();
- pressCtrlTab();
- EventUtils.synthesizeKey("w", { ctrlKey: true });
- ok(!tabToRemove.parentNode,
- "Ctrl+Tab*2 -> Ctrl+W removes the second most recently selected tab");
-
- pressCtrlTab(true);
- pressCtrlTab(true);
- releaseCtrl();
- ok(selectedTab.selected,
- "Ctrl+Tab*2 -> Ctrl+W -> Ctrl+Shift+Tab*2 keeps the selected tab");
- }
- gBrowser.removeTab(gBrowser.tabContainer.lastChild);
- checkTabs(2);
-
- ctrlTabTest([1], 1, 0);
-
- gBrowser.removeTab(gBrowser.tabContainer.lastChild);
- checkTabs(1);
-
- { // test for bug 445768
- let focusedWindow = document.commandDispatcher.focusedWindow;
- let eventConsumed = true;
- let detectKeyEvent = function (event) {
- eventConsumed = event.defaultPrevented;
- };
- document.addEventListener("keypress", detectKeyEvent, false);
- pressCtrlTab();
- document.removeEventListener("keypress", detectKeyEvent, false);
- ok(eventConsumed, "Ctrl+Tab consumed by the tabbed browser if one tab is open");
- is(focusedWindow, document.commandDispatcher.focusedWindow,
- "Ctrl+Tab doesn't change focus if one tab is open");
- }
-
- // cleanup
- if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
- gPrefService.clearUserPref("browser.ctrlTab.previews");
-
- /* private utility functions */
-
- function pressCtrlTab(aShiftKey)
- EventUtils.synthesizeKey("VK_TAB", { ctrlKey: true, shiftKey: !!aShiftKey });
-
- function releaseCtrl()
- EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" });
-
- function isOpen()
- ctrlTab.isOpen;
-
- function checkTabs(aTabs) {
- var tabs = gBrowser.tabs.length;
- if (tabs != aTabs) {
- while (gBrowser.tabs.length > 1)
- gBrowser.removeCurrentTab();
- throw "expected " + aTabs + " open tabs, got " + tabs;
- }
- }
-
- function selectTabs(tabs) {
- tabs.forEach(function (index) {
- gBrowser.selectedTab = gBrowser.tabs[index];
- });
- }
-
- function ctrlTabTest(tabsToSelect, tabTimes, expectedIndex) {
- selectTabs(tabsToSelect);
-
- var indexStart = gBrowser.tabContainer.selectedIndex;
- var tabCount = gBrowser.tabs.length;
- var normalized = tabTimes % tabCount;
- var where = normalized == 1 ? "back to the previously selected tab" :
- normalized + " tabs back in most-recently-selected order";
-
- for (let i = 0; i < tabTimes; i++) {
- pressCtrlTab();
-
- if (tabCount > 2)
- is(gBrowser.tabContainer.selectedIndex, indexStart,
- "Selected tab doesn't change while tabbing");
- }
-
- if (tabCount > 2) {
- ok(isOpen(),
- "With " + tabCount + " tabs open, Ctrl+Tab opens the preview panel");
-
- releaseCtrl();
-
- ok(!isOpen(),
- "Releasing Ctrl closes the preview panel");
- } else {
- ok(!isOpen(),
- "With " + tabCount + " tabs open, Ctrl+Tab doesn't open the preview panel");
- }
-
- is(gBrowser.tabContainer.selectedIndex, expectedIndex,
- "With "+ tabCount +" tabs open and tab " + indexStart
- + " selected, Ctrl+Tab*" + tabTimes + " goes " + where);
- }
-}
diff --git a/browser/base/content/test/browser_customize.js b/browser/base/content/test/browser_customize.js
deleted file mode 100644
index 8cff36686..000000000
--- a/browser/base/content/test/browser_customize.js
+++ /dev/null
@@ -1,24 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- openToolbarCustomizationUI(customizationWindowLoaded);
-}
-
-function customizationWindowLoaded(win) {
- let x = win.screenX;
- let iconModeList = win.document.getElementById("modelist");
-
- iconModeList.addEventListener("popupshown", function popupshown() {
- iconModeList.removeEventListener("popupshown", popupshown, false);
-
- executeSoon(function () {
- is(win.screenX, x,
- "toolbar customization window shouldn't move when the iconmode menulist is opened");
- iconModeList.open = false;
-
- closeToolbarCustomizationUI(finish);
- });
- }, false);
-
- iconModeList.open = true;
-}
diff --git a/browser/base/content/test/browser_customize_popupNotification.js b/browser/base/content/test/browser_customize_popupNotification.js
deleted file mode 100644
index 138e0dc47..000000000
--- a/browser/base/content/test/browser_customize_popupNotification.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Any copyright is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/
-*/
-
-function test() {
- waitForExplicitFinish();
- let newWin = OpenBrowserWindow();
- whenDelayedStartupFinished(newWin, function () {
- // Remove the URL bar
- newWin.gURLBar.parentNode.removeChild(newWin.gURLBar);
-
- waitForFocus(function () {
- let PN = newWin.PopupNotifications;
- try {
- let notification = PN.show(newWin.gBrowser.selectedBrowser, "some-notification", "Some message");
- ok(notification, "showed the notification");
- ok(PN.isPanelOpen, "panel is open");
- is(PN.panel.anchorNode, newWin.gBrowser.selectedTab, "notification is correctly anchored to the tab");
- } catch (ex) {
- ok(false, "threw exception: " + ex);
- }
- newWin.close();
- finish();
- }, newWin);
- });
-}
diff --git a/browser/base/content/test/browser_datareporting_notification.js b/browser/base/content/test/browser_datareporting_notification.js
deleted file mode 100644
index b892bd009..000000000
--- a/browser/base/content/test/browser_datareporting_notification.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function sendNotifyRequest(name) {
- let ns = {};
- Components.utils.import("resource://gre/modules/services/datareporting/policy.jsm", ns);
- Components.utils.import("resource://gre/modules/Preferences.jsm", ns);
-
- let service = Components.classes["@mozilla.org/datareporting/service;1"]
- .getService(Components.interfaces.nsISupports)
- .wrappedJSObject;
- ok(service.healthReporter, "Health Reporter instance is available.");
-
- let policyPrefs = new ns.Preferences("testing." + name + ".");
- ok(service._prefs, "Health Reporter prefs are available.");
- let hrPrefs = service._prefs;
-
- let policy = new ns.DataReportingPolicy(policyPrefs, hrPrefs, service);
- policy.firstRunDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
-
- is(policy.notifyState, policy.STATE_NOTIFY_UNNOTIFIED, "Policy is in unnotified state.");
-
- service.healthReporter.onInit().then(function onInit() {
- is(policy.ensureNotifyResponse(new Date()), false, "User has not responded to policy.");
- });
-
- return policy;
-}
-
-/**
- * Wait for a <notification> to be closed then call the specified callback.
- */
-function waitForNotificationClose(notification, cb) {
- let parent = notification.parentNode;
-
- let observer = new MutationObserver(function onMutatations(mutations) {
- for (let mutation of mutations) {
- for (let i = 0; i < mutation.removedNodes.length; i++) {
- let node = mutation.removedNodes.item(i);
-
- if (node != notification) {
- continue;
- }
-
- observer.disconnect();
- cb();
- }
- }
- });
-
- observer.observe(parent, {childList: true});
-}
-
-let dumpAppender, rootLogger;
-
-function test() {
- waitForExplicitFinish();
-
- let ns = {};
- Components.utils.import("resource://services-common/log4moz.js", ns);
- rootLogger = ns.Log4Moz.repository.rootLogger;
- dumpAppender = new ns.Log4Moz.DumpAppender();
- dumpAppender.level = ns.Log4Moz.Level.All;
- rootLogger.addAppender(dumpAppender);
-
- let notification = document.getElementById("global-notificationbox");
- let policy;
-
- notification.addEventListener("AlertActive", function active() {
- notification.removeEventListener("AlertActive", active, true);
-
- executeSoon(function afterNotification() {
- is(policy.notifyState, policy.STATE_NOTIFY_WAIT, "Policy is waiting for user response.");
- ok(!policy.dataSubmissionPolicyAccepted, "Data submission policy not yet accepted.");
-
- waitForNotificationClose(notification.currentNotification, function onClose() {
- is(policy.notifyState, policy.STATE_NOTIFY_COMPLETE, "Closing info bar completes user notification.");
- ok(policy.dataSubmissionPolicyAccepted, "Data submission policy accepted.");
- is(policy.dataSubmissionPolicyResponseType, "accepted-info-bar-dismissed",
- "Reason for acceptance was info bar dismissal.");
- is(notification.allNotifications.length, 0, "No notifications remain.");
- test_multiple_windows();
- });
- notification.currentNotification.close();
- });
- }, true);
-
- policy = sendNotifyRequest("single_window_notified");
-}
-
-function test_multiple_windows() {
- // Ensure we see the notification on all windows and that action on one window
- // results in dismiss on every window.
- let window2 = OpenBrowserWindow();
- whenDelayedStartupFinished(window2, function onWindow() {
- let notification1 = document.getElementById("global-notificationbox");
- let notification2 = window2.document.getElementById("global-notificationbox");
- ok(notification2, "2nd window has a global notification box.");
-
- let policy;
-
- let displayCount = 0;
- let prefPaneClosed = false;
- let childWindowClosed = false;
-
- function onAlertDisplayed() {
- displayCount++;
-
- if (displayCount != 2) {
- return;
- }
-
- ok(true, "Data reporting info bar displayed on all open windows.");
-
- // We register two independent observers and we need both to clean up
- // properly. This handles gating for test completion.
- function maybeFinish() {
- if (!prefPaneClosed) {
- dump("Not finishing test yet because pref pane isn't closed.\n");
- return;
- }
-
- if (!childWindowClosed) {
- dump("Not finishing test yet because child window isn't closed.\n");
- return;
- }
-
- dump("Finishing multiple window test.\n");
- rootLogger.removeAppender(dumpAppender);
- delete dumpAppender;
- delete rootLogger;
- finish();
- }
-
- let closeCount = 0;
- function onAlertClose() {
- closeCount++;
-
- if (closeCount != 2) {
- return;
- }
-
- ok(true, "Closing info bar on one window closed them on all.");
-
- is(policy.notifyState, policy.STATE_NOTIFY_COMPLETE,
- "Closing info bar with multiple windows completes notification.");
- ok(policy.dataSubmissionPolicyAccepted, "Data submission policy accepted.");
- is(policy.dataSubmissionPolicyResponseType, "accepted-info-bar-button-pressed",
- "Policy records reason for acceptance was button press.");
- is(notification1.allNotifications.length, 0, "No notifications remain on main window.");
- is(notification2.allNotifications.length, 0, "No notifications remain on 2nd window.");
-
- window2.close();
- childWindowClosed = true;
- maybeFinish();
- }
-
- waitForNotificationClose(notification1.currentNotification, onAlertClose);
- waitForNotificationClose(notification2.currentNotification, onAlertClose);
-
- // While we're here, we dual purpose this test to check that pressing the
- // button does the right thing.
- let buttons = notification2.currentNotification.getElementsByTagName("button");
- is(buttons.length, 1, "There is 1 button in the data reporting notification.");
- let button = buttons[0];
-
- // Automatically close preferences window when it is opened as part of
- // button press.
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
-
- ok(true, "Pref pane opened on info bar button press.");
- executeSoon(function soon() {
- dump("Closing pref pane.\n");
- prefWin.close();
- prefPaneClosed = true;
- maybeFinish();
- });
- }, "advanced-pane-loaded", false);
-
- button.click();
- }
-
- notification1.addEventListener("AlertActive", function active1() {
- notification1.removeEventListener("AlertActive", active1, true);
- executeSoon(onAlertDisplayed);
- }, true);
-
- notification2.addEventListener("AlertActive", function active2() {
- notification2.removeEventListener("AlertActive", active2, true);
- executeSoon(onAlertDisplayed);
- }, true);
-
- policy = sendNotifyRequest("multiple_window_behavior");
- });
-}
-
diff --git a/browser/base/content/test/browser_disablechrome.js b/browser/base/content/test/browser_disablechrome.js
deleted file mode 100644
index b9c6a74ce..000000000
--- a/browser/base/content/test/browser_disablechrome.js
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that the disablechrome attribute gets propogated to the main UI
-
-const HTTPSRC = "http://example.com/browser/browser/base/content/test/";
-
-function is_element_hidden(aElement) {
- var style = window.getComputedStyle(document.getElementById("nav-bar"), "");
- if (style.visibility != "visible" || style.display == "none")
- return true;
-
- if (aElement.ownerDocument != aElement.parentNode)
- return is_element_hidden(aElement.parentNode);
-
- return false;
-}
-
-function is_chrome_hidden() {
- is(document.documentElement.getAttribute("disablechrome"), "true", "Attribute should be set");
- if (TabsOnTop.enabled)
- ok(is_element_hidden(document.getElementById("nav-bar")), "Toolbar should be hidden");
- else
- ok(!is_element_hidden(document.getElementById("nav-bar")), "Toolbar should not be hidden");
-}
-
-function is_chrome_visible() {
- isnot(document.getElementById("main-window").getAttribute("disablechrome"), "true", "Attribute should not be set");
- ok(!is_element_hidden(document.getElementById("nav-bar")), "Toolbar should not be hidden");
-}
-
-function load_page(aURL, aCanHide, aCallback) {
- gNewBrowser.addEventListener("pageshow", function() {
- // Filter out about:blank loads
- if (gNewBrowser.currentURI.spec != aURL)
- return;
-
- gNewBrowser.removeEventListener("pageshow", arguments.callee, false);
-
- if (aCanHide)
- is_chrome_hidden();
- else
- is_chrome_visible();
-
- if (aURL == "about:addons") {
- function check_after_init() {
- if (aCanHide)
- is_chrome_hidden();
- else
- is_chrome_visible();
-
- aCallback();
- }
-
- if (gNewBrowser.contentWindow.gIsInitializing) {
- gNewBrowser.contentDocument.addEventListener("Initialized", function() {
- gNewBrowser.contentDocument.removeEventListener("Initialized", arguments.callee, false);
-
- check_after_init();
- }, false);
- }
- else {
- check_after_init();
- }
- }
- else {
- executeSoon(aCallback);
- }
- }, false);
- gNewBrowser.loadURI(aURL);
-}
-
-var gOldTab;
-var gNewTab;
-var gNewBrowser;
-
-function test() {
- // Opening the add-ons manager and waiting for it to load the discovery pane
- // takes more time in windows debug builds
- requestLongerTimeout(2);
-
- var gOldTabsOnTop = TabsOnTop.enabled;
- registerCleanupFunction(function() {
- TabsOnTop.enabled = gOldTabsOnTop;
- });
-
- waitForExplicitFinish();
-
- gOldTab = gBrowser.selectedTab;
- gNewTab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
- gNewBrowser = gBrowser.selectedBrowser;
-
- info("Tabs on top");
- TabsOnTop.enabled = true;
-
- run_http_test_1();
-}
-
-function end_test() {
- gBrowser.removeTab(gNewTab);
- finish();
-}
-
-function test_url(aURL, aCanHide, aNextTest) {
- is_chrome_visible();
- info("Page load");
- load_page(aURL, aCanHide, function() {
- info("Switch away");
- gBrowser.selectedTab = gOldTab;
- is_chrome_visible();
-
- info("Switch back");
- gBrowser.selectedTab = gNewTab;
- if (aCanHide)
- is_chrome_hidden();
- else
- is_chrome_visible();
-
- gBrowser.removeTab(gNewTab);
- gNewTab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
- gNewBrowser = gBrowser.selectedBrowser;
-
- gBrowser.selectedTab = gOldTab;
-
- info("Background load");
- load_page(aURL, false, function() {
- info("Switch back");
- gBrowser.selectedTab = gNewTab;
- if (aCanHide)
- is_chrome_hidden();
- else
- is_chrome_visible();
-
- load_page("about:blank", false, aNextTest);
- });
- });
-}
-
-// Should never hide the chrome
-function run_http_test_1() {
- info("HTTP tests");
- test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test);
-}
-
-// Should hide the chrome
-function run_chrome_about_test() {
- info("Chrome about: tests");
- test_url("about:addons", true, function() {
- info("Tabs on bottom");
- TabsOnTop.enabled = false;
- run_http_test_2();
- });
-}
-
-// Should never hide the chrome
-function run_http_test_2() {
- info("HTTP tests");
- test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_2);
-}
-
-// Should not hide the chrome
-function run_chrome_about_test_2() {
- info("Chrome about: tests");
- test_url("about:addons", true, run_http_test3);
-}
-
-function run_http_test3() {
- info("HTTP tests");
- test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_3);
-}
-
-// Should not hide the chrome
-function run_chrome_about_test_3() {
- info("Chrome about: tests");
- test_url("about:Addons", true, function(){
- info("Tabs on top");
- TabsOnTop.enabled = true;
- run_http_test4();
- });
-}
-
-function run_http_test4() {
- info("HTTP tests");
- test_url(HTTPSRC + "disablechrome.html", false, run_chrome_about_test_4);
-}
-
-function run_chrome_about_test_4() {
- info("Chrome about: tests");
- test_url("about:Addons", true, end_test);
-} \ No newline at end of file
diff --git a/browser/base/content/test/browser_discovery.js b/browser/base/content/test/browser_discovery.js
deleted file mode 100644
index 61098fbef..000000000
--- a/browser/base/content/test/browser_discovery.js
+++ /dev/null
@@ -1,159 +0,0 @@
-var browser;
-
-function doc() browser.contentDocument;
-
-function setHandlerFunc(aResultFunc) {
- gBrowser.addEventListener("DOMLinkAdded", function (event) {
- gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, false);
- executeSoon(aResultFunc);
- }, false);
-}
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- browser = gBrowser.selectedBrowser;
- browser.addEventListener("load", function (event) {
- event.currentTarget.removeEventListener("load", arguments.callee, true);
- iconDiscovery();
- }, true);
- var rootDir = getRootDirectory(gTestPath);
- content.location = rootDir + "discovery.html";
-}
-
-var iconDiscoveryTests = [
- { text: "rel icon discovered" },
- { rel: "abcdefg icon qwerty", text: "rel may contain additional rels separated by spaces" },
- { rel: "ICON", text: "rel is case insensitive" },
- { rel: "shortcut-icon", pass: false, text: "rel shortcut-icon not discovered" },
- { href: "moz.png", text: "relative href works" },
- { href: "notthere.png", text: "404'd icon is removed properly" },
- { href: "data:image/x-icon,%00", type: "image/x-icon", text: "data: URIs work" },
- { type: "image/png; charset=utf-8", text: "type may have optional parameters (RFC2046)" }
-];
-
-function runIconDiscoveryTest() {
- var test = iconDiscoveryTests[0];
- var head = doc().getElementById("linkparent");
- var hasSrc = gBrowser.getIcon() != null;
- if (test.pass)
- ok(hasSrc, test.text);
- else
- ok(!hasSrc, test.text);
-
- head.removeChild(head.getElementsByTagName('link')[0]);
- iconDiscoveryTests.shift();
- iconDiscovery(); // Run the next test.
-}
-
-function iconDiscovery() {
- if (iconDiscoveryTests.length) {
- setHandlerFunc(runIconDiscoveryTest);
- gBrowser.setIcon(gBrowser.selectedTab, null);
-
- var test = iconDiscoveryTests[0];
- var head = doc().getElementById("linkparent");
- var link = doc().createElement("link");
-
- var rootDir = getRootDirectory(gTestPath);
- var rel = test.rel || "icon";
- var href = test.href || rootDir + "moz.png";
- var type = test.type || "image/png";
- if (test.pass == undefined)
- test.pass = true;
-
- link.rel = rel;
- link.href = href;
- link.type = type;
- head.appendChild(link);
- } else {
- searchDiscovery();
- }
-}
-
-var searchDiscoveryTests = [
- { text: "rel search discovered" },
- { rel: "SEARCH", text: "rel is case insensitive" },
- { rel: "-search-", pass: false, text: "rel -search- not discovered" },
- { rel: "foo bar baz search quux", text: "rel may contain additional rels separated by spaces" },
- { href: "https://not.mozilla.com", text: "HTTPS ok" },
- { href: "ftp://not.mozilla.com", text: "FTP ok" },
- { href: "data:text/foo,foo", pass: false, text: "data URI not permitted" },
- { href: "javascript:alert(0)", pass: false, text: "JS URI not permitted" },
- { type: "APPLICATION/OPENSEARCHDESCRIPTION+XML", text: "type is case insensitve" },
- { type: " application/opensearchdescription+xml ", text: "type may contain extra whitespace" },
- { type: "application/opensearchdescription+xml; charset=utf-8", text: "type may have optional parameters (RFC2046)" },
- { type: "aapplication/opensearchdescription+xml", pass: false, text: "type should not be loosely matched" },
- { rel: "search search search", count: 1, text: "only one engine should be added" }
-];
-
-function runSearchDiscoveryTest() {
- var test = searchDiscoveryTests[0];
- var title = test.title || searchDiscoveryTests.length;
- if (browser.engines) {
- var hasEngine = (test.count) ? (browser.engines[0].title == title &&
- browser.engines.length == test.count) :
- (browser.engines[0].title == title);
- ok(hasEngine, test.text);
- browser.engines = null;
- }
- else
- ok(!test.pass, test.text);
-
- searchDiscoveryTests.shift();
- searchDiscovery(); // Run the next test.
-}
-
-// This handler is called twice, once for each added link element.
-// Only want to check once the second link element has been added.
-var ranOnce = false;
-function runMultipleEnginesTestAndFinalize() {
- if (!ranOnce) {
- ranOnce = true;
- return;
- }
- ok(browser.engines, "has engines");
- is(browser.engines.length, 1, "only one engine");
- is(browser.engines[0].uri, "http://first.mozilla.com/search.xml", "first engine wins");
-
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function searchDiscovery() {
- var head = doc().getElementById("linkparent");
-
- if (searchDiscoveryTests.length) {
- setHandlerFunc(runSearchDiscoveryTest);
- var test = searchDiscoveryTests[0];
- var link = doc().createElement("link");
-
- var rel = test.rel || "search";
- var href = test.href || "http://so.not.here.mozilla.com/search.xml";
- var type = test.type || "application/opensearchdescription+xml";
- var title = test.title || searchDiscoveryTests.length;
- if (test.pass == undefined)
- test.pass = true;
-
- link.rel = rel;
- link.href = href;
- link.type = type;
- link.title = title;
- head.appendChild(link);
- } else {
- setHandlerFunc(runMultipleEnginesTestAndFinalize);
- setHandlerFunc(runMultipleEnginesTestAndFinalize);
- // Test multiple engines with the same title
- var link = doc().createElement("link");
- link.rel = "search";
- link.href = "http://first.mozilla.com/search.xml";
- link.type = "application/opensearchdescription+xml";
- link.title = "Test Engine";
- var link2 = link.cloneNode(false);
- link2.href = "http://second.mozilla.com/search.xml";
-
- head.appendChild(link);
- head.appendChild(link2);
- }
-}
diff --git a/browser/base/content/test/browser_drag.js b/browser/base/content/test/browser_drag.js
deleted file mode 100644
index 6aa14bea0..000000000
--- a/browser/base/content/test/browser_drag.js
+++ /dev/null
@@ -1,45 +0,0 @@
-function test()
-{
- waitForExplicitFinish();
-
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let ChromeUtils = {};
- scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
- // ---- Test dragging the proxy icon ---
- var value = content.location.href;
- var urlString = value + "\n" + content.document.title;
- var htmlString = "<a href=\"" + value + "\">" + value + "</a>";
- var expected = [ [
- { type : "text/x-moz-url",
- data : urlString },
- { type : "text/uri-list",
- data : value },
- { type : "text/plain",
- data : value },
- { type : "text/html",
- data : htmlString }
- ] ];
- // set the valid attribute so dropping is allowed
- var oldstate = gURLBar.getAttribute("pageproxystate");
- gURLBar.setAttribute("pageproxystate", "valid");
- var dt = EventUtils.synthesizeDragStart(document.getElementById("identity-box"), expected);
- is(dt, null, "drag on proxy icon");
- gURLBar.setAttribute("pageproxystate", oldstate);
- // Now, the identity information panel is opened by the proxy icon click.
- // We need to close it for next tests.
- EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
-
- // now test dragging onto a tab
- var tab = gBrowser.addTab("about:blank", {skipAnimation: true});
- var browser = gBrowser.getBrowserForTab(tab);
-
- browser.addEventListener("load", function () {
- is(browser.contentWindow.location, "http://mochi.test:8888/", "drop on tab");
- gBrowser.removeTab(tab);
- finish();
- }, true);
-
- ChromeUtils.synthesizeDrop(tab, tab, [[{type: "text/uri-list", data: "http://mochi.test:8888/"}]], "copy", window);
-}
diff --git a/browser/base/content/test/browser_duplicateIDs.js b/browser/base/content/test/browser_duplicateIDs.js
deleted file mode 100644
index 38fc17820..000000000
--- a/browser/base/content/test/browser_duplicateIDs.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function test() {
- var ids = {};
- Array.forEach(document.querySelectorAll("[id]"), function (node) {
- var id = node.id;
- ok(!(id in ids), id + " should be unique");
- ids[id] = null;
- });
-}
diff --git a/browser/base/content/test/browser_findbarClose.js b/browser/base/content/test/browser_findbarClose.js
deleted file mode 100644
index 7a4ff5470..000000000
--- a/browser/base/content/test/browser_findbarClose.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests find bar auto-close behavior
-
-let newTab, iframe;
-
-function test() {
- waitForExplicitFinish();
- newTab = gBrowser.addTab("about:blank");
- newTab.linkedBrowser.addEventListener("DOMContentLoaded",
- prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
- newTab.linkedBrowser.contentWindow.location = "http://example.com/browser/" +
- "browser/base/content/test/test_bug628179.html";
-}
-
-function prepareTestFindBarStaysOpenOnSubdocumentLocationChange() {
- newTab.linkedBrowser.removeEventListener("DOMContentLoaded",
- prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
-
- gFindBar.open();
-
- iframe = newTab.linkedBrowser.contentDocument.getElementById("iframe");
- iframe.addEventListener("load",
- testFindBarStaysOpenOnSubdocumentLocationChange, false);
- iframe.src = "http://example.org/";
-}
-
-function testFindBarStaysOpenOnSubdocumentLocationChange() {
- iframe.removeEventListener("load",
- testFindBarStaysOpenOnSubdocumentLocationChange, false);
-
- ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
- "subdocument changes");
-
- gFindBar.close();
- gBrowser.removeTab(newTab);
- finish();
-}
-
diff --git a/browser/base/content/test/browser_fullscreen-window-open.js b/browser/base/content/test/browser_fullscreen-window-open.js
deleted file mode 100644
index 4504cb104..000000000
--- a/browser/base/content/test/browser_fullscreen-window-open.js
+++ /dev/null
@@ -1,394 +0,0 @@
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-
-const PREF_DISABLE_OPEN_NEW_WINDOW = "browser.link.open_newwindow.disabled_in_fullscreen";
-const isOSX = (Services.appinfo.OS === "Darwin");
-
-const TEST_FILE = "file_fullscreen-window-open.html";
-const gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/",
- "http://127.0.0.1:8888/");
-
-function test () {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, true);
-
- let newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
-
- let gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", function onLoad(){
- gTestBrowser.removeEventListener("load", onLoad, true, true);
-
- // Enter browser fullscreen mode.
- BrowserFullScreen();
-
- runNextTest();
- }, true, true);
- gTestBrowser.contentWindow.location.href = gHttpTestRoot + TEST_FILE;
-}
-
-registerCleanupFunction(function(){
- // Exit browser fullscreen mode.
- BrowserFullScreen();
-
- gBrowser.removeCurrentTab();
-
- Services.prefs.clearUserPref(PREF_DISABLE_OPEN_NEW_WINDOW);
-});
-
-let gTests = [
- test_open,
- test_open_with_size,
- test_open_with_pos,
- test_open_with_outerSize,
- test_open_with_innerSize,
- test_open_with_dialog,
- test_open_when_open_new_window_by_pref,
- test_open_with_pref_to_disable_in_fullscreen,
- test_open_from_chrome,
-];
-
-function runNextTest () {
- let test = gTests.shift();
- if (test) {
- executeSoon(test);
- }
- else {
- finish();
- }
-}
-
-
-// Test for window.open() with no feature.
-function test_open() {
- waitForTabOpen({
- message: {
- title: "test_open",
- param: "",
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open() with width/height.
-function test_open_with_size() {
- waitForTabOpen({
- message: {
- title: "test_open_with_size",
- param: "width=400,height=400",
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open() with top/left.
-function test_open_with_pos() {
- waitForTabOpen({
- message: {
- title: "test_open_with_pos",
- param: "top=200,left=200",
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open() with outerWidth/Height.
-function test_open_with_outerSize() {
- let [outerWidth, outerHeight] = [window.outerWidth, window.outerHeight];
- waitForTabOpen({
- message: {
- title: "test_open_with_outerSize",
- param: "outerWidth=200,outerHeight=200",
- },
- successFn: function () {
- is(window.outerWidth, outerWidth, "Don't change window.outerWidth.");
- is(window.outerHeight, outerHeight, "Don't change window.outerHeight.");
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open() with innerWidth/Height.
-function test_open_with_innerSize() {
- let [innerWidth, innerHeight] = [window.innerWidth, window.innerHeight];
- waitForTabOpen({
- message: {
- title: "test_open_with_innerSize",
- param: "innerWidth=200,innerHeight=200",
- },
- successFn: function () {
- is(window.innerWidth, innerWidth, "Don't change window.innerWidth.");
- is(window.innerHeight, innerHeight, "Don't change window.innerHeight.");
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open() with dialog.
-function test_open_with_dialog() {
- waitForTabOpen({
- message: {
- title: "test_open_with_dialog",
- param: "dialog=yes",
- },
- finalizeFn: function () {},
- });
-}
-
-// Test for window.open()
-// when "browser.link.open_newwindow" is nsIBrowserDOMWindow.OPEN_NEWWINDOW
-function test_open_when_open_new_window_by_pref() {
- const PREF_NAME = "browser.link.open_newwindow";
- Services.prefs.setIntPref(PREF_NAME, Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW);
- is(Services.prefs.getIntPref(PREF_NAME), Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW,
- PREF_NAME + " is nsIBrowserDOMWindow.OPEN_NEWWINDOW at this time");
-
- waitForTabOpen({
- message: {
- title: "test_open_when_open_new_window_by_pref",
- param: "width=400,height=400",
- },
- finalizeFn: function () {
- Services.prefs.clearUserPref(PREF_NAME);
- },
- });
-}
-
-// Test for the pref, "browser.link.open_newwindow.disabled_in_fullscreen"
-function test_open_with_pref_to_disable_in_fullscreen() {
- Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, false);
-
- waitForWindowOpen({
- message: {
- title: "test_open_with_pref_disabled_in_fullscreen",
- param: "width=400,height=400",
- },
- finalizeFn: function () {
- Services.prefs.setBoolPref(PREF_DISABLE_OPEN_NEW_WINDOW, true);
- },
- });
-}
-
-
-// Test for window.open() called from chrome context.
-function test_open_from_chrome() {
- waitForWindowOpenFromChrome({
- message: {
- title: "test_open_from_chrome",
- param: "",
- },
- finalizeFn: function () {},
- timeout: 10000,
- });
-}
-
-function waitForTabOpen(aOptions) {
- let start = Date.now();
- let timeout = aOptions.timeout || 5000;
- let message = aOptions.message;
-
- if (!message.title) {
- ok(false, "Can't get message.title.");
- aOptions.finalizeFn();
- runNextTest();
- return;
- }
-
- info("Running test: " + message.title);
-
- let onTabOpen = function onTabOpen(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
-
- let tab = aEvent.target;
- tab.linkedBrowser.addEventListener("load", function onLoad(ev){
- let browser = ev.currentTarget;
- browser.removeEventListener("load", onLoad, true, true);
- clearTimeout(onTimeout);
-
- is(browser.contentWindow.document.title, message.title,
- "Opened Tab is expected: " + message.title);
-
- if (aOptions.successFn) {
- aOptions.successFn();
- }
-
- gBrowser.removeTab(tab);
- finalize();
- }, true, true);
- }
- gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
-
- let finalize = function () {
- aOptions.finalizeFn();
- info("Finished: " + message.title);
- runNextTest();
- };
-
- let onTimeout = setTimeout(function(){
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
-
- ok(false, "Timeout: '"+message.title + "'.");
- finalize();
- }, timeout);
-
-
- const URI = "data:text/html;charset=utf-8,<!DOCTYPE html><html><head><title>"+
- message.title +
- "<%2Ftitle><%2Fhead><body><%2Fbody><%2Fhtml>";
-
- executeWindowOpenInContent({
- uri: URI,
- title: message.title,
- option: message.param,
- });
-}
-
-
-function waitForWindowOpen(aOptions) {
- let start = Date.now();
- let timeout = aOptions.timeout || 10000;
- let message = aOptions.message;
- let url = aOptions.url || getBrowserURL();
-
- if (!message.title) {
- ok(false, "Can't get message.title");
- aOptions.finalizeFn();
- runNextTest();
- return;
- }
-
- info("Running test: " + message.title);
-
- let onFinalize = function () {
- aOptions.finalizeFn();
-
- info("Finished: " + message.title);
- runNextTest();
- };
-
- let onTimeout = setTimeout(function(){
- Services.wm.removeListener(listener);
- ok(false, "Fail: '"+message.title + "'.");
-
- onFinalize();
- }, timeout);
-
- let listener = new WindowListener(message.title, url, {
- onSuccess: aOptions.successFn,
- onTimeout: onTimeout,
- onFinalize: onFinalize,
- });
- Services.wm.addListener(listener);
-
- const URI = aOptions.url || "about:blank";
-
- executeWindowOpenInContent({
- uri: URI,
- title: message.title,
- option: message.param,
- });
-}
-
-function executeWindowOpenInContent(aParam) {
- var testWindow = gBrowser.selectedBrowser.contentWindow;
- var testElm = testWindow.document.getElementById("test");
-
- testElm.setAttribute("data-test-param", JSON.stringify(aParam));
- EventUtils.synthesizeMouseAtCenter(testElm, {}, testWindow);
-}
-
-function waitForWindowOpenFromChrome(aOptions) {
- let start = Date.now();
- let timeout = aOptions.timeout || 10000;
- let message = aOptions.message;
- let url = aOptions.url || getBrowserURL();
-
- if (!message.title) {
- ok(false, "Can't get message.title");
- aOptions.finalizeFn();
- runNextTest();
- return;
- }
-
- info("Running test: " + message.title);
-
- let onFinalize = function () {
- aOptions.finalizeFn();
-
- info("Finished: " + message.title);
- runNextTest();
- };
-
- let onTimeout = setTimeout(function(){
- Services.wm.removeListener(listener);
- ok(false, "Fail: '"+message.title + "'.");
-
- testWindow.close();
- onFinalize();
- }, timeout);
-
- let listener = new WindowListener(message.title, url, {
- onSuccess: aOptions.successFn,
- onTimeout: onTimeout,
- onFinalize: onFinalize,
- });
- Services.wm.addListener(listener);
-
-
- const URI = aOptions.url || "about:blank";
-
- let testWindow = window.open(URI, message.title, message.option);
-}
-
-function WindowListener(aTitle, aUrl, aCallBackObj) {
- this.test_title = aTitle;
- this.test_url = aUrl;
- this.callback_onSuccess = aCallBackObj.onSuccess;
- this.callBack_onTimeout = aCallBackObj.onTimeout;
- this.callBack_onFinalize = aCallBackObj.onFinalize;
-}
-WindowListener.prototype = {
-
- test_title: null,
- test_url: null,
- callback_onSuccess: null,
- callBack_onTimeout: null,
- callBack_onFinalize: null,
-
- onOpenWindow: function(aXULWindow) {
- Services.wm.removeListener(this);
-
- let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- domwindow.addEventListener("load", function onLoad(aEvent) {
- is(domwindow.document.location.href, this.test_url,
- "Opened Window is expected: "+ this.test_title);
- if (this.callback_onSuccess) {
- this.callback_onSuccess();
- }
-
- domwindow.removeEventListener("load", onLoad, true);
- clearTimeout(this.callBack_onTimeout);
-
- // wait for trasition to fullscreen on OSX Lion later
- if (isOSX) {
- setTimeout(function(){
- domwindow.close();
- executeSoon(this.callBack_onFinalize);
- }.bind(this), 3000);
- }
- else {
- domwindow.close();
- executeSoon(this.callBack_onFinalize);
- }
- }.bind(this), true);
- },
- onCloseWindow: function(aXULWindow) {},
- onWindowTitleChange: function(aXULWindow, aNewTitle) {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener,
- Ci.nsISupports]),
-};
diff --git a/browser/base/content/test/browser_gestureSupport.js b/browser/base/content/test/browser_gestureSupport.js
deleted file mode 100644
index d60ae58f4..000000000
--- a/browser/base/content/test/browser_gestureSupport.js
+++ /dev/null
@@ -1,671 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Simple gestures tests
-//
-// These tests require the ability to disable the fact that the
-// Firefox chrome intentionally prevents "simple gesture" events from
-// reaching web content.
-
-let test_utils;
-let test_commandset;
-let test_prefBranch = "browser.gesture.";
-
-function test()
-{
- waitForExplicitFinish();
-
- // Disable the default gestures support during the test
- gGestureSupport.init(false);
-
- test_utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
-
- // Run the tests of "simple gesture" events generally
- test_EnsureConstantsAreDisjoint();
- test_TestEventListeners();
- test_TestEventCreation();
-
- // Reenable the default gestures support. The remaining tests target
- // the Firefox gesture functionality.
- gGestureSupport.init(true);
-
- // Test Firefox's gestures support.
- test_commandset = document.getElementById("mainCommandSet");
- test_swipeGestures();
- test_latchedGesture("pinch", "out", "in", "MozMagnifyGesture");
- test_thresholdGesture("pinch", "out", "in", "MozMagnifyGesture");
- test_rotateGestures();
-}
-
-let test_eventCount = 0;
-let test_expectedType;
-let test_expectedDirection;
-let test_expectedDelta;
-let test_expectedModifiers;
-let test_expectedClickCount;
-let test_imageTab;
-
-function test_gestureListener(evt)
-{
- is(evt.type, test_expectedType,
- "evt.type (" + evt.type + ") does not match expected value");
- is(evt.target, test_utils.elementFromPoint(20, 20, false, false),
- "evt.target (" + evt.target + ") does not match expected value");
- is(evt.clientX, 20,
- "evt.clientX (" + evt.clientX + ") does not match expected value");
- is(evt.clientY, 20,
- "evt.clientY (" + evt.clientY + ") does not match expected value");
- isnot(evt.screenX, 0,
- "evt.screenX (" + evt.screenX + ") does not match expected value");
- isnot(evt.screenY, 0,
- "evt.screenY (" + evt.screenY + ") does not match expected value");
-
- is(evt.direction, test_expectedDirection,
- "evt.direction (" + evt.direction + ") does not match expected value");
- is(evt.delta, test_expectedDelta,
- "evt.delta (" + evt.delta + ") does not match expected value");
-
- is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.SHIFT_MASK) != 0,
- "evt.shiftKey did not match expected value");
- is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.CONTROL_MASK) != 0,
- "evt.ctrlKey did not match expected value");
- is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.ALT_MASK) != 0,
- "evt.altKey did not match expected value");
- is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.META_MASK) != 0,
- "evt.metaKey did not match expected value");
-
- if (evt.type == "MozTapGesture") {
- is(evt.clickCount, test_expectedClickCount, "evt.clickCount does not match");
- }
-
- test_eventCount++;
-}
-
-function test_helper1(type, direction, delta, modifiers)
-{
- // Setup the expected values
- test_expectedType = type;
- test_expectedDirection = direction;
- test_expectedDelta = delta;
- test_expectedModifiers = modifiers;
-
- let expectedEventCount = test_eventCount + 1;
-
- document.addEventListener(type, test_gestureListener, true);
- test_utils.sendSimpleGestureEvent(type, 20, 20, direction, delta, modifiers);
- document.removeEventListener(type, test_gestureListener, true);
-
- is(expectedEventCount, test_eventCount, "Event (" + type + ") was never received by event listener");
-}
-
-function test_clicks(type, clicks)
-{
- // Setup the expected values
- test_expectedType = type;
- test_expectedDirection = 0;
- test_expectedDelta = 0;
- test_expectedModifiers = 0;
- test_expectedClickCount = clicks;
-
- let expectedEventCount = test_eventCount + 1;
-
- document.addEventListener(type, test_gestureListener, true);
- test_utils.sendSimpleGestureEvent(type, 20, 20, 0, 0, 0, clicks);
- document.removeEventListener(type, test_gestureListener, true);
-
- is(expectedEventCount, test_eventCount, "Event (" + type + ") was never received by event listener");
-}
-
-function test_TestEventListeners()
-{
- let e = test_helper1; // easier to type this name
-
- // Swipe gesture animation events
- e("MozSwipeGestureStart", 0, -0.7, 0);
- e("MozSwipeGestureUpdate", 0, -0.4, 0);
- e("MozSwipeGestureEnd", 0, 0, 0);
- e("MozSwipeGestureStart", 0, 0.6, 0);
- e("MozSwipeGestureUpdate", 0, 0.3, 0);
- e("MozSwipeGestureEnd", 0, 1, 0);
-
- // Swipe gesture event
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_UP, 0.0, 0);
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_DOWN, 0.0, 0);
- e("MozSwipeGesture",
- SimpleGestureEvent.DIRECTION_UP | SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
- e("MozSwipeGesture",
- SimpleGestureEvent.DIRECTION_DOWN | SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
- e("MozSwipeGesture",
- SimpleGestureEvent.DIRECTION_UP | SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
- e("MozSwipeGesture",
- SimpleGestureEvent.DIRECTION_DOWN | SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
-
- // magnify gesture events
- e("MozMagnifyGestureStart", 0, 50.0, 0);
- e("MozMagnifyGestureUpdate", 0, -25.0, 0);
- e("MozMagnifyGestureUpdate", 0, 5.0, 0);
- e("MozMagnifyGesture", 0, 30.0, 0);
-
- // rotate gesture events
- e("MozRotateGestureStart", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
- e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE, -13.0, 0);
- e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_CLOCKWISE, 13.0, 0);
- e("MozRotateGesture", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
-
- // Tap and presstap gesture events
- test_clicks("MozTapGesture", 1);
- test_clicks("MozTapGesture", 2);
- test_clicks("MozTapGesture", 3);
- test_clicks("MozPressTapGesture", 1);
-
- // simple delivery test for edgeui gestures
- e("MozEdgeUIStarted", 0, 0, 0);
- e("MozEdgeUICanceled", 0, 0, 0);
- e("MozEdgeUICompleted", 0, 0, 0);
-
- // event.shiftKey
- let modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
-
- // event.metaKey
- modifier = Components.interfaces.nsIDOMEvent.META_MASK;
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
-
- // event.altKey
- modifier = Components.interfaces.nsIDOMEvent.ALT_MASK;
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
-
- // event.ctrlKey
- modifier = Components.interfaces.nsIDOMEvent.CONTROL_MASK;
- e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
-}
-
-function test_eventDispatchListener(evt)
-{
- test_eventCount++;
- evt.stopPropagation();
-}
-
-function test_helper2(type, direction, delta, altKey, ctrlKey, shiftKey, metaKey)
-{
- let event = null;
- let successful;
-
- try {
- event = document.createEvent("SimpleGestureEvent");
- successful = true;
- }
- catch (ex) {
- successful = false;
- }
- ok(successful, "Unable to create SimpleGestureEvent");
-
- try {
- event.initSimpleGestureEvent(type, true, true, window, 1,
- 10, 10, 10, 10,
- ctrlKey, altKey, shiftKey, metaKey,
- 1, window,
- 0, direction, delta, 0);
- successful = true;
- }
- catch (ex) {
- successful = false;
- }
- ok(successful, "event.initSimpleGestureEvent should not fail");
-
- // Make sure the event fields match the expected values
- is(event.type, type, "Mismatch on evt.type");
- is(event.direction, direction, "Mismatch on evt.direction");
- is(event.delta, delta, "Mismatch on evt.delta");
- is(event.altKey, altKey, "Mismatch on evt.altKey");
- is(event.ctrlKey, ctrlKey, "Mismatch on evt.ctrlKey");
- is(event.shiftKey, shiftKey, "Mismatch on evt.shiftKey");
- is(event.metaKey, metaKey, "Mismatch on evt.metaKey");
- is(event.view, window, "Mismatch on evt.view");
- is(event.detail, 1, "Mismatch on evt.detail");
- is(event.clientX, 10, "Mismatch on evt.clientX");
- is(event.clientY, 10, "Mismatch on evt.clientY");
- is(event.screenX, 10, "Mismatch on evt.screenX");
- is(event.screenY, 10, "Mismatch on evt.screenY");
- is(event.button, 1, "Mismatch on evt.button");
- is(event.relatedTarget, window, "Mismatch on evt.relatedTarget");
-
- // Test event dispatch
- let expectedEventCount = test_eventCount + 1;
- document.addEventListener(type, test_eventDispatchListener, true);
- document.dispatchEvent(event);
- document.removeEventListener(type, test_eventDispatchListener, true);
- is(expectedEventCount, test_eventCount, "Dispatched event was never received by listener");
-}
-
-function test_TestEventCreation()
-{
- // Event creation
- test_helper2("MozMagnifyGesture", SimpleGestureEvent.DIRECTION_RIGHT, 20.0,
- true, false, true, false);
- test_helper2("MozMagnifyGesture", SimpleGestureEvent.DIRECTION_LEFT, -20.0,
- false, true, false, true);
-}
-
-function test_EnsureConstantsAreDisjoint()
-{
- let up = SimpleGestureEvent.DIRECTION_UP;
- let down = SimpleGestureEvent.DIRECTION_DOWN;
- let left = SimpleGestureEvent.DIRECTION_LEFT;
- let right = SimpleGestureEvent.DIRECTION_RIGHT;
-
- let clockwise = SimpleGestureEvent.ROTATION_CLOCKWISE;
- let cclockwise = SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE;
-
- ok(up ^ down, "DIRECTION_UP and DIRECTION_DOWN are not bitwise disjoint");
- ok(up ^ left, "DIRECTION_UP and DIRECTION_LEFT are not bitwise disjoint");
- ok(up ^ right, "DIRECTION_UP and DIRECTION_RIGHT are not bitwise disjoint");
- ok(down ^ left, "DIRECTION_DOWN and DIRECTION_LEFT are not bitwise disjoint");
- ok(down ^ right, "DIRECTION_DOWN and DIRECTION_RIGHT are not bitwise disjoint");
- ok(left ^ right, "DIRECTION_LEFT and DIRECTION_RIGHT are not bitwise disjoint");
- ok(clockwise ^ cclockwise, "ROTATION_CLOCKWISE and ROTATION_COUNTERCLOCKWISE are not bitwise disjoint");
-}
-
-// Helper for test of latched event processing. Emits the actual
-// gesture events to test whether the commands associated with the
-// gesture will only trigger once for each direction of movement.
-function test_emitLatchedEvents(eventPrefix, initialDelta, cmd)
-{
- let cumulativeDelta = 0;
- let isIncreasing = initialDelta > 0;
-
- let expect = {};
- // Reset the call counters and initialize expected values
- for (let dir in cmd)
- cmd[dir].callCount = expect[dir] = 0;
-
- let check = function(aDir, aMsg) ok(cmd[aDir].callCount == expect[aDir], aMsg);
- let checkBoth = function(aNum, aInc, aDec) {
- let prefix = "Step " + aNum + ": ";
- check("inc", prefix + aInc);
- check("dec", prefix + aDec);
- };
-
- // Send the "Start" event.
- test_utils.sendSimpleGestureEvent(eventPrefix + "Start", 0, 0, 0, initialDelta, 0);
- cumulativeDelta += initialDelta;
- if (isIncreasing) {
- expect.inc++;
- checkBoth(1, "Increasing command was not triggered", "Decreasing command was triggered");
- } else {
- expect.dec++;
- checkBoth(1, "Increasing command was triggered", "Decreasing command was not triggered");
- }
-
- // Send random values in the same direction and ensure neither
- // command triggers.
- for (let i = 0; i < 5; i++) {
- let delta = Math.random() * (isIncreasing ? 100 : -100);
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, delta, 0);
- cumulativeDelta += delta;
- checkBoth(2, "Increasing command was triggered", "Decreasing command was triggered");
- }
-
- // Now go back in the opposite direction.
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0,
- - initialDelta, 0);
- cumulativeDelta += - initialDelta;
- if (isIncreasing) {
- expect.dec++;
- checkBoth(3, "Increasing command was triggered", "Decreasing command was not triggered");
- } else {
- expect.inc++;
- checkBoth(3, "Increasing command was not triggered", "Decreasing command was triggered");
- }
-
- // Send random values in the opposite direction and ensure neither
- // command triggers.
- for (let i = 0; i < 5; i++) {
- let delta = Math.random() * (isIncreasing ? -100 : 100);
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, delta, 0);
- cumulativeDelta += delta;
- checkBoth(4, "Increasing command was triggered", "Decreasing command was triggered");
- }
-
- // Go back to the original direction. The original command should trigger.
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0,
- initialDelta, 0);
- cumulativeDelta += initialDelta;
- if (isIncreasing) {
- expect.inc++;
- checkBoth(5, "Increasing command was not triggered", "Decreasing command was triggered");
- } else {
- expect.dec++;
- checkBoth(5, "Increasing command was triggered", "Decreasing command was not triggered");
- }
-
- // Send the wrap-up event. No commands should be triggered.
- test_utils.sendSimpleGestureEvent(eventPrefix, 0, 0, 0, cumulativeDelta, 0);
- checkBoth(6, "Increasing command was triggered", "Decreasing command was triggered");
-}
-
-function test_addCommand(prefName, id)
-{
- let cmd = test_commandset.appendChild(document.createElement("command"));
- cmd.setAttribute("id", id);
- cmd.setAttribute("oncommand", "this.callCount++;");
-
- cmd.origPrefName = prefName;
- cmd.origPrefValue = gPrefService.getCharPref(prefName);
- gPrefService.setCharPref(prefName, id);
-
- return cmd;
-}
-
-function test_removeCommand(cmd)
-{
- gPrefService.setCharPref(cmd.origPrefName, cmd.origPrefValue);
- test_commandset.removeChild(cmd);
-}
-
-// Test whether latched events are only called once per direction of motion.
-function test_latchedGesture(gesture, inc, dec, eventPrefix)
-{
- let branch = test_prefBranch + gesture + ".";
-
- // Put the gesture into latched mode.
- let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
- gPrefService.setBoolPref(branch + "latched", true);
-
- // Install the test commands for increasing and decreasing motion.
- let cmd = {
- inc: test_addCommand(branch + inc, "test:incMotion"),
- dec: test_addCommand(branch + dec, "test:decMotion"),
- };
-
- // Test the gestures in each direction.
- test_emitLatchedEvents(eventPrefix, 500, cmd);
- test_emitLatchedEvents(eventPrefix, -500, cmd);
-
- // Restore the gesture to its original configuration.
- gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
- for (let dir in cmd)
- test_removeCommand(cmd[dir]);
-}
-
-// Test whether non-latched events are triggered upon sufficient motion.
-function test_thresholdGesture(gesture, inc, dec, eventPrefix)
-{
- let branch = test_prefBranch + gesture + ".";
-
- // Disable latched mode for this gesture.
- let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
- gPrefService.setBoolPref(branch + "latched", false);
-
- // Set the triggering threshold value to 50.
- let oldThresholdValue = gPrefService.getIntPref(branch + "threshold");
- gPrefService.setIntPref(branch + "threshold", 50);
-
- // Install the test commands for increasing and decreasing motion.
- let cmdInc = test_addCommand(branch + inc, "test:incMotion");
- let cmdDec = test_addCommand(branch + dec, "test:decMotion");
-
- // Send the start event but stop short of triggering threshold.
- cmdInc.callCount = cmdDec.callCount = 0;
- test_utils.sendSimpleGestureEvent(eventPrefix + "Start", 0, 0, 0, 49.5, 0);
- ok(cmdInc.callCount == 0, "Increasing command was triggered");
- ok(cmdDec.callCount == 0, "Decreasing command was triggered");
-
- // Now trigger the threshold.
- cmdInc.callCount = cmdDec.callCount = 0;
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, 1, 0);
- ok(cmdInc.callCount == 1, "Increasing command was not triggered");
- ok(cmdDec.callCount == 0, "Decreasing command was triggered");
-
- // The tracking counter should go to zero. Go back the other way and
- // stop short of triggering the threshold.
- cmdInc.callCount = cmdDec.callCount = 0;
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, -49.5, 0);
- ok(cmdInc.callCount == 0, "Increasing command was triggered");
- ok(cmdDec.callCount == 0, "Decreasing command was triggered");
-
- // Now cross the threshold and trigger the decreasing command.
- cmdInc.callCount = cmdDec.callCount = 0;
- test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, -1.5, 0);
- ok(cmdInc.callCount == 0, "Increasing command was triggered");
- ok(cmdDec.callCount == 1, "Decreasing command was not triggered");
-
- // Send the wrap-up event. No commands should trigger.
- cmdInc.callCount = cmdDec.callCount = 0;
- test_utils.sendSimpleGestureEvent(eventPrefix, 0, 0, 0, -0.5, 0);
- ok(cmdInc.callCount == 0, "Increasing command was triggered");
- ok(cmdDec.callCount == 0, "Decreasing command was triggered");
-
- // Restore the gesture to its original configuration.
- gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
- gPrefService.setIntPref(branch + "threshold", oldThresholdValue);
- test_removeCommand(cmdInc);
- test_removeCommand(cmdDec);
-}
-
-function test_swipeGestures()
-{
- // easier to type names for the direction constants
- let up = SimpleGestureEvent.DIRECTION_UP;
- let down = SimpleGestureEvent.DIRECTION_DOWN;
- let left = SimpleGestureEvent.DIRECTION_LEFT;
- let right = SimpleGestureEvent.DIRECTION_RIGHT;
-
- let branch = test_prefBranch + "swipe.";
-
- // Install the test commands for the swipe gestures.
- let cmdUp = test_addCommand(branch + "up", "test:swipeUp");
- let cmdDown = test_addCommand(branch + "down", "test:swipeDown");
- let cmdLeft = test_addCommand(branch + "left", "test:swipeLeft");
- let cmdRight = test_addCommand(branch + "right", "test:swipeRight");
-
- function resetCounts() {
- cmdUp.callCount = 0;
- cmdDown.callCount = 0;
- cmdLeft.callCount = 0;
- cmdRight.callCount = 0;
- }
-
- // UP
- resetCounts();
- test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, up, 0, 0);
- ok(cmdUp.callCount == 1, "Step 1: Up command was not triggered");
- ok(cmdDown.callCount == 0, "Step 1: Down command was triggered");
- ok(cmdLeft.callCount == 0, "Step 1: Left command was triggered");
- ok(cmdRight.callCount == 0, "Step 1: Right command was triggered");
-
- // DOWN
- resetCounts();
- test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, down, 0, 0);
- ok(cmdUp.callCount == 0, "Step 2: Up command was triggered");
- ok(cmdDown.callCount == 1, "Step 2: Down command was not triggered");
- ok(cmdLeft.callCount == 0, "Step 2: Left command was triggered");
- ok(cmdRight.callCount == 0, "Step 2: Right command was triggered");
-
- // LEFT
- resetCounts();
- test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, left, 0, 0);
- ok(cmdUp.callCount == 0, "Step 3: Up command was triggered");
- ok(cmdDown.callCount == 0, "Step 3: Down command was triggered");
- ok(cmdLeft.callCount == 1, "Step 3: Left command was not triggered");
- ok(cmdRight.callCount == 0, "Step 3: Right command was triggered");
-
- // RIGHT
- resetCounts();
- test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, right, 0, 0);
- ok(cmdUp.callCount == 0, "Step 4: Up command was triggered");
- ok(cmdDown.callCount == 0, "Step 4: Down command was triggered");
- ok(cmdLeft.callCount == 0, "Step 4: Left command was triggered");
- ok(cmdRight.callCount == 1, "Step 4: Right command was not triggered");
-
- // Make sure combinations do not trigger events.
- let combos = [ up | left, up | right, down | left, down | right];
- for (let i = 0; i < combos.length; i++) {
- resetCounts();
- test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, combos[i], 0, 0);
- ok(cmdUp.callCount == 0, "Step 5-"+i+": Up command was triggered");
- ok(cmdDown.callCount == 0, "Step 5-"+i+": Down command was triggered");
- ok(cmdLeft.callCount == 0, "Step 5-"+i+": Left command was triggered");
- ok(cmdRight.callCount == 0, "Step 5-"+i+": Right command was triggered");
- }
-
- // Remove the test commands.
- test_removeCommand(cmdUp);
- test_removeCommand(cmdDown);
- test_removeCommand(cmdLeft);
- test_removeCommand(cmdRight);
-}
-
-
-function test_rotateHelperGetImageRotation(aImageElement)
-{
- // Get the true image rotation from the transform matrix, bounded
- // to 0 <= result < 360
- let transformValue = content.window.getComputedStyle(aImageElement, null)
- .transform;
- if (transformValue == "none")
- return 0;
-
- transformValue = transformValue.split("(")[1]
- .split(")")[0]
- .split(",");
- var rotation = Math.round(Math.atan2(transformValue[1], transformValue[0]) *
- (180 / Math.PI));
- return (rotation < 0 ? rotation + 360 : rotation);
-}
-
-function test_rotateHelperOneGesture(aImageElement, aCurrentRotation,
- aDirection, aAmount, aStop)
-{
- if (aAmount <= 0 || aAmount > 90) // Bound to 0 < aAmount <= 90
- return;
-
- // easier to type names for the direction constants
- let clockwise = SimpleGestureEvent.ROTATION_CLOCKWISE;
- let cclockwise = SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE;
-
- let delta = aAmount * (aDirection == clockwise ? 1 : -1);
-
- // Kill transition time on image so test isn't wrong and doesn't take 10 seconds
- aImageElement.style.transitionDuration = "0s";
-
- // Start the gesture, perform an update, and force flush
- test_utils.sendSimpleGestureEvent("MozRotateGestureStart", 0, 0, aDirection, .001, 0);
- test_utils.sendSimpleGestureEvent("MozRotateGestureUpdate", 0, 0, aDirection, delta, 0);
- aImageElement.clientTop;
-
- // If stop, check intermediate
- if (aStop) {
- // Send near-zero-delta to stop, and force flush
- test_utils.sendSimpleGestureEvent("MozRotateGestureUpdate", 0, 0, aDirection, .001, 0);
- aImageElement.clientTop;
-
- let stopExpectedRotation = (aCurrentRotation + delta) % 360;
- if (stopExpectedRotation < 0)
- stopExpectedRotation += 360;
-
- is(stopExpectedRotation, test_rotateHelperGetImageRotation(aImageElement),
- "Image rotation at gesture stop/hold: expected=" + stopExpectedRotation +
- ", observed=" + test_rotateHelperGetImageRotation(aImageElement) +
- ", init=" + aCurrentRotation +
- ", amt=" + aAmount +
- ", dir=" + (aDirection == clockwise ? "cl" : "ccl"));
- }
- // End it and force flush
- test_utils.sendSimpleGestureEvent("MozRotateGesture", 0, 0, aDirection, 0, 0);
- aImageElement.clientTop;
-
- let finalExpectedRotation;
-
- if (aAmount < 45 && aStop) {
- // Rotate a bit, then stop. Expect no change at end of gesture.
- finalExpectedRotation = aCurrentRotation;
- }
- else {
- // Either not stopping (expect 90 degree change in aDirection), OR
- // stopping but after 45, (expect 90 degree change in aDirection)
- finalExpectedRotation = (aCurrentRotation +
- (aDirection == clockwise ? 1 : -1) * 90) % 360;
- if (finalExpectedRotation < 0)
- finalExpectedRotation += 360;
- }
-
- is(finalExpectedRotation, test_rotateHelperGetImageRotation(aImageElement),
- "Image rotation gesture end: expected=" + finalExpectedRotation +
- ", observed=" + test_rotateHelperGetImageRotation(aImageElement) +
- ", init=" + aCurrentRotation +
- ", amt=" + aAmount +
- ", dir=" + (aDirection == clockwise ? "cl" : "ccl"));
-}
-
-function test_rotateGesturesOnTab()
-{
- gBrowser.selectedBrowser.removeEventListener("load", test_rotateGesturesOnTab, true);
-
- if (!(content.document instanceof ImageDocument)) {
- ok(false, "Image document failed to open for rotation testing");
- gBrowser.removeTab(test_imageTab);
- finish();
- return;
- }
-
- // easier to type names for the direction constants
- let cl = SimpleGestureEvent.ROTATION_CLOCKWISE;
- let ccl = SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE;
-
- let imgElem = content.document.body &&
- content.document.body.firstElementChild;
-
- if (!imgElem) {
- ok(false, "Could not get image element on ImageDocument for rotation!");
- gBrowser.removeTab(test_imageTab);
- finish();
- return;
- }
-
- // Quick function to normalize rotation to 0 <= r < 360
- var normRot = function(rotation) {
- rotation = rotation % 360;
- if (rotation < 0)
- rotation += 360;
- return rotation;
- }
-
- for (var initRot = 0; initRot < 360; initRot += 90) {
- // Test each case: at each 90 degree snap; cl/ccl;
- // amount more or less than 45; stop and hold or don't (32 total tests)
- // The amount added to the initRot is where it is expected to be
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 0), cl, 35, true );
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 0), cl, 35, false);
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 90), cl, 55, true );
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 180), cl, 55, false);
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 270), ccl, 35, true );
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 270), ccl, 35, false);
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 180), ccl, 55, true );
- test_rotateHelperOneGesture(imgElem, normRot(initRot + 90), ccl, 55, false);
-
- // Manually rotate it 90 degrees clockwise to prepare for next iteration,
- // and force flush
- test_utils.sendSimpleGestureEvent("MozRotateGestureStart", 0, 0, cl, .001, 0);
- test_utils.sendSimpleGestureEvent("MozRotateGestureUpdate", 0, 0, cl, 90, 0);
- test_utils.sendSimpleGestureEvent("MozRotateGestureUpdate", 0, 0, cl, .001, 0);
- test_utils.sendSimpleGestureEvent("MozRotateGesture", 0, 0, cl, 0, 0);
- imgElem.clientTop;
- }
-
- gBrowser.removeTab(test_imageTab);
- test_imageTab = null;
- finish();
-}
-
-function test_rotateGestures()
-{
- test_imageTab = gBrowser.addTab("chrome://branding/content/about-logo.png");
- gBrowser.selectedTab = test_imageTab;
-
- gBrowser.selectedBrowser.addEventListener("load", test_rotateGesturesOnTab, true);
-}
diff --git a/browser/base/content/test/browser_getshortcutoruri.js b/browser/base/content/test/browser_getshortcutoruri.js
deleted file mode 100644
index 39a24f605..000000000
--- a/browser/base/content/test/browser_getshortcutoruri.js
+++ /dev/null
@@ -1,146 +0,0 @@
-function getPostDataString(aIS) {
- if (!aIS)
- return null;
-
- var sis = Cc["@mozilla.org/scriptableinputstream;1"].
- createInstance(Ci.nsIScriptableInputStream);
- sis.init(aIS);
- var dataLines = sis.read(aIS.available()).split("\n");
-
- // only want the last line
- return dataLines[dataLines.length-1];
-}
-
-function keywordResult(aURL, aPostData, aIsUnsafe) {
- this.url = aURL;
- this.postData = aPostData;
- this.isUnsafe = aIsUnsafe;
-}
-
-function keyWordData() {}
-keyWordData.prototype = {
- init: function(aKeyWord, aURL, aPostData, aSearchWord) {
- this.keyword = aKeyWord;
- this.uri = makeURI(aURL);
- this.postData = aPostData;
- this.searchWord = aSearchWord;
-
- this.method = (this.postData ? "POST" : "GET");
- }
-}
-
-function bmKeywordData(aKeyWord, aURL, aPostData, aSearchWord) {
- this.init(aKeyWord, aURL, aPostData, aSearchWord);
-}
-bmKeywordData.prototype = new keyWordData();
-
-function searchKeywordData(aKeyWord, aURL, aPostData, aSearchWord) {
- this.init(aKeyWord, aURL, aPostData, aSearchWord);
-}
-searchKeywordData.prototype = new keyWordData();
-
-var testData = [
- [new bmKeywordData("bmget", "http://bmget/search=%s", null, "foo"),
- new keywordResult("http://bmget/search=foo", null)],
-
- [new bmKeywordData("bmpost", "http://bmpost/", "search=%s", "foo2"),
- new keywordResult("http://bmpost/", "search=foo2")],
-
- [new bmKeywordData("bmpostget", "http://bmpostget/search1=%s", "search2=%s", "foo3"),
- new keywordResult("http://bmpostget/search1=foo3", "search2=foo3")],
-
- [new bmKeywordData("bmget-nosearch", "http://bmget-nosearch/", null, ""),
- new keywordResult("http://bmget-nosearch/", null)],
-
- [new searchKeywordData("searchget", "http://searchget/?search={searchTerms}", null, "foo4"),
- new keywordResult("http://searchget/?search=foo4", null, true)],
-
- [new searchKeywordData("searchpost", "http://searchpost/", "search={searchTerms}", "foo5"),
- new keywordResult("http://searchpost/", "search=foo5", true)],
-
- [new searchKeywordData("searchpostget", "http://searchpostget/?search1={searchTerms}", "search2={searchTerms}", "foo6"),
- new keywordResult("http://searchpostget/?search1=foo6", "search2=foo6", true)],
-
- // Bookmark keywords that don't take parameters should not be activated if a
- // parameter is passed (bug 420328).
- [new bmKeywordData("bmget-noparam", "http://bmget-noparam/", null, "foo7"),
- new keywordResult(null, null, true)],
- [new bmKeywordData("bmpost-noparam", "http://bmpost-noparam/", "not_a=param", "foo8"),
- new keywordResult(null, null, true)],
-
- // Test escaping (%s = escaped, %S = raw)
- // UTF-8 default
- [new bmKeywordData("bmget-escaping", "http://bmget/?esc=%s&raw=%S", null, "foé"),
- new keywordResult("http://bmget/?esc=fo%C3%A9&raw=foé", null)],
- // Explicitly-defined ISO-8859-1
- [new bmKeywordData("bmget-escaping2", "http://bmget/?esc=%s&raw=%S&mozcharset=ISO-8859-1", null, "foé"),
- new keywordResult("http://bmget/?esc=fo%E9&raw=foé", null)],
-
- // Bug 359809: Test escaping +, /, and @
- // UTF-8 default
- [new bmKeywordData("bmget-escaping", "http://bmget/?esc=%s&raw=%S", null, "+/@"),
- new keywordResult("http://bmget/?esc=%2B%2F%40&raw=+/@", null)],
- // Explicitly-defined ISO-8859-1
- [new bmKeywordData("bmget-escaping2", "http://bmget/?esc=%s&raw=%S&mozcharset=ISO-8859-1", null, "+/@"),
- new keywordResult("http://bmget/?esc=%2B%2F%40&raw=+/@", null)],
-
- // Test using a non-bmKeywordData object, to test the behavior of
- // getShortcutOrURI for non-keywords (setupKeywords only adds keywords for
- // bmKeywordData objects)
- [{keyword: "http://gavinsharp.com"},
- new keywordResult(null, null, true)]
-];
-
-function test() {
- setupKeywords();
-
- for each (var item in testData) {
- var [data, result] = item;
-
- var postData = {};
- var query = data.keyword;
- if (data.searchWord)
- query += " " + data.searchWord;
- var mayInheritPrincipal = {};
- var url = getShortcutOrURI(query, postData, mayInheritPrincipal);
-
- // null result.url means we should expect the same query we sent in
- var expected = result.url || query;
- is(url, expected, "got correct URL for " + data.keyword);
- is(getPostDataString(postData.value), result.postData, "got correct postData for " + data.keyword);
- is(mayInheritPrincipal.value, !result.isUnsafe, "got correct mayInheritPrincipal for " + data.keyword);
- }
-
- cleanupKeywords();
-}
-
-var gBMFolder = null;
-var gAddedEngines = [];
-function setupKeywords() {
- gBMFolder = Application.bookmarks.menu.addFolder("keyword-test");
- for each (var item in testData) {
- var data = item[0];
- if (data instanceof bmKeywordData) {
- var bm = gBMFolder.addBookmark(data.keyword, data.uri);
- bm.keyword = data.keyword;
- if (data.postData)
- bm.annotations.set("bookmarkProperties/POSTData", data.postData, Ci.nsIAnnotationService.EXPIRE_SESSION);
- }
-
- if (data instanceof searchKeywordData) {
- Services.search.addEngineWithDetails(data.keyword, "", data.keyword, "", data.method, data.uri.spec);
- var addedEngine = Services.search.getEngineByName(data.keyword);
- if (data.postData) {
- var [paramName, paramValue] = data.postData.split("=");
- addedEngine.addParam(paramName, paramValue, null);
- }
-
- gAddedEngines.push(addedEngine);
- }
- }
-}
-
-function cleanupKeywords() {
- gBMFolder.remove();
- gAddedEngines.map(Services.search.removeEngine);
-}
diff --git a/browser/base/content/test/browser_hide_removing.js b/browser/base/content/test/browser_hide_removing.js
deleted file mode 100644
index d29826556..000000000
--- a/browser/base/content/test/browser_hide_removing.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Bug 587922: tabs don't get removed if they're hidden
-
-function test() {
- waitForExplicitFinish();
-
- // Add a tab that will get removed and hidden
- let testTab = gBrowser.addTab("about:blank", {skipAnimation: true});
- is(gBrowser.visibleTabs.length, 2, "just added a tab, so 2 tabs");
- gBrowser.selectedTab = testTab;
-
- let numVisBeforeHide, numVisAfterHide;
- gBrowser.tabContainer.addEventListener("TabSelect", function() {
- gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee, false);
-
- // While the next tab is being selected, hide the removing tab
- numVisBeforeHide = gBrowser.visibleTabs.length;
- gBrowser.hideTab(testTab);
- numVisAfterHide = gBrowser.visibleTabs.length;
- }, false);
- gBrowser.removeTab(testTab, {animate: true});
-
- // Make sure the tab gets removed at the end of the animation by polling
- (function checkRemoved() setTimeout(function() {
- if (gBrowser.tabs.length != 1)
- return checkRemoved();
-
- is(numVisBeforeHide, 1, "animated remove has in 1 tab left");
- is(numVisAfterHide, 1, "hiding a removing tab is also has 1 tab");
- finish();
- }, 50))();
-}
diff --git a/browser/base/content/test/browser_homeDrop.js b/browser/base/content/test/browser_homeDrop.js
deleted file mode 100644
index e9c977827..000000000
--- a/browser/base/content/test/browser_homeDrop.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let str = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString);
- str.data = "about:mozilla";
- Services.prefs.setComplexValue("browser.startup.homepage",
- Ci.nsISupportsString, str);
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("browser.startup.homepage");
- });
-
- // Open a new tab, since starting a drag from the home button activates it and
- // we don't want to interfere with future tests by loading the home page.
- let newTab = gBrowser.selectedTab = gBrowser.addTab();
- registerCleanupFunction(function () {
- gBrowser.removeTab(newTab);
- });
-
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let ChromeUtils = {};
- scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
- let homeButton = document.getElementById("home-button");
- ok(homeButton, "home button present");
-
- let dialogListener = new WindowListener("chrome://global/content/commonDialog.xul", function (domwindow) {
- ok(true, "dialog appeared in response to home button drop");
- domwindow.document.documentElement.cancelDialog();
- Services.wm.removeListener(dialogListener);
-
- // Now trigger the invalid URI test
- executeSoon(function () {
- let consoleListener = {
- observe: function (m) {
- if (m.message.contains("NS_ERROR_DOM_BAD_URI")) {
- ok(true, "drop was blocked");
- executeSoon(finish);
- }
- }
- }
- Services.console.registerListener(consoleListener);
- registerCleanupFunction(function () {
- Services.console.unregisterListener(consoleListener);
- });
-
- executeSoon(function () {
- info("Attempting second drop, of a javascript: URI");
- // The drop handler throws an exception when dragging URIs that inherit
- // principal, e.g. javascript:
- expectUncaughtException();
- ChromeUtils.synthesizeDrop(homeButton, homeButton, [[{type: "text/plain", data: "javascript:8888"}]], "copy", window);
- });
- })
- });
-
- Services.wm.addListener(dialogListener);
-
- ChromeUtils.synthesizeDrop(homeButton, homeButton, [[{type: "text/plain", data: "http://mochi.test:8888/"}]], "copy", window);
-}
-
-function WindowListener(aURL, aCallback) {
- this.callback = aCallback;
- this.url = aURL;
-}
-WindowListener.prototype = {
- onOpenWindow: function(aXULWindow) {
- var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- var self = this;
- domwindow.addEventListener("load", function() {
- domwindow.removeEventListener("load", arguments.callee, false);
-
- ok(true, "domwindow.document.location.href: " + domwindow.document.location.href);
- if (domwindow.document.location.href != self.url)
- return;
-
- // Allow other window load listeners to execute before passing to callback
- executeSoon(function() {
- self.callback(domwindow);
- });
- }, false);
- },
- onCloseWindow: function(aXULWindow) {},
- onWindowTitleChange: function(aXULWindow, aNewTitle) {}
-}
-
diff --git a/browser/base/content/test/browser_identity_UI.js b/browser/base/content/test/browser_identity_UI.js
deleted file mode 100644
index 9f07265c9..000000000
--- a/browser/base/content/test/browser_identity_UI.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Tests for correct behaviour of getEffectiveHost on identity handler */
-function test() {
- waitForExplicitFinish();
-
- ok(gIdentityHandler, "gIdentityHandler should exist");
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", checkResult, true);
-
- nextTest();
-}
-
-// Greek IDN for 'example.test'.
-var idnDomain = "\u03C0\u03B1\u03C1\u03AC\u03B4\u03B5\u03B9\u03B3\u03BC\u03B1.\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE";
-var tests = [
- {
- name: "normal domain",
- location: "http://test1.example.org/",
- host: "test1.example.org",
- effectiveHost: "example.org"
- },
- {
- name: "view-source",
- location: "view-source:http://example.com/",
- // TODO: these should not be blank, bug 646690
- host: "",
- effectiveHost: ""
- },
- {
- name: "normal HTTPS",
- location: "https://example.com/",
- host: "example.com",
- effectiveHost: "example.com",
- isHTTPS: true
- },
- {
- name: "IDN subdomain",
- location: "http://sub1." + idnDomain + "/",
- host: "sub1." + idnDomain,
- effectiveHost: idnDomain
- },
- {
- name: "subdomain with port",
- location: "http://sub1.test1.example.org:8000/",
- host: "sub1.test1.example.org:8000",
- effectiveHost: "example.org"
- },
- {
- name: "subdomain HTTPS",
- location: "https://test1.example.com",
- host: "test1.example.com",
- effectiveHost: "example.com",
- isHTTPS: true
- },
- {
- name: "view-source HTTPS",
- location: "view-source:https://example.com/",
- // TODO: these should not be blank, bug 646690
- host: "",
- effectiveHost: "",
- isHTTPS: true
- },
- {
- name: "IP address",
- location: "http://127.0.0.1:8888/",
- host: "127.0.0.1:8888",
- effectiveHost: "127.0.0.1"
- },
-]
-
-let gCurrentTest, gCurrentTestIndex = -1, gTestDesc;
-// Go through the tests in both directions, to add additional coverage for
-// transitions between different states.
-let gForward = true;
-let gCheckETLD = false;
-function nextTest() {
- if (!gCheckETLD) {
- if (gForward)
- gCurrentTestIndex++;
- else
- gCurrentTestIndex--;
-
- if (gCurrentTestIndex == tests.length) {
- // Went too far, reverse
- gCurrentTestIndex--;
- gForward = false;
- }
-
- if (gCurrentTestIndex == -1) {
- gBrowser.selectedBrowser.removeEventListener("load", checkResult, true);
- gBrowser.removeCurrentTab();
- finish();
- return;
- }
-
- gCurrentTest = tests[gCurrentTestIndex];
- gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + ")";
- if (!gForward)
- gTestDesc += " (second time)";
- if (gCurrentTest.isHTTPS) {
- gCheckETLD = true;
- }
- content.location = gCurrentTest.location;
- } else {
- gCheckETLD = false;
- gTestDesc = "#" + gCurrentTestIndex + " (" + gCurrentTest.name + " without eTLD in identity icon label)";
- if (!gForward)
- gTestDesc += " (second time)";
- content.location.reload(true);
- }
-}
-
-function checkResult() {
- // Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
- is(gIdentityHandler._lastLocation.host, gCurrentTest.host, "host matches for test " + gTestDesc);
- is(gIdentityHandler.getEffectiveHost(), gCurrentTest.effectiveHost, "effectiveHost matches for test " + gTestDesc);
-
- executeSoon(nextTest);
-}
diff --git a/browser/base/content/test/browser_keywordBookmarklets.js b/browser/base/content/test/browser_keywordBookmarklets.js
deleted file mode 100644
index 8b075d74c..000000000
--- a/browser/base/content/test/browser_keywordBookmarklets.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let bmFolder = Application.bookmarks.menu.addFolder("keyword-test");
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- registerCleanupFunction (function () {
- bmFolder.remove();
- gBrowser.removeTab(tab);
- });
-
- let bm = bmFolder.addBookmark("bookmarklet", makeURI("javascript:1;"));
- bm.keyword = "bm";
-
- addPageShowListener(function () {
- let originalPrincipal = gBrowser.contentPrincipal;
-
- // Enter bookmarklet keyword in the URL bar
- gURLBar.value = "bm";
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
-
- addPageShowListener(function () {
- ok(gBrowser.contentPrincipal.equals(originalPrincipal), "javascript bookmarklet should inherit principal");
- finish();
- });
- });
-}
-
-function addPageShowListener(func) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- func();
- });
-}
diff --git a/browser/base/content/test/browser_keywordSearch.js b/browser/base/content/test/browser_keywordSearch.js
deleted file mode 100644
index 73efe580e..000000000
--- a/browser/base/content/test/browser_keywordSearch.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- **/
-
-var gTests = [
- {
- name: "normal search (search service)",
- testText: "test search",
- searchURL: Services.search.defaultEngine.getSubmission("test search", null, "keyword").uri.spec
- },
- {
- name: "?-prefixed search (search service)",
- testText: "? foo ",
- searchURL: Services.search.defaultEngine.getSubmission("foo", null, "keyword").uri.spec
- }
-];
-
-function test() {
- waitForExplicitFinish();
-
- let windowObserver = {
- observe: function(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- ok(false, "Alert window opened");
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
- win.addEventListener("load", function() {
- win.removeEventListener("load", arguments.callee, false);
- win.close();
- }, false);
- executeSoon(finish);
- }
- }
- };
-
- Services.ww.registerNotification(windowObserver);
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- let listener = {
- onStateChange: function onLocationChange(webProgress, req, flags, status) {
- // Only care about document starts
- let docStart = Ci.nsIWebProgressListener.STATE_IS_DOCUMENT |
- Ci.nsIWebProgressListener.STATE_START;
- if (!(flags & docStart))
- return;
-
- info("received document start");
-
- ok(req instanceof Ci.nsIChannel, "req is a channel");
- is(req.originalURI.spec, gCurrTest.searchURL, "search URL was loaded");
- info("Actual URI: " + req.URI.spec);
-
- executeSoon(nextTest);
- }
- }
- gBrowser.addProgressListener(listener);
-
- registerCleanupFunction(function () {
- Services.ww.unregisterNotification(windowObserver);
-
- gBrowser.removeProgressListener(listener);
- gBrowser.removeTab(tab);
- });
-
- nextTest();
-}
-
-var gCurrTest;
-function nextTest() {
- if (gTests.length) {
- gCurrTest = gTests.shift();
- doTest();
- } else {
- finish();
- }
-}
-
-function doTest() {
- info("Running test: " + gCurrTest.name);
-
- // Simulate a user entering search terms
- gURLBar.value = gCurrTest.testText;
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
-}
diff --git a/browser/base/content/test/browser_keywordSearch_postData.js b/browser/base/content/test/browser_keywordSearch_postData.js
deleted file mode 100644
index 48db709c1..000000000
--- a/browser/base/content/test/browser_keywordSearch_postData.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- **/
-
-var gTests = [
- {
- name: "normal search (search service)",
- testText: "test search",
- expectText: "test+search"
- },
- {
- name: "?-prefixed search (search service)",
- testText: "? foo ",
- expectText: "foo"
- }
-];
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- let searchObserver = function search_observer(aSubject, aTopic, aData) {
- let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
- info("Observer: " + aData + " for " + engine.name);
-
- if (aData != "engine-added")
- return;
-
- if (engine.name != "POST Search")
- return;
-
- Services.search.defaultEngine = engine;
-
- registerCleanupFunction(function () {
- Services.search.removeEngine(engine);
- });
-
- // ready to execute the tests!
- executeSoon(nextTest);
- };
-
- Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
-
- registerCleanupFunction(function () {
- gBrowser.removeTab(tab);
-
- Services.obs.removeObserver(searchObserver, "browser-search-engine-modified");
- });
-
- Services.search.addEngine("http://test:80/browser/browser/base/content/test/POSTSearchEngine.xml",
- Ci.nsISearchEngine.DATA_XML, null, false);
-}
-
-var gCurrTest;
-function nextTest() {
- if (gTests.length) {
- gCurrTest = gTests.shift();
- doTest();
- } else {
- finish();
- }
-}
-
-function doTest() {
- info("Running test: " + gCurrTest.name);
-
- waitForLoad(function () {
- let loadedText = gBrowser.contentDocument.body.textContent;
- ok(loadedText, "search page loaded");
- let needle = "searchterms=" + gCurrTest.expectText;
- is(loadedText, needle, "The query POST data should be returned in the response");
- nextTest();
- });
-
- // Simulate a user entering search terms
- gURLBar.value = gCurrTest.testText;
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
-}
-
-
-function waitForLoad(cb) {
- let browser = gBrowser.selectedBrowser;
- browser.addEventListener("load", function listener() {
- if (browser.currentURI.spec == "about:blank")
- return;
- info("Page loaded: " + browser.currentURI.spec);
- browser.removeEventListener("load", listener, true);
-
- cb();
- }, true);
-}
diff --git a/browser/base/content/test/browser_lastAccessedTab.js b/browser/base/content/test/browser_lastAccessedTab.js
deleted file mode 100644
index d0ad8b4cd..000000000
--- a/browser/base/content/test/browser_lastAccessedTab.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test for bug 739866.
- *
- * 1. Adds a new tab (but doesn't select it)
- * 2. Checks if timestamp on the new tab is 0
- * 3. Selects the new tab, checks that the timestamp is updated (>0)
- * 4. Selects the original tab & checks if new tab's timestamp has remained changed
- */
-
-function test() {
- let originalTab = gBrowser.selectedTab;
- let newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
- is(newTab.lastAccessed, 0, "Timestamp on the new tab is 0.");
- gBrowser.selectedTab = newTab;
- let newTabAccessedDate = newTab.lastAccessed;
- ok(newTabAccessedDate > 0, "Timestamp on the selected tab is more than 0.");
- // Date.now is not guaranteed to be monotonic, so include one second of fudge.
- let now = Date.now() + 1000;
- ok(newTabAccessedDate <= now, "Timestamp less than or equal current Date: " + newTabAccessedDate + " <= " + now);
- gBrowser.selectedTab = originalTab;
- is(newTab.lastAccessed, newTabAccessedDate, "New tab's timestamp remains the same.");
- gBrowser.removeTab(newTab);
-}
diff --git a/browser/base/content/test/browser_locationBarCommand.js b/browser/base/content/test/browser_locationBarCommand.js
deleted file mode 100644
index fe70300f9..000000000
--- a/browser/base/content/test/browser_locationBarCommand.js
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_VALUE = "example.com";
-const START_VALUE = "example.org";
-
-let gFocusManager = Cc["@mozilla.org/focus-manager;1"].
- getService(Ci.nsIFocusManager);
-
-function test() {
- waitForExplicitFinish();
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.altClickSave");
- });
- Services.prefs.setBoolPref("browser.altClickSave", true);
-
- runAltLeftClickTest();
-}
-
-// Monkey patch saveURL to avoid dealing with file save code paths
-var oldSaveURL = saveURL;
-saveURL = function() {
- ok(true, "SaveURL was called");
- is(gURLBar.value, "", "Urlbar reverted to original value");
- saveURL = oldSaveURL;
- runShiftLeftClickTest();
-}
-function runAltLeftClickTest() {
- info("Running test: Alt left click");
- triggerCommand(true, { altKey: true });
-}
-
-function runShiftLeftClickTest() {
- let listener = new BrowserWindowListener(getBrowserURL(), function(aWindow) {
- Services.wm.removeListener(listener);
- addPageShowListener(aWindow.gBrowser.selectedBrowser, function() {
- executeSoon(function () {
- info("URL should be loaded in a new window");
- is(gURLBar.value, "", "Urlbar reverted to original value");
- is(gFocusManager.focusedElement, null, "There should be no focused element");
- is(gFocusManager.focusedWindow, aWindow.gBrowser.contentWindow, "Content window should be focused");
- is(aWindow.gURLBar.value, TEST_VALUE, "New URL is loaded in new window");
-
- aWindow.close();
-
- // Continue testing when the original window has focus again.
- whenWindowActivated(window, runNextTest);
- });
- }, "http://example.com/");
- });
- Services.wm.addListener(listener);
-
- info("Running test: Shift left click");
- triggerCommand(true, { shiftKey: true });
-}
-
-function runNextTest() {
- let test = gTests.shift();
- if (!test) {
- finish();
- return;
- }
-
- info("Running test: " + test.desc);
- // Tab will be blank if test.startValue is null
- let tab = gBrowser.selectedTab = gBrowser.addTab(test.startValue);
- addPageShowListener(gBrowser.selectedBrowser, function() {
- triggerCommand(test.click, test.event);
- test.check(tab);
-
- // Clean up
- while (gBrowser.tabs.length > 1)
- gBrowser.removeTab(gBrowser.selectedTab)
- runNextTest();
- });
-}
-
-let gTests = [
- { desc: "Right click on go button",
- click: true,
- event: { button: 2 },
- check: function(aTab) {
- // Right click should do nothing (context menu will be shown)
- is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
- }
- },
-
- { desc: "Left click on go button",
- click: true,
- event: {},
- check: checkCurrent
- },
-
- { desc: "Ctrl/Cmd left click on go button",
- click: true,
- event: { accelKey: true },
- check: checkNewTab
- },
-
- { desc: "Shift+Ctrl/Cmd left click on go button",
- click: true,
- event: { accelKey: true, shiftKey: true },
- check: function(aTab) {
- info("URL should be loaded in a new background tab");
- is(gURLBar.value, "", "Urlbar reverted to original value");
- ok(!gURLBar.focused, "Urlbar is no longer focused after urlbar command");
- is(gBrowser.selectedTab, aTab, "Focus did not change to the new tab");
-
- // Select the new background tab
- gBrowser.selectedTab = gBrowser.selectedTab.nextSibling;
- is(gURLBar.value, TEST_VALUE, "New URL is loaded in new tab");
- }
- },
-
- { desc: "Simple return keypress",
- event: {},
- check: checkCurrent
- },
-
- { desc: "Alt+Return keypress in a blank tab",
- event: { altKey: true },
- check: checkCurrent
- },
-
- { desc: "Alt+Return keypress in a dirty tab",
- event: { altKey: true },
- check: checkNewTab,
- startValue: START_VALUE
- },
-
- { desc: "Ctrl/Cmd+Return keypress",
- event: { accelKey: true },
- check: checkCurrent
- }
-]
-
-let gGoButton = document.getElementById("urlbar-go-button");
-function triggerCommand(aClick, aEvent) {
- gURLBar.value = TEST_VALUE;
- gURLBar.focus();
-
- if (aClick) {
- is(gURLBar.getAttribute("pageproxystate"), "invalid",
- "page proxy state must be invalid for go button to be visible");
- EventUtils.synthesizeMouseAtCenter(gGoButton, aEvent);
- }
- else
- EventUtils.synthesizeKey("VK_RETURN", aEvent);
-}
-
-/* Checks that the URL was loaded in the current tab */
-function checkCurrent(aTab) {
- info("URL should be loaded in the current tab");
- is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
- is(gFocusManager.focusedElement, null, "There should be no focused element");
- is(gFocusManager.focusedWindow, gBrowser.contentWindow, "Content window should be focused");
- is(gBrowser.selectedTab, aTab, "New URL was loaded in the current tab");
-}
-
-/* Checks that the URL was loaded in a new focused tab */
-function checkNewTab(aTab) {
- info("URL should be loaded in a new focused tab");
- is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
- is(gFocusManager.focusedElement, null, "There should be no focused element");
- is(gFocusManager.focusedWindow, gBrowser.contentWindow, "Content window should be focused");
- isnot(gBrowser.selectedTab, aTab, "New URL was loaded in a new tab");
-}
-
-function addPageShowListener(browser, cb, expectedURL) {
- browser.addEventListener("pageshow", function pageShowListener() {
- info("pageshow: " + browser.currentURI.spec);
- if (expectedURL && browser.currentURI.spec != expectedURL)
- return; // ignore pageshows for non-expected URLs
- browser.removeEventListener("pageshow", pageShowListener, false);
- cb();
- });
-}
-
-function whenWindowActivated(win, cb) {
- if (Services.focus.activeWindow == win) {
- executeSoon(cb);
- return;
- }
-
- win.addEventListener("activate", function onActivate() {
- win.removeEventListener("activate", onActivate);
- executeSoon(cb);
- });
-}
-
-function BrowserWindowListener(aURL, aCallback) {
- this.callback = aCallback;
- this.url = aURL;
-}
-BrowserWindowListener.prototype = {
- onOpenWindow: function(aXULWindow) {
- let cb = () => this.callback(domwindow);
- let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
-
- let numWait = 2;
- function maybeRunCallback() {
- if (--numWait == 0)
- cb();
- }
-
- whenWindowActivated(domwindow, maybeRunCallback);
- whenDelayedStartupFinished(domwindow, maybeRunCallback);
- },
- onCloseWindow: function(aXULWindow) {},
- onWindowTitleChange: function(aXULWindow, aNewTitle) {}
-}
diff --git a/browser/base/content/test/browser_locationBarExternalLoad.js b/browser/base/content/test/browser_locationBarExternalLoad.js
deleted file mode 100644
index 2bc88a989..000000000
--- a/browser/base/content/test/browser_locationBarExternalLoad.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- nextTest();
-}
-
-let urls = [
- "javascript:'foopy';",
- "data:text/html,<body>hi"
-];
-
-function urlEnter(url) {
- gURLBar.value = url;
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
-}
-
-function urlClick(url) {
- gURLBar.value = url;
- gURLBar.focus();
- let goButton = document.getElementById("urlbar-go-button");
- EventUtils.synthesizeMouseAtCenter(goButton, {});
-}
-
-function nextTest() {
- let url = urls.shift();
- if (url) {
- testURL(url, urlEnter, function () {
- testURL(url, urlClick, nextTest);
- });
- }
- else
- finish();
-}
-
-function testURL(url, loadFunc, endFunc) {
- let tab = gBrowser.selectedTab = gBrowser.addTab();
- registerCleanupFunction(function () {
- gBrowser.removeTab(tab);
- });
- addPageShowListener(function () {
- let pagePrincipal = gBrowser.contentPrincipal;
- loadFunc(url);
-
- addPageShowListener(function () {
- let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
- is(fm.focusedElement, null, "should be no focused element");
- is(fm.focusedWindow, gBrowser.contentWindow, "content window should be focused");
-
- ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
- "load of " + url + " by " + loadFunc.name + " should produce a page with a different principal");
- endFunc();
- });
- });
-}
-
-function addPageShowListener(func) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- func();
- });
-}
diff --git a/browser/base/content/test/browser_middleMouse_inherit.js b/browser/base/content/test/browser_middleMouse_inherit.js
deleted file mode 100644
index 891ea2ed0..000000000
--- a/browser/base/content/test/browser_middleMouse_inherit.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const middleMousePastePref = "middlemouse.contentLoadURL";
-const autoScrollPref = "general.autoScroll";
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(middleMousePastePref, true);
- Services.prefs.setBoolPref(autoScrollPref, false);
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(middleMousePastePref);
- Services.prefs.clearUserPref(autoScrollPref);
- gBrowser.removeTab(tab);
- });
-
- addPageShowListener(function () {
- let pagePrincipal = gBrowser.contentPrincipal;
-
- // copy javascript URI to the clipboard
- let url = "javascript:1+1";
- waitForClipboard(url,
- function() {
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(url, document);
- },
- function () {
- // Middle click on the content area
- info("Middle clicking");
- EventUtils.sendMouseEvent({type: "click", button: 1}, gBrowser);
- },
- function() {
- ok(false, "Failed to copy URL to the clipboard");
- finish();
- }
- );
-
- addPageShowListener(function () {
- is(gBrowser.currentURI.spec, url, "url loaded by middle click");
- ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
- "middle click load of " + url + " should produce a page with a different principal");
- finish();
- });
- });
-}
-
-function addPageShowListener(func) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- func();
- });
-}
diff --git a/browser/base/content/test/browser_minimize.js b/browser/base/content/test/browser_minimize.js
deleted file mode 100644
index 459f84b44..000000000
--- a/browser/base/content/test/browser_minimize.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-function waitForActive() {
- if (!gBrowser.docShell.isActive) {
- executeSoon(waitForActive);
- return;
- }
- is(gBrowser.docShell.isActive, true, "Docshell should be active again");
- finish();
-}
-
-function waitForInactive() {
- if (gBrowser.docShell.isActive) {
- executeSoon(waitForInactive);
- return;
- }
- is(gBrowser.docShell.isActive, false, "Docshell should be inactive");
- window.restore();
- waitForActive();
-}
-
-function test() {
- registerCleanupFunction(function() {
- window.restore();
- });
-
- waitForExplicitFinish();
- is(gBrowser.docShell.isActive, true, "Docshell should be active");
- window.minimize();
- // XXX On Linux minimize/restore seem to be very very async, but
- // our window.windowState changes sync.... so we can't rely on the
- // latter correctly reflecting the state of the former. In
- // particular, a restore() call before minimizing is done will not
- // actually restore the window, but change the window state. As a
- // result, just poll waiting for our expected isActive values.
- waitForInactive();
-}
diff --git a/browser/base/content/test/browser_offlineQuotaNotification.js b/browser/base/content/test/browser_offlineQuotaNotification.js
deleted file mode 100644
index a8aba6b97..000000000
--- a/browser/base/content/test/browser_offlineQuotaNotification.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test offline quota warnings - must be run as a mochitest-browser test or
-// else the test runner gets in the way of notifications due to bug 857897.
-
-const URL = "http://mochi.test:8888/browser/browser/base/content/test/offlineQuotaNotification.html";
-
-registerCleanupFunction(function() {
- // Clean up after ourself
- let uri = Services.io.newURI(URL, null, null);
- var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
- Services.perms.removeFromPrincipal(principal, "offline-app");
- Services.prefs.clearUserPref("offline-apps.quota.warn");
-});
-
-// Check that the "preferences" UI is opened and showing which websites have
-// offline storage permissions - currently this is the "network" tab in the
-// "advanced" pane.
-function checkPreferences(prefsWin) {
- // We expect a 'paneload' event for the 'advanced' pane, then
- // a 'select' event on the 'network' tab inside that pane.
- prefsWin.addEventListener("paneload", function paneload(evt) {
- prefsWin.removeEventListener("paneload", paneload);
- is(evt.target.id, "paneAdvanced", "advanced pane loaded");
- let tabPanels = evt.target.getElementsByTagName("tabpanels")[0];
- tabPanels.addEventListener("select", function tabselect() {
- tabPanels.removeEventListener("select", tabselect);
- is(tabPanels.selectedPanel.id, "networkPanel", "networkPanel is selected");
- // all good, we are done.
- prefsWin.close();
- finish();
- });
- });
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- gBrowser.selectedBrowser.contentWindow.applicationCache.oncached = function() {
- executeSoon(function() {
- // We got cached - now we should have provoked the quota warning.
- let notification = PopupNotifications.getNotification('offline-app-usage');
- ok(notification, "have offline-app-usage notification");
- // select the default action - this should cause the preferences
- // window to open - which we track either via a window watcher (for
- // the window-based prefs) or via an "Initialized" event (for
- // in-content prefs.)
- if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
- // Bug 881576 - ensure this works with inContent prefs.
- todo(false, "Bug 881576 - this test needs to be updated for inContent prefs");
- } else {
- Services.ww.registerNotification(function wwobserver(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
- Services.ww.unregisterNotification(wwobserver);
- checkPreferences(aSubject);
- });
- PopupNotifications.panel.firstElementChild.button.click();
- }
- });
- };
- Services.prefs.setIntPref("offline-apps.quota.warn", 1);
-
- // Click the notification panel's "Allow" button. This should kick
- // off updates which will call our oncached handler above.
- PopupNotifications.panel.firstElementChild.button.click();
- }, true);
-
- gBrowser.contentWindow.location = URL;
-}
diff --git a/browser/base/content/test/browser_overflowScroll.js b/browser/base/content/test/browser_overflowScroll.js
deleted file mode 100644
index 8c0eac709..000000000
--- a/browser/base/content/test/browser_overflowScroll.js
+++ /dev/null
@@ -1,87 +0,0 @@
-var tabstrip = gBrowser.tabContainer.mTabstrip;
-var scrollbox = tabstrip._scrollbox;
-var originalSmoothScroll = tabstrip.smoothScroll;
-var tabs = gBrowser.tabs;
-
-function rect(ele) ele.getBoundingClientRect();
-function width(ele) rect(ele).width;
-function left(ele) rect(ele).left;
-function right(ele) rect(ele).right;
-function isLeft(ele, msg) is(left(ele), left(scrollbox), msg);
-function isRight(ele, msg) is(right(ele), right(scrollbox), msg);
-function elementFromPoint(x) tabstrip._elementFromPoint(x);
-function nextLeftElement() elementFromPoint(left(scrollbox) - 1);
-function nextRightElement() elementFromPoint(right(scrollbox) + 1);
-function firstScrollable() tabs[gBrowser._numPinnedTabs];
-
-function test() {
- requestLongerTimeout(2);
- waitForExplicitFinish();
-
- // If the previous (or more) test finished with cleaning up the tabs,
- // there may be some pending animations. That can cause a failure of
- // this tests, so, we should test this in another stack.
- setTimeout(doTest, 0);
-}
-
-function doTest() {
- tabstrip.smoothScroll = false;
-
- var tabMinWidth = parseInt(getComputedStyle(gBrowser.selectedTab, null).minWidth);
- var tabCountForOverflow = Math.ceil(width(tabstrip) / tabMinWidth * 3);
- while (tabs.length < tabCountForOverflow)
- gBrowser.addTab("about:blank", {skipAnimation: true});
- gBrowser.pinTab(tabs[0]);
-
- tabstrip.addEventListener("overflow", runOverflowTests, false);
-}
-
-function runOverflowTests(aEvent) {
- if (aEvent.detail != 1)
- return;
-
- tabstrip.removeEventListener("overflow", runOverflowTests, false);
-
- var upButton = tabstrip._scrollButtonUp;
- var downButton = tabstrip._scrollButtonDown;
- var element;
-
- gBrowser.selectedTab = firstScrollable();
- ok(left(scrollbox) <= left(firstScrollable()), "Selecting the first tab scrolls it into view " +
- "(" + left(scrollbox) + " <= " + left(firstScrollable()) + ")");
-
- element = nextRightElement();
- EventUtils.synthesizeMouseAtCenter(downButton, {});
- isRight(element, "Scrolled one tab to the right with a single click");
-
- gBrowser.selectedTab = tabs[tabs.length - 1];
- ok(right(gBrowser.selectedTab) <= right(scrollbox), "Selecting the last tab scrolls it into view " +
- "(" + right(gBrowser.selectedTab) + " <= " + right(scrollbox) + ")");
-
- element = nextLeftElement();
- EventUtils.synthesizeMouse(upButton, 1, 1, {});
- isLeft(element, "Scrolled one tab to the left with a single click");
-
- element = elementFromPoint(left(scrollbox) - width(scrollbox));
- EventUtils.synthesizeMouse(upButton, 1, 1, {clickCount: 2});
- isLeft(element, "Scrolled one page of tabs with a double click");
-
- EventUtils.synthesizeMouse(upButton, 1, 1, {clickCount: 3});
- var firstScrollableLeft = left(firstScrollable());
- ok(left(scrollbox) <= firstScrollableLeft, "Scrolled to the start with a triple click " +
- "(" + left(scrollbox) + " <= " + firstScrollableLeft + ")");
-
- for (var i = 2; i; i--)
- EventUtils.synthesizeWheel(scrollbox, 1, 1, { deltaX: -1.0, deltaMode: WheelEvent.DOM_DELTA_LINE });
- is(left(firstScrollable()), firstScrollableLeft, "Remained at the start with the mouse wheel");
-
- element = nextRightElement();
- EventUtils.synthesizeWheel(scrollbox, 1, 1, { deltaX: 1.0, deltaMode: WheelEvent.DOM_DELTA_LINE});
- isRight(element, "Scrolled one tab to the right with the mouse wheel");
-
- while (tabs.length > 1)
- gBrowser.removeTab(tabs[0]);
-
- tabstrip.smoothScroll = originalSmoothScroll;
- finish();
-}
diff --git a/browser/base/content/test/browser_pageInfo.js b/browser/base/content/test/browser_pageInfo.js
deleted file mode 100644
index c0159380c..000000000
--- a/browser/base/content/test/browser_pageInfo.js
+++ /dev/null
@@ -1,38 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var pageInfo;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
-
- Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
- pageInfo = BrowserPageInfo();
- }, true);
- content.location =
- "https://example.com/browser/browser/base/content/test/feed_tab.html";
-
- function observer(win, topic, data) {
- Services.obs.removeObserver(observer, "page-info-dialog-loaded");
- handlePageInfo();
- }
-
- function handlePageInfo() {
- ok(pageInfo.document.getElementById("feedTab"), "Feed tab");
- let feedListbox = pageInfo.document.getElementById("feedListbox");
- ok(feedListbox, "Feed list");
-
- var feedRowsNum = feedListbox.getRowCount();
- is(feedRowsNum, 3, "Number of feeds listed");
-
- for (var i = 0; i < feedRowsNum; i++) {
- let feedItem = feedListbox.getItemAtIndex(i);
- is(feedItem.getAttribute("name"), i + 1, "Feed name");
- }
-
- pageInfo.close();
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/base/content/test/browser_pageInfo_plugins.js b/browser/base/content/test/browser_pageInfo_plugins.js
deleted file mode 100644
index 58fd82586..000000000
--- a/browser/base/content/test/browser_pageInfo_plugins.js
+++ /dev/null
@@ -1,187 +0,0 @@
-let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-let gPageInfo = null;
-let gNextTest = null;
-let gTestBrowser = null;
-let gPluginHost = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
-let gPermissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(Components.interfaces.nsIPermissionManager);
-let gTestPermissionString = gPluginHost.getPermissionStringForType("application/x-test");
-let gSecondTestPermissionString = gPluginHost.getPermissionStringForType("application/x-second-test");
-
-function doOnPageLoad(url, continuation) {
- gNextTest = continuation;
- gTestBrowser.addEventListener("load", pageLoad, true);
- gTestBrowser.contentWindow.location = url;
-}
-
-function pageLoad() {
- gTestBrowser.removeEventListener("load", pageLoad);
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function doOnOpenPageInfo(continuation) {
- Services.obs.addObserver(pageInfoObserve, "page-info-dialog-loaded", false);
- gNextTest = continuation;
- // An explanation: it looks like the test harness complains about leaked
- // windows if we don't keep a reference to every window we've opened.
- // So, don't reuse pointers to opened Page Info windows - simply append
- // to this list.
- gPageInfo = BrowserPageInfo(null, "permTab");
-}
-
-function pageInfoObserve(win, topic, data) {
- Services.obs.removeObserver(pageInfoObserve, "page-info-dialog-loaded");
- executeSoon(gNextTest);
-}
-
-function finishTest() {
- gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
- gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
- Services.prefs.clearUserPref("plugins.click_to_play");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- gBrowser.selectedTab = gBrowser.addTab();
- gTestBrowser = gBrowser.selectedBrowser;
- gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
- gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
- doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart1a);
-}
-
-// The first test plugin is CtP and the second test plugin is enabled.
-function testPart1a() {
- let test = gTestBrowser.contentDocument.getElementById("test");
- let objLoadingContent = test.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "part 1a: Test plugin should not be activated");
- let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA");
- let objLoadingContent = secondtest.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "part 1a: Second Test plugin should be activated");
-
- doOnOpenPageInfo(testPart1b);
-}
-
-function testPart1b() {
- let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
- let testRadioDefault = gPageInfo.document.getElementById(gTestPermissionString + "#0");
-
- var qString = "#" + gTestPermissionString.replace(':', '\\:') + "\\#0";
- is(testRadioGroup.selectedItem, testRadioDefault, "part 1b: Test radio group should be set to 'Default'");
- let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
- testRadioGroup.selectedItem = testRadioAllow;
- testRadioAllow.doCommand();
-
- let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
- let secondtestRadioDefault = gPageInfo.document.getElementById(gSecondTestPermissionString + "#0");
- is(secondtestRadioGroup.selectedItem, secondtestRadioDefault, "part 1b: Second Test radio group should be set to 'Default'");
- let secondtestRadioAsk = gPageInfo.document.getElementById(gSecondTestPermissionString + "#3");
- secondtestRadioGroup.selectedItem = secondtestRadioAsk;
- secondtestRadioAsk.doCommand();
-
- doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart2);
-}
-
-// Now, the Test plugin should be allowed, and the Test2 plugin should be CtP
-function testPart2() {
- let test = gTestBrowser.contentDocument.getElementById("test").
- QueryInterface(Ci.nsIObjectLoadingContent);
- ok(test.activated, "part 2: Test plugin should be activated");
-
- let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA").
- QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!secondtest.activated, "part 2: Second Test plugin should not be activated");
- is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
- "part 2: Second test plugin should be click-to-play.");
-
- let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
- let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
- is(testRadioGroup.selectedItem, testRadioAllow, "part 2: Test radio group should be set to 'Allow'");
- let testRadioBlock = gPageInfo.document.getElementById(gTestPermissionString + "#2");
- testRadioGroup.selectedItem = testRadioBlock;
- testRadioBlock.doCommand();
-
- let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
- let secondtestRadioAsk = gPageInfo.document.getElementById(gSecondTestPermissionString + "#3");
- is(secondtestRadioGroup.selectedItem, secondtestRadioAsk, "part 2: Second Test radio group should be set to 'Always Ask'");
- let secondtestRadioBlock = gPageInfo.document.getElementById(gSecondTestPermissionString + "#2");
- secondtestRadioGroup.selectedItem = secondtestRadioBlock;
- secondtestRadioBlock.doCommand();
-
- doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart3);
-}
-
-// Now, all the things should be blocked
-function testPart3() {
- let test = gTestBrowser.contentDocument.getElementById("test").
- QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!test.activated, "part 3: Test plugin should not be activated");
- is(test.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
- "part 3: Test plugin should be marked as PLUGIN_DISABLED");
-
- let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA").
- QueryInterface(Ci.nsIObjectLoadingContent);
-
- ok(!secondtest.activated, "part 3: Second Test plugin should not be activated");
- is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
- "part 3: Second test plugin should be marked as PLUGIN_DISABLED");
-
- // reset permissions
- gPermissionManager.remove("127.0.0.1:8888", gTestPermissionString);
- gPermissionManager.remove("127.0.0.1:8888", gSecondTestPermissionString);
- // check that changing the permissions affects the radio state in the
- // open Page Info window
- let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
- let testRadioDefault = gPageInfo.document.getElementById(gTestPermissionString + "#0");
- is(testRadioGroup.selectedItem, testRadioDefault, "part 3: Test radio group should be set to 'Default'");
- let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
- let secondtestRadioDefault = gPageInfo.document.getElementById(gSecondTestPermissionString + "#0");
- is(secondtestRadioGroup.selectedItem, secondtestRadioDefault, "part 3: Second Test radio group should be set to 'Default'");
-
- doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart4a);
-}
-
-// Now test that setting permission directly (as from the popup notification)
-// immediately influences Page Info.
-function testPart4a() {
- // simulate "allow" from the doorhanger
- gPermissionManager.add(gTestBrowser.currentURI, gTestPermissionString, Ci.nsIPermissionManager.ALLOW_ACTION);
- gPermissionManager.add(gTestBrowser.currentURI, gSecondTestPermissionString, Ci.nsIPermissionManager.ALLOW_ACTION);
-
- // check (again) that changing the permissions affects the radio state in the
- // open Page Info window
- let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
- let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
- is(testRadioGroup.selectedItem, testRadioAllow, "part 4a: Test radio group should be set to 'Allow'");
- let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
- let secondtestRadioAllow = gPageInfo.document.getElementById(gSecondTestPermissionString + "#1");
- is(secondtestRadioGroup.selectedItem, secondtestRadioAllow, "part 4a: Second Test radio group should be set to 'Always Allow'");
-
- // now close Page Info and see that it opens with the right settings
- gPageInfo.close();
- doOnOpenPageInfo(testPart4b);
-}
-
-// check that "always allow" resulted in the radio buttons getting set to allow
-function testPart4b() {
- let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
- let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
- is(testRadioGroup.selectedItem, testRadioAllow, "part 4b: Test radio group should be set to 'Allow'");
-
- let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
- let secondtestRadioAllow = gPageInfo.document.getElementById(gSecondTestPermissionString + "#1");
- is(secondtestRadioGroup.selectedItem, secondtestRadioAllow, "part 4b: Second Test radio group should be set to 'Allow'");
-
- Services.prefs.setBoolPref("plugins.click_to_play", false);
- gPageInfo.close();
- finishTest();
-}
diff --git a/browser/base/content/test/browser_page_style_menu.js b/browser/base/content/test/browser_page_style_menu.js
deleted file mode 100644
index 99b1bcfc2..000000000
--- a/browser/base/content/test/browser_page_style_menu.js
+++ /dev/null
@@ -1,67 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
- tab.linkedBrowser.addEventListener("load", function () {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- checkPageStyleMenu();
- }, true);
- let rootDir = getRootDirectory(gTestPath);
- content.location = rootDir + "page_style_sample.html";
-}
-
-function checkPageStyleMenu() {
- var menupopup = document.getElementById("pageStyleMenu")
- .getElementsByTagName("menupopup")[0];
- gPageStyleMenu.fillPopup(menupopup);
-
- var items = [];
- var current = menupopup.getElementsByTagName("menuseparator")[0];
- while (current.nextSibling) {
- current = current.nextSibling;
- items.push(current);
- }
-
- var validLinks = 0;
- Array.forEach(content.document.getElementsByTagName("link"), function (link) {
- var title = link.getAttribute("title");
- var rel = link.getAttribute("rel");
- var media = link.getAttribute("media");
- var idstring = "link " + (title ? title : "without title and") +
- " with rel=\"" + rel + "\"" +
- (media ? " and media=\"" + media + "\"" : "");
-
- var item = items.filter(function (item) item.getAttribute("label") == title);
- var found = item.length == 1;
- var checked = found && (item[0].getAttribute("checked") == "true");
-
- switch (link.getAttribute("data-state")) {
- case "0":
- ok(!found, idstring + " does not show up in page style menu");
- break;
- case "0-todo":
- validLinks++;
- todo(!found, idstring + " should not show up in page style menu");
- ok(!checked, idstring + " is not selected");
- break;
- case "1":
- validLinks++;
- ok(found, idstring + " shows up in page style menu");
- ok(!checked, idstring + " is not selected");
- break;
- case "2":
- validLinks++;
- ok(found, idstring + " shows up in page style menu");
- ok(checked, idstring + " is selected");
- break;
- default:
- throw "data-state attribute is missing or has invalid value";
- }
- });
-
- is(validLinks, items.length, "all valid links found");
-
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/base/content/test/browser_pinnedTabs.js b/browser/base/content/test/browser_pinnedTabs.js
deleted file mode 100644
index 5dbe941a2..000000000
--- a/browser/base/content/test/browser_pinnedTabs.js
+++ /dev/null
@@ -1,73 +0,0 @@
-var tabs;
-
-function index(tab) Array.indexOf(gBrowser.tabs, tab);
-
-function indexTest(tab, expectedIndex, msg) {
- var diag = "tab " + tab + " should be at index " + expectedIndex;
- if (msg)
- msg = msg + " (" + diag + ")";
- else
- msg = diag;
- is(index(tabs[tab]), expectedIndex, msg);
-}
-
-function PinUnpinHandler(tab, eventName) {
- this.eventCount = 0;
- var self = this;
- tab.addEventListener(eventName, function() {
- tab.removeEventListener(eventName, arguments.callee, true);
-
- self.eventCount++;
- }, true);
- gBrowser.tabContainer.addEventListener(eventName, function(e) {
- gBrowser.tabContainer.removeEventListener(eventName, arguments.callee, true);
-
- if (e.originalTarget == tab) {
- self.eventCount++;
- }
- }, true);
-}
-
-function test() {
- tabs = [gBrowser.selectedTab, gBrowser.addTab(), gBrowser.addTab(), gBrowser.addTab()];
- indexTest(0, 0);
- indexTest(1, 1);
- indexTest(2, 2);
- indexTest(3, 3);
-
- var eh = new PinUnpinHandler(tabs[3], "TabPinned");
- gBrowser.pinTab(tabs[3]);
- is(eh.eventCount, 2, "TabPinned event should be fired");
- indexTest(0, 1);
- indexTest(1, 2);
- indexTest(2, 3);
- indexTest(3, 0);
-
- eh = new PinUnpinHandler(tabs[1], "TabPinned");
- gBrowser.pinTab(tabs[1]);
- is(eh.eventCount, 2, "TabPinned event should be fired");
- indexTest(0, 2);
- indexTest(1, 1);
- indexTest(2, 3);
- indexTest(3, 0);
-
- gBrowser.moveTabTo(tabs[3], 3);
- indexTest(3, 1, "shouldn't be able to mix a pinned tab into normal tabs");
-
- gBrowser.moveTabTo(tabs[2], 0);
- indexTest(2, 2, "shouldn't be able to mix a normal tab into pinned tabs");
-
- eh = new PinUnpinHandler(tabs[1], "TabUnpinned");
- gBrowser.unpinTab(tabs[1]);
- is(eh.eventCount, 2, "TabUnpinned event should be fired");
- indexTest(1, 1, "unpinning a tab should move a tab to the start of normal tabs");
-
- eh = new PinUnpinHandler(tabs[3], "TabUnpinned");
- gBrowser.unpinTab(tabs[3]);
- is(eh.eventCount, 2, "TabUnpinned event should be fired");
- indexTest(3, 0, "unpinning a tab should move a tab to the start of normal tabs");
-
- gBrowser.removeTab(tabs[1]);
- gBrowser.removeTab(tabs[2]);
- gBrowser.removeTab(tabs[3]);
-}
diff --git a/browser/base/content/test/browser_plainTextLinks.js b/browser/base/content/test/browser_plainTextLinks.js
deleted file mode 100644
index 4c7c8ee98..000000000
--- a/browser/base/content/test/browser_plainTextLinks.js
+++ /dev/null
@@ -1,115 +0,0 @@
-let doc, range, selection;
-function setSelection(el1, el2, index1, index2) {
- while (el1.nodeType != Node.TEXT_NODE)
- el1 = el1.firstChild;
- while (el2.nodeType != Node.TEXT_NODE)
- el2 = el2.firstChild;
-
- selection.removeAllRanges();
- range.setStart(el1, index1);
- range.setEnd(el2, index2);
- selection.addRange(range);
-}
-
-function initContextMenu(aNode) {
- document.popupNode = aNode;
- let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- let contextMenu = new nsContextMenu(contentAreaContextMenu);
- return contextMenu;
-}
-
-function testExpected(expected, msg, aNode) {
- let popupNode = aNode || doc.getElementsByTagName("DIV")[0];
- initContextMenu(popupNode);
- let linkMenuItem = document.getElementById("context-openlinkincurrent");
- is(linkMenuItem.hidden, expected, msg);
-}
-
-function testLinkExpected(expected, msg, aNode) {
- let popupNode = aNode || doc.getElementsByTagName("DIV")[0];
- let contextMenu = initContextMenu(popupNode);
- is(contextMenu.linkURL, expected, msg);
-}
-
-function runSelectionTests() {
- let mainDiv = doc.createElement("div");
- let div = doc.createElement("div");
- let div2 = doc.createElement("div");
- let span1 = doc.createElement("span");
- let span2 = doc.createElement("span");
- let span3 = doc.createElement("span");
- let span4 = doc.createElement("span");
- let p1 = doc.createElement("p");
- let p2 = doc.createElement("p");
- span1.textContent = "http://index.";
- span2.textContent = "example.com example.com";
- span3.textContent = " - Test";
- span4.innerHTML = "<a href='http://www.example.com'>http://www.example.com/example</a>";
- p1.textContent = "mailto:test.com ftp.example.com";
- p2.textContent = "example.com -";
- div.appendChild(span1);
- div.appendChild(span2);
- div.appendChild(span3);
- div.appendChild(span4);
- div.appendChild(p1);
- div.appendChild(p2);
- let p3 = doc.createElement("p");
- p3.textContent = "main.example.com";
- div2.appendChild(p3);
- mainDiv.appendChild(div);
- mainDiv.appendChild(div2);
- doc.body.appendChild(mainDiv);
- setSelection(span1.firstChild, span2.firstChild, 0, 11);
- testExpected(false, "The link context menu should show for http://www.example.com");
- setSelection(span1.firstChild, span2.firstChild, 7, 11);
- testExpected(false, "The link context menu should show for www.example.com");
- setSelection(span1.firstChild, span2.firstChild, 8, 11);
- testExpected(true, "The link context menu should not show for ww.example.com");
- setSelection(span2.firstChild, span2.firstChild, 0, 11);
- testExpected(false, "The link context menu should show for example.com");
- testLinkExpected("http://example.com/", "url for example.com selection should not prepend www");
- setSelection(span2.firstChild, span2.firstChild, 11, 23);
- testExpected(false, "The link context menu should show for example.com");
- setSelection(span2.firstChild, span2.firstChild, 0, 10);
- testExpected(true, "Link options should not show for selection that's not at a word boundary");
- setSelection(span2.firstChild, span3.firstChild, 12, 7);
- testExpected(true, "Link options should not show for selection that has whitespace");
- setSelection(span2.firstChild, span2.firstChild, 12, 19);
- testExpected(true, "Link options should not show unless a url is selected");
- setSelection(p1.firstChild, p1.firstChild, 0, 15);
- testExpected(true, "Link options should not show for mailto: links");
- setSelection(p1.firstChild, p1.firstChild, 16, 31);
- testExpected(false, "Link options should show for ftp.example.com");
- testLinkExpected("ftp://ftp.example.com/", "ftp.example.com should be preceeded with ftp://");
- setSelection(p2.firstChild, p2.firstChild, 0, 14);
- testExpected(false, "Link options should show for www.example.com ");
- selection.selectAllChildren(div2);
- testExpected(false, "Link options should show for triple-click selections");
- selection.selectAllChildren(span4);
- testLinkExpected("http://www.example.com/", "Linkified text should open the correct link", span4.firstChild);
-
- mainDiv.innerHTML = "(open-suse.ru)";
- setSelection(mainDiv, mainDiv, 1, 13);
- testExpected(false, "Link options should show for open-suse.ru");
- testLinkExpected("http://open-suse.ru/", "Linkified text should open the correct link");
- setSelection(mainDiv, mainDiv, 1, 14);
- testExpected(true, "Link options should not show for 'open-suse.ru)'");
-
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- range = doc.createRange();
- selection = content.getSelection();
- waitForFocus(runSelectionTests, content);
- }, true);
-
- content.location =
- "data:text/html;charset=UTF-8,Test For Non-Hyperlinked url selection";
-}
diff --git a/browser/base/content/test/browser_pluginCrashCommentAndURL.js b/browser/base/content/test/browser_pluginCrashCommentAndURL.js
deleted file mode 100644
index 1243daaca..000000000
--- a/browser/base/content/test/browser_pluginCrashCommentAndURL.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-const CRASH_URL = "http://example.com/browser/browser/base/content/test/pluginCrashCommentAndURL.html";
-
-const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
-
-function test() {
- // Crashing the plugin takes up a lot of time, so extend the test timeout.
- requestLongerTimeout(runs.length);
- waitForExplicitFinish();
-
- // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin
- // crash reports. This test needs them enabled. The test also needs a mock
- // report server, and fortunately one is already set up by toolkit/
- // crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
- // which CrashSubmit.jsm uses as a server override.
- let env = Cc["@mozilla.org/process/environment;1"].
- getService(Components.interfaces.nsIEnvironment);
- let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
- let serverURL = env.get("MOZ_CRASHREPORTER_URL");
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
- env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
-
- let tab = gBrowser.loadOneTab("about:blank", { inBackground: false });
- let browser = gBrowser.getBrowserForTab(tab);
- browser.addEventListener("PluginCrashed", onCrash, false);
- Services.obs.addObserver(onSubmitStatus, "crash-report-status", false);
-
- registerCleanupFunction(function cleanUp() {
- env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
- env.set("MOZ_CRASHREPORTER_URL", serverURL);
- gBrowser.selectedBrowser.removeEventListener("PluginCrashed", onCrash,
- false);
- Services.obs.removeObserver(onSubmitStatus, "crash-report-status");
- gBrowser.removeCurrentTab();
- });
-
- doNextRun();
-}
-
-let runs = [
- {
- shouldSubmissionUIBeVisible: true,
- comment: "",
- urlOptIn: false,
- },
- {
- shouldSubmissionUIBeVisible: true,
- comment: "a test comment",
- urlOptIn: true,
- },
- {
- width: 300,
- height: 300,
- shouldSubmissionUIBeVisible: false,
- },
-];
-
-let currentRun = null;
-
-function doNextRun() {
- try {
- if (!runs.length) {
- finish();
- return;
- }
- currentRun = runs.shift();
- let args = ["width", "height"].reduce(function (memo, arg) {
- if (arg in currentRun)
- memo[arg] = currentRun[arg];
- return memo;
- }, {});
- gBrowser.loadURI(CRASH_URL + "?" +
- encodeURIComponent(JSON.stringify(args)));
- // And now wait for the crash.
- }
- catch (err) {
- failWithException(err);
- finish();
- }
-}
-
-function onCrash() {
- try {
- let plugin = gBrowser.contentDocument.getElementById("plugin");
- let elt = gPluginHandler.getPluginUI.bind(gPluginHandler, plugin);
- let style =
- gBrowser.contentWindow.getComputedStyle(elt("msg msgPleaseSubmit"));
- is(style.display,
- currentRun.shouldSubmissionUIBeVisible ? "block" : "none",
- "Submission UI visibility should be correct");
- if (!currentRun.shouldSubmissionUIBeVisible) {
- // Done with this run.
- doNextRun();
- return;
- }
- elt("submitComment").value = currentRun.comment;
- elt("submitURLOptIn").checked = currentRun.urlOptIn;
- elt("submitButton").click();
- // And now wait for the submission status notification.
- }
- catch (err) {
- failWithException(err);
- doNextRun();
- }
-}
-
-function onSubmitStatus(subj, topic, data) {
- try {
- // Wait for success or failed, doesn't matter which.
- if (data != "success" && data != "failed")
- return;
-
- let extra = getPropertyBagValue(subj.QueryInterface(Ci.nsIPropertyBag),
- "extra");
- ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag");
-
- let val = getPropertyBagValue(extra, "PluginUserComment");
- if (currentRun.comment)
- is(val, currentRun.comment,
- "Comment in extra data should match comment in textbox");
- else
- ok(val === undefined,
- "Comment should be absent from extra data when textbox is empty");
-
- val = getPropertyBagValue(extra, "PluginContentURL");
- if (currentRun.urlOptIn)
- is(val, gBrowser.currentURI.spec,
- "URL in extra data should match browser URL when opt-in checked");
- else
- ok(val === undefined,
- "URL should be absent from extra data when opt-in not checked");
- }
- catch (err) {
- failWithException(err);
- }
- doNextRun();
-}
-
-function getPropertyBagValue(bag, key) {
- try {
- var val = bag.getProperty(key);
- }
- catch (e if e.result == Cr.NS_ERROR_FAILURE) {}
- return val;
-}
-
-function failWithException(err) {
- ok(false, "Uncaught exception: " + err + "\n" + err.stack);
-}
diff --git a/browser/base/content/test/browser_pluginnotification.js b/browser/base/content/test/browser_pluginnotification.js
deleted file mode 100644
index 1b4fc86cc..000000000
--- a/browser/base/content/test/browser_pluginnotification.js
+++ /dev/null
@@ -1,841 +0,0 @@
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-// This listens for the next opened tab and checks it is of the right url.
-// opencallback is called when the new tab is fully loaded
-// closecallback is called when the tab is closed
-function TabOpenListener(url, opencallback, closecallback) {
- this.url = url;
- this.opencallback = opencallback;
- this.closecallback = closecallback;
-
- gBrowser.tabContainer.addEventListener("TabOpen", this, false);
-}
-
-TabOpenListener.prototype = {
- url: null,
- opencallback: null,
- closecallback: null,
- tab: null,
- browser: null,
-
- handleEvent: function(event) {
- if (event.type == "TabOpen") {
- gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
- this.tab = event.originalTarget;
- this.browser = this.tab.linkedBrowser;
- gBrowser.addEventListener("pageshow", this, false);
- } else if (event.type == "pageshow") {
- if (event.target.location.href != this.url)
- return;
- gBrowser.removeEventListener("pageshow", this, false);
- this.tab.addEventListener("TabClose", this, false);
- var url = this.browser.contentDocument.location.href;
- is(url, this.url, "Should have opened the correct tab");
- this.opencallback(this.tab, this.browser.contentWindow);
- } else if (event.type == "TabClose") {
- if (event.originalTarget != this.tab)
- return;
- this.tab.removeEventListener("TabClose", this, false);
- this.opencallback = null;
- this.tab = null;
- this.browser = null;
- // Let the window close complete
- executeSoon(this.closecallback);
- this.closecallback = null;
- }
- }
-};
-
-function test() {
- waitForExplicitFinish();
- requestLongerTimeout(2);
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- prepareTest(runAfterPluginBindingAttached(test1), gTestRoot + "plugin_unknown.html");
-}
-
-function finishTest() {
- clearAllPluginPermissions();
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Due to layout being async, "PluginBindAttached" may trigger later.
-// This wraps a function to force a layout flush, thus triggering it,
-// and schedules the function execution so they're definitely executed
-// afterwards.
-function runAfterPluginBindingAttached(func) {
- return function() {
- let doc = gTestBrowser.contentDocument;
- let elems = doc.getElementsByTagName('embed');
- if (elems.length < 1) {
- elems = doc.getElementsByTagName('object');
- }
- elems[0].clientTop;
- executeSoon(func);
- };
-}
-
-// Tests a page with an unknown plugin in it.
-function test1() {
- ok(PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 1, Should have displayed the missing plugin notification");
- ok(gTestBrowser.missingPlugins, "Test 1, Should be a missing plugin list");
- ok(gTestBrowser.missingPlugins.has("application/x-unknown"), "Test 1, Should know about application/x-unknown");
- ok(!gTestBrowser.missingPlugins.has("application/x-test"), "Test 1, Should not know about application/x-test");
-
- var pluginNode = gTestBrowser.contentDocument.getElementById("unknown");
- ok(pluginNode, "Test 1, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED, "Test 1, plugin fallback type should be PLUGIN_UNSUPPORTED");
-
- var plugin = getTestPlugin();
- ok(plugin, "Should have a test plugin");
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- prepareTest(runAfterPluginBindingAttached(test2), gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it.
-function test2() {
- ok(!PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 2, Should not have displayed the missing plugin notification");
- ok(!gTestBrowser.missingPlugins, "Test 2, Should not be a missing plugin list");
-
- var plugin = getTestPlugin();
- ok(plugin, "Should have a test plugin");
- plugin.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
- prepareTest(runAfterPluginBindingAttached(test3), gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a disabled plugin in it.
-function test3() {
- ok(!PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 3, Should not have displayed the missing plugin notification");
- ok(!gTestBrowser.missingPlugins, "Test 3, Should not be a missing plugin list");
-
- new TabOpenListener("about:addons", test4, prepareTest5);
-
- var pluginNode = gTestBrowser.contentDocument.getElementById("test");
- ok(pluginNode, "Test 3, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED, "Test 3, plugin fallback type should be PLUGIN_DISABLED");
- var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "anonid", "managePluginsLink");
- ok(manageLink, "Test 3, found 'manage' link in plugin-problem binding");
-
- EventUtils.synthesizeMouseAtCenter(manageLink, {}, gTestBrowser.contentWindow);
-}
-
-function test4(tab, win) {
- is(win.wrappedJSObject.gViewController.currentViewId, "addons://list/plugin", "Test 4, Should have displayed the plugins pane");
- gBrowser.removeTab(tab);
-}
-
-function prepareTest5() {
- info("prepareTest5");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
- function() {
- info("prepareTest5 callback");
- prepareTest(runAfterPluginBindingAttached(test5), gTestRoot + "plugin_test.html");
- });
-}
-
-// Tests a page with a blocked plugin in it.
-function test5() {
- info("test5");
- ok(!PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 5, Should not have displayed the missing plugin notification");
- let notification = PopupNotifications.getNotification("click-to-play-plugins");
- ok(notification, "Test 5: There should be a plugin notification for blocked plugins");
- ok(notification.dismissed, "Test 5: The plugin notification should be dismissed by default");
-
- notification.reshow();
- is(notification.options.centerActions.length, 1, "Test 5: Only the blocked plugin should be present in the notification");
- ok(PopupNotifications.panel.firstChild._buttonContainer.hidden, "Part 5: The blocked plugins notification should not have any buttons visible.");
-
- ok(!gTestBrowser.missingPlugins, "Test 5, Should not be a missing plugin list");
- var pluginNode = gTestBrowser.contentDocument.getElementById("test");
- ok(pluginNode, "Test 5, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED, "Test 5, plugin fallback type should be PLUGIN_BLOCKLISTED");
-
- prepareTest(runAfterPluginBindingAttached(test6), gTestRoot + "plugin_both.html");
-}
-
-// Tests a page with a blocked and unknown plugin in it.
-function test6() {
- ok(PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 6, Should have displayed the missing plugin notification");
- ok(gTestBrowser.missingPlugins, "Test 6, Should be a missing plugin list");
- ok(gTestBrowser.missingPlugins.has("application/x-unknown"), "Test 6, Should know about application/x-unknown");
- ok(!gTestBrowser.missingPlugins.has("application/x-test"), "Test 6, application/x-test should not be a missing plugin");
-
- prepareTest(runAfterPluginBindingAttached(test7), gTestRoot + "plugin_both2.html");
-}
-
-// Tests a page with a blocked and unknown plugin in it (alternate order to above).
-function test7() {
- ok(PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 7, Should have displayed the missing plugin notification");
- ok(gTestBrowser.missingPlugins, "Test 7, Should be a missing plugin list");
- ok(gTestBrowser.missingPlugins.has("application/x-unknown"), "Test 7, Should know about application/x-unknown");
- ok(!gTestBrowser.missingPlugins.has("application/x-test"), "Test 7, application/x-test should not be a missing plugin");
-
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
- prepareTest(runAfterPluginBindingAttached(test8), gTestRoot + "plugin_test.html");
- });
-}
-
-// Tests a page with a working plugin that is click-to-play
-function test8() {
- ok(!PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 8, Should not have displayed the missing plugin notification");
- ok(!gTestBrowser.missingPlugins, "Test 8, Should not be a missing plugin list");
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 8, Should have a click-to-play notification");
-
- var pluginNode = gTestBrowser.contentDocument.getElementById("test");
- ok(pluginNode, "Test 8, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 8, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-
- prepareTest(runAfterPluginBindingAttached(test11a), gTestRoot + "plugin_test3.html");
-}
-
-// Tests 9 & 10 removed
-
-// Tests that the going back will reshow the notification for click-to-play plugins (part 1/4)
-function test11a() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 11a, Should have a click-to-play notification");
-
- prepareTest(test11b, "about:blank");
-}
-
-// Tests that the going back will reshow the notification for click-to-play plugins (part 2/4)
-function test11b() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!popupNotification, "Test 11b, Should not have a click-to-play notification");
-
- Services.obs.addObserver(test11c, "PopupNotifications-updateNotShowing", false);
- gTestBrowser.contentWindow.history.back();
-}
-
-// Tests that the going back will reshow the notification for click-to-play plugins (part 3/4)
-function test11c() {
- Services.obs.removeObserver(test11c, "PopupNotifications-updateNotShowing");
- var condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, test11d, "Test 11c, waited too long for click-to-play-plugin notification");
-}
-
-// Tests that the going back will reshow the notification for click-to-play plugins (part 4/4)
-function test11d() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 11d, Should have a click-to-play notification");
-
- prepareTest(runAfterPluginBindingAttached(test12a), gHttpTestRoot + "plugin_clickToPlayAllow.html");
-}
-
-// Tests that the "Allow Always" permission works for click-to-play plugins
-function test12a() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 12a, Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 12a, Plugin should not be activated");
-
- // Simulate clicking the "Allow Always" button.
- popupNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test12b, "Test 12a, Waited too long for plugin to activate");
-}
-
-function test12b() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 12d, Should have a click-to-play notification");
- prepareTest(runAfterPluginBindingAttached(test12c), gHttpTestRoot + "plugin_two_types.html");
-}
-
-// Test that the "Always" permission, when set for just the Test plugin,
-// does not also allow the Second Test plugin.
-function test12c() {
- var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "Test 12d, Should have a click-to-play notification");
- var test = gTestBrowser.contentDocument.getElementById("test");
- var secondtestA = gTestBrowser.contentDocument.getElementById("secondtestA");
- var secondtestB = gTestBrowser.contentDocument.getElementById("secondtestB");
- ok(test.activated, "Test 12d, Test plugin should be activated");
- ok(!secondtestA.activated, "Test 12d, Second Test plugin (A) should not be activated");
- ok(!secondtestB.activated, "Test 12d, Second Test plugin (B) should not be activated");
-
- clearAllPluginPermissions();
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- prepareTest(test14, gTestRoot + "plugin_test2.html");
-}
-
-// Test 13 removed
-
-// Tests that the plugin's "activated" property is true for working plugins with click-to-play disabled.
-function test14() {
- var plugin = gTestBrowser.contentDocument.getElementById("test1");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 14, Plugin should be activated");
-
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- prepareTest(runAfterPluginBindingAttached(test15), gTestRoot + "plugin_alternate_content.html");
-}
-
-// Tests that the overlay is shown instead of alternate content when
-// plugins are click to play
-function test15() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var doc = gTestBrowser.contentDocument;
- var mainBox = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
- ok(mainBox, "Test 15, Plugin with id=" + plugin.id + " overlay should exist");
-
- prepareTest(runAfterPluginBindingAttached(test17), gTestRoot + "plugin_bug749455.html");
-}
-
-// Test 16 removed
-
-// Tests that mContentType is used for click-to-play plugins, and not the
-// inspected type.
-function test17() {
- var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(clickToPlayNotification, "Test 17, Should have a click-to-play notification");
- var missingNotification = PopupNotifications.getNotification("missing-plugins", gTestBrowser);
- ok(!missingNotification, "Test 17, Should not have a missing plugin notification");
-
- setAndUpdateBlocklist(gHttpTestRoot + "blockPluginVulnerableUpdatable.xml",
- function() {
- prepareTest(runAfterPluginBindingAttached(test18a), gHttpTestRoot + "plugin_test.html");
- });
-}
-
-// Tests a vulnerable, updatable plugin
-function test18a() {
- var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(clickToPlayNotification, "Test 18a, Should have a click-to-play notification");
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- ok(plugin, "Test 18a, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
- ok(!objLoadingContent.activated, "Test 18a, Plugin should not be activated");
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
- ok(overlay.style.visibility != "hidden", "Test 18a, Plugin overlay should exist, not be hidden");
- var updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
- ok(updateLink.style.visibility != "hidden", "Test 18a, Plugin should have an update link");
-
- var tabOpenListener = new TabOpenListener(Services.urlFormatter.formatURLPref("plugins.update.url"), false, false);
- tabOpenListener.handleEvent = function(event) {
- if (event.type == "TabOpen") {
- gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
- this.tab = event.originalTarget;
- ok(event.target.label == this.url, "Test 18a, Update link should open up the plugin check page");
- gBrowser.removeTab(this.tab);
- test18b();
- }
- };
- EventUtils.synthesizeMouseAtCenter(updateLink, {}, gTestBrowser.contentWindow);
-}
-
-function test18b() {
- // clicking the update link should not activate the plugin
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 18b, Plugin should not be activated");
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
- ok(overlay.style.visibility != "hidden", "Test 18b, Plugin overlay should exist, not be hidden");
-
- setAndUpdateBlocklist(gHttpTestRoot + "blockPluginVulnerableNoUpdate.xml",
- function() {
- prepareTest(runAfterPluginBindingAttached(test18c), gHttpTestRoot + "plugin_test.html");
- });
-}
-
-// Tests a vulnerable plugin with no update
-function test18c() {
- var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(clickToPlayNotification, "Test 18c, Should have a click-to-play notification");
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- ok(plugin, "Test 18c, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE, "Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
- ok(!objLoadingContent.activated, "Test 18c, Plugin should not be activated");
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
- ok(overlay.style.visibility != "hidden", "Test 18c, Plugin overlay should exist, not be hidden");
- var updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
- ok(updateLink.style.display != "block", "Test 18c, Plugin should not have an update link");
-
- // check that click "Always allow" works with blocklisted plugins
- clickToPlayNotification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test18d, "Test 18d, Waited too long for plugin to activate");
-}
-
-// continue testing "Always allow"
-function test18d() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 18d, Plugin should be activated");
-
- prepareTest(test18e, gHttpTestRoot + "plugin_test.html");
-}
-
-// continue testing "Always allow"
-function test18e() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 18e, Plugin should be activated");
-
- clearAllPluginPermissions();
- prepareTest(runAfterPluginBindingAttached(test18f), gHttpTestRoot + "plugin_test.html");
-}
-
-// clicking the in-content overlay of a vulnerable plugin should bring
-// up the notification and not directly activate the plugin
-function test18f() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 18f, Should have a click-to-play notification");
- ok(notification.dismissed, "Test 18f, notification should start dismissed");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 18f, Plugin should not be activated");
-
- // XXXBAD: this code doesn't do what you think it does! it is actually
- // observing the "removed" event of the old notification, since we create
- // a *new* one when the plugin is clicked.
- notification.options.eventCallback = function() { executeSoon(test18g); };
- EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
-}
-
-function test18g() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 18g, Should have a click-to-play notification");
- ok(!notification.dismissed, "Test 18g, notification should be open");
- notification.options.eventCallback = null;
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 18g, Plugin should not be activated");
-
- setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml",
- function() {
- resetBlocklist();
- prepareTest(runAfterPluginBindingAttached(test19a), gTestRoot + "plugin_test.html");
- });
-}
-
-// Tests that clicking the icon of the overlay activates the doorhanger
-function test19a() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 19a, Plugin should not be activated");
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Test 19a, Doorhanger should start out dismissed");
-
- var icon = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
- EventUtils.synthesizeMouseAtCenter(icon, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, test19b, "Test 19a, Waited too long for doorhanger to activate");
-}
-
-function test19b() {
- prepareTest(runAfterPluginBindingAttached(test19c), gTestRoot + "plugin_test.html");
-}
-
-// Tests that clicking the text of the overlay activates the plugin
-function test19c() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 19c, Plugin should not be activated");
-
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Test 19c, Doorhanger should start out dismissed");
-
- var text = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
- EventUtils.synthesizeMouseAtCenter(text, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, test19d, "Test 19c, Waited too long for doorhanger to activate");
-}
-
-function test19d() {
- prepareTest(runAfterPluginBindingAttached(test19e), gTestRoot + "plugin_test.html");
-}
-
-// Tests that clicking the box of the overlay activates the doorhanger
-// (just to be thorough)
-function test19e() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 19e, Plugin should not be activated");
-
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Test 19e, Doorhanger should start out dismissed");
-
- EventUtils.synthesizeMouse(plugin, 50, 50, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, test19f, "Test 19e, Waited too long for plugin to activate");
-}
-
-function test19f() {
- prepareTest(test20a, gTestRoot + "plugin_hidden_to_visible.html");
-}
-
-// Tests that a plugin in a div that goes from style="display: none" to
-// "display: block" can be clicked to activate.
-function test20a() {
- var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!clickToPlayNotification, "Test 20a, Should not have a click-to-play notification");
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("plugin");
- var mainBox = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
- ok(mainBox, "Test 20a, plugin overlay should not be null");
- var pluginRect = mainBox.getBoundingClientRect();
- ok(pluginRect.width == 0, "Test 20a, plugin should have an overlay with 0px width");
- ok(pluginRect.height == 0, "Test 20a, plugin should have an overlay with 0px height");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 20a, plugin should not be activated");
- var div = doc.getElementById("container");
- ok(div.style.display == "none", "Test 20a, container div should be display: none");
-
- div.style.display = "block";
- var condition = function() {
- var pluginRect = mainBox.getBoundingClientRect();
- return (pluginRect.width == 200);
- }
- waitForCondition(condition, test20b, "Test 20a, Waited too long for plugin to become visible");
-}
-
-function test20b() {
- var clickToPlayNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(clickToPlayNotification, "Test 20b, Should now have a click-to-play notification");
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("plugin");
- var pluginRect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(pluginRect.width == 200, "Test 20b, plugin should have an overlay with 200px width");
- ok(pluginRect.height == 200, "Test 20b, plugin should have an overlay with 200px height");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 20b, plugin should not be activated");
-
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed, "Test 20b, Doorhanger should start out dismissed");
-
- EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
- let condition = function() !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
- waitForCondition(condition, test20c, "Test 20b, Waited too long for plugin to activate");
-}
-
-function test20c() {
- PopupNotifications.panel.firstChild._primaryButton.click();
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("plugin");
- let condition = function() plugin.activated;
- waitForCondition(condition, test20d, "Test 20c", "Waiting for plugin to activate");
-}
-
-function test20d() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("plugin");
- var pluginRect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(pluginRect.width == 0, "Test 20d, plugin should have click-to-play overlay with zero width");
- ok(pluginRect.height == 0, "Test 20d, plugin should have click-to-play overlay with zero height");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 20d, plugin should be activated");
-
- clearAllPluginPermissions();
-
- prepareTest(runAfterPluginBindingAttached(test21a), gTestRoot + "plugin_two_types.html");
-}
-
-// Test having multiple different types of plugin on one page
-function test21a() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21a, Should have a click-to-play notification");
-
- var doc = gTestBrowser.contentDocument;
- var ids = ["test", "secondtestA", "secondtestB"];
- for (var id of ids) {
- var plugin = doc.getElementById(id);
- var rect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(rect.width == 200, "Test 21a, Plugin with id=" + plugin.id + " overlay rect should have 200px width before being clicked");
- ok(rect.height == 200, "Test 21a, Plugin with id=" + plugin.id + " overlay rect should have 200px height before being clicked");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 21a, Plugin with id=" + plugin.id + " should not be activated");
- }
-
- // we have to actually show the panel to get the bindings to instantiate
- notification.reshow();
- is(notification.options.centerActions.length, 2, "Test 21a, Should have two types of plugin in the notification");
-
- var centerAction = null;
- for (var action of notification.options.centerActions) {
- if (action.pluginName == "Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 21b, found center action for the Test plugin");
-
- var centerItem = null;
- for (var item of PopupNotifications.panel.firstChild.childNodes) {
- is(item.value, "block", "Test 21b, all plugins should start out blocked");
- if (item.action == centerAction) {
- centerItem = item;
- break;
- }
- }
- ok(centerItem, "Test 21b, found center item for the Test plugin");
-
- // "click" the button to activate the Test plugin
- centerItem.value = "allownow";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test21c, "Test 21b, Waited too long for plugin to activate");
-}
-
-function test21c() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 21c, Should have a click-to-play notification");
-
- notification.reshow();
- ok(notification.options.centerActions.length == 2, "Test 21c, Should have one type of plugin in the notification");
-
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var rect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(rect.width == 0, "Test 21c, Plugin with id=" + plugin.id + " overlay rect should have 0px width after being clicked");
- ok(rect.height == 0, "Test 21c, Plugin with id=" + plugin.id + " overlay rect should have 0px height after being clicked");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 21c, Plugin with id=" + plugin.id + " should be activated");
-
- var ids = ["secondtestA", "secondtestB"];
- for (var id of ids) {
- var plugin = doc.getElementById(id);
- var rect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(rect.width == 200, "Test 21c, Plugin with id=" + plugin.id + " overlay rect should have 200px width before being clicked");
- ok(rect.height == 200, "Test 21c, Plugin with id=" + plugin.id + " overlay rect should have 200px height before being clicked");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(!objLoadingContent.activated, "Test 21c, Plugin with id=" + plugin.id + " should not be activated");
- }
-
- var centerAction = null;
- for (var action of notification.options.centerActions) {
- if (action.pluginName == "Second Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "Test 21d, found center action for the Second Test plugin");
-
- var centerItem = null;
- for (var item of PopupNotifications.panel.firstChild.childNodes) {
- if (item.action == centerAction) {
- is(item.value, "block", "Test 21d, test plugin 2 should start blocked");
- centerItem = item;
- break;
- }
- else {
- is(item.value, "allownow", "Test 21d, test plugin should be enabled");
- }
- }
- ok(centerItem, "Test 21d, found center item for the Second Test plugin");
-
- // "click" the button to activate the Second Test plugins
- centerItem.value = "allownow";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("secondtestA");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test21e, "Test 21d, Waited too long for plugin to activate");
-}
-
-function test21e() {
- var doc = gTestBrowser.contentDocument;
- var ids = ["test", "secondtestA", "secondtestB"];
- for (var id of ids) {
- var plugin = doc.getElementById(id);
- var rect = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox").getBoundingClientRect();
- ok(rect.width == 0, "Test 21e, Plugin with id=" + plugin.id + " overlay rect should have 0px width after being clicked");
- ok(rect.height == 0, "Test 21e, Plugin with id=" + plugin.id + " overlay rect should have 0px height after being clicked");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 21e, Plugin with id=" + plugin.id + " should be activated");
- }
-
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- clearAllPluginPermissions();
-
- prepareTest(runAfterPluginBindingAttached(test22), gTestRoot + "plugin_test.html");
-}
-
-// Tests that a click-to-play plugin retains its activated state upon reloading
-function test22() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 22, Should have a click-to-play notification");
-
- // Plugin should start as CTP
- var pluginNode = gTestBrowser.contentDocument.getElementById("test");
- ok(pluginNode, "Test 22, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 22, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-
- // Activate
- objLoadingContent.playPlugin();
- is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, plugin should have started");
- ok(pluginNode.activated, "Test 22, plugin should be activated");
-
- // Reload plugin
- var oldVal = pluginNode.getObjectValue();
- pluginNode.src = pluginNode.src;
- is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 22, Plugin should have retained activated state");
- ok(pluginNode.activated, "Test 22, plugin should have remained activated");
- // Sanity, ensure that we actually reloaded the instance, since this behavior might change in the future.
- var pluginsDiffer;
- try {
- pluginNode.checkObjectValue(oldVal);
- } catch (e) {
- pluginsDiffer = true;
- }
- ok(pluginsDiffer, "Test 22, plugin should have reloaded");
-
- prepareTest(runAfterPluginBindingAttached(test23), gTestRoot + "plugin_test.html");
-}
-
-// Tests that a click-to-play plugin resets its activated state when changing types
-function test23() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "Test 23, Should have a click-to-play notification");
-
- // Plugin should start as CTP
- var pluginNode = gTestBrowser.contentDocument.getElementById("test");
- ok(pluginNode, "Test 23, Found plugin in page");
- var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 23, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-
- // Activate
- objLoadingContent.playPlugin();
- is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 23, plugin should have started");
- ok(pluginNode.activated, "Test 23, plugin should be activated");
-
- // Reload plugin (this may need RunSoon() in the future when plugins change state asynchronously)
- pluginNode.type = null;
- // We currently don't properly change state just on type change,
- // so rebind the plugin to tree. bug 767631
- pluginNode.parentNode.appendChild(pluginNode);
- is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, plugin should be unloaded");
- pluginNode.type = "application/x-test";
- pluginNode.parentNode.appendChild(pluginNode);
- is(objLoadingContent.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, Plugin should not have activated");
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 23, Plugin should be click-to-play");
- ok(!pluginNode.activated, "Test 23, plugin node should not be activated");
-
- prepareTest(runAfterPluginBindingAttached(test24a), gHttpTestRoot + "plugin_test.html");
-}
-
-// Test that "always allow"-ing a plugin will not allow it when it becomes
-// blocklisted.
-function test24a() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 24a, Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(plugin, "Test 24a, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Test 24a, Plugin should be click-to-play");
- ok(!objLoadingContent.activated, "Test 24a, plugin should not be activated");
-
- // simulate "always allow"
- notification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
- prepareTest(test24b, gHttpTestRoot + "plugin_test.html");
-}
-
-// did the "always allow" work as intended?
-function test24b() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(plugin, "Test 24b, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 24b, plugin should be activated");
- setAndUpdateBlocklist(gHttpTestRoot + "blockPluginVulnerableUpdatable.xml",
- function() {
- prepareTest(runAfterPluginBindingAttached(test24c), gHttpTestRoot + "plugin_test.html");
- });
-}
-
-// the plugin is now blocklisted, so it should not automatically load
-function test24c() {
- var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(notification, "Test 24c, Should have a click-to-play notification");
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(plugin, "Test 24c, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "Test 24c, Plugin should be vulnerable/updatable");
- ok(!objLoadingContent.activated, "Test 24c, plugin should not be activated");
-
- // simulate "always allow"
- notification.reshow();
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- prepareTest(test24d, gHttpTestRoot + "plugin_test.html");
-}
-
-// We should still be able to always allow a plugin after we've seen that it's
-// blocklisted.
-function test24d() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- ok(plugin, "Test 24d, Found plugin in page");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 24d, plugin should be activated");
-
- // this resets the vulnerable plugin permission
- setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml",
- function() {
- clearAllPluginPermissions();
- resetBlocklist();
- finishTest();
- });
-}
diff --git a/browser/base/content/test/browser_pluginplaypreview.js b/browser/base/content/test/browser_pluginplaypreview.js
deleted file mode 100644
index d1d8a53fb..000000000
--- a/browser/base/content/test/browser_pluginplaypreview.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gNextTestSkip = 0;
-var gPlayPreviewPluginActualEvents = 0;
-var gPlayPreviewPluginExpectedEvents = 1;
-
-var gPlayPreviewRegistration = null;
-
-function registerPlayPreview(mimeType, targetUrl) {
-
- function StreamConverterFactory() {}
- StreamConverterFactory.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]),
- _targetConstructor: null,
-
- register: function register(targetConstructor) {
- this._targetConstructor = targetConstructor;
- var proto = targetConstructor.prototype;
- var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- registrar.registerFactory(proto.classID, proto.classDescription,
- proto.contractID, this);
- },
-
- unregister: function unregister() {
- var proto = this._targetConstructor.prototype;
- var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- registrar.unregisterFactory(proto.classID, this);
- this._targetConstructor = null;
- },
-
- // nsIFactory
- createInstance: function createInstance(aOuter, iid) {
- if (aOuter !== null)
- throw Cr.NS_ERROR_NO_AGGREGATION;
- return (new (this._targetConstructor)).QueryInterface(iid);
- },
-
- // nsIFactory
- lockFactory: function lockFactory(lock) {
- // No longer used as of gecko 1.7.
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
- }
- };
-
- function OverlayStreamConverter() {}
- OverlayStreamConverter.prototype = {
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsISupports,
- Ci.nsIStreamConverter,
- Ci.nsIStreamListener,
- Ci.nsIRequestObserver
- ]),
-
- classID: Components.ID('{4c6030f7-e20a-264f-0f9b-ada3a9e97384}'),
- classDescription: 'overlay-test-data Component',
- contractID: '@mozilla.org/streamconv;1?from=application/x-moz-playpreview&to=*/*',
-
- // nsIStreamConverter::convert
- convert: function(aFromStream, aFromType, aToType, aCtxt) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
- },
-
- // nsIStreamConverter::asyncConvertData
- asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
- var isValidRequest = false;
- try {
- var request = aCtxt;
- request.QueryInterface(Ci.nsIChannel);
- var spec = request.URI.spec;
- var expectedSpec = 'data:application/x-moz-playpreview;,' + mimeType;
- isValidRequest = (spec == expectedSpec);
- } catch (e) { }
- if (!isValidRequest)
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-
- // Store the listener passed to us
- this.listener = aListener;
- },
-
- // nsIStreamListener::onDataAvailable
- onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
- // Do nothing since all the data loading is handled by the viewer.
- ok(false, "onDataAvailable should not be called");
- },
-
- // nsIRequestObserver::onStartRequest
- onStartRequest: function(aRequest, aContext) {
-
- // Setup the request so we can use it below.
- aRequest.QueryInterface(Ci.nsIChannel);
- // Cancel the request so the viewer can handle it.
- aRequest.cancel(Cr.NS_BINDING_ABORTED);
-
- // Create a new channel that is viewer loaded as a resource.
- var ioService = Services.io;
- var channel = ioService.newChannel(targetUrl, null, null);
- channel.asyncOpen(this.listener, aContext);
- },
-
- // nsIRequestObserver::onStopRequest
- onStopRequest: function(aRequest, aContext, aStatusCode) {
- // Do nothing.
- }
- };
-
- var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
- ph.registerPlayPreviewMimeType(mimeType, true); // ignoring CTP rules
-
- var factory = new StreamConverterFactory();
- factory.register(OverlayStreamConverter);
-
- return (gPlayPreviewRegistration = {
- unregister: function() {
- ph.unregisterPlayPreviewMimeType(mimeType);
- factory.unregister();
- gPlayPreviewRegistration = null;
- }
- });
-}
-
-function unregisterPlayPreview() {
- gPlayPreviewRegistration.unregister();
-}
-
-Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- if (gPlayPreviewRegistration)
- gPlayPreviewRegistration.unregister();
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- gTestBrowser.addEventListener("PluginBindingAttached", handleBindingAttached, true, true);
-
- registerPlayPreview('application/x-test', 'about:');
- prepareTest(test1a, gTestRoot + "plugin_test.html", 1);
-}
-
-function finishTest() {
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gTestBrowser.removeEventListener("PluginBindingAttached", handleBindingAttached, true, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function handleBindingAttached(evt) {
- if (evt.target instanceof Ci.nsIObjectLoadingContent &&
- evt.target.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW)
- gPlayPreviewPluginActualEvents++;
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
-
- // iframe might triggers load event as well, making sure we skip some to let
- // all iframes on the page be loaded as well
- if (gNextTestSkip) {
- gNextTestSkip--;
- return;
- }
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url, skip) {
- gNextTest = nextTest;
- gNextTestSkip = skip;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Tests a page with normal play preview registration (1/2)
-function test1a() {
- var notificationBox = gBrowser.getNotificationBox(gTestBrowser);
- ok(!notificationBox.getNotificationWithValue("missing-plugins"), "Test 1a, Should not have displayed the missing plugin notification");
- ok(!notificationBox.getNotificationWithValue("blocked-plugins"), "Test 1a, Should not have displayed the blocked plugin notification");
-
- var pluginInfo = getTestPlugin();
- ok(pluginInfo, "Should have a test plugin");
-
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 1a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
-
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
- ok(overlay, "Test 1a, the overlay div is expected");
-
- var iframe = overlay.getElementsByClassName("previewPluginContentFrame")[0];
- ok(iframe && iframe.localName == "iframe", "Test 1a, the overlay iframe is expected");
- var iframeHref = iframe.contentWindow.location.href;
- ok(iframeHref == "about:", "Test 1a, the overlay about: content is expected");
-
- var rect = iframe.getBoundingClientRect();
- ok(rect.width == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px width before being replaced by actual plugin");
- ok(rect.height == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px height before being replaced by actual plugin");
-
- var e = overlay.ownerDocument.createEvent("CustomEvent");
- e.initCustomEvent("MozPlayPlugin", true, true, null);
- overlay.dispatchEvent(e);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1b, "Test 1a, Waited too long for plugin to stop play preview");
-}
-
-// Tests that activating via MozPlayPlugin through the notification works (part 2/2)
-function test1b() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
-
- is(gPlayPreviewPluginActualEvents, gPlayPreviewPluginExpectedEvents,
- "There should be exactly one PluginPlayPreview event");
-
- unregisterPlayPreview();
-
- prepareTest(test2, gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it -- the mime type was just unregistered.
-function test2() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 2, Plugin should be activated");
-
- registerPlayPreview('application/x-unknown', 'about:');
-
- prepareTest(test3, gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it -- diffent play preview type is reserved.
-function test3() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 3, Plugin should be activated");
-
- unregisterPlayPreview();
-
- registerPlayPreview('application/x-test', 'about:');
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- prepareTest(test4a, gTestRoot + "plugin_test.html", 1);
-}
-
-// Test a fallback to the click-to-play
-function test4a() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
-
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
- ok(overlay, "Test 4a, the overlay div is expected");
-
- var e = overlay.ownerDocument.createEvent("CustomEvent");
- e.initCustomEvent("MozPlayPlugin", true, true, true);
- overlay.dispatchEvent(e);
- var condition = function() objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY;
- waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to stop play preview");
-}
-
-function test4b() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4b, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 4b, Plugin should not be activated");
-
- prepareTest(test5a, gTestRoot + "plugin_test.html", 1);
-}
-
-// Test a bypass of the click-to-play
-function test5a() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 5a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 5a, Plugin should not be activated");
-
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
- ok(overlay, "Test 5a, the overlay div is expected");
-
- var e = overlay.ownerDocument.createEvent("CustomEvent");
- e.initCustomEvent("MozPlayPlugin", true, true, false);
- overlay.dispatchEvent(e);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test5b, "Test 5a, Waited too long for plugin to stop play preview");
-}
-
-function test5b() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 5b, Plugin should be activated");
-
- finishTest();
-}
-
diff --git a/browser/base/content/test/browser_pluginplaypreview2.js b/browser/base/content/test/browser_pluginplaypreview2.js
deleted file mode 100644
index 972e62a8d..000000000
--- a/browser/base/content/test/browser_pluginplaypreview2.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gNextTestSkip = 0;
-var gPlayPreviewPluginActualEvents = 0;
-var gPlayPreviewPluginExpectedEvents = 1;
-
-var gPlayPreviewRegistration = null;
-
-function registerPlayPreview(mimeType, targetUrl) {
- var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
- ph.registerPlayPreviewMimeType(mimeType, false, targetUrl);
-
- return (gPlayPreviewRegistration = {
- unregister: function() {
- ph.unregisterPlayPreviewMimeType(mimeType);
- gPlayPreviewRegistration = null;
- }
- });
-}
-
-function unregisterPlayPreview() {
- gPlayPreviewRegistration.unregister();
-}
-
-Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- if (gPlayPreviewRegistration)
- gPlayPreviewRegistration.unregister();
- Services.prefs.clearUserPref("plugins.click_to_play");
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
-
- var newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- gTestBrowser.addEventListener("PluginBindingAttached", handleBindingAttached, true, true);
-
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- registerPlayPreview('application/x-test', 'about:');
- prepareTest(test1a, gTestRoot + "plugin_test.html", 1);
-}
-
-function finishTest() {
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gTestBrowser.removeEventListener("PluginBindingAttached", handleBindingAttached, true, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function handleBindingAttached(evt) {
- if (evt.target instanceof Ci.nsIObjectLoadingContent &&
- evt.target.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW)
- gPlayPreviewPluginActualEvents++;
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
-
- // iframe might triggers load event as well, making sure we skip some to let
- // all iframes on the page be loaded as well
- if (gNextTestSkip) {
- gNextTestSkip--;
- return;
- }
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url, skip) {
- gNextTest = nextTest;
- gNextTestSkip = skip;
- gTestBrowser.contentWindow.location = url;
-}
-
-// Tests a page with normal play preview registration (1/2)
-function test1a() {
- var notificationBox = gBrowser.getNotificationBox(gTestBrowser);
- ok(!notificationBox.getNotificationWithValue("missing-plugins"), "Test 1a, Should not have displayed the missing plugin notification");
- ok(!notificationBox.getNotificationWithValue("blocked-plugins"), "Test 1a, Should not have displayed the blocked plugin notification");
-
- var pluginInfo = getTestPlugin();
- ok(pluginInfo, "Should have a test plugin");
-
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 1a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
-
- var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
- ok(overlay, "Test 1a, the overlay div is expected");
-
- var iframe = overlay.getElementsByClassName("previewPluginContentFrame")[0];
- ok(iframe && iframe.localName == "iframe", "Test 1a, the overlay iframe is expected");
- var iframeHref = iframe.contentWindow.location.href;
- ok(iframeHref == "about:", "Test 1a, the overlay about: content is expected");
-
- var rect = iframe.getBoundingClientRect();
- ok(rect.width == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px width before being replaced by actual plugin");
- ok(rect.height == 200, "Test 1a, Plugin with id=" + plugin.id + " overlay rect should have 200px height before being replaced by actual plugin");
-
- var e = overlay.ownerDocument.createEvent("CustomEvent");
- e.initCustomEvent("MozPlayPlugin", true, true, null);
- overlay.dispatchEvent(e);
- var condition = function() objLoadingContent.activated;
- waitForCondition(condition, test1b, "Test 1a, Waited too long for plugin to stop play preview");
-}
-
-// Tests that activating via MozPlayPlugin through the notification works (part 2/2)
-function test1b() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
-
- is(gPlayPreviewPluginActualEvents, gPlayPreviewPluginExpectedEvents,
- "There should be exactly one PluginPlayPreview event");
-
- unregisterPlayPreview();
-
- prepareTest(test2, gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it -- the mime type was just unregistered.
-function test2() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 2, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 2, Plugin should not be activated");
-
- registerPlayPreview('application/x-unknown', 'about:');
-
- prepareTest(test3, gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it -- diffent play preview type is reserved.
-function test3() {
- var doc = gTestBrowser.contentDocument;
- var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 3, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
- ok(!objLoadingContent.activated, "Test 3, Plugin should not be activated");
-
- unregisterPlayPreview();
-
- registerPlayPreview('application/x-test', 'about:');
- Services.prefs.setBoolPref("plugins.click_to_play", false);
- var plugin = getTestPlugin();
- plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- prepareTest(test4, gTestRoot + "plugin_test.html");
-}
-
-// Tests a page with a working plugin in it -- click-to-play is off
-function test4() {
- var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
- ok(objLoadingContent.activated, "Test 4, Plugin should be activated");
-
- finishTest();
-}
-
diff --git a/browser/base/content/test/browser_plugins_added_dynamically.js b/browser/base/content/test/browser_plugins_added_dynamically.js
deleted file mode 100644
index 457a72dcc..000000000
--- a/browser/base/content/test/browser_plugins_added_dynamically.js
+++ /dev/null
@@ -1,179 +0,0 @@
-const gTestRoot = "http://mochi.test:8888/browser/browser/base/content/test/";
-
-let gTestBrowser = null;
-let gNextTest = null;
-let gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-// Let's do the XPCNativeWrapper dance!
-function addPlugin(browser, type) {
- let contentWindow = XPCNativeWrapper.unwrap(browser.contentWindow);
- contentWindow.addPlugin(type);
-}
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- clearAllPluginPermissions();
- Services.prefs.clearUserPref("plugins.click_to_play");
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
- });
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-
- let newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
- gTestBrowser = gBrowser.selectedBrowser;
- gTestBrowser.addEventListener("load", pageLoad, true);
- prepareTest(testActivateAddSameTypePart1, gTestRoot + "plugin_add_dynamically.html");
-}
-
-function finishTest() {
- gTestBrowser.removeEventListener("load", pageLoad, true);
- gBrowser.removeCurrentTab();
- window.focus();
- finish();
-}
-
-function pageLoad() {
- // The plugin events are async dispatched and can come after the load event
- // This just allows the events to fire before we then go on to test the states
- executeSoon(gNextTest);
-}
-
-function prepareTest(nextTest, url) {
- gNextTest = nextTest;
- gTestBrowser.contentWindow.location = url;
-}
-
-// "Activate" of a given type -> plugins of that type dynamically added should
-// automatically play.
-function testActivateAddSameTypePart1() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!popupNotification, "testActivateAddSameTypePart1: should not have a click-to-play notification");
- addPlugin(gTestBrowser);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, testActivateAddSameTypePart2, "testActivateAddSameTypePart1: waited too long for click-to-play-plugin notification");
-}
-
-function testActivateAddSameTypePart2() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "testActivateAddSameTypePart2: should have a click-to-play notification");
-
- popupNotification.reshow();
- testActivateAddSameTypePart3();
-}
-
-function testActivateAddSameTypePart3() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- let centerAction = null;
- for (let action of popupNotification.options.centerActions) {
- if (action.pluginName == "Test") {
- centerAction = action;
- break;
- }
- }
- ok(centerAction, "testActivateAddSameTypePart3: found center action for the Test plugin");
-
- let centerItem = null;
- for (let item of PopupNotifications.panel.firstChild.childNodes) {
- if (item.action && item.action == centerAction) {
- centerItem = item;
- break;
- }
- }
- ok(centerItem, "testActivateAddSameTypePart3: found center item for the Test plugin");
-
- let plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
- ok(!plugin.activated, "testActivateAddSameTypePart3: plugin should not be activated");
-
- // Change the state and click the ok button to activate the Test plugin
- centerItem.value = "allownow";
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let condition = function() plugin.activated;
- waitForCondition(condition, testActivateAddSameTypePart4, "testActivateAddSameTypePart3: waited too long for plugin to activate");
-}
-
-function testActivateAddSameTypePart4() {
- let plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
- ok(plugin.activated, "testActivateAddSameTypePart4: plugin should be activated");
-
- addPlugin(gTestBrowser);
- let condition = function() {
- let embeds = gTestBrowser.contentDocument.getElementsByTagName("embed");
- let allActivated = true;
- for (let embed of embeds) {
- if (!embed.activated)
- allActivated = false;
- }
- return allActivated && embeds.length == 2;
- };
- waitForCondition(condition, testActivateAddSameTypePart5, "testActivateAddSameTypePart4: waited too long for second plugin to activate"); }
-
-function testActivateAddSameTypePart5() {
- let embeds = gTestBrowser.contentDocument.getElementsByTagName("embed");
- for (let embed of embeds) {
- ok(embed.activated, "testActivateAddSameTypePart5: all plugins should be activated");
- }
- clearAllPluginPermissions();
- prepareTest(testActivateAddDifferentTypePart1, gTestRoot + "plugin_add_dynamically.html");
-}
-
-// "Activate" of a given type -> plugins of other types dynamically added
-// should not automatically play.
-function testActivateAddDifferentTypePart1() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(!popupNotification, "testActivateAddDifferentTypePart1: should not have a click-to-play notification");
- addPlugin(gTestBrowser);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, testActivateAddDifferentTypePart2, "testActivateAddDifferentTypePart1: waited too long for click-to-play-plugin notification");
-}
-
-function testActivateAddDifferentTypePart2() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- ok(popupNotification, "testActivateAddDifferentTypePart2: should have a click-to-play notification");
-
- // we have to actually show the panel to get the bindings to instantiate
- popupNotification.reshow();
- testActivateAddDifferentTypePart3();
-}
-
-function testActivateAddDifferentTypePart3() {
- let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- is(popupNotification.options.centerActions.length, 1, "Should be one plugin action");
-
- let plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
- ok(!plugin.activated, "testActivateAddDifferentTypePart3: plugin should not be activated");
-
- // "click" the button to activate the Test plugin
- PopupNotifications.panel.firstChild._primaryButton.click();
-
- let condition = function() plugin.activated;
- waitForCondition(condition, testActivateAddDifferentTypePart4, "testActivateAddDifferentTypePart3: waited too long for plugin to activate");
-}
-
-function testActivateAddDifferentTypePart4() {
- let plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
- ok(plugin.activated, "testActivateAddDifferentTypePart4: plugin should be activated");
-
- addPlugin(gTestBrowser);
- let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
- waitForCondition(condition, testActivateAddDifferentTypePart5, "testActivateAddDifferentTypePart5: waited too long for popup notification");
-}
-
-function testActivateAddDifferentTypePart5() {
- ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser), "testActivateAddDifferentTypePart5: should have popup notification");
- let embeds = gTestBrowser.contentDocument.getElementsByTagName("embed");
- for (let embed of embeds) {
- if (embed.type == "application/x-test")
- ok(embed.activated, "testActivateAddDifferentTypePart5: Test plugin should be activated");
- else if (embed.type == "application/x-second-test")
- ok(!embed.activated, "testActivateAddDifferentTypePart5: Second Test plugin should not be activated");
- }
-
- finishTest();
-}
diff --git a/browser/base/content/test/browser_popupNotification.js b/browser/base/content/test/browser_popupNotification.js
deleted file mode 100644
index 1146b5d7c..000000000
--- a/browser/base/content/test/browser_popupNotification.js
+++ /dev/null
@@ -1,991 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- ok(PopupNotifications, "PopupNotifications object exists");
- ok(PopupNotifications.panel, "PopupNotifications panel exists");
-
- registerCleanupFunction(cleanUp);
-
- runNextTest();
-}
-
-function cleanUp() {
- for (var topic in gActiveObservers)
- Services.obs.removeObserver(gActiveObservers[topic], topic);
- for (var eventName in gActiveListeners)
- PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
- PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
-}
-
-const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notification_enable_delay");
-
-var gActiveListeners = {};
-var gActiveObservers = {};
-var gShownState = {};
-
-function goNext() {
- if (++gTestIndex == tests.length)
- executeSoon(finish);
- else
- executeSoon(runNextTest);
-}
-
-function runNextTest() {
- let nextTest = tests[gTestIndex];
-
- function addObserver(topic) {
- function observer() {
- Services.obs.removeObserver(observer, "PopupNotifications-" + topic);
- delete gActiveObservers["PopupNotifications-" + topic];
-
- info("[Test #" + gTestIndex + "] observer for " + topic + " called");
- nextTest[topic]();
- goNext();
- }
- Services.obs.addObserver(observer, "PopupNotifications-" + topic, false);
- gActiveObservers["PopupNotifications-" + topic] = observer;
- }
-
- if (nextTest.backgroundShow) {
- addObserver("backgroundShow");
- } else if (nextTest.updateNotShowing) {
- addObserver("updateNotShowing");
- } else if (nextTest.onShown) {
- doOnPopupEvent("popupshowing", function () {
- info("[Test #" + gTestIndex + "] popup showing");
- });
- doOnPopupEvent("popupshown", function () {
- gShownState[gTestIndex] = true;
- info("[Test #" + gTestIndex + "] popup shown");
- nextTest.onShown(this);
- });
-
- // We allow multiple onHidden functions to be defined in an array. They're
- // called in the order they appear.
- let onHiddenArray = nextTest.onHidden instanceof Array ?
- nextTest.onHidden :
- [nextTest.onHidden];
- doOnPopupEvent("popuphidden", function () {
- if (!gShownState[gTestIndex]) {
- // This is expected to happen for test 9, so let's not treat it as a failure.
- info("Popup from test " + gTestIndex + " was hidden before its popupshown fired");
- }
-
- let onHidden = onHiddenArray.shift();
- info("[Test #" + gTestIndex + "] popup hidden (" + onHiddenArray.length + " hides remaining)");
- executeSoon(function () {
- onHidden.call(nextTest, this);
- if (!onHiddenArray.length)
- goNext();
- }.bind(this));
- }, onHiddenArray.length);
- info("[Test #" + gTestIndex + "] added listeners; panel state: " + PopupNotifications.isPanelOpen);
- }
-
- info("[Test #" + gTestIndex + "] running test");
- nextTest.run();
-}
-
-function doOnPopupEvent(eventName, callback, numExpected) {
- gActiveListeners[eventName] = function (event) {
- if (event.target != PopupNotifications.panel)
- return;
- if (typeof(numExpected) === "number")
- numExpected--;
- if (!numExpected) {
- PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
- delete gActiveListeners[eventName];
- }
-
- callback.call(PopupNotifications.panel);
- }
- PopupNotifications.panel.addEventListener(eventName, gActiveListeners[eventName], false);
-}
-
-var gTestIndex = 0;
-var gNewTab;
-
-function basicNotification() {
- var self = this;
- this.browser = gBrowser.selectedBrowser;
- this.id = "test-notification-" + gTestIndex;
- this.message = "This is popup notification " + this.id + " from test " + gTestIndex;
- this.anchorID = null;
- this.mainAction = {
- label: "Main Action",
- accessKey: "M",
- callback: function () {
- self.mainActionClicked = true;
- }
- };
- this.secondaryActions = [
- {
- label: "Secondary Action",
- accessKey: "S",
- callback: function () {
- self.secondaryActionClicked = true;
- }
- }
- ];
- this.options = {
- eventCallback: function (eventName) {
- switch (eventName) {
- case "dismissed":
- self.dismissalCallbackTriggered = true;
- break;
- case "showing":
- self.showingCallbackTriggered = true;
- break;
- case "shown":
- self.shownCallbackTriggered = true;
- break;
- case "removed":
- self.removedCallbackTriggered = true;
- break;
- }
- }
- };
- this.addOptions = function(options) {
- for (let [name, value] in Iterator(options))
- self.options[name] = value;
- }
-}
-
-var wrongBrowserNotificationObject = new basicNotification();
-var wrongBrowserNotification;
-
-var tests = [
- { // Test #0
- run: function () {
- this.notifyObj = new basicNotification();
- showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- triggerMainCommand(popup);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.mainActionClicked, "mainAction was clicked");
- ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- { // Test #1
- run: function () {
- this.notifyObj = new basicNotification();
- showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- triggerSecondaryCommand(popup, 0);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.secondaryActionClicked, "secondaryAction was clicked");
- ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- { // Test #2
- run: function () {
- this.notifyObj = new basicNotification();
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
- this.notification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // test opening a notification for a background browser
- { // Test #3
- run: function () {
- gNewTab = gBrowser.addTab("about:blank");
- isnot(gBrowser.selectedTab, gNewTab, "new tab isn't selected");
- wrongBrowserNotificationObject.browser = gBrowser.getBrowserForTab(gNewTab);
- wrongBrowserNotification = showNotification(wrongBrowserNotificationObject);
- },
- backgroundShow: function () {
- is(PopupNotifications.isPanelOpen, false, "panel isn't open");
- ok(!wrongBrowserNotificationObject.mainActionClicked, "main action wasn't clicked");
- ok(!wrongBrowserNotificationObject.secondaryActionClicked, "secondary action wasn't clicked");
- ok(!wrongBrowserNotificationObject.dismissalCallbackTriggered, "dismissal callback wasn't called");
- }
- },
- // now select that browser and test to see that the notification appeared
- { // Test #4
- run: function () {
- this.oldSelectedTab = gBrowser.selectedTab;
- gBrowser.selectedTab = gNewTab;
- },
- onShown: function (popup) {
- checkPopup(popup, wrongBrowserNotificationObject);
- is(PopupNotifications.isPanelOpen, true, "isPanelOpen getter doesn't lie");
-
- // switch back to the old browser
- gBrowser.selectedTab = this.oldSelectedTab;
- },
- onHidden: function (popup) {
- // actually remove the notification to prevent it from reappearing
- ok(wrongBrowserNotificationObject.dismissalCallbackTriggered, "dismissal callback triggered due to tab switch");
- wrongBrowserNotification.remove();
- ok(wrongBrowserNotificationObject.removedCallbackTriggered, "removed callback triggered");
- wrongBrowserNotification = null;
- }
- },
- // test that the removed notification isn't shown on browser re-select
- { // Test #5
- run: function () {
- gBrowser.selectedTab = gNewTab;
- },
- updateNotShowing: function () {
- is(PopupNotifications.isPanelOpen, false, "panel isn't open");
- gBrowser.removeTab(gNewTab);
- }
- },
- // Test that two notifications with the same ID result in a single displayed
- // notification.
- { // Test #6
- run: function () {
- this.notifyObj = new basicNotification();
- // Show the same notification twice
- this.notification1 = showNotification(this.notifyObj);
- this.notification2 = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- this.notification2.remove();
- },
- onHidden: function (popup) {
- ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test that two notifications with different IDs are displayed
- { // Test #7
- run: function () {
- this.testNotif1 = new basicNotification();
- this.testNotif1.message += " 1";
- showNotification(this.testNotif1);
- this.testNotif2 = new basicNotification();
- this.testNotif2.message += " 2";
- this.testNotif2.id += "-2";
- showNotification(this.testNotif2);
- },
- onShown: function (popup) {
- is(popup.childNodes.length, 2, "two notifications are shown");
- // Trigger the main command for the first notification, and the secondary
- // for the second. Need to do mainCommand first since the secondaryCommand
- // triggering is async.
- triggerMainCommand(popup);
- is(popup.childNodes.length, 1, "only one notification left");
- triggerSecondaryCommand(popup, 0);
- },
- onHidden: function (popup) {
- ok(this.testNotif1.mainActionClicked, "main action #1 was clicked");
- ok(!this.testNotif1.secondaryActionClicked, "secondary action #1 wasn't clicked");
- ok(!this.testNotif1.dismissalCallbackTriggered, "dismissal callback #1 wasn't called");
-
- ok(!this.testNotif2.mainActionClicked, "main action #2 wasn't clicked");
- ok(this.testNotif2.secondaryActionClicked, "secondary action #2 was clicked");
- ok(!this.testNotif2.dismissalCallbackTriggered, "dismissal callback #2 wasn't called");
- }
- },
- // Test notification without mainAction
- { // Test #8
- run: function () {
- this.notifyObj = new basicNotification();
- this.notifyObj.mainAction = null;
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- this.notification.remove();
- }
- },
- // Test two notifications with different anchors
- { // Test #9
- run: function () {
- this.notifyObj = new basicNotification();
- this.firstNotification = showNotification(this.notifyObj);
- this.notifyObj2 = new basicNotification();
- this.notifyObj2.id += "-2";
- this.notifyObj2.anchorID = "addons-notification-icon";
- // Second showNotification() overrides the first
- this.secondNotification = showNotification(this.notifyObj2);
- },
- onShown: function (popup) {
- // This also checks that only one element is shown.
- checkPopup(popup, this.notifyObj2);
- is(document.getElementById("geo-notification-icon").boxObject.width, 0,
- "geo anchor shouldn't be visible");
- dismissNotification(popup);
- },
- onHidden: [
- // The second showing triggers a popuphidden event that we should ignore.
- function (popup) {},
- function (popup) {
- // Remove the notifications
- this.firstNotification.remove();
- this.secondNotification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- ok(this.notifyObj2.removedCallbackTriggered, "removed callback triggered");
- }
- ]
- },
- // Test optional params
- { // Test #10
- run: function () {
- this.notifyObj = new basicNotification();
- this.notifyObj.secondaryActions = undefined;
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
- this.notification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test that icons appear
- { // Test #11
- run: function () {
- this.notifyObj = new basicNotification();
- this.notifyObj.id = "geolocation";
- this.notifyObj.anchorID = "geo-notification-icon";
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
- "geo anchor should be visible");
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- let icon = document.getElementById("geo-notification-icon");
- isnot(icon.boxObject.width, 0,
- "geo anchor should be visible after dismissal");
- this.notification.remove();
- is(icon.boxObject.width, 0,
- "geo anchor should not be visible after removal");
- }
- },
- // Test that persistence allows the notification to persist across reloads
- { // Test #12
- run: function () {
- this.oldSelectedTab = gBrowser.selectedTab;
- gBrowser.selectedTab = gBrowser.addTab("about:blank");
-
- let self = this;
- loadURI("http://example.com/", function() {
- self.notifyObj = new basicNotification();
- self.notifyObj.addOptions({
- persistence: 2
- });
- self.notification = showNotification(self.notifyObj);
- });
- },
- onShown: function (popup) {
- this.complete = false;
-
- let self = this;
- loadURI("http://example.org/", function() {
- loadURI("http://example.com/", function() {
-
- // Next load will remove the notification
- self.complete = true;
-
- loadURI("http://example.org/");
- });
- });
- },
- onHidden: function (popup) {
- ok(this.complete, "Should only have hidden the notification after 3 page loads");
- ok(this.notifyObj.removedCallbackTriggered, "removal callback triggered");
- gBrowser.removeTab(gBrowser.selectedTab);
- gBrowser.selectedTab = this.oldSelectedTab;
- }
- },
- // Test that a timeout allows the notification to persist across reloads
- { // Test #13
- run: function () {
- this.oldSelectedTab = gBrowser.selectedTab;
- gBrowser.selectedTab = gBrowser.addTab("about:blank");
-
- let self = this;
- loadURI("http://example.com/", function() {
- self.notifyObj = new basicNotification();
- // Set a timeout of 10 minutes that should never be hit
- self.notifyObj.addOptions({
- timeout: Date.now() + 600000
- });
- self.notification = showNotification(self.notifyObj);
- });
- },
- onShown: function (popup) {
- this.complete = false;
-
- let self = this;
- loadURI("http://example.org/", function() {
- loadURI("http://example.com/", function() {
-
- // Next load will hide the notification
- self.notification.options.timeout = Date.now() - 1;
- self.complete = true;
-
- loadURI("http://example.org/");
- });
- });
- },
- onHidden: function (popup) {
- ok(this.complete, "Should only have hidden the notification after the timeout was passed");
- this.notification.remove();
- gBrowser.removeTab(gBrowser.selectedTab);
- gBrowser.selectedTab = this.oldSelectedTab;
- }
- },
- // Test that setting persistWhileVisible allows a visible notification to
- // persist across location changes
- { // Test #14
- run: function () {
- this.oldSelectedTab = gBrowser.selectedTab;
- gBrowser.selectedTab = gBrowser.addTab("about:blank");
-
- let self = this;
- loadURI("http://example.com/", function() {
- self.notifyObj = new basicNotification();
- self.notifyObj.addOptions({
- persistWhileVisible: true
- });
- self.notification = showNotification(self.notifyObj);
- });
- },
- onShown: function (popup) {
- this.complete = false;
-
- let self = this;
- loadURI("http://example.org/", function() {
- loadURI("http://example.com/", function() {
-
- // Notification should persist across location changes
- self.complete = true;
- dismissNotification(popup);
- });
- });
- },
- onHidden: function (popup) {
- ok(this.complete, "Should only have hidden the notification after it was dismissed");
- this.notification.remove();
- gBrowser.removeTab(gBrowser.selectedTab);
- gBrowser.selectedTab = this.oldSelectedTab;
- }
- },
- // Test that nested icon nodes correctly activate popups
- { // Test #15
- run: function() {
- // Add a temporary box as the anchor with a button
- this.box = document.createElement("box");
- PopupNotifications.iconBox.appendChild(this.box);
-
- let button = document.createElement("button");
- button.setAttribute("label", "Please click me!");
- this.box.appendChild(button);
-
- // The notification should open up on the box
- this.notifyObj = new basicNotification();
- this.notifyObj.anchorID = this.box.id = "nested-box";
- this.notifyObj.addOptions({dismissed: true});
- this.notification = showNotification(this.notifyObj);
-
- EventUtils.synthesizeMouse(button, 1, 1, {});
- },
- onShown: function(popup) {
- checkPopup(popup, this.notifyObj);
- dismissNotification(popup);
- },
- onHidden: function(popup) {
- this.notification.remove();
- this.box.parentNode.removeChild(this.box);
- }
- },
- // Test that popupnotifications without popups have anchor icons shown
- { // Test #16
- run: function() {
- let notifyObj = new basicNotification();
- notifyObj.anchorID = "geo-notification-icon";
- notifyObj.addOptions({neverShow: true});
- showNotification(notifyObj);
- },
- updateNotShowing: function() {
- isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
- "geo anchor should be visible");
- }
- },
- // Test notification "Not Now" menu item
- { // Test #17
- run: function () {
- this.notifyObj = new basicNotification();
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- triggerSecondaryCommand(popup, 1);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
- this.notification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test notification close button
- { // Test #18
- run: function () {
- this.notifyObj = new basicNotification();
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- let notification = popup.childNodes[0];
- EventUtils.synthesizeMouseAtCenter(notification.closebutton, {});
- },
- onHidden: function (popup) {
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
- this.notification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test notification when chrome is hidden
- { // Test #19
- run: function () {
- window.locationbar.visible = false;
- this.notifyObj = new basicNotification();
- this.notification = showNotification(this.notifyObj);
- window.locationbar.visible = true;
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- is(popup.anchorNode.className, "tabbrowser-tab", "notification anchored to tab");
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
- this.notification.remove();
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test notification is removed when dismissed if removeOnDismissal is true
- { // Test #20
- run: function () {
- this.notifyObj = new basicNotification();
- this.notifyObj.addOptions({
- removeOnDismissal: true
- });
- this.notification = showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- dismissNotification(popup);
- },
- onHidden: function (popup) {
- ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered");
- ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
- }
- },
- // Test multiple notification icons are shown
- { // Test #21
- run: function () {
- this.notifyObj1 = new basicNotification();
- this.notifyObj1.id += "_1";
- this.notifyObj1.anchorID = "default-notification-icon";
- this.notification1 = showNotification(this.notifyObj1);
-
- this.notifyObj2 = new basicNotification();
- this.notifyObj2.id += "_2";
- this.notifyObj2.anchorID = "geo-notification-icon";
- this.notification2 = showNotification(this.notifyObj2);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj2);
-
- // check notifyObj1 anchor icon is showing
- isnot(document.getElementById("default-notification-icon").boxObject.width, 0,
- "default anchor should be visible");
- // check notifyObj2 anchor icon is showing
- isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
- "geo anchor should be visible");
-
- dismissNotification(popup);
- },
- onHidden: [
- function (popup) {
- },
- function (popup) {
- this.notification1.remove();
- ok(this.notifyObj1.removedCallbackTriggered, "removed callback triggered");
-
- this.notification2.remove();
- ok(this.notifyObj2.removedCallbackTriggered, "removed callback triggered");
- }
- ]
- },
- // Test that multiple notification icons are removed when switching tabs
- { // Test #22
- run: function () {
- // show the notification on old tab.
- this.notifyObjOld = new basicNotification();
- this.notifyObjOld.anchorID = "default-notification-icon";
- this.notificationOld = showNotification(this.notifyObjOld);
-
- // switch tab
- this.oldSelectedTab = gBrowser.selectedTab;
- gBrowser.selectedTab = gBrowser.addTab("about:blank");
-
- // show the notification on new tab.
- this.notifyObjNew = new basicNotification();
- this.notifyObjNew.anchorID = "geo-notification-icon";
- this.notificationNew = showNotification(this.notifyObjNew);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObjNew);
-
- // check notifyObjOld anchor icon is removed
- is(document.getElementById("default-notification-icon").boxObject.width, 0,
- "default anchor shouldn't be visible");
- // check notifyObjNew anchor icon is showing
- isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
- "geo anchor should be visible");
-
- dismissNotification(popup);
- },
- onHidden: [
- function (popup) {
- },
- function (popup) {
- this.notificationNew.remove();
- gBrowser.removeTab(gBrowser.selectedTab);
-
- gBrowser.selectedTab = this.oldSelectedTab;
- this.notificationOld.remove();
- }
- ]
- },
- { // Test #23 - test security delay - too early
- run: function () {
- // Set the security delay to 100s
- PopupNotifications.buttonDelay = 100000;
-
- this.notifyObj = new basicNotification();
- showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
- triggerMainCommand(popup);
-
- // Wait to see if the main command worked
- executeSoon(function delayedDismissal() {
- dismissNotification(popup);
- });
-
- },
- onHidden: function (popup) {
- ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked because it was too soon");
- ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered");
- }
- },
- { // Test #24 - test security delay - after delay
- run: function () {
- // Set the security delay to 10ms
- PopupNotifications.buttonDelay = 10;
-
- this.notifyObj = new basicNotification();
- showNotification(this.notifyObj);
- },
- onShown: function (popup) {
- checkPopup(popup, this.notifyObj);
-
- // Wait until after the delay to trigger the main action
- setTimeout(function delayedDismissal() {
- triggerMainCommand(popup);
- }, 500);
-
- },
- onHidden: function (popup) {
- ok(this.notifyObj.mainActionClicked, "mainAction was clicked after the delay");
- ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback was not triggered");
- PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
- }
- },
- { // Test #25 - reload removes notification
- run: function () {
- loadURI("http://example.com/", function() {
- let notifyObj = new basicNotification();
- notifyObj.options.eventCallback = function (eventName) {
- if (eventName == "removed") {
- ok(true, "Notification removed in background tab after reloading");
- executeSoon(function () {
- goNext();
- });
- }
- };
- showNotification(notifyObj);
- executeSoon(function () {
- gBrowser.selectedBrowser.reload();
- });
- });
- }
- },
- { // Test #26 - location change in background tab removes notification
- run: function () {
- let oldSelectedTab = gBrowser.selectedTab;
- let newTab = gBrowser.addTab("about:blank");
- gBrowser.selectedTab = newTab;
-
- loadURI("http://example.com/", function() {
- gBrowser.selectedTab = oldSelectedTab;
- let browser = gBrowser.getBrowserForTab(newTab);
-
- let notifyObj = new basicNotification();
- notifyObj.browser = browser;
- notifyObj.options.eventCallback = function (eventName) {
- if (eventName == "removed") {
- ok(true, "Notification removed in background tab after reloading");
- executeSoon(function () {
- gBrowser.removeTab(newTab);
- goNext();
- });
- }
- };
- showNotification(notifyObj);
- executeSoon(function () {
- browser.reload();
- });
- });
- }
- },
- { // Test #27 - Popup notification anchor shouldn't disappear when a notification with the same ID is re-added in a background tab
- run: function () {
- loadURI("http://example.com/", function () {
- let originalTab = gBrowser.selectedTab;
- let bgTab = gBrowser.addTab("about:blank");
- gBrowser.selectedTab = bgTab;
- loadURI("http://example.com/", function () {
- let anchor = document.createElement("box");
- anchor.id = "test26-anchor";
- anchor.className = "notification-anchor-icon";
- PopupNotifications.iconBox.appendChild(anchor);
-
- gBrowser.selectedTab = originalTab;
-
- let fgNotifyObj = new basicNotification();
- fgNotifyObj.anchorID = anchor.id;
- fgNotifyObj.options.dismissed = true;
- let fgNotification = showNotification(fgNotifyObj);
-
- let bgNotifyObj = new basicNotification();
- bgNotifyObj.anchorID = anchor.id;
- bgNotifyObj.browser = gBrowser.getBrowserForTab(bgTab);
- // show the notification in the background tab ...
- let bgNotification = showNotification(bgNotifyObj);
- // ... and re-show it
- bgNotification = showNotification(bgNotifyObj);
-
- ok(fgNotification.id, "notification has id");
- is(fgNotification.id, bgNotification.id, "notification ids are the same");
- is(anchor.getAttribute("showing"), "true", "anchor still showing");
-
- fgNotification.remove();
- gBrowser.removeTab(bgTab);
- goNext();
- });
- });
- }
- },
- { // Test #28 - location change in embedded frame removes notification
- run: function () {
- loadURI("data:text/html,<iframe id='iframe' src='http://example.com/'>", function () {
- let notifyObj = new basicNotification();
- notifyObj.options.eventCallback = function (eventName) {
- if (eventName == "removed") {
- ok(true, "Notification removed in background tab after reloading");
- executeSoon(goNext);
- }
- };
- showNotification(notifyObj);
- executeSoon(function () {
- content.document.getElementById("iframe")
- .setAttribute("src", "http://example.org/");
- });
- });
- }
- },
- { // Test #29 - Existing popup notification shouldn't disappear when adding a dismissed notification
- run: function () {
- this.notifyObj1 = new basicNotification();
- this.notifyObj1.id += "_1";
- this.notifyObj1.anchorID = "default-notification-icon";
- this.notification1 = showNotification(this.notifyObj1);
- },
- onShown: function (popup) {
- // Now show a dismissed notification, and check that it doesn't clobber
- // the showing one.
- this.notifyObj2 = new basicNotification();
- this.notifyObj2.id += "_2";
- this.notifyObj2.anchorID = "geo-notification-icon";
- this.notifyObj2.options.dismissed = true;
- this.notification2 = showNotification(this.notifyObj2);
-
- checkPopup(popup, this.notifyObj1);
-
- // check that both anchor icons are showing
- is(document.getElementById("default-notification-icon").getAttribute("showing"), "true",
- "notification1 anchor should be visible");
- is(document.getElementById("geo-notification-icon").getAttribute("showing"), "true",
- "notification2 anchor should be visible");
-
- dismissNotification(popup);
- },
- onHidden: function(popup) {
- this.notification1.remove();
- this.notification2.remove();
- }
- },
- { // Test #30 - Showing should be able to modify the popup data
- run: function() {
- this.notifyObj = new basicNotification();
- var normalCallback = this.notifyObj.options.eventCallback;
- this.notifyObj.options.eventCallback = function (eventName) {
- if (eventName == "showing") {
- this.mainAction.label = "Alternate Label";
- }
- normalCallback.call(this, eventName);
- };
- showNotification(this.notifyObj);
- },
- onShown: function(popup) {
- // checkPopup checks for the matching label. Note that this assumes that
- // this.notifyObj.mainAction is the same as notification.mainAction,
- // which could be a problem if we ever decided to deep-copy.
- checkPopup(popup, this.notifyObj);
- triggerMainCommand(popup);
- },
- onHidden: function() { }
- }
-];
-
-function showNotification(notifyObj) {
- return PopupNotifications.show(notifyObj.browser,
- notifyObj.id,
- notifyObj.message,
- notifyObj.anchorID,
- notifyObj.mainAction,
- notifyObj.secondaryActions,
- notifyObj.options);
-}
-
-function checkPopup(popup, notificationObj) {
- info("[Test #" + gTestIndex + "] checking popup");
-
- ok(notificationObj.showingCallbackTriggered, "showing callback was triggered");
- ok(notificationObj.shownCallbackTriggered, "shown callback was triggered");
-
- let notifications = popup.childNodes;
- is(notifications.length, 1, "one notification displayed");
- let notification = notifications[0];
- if (!notification)
- return;
- let icon = document.getAnonymousElementByAttribute(notification, "class", "popup-notification-icon");
- if (notificationObj.id == "geolocation") {
- isnot(icon.boxObject.width, 0, "icon for geo displayed");
- is(popup.anchorNode.className, "notification-anchor-icon", "notification anchored to icon");
- }
- is(notification.getAttribute("label"), notificationObj.message, "message matches");
- is(notification.id, notificationObj.id + "-notification", "id matches");
- if (notificationObj.mainAction) {
- is(notification.getAttribute("buttonlabel"), notificationObj.mainAction.label, "main action label matches");
- is(notification.getAttribute("buttonaccesskey"), notificationObj.mainAction.accessKey, "main action accesskey matches");
- }
- let actualSecondaryActions = Array.filter(notification.childNodes,
- function (child) child.nodeName == "menuitem");
- let secondaryActions = notificationObj.secondaryActions || [];
- let actualSecondaryActionsCount = actualSecondaryActions.length;
- if (secondaryActions.length) {
- is(notification.lastChild.tagName, "menuseparator", "menuseparator exists");
- }
- is(actualSecondaryActionsCount, secondaryActions.length, actualSecondaryActions.length + " secondary actions");
- secondaryActions.forEach(function (a, i) {
- is(actualSecondaryActions[i].getAttribute("label"), a.label, "label for secondary action " + i + " matches");
- is(actualSecondaryActions[i].getAttribute("accesskey"), a.accessKey, "accessKey for secondary action " + i + " matches");
- });
-}
-
-function triggerMainCommand(popup) {
- info("[Test #" + gTestIndex + "] triggering main command");
- let notifications = popup.childNodes;
- ok(notifications.length > 0, "at least one notification displayed");
- let notification = notifications[0];
-
- // 20, 10 so that the inner button is hit
- EventUtils.synthesizeMouse(notification.button, 20, 10, {});
-}
-
-function triggerSecondaryCommand(popup, index) {
- info("[Test #" + gTestIndex + "] triggering secondary command");
- let notifications = popup.childNodes;
- ok(notifications.length > 0, "at least one notification displayed");
- let notification = notifications[0];
-
- // Cancel the arrow panel slide-in transition (bug 767133) such that
- // it won't interfere with us interacting with the dropdown.
- document.getAnonymousNodes(popup)[0].style.transition = "none";
-
- notification.button.focus();
-
- popup.addEventListener("popupshown", function () {
- popup.removeEventListener("popupshown", arguments.callee, false);
-
- // Press down until the desired command is selected
- for (let i = 0; i <= index; i++)
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- // Activate
- EventUtils.synthesizeKey("VK_ENTER", {});
- }, false);
-
- // One down event to open the popup
- EventUtils.synthesizeKey("VK_DOWN", { altKey: !navigator.platform.contains("Mac") });
-}
-
-function loadURI(uri, callback) {
- if (callback) {
- gBrowser.addEventListener("load", function() {
- // Ignore the about:blank load
- if (gBrowser.currentURI.spec == "about:blank")
- return;
-
- gBrowser.removeEventListener("load", arguments.callee, true);
-
- callback();
- }, true);
- }
- gBrowser.loadURI(uri);
-}
-
-function dismissNotification(popup) {
- info("[Test #" + gTestIndex + "] dismissing notification");
- executeSoon(function () {
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- });
-}
diff --git a/browser/base/content/test/browser_popupUI.js b/browser/base/content/test/browser_popupUI.js
deleted file mode 100644
index fd722886d..000000000
--- a/browser/base/content/test/browser_popupUI.js
+++ /dev/null
@@ -1,57 +0,0 @@
-function test() {
- waitForExplicitFinish();
- gPrefService.setBoolPref("dom.disable_open_during_load", false);
-
- var browser = gBrowser.selectedBrowser;
- browser.addEventListener("load", function () {
- browser.removeEventListener("load", arguments.callee, true);
-
- if (gPrefService.prefHasUserValue("dom.disable_open_during_load"))
- gPrefService.clearUserPref("dom.disable_open_during_load");
-
- findPopup();
- }, true);
-
- content.location =
- "data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>";
-}
-
-function findPopup() {
- var enumerator = Services.wm.getEnumerator("navigator:browser");
-
- while (enumerator.hasMoreElements()) {
- let win = enumerator.getNext();
- if (win.content.wrappedJSObject == content.wrappedJSObject.popup) {
- testPopupUI(win);
- return;
- }
- }
-
- throw "couldn't find the popup";
-}
-
-function testPopupUI(win) {
- var doc = win.document;
-
- ok(win.gURLBar, "location bar exists in the popup");
- isnot(win.gURLBar.clientWidth, 0, "location bar is visible in the popup");
- ok(win.gURLBar.readOnly, "location bar is read-only in the popup");
- isnot(doc.getElementById("Browser:OpenLocation").getAttribute("disabled"), "true",
- "'open location' command is not disabled in the popup");
-
- let historyButton = doc.getAnonymousElementByAttribute(win.gURLBar, "anonid",
- "historydropmarker");
- is(historyButton.clientWidth, 0, "history dropdown button is hidden in the popup");
-
- EventUtils.synthesizeKey("t", { accelKey: true }, win);
- is(win.gBrowser.browsers.length, 1, "Accel+T doesn't open a new tab in the popup");
-
- EventUtils.synthesizeKey("w", { accelKey: true }, win);
- ok(win.closed, "Accel+W closes the popup");
-
- if (!win.closed)
- win.close();
- gBrowser.addTab();
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/base/content/test/browser_private_browsing_window.js b/browser/base/content/test/browser_private_browsing_window.js
deleted file mode 100644
index 607a34060..000000000
--- a/browser/base/content/test/browser_private_browsing_window.js
+++ /dev/null
@@ -1,65 +0,0 @@
-// Make sure that we can open private browsing windows
-
-function test() {
- waitForExplicitFinish();
- var nonPrivateWin = OpenBrowserWindow();
- ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "OpenBrowserWindow() should open a normal window");
- nonPrivateWin.close();
-
- var privateWin = OpenBrowserWindow({private: true});
- ok(PrivateBrowsingUtils.isWindowPrivate(privateWin), "OpenBrowserWindow({private: true}) should open a private window");
-
- nonPrivateWin = OpenBrowserWindow({private: false});
- ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "OpenBrowserWindow({private: false}) should open a normal window");
- nonPrivateWin.close();
-
- whenDelayedStartupFinished(privateWin, function() {
- nonPrivateWin = privateWin.OpenBrowserWindow({private: false});
- ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "privateWin.OpenBrowserWindow({private: false}) should open a normal window");
-
- nonPrivateWin.close();
-
- [
- { normal: "menu_newNavigator", private: "menu_newPrivateWindow", accesskey: true },
- { normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accesskey: false },
- ].forEach(function(menu) {
- let newWindow = privateWin.document.getElementById(menu.normal);
- let newPrivateWindow = privateWin.document.getElementById(menu.private);
- if (newWindow && newPrivateWindow) {
- ok(!newPrivateWindow.hidden, "New Private Window menu item should be hidden");
- isnot(newWindow.label, newPrivateWindow.label, "New Window's label shouldn't be overwritten");
- if (menu.accesskey) {
- isnot(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey shouldn't be overwritten");
- }
- isnot(newWindow.command, newPrivateWindow.command, "New Window's command shouldn't be overwritten");
- }
- });
-
- privateWin.close();
-
- Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
- privateWin = OpenBrowserWindow({private: true});
- whenDelayedStartupFinished(privateWin, function() {
- [
- { normal: "menu_newNavigator", private: "menu_newPrivateWindow", accessKey: true },
- { normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accessKey: false },
- ].forEach(function(menu) {
- let newWindow = privateWin.document.getElementById(menu.normal);
- let newPrivateWindow = privateWin.document.getElementById(menu.private);
- if (newWindow && newPrivateWindow) {
- ok(newPrivateWindow.hidden, "New Private Window menu item should be hidden");
- is(newWindow.label, newPrivateWindow.label, "New Window's label should be overwritten");
- if (menu.accesskey) {
- is(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey should be overwritten");
- }
- is(newWindow.command, newPrivateWindow.command, "New Window's command should be overwritten");
- }
- });
-
- privateWin.close();
- Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
- finish();
- });
- });
-}
-
diff --git a/browser/base/content/test/browser_private_no_prompt.js b/browser/base/content/test/browser_private_no_prompt.js
deleted file mode 100644
index 17ab1b437..000000000
--- a/browser/base/content/test/browser_private_no_prompt.js
+++ /dev/null
@@ -1,13 +0,0 @@
-function test() {
- waitForExplicitFinish();
- var privateWin = OpenBrowserWindow({private: true});
- privateWin.addEventListener("load", function onload() {
- privateWin.removeEventListener("load", onload, false);
- ok(true, "Load listener called");
-
- privateWin.BrowserOpenTab();
- privateWin.BrowserTryToCloseWindow();
- ok(true, "didn't prompt");
- finish();
- }, false);
-} \ No newline at end of file
diff --git a/browser/base/content/test/browser_relatedTabs.js b/browser/base/content/test/browser_relatedTabs.js
deleted file mode 100644
index f59e0bbbb..000000000
--- a/browser/base/content/test/browser_relatedTabs.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- is(gBrowser.tabs.length, 1, "one tab is open initially");
-
- // Add several new tabs in sequence, interrupted by selecting a
- // different tab, moving a tab around and closing a tab,
- // returning a list of opened tabs for verifying the expected order.
- // The new tab behaviour is documented in bug 465673
- let tabs = [];
- function addTab(aURL, aReferrer) {
- tabs.push(gBrowser.addTab(aURL, {referrerURI: aReferrer}));
- }
-
- addTab("http://mochi.test:8888/#0");
- gBrowser.selectedTab = tabs[0];
- addTab("http://mochi.test:8888/#1");
- addTab("http://mochi.test:8888/#2", gBrowser.currentURI);
- addTab("http://mochi.test:8888/#3", gBrowser.currentURI);
- gBrowser.selectedTab = tabs[tabs.length - 1];
- gBrowser.selectedTab = tabs[0];
- addTab("http://mochi.test:8888/#4", gBrowser.currentURI);
- gBrowser.selectedTab = tabs[3];
- addTab("http://mochi.test:8888/#5", gBrowser.currentURI);
- gBrowser.removeTab(tabs.pop());
- addTab("about:blank", gBrowser.currentURI);
- gBrowser.moveTabTo(gBrowser.selectedTab, 1);
- addTab("http://mochi.test:8888/#6", gBrowser.currentURI);
- addTab();
- addTab("http://mochi.test:8888/#7");
-
- function testPosition(tabNum, expectedPosition, msg) {
- is(Array.indexOf(gBrowser.tabs, tabs[tabNum]), expectedPosition, msg);
- }
-
- testPosition(0, 3, "tab without referrer was opened to the far right");
- testPosition(1, 7, "tab without referrer was opened to the far right");
- testPosition(2, 5, "tab with referrer opened immediately to the right");
- testPosition(3, 1, "next tab with referrer opened further to the right");
- testPosition(4, 4, "tab selection changed, tab opens immediately to the right");
- testPosition(5, 6, "blank tab with referrer opens to the right of 3rd original tab where removed tab was");
- testPosition(6, 2, "tab has moved, new tab opens immediately to the right");
- testPosition(7, 8, "blank tab without referrer opens at the end");
- testPosition(8, 9, "tab without referrer opens at the end");
-
- tabs.forEach(gBrowser.removeTab, gBrowser);
-}
diff --git a/browser/base/content/test/browser_removeTabsToTheEnd.js b/browser/base/content/test/browser_removeTabsToTheEnd.js
deleted file mode 100644
index 856f25aac..000000000
--- a/browser/base/content/test/browser_removeTabsToTheEnd.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // Add two new tabs after the original tab. Pin the first one.
- let originalTab = gBrowser.selectedTab;
- let newTab1 = gBrowser.addTab();
- let newTab2 = gBrowser.addTab();
- gBrowser.pinTab(newTab1);
-
- // Check that there is only one closable tab from originalTab to the end
- is(gBrowser.getTabsToTheEndFrom(originalTab).length, 1,
- "One unpinned tab to the right");
-
- // Remove tabs to the end
- gBrowser.removeTabsToTheEndFrom(originalTab);
- is(gBrowser.tabs.length, 2, "Length is 2");
- is(gBrowser.tabs[1], originalTab, "Starting tab is not removed");
- is(gBrowser.tabs[0], newTab1, "Pinned tab is not removed");
-
- // Remove pinned tab
- gBrowser.removeTab(newTab1);
-}
diff --git a/browser/base/content/test/browser_sanitize-download-history.js b/browser/base/content/test/browser_sanitize-download-history.js
deleted file mode 100644
index 186b02167..000000000
--- a/browser/base/content/test/browser_sanitize-download-history.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-
-function test()
-{
- //////////////////////////////////////////////////////////////////////////////
- //// Tests (defined locally for scope's sake)
-
- function test_checkedAndDisabledAtStart(aWin)
- {
- let doc = aWin.document;
- let downloads = doc.getElementById("downloads-checkbox");
- let history = doc.getElementById("history-checkbox");
-
- ok(history.checked, "history checkbox is checked");
- ok(downloads.disabled, "downloads checkbox is disabled");
- ok(downloads.checked, "downloads checkbox is checked");
- }
-
- function test_checkedAndDisabledOnHistoryToggle(aWin)
- {
- let doc = aWin.document;
- let downloads = doc.getElementById("downloads-checkbox");
- let history = doc.getElementById("history-checkbox");
-
- EventUtils.synthesizeMouse(history, 0, 0, {}, aWin);
- ok(!history.checked, "history checkbox is not checked");
- ok(downloads.disabled, "downloads checkbox is disabled");
- ok(downloads.checked, "downloads checkbox is checked");
- }
-
- function test_checkedAfterAddingDownload(aWin)
- {
- let doc = aWin.document;
- let downloads = doc.getElementById("downloads-checkbox");
- let history = doc.getElementById("history-checkbox");
-
- // Add download to DB
- let file = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
- file.append("sanitize-dm-test.file");
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
- let testPath = Services.io.newFileURI(file).spec;
- let data = {
- name: "381603.patch",
- source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
- target: testPath,
- startTime: 1180493839859230,
- endTime: 1180493839859239,
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "a1bcD23eF4g5"
- };
- let db = Cc["@mozilla.org/download-manager;1"].
- getService(Ci.nsIDownloadManager).DBConnection;
- let stmt = db.createStatement(
- "INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
- "state, currBytes, maxBytes, preferredAction, autoResume, guid) " +
- "VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
- ":currBytes, :maxBytes, :preferredAction, :autoResume, :guid)");
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.finalize();
- }
-
- // Toggle history to get everything to update
- EventUtils.synthesizeMouse(history, 0, 0, {}, aWin);
- EventUtils.synthesizeMouse(history, 0, 0, {}, aWin);
-
- ok(!history.checked, "history checkbox is not checked");
- ok(!downloads.disabled, "downloads checkbox is not disabled");
- ok(downloads.checked, "downloads checkbox is checked");
- }
-
- function test_checkedAndDisabledWithHistoryChecked(aWin)
- {
- let doc = aWin.document;
- let downloads = doc.getElementById("downloads-checkbox");
- let history = doc.getElementById("history-checkbox");
-
- EventUtils.synthesizeMouse(history, 0, 0, {}, aWin);
- ok(history.checked, "history checkbox is checked");
- ok(downloads.disabled, "downloads checkbox is disabled");
- ok(downloads.checked, "downloads checkbox is checked");
- }
-
- let tests = [
- test_checkedAndDisabledAtStart,
- test_checkedAndDisabledOnHistoryToggle,
- test_checkedAfterAddingDownload,
- test_checkedAndDisabledWithHistoryChecked,
- ];
-
- //////////////////////////////////////////////////////////////////////////////
- //// Run the tests
-
- let dm = Cc["@mozilla.org/download-manager;1"].
- getService(Ci.nsIDownloadManager);
- let db = dm.DBConnection;
-
- // Empty any old downloads
- db.executeSimpleSQL("DELETE FROM moz_downloads");
-
- // Close the UI if necessary
- let win = Services.ww.getWindowByName("Sanitize", null);
- if (win && (win instanceof Ci.nsIDOMWindow))
- win.close();
-
- // Start the test when the sanitize window loads
- Services.ww.registerNotification(function (aSubject, aTopic, aData) {
- Services.ww.unregisterNotification(arguments.callee);
- aSubject.QueryInterface(Ci.nsIDOMEventTarget)
- .addEventListener("DOMContentLoaded", doTest, false);
- });
-
- // Let the methods that run onload finish before we test
- let doTest = function() setTimeout(function() {
- let win = Services.ww.getWindowByName("Sanitize", null)
- .QueryInterface(Ci.nsIDOMWindow);
-
- for (let i = 0; i < tests.length; i++)
- tests[i](win);
-
- win.close();
- finish();
- }, 0);
-
- // Show the UI
- Services.ww.openWindow(window,
- "chrome://browser/content/sanitize.xul",
- "Sanitize",
- "chrome,titlebar,centerscreen",
- null);
-
- waitForExplicitFinish();
-}
diff --git a/browser/base/content/test/browser_sanitize-passwordDisabledHosts.js b/browser/base/content/test/browser_sanitize-passwordDisabledHosts.js
deleted file mode 100644
index 06cf2467e..000000000
--- a/browser/base/content/test/browser_sanitize-passwordDisabledHosts.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// Bug 474792 - Clear "Never remember passwords for this site" when
-// clearing site-specific settings in Clear Recent History dialog
-
-let tempScope = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
-let Sanitizer = tempScope.Sanitizer;
-
-function test() {
-
- var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
-
- // Add a disabled host
- pwmgr.setLoginSavingEnabled("http://example.com", false);
-
- // Sanity check
- is(pwmgr.getLoginSavingEnabled("http://example.com"), false,
- "example.com should be disabled for password saving since we haven't cleared that yet.");
-
- // Set up the sanitizer to just clear siteSettings
- let s = new Sanitizer();
- s.ignoreTimespan = false;
- s.prefDomain = "privacy.cpd.";
- var itemPrefs = gPrefService.getBranch(s.prefDomain);
- itemPrefs.setBoolPref("history", false);
- itemPrefs.setBoolPref("downloads", false);
- itemPrefs.setBoolPref("cache", false);
- itemPrefs.setBoolPref("cookies", false);
- itemPrefs.setBoolPref("formdata", false);
- itemPrefs.setBoolPref("offlineApps", false);
- itemPrefs.setBoolPref("passwords", false);
- itemPrefs.setBoolPref("sessions", false);
- itemPrefs.setBoolPref("siteSettings", true);
-
- // Clear it
- s.sanitize();
-
- // Make sure it's gone
- is(pwmgr.getLoginSavingEnabled("http://example.com"), true,
- "example.com should be enabled for password saving again now that we've cleared.");
-}
diff --git a/browser/base/content/test/browser_sanitize-sitepermissions.js b/browser/base/content/test/browser_sanitize-sitepermissions.js
deleted file mode 100644
index 13c0e2068..000000000
--- a/browser/base/content/test/browser_sanitize-sitepermissions.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// Bug 380852 - Delete permission manager entries in Clear Recent History
-
-let tempScope = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
-let Sanitizer = tempScope.Sanitizer;
-
-function test() {
-
- // Add a permission entry
- var pm = Services.perms;
- pm.add(makeURI("http://example.com"), "testing", pm.ALLOW_ACTION);
-
- // Sanity check
- ok(pm.enumerator.hasMoreElements(), "Permission manager should have elements, since we just added one");
-
- // Set up the sanitizer to just clear siteSettings
- let s = new Sanitizer();
- s.ignoreTimespan = false;
- s.prefDomain = "privacy.cpd.";
- var itemPrefs = gPrefService.getBranch(s.prefDomain);
- itemPrefs.setBoolPref("history", false);
- itemPrefs.setBoolPref("downloads", false);
- itemPrefs.setBoolPref("cache", false);
- itemPrefs.setBoolPref("cookies", false);
- itemPrefs.setBoolPref("formdata", false);
- itemPrefs.setBoolPref("offlineApps", false);
- itemPrefs.setBoolPref("passwords", false);
- itemPrefs.setBoolPref("sessions", false);
- itemPrefs.setBoolPref("siteSettings", true);
-
- // Clear it
- s.sanitize();
-
- // Make sure it's gone
- ok(!pm.enumerator.hasMoreElements(), "Permission manager shouldn't have entries after Sanitizing");
-}
diff --git a/browser/base/content/test/browser_sanitize-timespans.js b/browser/base/content/test/browser_sanitize-timespans.js
deleted file mode 100644
index 6c6fb059b..000000000
--- a/browser/base/content/test/browser_sanitize-timespans.js
+++ /dev/null
@@ -1,810 +0,0 @@
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-// Bug 453440 - Test the timespan-based logic of the sanitizer code
-var now_uSec = Date.now() * 1000;
-
-const dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
-
-const kUsecPerMin = 60 * 1000000;
-
-let tempScope = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
-let Sanitizer = tempScope.Sanitizer;
-
-let FormHistory = (Components.utils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory;
-
-function promiseFormHistoryRemoved() {
- let deferred = Promise.defer();
- Services.obs.addObserver(function onfh() {
- Services.obs.removeObserver(onfh, "satchel-storage-changed", false);
- deferred.resolve();
- }, "satchel-storage-changed", false);
- return deferred.promise;
-}
-
-function test() {
- waitForExplicitFinish();
-
- Task.spawn(function() {
- setupDownloads();
- yield setupFormHistory();
- yield setupHistory();
- yield onHistoryReady();
- }).then(finish);
-}
-
-function countEntries(name, message, check) {
- let deferred = Promise.defer();
-
- var obj = {};
- if (name !== null)
- obj.fieldname = name;
-
- let count;
- FormHistory.count(obj, { handleResult: function (result) count = result,
- handleError: function (error) {
- do_throw("Error occurred searching form history: " + error);
- deferred.reject(error)
- },
- handleCompletion: function (reason) {
- if (!reason) {
- check(count, message);
- deferred.resolve();
- }
- },
- });
-
- return deferred.promise;
-}
-
-function onHistoryReady() {
- var hoursSinceMidnight = new Date().getHours();
- var minutesSinceMidnight = hoursSinceMidnight * 60 + new Date().getMinutes();
-
- // Should test cookies here, but nsICookieManager/nsICookieService
- // doesn't let us fake creation times. bug 463127
-
- let s = new Sanitizer();
- s.ignoreTimespan = false;
- s.prefDomain = "privacy.cpd.";
- var itemPrefs = gPrefService.getBranch(s.prefDomain);
- itemPrefs.setBoolPref("history", true);
- itemPrefs.setBoolPref("downloads", true);
- itemPrefs.setBoolPref("cache", false);
- itemPrefs.setBoolPref("cookies", false);
- itemPrefs.setBoolPref("formdata", true);
- itemPrefs.setBoolPref("offlineApps", false);
- itemPrefs.setBoolPref("passwords", false);
- itemPrefs.setBoolPref("sessions", false);
- itemPrefs.setBoolPref("siteSettings", false);
-
- // Clear 10 minutes ago
- s.range = [now_uSec - 10*60*1000000, now_uSec];
- s.sanitize();
- s.range = null;
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://10minutes.com"))),
- "Pretend visit to 10minutes.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://1hour.com"))),
- "Pretend visit to 1hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
- "Pretend visit to 1hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://2hour.com"))),
- "Pretend visit to 2hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
- "Pretend visit to 2hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (minutesSinceMidnight > 10) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- let checkZero = function(num, message) { is(num, 0, message); }
- let checkOne = function(num, message) { is(num, 1, message); }
-
- yield countEntries("10minutes", "10minutes form entry should be deleted", checkZero);
- yield countEntries("1hour", "1hour form entry should still exist", checkOne);
- yield countEntries("1hour10minutes", "1hour10minutes form entry should still exist", checkOne);
- yield countEntries("2hour", "2hour form entry should still exist", checkOne);
- yield countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
- yield countEntries("4hour", "4hour form entry should still exist", checkOne);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (minutesSinceMidnight > 10)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555555), "10 minute download should now be deleted");
- ok(downloadExists(5555551), "<1 hour download should still be present");
- ok(downloadExists(5555556), "1 hour 10 minute download should still be present");
- ok(downloadExists(5555550), "Year old download should still be present");
- ok(downloadExists(5555552), "<2 hour old download should still be present");
- ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
- ok(downloadExists(5555553), "<4 hour old download should still be present");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
-
- if (minutesSinceMidnight > 10)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 1 hour
- Sanitizer.prefs.setIntPref("timeSpan", 1);
- s.sanitize();
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://1hour.com"))),
- "Pretend visit to 1hour.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
- "Pretend visit to 1hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://2hour.com"))),
- "Pretend visit to 2hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
- "Pretend visit to 2hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (hoursSinceMidnight > 1) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("1hour", "1hour form entry should be deleted", checkZero);
- yield countEntries("1hour10minutes", "1hour10minutes form entry should still exist", checkOne);
- yield countEntries("2hour", "2hour form entry should still exist", checkOne);
- yield countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
- yield countEntries("4hour", "4hour form entry should still exist", checkOne);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (hoursSinceMidnight > 1)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555551), "<1 hour download should now be deleted");
- ok(downloadExists(5555556), "1 hour 10 minute download should still be present");
- ok(downloadExists(5555550), "Year old download should still be present");
- ok(downloadExists(5555552), "<2 hour old download should still be present");
- ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
- ok(downloadExists(5555553), "<4 hour old download should still be present");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
-
- if (hoursSinceMidnight > 1)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 1 hour 10 minutes
- s.range = [now_uSec - 70*60*1000000, now_uSec];
- s.sanitize();
- s.range = null;
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
- "Pretend visit to 1hour10minutes.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://2hour.com"))),
- "Pretend visit to 2hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
- "Pretend visit to 2hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (minutesSinceMidnight > 70) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("1hour10minutes", "1hour10minutes form entry should be deleted", checkZero);
- yield countEntries("2hour", "2hour form entry should still exist", checkOne);
- yield countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
- yield countEntries("4hour", "4hour form entry should still exist", checkOne);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (minutesSinceMidnight > 70)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555556), "1 hour 10 minute old download should now be deleted");
- ok(downloadExists(5555550), "Year old download should still be present");
- ok(downloadExists(5555552), "<2 hour old download should still be present");
- ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
- ok(downloadExists(5555553), "<4 hour old download should still be present");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
- if (minutesSinceMidnight > 70)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 2 hours
- Sanitizer.prefs.setIntPref("timeSpan", 2);
- s.sanitize();
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://2hour.com"))),
- "Pretend visit to 2hour.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
- "Pretend visit to 2hour10minutes.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (hoursSinceMidnight > 2) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("2hour", "2hour form entry should be deleted", checkZero);
- yield countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
- yield countEntries("4hour", "4hour form entry should still exist", checkOne);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (hoursSinceMidnight > 2)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555552), "<2 hour old download should now be deleted");
- ok(downloadExists(5555550), "Year old download should still be present");
- ok(downloadExists(5555557), "2 hour 10 minute download should still be present");
- ok(downloadExists(5555553), "<4 hour old download should still be present");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
- if (hoursSinceMidnight > 2)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 2 hours 10 minutes
- s.range = [now_uSec - 130*60*1000000, now_uSec];
- s.sanitize();
- s.range = null;
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
- "Pretend visit to 2hour10minutes.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should should still exist");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (minutesSinceMidnight > 130) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("2hour10minutes", "2hour10minutes form entry should be deleted", checkZero);
- yield countEntries("4hour", "4hour form entry should still exist", checkOne);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (minutesSinceMidnight > 130)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555557), "2 hour 10 minute old download should now be deleted");
- ok(downloadExists(5555553), "<4 hour old download should still be present");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
- ok(downloadExists(5555550), "Year old download should still be present");
- if (minutesSinceMidnight > 130)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 4 hours
- Sanitizer.prefs.setIntPref("timeSpan", 3);
- s.sanitize();
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://4hour.com"))),
- "Pretend visit to 4hour.com should now be deleted");
- ok((yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should should still exist");
- if (hoursSinceMidnight > 4) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("4hour", "4hour form entry should be deleted", checkZero);
- yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
- if (hoursSinceMidnight > 4)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555553), "<4 hour old download should now be deleted");
- ok(downloadExists(5555558), "4 hour 10 minute download should still be present");
- ok(downloadExists(5555550), "Year old download should still be present");
- if (hoursSinceMidnight > 4)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear 4 hours 10 minutes
- s.range = [now_uSec - 250*60*1000000, now_uSec];
- s.sanitize();
- s.range = null;
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
- "Pretend visit to 4hour10minutes.com should now be deleted");
- if (minutesSinceMidnight > 250) {
- ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should still exist");
- }
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
-
- yield countEntries("4hour10minutes", "4hour10minutes form entry should be deleted", checkZero);
- if (minutesSinceMidnight > 250)
- yield countEntries("today", "today form entry should still exist", checkOne);
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
-
- ok(!downloadExists(5555558), "4 hour 10 minute download should now be deleted");
- ok(downloadExists(5555550), "Year old download should still be present");
- if (minutesSinceMidnight > 250)
- ok(downloadExists(5555554), "'Today' download should still be present");
-
- // Clear Today
- Sanitizer.prefs.setIntPref("timeSpan", 4);
- s.sanitize();
-
- yield promiseFormHistoryRemoved();
-
- // Be careful. If we add our objectss just before midnight, and sanitize
- // runs immediately after, they won't be expired. This is expected, but
- // we should not test in that case. We cannot just test for opposite
- // condition because we could cross midnight just one moment after we
- // cache our time, then we would have an even worse random failure.
- var today = isToday(new Date(now_uSec/1000));
- if (today) {
- ok(!(yield promiseIsURIVisited(makeURI("http://today.com"))),
- "Pretend visit to today.com should now be deleted");
-
- yield countEntries("today", "today form entry should be deleted", checkZero);
- ok(!downloadExists(5555554), "'Today' download should now be deleted");
- }
-
- ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should still exist");
- yield countEntries("b4today", "b4today form entry should still exist", checkOne);
- ok(downloadExists(5555550), "Year old download should still be present");
-
- // Choose everything
- Sanitizer.prefs.setIntPref("timeSpan", 0);
- s.sanitize();
-
- yield promiseFormHistoryRemoved();
-
- ok(!(yield promiseIsURIVisited(makeURI("http://before-today.com"))),
- "Pretend visit to before-today.com should now be deleted");
-
- yield countEntries("b4today", "b4today form entry should be deleted", checkZero);
-
- ok(!downloadExists(5555550), "Year old download should now be deleted");
-}
-
-function setupHistory() {
- let deferred = Promise.defer();
-
- let places = [];
-
- function addPlace(aURI, aTitle, aVisitDate) {
- places.push({
- uri: aURI,
- title: aTitle,
- visits: [{
- visitDate: aVisitDate,
- transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
- }]
- });
- }
-
- addPlace(makeURI("http://10minutes.com/"), "10 minutes ago", now_uSec - 10 * kUsecPerMin);
- addPlace(makeURI("http://1hour.com/"), "Less than 1 hour ago", now_uSec - 45 * kUsecPerMin);
- addPlace(makeURI("http://1hour10minutes.com/"), "1 hour 10 minutes ago", now_uSec - 70 * kUsecPerMin);
- addPlace(makeURI("http://2hour.com/"), "Less than 2 hours ago", now_uSec - 90 * kUsecPerMin);
- addPlace(makeURI("http://2hour10minutes.com/"), "2 hours 10 minutes ago", now_uSec - 130 * kUsecPerMin);
- addPlace(makeURI("http://4hour.com/"), "Less than 4 hours ago", now_uSec - 180 * kUsecPerMin);
- addPlace(makeURI("http://4hour10minutes.com/"), "4 hours 10 minutesago", now_uSec - 250 * kUsecPerMin);
-
- let today = new Date();
- today.setHours(0);
- today.setMinutes(0);
- today.setSeconds(1);
- addPlace(makeURI("http://today.com/"), "Today", today.getTime() * 1000);
-
- let lastYear = new Date();
- lastYear.setFullYear(lastYear.getFullYear() - 1);
- addPlace(makeURI("http://before-today.com/"), "Before Today", lastYear.getTime() * 1000);
-
- PlacesUtils.asyncHistory.updatePlaces(places, {
- handleError: function () ok(false, "Unexpected error in adding visit."),
- handleResult: function () { },
- handleCompletion: function () deferred.resolve()
- });
-
- return deferred.promise;
-}
-
-function setupFormHistory() {
-
- function searchEntries(terms, params) {
- let deferred = Promise.defer();
-
- let results = [];
- FormHistory.search(terms, params, { handleResult: function (result) results.push(result),
- handleError: function (error) {
- do_throw("Error occurred searching form history: " + error);
- deferred.reject(error);
- },
- handleCompletion: function (reason) { deferred.resolve(results); }
- });
- return deferred.promise;
- }
-
- function update(changes)
- {
- let deferred = Promise.defer();
- FormHistory.update(changes, { handleError: function (error) {
- do_throw("Error occurred searching form history: " + error);
- deferred.reject(error);
- },
- handleCompletion: function (reason) { deferred.resolve(); }
- });
- return deferred.promise;
- }
-
- // Make sure we've got a clean DB to start with, then add the entries we'll be testing.
- yield update(
- [{
- op: "remove"
- },
- {
- op : "add",
- fieldname : "10minutes",
- value : "10m"
- }, {
- op : "add",
- fieldname : "1hour",
- value : "1h"
- }, {
- op : "add",
- fieldname : "1hour10minutes",
- value : "1h10m"
- }, {
- op : "add",
- fieldname : "2hour",
- value : "2h"
- }, {
- op : "add",
- fieldname : "2hour10minutes",
- value : "2h10m"
- }, {
- op : "add",
- fieldname : "4hour",
- value : "4h"
- }, {
- op : "add",
- fieldname : "4hour10minutes",
- value : "4h10m"
- }, {
- op : "add",
- fieldname : "today",
- value : "1d"
- }, {
- op : "add",
- fieldname : "b4today",
- value : "1y"
- }]);
-
- // Artifically age the entries to the proper vintage.
- let timestamp = now_uSec - 10 * kUsecPerMin;
- let results = yield searchEntries(["guid"], { fieldname: "10minutes" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 45 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "1hour" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 70 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "1hour10minutes" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 90 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "2hour" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 130 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "2hour10minutes" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 180 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "4hour" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- timestamp = now_uSec - 250 * kUsecPerMin;
- results = yield searchEntries(["guid"], { fieldname: "4hour10minutes" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- let today = new Date();
- today.setHours(0);
- today.setMinutes(0);
- today.setSeconds(1);
- timestamp = today.getTime() * 1000;
- results = yield searchEntries(["guid"], { fieldname: "today" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- let lastYear = new Date();
- lastYear.setFullYear(lastYear.getFullYear() - 1);
- timestamp = lastYear.getTime() * 1000;
- results = yield searchEntries(["guid"], { fieldname: "b4today" });
- yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
-
- var checks = 0;
- let checkOne = function(num, message) { is(num, 1, message); checks++; }
-
- // Sanity check.
- yield countEntries("10minutes", "Checking for 10minutes form history entry creation", checkOne);
- yield countEntries("1hour", "Checking for 1hour form history entry creation", checkOne);
- yield countEntries("1hour10minutes", "Checking for 1hour10minutes form history entry creation", checkOne);
- yield countEntries("2hour", "Checking for 2hour form history entry creation", checkOne);
- yield countEntries("2hour10minutes", "Checking for 2hour10minutes form history entry creation", checkOne);
- yield countEntries("4hour", "Checking for 4hour form history entry creation", checkOne);
- yield countEntries("4hour10minutes", "Checking for 4hour10minutes form history entry creation", checkOne);
- yield countEntries("today", "Checking for today form history entry creation", checkOne);
- yield countEntries("b4today", "Checking for b4today form history entry creation", checkOne);
- is(checks, 9, "9 checks made");
-}
-
-function setupDownloads() {
-
- // Add 10-minutes download to DB
- let data = {
- id: "5555555",
- name: "fakefile-10-minutes",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: "fakefile-10-minutes",
- startTime: now_uSec - 10 * kUsecPerMin, // 10 minutes ago, in uSec
- endTime: now_uSec - 11 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "a1bcD23eF4g5"
- };
-
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "INSERT INTO moz_downloads (id, name, source, target, startTime, endTime, " +
- "state, currBytes, maxBytes, preferredAction, autoResume, guid) " +
- "VALUES (:id, :name, :source, :target, :startTime, :endTime, :state, " +
- ":currBytes, :maxBytes, :preferredAction, :autoResume, :guid)");
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add within-1-hour download to DB
- data = {
- id: "5555551",
- name: "fakefile-1-hour",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
- target: "fakefile-1-hour",
- startTime: now_uSec - 45 * kUsecPerMin, // 45 minutes ago, in uSec
- endTime: now_uSec - 44 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "1bcD23eF4g5a"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add 1-hour-10-minutes download to DB
- data = {
- id: "5555556",
- name: "fakefile-1-hour-10-minutes",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: "fakefile-1-hour-10-minutes",
- startTime: now_uSec - 70 * kUsecPerMin, // 70 minutes ago, in uSec
- endTime: now_uSec - 71 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "a1cbD23e4Fg5"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add within-2-hour download
- data = {
- id: "5555552",
- name: "fakefile-2-hour",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
- target: "fakefile-2-hour",
- startTime: now_uSec - 90 * kUsecPerMin, // 90 minutes ago, in uSec
- endTime: now_uSec - 89 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "b1aDc23eFg54"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add 2-hour-10-minutes download
- data = {
- id: "5555557",
- name: "fakefile-2-hour-10-minutes",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: "fakefile-2-hour-10-minutes",
- startTime: now_uSec - 130 * kUsecPerMin, // 130 minutes ago, in uSec
- endTime: now_uSec - 131 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "z1bcD23eF4g5"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add within-4-hour download
- data = {
- id: "5555553",
- name: "fakefile-4-hour",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
- target: "fakefile-4-hour",
- startTime: now_uSec - 180 * kUsecPerMin, // 180 minutes ago, in uSec
- endTime: now_uSec - 179 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "zzzcD23eF4g5"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add 4-hour-10-minutes download
- data = {
- id: "5555558",
- name: "fakefile-4-hour-10-minutes",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: "fakefile-4-hour-10-minutes",
- startTime: now_uSec - 250 * kUsecPerMin, // 250 minutes ago, in uSec
- endTime: now_uSec - 251 * kUsecPerMin, // 1 minute later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "z1bzz23eF4gz"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add "today" download
- let today = new Date();
- today.setHours(0);
- today.setMinutes(0);
- today.setSeconds(1);
-
- data = {
- id: "5555554",
- name: "fakefile-today",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
- target: "fakefile-today",
- startTime: today.getTime() * 1000, // 12:00:30am this morning, in uSec
- endTime: (today.getTime() + 1000) * 1000, // 1 second later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "ffffD23eF4g5"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- // Add "before today" download
- let lastYear = new Date();
- lastYear.setFullYear(lastYear.getFullYear() - 1);
- data = {
- id: "5555550",
- name: "fakefile-old",
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=453440",
- target: "fakefile-old",
- startTime: lastYear.getTime() * 1000, // 1 year ago, in uSec
- endTime: (lastYear.getTime() + 1000) * 1000, // 1 second later
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "ggggg23eF4g5"
- };
-
- try {
- for (let prop in data)
- stmt.params[prop] = data[prop];
- stmt.execute();
- }
- finally {
- stmt.finalize();
- }
-
- // Confirm everything worked
- ok(downloadExists(5555550), "Pretend download for everything case should exist");
- ok(downloadExists(5555555), "Pretend download for 10-minutes case should exist");
- ok(downloadExists(5555551), "Pretend download for 1-hour case should exist");
- ok(downloadExists(5555556), "Pretend download for 1-hour-10-minutes case should exist");
- ok(downloadExists(5555552), "Pretend download for 2-hour case should exist");
- ok(downloadExists(5555557), "Pretend download for 2-hour-10-minutes case should exist");
- ok(downloadExists(5555553), "Pretend download for 4-hour case should exist");
- ok(downloadExists(5555558), "Pretend download for 4-hour-10-minutes case should exist");
- ok(downloadExists(5555554), "Pretend download for Today case should exist");
-}
-
-/**
- * Checks to see if the downloads with the specified id exists.
- *
- * @param aID
- * The ids of the downloads to check.
- */
-function downloadExists(aID)
-{
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "SELECT * " +
- "FROM moz_downloads " +
- "WHERE id = :id"
- );
- stmt.params.id = aID;
- var rows = stmt.executeStep();
- stmt.finalize();
- return rows;
-}
-
-function isToday(aDate) {
- return aDate.getDate() == new Date().getDate();
-}
diff --git a/browser/base/content/test/browser_sanitizeDialog.js b/browser/base/content/test/browser_sanitizeDialog.js
deleted file mode 100644
index 02f32e3bf..000000000
--- a/browser/base/content/test/browser_sanitizeDialog.js
+++ /dev/null
@@ -1,1099 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests the sanitize dialog (a.k.a. the clear recent history dialog).
- * See bug 480169.
- *
- * The purpose of this test is not to fully flex the sanitize timespan code;
- * browser/base/content/test/browser_sanitize-timespans.js does that. This
- * test checks the UI of the dialog and makes sure it's correctly connected to
- * the sanitize timespan code.
- *
- * Some of this code, especially the history creation parts, was taken from
- * browser/base/content/test/browser_sanitize-timespans.js.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
- "resource://gre/modules/FormHistory.jsm");
-
-let tempScope = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tempScope);
-let Sanitizer = tempScope.Sanitizer;
-
-const dm = Cc["@mozilla.org/download-manager;1"].
- getService(Ci.nsIDownloadManager);
-
-const kUsecPerMin = 60 * 1000000;
-
-let formEntries;
-
-// Add tests here. Each is a function that's called by doNextTest().
-var gAllTests = [
-
- /**
- * Initializes the dialog to its default state.
- */
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Select "Last Hour"
- this.selectDuration(Sanitizer.TIMESPAN_HOUR);
- // Hide details
- if (!this.getItemList().collapsed)
- this.toggleDetails();
- this.acceptDialog();
- };
- wh.open();
- },
-
- /**
- * Cancels the dialog, makes sure history not cleared.
- */
- function () {
- // Add history (within the past hour)
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 30; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
-
- addVisits(places, function() {
- let wh = new WindowHelper();
- wh.onload = function () {
- this.selectDuration(Sanitizer.TIMESPAN_HOUR);
- this.checkPrefCheckbox("history", false);
- this.checkDetails(false);
-
- // Show details
- this.toggleDetails();
- this.checkDetails(true);
-
- // Hide details
- this.toggleDetails();
- this.checkDetails(false);
- this.cancelDialog();
- };
- wh.onunload = function () {
- yield promiseHistoryClearedState(uris, false);
- yield blankSlate();
- yield promiseHistoryClearedState(uris, true);
- };
- wh.open();
- });
- },
-
- /**
- * Ensures that the combined history-downloads checkbox clears both history
- * visits and downloads when checked; the dialog respects simple timespan.
- */
- function () {
- // Add history (within the past hour).
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 30; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
- // Add history (over an hour ago).
- let olderURIs = [];
- for (let i = 0; i < 5; i++) {
- pURI = makeURI("http://" + (61 + i) + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(61 + i)});
- olderURIs.push(pURI);
- }
-
- addVisits(places, function() {
- // Add downloads (within the past hour).
- let downloadIDs = [];
- for (let i = 0; i < 5; i++) {
- downloadIDs.push(addDownloadWithMinutesAgo(i));
- }
- // Add downloads (over an hour ago).
- let olderDownloadIDs = [];
- for (let i = 0; i < 5; i++) {
- olderDownloadIDs.push(addDownloadWithMinutesAgo(61 + i));
- }
- let totalHistoryVisits = uris.length + olderURIs.length;
-
- let wh = new WindowHelper();
- wh.onload = function () {
- this.selectDuration(Sanitizer.TIMESPAN_HOUR);
- this.checkPrefCheckbox("history", true);
- this.acceptDialog();
-
- intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_HOUR,
- "timeSpan pref should be hour after accepting dialog with " +
- "hour selected");
- boolPrefIs("cpd.history", true,
- "history pref should be true after accepting dialog with " +
- "history checkbox checked");
- boolPrefIs("cpd.downloads", true,
- "downloads pref should be true after accepting dialog with " +
- "history checkbox checked");
- };
- wh.onunload = function () {
- // History visits and downloads within one hour should be cleared.
- yield promiseHistoryClearedState(uris, true);
- ensureDownloadsClearedState(downloadIDs, true);
-
- // Visits and downloads > 1 hour should still exist.
- yield promiseHistoryClearedState(olderURIs, false);
- ensureDownloadsClearedState(olderDownloadIDs, false);
-
- // OK, done, cleanup after ourselves.
- yield blankSlate();
- yield promiseHistoryClearedState(olderURIs, true);
- ensureDownloadsClearedState(olderDownloadIDs, true);
- };
- wh.open();
- });
- },
-
- /**
- * Add form history entries for the next test.
- */
- function () {
- formEntries = [];
-
- let iter = function() {
- for (let i = 0; i < 5; i++) {
- formEntries.push(addFormEntryWithMinutesAgo(iter, i));
- yield;
- }
- doNextTest();
- }();
-
- iter.next();
- },
-
- /**
- * Ensures that the combined history-downloads checkbox removes neither
- * history visits nor downloads when not checked.
- */
- function () {
- // Add history, downloads, form entries (within the past hour).
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 5; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
-
- addVisits(places, function() {
- let downloadIDs = [];
- for (let i = 0; i < 5; i++) {
- downloadIDs.push(addDownloadWithMinutesAgo(i));
- }
-
- let wh = new WindowHelper();
- wh.onload = function () {
- is(this.isWarningPanelVisible(), false,
- "Warning panel should be hidden after previously accepting dialog " +
- "with a predefined timespan");
- this.selectDuration(Sanitizer.TIMESPAN_HOUR);
-
- // Remove only form entries, leave history (including downloads).
- this.checkPrefCheckbox("history", false);
- this.checkPrefCheckbox("formdata", true);
- this.acceptDialog();
-
- intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_HOUR,
- "timeSpan pref should be hour after accepting dialog with " +
- "hour selected");
- boolPrefIs("cpd.history", false,
- "history pref should be false after accepting dialog with " +
- "history checkbox unchecked");
- boolPrefIs("cpd.downloads", false,
- "downloads pref should be false after accepting dialog with " +
- "history checkbox unchecked");
- };
- wh.onunload = function () {
- // Of the three only form entries should be cleared.
- yield promiseHistoryClearedState(uris, false);
- ensureDownloadsClearedState(downloadIDs, false);
-
- formEntries.forEach(function (entry) {
- let exists = yield formNameExists(entry);
- is(exists, false, "form entry " + entry + " should no longer exist");
- });
-
- // OK, done, cleanup after ourselves.
- yield blankSlate();
- yield promiseHistoryClearedState(uris, true);
- ensureDownloadsClearedState(downloadIDs, true);
- };
- wh.open();
- });
- },
-
- /**
- * Ensures that the "Everything" duration option works.
- */
- function () {
- // Add history.
- let uris = [];
- let places = [];
- let pURI;
- // within past hour, within past two hours, within past four hours and
- // outside past four hours
- [10, 70, 130, 250].forEach(function(aValue) {
- pURI = makeURI("http://" + aValue + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(aValue)});
- uris.push(pURI);
- });
- addVisits(places, function() {
- let wh = new WindowHelper();
- wh.onload = function () {
- is(this.isWarningPanelVisible(), false,
- "Warning panel should be hidden after previously accepting dialog " +
- "with a predefined timespan");
- this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
- this.checkPrefCheckbox("history", true);
- this.checkDetails(true);
-
- // Hide details
- this.toggleDetails();
- this.checkDetails(false);
-
- // Show details
- this.toggleDetails();
- this.checkDetails(true);
-
- this.acceptDialog();
-
- intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_EVERYTHING,
- "timeSpan pref should be everything after accepting dialog " +
- "with everything selected");
- };
- wh.onunload = function () {
- yield promiseHistoryClearedState(uris, true);
- };
- wh.open();
- });
- },
-
- /**
- * Ensures that the "Everything" warning is visible on dialog open after
- * the previous test.
- */
- function () {
- // Add history.
- let uris = [];
- let places = [];
- let pURI;
- // within past hour, within past two hours, within past four hours and
- // outside past four hours
- [10, 70, 130, 250].forEach(function(aValue) {
- pURI = makeURI("http://" + aValue + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(aValue)});
- uris.push(pURI);
- });
- addVisits(places, function() {
- let wh = new WindowHelper();
- wh.onload = function () {
- is(this.isWarningPanelVisible(), true,
- "Warning panel should be visible after previously accepting dialog " +
- "with clearing everything");
- this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
- this.checkPrefCheckbox("history", true);
- this.acceptDialog();
-
- intPrefIs("sanitize.timeSpan", Sanitizer.TIMESPAN_EVERYTHING,
- "timeSpan pref should be everything after accepting dialog " +
- "with everything selected");
- };
- wh.onunload = function () {
- yield promiseHistoryClearedState(uris, true);
- };
- wh.open();
- });
- },
-
- /**
- * Add form history entry for the next test.
- */
- function () {
- let iter = function() {
- formEntries = [ addFormEntryWithMinutesAgo(iter, 10) ];
- yield;
- doNextTest();
- }();
-
- iter.next();
- },
-
- /**
- * The next three tests checks that when a certain history item cannot be
- * cleared then the checkbox should be both disabled and unchecked.
- * In addition, we ensure that this behavior does not modify the preferences.
- */
- function () {
- // Add history.
- let pURI = makeURI("http://" + 10 + "-minutes-ago.com/");
- addVisits({uri: pURI, visitDate: visitTimeForMinutesAgo(10)}, function() {
- let uris = [ pURI ];
-
- let wh = new WindowHelper();
- wh.onload = function() {
- // Check that the relevant checkboxes are enabled
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='privacy.cpd.formdata']");
- ok(cb.length == 1 && !cb[0].disabled, "There is formdata, checkbox to " +
- "clear formdata should be enabled.");
-
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='privacy.cpd.history']");
- ok(cb.length == 1 && !cb[0].disabled, "There is history, checkbox to " +
- "clear history should be enabled.");
-
- this.checkAllCheckboxes();
- this.acceptDialog();
- };
- wh.onunload = function () {
- yield promiseHistoryClearedState(uris, true);
-
- let exists = yield formNameExists(formEntries[0]);
- is(exists, false, "form entry " + formEntries[0] + " should no longer exist");
- };
- wh.open();
- });
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function() {
- boolPrefIs("cpd.history", true,
- "history pref should be true after accepting dialog with " +
- "history checkbox checked");
- boolPrefIs("cpd.formdata", true,
- "formdata pref should be true after accepting dialog with " +
- "formdata checkbox checked");
-
-
- // Even though the formdata pref is true, because there is no history
- // left to clear, the checkbox will be disabled.
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='privacy.cpd.formdata']");
- ok(cb.length == 1 && cb[0].disabled && !cb[0].checked,
- "There is no formdata history, checkbox should be disabled and be " +
- "cleared to reduce user confusion (bug 497664).");
-
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='privacy.cpd.history']");
- ok(cb.length == 1 && !cb[0].disabled && cb[0].checked,
- "There is no history, but history checkbox should always be enabled " +
- "and will be checked from previous preference.");
-
- this.acceptDialog();
- }
- wh.open();
- },
-
- /**
- * Add form history entry for the next test.
- */
- function () {
- let iter = function() {
- formEntries = [ addFormEntryWithMinutesAgo(iter, 10) ];
- yield;
- doNextTest();
- }();
-
- iter.next();
- },
-
- function () {
- let wh = new WindowHelper();
- wh.onload = function() {
- boolPrefIs("cpd.formdata", true,
- "formdata pref should persist previous value after accepting " +
- "dialog where you could not clear formdata.");
-
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='privacy.cpd.formdata']");
- ok(cb.length == 1 && !cb[0].disabled && cb[0].checked,
- "There exists formEntries so the checkbox should be in sync with " +
- "the pref.");
-
- this.acceptDialog();
- };
- wh.onunload = function () {
- let exists = yield formNameExists(formEntries[0]);
- is(exists, false, "form entry " + formEntries[0] + " should no longer exist");
- };
- wh.open();
- },
-
-
- /**
- * These next six tests together ensure that toggling details persists
- * across dialog openings.
- */
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Check all items and select "Everything"
- this.checkAllCheckboxes();
- this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
-
- // Hide details
- this.toggleDetails();
- this.checkDetails(false);
- this.acceptDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should remain closed because all items are checked.
- this.checkDetails(false);
-
- // Uncheck history.
- this.checkPrefCheckbox("history", false);
- this.acceptDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should be open because not all items are checked.
- this.checkDetails(true);
-
- // Modify the Site Preferences item state (bug 527820)
- this.checkAllCheckboxes();
- this.checkPrefCheckbox("siteSettings", false);
- this.acceptDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should be open because not all items are checked.
- this.checkDetails(true);
-
- // Hide details
- this.toggleDetails();
- this.checkDetails(false);
- this.cancelDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should be open because not all items are checked.
- this.checkDetails(true);
-
- // Select another duration
- this.selectDuration(Sanitizer.TIMESPAN_HOUR);
- // Hide details
- this.toggleDetails();
- this.checkDetails(false);
- this.acceptDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should not be open because "Last Hour" is selected
- this.checkDetails(false);
-
- this.cancelDialog();
- };
- wh.open();
- },
- function () {
- let wh = new WindowHelper();
- wh.onload = function () {
- // Details should have remained closed
- this.checkDetails(false);
-
- // Show details
- this.toggleDetails();
- this.checkDetails(true);
- this.cancelDialog();
- };
- wh.open();
- },
- function () {
- // Test for offline cache deletion
-
- // Prepare stuff, we will work with www.example.com
- var URL = "http://www.example.com";
-
- var ios = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService);
- var URI = ios.newURI(URL, null, null);
-
- var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Ci.nsIScriptSecurityManager);
- var principal = sm.getNoAppCodebasePrincipal(URI);
-
- // Give www.example.com privileges to store offline data
- var pm = Cc["@mozilla.org/permissionmanager;1"]
- .getService(Ci.nsIPermissionManager);
- pm.addFromPrincipal(principal, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
- pm.addFromPrincipal(principal, "offline-app", Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
-
- // Store something to the offline cache
- const nsICache = Components.interfaces.nsICache;
- var cs = Components.classes["@mozilla.org/network/cache-service;1"]
- .getService(Components.interfaces.nsICacheService);
- var session = cs.createSession(URL + "/manifest", nsICache.STORE_OFFLINE, nsICache.STREAM_BASED);
-
- // Open the dialog
- let wh = new WindowHelper();
- wh.onload = function () {
- this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
- // Show details
- this.toggleDetails();
- // Clear only offlineApps
- this.uncheckAllCheckboxes();
- this.checkPrefCheckbox("offlineApps", true);
- this.acceptDialog();
-
- // Check if the cache has been deleted
- var size = -1;
- var visitor = {
- visitDevice: function (deviceID, deviceInfo)
- {
- if (deviceID == "offline")
- size = deviceInfo.totalSize;
-
- // Do not enumerate entries
- return false;
- },
-
- visitEntry: function (deviceID, entryInfo)
- {
- // Do not enumerate entries.
- return false;
- }
- };
- cs.visitEntries(visitor);
- is(size, 0, "offline application cache entries evicted");
- };
-
- var cacheListener = {
- onCacheEntryAvailable: function (entry, access, status) {
- is(status, Cr.NS_OK);
- var stream = entry.openOutputStream(0);
- var content = "content";
- stream.write(content, content.length);
- stream.close();
- entry.close();
- wh.open();
- }
- };
-
- session.asyncOpenCacheEntry(URL, nsICache.ACCESS_READ_WRITE, cacheListener);
- },
- function () {
- // Test for offline apps permission deletion
-
- // Prepare stuff, we will work with www.example.com
- var URL = "http://www.example.com";
-
- var ios = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService);
- var URI = ios.newURI(URL, null, null);
-
- var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Ci.nsIScriptSecurityManager);
- var principal = sm.getNoAppCodebasePrincipal(URI);
-
- // Open the dialog
- let wh = new WindowHelper();
- wh.onload = function () {
- this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
- // Show details
- this.toggleDetails();
- // Clear only offlineApps
- this.uncheckAllCheckboxes();
- this.checkPrefCheckbox("siteSettings", true);
- this.acceptDialog();
-
- // Check all has been deleted (privileges, data, cache)
- var pm = Cc["@mozilla.org/permissionmanager;1"]
- .getService(Ci.nsIPermissionManager);
- is(pm.testPermissionFromPrincipal(principal, "offline-app"), 0, "offline-app permissions removed");
- };
- wh.open();
- }
-];
-
-// Used as the download database ID for a new download. Incremented for each
-// new download. See addDownloadWithMinutesAgo().
-var gDownloadId = 5555551;
-
-// Index in gAllTests of the test currently being run. Incremented for each
-// test run. See doNextTest().
-var gCurrTest = 0;
-
-var now_uSec = Date.now() * 1000;
-
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- * This wraps the dialog and provides some convenience methods for interacting
- * with it.
- *
- * @param aWin
- * The dialog's nsIDOMWindow
- */
-function WindowHelper(aWin) {
- this.win = aWin;
-}
-
-WindowHelper.prototype = {
- /**
- * "Presses" the dialog's OK button.
- */
- acceptDialog: function () {
- is(this.win.document.documentElement.getButton("accept").disabled, false,
- "Dialog's OK button should not be disabled");
- this.win.document.documentElement.acceptDialog();
- },
-
- /**
- * "Presses" the dialog's Cancel button.
- */
- cancelDialog: function () {
- this.win.document.documentElement.cancelDialog();
- },
-
- /**
- * Ensures that the details progressive disclosure button and the item list
- * hidden by it match up. Also makes sure the height of the dialog is
- * sufficient for the item list and warning panel.
- *
- * @param aShouldBeShown
- * True if you expect the details to be shown and false if hidden
- */
- checkDetails: function (aShouldBeShown) {
- let button = this.getDetailsButton();
- let list = this.getItemList();
- let hidden = list.hidden || list.collapsed;
- is(hidden, !aShouldBeShown,
- "Details should be " + (aShouldBeShown ? "shown" : "hidden") +
- " but were actually " + (hidden ? "hidden" : "shown"));
- let dir = hidden ? "down" : "up";
- is(button.className, "expander-" + dir,
- "Details button should be " + dir + " because item list is " +
- (hidden ? "" : "not ") + "hidden");
- let height = 0;
- if (!hidden) {
- ok(list.boxObject.height > 30, "listbox has sufficient size")
- height += list.boxObject.height;
- }
- if (this.isWarningPanelVisible())
- height += this.getWarningPanel().boxObject.height;
- ok(height < this.win.innerHeight,
- "Window should be tall enough to fit warning panel and item list");
- },
-
- /**
- * (Un)checks a history scope checkbox (browser & download history,
- * form history, etc.).
- *
- * @param aPrefName
- * The final portion of the checkbox's privacy.cpd.* preference name
- * @param aCheckState
- * True if the checkbox should be checked, false otherwise
- */
- checkPrefCheckbox: function (aPrefName, aCheckState) {
- var pref = "privacy.cpd." + aPrefName;
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='" + pref + "']");
- is(cb.length, 1, "found checkbox for " + pref + " preference");
- if (cb[0].checked != aCheckState)
- cb[0].click();
- },
-
- /**
- * Makes sure all the checkboxes are checked.
- */
- _checkAllCheckboxesCustom: function (check) {
- var cb = this.win.document.querySelectorAll("#itemList > [preference]");
- ok(cb.length > 1, "found checkboxes for preferences");
- for (var i = 0; i < cb.length; ++i) {
- var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
- if (!!pref.value ^ check)
- cb[i].click();
- }
- },
-
- checkAllCheckboxes: function () {
- this._checkAllCheckboxesCustom(true);
- },
-
- uncheckAllCheckboxes: function () {
- this._checkAllCheckboxesCustom(false);
- },
-
- /**
- * @return The details progressive disclosure button
- */
- getDetailsButton: function () {
- return this.win.document.getElementById("detailsExpander");
- },
-
- /**
- * @return The dialog's duration dropdown
- */
- getDurationDropdown: function () {
- return this.win.document.getElementById("sanitizeDurationChoice");
- },
-
- /**
- * @return The item list hidden by the details progressive disclosure button
- */
- getItemList: function () {
- return this.win.document.getElementById("itemList");
- },
-
- /**
- * @return The clear-everything warning box
- */
- getWarningPanel: function () {
- return this.win.document.getElementById("sanitizeEverythingWarningBox");
- },
-
- /**
- * @return True if the "Everything" warning panel is visible (as opposed to
- * the tree)
- */
- isWarningPanelVisible: function () {
- return !this.getWarningPanel().hidden;
- },
-
- /**
- * Opens the clear recent history dialog. Before calling this, set
- * this.onload to a function to execute onload. It should close the dialog
- * when done so that the tests may continue. Set this.onunload to a function
- * to execute onunload. this.onunload is optional. If it returns true, the
- * caller is expected to call waitForAsyncUpdates at some point; if false is
- * returned, waitForAsyncUpdates is called automatically.
- */
- open: function () {
- let wh = this;
-
- function windowObserver(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
-
- Services.ww.unregisterNotification(windowObserver);
-
- var loaded = false;
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
-
- win.addEventListener("load", function onload(event) {
- win.removeEventListener("load", onload, false);
-
- if (win.name !== "SanitizeDialog")
- return;
-
- wh.win = win;
- loaded = true;
-
- executeSoon(function () {
- // Some exceptions that reach here don't reach the test harness, but
- // ok()/is() do...
- try {
- wh.onload();
- }
- catch (exc) {
- win.close();
- ok(false, "Unexpected exception: " + exc + "\n" + exc.stack);
- finish();
- }
- });
- }, false);
-
- win.addEventListener("unload", function onunload(event) {
- if (win.name !== "SanitizeDialog") {
- win.removeEventListener("unload", onunload, false);
- return;
- }
-
- // Why is unload fired before load?
- if (!loaded)
- return;
-
- win.removeEventListener("unload", onunload, false);
- wh.win = win;
-
- executeSoon(function () {
- // Some exceptions that reach here don't reach the test harness, but
- // ok()/is() do...
- try {
- if (wh.onunload) {
- Task.spawn(wh.onunload).then(function() {
- waitForAsyncUpdates(doNextTest);
- });
- } else {
- waitForAsyncUpdates(doNextTest);
- }
- }
- catch (exc) {
- win.close();
- ok(false, "Unexpected exception: " + exc + "\n" + exc.stack);
- finish();
- }
- });
- }, false);
- }
- Services.ww.registerNotification(windowObserver);
- Services.ww.openWindow(null,
- "chrome://browser/content/sanitize.xul",
- "SanitizeDialog",
- "chrome,titlebar,dialog,centerscreen,modal",
- null);
- },
-
- /**
- * Selects a duration in the duration dropdown.
- *
- * @param aDurVal
- * One of the Sanitizer.TIMESPAN_* values
- */
- selectDuration: function (aDurVal) {
- this.getDurationDropdown().value = aDurVal;
- if (aDurVal === Sanitizer.TIMESPAN_EVERYTHING) {
- is(this.isWarningPanelVisible(), true,
- "Warning panel should be visible for TIMESPAN_EVERYTHING");
- }
- else {
- is(this.isWarningPanelVisible(), false,
- "Warning panel should not be visible for non-TIMESPAN_EVERYTHING");
- }
- },
-
- /**
- * Toggles the details progressive disclosure button.
- */
- toggleDetails: function () {
- this.getDetailsButton().click();
- }
-};
-
-/**
- * Adds a download to history.
- *
- * @param aMinutesAgo
- * The download will be downloaded this many minutes ago
- */
-function addDownloadWithMinutesAgo(aMinutesAgo) {
- let name = "fakefile-" + aMinutesAgo + "-minutes-ago";
- let data = {
- id: gDownloadId,
- name: name,
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: name,
- startTime: now_uSec - (aMinutesAgo * kUsecPerMin),
- endTime: now_uSec - ((aMinutesAgo + 1) * kUsecPerMin),
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0
- };
-
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "INSERT INTO moz_downloads (id, name, source, target, startTime, endTime, " +
- "state, currBytes, maxBytes, preferredAction, autoResume) " +
- "VALUES (:id, :name, :source, :target, :startTime, :endTime, :state, " +
- ":currBytes, :maxBytes, :preferredAction, :autoResume)");
- try {
- for (let prop in data) {
- stmt.params[prop] = data[prop];
- }
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- is(downloadExists(gDownloadId), true,
- "Sanity check: download " + gDownloadId +
- " should exist after creating it");
-
- return gDownloadId++;
-}
-
-/**
- * Adds a form entry to history.
- *
- * @param aMinutesAgo
- * The entry will be added this many minutes ago
- */
-function addFormEntryWithMinutesAgo(then, aMinutesAgo) {
- let name = aMinutesAgo + "-minutes-ago";
-
- // Artifically age the entry to the proper vintage.
- let timestamp = now_uSec - (aMinutesAgo * kUsecPerMin);
-
- FormHistory.update({ op: "add", fieldname: name, value: "dummy", firstUsed: timestamp },
- { handleError: function (error) {
- do_throw("Error occurred updating form history: " + error);
- },
- handleCompletion: function (reason) { then.next(); }
- });
- return name;
-}
-
-/**
- * Checks if a form entry exists.
- */
-function formNameExists(name)
-{
- let deferred = Promise.defer();
-
- let count = 0;
- FormHistory.count({ fieldname: name },
- { handleResult: function (result) count = result,
- handleError: function (error) {
- do_throw("Error occurred searching form history: " + error);
- deferred.reject(error);
- },
- handleCompletion: function (reason) {
- if (!reason) deferred.resolve(count);
- }
- });
-
- return deferred.promise;
-}
-
-/**
- * Removes all history visits, downloads, and form entries.
- */
-function blankSlate() {
- PlacesUtils.bhistory.removeAllPages();
- dm.cleanUp();
-
- let deferred = Promise.defer();
- FormHistory.update({ op: "remove" },
- { handleError: function (error) {
- do_throw("Error occurred updating form history: " + error);
- deferred.reject(error);
- },
- handleCompletion: function (reason) { if (!reason) deferred.resolve(); }
- });
- return deferred.promise;
-}
-
-/**
- * Ensures that the given pref is the expected value.
- *
- * @param aPrefName
- * The pref's sub-branch under the privacy branch
- * @param aExpectedVal
- * The pref's expected value
- * @param aMsg
- * Passed to is()
- */
-function boolPrefIs(aPrefName, aExpectedVal, aMsg) {
- is(gPrefService.getBoolPref("privacy." + aPrefName), aExpectedVal, aMsg);
-}
-
-/**
- * Checks to see if the download with the specified ID exists.
- *
- * @param aID
- * The ID of the download to check
- * @return True if the download exists, false otherwise
- */
-function downloadExists(aID)
-{
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "SELECT * " +
- "FROM moz_downloads " +
- "WHERE id = :id"
- );
- stmt.params.id = aID;
- let rows = stmt.executeStep();
- stmt.finalize();
- return !!rows;
-}
-
-/**
- * Runs the next test in the gAllTests array. If all tests have been run,
- * finishes the entire suite.
- */
-function doNextTest() {
- if (gAllTests.length <= gCurrTest) {
- blankSlate();
- waitForAsyncUpdates(finish);
- }
- else {
- let ct = gCurrTest;
- gCurrTest++;
- gAllTests[ct]();
- }
-}
-
-/**
- * Ensures that the specified downloads are either cleared or not.
- *
- * @param aDownloadIDs
- * Array of download database IDs
- * @param aShouldBeCleared
- * True if each download should be cleared, false otherwise
- */
-function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
- let niceStr = aShouldBeCleared ? "no longer" : "still";
- aDownloadIDs.forEach(function (id) {
- is(downloadExists(id), !aShouldBeCleared,
- "download " + id + " should " + niceStr + " exist");
- });
-}
-
-/**
- * Ensures that the given pref is the expected value.
- *
- * @param aPrefName
- * The pref's sub-branch under the privacy branch
- * @param aExpectedVal
- * The pref's expected value
- * @param aMsg
- * Passed to is()
- */
-function intPrefIs(aPrefName, aExpectedVal, aMsg) {
- is(gPrefService.getIntPref("privacy." + aPrefName), aExpectedVal, aMsg);
-}
-
-/**
- * Creates a visit time.
- *
- * @param aMinutesAgo
- * The visit will be visited this many minutes ago
- */
-function visitTimeForMinutesAgo(aMinutesAgo) {
- return now_uSec - aMinutesAgo * kUsecPerMin;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-function test() {
- requestLongerTimeout(2);
- waitForExplicitFinish();
- blankSlate();
- // Kick off all the tests in the gAllTests array.
- waitForAsyncUpdates(doNextTest);
-}
diff --git a/browser/base/content/test/browser_sanitizeDialog_treeView.js b/browser/base/content/test/browser_sanitizeDialog_treeView.js
deleted file mode 100644
index 10e726100..000000000
--- a/browser/base/content/test/browser_sanitizeDialog_treeView.js
+++ /dev/null
@@ -1,632 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests the sanitize dialog (a.k.a. the clear recent history dialog).
- * See bug 480169.
- *
- * The purpose of this test is not to fully flex the sanitize timespan code;
- * browser/base/content/test/browser_sanitize-timespans.js does that. This
- * test checks the UI of the dialog and makes sure it's correctly connected to
- * the sanitize timespan code.
- *
- * Some of this code, especially the history creation parts, was taken from
- * browser/base/content/test/browser_sanitize-timespans.js.
- */
-
-Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader).
- loadSubScript("chrome://browser/content/sanitize.js");
-
-const dm = Cc["@mozilla.org/download-manager;1"].
- getService(Ci.nsIDownloadManager);
-const formhist = Cc["@mozilla.org/satchel/form-history;1"].
- getService(Ci.nsIFormHistory2);
-
-// Add tests here. Each is a function that's called by doNextTest().
-var gAllTests = [
-
- /**
- * Moves the grippy around, makes sure it works OK.
- */
- function () {
- // Add history (within the past hour) to get some rows in the tree.
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 30; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
-
- addVisits(places, function() {
- // Open the dialog and do our tests.
- openWindow(function (aWin) {
- let wh = new WindowHelper(aWin);
- wh.selectDuration(Sanitizer.TIMESPAN_HOUR);
- wh.checkGrippy("Grippy should be at last row after selecting HOUR " +
- "duration",
- wh.getRowCount() - 1);
-
- // Move the grippy around.
- let row = wh.getGrippyRow();
- while (row !== 0) {
- row--;
- wh.moveGrippyBy(-1);
- wh.checkGrippy("Grippy should be moved up one row", row);
- }
- wh.moveGrippyBy(-1);
- wh.checkGrippy("Grippy should remain at first row after trying to move " +
- "it up",
- 0);
- while (row !== wh.getRowCount() - 1) {
- row++;
- wh.moveGrippyBy(1);
- wh.checkGrippy("Grippy should be moved down one row", row);
- }
- wh.moveGrippyBy(1);
- wh.checkGrippy("Grippy should remain at last row after trying to move " +
- "it down",
- wh.getRowCount() - 1);
-
- // Cancel the dialog, make sure history visits are not cleared.
- wh.checkPrefCheckbox("history", false);
-
- wh.cancelDialog();
- yield promiseHistoryClearedState(uris, false);
-
- // OK, done, cleanup after ourselves.
- blankSlate();
- yield promiseHistoryClearedState(uris, true);
- });
- });
- },
-
- /**
- * Ensures that the combined history-downloads checkbox clears both history
- * visits and downloads when checked; the dialog respects simple timespan.
- */
- function () {
- // Add history (within the past hour).
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 30; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
- // Add history (over an hour ago).
- let olderURIs = [];
- for (let i = 0; i < 5; i++) {
- pURI = makeURI("http://" + (60 + i) + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(60 + i)});
- olderURIs.push(pURI);
- }
-
- addVisits(places, function() {
- // Add downloads (within the past hour).
- let downloadIDs = [];
- for (let i = 0; i < 5; i++) {
- downloadIDs.push(addDownloadWithMinutesAgo(i));
- }
- // Add downloads (over an hour ago).
- let olderDownloadIDs = [];
- for (let i = 0; i < 5; i++) {
- olderDownloadIDs.push(addDownloadWithMinutesAgo(61 + i));
- }
- let totalHistoryVisits = uris.length + olderURIs.length;
-
- // Open the dialog and do our tests.
- openWindow(function (aWin) {
- let wh = new WindowHelper(aWin);
- wh.selectDuration(Sanitizer.TIMESPAN_HOUR);
- wh.checkGrippy("Grippy should be at proper row after selecting HOUR " +
- "duration",
- uris.length);
-
- // Accept the dialog, make sure history visits and downloads within one
- // hour are cleared.
- wh.checkPrefCheckbox("history", true);
- wh.acceptDialog();
- yield promiseHistoryClearedState(uris, true);
- ensureDownloadsClearedState(downloadIDs, true);
-
- // Make sure visits and downloads > 1 hour still exist.
- yield promiseHistoryClearedState(olderURIs, false);
- ensureDownloadsClearedState(olderDownloadIDs, false);
-
- // OK, done, cleanup after ourselves.
- blankSlate();
- yield promiseHistoryClearedState(olderURIs, true);
- ensureDownloadsClearedState(olderDownloadIDs, true);
- });
- });
- },
-
- /**
- * Ensures that the combined history-downloads checkbox removes neither
- * history visits nor downloads when not checked.
- */
- function () {
- // Add history, downloads, form entries (within the past hour).
- let uris = [];
- let places = [];
- let pURI;
- for (let i = 0; i < 5; i++) {
- pURI = makeURI("http://" + i + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(i)});
- uris.push(pURI);
- }
-
- addVisits(places, function() {
- let downloadIDs = [];
- for (let i = 0; i < 5; i++) {
- downloadIDs.push(addDownloadWithMinutesAgo(i));
- }
- let formEntries = [];
- for (let i = 0; i < 5; i++) {
- formEntries.push(addFormEntryWithMinutesAgo(i));
- }
-
- // Open the dialog and do our tests.
- openWindow(function (aWin) {
- let wh = new WindowHelper(aWin);
- wh.selectDuration(Sanitizer.TIMESPAN_HOUR);
- wh.checkGrippy("Grippy should be at last row after selecting HOUR " +
- "duration",
- wh.getRowCount() - 1);
-
- // Remove only form entries, leave history (including downloads).
- wh.checkPrefCheckbox("history", false);
- wh.checkPrefCheckbox("formdata", true);
- wh.acceptDialog();
-
- // Of the three only form entries should be cleared.
- yield promiseHistoryClearedState(uris, false);
- ensureDownloadsClearedState(downloadIDs, false);
- ensureFormEntriesClearedState(formEntries, true);
-
- // OK, done, cleanup after ourselves.
- blankSlate();
- yield promiseHistoryClearedState(uris, true);
- ensureDownloadsClearedState(downloadIDs, true);
- });
- });
- },
-
- /**
- * Ensures that the "Everything" duration option works.
- */
- function () {
- // Add history.
- let uris = [];
- let places = [];
- let pURI;
- // within past hour, within past two hours, within past four hours and
- // outside past four hours
- [10, 70, 130, 250].forEach(function(aValue) {
- pURI = makeURI("http://" + aValue + "-minutes-ago.com/");
- places.push({uri: pURI, visitDate: visitTimeForMinutesAgo(aValue)});
- uris.push(pURI);
- });
- addVisits(places, function() {
-
- // Open the dialog and do our tests.
- openWindow(function (aWin) {
- let wh = new WindowHelper(aWin);
- wh.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
- wh.checkPrefCheckbox("history", true);
- wh.acceptDialog();
- yield promiseHistoryClearedState(uris, true);
- });
- });
- }
-];
-
-// Used as the download database ID for a new download. Incremented for each
-// new download. See addDownloadWithMinutesAgo().
-var gDownloadId = 5555551;
-
-// Index in gAllTests of the test currently being run. Incremented for each
-// test run. See doNextTest().
-var gCurrTest = 0;
-
-var now_uSec = Date.now() * 1000;
-
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- * This wraps the dialog and provides some convenience methods for interacting
- * with it.
- *
- * A warning: Before you call any function that uses the tree (or any function
- * that calls a function that uses the tree), you must set a non-everything
- * duration by calling selectDuration(). The dialog does not initialize the
- * tree if it does not yet need to be shown.
- *
- * @param aWin
- * The dialog's nsIDOMWindow
- */
-function WindowHelper(aWin) {
- this.win = aWin;
-}
-
-WindowHelper.prototype = {
- /**
- * "Presses" the dialog's OK button.
- */
- acceptDialog: function () {
- is(this.win.document.documentElement.getButton("accept").disabled, false,
- "Dialog's OK button should not be disabled");
- this.win.document.documentElement.acceptDialog();
- },
-
- /**
- * "Presses" the dialog's Cancel button.
- */
- cancelDialog: function () {
- this.win.document.documentElement.cancelDialog();
- },
-
- /**
- * Ensures that the grippy row is in the right place, tree selection is OK,
- * and that the grippy's visible.
- *
- * @param aMsg
- * Passed to is() when checking grippy location
- * @param aExpectedRow
- * The row that the grippy should be at
- */
- checkGrippy: function (aMsg, aExpectedRow) {
- is(this.getGrippyRow(), aExpectedRow, aMsg);
- this.checkTreeSelection();
- this.ensureGrippyIsVisible();
- },
-
- /**
- * (Un)checks a history scope checkbox (browser & download history,
- * form history, etc.).
- *
- * @param aPrefName
- * The final portion of the checkbox's privacy.cpd.* preference name
- * @param aCheckState
- * True if the checkbox should be checked, false otherwise
- */
- checkPrefCheckbox: function (aPrefName, aCheckState) {
- var pref = "privacy.cpd." + aPrefName;
- var cb = this.win.document.querySelectorAll(
- "#itemList > [preference='" + pref + "']");
- is(cb.length, 1, "found checkbox for " + pref + " preference");
- if (cb[0].checked != aCheckState)
- cb[0].click();
- },
-
- /**
- * Ensures that the tree selection is appropriate to the grippy row. (A
- * single, contiguous selection should exist from the first row all the way
- * to the grippy.)
- */
- checkTreeSelection: function () {
- let grippyRow = this.getGrippyRow();
- let sel = this.getTree().view.selection;
- if (grippyRow === 0) {
- is(sel.getRangeCount(), 0,
- "Grippy row is 0, so no tree selection should exist");
- }
- else {
- is(sel.getRangeCount(), 1,
- "Grippy row > 0, so only one tree selection range should exist");
- let min = {};
- let max = {};
- sel.getRangeAt(0, min, max);
- is(min.value, 0, "Tree selection should start at first row");
- is(max.value, grippyRow - 1,
- "Tree selection should end at row before grippy");
- }
- },
-
- /**
- * The grippy should always be visible when it's moved directly. This method
- * ensures that.
- */
- ensureGrippyIsVisible: function () {
- let tbo = this.getTree().treeBoxObject;
- let firstVis = tbo.getFirstVisibleRow();
- let lastVis = tbo.getLastVisibleRow();
- let grippyRow = this.getGrippyRow();
- ok(firstVis <= grippyRow && grippyRow <= lastVis,
- "Grippy row should be visible; this inequality should be true: " +
- firstVis + " <= " + grippyRow + " <= " + lastVis);
- },
-
- /**
- * @return The dialog's duration dropdown
- */
- getDurationDropdown: function () {
- return this.win.document.getElementById("sanitizeDurationChoice");
- },
-
- /**
- * @return The grippy row index
- */
- getGrippyRow: function () {
- return this.win.gContiguousSelectionTreeHelper.getGrippyRow();
- },
-
- /**
- * @return The tree's row count (includes the grippy row)
- */
- getRowCount: function () {
- return this.getTree().view.rowCount;
- },
-
- /**
- * @return The tree
- */
- getTree: function () {
- return this.win.gContiguousSelectionTreeHelper.tree;
- },
-
- /**
- * @return True if the "Everything" warning panel is visible (as opposed to
- * the tree)
- */
- isWarningPanelVisible: function () {
- return this.win.document.getElementById("durationDeck").selectedIndex == 1;
- },
-
- /**
- * @return True if the tree is visible (as opposed to the warning panel)
- */
- isTreeVisible: function () {
- return this.win.document.getElementById("durationDeck").selectedIndex == 0;
- },
-
- /**
- * Moves the grippy one row at a time in the direction and magnitude specified.
- * If aDelta < 0, moves the grippy up; if aDelta > 0, moves it down.
- *
- * @param aDelta
- * The amount and direction to move
- */
- moveGrippyBy: function (aDelta) {
- if (aDelta === 0)
- return;
- let key = aDelta < 0 ? "UP" : "DOWN";
- let abs = Math.abs(aDelta);
- let treechildren = this.getTree().treeBoxObject.treeBody;
- treechildren.focus();
- for (let i = 0; i < abs; i++) {
- EventUtils.sendKey(key);
- }
- },
-
- /**
- * Selects a duration in the duration dropdown.
- *
- * @param aDurVal
- * One of the Sanitizer.TIMESPAN_* values
- */
- selectDuration: function (aDurVal) {
- this.getDurationDropdown().value = aDurVal;
- if (aDurVal === Sanitizer.TIMESPAN_EVERYTHING) {
- is(this.isTreeVisible(), false,
- "Tree should not be visible for TIMESPAN_EVERYTHING");
- is(this.isWarningPanelVisible(), true,
- "Warning panel should be visible for TIMESPAN_EVERYTHING");
- }
- else {
- is(this.isTreeVisible(), true,
- "Tree should be visible for non-TIMESPAN_EVERYTHING");
- is(this.isWarningPanelVisible(), false,
- "Warning panel should not be visible for non-TIMESPAN_EVERYTHING");
- }
- }
-};
-
-/**
- * Adds a download to history.
- *
- * @param aMinutesAgo
- * The download will be downloaded this many minutes ago
- */
-function addDownloadWithMinutesAgo(aMinutesAgo) {
- let name = "fakefile-" + aMinutesAgo + "-minutes-ago";
- let data = {
- id: gDownloadId,
- name: name,
- source: "https://bugzilla.mozilla.org/show_bug.cgi?id=480169",
- target: name,
- startTime: now_uSec - (aMinutesAgo * 60 * 1000000),
- endTime: now_uSec - ((aMinutesAgo + 1) *60 * 1000000),
- state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
- currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0,
- guid: "a1bcD23eF4g5"
- };
-
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "INSERT INTO moz_downloads (id, name, source, target, startTime, endTime, " +
- "state, currBytes, maxBytes, preferredAction, autoResume, guid) " +
- "VALUES (:id, :name, :source, :target, :startTime, :endTime, :state, " +
- ":currBytes, :maxBytes, :preferredAction, :autoResume, :guid)");
- try {
- for (let prop in data) {
- stmt.params[prop] = data[prop];
- }
- stmt.execute();
- }
- finally {
- stmt.reset();
- }
-
- is(downloadExists(gDownloadId), true,
- "Sanity check: download " + gDownloadId +
- " should exist after creating it");
-
- return gDownloadId++;
-}
-
-/**
- * Adds a form entry to history.
- *
- * @param aMinutesAgo
- * The entry will be added this many minutes ago
- */
-function addFormEntryWithMinutesAgo(aMinutesAgo) {
- let name = aMinutesAgo + "-minutes-ago";
- formhist.addEntry(name, "dummy");
-
- // Artifically age the entry to the proper vintage.
- let db = formhist.DBConnection;
- let timestamp = now_uSec - (aMinutesAgo * 60 * 1000000);
- db.executeSimpleSQL("UPDATE moz_formhistory SET firstUsed = " +
- timestamp + " WHERE fieldname = '" + name + "'");
-
- is(formhist.nameExists(name), true,
- "Sanity check: form entry " + name + " should exist after creating it");
- return name;
-}
-
-/**
- * Removes all history visits, downloads, and form entries.
- */
-function blankSlate() {
- PlacesUtils.bhistory.removeAllPages();
- dm.cleanUp();
- formhist.removeAllEntries();
-}
-
-/**
- * Checks to see if the download with the specified ID exists.
- *
- * @param aID
- * The ID of the download to check
- * @return True if the download exists, false otherwise
- */
-function downloadExists(aID)
-{
- let db = dm.DBConnection;
- let stmt = db.createStatement(
- "SELECT * " +
- "FROM moz_downloads " +
- "WHERE id = :id"
- );
- stmt.params.id = aID;
- let rows = stmt.executeStep();
- stmt.finalize();
- return !!rows;
-}
-
-/**
- * Runs the next test in the gAllTests array. If all tests have been run,
- * finishes the entire suite.
- */
-function doNextTest() {
- if (gAllTests.length <= gCurrTest) {
- blankSlate();
- waitForAsyncUpdates(finish);
- }
- else {
- let ct = gCurrTest;
- gCurrTest++;
- gAllTests[ct]();
- }
-}
-
-/**
- * Ensures that the specified downloads are either cleared or not.
- *
- * @param aDownloadIDs
- * Array of download database IDs
- * @param aShouldBeCleared
- * True if each download should be cleared, false otherwise
- */
-function ensureDownloadsClearedState(aDownloadIDs, aShouldBeCleared) {
- let niceStr = aShouldBeCleared ? "no longer" : "still";
- aDownloadIDs.forEach(function (id) {
- is(downloadExists(id), !aShouldBeCleared,
- "download " + id + " should " + niceStr + " exist");
- });
-}
-
-/**
- * Ensures that the specified form entries are either cleared or not.
- *
- * @param aFormEntries
- * Array of form entry names
- * @param aShouldBeCleared
- * True if each form entry should be cleared, false otherwise
- */
-function ensureFormEntriesClearedState(aFormEntries, aShouldBeCleared) {
- let niceStr = aShouldBeCleared ? "no longer" : "still";
- aFormEntries.forEach(function (entry) {
- is(formhist.nameExists(entry), !aShouldBeCleared,
- "form entry " + entry + " should " + niceStr + " exist");
- });
-}
-
-/**
- * Opens the sanitize dialog and runs a callback once it's finished loading.
- *
- * @param aOnloadCallback
- * A function that will be called once the dialog has loaded
- */
-function openWindow(aOnloadCallback) {
- function windowObserver(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
-
- Services.ww.unregisterNotification(windowObserver);
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function onload(event) {
- win.removeEventListener("load", onload, false);
- executeSoon(function () {
- // Some exceptions that reach here don't reach the test harness, but
- // ok()/is() do...
- try {
- Task.spawn(function() {
- aOnloadCallback(win);
- }).then(function() {
- waitForAsyncUpdates(doNextTest);
- });
- }
- catch (exc) {
- win.close();
- ok(false, "Unexpected exception: " + exc + "\n" + exc.stack);
- finish();
- }
- });
- }, false);
- }
- Services.ww.registerNotification(windowObserver);
- Services.ww.openWindow(null,
- "chrome://browser/content/sanitize.xul",
- "Sanitize",
- "chrome,titlebar,dialog,centerscreen,modal",
- null);
-}
-
-/**
- * Creates a visit time.
- *
- * @param aMinutesAgo
- * The visit will be visited this many minutes ago
- */
-function visitTimeForMinutesAgo(aMinutesAgo) {
- return now_uSec - (aMinutesAgo * 60 * 1000000);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-function test() {
- blankSlate();
- waitForExplicitFinish();
- // Kick off all the tests in the gAllTests array.
- waitForAsyncUpdates(doNextTest);
-}
diff --git a/browser/base/content/test/browser_save_link-perwindowpb.js b/browser/base/content/test/browser_save_link-perwindowpb.js
deleted file mode 100644
index c44344761..000000000
--- a/browser/base/content/test/browser_save_link-perwindowpb.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var MockFilePicker = SpecialPowers.MockFilePicker;
-MockFilePicker.init(window);
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-
-// Trigger a save of a link in public mode, then trigger an identical save
-// in private mode and ensure that the second request is differentiated from
-// the first by checking that cookies set by the first response are not sent
-// during the second request.
-function triggerSave(aWindow, aCallback) {
- var fileName;
- let testBrowser = aWindow.gBrowser.selectedBrowser;
- // This page sets a cookie if and only if a cookie does not exist yet
- testBrowser.loadURI("http://mochi.test:8888/browser/browser/base/content/test/bug792517-2.html");
- testBrowser.addEventListener("pageshow", function pageShown(event) {
- if (event.target.location == "about:blank")
- return;
- testBrowser.removeEventListener("pageshow", pageShown, false);
-
- executeSoon(function () {
- aWindow.document.addEventListener("popupshown", function(e) contextMenuOpened(aWindow, e), false);
-
- var link = testBrowser.contentDocument.getElementById("fff");
- EventUtils.synthesizeMouseAtCenter(link,
- { type: "contextmenu", button: 2 },
- testBrowser.contentWindow);
- });
- }, false);
-
- function contextMenuOpened(aWindow, event) {
- event.currentTarget.removeEventListener("popupshown", contextMenuOpened, false);
-
- // Create the folder the link will be saved into.
- var destDir = createTemporarySaveDirectory();
- var destFile = destDir.clone();
-
- MockFilePicker.displayDirectory = destDir;
- MockFilePicker.showCallback = function(fp) {
- fileName = fp.defaultString;
- destFile.append (fileName);
- MockFilePicker.returnFiles = [destFile];
- MockFilePicker.filterIndex = 1; // kSaveAsType_URL
- };
-
- mockTransferCallback = function(downloadSuccess) {
- onTransferComplete(aWindow, downloadSuccess, destDir);
- destDir.remove(true);
- ok(!destDir.exists(), "Destination dir should be removed");
- ok(!destFile.exists(), "Destination file should be removed");
- mockTransferCallback = function(){};
- }
-
- // Select "Save Link As" option from context menu
- var saveLinkCommand = aWindow.document.getElementById("context-savelink");
- saveLinkCommand.doCommand();
-
- event.target.hidePopup();
- }
-
- function onTransferComplete(aWindow, downloadSuccess, destDir) {
- ok(downloadSuccess, "Link should have been downloaded successfully");
- aWindow.gBrowser.removeCurrentTab();
-
- executeSoon(function() aCallback());
- }
-}
-
-function test() {
- waitForExplicitFinish();
-
- var windowsToClose = [];
- var gNumSet = 0;
- function testOnWindow(options, callback) {
- var win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- executeSoon(function() callback(win));
- }, false);
- }
-
- mockTransferRegisterer.register();
-
- registerCleanupFunction(function () {
- mockTransferRegisterer.unregister();
- MockFilePicker.cleanup();
- windowsToClose.forEach(function(win) {
- win.close();
- });
- Services.obs.removeObserver(observer, "http-on-modify-request");
- Services.obs.removeObserver(observer, "http-on-examine-response");
- });
-
- function observer(subject, topic, state) {
- if (topic == "http-on-modify-request") {
- onModifyRequest(subject);
- } else if (topic == "http-on-examine-response") {
- onExamineResponse(subject);
- }
- }
-
- function onExamineResponse(subject) {
- let channel = subject.QueryInterface(Ci.nsIHttpChannel);
- if (channel.URI.spec != "http://mochi.test:8888/browser/browser/base/content/test/bug792517.sjs") {
- return;
- }
- try {
- let cookies = channel.getResponseHeader("set-cookie");
- // From browser/base/content/test/bug792715.sjs, we receive a Set-Cookie
- // header with foopy=1 when there are no cookies for that domain.
- is(cookies, "foopy=1", "Cookie should be foopy=1");
- gNumSet += 1;
- } catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) { }
- }
-
- function onModifyRequest(subject) {
- let channel = subject.QueryInterface(Ci.nsIHttpChannel);
- if (channel.URI.spec != "http://mochi.test:8888/browser/browser/base/content/test/bug792517.sjs") {
- return;
- }
- try {
- let cookies = channel.getRequestHeader("cookie");
- // From browser/base/content/test/bug792715.sjs, we should never send a
- // cookie because we are making only 2 requests: one in public mode, and
- // one in private mode.
- throw "We should never send a cookie in this test";
- } catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) { }
- }
-
- Services.obs.addObserver(observer, "http-on-modify-request", false);
- Services.obs.addObserver(observer, "http-on-examine-response", false);
-
- testOnWindow(undefined, function(win) {
- // The first save from a regular window sets a cookie.
- triggerSave(win, function() {
- is(gNumSet, 1, "1 cookie should be set");
-
- // The second save from a private window also sets a cookie.
- testOnWindow({private: true}, function(win) {
- triggerSave(win, function() {
- is(gNumSet, 2, "2 cookies should be set");
- finish();
- });
- });
- });
- });
-}
-
-Cc["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
- this);
-
-function createTemporarySaveDirectory() {
- var saveDir = Cc["@mozilla.org/file/directory_service;1"]
- .getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsIFile);
- saveDir.append("testsavedir");
- if (!saveDir.exists())
- saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
- return saveDir;
-}
diff --git a/browser/base/content/test/browser_save_private_link_perwindowpb.js b/browser/base/content/test/browser_save_private_link_perwindowpb.js
deleted file mode 100644
index 7365ab1b0..000000000
--- a/browser/base/content/test/browser_save_private_link_perwindowpb.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let testURI = "http://mochi.test:8888/browser/browser/base/content/test/bug792517.html";
- let fileName;
- let MockFilePicker = SpecialPowers.MockFilePicker;
- let cache = Cc["@mozilla.org/network/cache-service;1"]
- .getService(Ci.nsICacheService);
-
- function checkDiskCacheFor(filename) {
- let visitor = {
- visitDevice: function(deviceID, deviceInfo) {
- if (deviceID == "disk")
- info(deviceID + " device contains " + deviceInfo.entryCount + " entries");
- return deviceID == "disk";
- },
-
- visitEntry: function(deviceID, entryInfo) {
- info(entryInfo.key);
- is(entryInfo.key.contains(filename), false, "web content present in disk cache");
- }
- };
- cache.visitEntries(visitor);
- }
-
- function contextMenuOpened(aWindow, event) {
- cache.evictEntries(Ci.nsICache.STORE_ANYWHERE);
-
- event.currentTarget.removeEventListener("popupshown", contextMenuOpened);
-
- // Create the folder the image will be saved into.
- var destDir = createTemporarySaveDirectory();
- var destFile = destDir.clone();
-
- MockFilePicker.displayDirectory = destDir;
- MockFilePicker.showCallback = function(fp) {
- fileName = fp.defaultString;
- destFile.append (fileName);
- MockFilePicker.returnFiles = [destFile];
- MockFilePicker.filterIndex = 1; // kSaveAsType_URL
- };
-
- mockTransferCallback = onTransferComplete;
- mockTransferRegisterer.register();
-
- registerCleanupFunction(function () {
- mockTransferRegisterer.unregister();
- MockFilePicker.cleanup();
- destDir.remove(true);
- });
-
- // Select "Save Image As" option from context menu
- var saveVideoCommand = aWindow.document.getElementById("context-saveimage");
- saveVideoCommand.doCommand();
-
- event.target.hidePopup();
- }
-
- function onTransferComplete(downloadSuccess) {
- ok(downloadSuccess, "Image file should have been downloaded successfully");
-
- // Give the request a chance to finish and create a cache entry
- executeSoon(function() {
- checkDiskCacheFor(fileName);
- finish();
- });
- }
-
- function createTemporarySaveDirectory() {
- var saveDir = Cc["@mozilla.org/file/directory_service;1"]
- .getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsIFile);
- saveDir.append("testsavedir");
- if (!saveDir.exists())
- saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
- return saveDir;
- }
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- aWindow.gBrowser.addEventListener("pageshow", function pageShown(event) {
- // If data: -url PAC file isn't loaded soon enough, we may get about:privatebrowsing loaded
- if (event.target.location == "about:blank" ||
- event.target.location == "about:privatebrowsing") {
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- return;
- }
- aWindow.gBrowser.removeEventListener("pageshow", pageShown);
-
- executeSoon(function () {
- aWindow.document.addEventListener("popupshown",
- function(e) contextMenuOpened(aWindow, e), false);
- var img = aWindow.gBrowser.selectedBrowser.contentDocument.getElementById("img");
- EventUtils.synthesizeMouseAtCenter(img,
- { type: "contextmenu", button: 2 },
- aWindow.gBrowser.contentWindow);
- });
- });
- }
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- windowsToClose.push(aWin);
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- // this function is called after calling finish() on the test.
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- MockFilePicker.init(window);
- // then test when on private mode
- testOnWindow({private: true}, function(aWin) {
- doTest(true, aWin, finish);
- });
-}
-
-Cc["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
- this);
diff --git a/browser/base/content/test/browser_save_video.js b/browser/base/content/test/browser_save_video.js
deleted file mode 100644
index fa00ea37b..000000000
--- a/browser/base/content/test/browser_save_video.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var MockFilePicker = SpecialPowers.MockFilePicker;
-MockFilePicker.init(window);
-
-/**
- * TestCase for bug 564387
- * <https://bugzilla.mozilla.org/show_bug.cgi?id=564387>
- */
-function test() {
- waitForExplicitFinish();
- var fileName;
-
- gBrowser.loadURI("http://mochi.test:8888/browser/browser/base/content/test/bug564387.html");
-
- registerCleanupFunction(function () {
- gBrowser.addTab();
- gBrowser.removeCurrentTab();
- });
-
- gBrowser.addEventListener("pageshow", function pageShown(event) {
- if (event.target.location == "about:blank")
- return;
- gBrowser.removeEventListener("pageshow", pageShown);
-
- executeSoon(function () {
- document.addEventListener("popupshown", contextMenuOpened);
-
- var video1 = gBrowser.contentDocument.getElementById("video1");
- EventUtils.synthesizeMouseAtCenter(video1,
- { type: "contextmenu", button: 2 },
- gBrowser.contentWindow);
- });
- });
-
- function contextMenuOpened(event) {
- event.currentTarget.removeEventListener("popupshown", contextMenuOpened);
-
- // Create the folder the video will be saved into.
- var destDir = createTemporarySaveDirectory();
- var destFile = destDir.clone();
-
- MockFilePicker.displayDirectory = destDir;
- MockFilePicker.showCallback = function(fp) {
- fileName = fp.defaultString;
- destFile.append (fileName);
- MockFilePicker.returnFiles = [destFile];
- MockFilePicker.filterIndex = 1; // kSaveAsType_URL
- };
-
- mockTransferCallback = onTransferComplete;
- mockTransferRegisterer.register();
-
- registerCleanupFunction(function () {
- mockTransferRegisterer.unregister();
- MockFilePicker.cleanup();
- destDir.remove(true);
- });
-
- // Select "Save Video As" option from context menu
- var saveVideoCommand = document.getElementById("context-savevideo");
- saveVideoCommand.doCommand();
-
- event.target.hidePopup();
- }
-
- function onTransferComplete(downloadSuccess) {
- ok(downloadSuccess, "Video file should have been downloaded successfully");
-
- is(fileName, "Bug564387-expectedName.ogv",
- "Video file name is correctly retrieved from Content-Disposition http header");
-
- finish();
- }
-}
-
-Cc["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://mochitests/content/browser/toolkit/content/tests/browser/common/mockTransfer.js",
- this);
-
-function createTemporarySaveDirectory() {
- var saveDir = Cc["@mozilla.org/file/directory_service;1"]
- .getService(Ci.nsIProperties)
- .get("TmpD", Ci.nsIFile);
- saveDir.append("testsavedir");
- if (!saveDir.exists())
- saveDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
- return saveDir;
-}
diff --git a/browser/base/content/test/browser_scope.js b/browser/base/content/test/browser_scope.js
deleted file mode 100644
index e4edac1e0..000000000
--- a/browser/base/content/test/browser_scope.js
+++ /dev/null
@@ -1,4 +0,0 @@
-function test() {
- ok(!!gBrowser, "gBrowser exists");
- is(gBrowser, getBrowser(), "both ways of getting tabbrowser work");
-}
diff --git a/browser/base/content/test/browser_selectTabAtIndex.js b/browser/base/content/test/browser_selectTabAtIndex.js
deleted file mode 100644
index e9a32184e..000000000
--- a/browser/base/content/test/browser_selectTabAtIndex.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function test() {
- for (let i = 0; i < 9; i++)
- gBrowser.addTab();
-
- var isLinux = navigator.platform.indexOf("Linux") == 0;
- for (let i = 9; i >= 1; i--) {
- EventUtils.synthesizeKey(i.toString(), { altKey: isLinux, accelKey: !isLinux });
-
- is(gBrowser.tabContainer.selectedIndex, (i == 9 ? gBrowser.tabs.length : i) - 1,
- (isLinux ? "Alt" : "Accel") + "+" + i + " selects expected tab");
- }
-
- gBrowser.selectTabAtIndex(-3);
- is(gBrowser.tabContainer.selectedIndex, gBrowser.tabs.length - 3,
- "gBrowser.selectTabAtIndex(-3) selects expected tab");
-
- for (let i = 0; i < 9; i++)
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_tabDrop.js b/browser/base/content/test/browser_tabDrop.js
deleted file mode 100644
index c159270f3..000000000
--- a/browser/base/content/test/browser_tabDrop.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let newTab = gBrowser.selectedTab = gBrowser.addTab("about:blank", {skipAnimation: true});
- registerCleanupFunction(function () {
- gBrowser.removeTab(newTab);
- });
-
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let ChromeUtils = {};
- scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
- let tabContainer = gBrowser.tabContainer;
- var receivedDropCount = 0;
- function dropListener() {
- receivedDropCount++;
- if (receivedDropCount == triggeredDropCount) {
- is(openedTabs, validDropCount, "correct number of tabs were opened");
- executeSoon(finish);
- }
- }
- tabContainer.addEventListener("drop", dropListener, false);
- registerCleanupFunction(function () {
- tabContainer.removeEventListener("drop", dropListener, false);
- });
-
- var openedTabs = 0;
- function tabOpenListener(e) {
- openedTabs++;
- let tab = e.target;
- executeSoon(function () {
- gBrowser.removeTab(tab);
- });
- }
-
- tabContainer.addEventListener("TabOpen", tabOpenListener, false);
- registerCleanupFunction(function () {
- tabContainer.removeEventListener("TabOpen", tabOpenListener, false);
- });
-
- var triggeredDropCount = 0;
- var validDropCount = 0;
- function drop(text, valid) {
- triggeredDropCount++;
- if (valid)
- validDropCount++;
- executeSoon(function () {
- // A drop type of "link" onto an existing tab would normally trigger a
- // load in that same tab, but tabbrowser code in _getDragTargetTab treats
- // drops on the outer edges of a tab differently (loading a new tab
- // instead). The events created by synthesizeDrop have all of their
- // coordinates set to 0 (screenX/screenY), so they're treated as drops
- // on the outer edge of the tab, thus they open new tabs.
- ChromeUtils.synthesizeDrop(newTab, newTab, [[{type: "text/plain", data: text}]], "link", window);
- });
- }
-
- // Begin and end with valid drops to make sure we wait for all drops before
- // ending the test
- drop("mochi.test/first", true);
- drop("javascript:'bad'");
- drop("jAvascript:'bad'");
- drop("search this", true);
- drop("mochi.test/second", true);
- drop("data:text/html,bad");
- drop("mochi.test/third", true);
-}
diff --git a/browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js b/browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js
deleted file mode 100644
index ef3344842..000000000
--- a/browser/base/content/test/browser_tabMatchesInAwesomebar_perwindowpb.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim:set ts=2 sw=2 sts=2 et:
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URL_BASES = [
- "http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
- "http://example.org/browser/browser/base/content/test/moz.png#tabmatch"
-];
-
-var gController = Cc["@mozilla.org/autocomplete/controller;1"].
- getService(Ci.nsIAutoCompleteController);
-
-var gTabWaitCount = 0;
-var gTabCounter = 0;
-
-var gTestSteps = [
- function() {
- info("Running step 1");
- for (let i = 0; i < 10; i++) {
- let tab = gBrowser.addTab();
- loadTab(tab, TEST_URL_BASES[0] + (++gTabCounter));
- }
- },
- function() {
- info("Running step 2");
- gBrowser.selectTabAtIndex(1);
- gBrowser.removeCurrentTab();
- gBrowser.selectTabAtIndex(1);
- gBrowser.removeCurrentTab();
- for (let i = 1; i < gBrowser.tabs.length; i++)
- loadTab(gBrowser.tabs[i], TEST_URL_BASES[1] + (++gTabCounter));
- },
- function() {
- info("Running step 3");
- for (let i = 1; i < gBrowser.tabs.length; i++)
- loadTab(gBrowser.tabs[i], TEST_URL_BASES[0] + gTabCounter);
- },
- function() {
- info("Running step 4 - ensure we don't register subframes as open pages");
- let tab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", function () {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- // Start the sub-document load.
- executeSoon(function () {
- tab.linkedBrowser.addEventListener("load", function (e) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- ensure_opentabs_match_db(nextStep);
- }, true);
- tab.linkedBrowser.contentDocument.querySelector("iframe").src = "http://test2.example.org/";
- });
- }, true);
- tab.linkedBrowser.loadURI('data:text/html,<body><iframe src=""></iframe></body>');
- },
- function() {
- info("Running step 5 - remove tab immediately");
- let tab = gBrowser.addTab("about:logo");
- gBrowser.removeTab(tab);
- ensure_opentabs_match_db(nextStep);
- },
- function() {
- info("Running step 6 - check swapBrowsersAndCloseOther preserves registered switch-to-tab result");
- let tabToKeep = gBrowser.addTab();
- let tab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", function () {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- gBrowser.swapBrowsersAndCloseOther(tabToKeep, tab);
- ensure_opentabs_match_db(function () {
- gBrowser.removeTab(tabToKeep);
- ensure_opentabs_match_db(nextStep);
- });
- }, true);
- tab.linkedBrowser.loadURI("about:mozilla");
- },
- function() {
- info("Running step 7 - close all tabs");
-
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
-
- gBrowser.addTab("about:blank", {skipAnimation: true});
- while (gBrowser.tabs.length > 1) {
- info("Removing tab: " + gBrowser.tabs[0].linkedBrowser.currentURI.spec);
- gBrowser.selectTabAtIndex(0);
- gBrowser.removeCurrentTab();
- }
- ensure_opentabs_match_db(nextStep);
- }
-];
-
-
-
-function test() {
- waitForExplicitFinish();
- nextStep();
-}
-
-function loadTab(tab, url) {
- // Because adding visits is async, we will not be notified immediately.
- let visited = false;
- let loaded = false;
-
- function maybeCheckResults() {
- if (visited && loaded && --gTabWaitCount == 0) {
- ensure_opentabs_match_db(nextStep);
- }
- }
-
- tab.linkedBrowser.addEventListener("load", function () {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- loaded = true;
- maybeCheckResults();
- }, true);
-
- if (!visited) {
- Services.obs.addObserver(
- function (aSubject, aTopic, aData) {
- if (url != aSubject.QueryInterface(Ci.nsIURI).spec)
- return;
- Services.obs.removeObserver(arguments.callee, aTopic);
- visited = true;
- maybeCheckResults();
- },
- "uri-visit-saved",
- false
- );
- }
-
- gTabWaitCount++;
- info("Loading page: " + url);
- tab.linkedBrowser.loadURI(url);
-}
-
-function waitForRestoredTab(tab) {
- gTabWaitCount++;
-
- tab.linkedBrowser.addEventListener("load", function () {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- if (--gTabWaitCount == 0) {
- ensure_opentabs_match_db(nextStep);
- }
- }, true);
-}
-
-
-function nextStep() {
- if (gTestSteps.length == 0) {
- while (gBrowser.tabs.length > 1) {
- gBrowser.selectTabAtIndex(1);
- gBrowser.removeCurrentTab();
- }
-
- waitForClearHistory(finish);
-
- return;
- }
-
- var stepFunc = gTestSteps.shift();
- stepFunc();
-}
-
-function ensure_opentabs_match_db(aCallback) {
- var tabs = {};
-
- var winEnum = Services.wm.getEnumerator("navigator:browser");
- while (winEnum.hasMoreElements()) {
- let browserWin = winEnum.getNext();
- // skip closed-but-not-destroyed windows
- if (browserWin.closed)
- continue;
-
- for (let i = 0; i < browserWin.gBrowser.tabContainer.childElementCount; i++) {
- let browser = browserWin.gBrowser.getBrowserAtIndex(i);
- let url = browser.currentURI.spec;
- if (browserWin.isBlankPageURL(url))
- continue;
- if (!(url in tabs))
- tabs[url] = 1;
- else
- tabs[url]++;
- }
- }
-
- checkAutocompleteResults(tabs, aCallback);
-}
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
-
- PlacesUtils.bhistory.removeAllPages();
-}
-
-function checkAutocompleteResults(aExpected, aCallback)
-{
- gController.input = {
- timeout: 10,
- textValue: "",
- searches: ["history"],
- searchParam: "enable-actions",
- popupOpen: false,
- minResultsForPopup: 0,
- invalidate: function() {},
- disableAutoComplete: false,
- completeDefaultIndex: false,
- get popup() { return this; },
- onSearchBegin: function() {},
- onSearchComplete: function ()
- {
- info("Found " + gController.matchCount + " matches.");
- // Check to see the expected uris and titles match up (in any order)
- for (let i = 0; i < gController.matchCount; i++) {
- let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
-
- info("Search for '" + uri + "' in open tabs.");
- let expected = uri in aExpected;
- ok(expected, uri + " was found in autocomplete, was " + (expected ? "" : "not ") + "expected");
- // Remove the found entry from expected results.
- delete aExpected[uri];
- }
-
- // Make sure there is no reported open page that is not open.
- for (let entry in aExpected) {
- ok(false, "'" + entry + "' should be found in autocomplete");
- }
-
- executeSoon(aCallback);
- },
- setSelectedIndex: function() {},
- get searchCount() { return this.searches.length; },
- getSearchAt: function(aIndex) this.searches[aIndex],
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIAutoCompleteInput,
- Ci.nsIAutoCompletePopup,
- ])
- };
-
- info("Searching open pages.");
- gController.startSearch(Services.prefs.getCharPref("browser.urlbar.restrict.openpage"));
-}
diff --git a/browser/base/content/test/browser_tab_drag_drop_perwindow.js b/browser/base/content/test/browser_tab_drag_drop_perwindow.js
deleted file mode 100644
index f787ae860..000000000
--- a/browser/base/content/test/browser_tab_drag_drop_perwindow.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- //initialization
- waitForExplicitFinish();
-
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let ChromeUtils = {};
- scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
- function testOnWindow(aIsPrivate, aCallback) {
- whenNewWindowLoaded({private: aIsPrivate}, function(win) {
- executeSoon(function() aCallback(win));
- });
- }
-
- testOnWindow(false, function(aNormalWindow) {
- testOnWindow(true, function(aPrivateWindow) {
- // Open a tab in each window
- let normalTab = aNormalWindow.gBrowser.addTab("about:blank", {skipAnimation: true});
- let privateTab = aPrivateWindow.gBrowser.addTab("about:blank", {skipAnimation: true});
-
- let effect = ChromeUtils.synthesizeDrop(normalTab, privateTab,
- [[{type: TAB_DROP_TYPE, data: normalTab}]],
- null, aNormalWindow, aPrivateWindow);
- is(effect, "none", "Should not be able to drag a normal tab to a private window");
-
- effect = ChromeUtils.synthesizeDrop(privateTab, normalTab,
- [[{type: TAB_DROP_TYPE, data: privateTab}]],
- null, aPrivateWindow, aNormalWindow);
- is(effect, "none", "Should not be able to drag a private tab to a normal window");
-
- aNormalWindow.gBrowser.swapBrowsersAndCloseOther(normalTab, privateTab);
- is(aNormalWindow.gBrowser.tabs.length, 2, "Prevent moving a normal tab to a private tabbrowser");
- is(aPrivateWindow.gBrowser.tabs.length, 2, "Prevent accepting a normal tab in a private tabbrowser");
-
- aPrivateWindow.gBrowser.swapBrowsersAndCloseOther(privateTab, normalTab);
- is(aPrivateWindow.gBrowser.tabs.length, 2, "Prevent moving a private tab to a normal tabbrowser");
- is(aNormalWindow.gBrowser.tabs.length, 2, "Prevent accepting a private tab in a normal tabbrowser");
-
- aNormalWindow.close();
- aPrivateWindow.close();
- finish();
- });
- });
-}
-
diff --git a/browser/base/content/test/browser_tab_dragdrop.js b/browser/base/content/test/browser_tab_dragdrop.js
deleted file mode 100644
index 04e4acdd7..000000000
--- a/browser/base/content/test/browser_tab_dragdrop.js
+++ /dev/null
@@ -1,118 +0,0 @@
-function test()
-{
- var embed = '<embed type="application/x-test" allowscriptaccess="always" allowfullscreen="true" wmode="window" width="640" height="480"></embed>'
-
- waitForExplicitFinish();
-
- // create a few tabs
- var tabs = [
- gBrowser.tabs[0],
- gBrowser.addTab("about:blank", {skipAnimation: true}),
- gBrowser.addTab("about:blank", {skipAnimation: true}),
- gBrowser.addTab("about:blank", {skipAnimation: true}),
- gBrowser.addTab("about:blank", {skipAnimation: true})
- ];
-
- function setLocation(i, url) {
- gBrowser.getBrowserForTab(tabs[i]).contentWindow.location = url;
- }
- function moveTabTo(a, b) {
- gBrowser.swapBrowsersAndCloseOther(gBrowser.tabs[b], gBrowser.tabs[a]);
- }
- function clickTest(doc, win) {
- var clicks = doc.defaultView.clicks;
- EventUtils.synthesizeMouseAtCenter(doc.body, {}, win);
- is(doc.defaultView.clicks, clicks+1, "adding 1 more click on BODY");
- }
- function test1() {
- moveTabTo(2, 3); // now: 0 1 2 4
- is(gBrowser.tabs[1], tabs[1], "tab1");
- is(gBrowser.tabs[2], tabs[3], "tab3");
-
- var plugin = gBrowser.getBrowserForTab(tabs[4]).docShell.contentViewer.DOMDocument.wrappedJSObject.body.firstChild;
- var tab4_plugin_object = plugin.getObjectValue();
-
- gBrowser.selectedTab = gBrowser.tabs[2];
- moveTabTo(3, 2); // now: 0 1 4
- gBrowser.selectedTab = tabs[4];
- var doc = gBrowser.getBrowserForTab(gBrowser.tabs[2]).docShell.contentViewer.DOMDocument.wrappedJSObject;
- plugin = doc.body.firstChild;
- ok(plugin && plugin.checkObjectValue(tab4_plugin_object), "same plugin instance");
- is(gBrowser.tabs[1], tabs[1], "tab1");
- is(gBrowser.tabs[2], tabs[3], "tab4");
- is(doc.defaultView.clicks, 0, "no click on BODY so far");
- clickTest(doc, window);
-
- moveTabTo(2, 1); // now: 0 4
- is(gBrowser.tabs[1], tabs[1], "tab1");
- doc = gBrowser.getBrowserForTab(gBrowser.tabs[1]).docShell.contentViewer.DOMDocument.wrappedJSObject;
- plugin = doc.body.firstChild;
- ok(plugin && plugin.checkObjectValue(tab4_plugin_object), "same plugin instance");
- clickTest(doc, window);
-
- // Load a new document (about:blank) in tab4, then detach that tab into a new window.
- // In the new window, navigate back to the original document and click on its <body>,
- // verify that its onclick was called.
- var t = tabs[1];
- var b = gBrowser.getBrowserForTab(t);
- gBrowser.selectedTab = t;
- b.addEventListener("load", function() {
- b.removeEventListener("load", arguments.callee, true);
-
- executeSoon(function () {
- var win = gBrowser.replaceTabWithWindow(t);
- whenDelayedStartupFinished(win, function () {
- // Verify that the original window now only has the initial tab left in it.
- is(gBrowser.tabs[0], tabs[0], "tab0");
- is(gBrowser.getBrowserForTab(gBrowser.tabs[0]).contentWindow.location, "about:blank", "tab0 uri");
-
- executeSoon(function () {
- win.gBrowser.addEventListener("pageshow", function () {
- win.gBrowser.removeEventListener("pageshow", arguments.callee, false);
- executeSoon(function () {
- t = win.gBrowser.tabs[0];
- b = win.gBrowser.getBrowserForTab(t);
- var doc = b.docShell.contentViewer.DOMDocument.wrappedJSObject;
- clickTest(doc, win);
- win.close();
- finish();
- });
- }, false);
- win.gBrowser.goBack();
- });
- });
- });
- }, true);
- b.loadURI("about:blank");
-
- }
-
- var loads = 0;
- function waitForLoad(event, tab, listenerContainer) {
- var b = gBrowser.getBrowserForTab(gBrowser.tabs[tab]);
- if (b.contentDocument != event.target) {
- return;
- }
- gBrowser.getBrowserForTab(gBrowser.tabs[tab]).removeEventListener("load", listenerContainer.listener, true);
- ++loads;
- if (loads == tabs.length - 1) {
- executeSoon(test1);
- }
- }
-
- function fn(f, arg) {
- var listenerContainer = { listener: null }
- listenerContainer.listener = function (event) { return f(event, arg, listenerContainer); };
- return listenerContainer.listener;
- }
- for (var i = 1; i < tabs.length; ++i) {
- gBrowser.getBrowserForTab(tabs[i]).addEventListener("load", fn(waitForLoad,i), true);
- }
-
- setLocation(1, "data:text/html;charset=utf-8,<title>tab1</title><body>tab1<iframe>");
- setLocation(2, "data:text/plain;charset=utf-8,tab2");
- setLocation(3, "data:text/html;charset=utf-8,<title>tab3</title><body>tab3<iframe>");
- setLocation(4, "data:text/html;charset=utf-8,<body onload='clicks=0' onclick='++clicks'>"+embed);
- gBrowser.selectedTab = tabs[3];
-
-}
diff --git a/browser/base/content/test/browser_tab_dragdrop2.js b/browser/base/content/test/browser_tab_dragdrop2.js
deleted file mode 100644
index e2f293e85..000000000
--- a/browser/base/content/test/browser_tab_dragdrop2.js
+++ /dev/null
@@ -1,52 +0,0 @@
-function test()
-{
- waitForExplicitFinish();
-
- var level1 = false;
- var level2 = false;
- function test1() {
- // Load the following URI (which runs some child popup tests) in a new window (B),
- // then add a blank tab to B and call replaceTabWithWindow to detach the URI tab
- // into yet a new window (C), then close B.
- // Now run the tests again and then close C.
- // The test results does not matter, all this is just to exercise some code to
- // catch assertions or crashes.
- var chromeroot = getRootDirectory(gTestPath);
- var uri = chromeroot + "browser_tab_dragdrop2_frame1.xul";
- let window_B = openDialog(location, "_blank", "chrome,all,dialog=no,left=200,top=200,width=200,height=200", uri);
- window_B.addEventListener("load", function(aEvent) {
- window_B.removeEventListener("load", arguments.callee, false);
- if (level1) return; level1=true;
- executeSoon(function () {
- window_B.gBrowser.addEventListener("load", function(aEvent) {
- window_B.removeEventListener("load", arguments.callee, true);
- if (level2) return; level2=true;
- is(window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location, uri, "sanity check");
- //alert("1:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
- var windowB_tab2 = window_B.gBrowser.addTab("about:blank", {skipAnimation: true});
- setTimeout(function () {
- //alert("2:"+window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
- window_B.gBrowser.addEventListener("pagehide", function(aEvent) {
- window_B.gBrowser.removeEventListener("pagehide", arguments.callee, true);
- executeSoon(function () {
- // alert("closing window_B which has "+ window_B.gBrowser.tabs.length+" tabs\n"+
- // window_B.gBrowser.getBrowserForTab(window_B.gBrowser.tabs[0]).contentWindow.location);
- window_B.close();
-
- var doc = window_C.gBrowser.getBrowserForTab(window_C.gBrowser.tabs[0])
- .docShell.contentViewer.DOMDocument;
- var calls = doc.defaultView.test_panels();
- window_C.close();
- finish();
- });
- }, true);
- window_B.gBrowser.selectedTab = window_B.gBrowser.tabs[0];
- var window_C = window_B.gBrowser.replaceTabWithWindow(window_B.gBrowser.tabs[0]);
- }, 1000); // 1 second to allow the tests to create the popups
- }, true);
- });
- }, false);
- }
-
- test1();
-}
diff --git a/browser/base/content/test/browser_tab_dragdrop2_frame1.xul b/browser/base/content/test/browser_tab_dragdrop2_frame1.xul
deleted file mode 100644
index ee3e62646..000000000
--- a/browser/base/content/test/browser_tab_dragdrop2_frame1.xul
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-<!--
- XUL Widget Test for panels
- -->
-<window title="Titlebar" width="200" height="200"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
-
-<tree id="tree" seltype="single" width="100" height="100">
- <treecols>
- <treecol flex="1"/>
- <treecol flex="1"/>
- </treecols>
- <treechildren id="treechildren">
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem>
- </treechildren>
-</tree>
-
-
- <!-- test results are displayed in the html:body -->
- <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
-
- <!-- test code goes here -->
- <script type="application/javascript"><![CDATA[
-
-SimpleTest.waitForExplicitFinish();
-
-var currentTest = null;
-
-var i = 0;
-var my_debug = false;
-function test_panels()
-{
- checkTreeCoords();
-
- addEventListener("popupshown", popupShown, false);
- addEventListener("popuphidden", nextTest, false);
- return nextTest();
-}
-
-function nextTest()
-{
- ok(true,"popuphidden " + i)
- if (i == tests.length) {
- return i;
- }
-
- currentTest = tests[i];
- var panel = createPanel(currentTest.attrs);
- currentTest.test(panel);
- return i;
-}
-
-var waitSteps = 0;
-function popupShown(event)
-{
- var panel = event.target;
- if (waitSteps > 0 && navigator.platform.indexOf("Linux") >= 0 &&
- panel.boxObject.screenY == 210) {
- waitSteps--;
- setTimeout(popupShown, 10, event);
- return;
- }
- ++i;
-
- currentTest.result(currentTest.testname + " ", panel);
- panel.hidePopup();
-}
-
-function createPanel(attrs)
-{
- var panel = document.createElement("panel");
- for (var a in attrs) {
- panel.setAttribute(a, attrs[a]);
- }
-
- var button = document.createElement("button");
- panel.appendChild(button);
- button.label = "OK";
- button.width = 120;
- button.height = 40;
- button.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0;");
- panel.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0;");
- return document.documentElement.appendChild(panel);
-}
-
-function checkTreeCoords()
-{
- var tree = $("tree");
- var treechildren = $("treechildren");
- tree.currentIndex = 0;
- tree.treeBoxObject.scrollToRow(0);
- synthesizeMouse(treechildren, 10, tree.treeBoxObject.rowHeight + 2, { });
-
- tree.treeBoxObject.scrollToRow(2);
- synthesizeMouse(treechildren, 10, tree.treeBoxObject.rowHeight + 2, { });
-}
-
-var tests = [
- {
- testname: "normal panel",
- attrs: { },
- test: function(panel) {
- panel.openPopupAtScreen(200, 210);
- },
- result: function(testname, panel) {
- if (my_debug) alert(testname);
- var panelrect = panel.getBoundingClientRect();
- }
- },
- {
- // only noautohide panels support titlebars, so one shouldn't be shown here
- testname: "autohide panel with titlebar",
- attrs: { titlebar: "normal" },
- test: function(panel) {
- panel.openPopupAtScreen(200, 210);
- },
- result: function(testname, panel) {
- if (my_debug) alert(testname);
- var panelrect = panel.getBoundingClientRect();
- }
- },
- {
- testname: "noautohide panel with titlebar",
- attrs: { noautohide: true, titlebar: "normal" },
- test: function(panel) {
- waitSteps = 25;
- panel.openPopupAtScreen(200, 210);
- },
- result: function(testname, panel) {
- if (my_debug) alert(testname);
- var panelrect = panel.getBoundingClientRect();
-
- var gotMouseEvent = false;
- function mouseMoved(event)
- {
- gotMouseEvent = true;
- }
-
- panel.addEventListener("mousemove", mouseMoved, true);
- synthesizeMouse(panel, 10, 10, { type: "mousemove" });
- panel.removeEventListener("mousemove", mouseMoved, true);
-
- var tree = $("tree");
- tree.currentIndex = 0;
- panel.appendChild(tree);
- checkTreeCoords();
- }
- }
-];
-
-SimpleTest.waitForFocus(test_panels);
-
-]]>
-</script>
-
-</window>
diff --git a/browser/base/content/test/browser_tabfocus.js b/browser/base/content/test/browser_tabfocus.js
deleted file mode 100644
index 289c83c89..000000000
--- a/browser/base/content/test/browser_tabfocus.js
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * This test checks that focus is adjusted properly when switching tabs.
- */
-
-let testPage1 = "data:text/html,<html id='tab1'><body><button id='button1'>Tab 1</button></body></html>";
-let testPage2 = "data:text/html,<html id='tab2'><body><button id='button2'>Tab 2</button></body></html>";
-let testPage3 = "data:text/html,<html id='tab3'><body><button id='button3'>Tab 3</button></body></html>";
-
-function test() {
- waitForExplicitFinish();
-
- var tab1 = gBrowser.addTab();
- var browser1 = gBrowser.getBrowserForTab(tab1);
-
- var tab2 = gBrowser.addTab();
- var browser2 = gBrowser.getBrowserForTab(tab2);
-
- gURLBar.focus();
-
- var loadCount = 0;
- function check()
- {
- // wait for both tabs to load
- if (++loadCount != 2)
- return;
-
- browser1.removeEventListener("load", check, true);
- browser2.removeEventListener("load", check, true);
- executeSoon(_run_focus_tests);
- }
-
- function _run_focus_tests() {
- window.focus();
-
- _browser_tabfocus_test_lastfocus = gURLBar;
- _browser_tabfocus_test_lastfocuswindow = window;
-
- window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
- window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
-
- // make sure that the focus initially starts out blank
- var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
- var focusedWindow = {};
- is(fm.getFocusedElementForWindow(browser1.contentWindow, false, focusedWindow), null, "initial focus in tab 1");
- is(focusedWindow.value, browser1.contentWindow, "initial frame focus in tab 1");
- is(fm.getFocusedElementForWindow(browser2.contentWindow, false, focusedWindow), null, "initial focus in tab 2");
- is(focusedWindow.value, browser2.contentWindow, "initial frame focus in tab 2");
-
- expectFocusShift(function () gBrowser.selectedTab = tab2,
- browser2.contentWindow, null, true,
- "focusedElement after tab change, focus in new tab");
-
- // switching tabs when nothing in the new tab is focused
- // should focus the browser
- expectFocusShift(function () gBrowser.selectedTab = tab1,
- browser1.contentWindow, null, true,
- "focusedElement after tab change, focus in new tab");
-
- // focusing a button in the current tab should focus it
- var button1 = browser1.contentDocument.getElementById("button1");
- expectFocusShift(function () button1.focus(),
- browser1.contentWindow, button1, true,
- "focusedWindow after focus in focused tab");
-
- // focusing a button in a background tab should not change the actual
- // focus, but should set the focus that would be in that background tab to
- // that button.
- var button2 = browser2.contentDocument.getElementById("button2");
- button2.focus();
-
- expectFocusShift(function () button2.focus(),
- browser1.contentWindow, button1, false,
- "focusedWindow after focus in unfocused tab");
- is(fm.getFocusedElementForWindow(browser2.contentWindow, false, {}), button2, "focus in unfocused tab");
-
- // switching tabs should now make the button in the other tab focused
- expectFocusShift(function () gBrowser.selectedTab = tab2,
- browser2.contentWindow, button2, true,
- "focusedWindow after tab change");
-
- // blurring an element in a background tab should not change the active
- // focus, but should clear the focus in that tab.
- expectFocusShift(function () button1.blur(),
- browser2.contentWindow, button2, false,
- "focusedWindow after blur in unfocused tab");
- is(fm.getFocusedElementForWindow(browser1.contentWindow, false, {}), null, "blur in unfocused tab");
-
- // When focus is in the tab bar, it should be retained there
- expectFocusShift(function () gBrowser.selectedTab.focus(),
- window, gBrowser.selectedTab, true,
- "focusing tab element");
- expectFocusShift(function () gBrowser.selectedTab = tab1,
- window, tab1, true,
- "tab change when selected tab element was focused");
- expectFocusShift(function () gBrowser.selectedTab = tab2,
- window, tab2, true,
- "tab change when selected tab element was focused");
- expectFocusShift(function () gBrowser.selectedTab.blur(),
- window, null, true,
- "blurring tab element");
-
- // focusing the url field should switch active focus away from the browser but
- // not clear what would be the focus in the browser
- button1.focus();
- expectFocusShift(function () gURLBar.focus(),
- window, gURLBar.inputField, true,
- "focusedWindow after url field focused");
- is(fm.getFocusedElementForWindow(browser2.contentWindow, false, {}), button2, "url field focused, button in browser");
- expectFocusShift(function () gURLBar.blur(),
- window, null, true,
- "blurring url field");
-
- // when a chrome element is focused, switching tabs to a tab with a button
- // with the current focus should focus the button
- expectFocusShift(function () gBrowser.selectedTab = tab1,
- browser1.contentWindow, button1, true,
- "focusedWindow after tab change, focus in url field, button focused in new tab");
- is(fm.getFocusedElementForWindow(browser2.contentWindow, false, {}), button2, "after switch tab, focus in unfocused tab");
-
- // blurring an element in the current tab should clear the active focus
- expectFocusShift(function () button1.blur(),
- browser1.contentWindow, null, true,
- "focusedWindow after blur in focused tab");
-
- // blurring an non-focused url field should have no effect
- expectFocusShift(function () gURLBar.blur(),
- browser1.contentWindow, null, false,
- "focusedWindow after blur in unfocused url field");
-
- // switch focus to a tab with a currently focused element
- expectFocusShift(function () gBrowser.selectedTab = tab2,
- browser2.contentWindow, button2, true,
- "focusedWindow after switch from unfocused to focused tab");
-
- // clearing focus on the chrome window should switch the focus to the
- // chrome window
- expectFocusShift(function () fm.clearFocus(window),
- window, null, true,
- "focusedWindow after switch to chrome with no focused element");
-
- // switch focus to another tab when neither have an active focus
- expectFocusShift(function () gBrowser.selectedTab = tab1,
- browser1.contentWindow, null, true,
- "focusedWindow after tab switch from no focus to no focus");
-
- gURLBar.focus();
- _browser_tabfocus_test_events = "";
- _browser_tabfocus_test_lastfocus = gURLBar;
- _browser_tabfocus_test_lastfocuswindow = window;
-
- expectFocusShift(function () EventUtils.synthesizeKey("VK_F6", { }),
- browser1.contentWindow, browser1.contentDocument.documentElement,
- true, "switch document forward with f6");
- EventUtils.synthesizeKey("VK_F6", { });
- is(fm.focusedWindow, window, "switch document forward again with f6");
-
- browser1.style.MozUserFocus = "ignore";
- browser1.clientWidth;
- EventUtils.synthesizeKey("VK_F6", { });
- is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
-
- window.removeEventListener("focus", _browser_tabfocus_test_eventOccured, true);
- window.removeEventListener("blur", _browser_tabfocus_test_eventOccured, true);
-
- // next, check whether navigating forward, focusing the urlbar and then
- // navigating back maintains the focus in the urlbar.
- browser1.addEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
- button1.focus();
- browser1.contentWindow.location = testPage3;
- }
-
- browser1.addEventListener("load", check, true);
- browser2.addEventListener("load", check, true);
- browser1.contentWindow.location = testPage1;
- browser2.contentWindow.location = testPage2;
-}
-
-var _browser_tabfocus_test_lastfocus;
-var _browser_tabfocus_test_lastfocuswindow = null;
-var _browser_tabfocus_test_events = "";
-
-function _browser_tabfocus_test_eventOccured(event)
-{
- var id;
- if (event.target instanceof Window)
- id = event.originalTarget.document.documentElement.id + "-window";
- else if (event.target instanceof Document)
- id = event.originalTarget.documentElement.id + "-document";
- else if (event.target.id == "urlbar" && event.originalTarget.localName == "input")
- id = "urlbar";
- else
- id = event.originalTarget.id;
-
- if (_browser_tabfocus_test_events)
- _browser_tabfocus_test_events += " ";
- _browser_tabfocus_test_events += event.type + ": " + id;
-}
-
-function _browser_tabfocus_navigation_test_eventOccured(event)
-{
- if (event.target instanceof Document) {
- var contentwin = event.target.defaultView;
- if (contentwin.location.toString().indexOf("3") > 0) {
- // just moved forward, so focus the urlbar and go back
- gURLBar.focus();
- setTimeout(function () contentwin.history.back(), 0);
- }
- else if (contentwin.location.toString().indexOf("2") > 0) {
- event.currentTarget.removeEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
- is(window.document.activeElement, gURLBar.inputField, "urlbar still focused after navigating back");
- gBrowser.removeCurrentTab();
- gBrowser.removeCurrentTab();
- finish();
- }
- }
-}
-
-function getId(element)
-{
- return (element.localName == "input") ? "urlbar" : element.id;
-}
-
-function expectFocusShift(callback, expectedWindow, expectedElement, focusChanged, testid)
-{
- var expectedEvents = "";
- if (focusChanged) {
- if (_browser_tabfocus_test_lastfocus)
- expectedEvents += "blur: " + getId(_browser_tabfocus_test_lastfocus);
-
- if (_browser_tabfocus_test_lastfocuswindow &&
- _browser_tabfocus_test_lastfocuswindow != expectedWindow) {
- if (expectedEvents)
- expectedEvents += " ";
- var windowid = _browser_tabfocus_test_lastfocuswindow.document.documentElement.id;
- expectedEvents += "blur: " + windowid + "-document " +
- "blur: " + windowid + "-window";
- }
-
- if (expectedWindow && _browser_tabfocus_test_lastfocuswindow != expectedWindow) {
- if (expectedEvents)
- expectedEvents += " ";
- var windowid = expectedWindow.document.documentElement.id;
- expectedEvents += "focus: " + windowid + "-document " +
- "focus: " + windowid + "-window";
- }
-
- if (expectedElement && expectedElement != expectedElement.ownerDocument.documentElement) {
- if (expectedEvents)
- expectedEvents += " ";
- expectedEvents += "focus: " + getId(expectedElement);
- }
-
- _browser_tabfocus_test_lastfocus = expectedElement;
- _browser_tabfocus_test_lastfocuswindow = expectedWindow;
- }
-
- callback();
-
- is(_browser_tabfocus_test_events, expectedEvents, testid + " events");
- _browser_tabfocus_test_events = "";
-
- var fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
-
- var focusedElement = fm.focusedElement;
- is(focusedElement ? getId(focusedElement) : "none",
- expectedElement ? getId(expectedElement) : "none", testid + " focusedElement");
- is(fm.focusedWindow, expectedWindow, testid + " focusedWindow");
- var focusedWindow = {};
- is(fm.getFocusedElementForWindow(expectedWindow, false, focusedWindow),
- expectedElement, testid + " getFocusedElementForWindow");
- is(focusedWindow.value, expectedWindow, testid + " getFocusedElementForWindow frame");
- is(expectedWindow.document.hasFocus(), true, testid + " hasFocus");
- var expectedActive = expectedElement;
- if (!expectedActive)
- expectedActive = expectedWindow.document instanceof XULDocument ?
- expectedWindow.document.documentElement : expectedWindow.document.body;
- is(expectedWindow.document.activeElement, expectedActive, testid + " activeElement");
-}
diff --git a/browser/base/content/test/browser_tabopen_reflows.js b/browser/base/content/test/browser_tabopen_reflows.js
deleted file mode 100644
index d28c6304a..000000000
--- a/browser/base/content/test/browser_tabopen_reflows.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-XPCOMUtils.defineLazyGetter(this, "docShell", () => {
- return window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsIDocShell);
-});
-
-const EXPECTED_REFLOWS = [
- // tabbrowser.adjustTabstrip() call after tabopen animation has finished
- "adjustTabstrip@chrome://browser/content/tabbrowser.xml|" +
- "_handleNewTab@chrome://browser/content/tabbrowser.xml|" +
- "onxbltransitionend@chrome://browser/content/tabbrowser.xml|",
-
- // switching focus in updateCurrentBrowser() causes reflows
- "updateCurrentBrowser@chrome://browser/content/tabbrowser.xml|" +
- "onselect@chrome://browser/content/browser.xul|",
-
- // switching focus in openLinkIn() causes reflows
- "openLinkIn@chrome://browser/content/utilityOverlay.js|" +
- "openUILinkIn@chrome://browser/content/utilityOverlay.js|" +
- "BrowserOpenTab@chrome://browser/content/browser.js|",
-
- // accessing element.scrollPosition in _fillTrailingGap() flushes layout
- "get_scrollPosition@chrome://global/content/bindings/scrollbox.xml|" +
- "_fillTrailingGap@chrome://browser/content/tabbrowser.xml|" +
- "_handleNewTab@chrome://browser/content/tabbrowser.xml|" +
- "onxbltransitionend@chrome://browser/content/tabbrowser.xml|",
-
- // The TabView iframe causes reflows in the parent document.
- "iQClass_height@chrome://browser/content/tabview.js|" +
- "GroupItem_getContentBounds@chrome://browser/content/tabview.js|" +
- "GroupItem_shouldStack@chrome://browser/content/tabview.js|" +
- "GroupItem_arrange@chrome://browser/content/tabview.js|" +
- "GroupItem_add@chrome://browser/content/tabview.js|" +
- "GroupItems_newTab@chrome://browser/content/tabview.js|" +
- "TabItem__reconnect@chrome://browser/content/tabview.js|" +
- "TabItem@chrome://browser/content/tabview.js|" +
- "TabItems_link@chrome://browser/content/tabview.js|" +
- "@chrome://browser/content/tabview.js|" +
- "addTab@chrome://browser/content/tabbrowser.xml|",
-
- // SessionStore.getWindowDimensions()
- "ssi_getWindowDimension@resource:///modules/sessionstore/SessionStore.jsm|" +
- "@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_updateWindowFeatures@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_collectWindowData@resource:///modules/sessionstore/SessionStore.jsm|" +
- "@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_forEachBrowserWindow@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_getCurrentState@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_saveState@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_onTimerCallback@resource:///modules/sessionstore/SessionStore.jsm|" +
- "ssi_observe@resource:///modules/sessionstore/SessionStore.jsm|",
-
- // tabPreviews.capture()
- "tabPreviews_capture@chrome://browser/content/browser.js|" +
- "tabPreviews_handleEvent/<@chrome://browser/content/browser.js|"
-];
-
-const PREF_PRELOAD = "browser.newtab.preload";
-
-/*
- * This test ensures that there are no unexpected
- * uninterruptible reflows when opening new tabs.
- */
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(PREF_PRELOAD, false);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF_PRELOAD));
-
- // Add a reflow observer and open a new tab.
- docShell.addWeakReflowObserver(observer);
- BrowserOpenTab();
-
- // Wait until the tabopen animation has finished.
- waitForTransitionEnd(function () {
- // Remove reflow observer and clean up.
- docShell.removeWeakReflowObserver(observer);
- gBrowser.removeCurrentTab();
-
- finish();
- });
-}
-
-let observer = {
- reflow: function (start, end) {
- // Gather information about the current code path.
- let path = (new Error().stack).split("\n").slice(1).map(line => {
- return line.replace(/:\d+$/, "");
- }).join("|");
-
- // Stack trace is empty. Reflow was triggered by native code.
- if (path === "") {
- return;
- }
-
- // Check if this is an expected reflow.
- for (let stack of EXPECTED_REFLOWS) {
- if (path.startsWith(stack)) {
- ok(true, "expected uninterruptible reflow '" + stack + "'");
- return;
- }
- }
-
- ok(false, "unexpected uninterruptible reflow '" + path + "'");
- },
-
- reflowInterruptible: function (start, end) {
- // We're not interested in interruptible reflows.
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver,
- Ci.nsISupportsWeakReference])
-};
-
-function waitForTransitionEnd(callback) {
- let tab = gBrowser.selectedTab;
- tab.addEventListener("transitionend", function onEnd(event) {
- if (event.propertyName === "max-width") {
- tab.removeEventListener("transitionend", onEnd);
- executeSoon(callback);
- }
- });
-}
diff --git a/browser/base/content/test/browser_tabs_isActive.js b/browser/base/content/test/browser_tabs_isActive.js
deleted file mode 100644
index 57d86e821..000000000
--- a/browser/base/content/test/browser_tabs_isActive.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- test_tab("about:blank");
- test_tab("about:license");
-}
-
-function test_tab(url) {
- let originalTab = gBrowser.selectedTab;
- let newTab = gBrowser.addTab(url, {skipAnimation: true});
- is(tabIsActive(newTab), false, "newly added " + url + " tab is not active");
- is(tabIsActive(originalTab), true, "original tab is active initially");
-
- gBrowser.selectedTab = newTab;
- is(tabIsActive(newTab), true, "newly added " + url + " tab is active after selection");
- is(tabIsActive(originalTab), false, "original tab is not active while unselected");
-
- gBrowser.selectedTab = originalTab;
- is(tabIsActive(newTab), false, "newly added " + url + " tab is not active after switch back");
- is(tabIsActive(originalTab), true, "original tab is active again after switch back");
-
- gBrowser.removeTab(newTab);
-}
-
-function tabIsActive(tab) {
- let browser = tab.linkedBrowser;
- return browser.docShell.isActive;
-}
diff --git a/browser/base/content/test/browser_tabs_owner.js b/browser/base/content/test/browser_tabs_owner.js
deleted file mode 100644
index d432eab24..000000000
--- a/browser/base/content/test/browser_tabs_owner.js
+++ /dev/null
@@ -1,32 +0,0 @@
-function test() {
- gBrowser.addTab();
- gBrowser.addTab();
- gBrowser.addTab();
-
- var tabs = gBrowser.tabs;
- var owner;
-
- is(tabs.length, 4, "4 tabs are open");
-
- owner = gBrowser.selectedTab = tabs[2];
- BrowserOpenTab();
- is(gBrowser.selectedTab, tabs[4], "newly opened tab is selected");
- gBrowser.removeCurrentTab();
- is(gBrowser.selectedTab, owner, "owner is selected");
-
- owner = gBrowser.selectedTab;
- BrowserOpenTab();
- gBrowser.selectedTab = tabs[1];
- gBrowser.selectedTab = tabs[4];
- gBrowser.removeCurrentTab();
- isnot(gBrowser.selectedTab, owner, "selecting a different tab clears the owner relation");
-
- owner = gBrowser.selectedTab;
- BrowserOpenTab();
- gBrowser.moveTabTo(gBrowser.selectedTab, 0);
- gBrowser.removeCurrentTab();
- is(gBrowser.selectedTab, owner, "owner relatitionship persists when tab is moved");
-
- while (tabs.length > 1)
- gBrowser.removeCurrentTab();
-}
diff --git a/browser/base/content/test/browser_typeAheadFind.js b/browser/base/content/test/browser_typeAheadFind.js
deleted file mode 100644
index 507a63b26..000000000
--- a/browser/base/content/test/browser_typeAheadFind.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let testWindow = null;
-
-function test() {
- waitForExplicitFinish();
-
- testWindow = OpenBrowserWindow();
- whenDelayedStartupFinished(testWindow, function () {
- let selectedBrowser = testWindow.gBrowser.selectedBrowser;
- selectedBrowser.addEventListener("load", function onLoad() {
- selectedBrowser.removeEventListener("load", onLoad, true);
- ok(true, "load listener called");
- waitForFocus(onFocus, testWindow.content);
- }, true);
- testWindow.gBrowser.loadURI("data:text/html,<h1>A Page</h1>");
- });
-}
-
-function onFocus() {
- ok(!testWindow.gFindBarInitialized, "find bar is not initialized");
- EventUtils.synthesizeKey("/", {}, testWindow);
- ok(testWindow.gFindBarInitialized, "find bar is now initialized");
- testWindow.close();
- finish();
-}
diff --git a/browser/base/content/test/browser_unloaddialogs.js b/browser/base/content/test/browser_unloaddialogs.js
deleted file mode 100644
index b8dca5447..000000000
--- a/browser/base/content/test/browser_unloaddialogs.js
+++ /dev/null
@@ -1,134 +0,0 @@
-function notify(event)
-{
- if (event.target.location == "about:blank")
- return;
-
- var eventname = event.type;
- if (eventname == "pagehide")
- details.pagehides++;
- else if (eventname == "beforeunload")
- details.beforeunloads++;
- else if (eventname == "unload")
- details.unloads++;
-}
-
-var details;
-
-var gUseFrame = false;
-
-const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
-
-const TEST_BASE_URL = "data:text/html,<script>" +
- "function note(event) { try { alert(event.type); } catch(ex) { return; } throw 'alert appeared'; }" +
- "</script>" +
- "<body onpagehide='note(event)' onbeforeunload='alert(event.type);' onunload='note(event)'>";
-
-const TEST_URL = TEST_BASE_URL + "Test</body>";
-const TEST_FRAME_URL = TEST_BASE_URL + "Frames</body>";
-
-function test()
-{
- waitForExplicitFinish();
- windowMediator.addListener(promptListener);
- runTest();
-}
-
-function runTest()
-{
- details = {
- testNumber : 0,
- beforeunloads : 0,
- pagehides : 0,
- unloads : 0,
- prompts : 0
- };
-
- var tab = gBrowser.addTab(TEST_URL);
- gBrowser.selectedTab = tab;
- tab.linkedBrowser.addEventListener("pageshow", shown, true);
-
- tab.linkedBrowser.addEventListener("pagehide", notify, true);
- tab.linkedBrowser.addEventListener("beforeunload", notify, true);
- tab.linkedBrowser.addEventListener("unload", notify, true);
-}
-
-function shown(event)
-{
- if (details.testNumber == 0) {
- var browser;
- var iframe;
- if (gUseFrame) {
- iframe = event.target.createElement("iframe");
- iframe.src = TEST_FRAME_URL;
- event.target.documentElement.appendChild(iframe);
- browser = iframe.contentWindow;
- }
- else {
- browser = gBrowser.selectedTab.linkedBrowser;
- details.testNumber = 1; // Move onto to the next step immediately
- }
- }
-
- if (details.testNumber == 1) {
- // Test going to another page
- executeSoon(function () {
- const urlToLoad = "data:text/html,<body>Another Page</body>";
- if (gUseFrame) {
- event.target.location = urlToLoad;
- }
- else {
- gBrowser.selectedBrowser.loadURI(urlToLoad);
- }
- });
- }
- else if (details.testNumber == 2) {
- is(details.pagehides, 1, "pagehides after next page")
- is(details.beforeunloads, 1, "beforeunloads after next page")
- is(details.unloads, 1, "unloads after next page")
- is(details.prompts, 1, "prompts after next page")
-
- executeSoon(function () gUseFrame ? gBrowser.goBack() : event.target.defaultView.back());
- }
- else if (details.testNumber == 3) {
- is(details.pagehides, 2, "pagehides after back")
- is(details.beforeunloads, 2, "beforeunloads after back")
- // No cache, so frame is unloaded
- is(details.unloads, gUseFrame ? 2 : 1, "unloads after back")
- is(details.prompts, 1, "prompts after back")
-
- // Test closing the tab
- gBrowser.selectedBrowser.removeEventListener("pageshow", shown, true);
- gBrowser.removeTab(gBrowser.selectedTab);
-
- // When the frame is present, there is are two beforeunload and prompts,
- // one for the frame and the other for the parent.
- is(details.pagehides, 3, "pagehides after close")
- is(details.beforeunloads, gUseFrame ? 4 : 3, "beforeunloads after close")
- is(details.unloads, gUseFrame ? 3 : 2, "unloads after close")
- is(details.prompts, gUseFrame ? 3 : 2, "prompts after close")
-
- // Now run the test again using a child frame.
- if (gUseFrame) {
- windowMediator.removeListener(promptListener);
- finish();
- }
- else {
- gUseFrame = true;
- runTest();
- }
-
- return;
- }
-
- details.testNumber++;
-}
-
-var promptListener = {
- onWindowTitleChange: function () {},
- onOpenWindow: function (win) {
- details.prompts++;
- let domWin = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
- executeSoon(function () { domWin.close() });
- },
- onCloseWindow: function () {},
-};
diff --git a/browser/base/content/test/browser_urlHighlight.js b/browser/base/content/test/browser_urlHighlight.js
deleted file mode 100644
index 3ab312738..000000000
--- a/browser/base/content/test/browser_urlHighlight.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function testVal(aExpected) {
- gURLBar.value = aExpected.replace(/[<>]/g, "");
-
- let selectionController = gURLBar.editor.selectionController;
- let selection = selectionController.getSelection(selectionController.SELECTION_URLSECONDARY);
- let value = gURLBar.editor.rootElement.textContent;
- let result = "";
- for (let i = 0; i < selection.rangeCount; i++) {
- let range = selection.getRangeAt(i).toString();
- let pos = value.indexOf(range);
- result += value.substring(0, pos) + "<" + range + ">";
- value = value.substring(pos + range.length);
- }
- result += value;
- is(result, aExpected);
-}
-
-function test() {
- const prefname = "browser.urlbar.formatting.enabled";
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(prefname);
- URLBarSetURI();
- });
-
- Services.prefs.setBoolPref(prefname, true);
-
- gURLBar.focus();
-
- testVal("https://mozilla.org");
-
- gBrowser.selectedBrowser.focus();
-
- testVal("<https://>mozilla.org");
- testVal("<https://>mözilla.org");
- testVal("<https://>mozilla.imaginatory");
-
- testVal("<https://www.>mozilla.org");
- testVal("<https://sub.>mozilla.org");
- testVal("<https://sub1.sub2.sub3.>mozilla.org");
- testVal("<www.>mozilla.org");
- testVal("<sub.>mozilla.org");
- testVal("<sub1.sub2.sub3.>mozilla.org");
-
- testVal("<http://ftp.>mozilla.org");
- testVal("<ftp://ftp.>mozilla.org");
-
- testVal("<https://sub.>mozilla.org");
- testVal("<https://sub1.sub2.sub3.>mozilla.org");
- testVal("<https://user:pass@sub1.sub2.sub3.>mozilla.org");
- testVal("<https://user:pass@>mozilla.org");
-
- testVal("<https://>mozilla.org</file.ext>");
- testVal("<https://>mozilla.org</sub/file.ext>");
- testVal("<https://>mozilla.org</sub/file.ext?foo>");
- testVal("<https://>mozilla.org</sub/file.ext?foo&bar>");
- testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
- testVal("<https://>mozilla.org</sub/file.ext?foo&bar#top>");
-
- testVal("<https://sub.>mozilla.org<:666/file.ext>");
- testVal("<sub.>mozilla.org<:666/file.ext>");
- testVal("localhost<:666/file.ext>");
-
- let IPs = ["192.168.1.1",
- "[::]",
- "[::1]",
- "[1::]",
- "[::]",
- "[::1]",
- "[1::]",
- "[1:2:3:4:5:6:7::]",
- "[::1:2:3:4:5:6:7]",
- "[1:2:a:B:c:D:e:F]",
- "[1::8]",
- "[1:2::8]",
- "[fe80::222:19ff:fe11:8c76]",
- "[0000:0123:4567:89AB:CDEF:abcd:ef00:0000]",
- "[::192.168.1.1]",
- "[1::0.0.0.0]",
- "[1:2::255.255.255.255]",
- "[1:2:3::255.255.255.255]",
- "[1:2:3:4::255.255.255.255]",
- "[1:2:3:4:5::255.255.255.255]",
- "[1:2:3:4:5:6:255.255.255.255]"];
- IPs.forEach(function (IP) {
- testVal(IP);
- testVal(IP + "</file.ext>");
- testVal(IP + "<:666/file.ext>");
- testVal("<https://>" + IP);
- testVal("<https://>" + IP + "</file.ext>");
- testVal("<https://user:pass@>" + IP + "<:666/file.ext>");
- testVal("<http://user:pass@>" + IP + "<:666/file.ext>");
- });
-
- testVal("mailto:admin@mozilla.org");
- testVal("gopher://mozilla.org/");
- testVal("about:config");
- testVal("jar:http://mozilla.org/example.jar!/");
- testVal("view-source:http://mozilla.org/");
- testVal("foo9://mozilla.org/");
- testVal("foo+://mozilla.org/");
- testVal("foo.://mozilla.org/");
- testVal("foo-://mozilla.org/");
-
- Services.prefs.setBoolPref(prefname, false);
-
- testVal("https://mozilla.org");
-}
diff --git a/browser/base/content/test/browser_urlbarAutoFillTrimURLs.js b/browser/base/content/test/browser_urlbarAutoFillTrimURLs.js
deleted file mode 100644
index 3219898a9..000000000
--- a/browser/base/content/test/browser_urlbarAutoFillTrimURLs.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test ensures that autoFilled values are not trimmed, unless the user
-// selects from the autocomplete popup.
-
-function test() {
- waitForExplicitFinish();
-
- const PREF_TRIMURL = "browser.urlbar.trimURLs";
- const PREF_AUTOFILL = "browser.urlbar.autoFill";
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_TRIMURL);
- Services.prefs.clearUserPref(PREF_AUTOFILL);
- gURLBar.handleRevert();
- });
- Services.prefs.setBoolPref(PREF_TRIMURL, true);
- Services.prefs.setBoolPref(PREF_AUTOFILL, true);
-
- // Adding a tab would hit switch-to-tab, so it's safer to just add a visit.
- let callback = {
- handleError: function () {},
- handleResult: function () {},
- handleCompletion: continue_test
- };
- let history = Cc["@mozilla.org/browser/history;1"]
- .getService(Ci.mozIAsyncHistory);
- history.updatePlaces({ uri: NetUtil.newURI("http://www.autofilltrimurl.com/")
- , visits: [ { transitionType: Ci.nsINavHistoryService.TRANSITION_TYPED
- , visitDate: Date.now() * 1000
- } ]
- }, callback);
-}
-
-function continue_test() {
- function test_autoFill(aTyped, aExpected, aCallback) {
- gURLBar.inputField.value = aTyped.substr(0, aTyped.length - 1);
- gURLBar.focus();
- gURLBar.selectionStart = aTyped.length - 1;
- gURLBar.selectionEnd = aTyped.length - 1;
-
- EventUtils.synthesizeKey(aTyped.substr(-1), {});
- is(gURLBar.value, aExpected, "trim was applied correctly");
-
- aCallback();
- }
-
- test_autoFill("http://", "http://", function () {
- test_autoFill("http://a", "http://autofilltrimurl.com/", function () {
- test_autoFill("http://www.autofilltrimurl.com", "http://www.autofilltrimurl.com/", function () {
- // Now ensure selecting from the popup correctly trims.
- waitForSearchComplete(function () {
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(gURLBar.value, "www.autofilltrimurl.com", "trim was applied correctly");
- gURLBar.closePopup();
- waitForClearHistory(finish);
- });
- });
- });
- });
-}
-
-function waitForClearHistory(aCallback) {
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
-function waitForSearchComplete(aCallback) {
- info("Waiting for onSearchComplete");
- let onSearchComplete = gURLBar.onSearchComplete;
- registerCleanupFunction(function () {
- gURLBar.onSearchComplete = onSearchComplete;
- });
- gURLBar.onSearchComplete = function () {
- ok(gURLBar.popupOpen, "The autocomplete popup is correctly open");
- is(gURLBar.controller.matchCount, 1, "Found the expected number of matches")
- onSearchComplete.apply(gURLBar);
- aCallback();
- }
-}
diff --git a/browser/base/content/test/browser_urlbarCopying.js b/browser/base/content/test/browser_urlbarCopying.js
deleted file mode 100644
index 7f0a511f8..000000000
--- a/browser/base/content/test/browser_urlbarCopying.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const trimPref = "browser.urlbar.trimURLs";
-const phishyUserPassPref = "network.http.phishy-userpass-length";
-
-function test() {
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- registerCleanupFunction(function () {
- gBrowser.removeTab(tab);
- Services.prefs.clearUserPref(trimPref);
- Services.prefs.clearUserPref(phishyUserPassPref);
- URLBarSetURI();
- });
-
- Services.prefs.setBoolPref(trimPref, true);
- Services.prefs.setIntPref(phishyUserPassPref, 32); // avoid prompting about phishing
-
- waitForExplicitFinish();
-
- nextTest();
-}
-
-var tests = [
- // pageproxystate="invalid"
- {
- setURL: "http://example.com/",
- expectedURL: "example.com",
- copyExpected: "example.com"
- },
- {
- copyVal: "<e>xample.com",
- copyExpected: "e"
- },
-
- // pageproxystate="valid" from this point on (due to the load)
- {
- loadURL: "http://example.com/",
- expectedURL: "example.com",
- copyExpected: "http://example.com/"
- },
- {
- copyVal: "<example.co>m",
- copyExpected: "example.co"
- },
- {
- copyVal: "e<x>ample.com",
- copyExpected: "x"
- },
- {
- copyVal: "<e>xample.com",
- copyExpected: "e"
- },
-
- {
- loadURL: "http://example.com/foo",
- expectedURL: "example.com/foo",
- copyExpected: "http://example.com/foo"
- },
- {
- copyVal: "<example.com>/foo",
- copyExpected: "http://example.com"
- },
- {
- copyVal: "<example>.com/foo",
- copyExpected: "example"
- },
-
- // Test that userPass is stripped out
- {
- loadURL: "http://user:pass@mochi.test:8888/browser/browser/base/content/test/authenticate.sjs?user=user&pass=pass",
- expectedURL: "mochi.test:8888/browser/browser/base/content/test/authenticate.sjs?user=user&pass=pass",
- copyExpected: "http://mochi.test:8888/browser/browser/base/content/test/authenticate.sjs?user=user&pass=pass"
- },
-
- // Test escaping
- {
- loadURL: "http://example.com/()%C3%A9",
- expectedURL: "example.com/()\xe9",
- copyExpected: "http://example.com/%28%29%C3%A9"
- },
- {
- copyVal: "<example.com/(>)\xe9",
- copyExpected: "http://example.com/("
- },
- {
- copyVal: "e<xample.com/(>)\xe9",
- copyExpected: "xample.com/("
- },
-
- {
- loadURL: "http://example.com/%C3%A9%C3%A9",
- expectedURL: "example.com/\xe9\xe9",
- copyExpected: "http://example.com/%C3%A9%C3%A9"
- },
- {
- copyVal: "e<xample.com/\xe9>\xe9",
- copyExpected: "xample.com/\xe9"
- },
- {
- copyVal: "<example.com/\xe9>\xe9",
- copyExpected: "http://example.com/\xe9"
- },
-
- {
- loadURL: "http://example.com/?%C3%B7%C3%B7",
- expectedURL: "example.com/?\xf7\xf7",
- copyExpected: "http://example.com/?%C3%B7%C3%B7"
- },
- {
- copyVal: "e<xample.com/?\xf7>\xf7",
- copyExpected: "xample.com/?\xf7"
- },
- {
- copyVal: "<example.com/?\xf7>\xf7",
- copyExpected: "http://example.com/?\xf7"
- },
-
- // data: and javsacript: URIs shouldn't be encoded
- {
- loadURL: "javascript:('%C3%A9')",
- expectedURL: "javascript:('\xe9')",
- copyExpected: "javascript:('\xe9')"
- },
- {
- copyVal: "<javascript:(>'\xe9')",
- copyExpected: "javascript:("
- },
-
- {
- loadURL: "data:text/html,(%C3%A9)",
- expectedURL: "data:text/html,(\xe9)",
- copyExpected: "data:text/html,(\xe9)"
- },
- {
- copyVal: "<data:text/html,(>\xe9)",
- copyExpected: "data:text/html,("
- },
- {
- copyVal: "data:<text/html,(\xe9>)",
- copyExpected: "text/html,(\xe9"
- }
-];
-
-function nextTest() {
- let test = tests.shift();
- if (tests.length == 0)
- runTest(test, finish);
- else
- runTest(test, nextTest);
-}
-
-function runTest(test, cb) {
- function doCheck() {
- if (test.setURL || test.loadURL) {
- gURLBar.valueIsTyped = !!test.setURL;
- is(gURLBar.value, test.expectedURL, "url bar value set");
- }
-
- testCopy(test.copyVal, test.copyExpected, cb);
- }
-
- if (test.loadURL) {
- loadURL(test.loadURL, doCheck);
- } else {
- if (test.setURL)
- gURLBar.value = test.setURL;
- doCheck();
- }
-}
-
-function testCopy(copyVal, targetValue, cb) {
- info("Expecting copy of: " + targetValue);
- waitForClipboard(targetValue, function () {
- gURLBar.focus();
- if (copyVal) {
- let startBracket = copyVal.indexOf("<");
- let endBracket = copyVal.indexOf(">");
- if (startBracket == -1 || endBracket == -1 ||
- startBracket > endBracket ||
- copyVal.replace("<", "").replace(">", "") != gURLBar.value) {
- ok(false, "invalid copyVal: " + copyVal);
- }
- gURLBar.selectionStart = startBracket;
- gURLBar.selectionEnd = endBracket - 1;
- } else {
- gURLBar.select();
- }
-
- goDoCommand("cmd_copy");
- }, cb, cb);
-}
-
-function loadURL(aURL, aCB) {
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- is(gBrowser.currentURI.spec, aURL, "loaded expected URL");
- aCB();
- }, true);
-
- gBrowser.loadURI(aURL);
-}
diff --git a/browser/base/content/test/browser_urlbarEnter.js b/browser/base/content/test/browser_urlbarEnter.js
deleted file mode 100644
index defea1396..000000000
--- a/browser/base/content/test/browser_urlbarEnter.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_VALUE = "example.com/\xF7?\xF7";
-const START_VALUE = "example.com/%C3%B7?%C3%B7";
-
-function test() {
- waitForExplicitFinish();
- runNextTest();
-}
-
-function locationBarEnter(aEvent, aClosure) {
- executeSoon(function() {
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", aEvent);
- addPageShowListener(aClosure);
- });
-}
-
-function runNextTest() {
- let test = gTests.shift();
- if (!test) {
- finish();
- return;
- }
-
- info("Running test: " + test.desc);
- let tab = gBrowser.selectedTab = gBrowser.addTab(START_VALUE);
- addPageShowListener(function() {
- locationBarEnter(test.event, function() {
- test.check(tab);
-
- // Clean up
- while (gBrowser.tabs.length > 1)
- gBrowser.removeTab(gBrowser.selectedTab)
- runNextTest();
- });
- });
-}
-
-let gTests = [
- { desc: "Simple return keypress",
- event: {},
- check: checkCurrent
- },
-
- { desc: "Alt+Return keypress",
- event: { altKey: true },
- check: checkNewTab,
- },
-]
-
-function checkCurrent(aTab) {
- is(gURLBar.value, TEST_VALUE, "Urlbar should preserve the value on return keypress");
- is(gBrowser.selectedTab, aTab, "New URL was loaded in the current tab");
-}
-
-function checkNewTab(aTab) {
- is(gURLBar.value, TEST_VALUE, "Urlbar should preserve the value on return keypress");
- isnot(gBrowser.selectedTab, aTab, "New URL was loaded in a new tab");
-}
-
-function addPageShowListener(aFunc) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- aFunc();
- });
-}
-
diff --git a/browser/base/content/test/browser_urlbarRevert.js b/browser/base/content/test/browser_urlbarRevert.js
deleted file mode 100644
index 2bd596efc..000000000
--- a/browser/base/content/test/browser_urlbarRevert.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.addTab("http://example.com");
- gBrowser.selectedTab = tab;
-
- onLoad(function () {
- let originalValue = gURLBar.value;
-
- gBrowser.userTypedValue = "foobar";
- gBrowser.selectedTab = gBrowser.tabs[0];
- gBrowser.selectedTab = tab;
- is(gURLBar.value, "foobar", "location bar displays typed value");
-
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- is(gURLBar.value, originalValue, "ESC reverted the location bar value");
-
- gBrowser.removeTab(tab);
- finish();
- });
-}
-
-function onLoad(callback) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- executeSoon(callback);
- });
-}
diff --git a/browser/base/content/test/browser_urlbarStop.js b/browser/base/content/test/browser_urlbarStop.js
deleted file mode 100644
index 2d9a87a71..000000000
--- a/browser/base/content/test/browser_urlbarStop.js
+++ /dev/null
@@ -1,40 +0,0 @@
-const goodURL = "http://mochi.test:8888/";
-const badURL = "http://mochi.test:8888/whatever.html";
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab(goodURL);
- gBrowser.selectedBrowser.addEventListener("load", onload, true);
-}
-
-function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
-
- is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page");
-
- typeAndSubmit(badURL);
- is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page");
-
- gBrowser.contentWindow.stop();
- is(gURLBar.value, gURLBar.trimValue(goodURL), "location bar reflects loaded page after stop()");
- gBrowser.removeCurrentTab();
-
- gBrowser.selectedTab = gBrowser.addTab("about:blank");
- is(gURLBar.value, "", "location bar is empty");
-
- typeAndSubmit(badURL);
- is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects loading page");
-
- gBrowser.contentWindow.stop();
- is(gURLBar.value, gURLBar.trimValue(badURL), "location bar reflects stopped page in an empty tab");
- gBrowser.removeCurrentTab();
-
- finish();
-}
-
-function typeAndSubmit(value) {
- gBrowser.userTypedValue = value;
- URLBarSetURI();
- gURLBar.handleCommand();
-}
diff --git a/browser/base/content/test/browser_urlbarTrimURLs.js b/browser/base/content/test/browser_urlbarTrimURLs.js
deleted file mode 100644
index 095ccc4a6..000000000
--- a/browser/base/content/test/browser_urlbarTrimURLs.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function testVal(originalValue, targetValue) {
- gURLBar.value = originalValue;
- gURLBar.valueIsTyped = false;
- is(gURLBar.value, targetValue || originalValue, "url bar value set");
-}
-
-function test() {
- const prefname = "browser.urlbar.trimURLs";
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- registerCleanupFunction(function () {
- gBrowser.removeCurrentTab();
- Services.prefs.clearUserPref(prefname);
- URLBarSetURI();
- });
-
- Services.prefs.setBoolPref(prefname, true);
-
- testVal("http://mozilla.org/", "mozilla.org");
- testVal("https://mozilla.org/", "https://mozilla.org");
- testVal("http://mözilla.org/", "mözilla.org");
- testVal("http://mozilla.imaginatory/", "mozilla.imaginatory");
- testVal("http://www.mozilla.org/", "www.mozilla.org");
- testVal("http://sub.mozilla.org/", "sub.mozilla.org");
- testVal("http://sub1.sub2.sub3.mozilla.org/", "sub1.sub2.sub3.mozilla.org");
- testVal("http://mozilla.org/file.ext", "mozilla.org/file.ext");
- testVal("http://mozilla.org/sub/", "mozilla.org/sub/");
-
- testVal("http://ftp.mozilla.org/", "http://ftp.mozilla.org");
- testVal("http://ftp1.mozilla.org/", "http://ftp1.mozilla.org");
- testVal("http://ftp42.mozilla.org/", "http://ftp42.mozilla.org");
- testVal("http://ftpx.mozilla.org/", "ftpx.mozilla.org");
- testVal("ftp://ftp.mozilla.org/", "ftp://ftp.mozilla.org");
- testVal("ftp://ftp1.mozilla.org/", "ftp://ftp1.mozilla.org");
- testVal("ftp://ftp42.mozilla.org/", "ftp://ftp42.mozilla.org");
- testVal("ftp://ftpx.mozilla.org/", "ftp://ftpx.mozilla.org");
-
- testVal("https://user:pass@mozilla.org/", "https://user:pass@mozilla.org");
- testVal("http://user:pass@mozilla.org/", "http://user:pass@mozilla.org");
- testVal("http://sub.mozilla.org:666/", "sub.mozilla.org:666");
-
- testVal("https://[fe80::222:19ff:fe11:8c76]/file.ext");
- testVal("http://[fe80::222:19ff:fe11:8c76]/", "[fe80::222:19ff:fe11:8c76]");
- testVal("https://user:pass@[fe80::222:19ff:fe11:8c76]:666/file.ext");
- testVal("http://user:pass@[fe80::222:19ff:fe11:8c76]:666/file.ext");
-
- testVal("mailto:admin@mozilla.org");
- testVal("gopher://mozilla.org/");
- testVal("about:config");
- testVal("jar:http://mozilla.org/example.jar!/");
- testVal("view-source:http://mozilla.org/");
-
- Services.prefs.setBoolPref(prefname, false);
-
- testVal("http://mozilla.org/");
-
- Services.prefs.setBoolPref(prefname, true);
-
- waitForExplicitFinish();
-
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- is(gBrowser.currentURI.spec, "http://example.com/", "expected page should have loaded");
-
- testCopy("example.com", "http://example.com/", function () {
- SetPageProxyState("invalid");
- gURLBar.valueIsTyped = true;
- testCopy("example.com", "example.com", finish);
- });
- }, true);
-
- gBrowser.loadURI("http://example.com/");
-}
-
-function testCopy(originalValue, targetValue, cb) {
- waitForClipboard(targetValue, function () {
- is(gURLBar.value, originalValue, "url bar copy value set");
-
- gURLBar.focus();
- gURLBar.select();
- goDoCommand("cmd_copy");
- }, cb, cb);
-}
diff --git a/browser/base/content/test/browser_urlbar_search_healthreport.js b/browser/base/content/test/browser_urlbar_search_healthreport.js
deleted file mode 100644
index 4315a9864..000000000
--- a/browser/base/content/test/browser_urlbar_search_healthreport.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
- waitForExplicitFinish();
- try {
- let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
- cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
- } catch (ex) {
- // Health Report disabled, or no SearchesProvider.
- ok(true, "Firefox Health Report is not enabled.");
- finish();
- return;
- }
-
- let reporter = Cc["@mozilla.org/datareporting/service;1"]
- .getService()
- .wrappedJSObject
- .healthReporter;
- ok(reporter, "Health Reporter available.");
- reporter.onInit().then(function onInit() {
- let provider = reporter.getProvider("org.mozilla.searches");
- ok(provider, "Searches provider is available.");
- let m = provider.getMeasurement("counts", 2);
-
- m.getValues().then(function onData(data) {
- let now = new Date();
- let oldCount = 0;
-
- // This will to be need changed if default search engine is not Google.
- let field = "google.urlbar";
-
- if (data.days.hasDay(now)) {
- let day = data.days.getDay(now);
- if (day.has(field)) {
- oldCount = day.get(field);
- }
- }
-
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
-
- gURLBar.value = "firefox health report";
- gURLBar.handleCommand();
-
- executeSoon(() => executeSoon(() => {
- gBrowser.removeTab(tab);
-
- m.getValues().then(function onData(data) {
- ok(data.days.hasDay(now), "FHR has data for today.");
- let day = data.days.getDay(now);
- ok(day.has(field), "FHR has url bar count for today.");
-
- let newCount = day.get(field);
-
- is(newCount, oldCount + 1, "Exactly one search has been recorded.");
- finish();
- });
- }));
- });
- });
-}
-
diff --git a/browser/base/content/test/browser_utilityOverlay.js b/browser/base/content/test/browser_utilityOverlay.js
deleted file mode 100644
index a3d909eb7..000000000
--- a/browser/base/content/test/browser_utilityOverlay.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const gTests = [
- test_getTopWin,
- test_getBoolPref,
- test_openNewTabWith,
- test_openUILink
-];
-
-function test () {
- waitForExplicitFinish();
- executeSoon(runNextTest);
-}
-
-function runNextTest() {
- if (gTests.length) {
- let testFun = gTests.shift();
- info("Running " + testFun.name);
- testFun()
- }
- else {
- finish();
- }
-}
-
-function test_getTopWin() {
- is(getTopWin(), window, "got top window");
- runNextTest();
-}
-
-
-function test_getBoolPref() {
- is(getBoolPref("browser.search.openintab", false), false, "getBoolPref");
- is(getBoolPref("this.pref.doesnt.exist", true), true, "getBoolPref fallback");
- is(getBoolPref("this.pref.doesnt.exist", false), false, "getBoolPref fallback #2");
- runNextTest();
-}
-
-function test_openNewTabWith() {
- openNewTabWith("http://example.com/");
- let tab = gBrowser.selectedTab = gBrowser.tabs[1];
- tab.linkedBrowser.addEventListener("load", function onLoad(event) {
- tab.linkedBrowser.removeEventListener("load", onLoad, true);
- is(tab.linkedBrowser.currentURI.spec, "http://example.com/", "example.com loaded");
- gBrowser.removeCurrentTab();
- runNextTest();
- }, true);
-}
-
-function test_openUILink() {
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
- tab.linkedBrowser.addEventListener("load", function onLoad(event) {
- tab.linkedBrowser.removeEventListener("load", onLoad, true);
- is(tab.linkedBrowser.currentURI.spec, "http://example.org/", "example.org loaded");
- gBrowser.removeCurrentTab();
- runNextTest();
- }, true);
-
- openUILink("http://example.org/"); // defaults to "current"
-}
diff --git a/browser/base/content/test/browser_visibleFindSelection.js b/browser/base/content/test/browser_visibleFindSelection.js
deleted file mode 100644
index b46104ad4..000000000
--- a/browser/base/content/test/browser_visibleFindSelection.js
+++ /dev/null
@@ -1,39 +0,0 @@
-
-function test() {
- waitForExplicitFinish();
-
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- ok(true, "Load listener called");
- waitForFocus(onFocus, content);
- }, true);
-
- content.location = "data:text/html,<div style='position: absolute; left: 2200px; background: green; width: 200px; height: 200px;'>div</div><div style='position: absolute; left: 0px; background: red; width: 200px; height: 200px;'><span id='s'>div</span></div>";
-}
-
-function onFocus() {
- EventUtils.synthesizeKey("f", { accelKey: true });
- ok(gFindBarInitialized, "find bar is now initialized");
-
- EventUtils.synthesizeKey("d", {});
- EventUtils.synthesizeKey("i", {});
- EventUtils.synthesizeKey("v", {});
- // finds the div in the green box
-
- EventUtils.synthesizeKey("g", { accelKey: true });
- // finds the div in the red box
-
- var rect = content.document.getElementById("s").getBoundingClientRect();
- ok(rect.left >= 0, "scroll should include find result");
-
- // clear the find bar
- EventUtils.synthesizeKey("a", { accelKey: true });
- EventUtils.synthesizeKey("VK_DELETE", { });
-
- gFindBar.close();
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/base/content/test/browser_visibleTabs.js b/browser/base/content/test/browser_visibleTabs.js
deleted file mode 100644
index d02bb64cb..000000000
--- a/browser/base/content/test/browser_visibleTabs.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // There should be one tab when we start the test
- let [origTab] = gBrowser.visibleTabs;
-
- // Add a tab that will get pinned
- let pinned = gBrowser.addTab();
- gBrowser.pinTab(pinned);
-
- let testTab = gBrowser.addTab();
-
- let visible = gBrowser.visibleTabs;
- is(visible.length, 3, "3 tabs should be open");
- is(visible[0], pinned, "the pinned tab is first");
- is(visible[1], origTab, "original tab is next");
- is(visible[2], testTab, "last created tab is last");
-
- // Only show the test tab (but also get pinned and selected)
- is(gBrowser.selectedTab, origTab, "sanity check that we're on the original tab");
- gBrowser.showOnlyTheseTabs([testTab]);
- is(gBrowser.visibleTabs.length, 3, "all 3 tabs are still visible");
-
- // Select the test tab and only show that (and pinned)
- gBrowser.selectedTab = testTab;
- gBrowser.showOnlyTheseTabs([testTab]);
-
- visible = gBrowser.visibleTabs;
- is(visible.length, 2, "2 tabs should be visible including the pinned");
- is(visible[0], pinned, "first is pinned");
- is(visible[1], testTab, "next is the test tab");
- is(gBrowser.tabs.length, 3, "3 tabs should still be open");
-
- gBrowser.selectTabAtIndex(0);
- is(gBrowser.selectedTab, pinned, "first tab is pinned");
- gBrowser.selectTabAtIndex(1);
- is(gBrowser.selectedTab, testTab, "second tab is the test tab");
- gBrowser.selectTabAtIndex(2);
- is(gBrowser.selectedTab, testTab, "no third tab, so no change");
- gBrowser.selectTabAtIndex(0);
- is(gBrowser.selectedTab, pinned, "switch back to the pinned");
- gBrowser.selectTabAtIndex(2);
- is(gBrowser.selectedTab, pinned, "no third tab, so no change");
- gBrowser.selectTabAtIndex(-1);
- is(gBrowser.selectedTab, testTab, "last tab is the test tab");
-
- gBrowser.tabContainer.advanceSelectedTab(1, true);
- is(gBrowser.selectedTab, pinned, "wrapped around the end to pinned");
- gBrowser.tabContainer.advanceSelectedTab(1, true);
- is(gBrowser.selectedTab, testTab, "next to test tab");
- gBrowser.tabContainer.advanceSelectedTab(1, true);
- is(gBrowser.selectedTab, pinned, "next to pinned again");
-
- gBrowser.tabContainer.advanceSelectedTab(-1, true);
- is(gBrowser.selectedTab, testTab, "going backwards to last tab");
- gBrowser.tabContainer.advanceSelectedTab(-1, true);
- is(gBrowser.selectedTab, pinned, "next to pinned");
- gBrowser.tabContainer.advanceSelectedTab(-1, true);
- is(gBrowser.selectedTab, testTab, "next to test tab again");
-
- // Try showing all tabs
- gBrowser.showOnlyTheseTabs(Array.slice(gBrowser.tabs));
- is(gBrowser.visibleTabs.length, 3, "all 3 tabs are visible again");
-
- // Select the pinned tab and show the testTab to make sure selection updates
- gBrowser.selectedTab = pinned;
- gBrowser.showOnlyTheseTabs([testTab]);
- is(gBrowser.tabs[1], origTab, "make sure origTab is in the middle");
- is(origTab.hidden, true, "make sure it's hidden");
- gBrowser.removeTab(pinned);
- is(gBrowser.selectedTab, testTab, "making sure origTab was skipped");
- is(gBrowser.visibleTabs.length, 1, "only testTab is there");
-
- // Only show one of the non-pinned tabs (but testTab is selected)
- gBrowser.showOnlyTheseTabs([origTab]);
- is(gBrowser.visibleTabs.length, 2, "got 2 tabs");
-
- // Now really only show one of the tabs
- gBrowser.showOnlyTheseTabs([testTab]);
- visible = gBrowser.visibleTabs;
- is(visible.length, 1, "only the original tab is visible");
- is(visible[0], testTab, "it's the original tab");
- is(gBrowser.tabs.length, 2, "still have 2 open tabs");
-
- // Close the last visible tab and make sure we still get a visible tab
- gBrowser.removeTab(testTab);
- is(gBrowser.visibleTabs.length, 1, "only orig is left and visible");
- is(gBrowser.tabs.length, 1, "sanity check that it matches");
- is(gBrowser.selectedTab, origTab, "got the orig tab");
- is(origTab.hidden, false, "and it's not hidden -- visible!");
-}
diff --git a/browser/base/content/test/browser_visibleTabs_bookmarkAllPages.js b/browser/base/content/test/browser_visibleTabs_bookmarkAllPages.js
deleted file mode 100644
index 0d9a12067..000000000
--- a/browser/base/content/test/browser_visibleTabs_bookmarkAllPages.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let tabOne = gBrowser.addTab("about:blank");
- let tabTwo = gBrowser.addTab("http://mochi.test:8888/");
- gBrowser.selectedTab = tabTwo;
-
- let browser = gBrowser.getBrowserForTab(tabTwo);
- let onLoad = function() {
- browser.removeEventListener("load", onLoad, true);
-
- gBrowser.showOnlyTheseTabs([tabTwo]);
-
- is(gBrowser.visibleTabs.length, 1, "Only one tab is visible");
-
- let uris = PlacesCommandHook.uniqueCurrentPages;
- is(uris.length, 1, "Only one uri is returned");
-
- is(uris[0].spec, tabTwo.linkedBrowser.currentURI.spec, "It's the correct URI");
-
- gBrowser.removeTab(tabOne);
- gBrowser.removeTab(tabTwo);
- Array.forEach(gBrowser.tabs, function(tab) {
- gBrowser.showTab(tab);
- });
-
- finish();
- }
- browser.addEventListener("load", onLoad, true);
-}
diff --git a/browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js b/browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js
deleted file mode 100644
index 09d790b94..000000000
--- a/browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- // There should be one tab when we start the test
- let [origTab] = gBrowser.visibleTabs;
- is(gBrowser.visibleTabs.length, 1, "1 tab should be open");
- is(Disabled(), true, "Bookmark All Tabs should be disabled");
-
- // Add a tab
- let testTab1 = gBrowser.addTab();
- is(gBrowser.visibleTabs.length, 2, "2 tabs should be open");
- is(Disabled(), true, "Bookmark All Tabs should be disabled since there are two tabs with the same address");
-
- let testTab2 = gBrowser.addTab("about:mozilla");
- is(gBrowser.visibleTabs.length, 3, "3 tabs should be open");
- // Wait for tab load, the code checks for currentURI.
- testTab2.linkedBrowser.addEventListener("load", function () {
- testTab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- is(Disabled(), false, "Bookmark All Tabs should be enabled since there are two tabs with different addresses");
-
- // Hide the original tab
- gBrowser.selectedTab = testTab2;
- gBrowser.showOnlyTheseTabs([testTab2]);
- is(gBrowser.visibleTabs.length, 1, "1 tab should be visible");
- is(Disabled(), true, "Bookmark All Tabs should be disabled as there is only one visible tab");
-
- // Add a tab that will get pinned
- let pinned = gBrowser.addTab();
- is(gBrowser.visibleTabs.length, 2, "2 tabs should be visible now");
- is(Disabled(), false, "Bookmark All Tabs should be available as there are two visible tabs");
- gBrowser.pinTab(pinned);
- is(Hidden(), false, "Bookmark All Tabs should be visible on a normal tab");
- is(Disabled(), true, "Bookmark All Tabs should not be available since one tab is pinned");
- gBrowser.selectedTab = pinned;
- is(Hidden(), true, "Bookmark All Tabs should be hidden on a pinned tab");
-
- // Show all tabs
- let allTabs = [tab for each (tab in gBrowser.tabs)];
- gBrowser.showOnlyTheseTabs(allTabs);
-
- // reset the environment
- gBrowser.removeTab(testTab2);
- gBrowser.removeTab(testTab1);
- gBrowser.removeTab(pinned);
- is(gBrowser.visibleTabs.length, 1, "only orig is left and visible");
- is(gBrowser.tabs.length, 1, "sanity check that it matches");
- is(Disabled(), true, "Bookmark All Tabs should be hidden");
- is(gBrowser.selectedTab, origTab, "got the orig tab");
- is(origTab.hidden, false, "and it's not hidden -- visible!");
- finish();
- }, true);
-}
-
-function Disabled() {
- updateTabContextMenu();
- return document.getElementById("Browser:BookmarkAllTabs").getAttribute("disabled") == "true";
-}
-
-function Hidden() {
- updateTabContextMenu();
- return document.getElementById("context_bookmarkAllTabs").hidden;
-}
diff --git a/browser/base/content/test/browser_visibleTabs_contextMenu.js b/browser/base/content/test/browser_visibleTabs_contextMenu.js
deleted file mode 100644
index 0539c8106..000000000
--- a/browser/base/content/test/browser_visibleTabs_contextMenu.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // There should be one tab when we start the test
- let [origTab] = gBrowser.visibleTabs;
- is(gBrowser.visibleTabs.length, 1, "there is one visible tab");
- let testTab = gBrowser.addTab();
- is(gBrowser.visibleTabs.length, 2, "there are now two visible tabs");
-
- // Check the context menu with two tabs
- updateTabContextMenu(origTab);
- is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled");
- is(document.getElementById("context_reloadAllTabs").disabled, false, "Reload All Tabs is enabled");
-
- // Hide the original tab.
- gBrowser.selectedTab = testTab;
- gBrowser.showOnlyTheseTabs([testTab]);
- is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
-
- // Check the context menu with one tab.
- updateTabContextMenu(testTab);
- is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
- is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
-
- // Add a tab that will get pinned
- // So now there's one pinned tab, one visible unpinned tab, and one hidden tab
- let pinned = gBrowser.addTab();
- gBrowser.pinTab(pinned);
- is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
-
- // Check the context menu on the unpinned visible tab
- updateTabContextMenu(testTab);
- is(document.getElementById("context_closeOtherTabs").disabled, true, "Close Other Tabs is disabled");
- is(document.getElementById("context_closeTabsToTheEnd").disabled, true, "Close Tabs To The End is disabled");
-
- // Show all tabs
- let allTabs = [tab for each (tab in gBrowser.tabs)];
- gBrowser.showOnlyTheseTabs(allTabs);
-
- // Check the context menu now
- updateTabContextMenu(testTab);
- is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
- is(document.getElementById("context_closeTabsToTheEnd").disabled, true, "Close Tabs To The End is disabled");
-
- // Check the context menu of the original tab
- // Close Tabs To The End should now be enabled
- updateTabContextMenu(origTab);
- is(document.getElementById("context_closeTabsToTheEnd").disabled, false, "Close Tabs To The End is enabled");
-
- gBrowser.removeTab(testTab);
- gBrowser.removeTab(pinned);
-}
diff --git a/browser/base/content/test/browser_visibleTabs_tabPreview.js b/browser/base/content/test/browser_visibleTabs_tabPreview.js
deleted file mode 100644
index 9491690cb..000000000
--- a/browser/base/content/test/browser_visibleTabs_tabPreview.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- gPrefService.setBoolPref("browser.ctrlTab.previews", true);
-
- let [origTab] = gBrowser.visibleTabs;
- let tabOne = gBrowser.addTab();
- let tabTwo = gBrowser.addTab();
-
- // test the ctrlTab.tabList
- pressCtrlTab();
- ok(ctrlTab.tabList.length, 3, "Show 3 tabs in tab preview");
- releaseCtrl();
-
- gBrowser.showOnlyTheseTabs([origTab]);
- pressCtrlTab();
- ok(ctrlTab.tabList.length, 1, "Show 1 tab in tab preview");
- ok(!ctrlTab.isOpen, "With 1 tab open, Ctrl+Tab doesn't open the preview panel");
-
- gBrowser.showOnlyTheseTabs([origTab, tabOne, tabTwo]);
- pressCtrlTab();
- ok(ctrlTab.isOpen, "With 3 tabs open, Ctrl+Tab does open the preview panel");
- releaseCtrl();
-
- // cleanup
- gBrowser.removeTab(tabOne);
- gBrowser.removeTab(tabTwo);
-
- if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
- gPrefService.clearUserPref("browser.ctrlTab.previews");
-}
-
-function pressCtrlTab(aShiftKey) {
- EventUtils.synthesizeKey("VK_TAB", { ctrlKey: true, shiftKey: !!aShiftKey });
-}
-
-function releaseCtrl() {
- EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" });
-}
diff --git a/browser/base/content/test/browser_wyciwyg_urlbarCopying.js b/browser/base/content/test/browser_wyciwyg_urlbarCopying.js
deleted file mode 100644
index f908e5254..000000000
--- a/browser/base/content/test/browser_wyciwyg_urlbarCopying.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let url = "http://mochi.test:8888/browser/browser/base/content/test/test_wyciwyg_copying.html";
- let tab = gBrowser.selectedTab = gBrowser.addTab(url);
- tab.linkedBrowser.addEventListener("pageshow", function () {
- let btn = content.document.getElementById("btn");
- executeSoon(function () {
- EventUtils.synthesizeMouseAtCenter(btn, {}, content);
- let currentURL = gBrowser.currentURI.spec;
- ok(/^wyciwyg:\/\//i.test(currentURL), currentURL + " is a wyciwyg URI");
-
- executeSoon(function () {
- testURLBarCopy(url, endTest);
- });
- });
- }, false);
-
- function endTest() {
- while (gBrowser.tabs.length > 1)
- gBrowser.removeCurrentTab();
- finish();
- }
-
- function testURLBarCopy(targetValue, cb) {
- info("Expecting copy of: " + targetValue);
- waitForClipboard(targetValue, function () {
- gURLBar.focus();
- gURLBar.select();
-
- goDoCommand("cmd_copy");
- }, cb, cb);
- }
-}
-
-
diff --git a/browser/base/content/test/browser_zbug569342.js b/browser/base/content/test/browser_zbug569342.js
deleted file mode 100644
index 8ca6674ce..000000000
--- a/browser/base/content/test/browser_zbug569342.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gTab = null;
-
-function load(url, cb) {
- gTab = gBrowser.addTab(url);
- gBrowser.addEventListener("load", function (event) {
- if (event.target.location != url)
- return;
-
- gBrowser.removeEventListener("load", arguments.callee, true);
- // Trigger onLocationChange by switching tabs.
- gBrowser.selectedTab = gTab;
- cb();
- }, true);
-}
-
-function test() {
- waitForExplicitFinish();
-
- ok(gFindBar.hidden, "Find bar should not be visible by default");
-
- // Open the Find bar before we navigate to pages that shouldn't have it.
- EventUtils.synthesizeKey("f", { accelKey: true });
- ok(!gFindBar.hidden, "Find bar should be visible");
-
- nextTest();
-}
-
-let urls = [
- "about:config",
- "about:addons",
- "about:permissions"
-];
-
-function nextTest() {
- let url = urls.shift();
- if (url) {
- testFindDisabled(url, nextTest);
- } else {
- // Make sure the find bar is re-enabled after disabled page is closed.
- testFindEnabled("about:blank", finish);
- }
-}
-
-function testFindDisabled(url, cb) {
- load(url, function() {
- ok(gFindBar.hidden, "Find bar should not be visible");
- EventUtils.synthesizeKey("/", {}, gTab.linkedBrowser.contentWindow);
- ok(gFindBar.hidden, "Find bar should not be visible");
- EventUtils.synthesizeKey("f", { accelKey: true });
- ok(gFindBar.hidden, "Find bar should not be visible");
- ok(document.getElementById("cmd_find").getAttribute("disabled"),
- "Find command should be disabled");
-
- gBrowser.removeTab(gTab);
- cb();
- });
-}
-
-function testFindEnabled(url, cb) {
- load(url, function() {
- ok(!document.getElementById("cmd_find").getAttribute("disabled"),
- "Find command should not be disabled");
-
- ok(!gFindBar.hidden, "Find bar should be visible again");
-
- // Give focus to the Find bar and then close it.
- EventUtils.synthesizeKey("f", { accelKey: true });
- EventUtils.synthesizeKey("VK_ESCAPE", { });
- ok(gFindBar.hidden, "Find bar should now be hidden");
-
- gBrowser.removeTab(gTab);
- cb();
- });
-}
diff --git a/browser/base/content/test/bug364677-data.xml b/browser/base/content/test/bug364677-data.xml
deleted file mode 100644
index b48915c05..000000000
--- a/browser/base/content/test/bug364677-data.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<rss version="2.0">
- <channel>
- <title>t</title>
- </channel>
-</rss>
diff --git a/browser/base/content/test/bug364677-data.xml^headers^ b/browser/base/content/test/bug364677-data.xml^headers^
deleted file mode 100644
index f203c6368..000000000
--- a/browser/base/content/test/bug364677-data.xml^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/xml
diff --git a/browser/base/content/test/bug395533-data.txt b/browser/base/content/test/bug395533-data.txt
deleted file mode 100644
index e0ed39850..000000000
--- a/browser/base/content/test/bug395533-data.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-<rss version="2.0">
- <channel>
- <link>http://example.org/</link>
- <title>t</title>
- </channel>
-</rss>
diff --git a/browser/base/content/test/bug564387.html b/browser/base/content/test/bug564387.html
deleted file mode 100644
index 51ba4d04b..000000000
--- a/browser/base/content/test/bug564387.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
- <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=564387 -->
- <head>
- <title> Bug 564387 test</title>
- </head>
- <body>
- Testing for Mozilla Bug: 564387
- <br>
- <video src="bug564387_video1.ogv" id="video1"> </video>
- </body>
-</html>
diff --git a/browser/base/content/test/bug564387_video1.ogv b/browser/base/content/test/bug564387_video1.ogv
deleted file mode 100644
index 093158432..000000000
--- a/browser/base/content/test/bug564387_video1.ogv
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/bug564387_video1.ogv^headers^ b/browser/base/content/test/bug564387_video1.ogv^headers^
deleted file mode 100644
index f880d0ac3..000000000
--- a/browser/base/content/test/bug564387_video1.ogv^headers^
+++ /dev/null
@@ -1,3 +0,0 @@
-Content-Disposition: filename="Bug564387-expectedName.ogv"
-Content-Type: video/ogg
-
diff --git a/browser/base/content/test/bug592338.html b/browser/base/content/test/bug592338.html
deleted file mode 100644
index 159b21a76..000000000
--- a/browser/base/content/test/bug592338.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<head>
-<script type="text/javascript">
-var theme = {
- id: "test",
- name: "Test Background",
- headerURL: "http://example.com/firefox/personas/01/header.jpg",
- footerURL: "http://example.com/firefox/personas/01/footer.jpg",
- textcolor: "#fff",
- accentcolor: "#6b6b6b"
-};
-
-function setTheme(node) {
- node.setAttribute("data-browsertheme", JSON.stringify(theme));
- var event = document.createEvent("Events");
- event.initEvent("InstallBrowserTheme", true, false);
- node.dispatchEvent(event);
-}
-</script>
-</head>
-<body>
-<a id="theme-install" href="#" onclick="setTheme(this)">Install</a>
-</body>
-</html>
diff --git a/browser/base/content/test/bug792517-2.html b/browser/base/content/test/bug792517-2.html
deleted file mode 100644
index bfc24d817..000000000
--- a/browser/base/content/test/bug792517-2.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-<a href="bug792517.sjs" id="fff">this is a link</a>
-</body>
-</html>
diff --git a/browser/base/content/test/bug792517.html b/browser/base/content/test/bug792517.html
deleted file mode 100644
index e7c040bf1..000000000
--- a/browser/base/content/test/bug792517.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
-<img src="moz.png" id="img">
-</body>
-</html>
diff --git a/browser/base/content/test/bug792517.sjs b/browser/base/content/test/bug792517.sjs
deleted file mode 100644
index 91e5aa23f..000000000
--- a/browser/base/content/test/bug792517.sjs
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function handleRequest(aRequest, aResponse) {
- aResponse.setStatusLine(aRequest.httpVersion, 200);
- if (aRequest.hasHeader('Cookie')) {
- aResponse.write("cookie-present");
- } else {
- aResponse.setHeader("Set-Cookie", "foopy=1");
- aResponse.write("cookie-not-present");
- }
-}
diff --git a/browser/base/content/test/bug839103.css b/browser/base/content/test/bug839103.css
deleted file mode 100644
index 611907d3d..000000000
--- a/browser/base/content/test/bug839103.css
+++ /dev/null
@@ -1 +0,0 @@
-* {}
diff --git a/browser/base/content/test/ctxmenu-image.png b/browser/base/content/test/ctxmenu-image.png
deleted file mode 100644
index 4c3be5084..000000000
--- a/browser/base/content/test/ctxmenu-image.png
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/disablechrome.html b/browser/base/content/test/disablechrome.html
deleted file mode 100644
index 7879e1ce9..000000000
--- a/browser/base/content/test/disablechrome.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<html>
-<body>
-</body>
-</html>
diff --git a/browser/base/content/test/discovery.html b/browser/base/content/test/discovery.html
deleted file mode 100644
index 1679e6545..000000000
--- a/browser/base/content/test/discovery.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head id="linkparent">
- <title>Autodiscovery Test</title>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/base/content/test/domplate_test.js b/browser/base/content/test/domplate_test.js
deleted file mode 100644
index 75f2b25e2..000000000
--- a/browser/base/content/test/domplate_test.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let doc;
-let div;
-let plate;
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource:///modules/domplate.jsm");
-
-function createDocument()
-{
- doc.body.innerHTML = '<div id="first">no</div>';
- doc.title = "Domplate Test";
- setupDomplateTests();
-}
-
-function setupDomplateTests()
-{
- ok(domplate, "domplate is defined");
- plate = domplate({tag: domplate.DIV("Hello!")});
- ok(plate, "template is defined");
- div = doc.getElementById("first");
- ok(div, "we have our div");
- plate.tag.replace({}, div, template);
- is(div.innerText, "Hello!", "Is the div's innerText replaced?");
- finishUp();
-}
-
-function finishUp()
-{
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic domplate tests";
-}
-
diff --git a/browser/base/content/test/download_page.html b/browser/base/content/test/download_page.html
deleted file mode 100644
index 541f6f88b..000000000
--- a/browser/base/content/test/download_page.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=676619
--->
- <head>
- <title>Test for the download attribute</title>
-
- </head>
- <body>
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=676619">Bug 676619</a>
- <br/>
- <ul>
- <li><a href="data:text/plain,Hey What are you looking for?"
- download="test.txt" id="link1">Download "test.txt"</a></li>
- <li><a href="video.ogg"
- download id="link2">Download "video.ogg"</a></li>
- <li><a href="video.ogg"
- download="just some video" id="link3">Download "just some video"</a></li>
- <li><a href="data:text/plain,test"
- download="with-target.txt" id="link4">Download "with-target.txt"</a></li>
- <li><a href="javascript:1+2"
- download="javascript.txt" id="link5">Download "javascript.txt"</a></li>
- </ul>
- <script>
- var li = document.createElement('li');
- var a = document.createElement('a');
-
- a.href = window.URL.createObjectURL(new Blob(["just text"])) ;
- a.download = "test.blob";
- a.id = "link6";
- a.textContent = 'Download "test.blob"';
-
- li.appendChild(a);
- document.getElementsByTagName('ul')[0].appendChild(li);
-
- window.addEventListener("beforeunload", function (evt) {
- document.getElementById("unload-flag").textContent = "Fail";
- });
- </script>
- <ul>
- <li><a href="http://example.com/"
- download="example.com" id="link7" target="_blank">Download "example.com"</a></li>
- <ul>
- <div id="unload-flag">Okay</div>
- </body>
-</html>
diff --git a/browser/base/content/test/dummy_page.html b/browser/base/content/test/dummy_page.html
deleted file mode 100644
index 578567564..000000000
--- a/browser/base/content/test/dummy_page.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>Dummy test page</title>
-</head>
-<body>
-<p>Dummy test page</p>
-</body>
-</html>
diff --git a/browser/base/content/test/feed_discovery.html b/browser/base/content/test/feed_discovery.html
deleted file mode 100644
index f7a30091c..000000000
--- a/browser/base/content/test/feed_discovery.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=377611
--->
- <head>
- <title>Test for feed discovery</title>
-
- <!-- Straight up standard -->
- <link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" />
- <link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" />
- <link rel="feed" title="3" href="/3.xml" />
-
- <!-- rel is a space-separated list -->
- <link rel=" alternate " type="application/atom+xml" title="4" href="/4.atom" />
- <link rel="foo alternate" type="application/atom+xml" title="5" href="/5.atom" />
- <link rel="alternate foo" type="application/atom+xml" title="6" href="/6.atom" />
- <link rel="foo alternate foo" type="application/atom+xml" title="7" href="/7.atom" />
- <link rel="meat feed cake" title="8" href="/8.atom" />
-
- <!-- rel is case-insensitive -->
- <link rel="ALTERNate" type="application/atom+xml" title="9" href="/9.atom" />
- <link rel="fEEd" title="10" href="/10.atom" />
-
- <!-- type can have leading and trailing whitespace -->
- <link rel="alternate" type=" application/atom+xml " title="11" href="/11.atom" />
-
- <!-- type is case-insensitive -->
- <link rel="alternate" type="aPPliCAtion/ATom+xML" title="12" href="/12.atom" />
-
- <!-- "feed stylesheet" is a feed, though "alternate stylesheet" isn't -->
- <link rel="feed stylesheet" title="13" href="/13.atom" />
-
- <!-- hyphens or letters around rel not allowed -->
- <link rel="disabled-alternate" type="application/atom+xml" title="Bogus1" href="/Bogus1" />
- <link rel="alternates" type="application/atom+xml" title="Bogus2" href="/Bogus2" />
- <link rel=" alternate-like" type="application/atom+xml" title="Bogus3" href="/Bogus3" />
-
- <!-- don't tolerate text/xml if title includes 'rss' not as a word -->
- <link rel="alternate" type="text/xml" title="Bogus4 scissorsshaped" href="/Bogus4" />
-
- <!-- don't tolerate application/xml if title includes 'rss' not as a word -->
- <link rel="alternate" type="application/xml" title="Bogus5 scissorsshaped" href="/Bogus5" />
-
- <!-- don't tolerate application/rdf+xml if title includes 'rss' not as a word -->
- <link rel="alternate" type="application/rdf+xml" title="Bogus6 scissorsshaped" href="/Bogus6" />
-
- <!-- don't tolerate random types -->
- <link rel="alternate" type="text/plain" title="Bogus7 rss" href="/Bogus7" />
-
- <!-- don't find Atom by title -->
- <link rel="foopy" type="application/atom+xml" title="Bogus8 Atom and RSS" href="/Bogus8" />
-
- <!-- don't find application/rss+xml by title -->
- <link rel="goats" type="application/rss+xml" title="Bogus9 RSS and Atom" href="/Bogus9" />
-
- <!-- don't find application/rdf+xml by title -->
- <link rel="alternate" type="application/rdf+xml" title="Bogus10 RSS and Atom" href="/Bogus10" />
-
- <!-- don't find application/xml by title -->
- <link rel="alternate" type="application/xml" title="Bogus11 RSS and Atom" href="/Bogus11" />
-
- <!-- don't find text/xml by title -->
- <link rel="alternate" type="text/xml" title="Bogus12 RSS and Atom" href="/Bogus12" />
-
- <!-- alternate and stylesheet isn't a feed -->
- <link rel="alternate stylesheet" type="application/rss+xml" title="Bogus13 RSS" href="/Bogus13" />
- </head>
- <body>
- <script type="text/javascript">
- window.onload = function() {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- var tests = new Array();
-
- var currentWindow =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
- .rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
- var browser = currentWindow.gBrowser.selectedBrowser;
-
- var discovered = browser.feeds;
- tests.push({ check: discovered.length > 0,
- message: "some feeds should be discovered" });
-
- var feeds = [];
-
- for (var aFeed of discovered) {
- feeds[aFeed.href] = true;
- }
-
- for (var aLink of document.getElementsByTagName("link")) {
- // ignore real stylesheets, and anything without an href property
- if (aLink.type != "text/css" && aLink.href) {
- if (/bogus/i.test(aLink.title)) {
- tests.push({ check: !feeds[aLink.href],
- message: "don't discover " + aLink.href });
- } else {
- tests.push({ check: feeds[aLink.href],
- message: "should discover " + aLink.href });
- }
- }
- }
- window.arguments[0].tests = tests;
- window.close();
- }
- </script>
- </body>
-</html>
-
diff --git a/browser/base/content/test/feed_tab.html b/browser/base/content/test/feed_tab.html
deleted file mode 100644
index 50903f48b..000000000
--- a/browser/base/content/test/feed_tab.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=458579
--->
- <head>
- <title>Test for page info feeds tab</title>
-
- <!-- Straight up standard -->
- <link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" />
- <link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" />
- <link rel="feed" title="3" href="/3.xml" />
-
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/base/content/test/file_bug550565_favicon.ico b/browser/base/content/test/file_bug550565_favicon.ico
deleted file mode 100644
index d44438903..000000000
--- a/browser/base/content/test/file_bug550565_favicon.ico
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/file_bug550565_popup.html b/browser/base/content/test/file_bug550565_popup.html
deleted file mode 100644
index b4cddf971..000000000
--- a/browser/base/content/test/file_bug550565_popup.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test file for bug 550565.</title>
-
- <!--Set a favicon; that's the whole point of this file.-->
- <link rel="icon" href="file_bug550565_favicon.ico">
-</head>
-<body>
- Test file for bug 550565.
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_1.html b/browser/base/content/test/file_bug822367_1.html
deleted file mode 100644
index 0bb5011b8..000000000
--- a/browser/base/content/test/file_bug822367_1.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 1 for Mixed Content Blocker User Override - Mixed Script
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 1 for Bug 822367</title>
-</head>
-<body>
- <div id="testContent">
- <p id="p1"></p>
- </div>
- <script src="http://example.com/browser/browser/base/content/test/file_bug822367_1.js">
- </script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_1.js b/browser/base/content/test/file_bug822367_1.js
deleted file mode 100644
index 175de363b..000000000
--- a/browser/base/content/test/file_bug822367_1.js
+++ /dev/null
@@ -1 +0,0 @@
-document.getElementById('p1').innerHTML="hello";
diff --git a/browser/base/content/test/file_bug822367_2.html b/browser/base/content/test/file_bug822367_2.html
deleted file mode 100644
index fe56ee213..000000000
--- a/browser/base/content/test/file_bug822367_2.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 2 for Mixed Content Blocker User Override - Mixed Display
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 2 for Bug 822367 - Mixed Display</title>
-</head>
-<body>
- <div id="testContent">
- <img src="http://example.com/tests/image/test/mochitest/blue.png">
- </div>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_3.html b/browser/base/content/test/file_bug822367_3.html
deleted file mode 100644
index 646e61206..000000000
--- a/browser/base/content/test/file_bug822367_3.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 3 for Mixed Content Blocker User Override - Mixed Script and Display
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 3 for Bug 822367</title>
- <script>
- function foo() {
- var x = document.createElement('p');
- x.setAttribute("id", "p2");
- x.innerHTML = "bye";
- document.getElementById("testContent").appendChild(x);
- }
- </script>
-</head>
-<body>
- <div id="testContent">
- <p id="p1"></p>
- <img src="http://example.com/tests/image/test/mochitest/blue.png" onload="foo()">
- </div>
- <script src="http://example.com/browser/browser/base/content/test/file_bug822367_1.js">
- </script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_4.html b/browser/base/content/test/file_bug822367_4.html
deleted file mode 100644
index 490692af9..000000000
--- a/browser/base/content/test/file_bug822367_4.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 4 for Mixed Content Blocker User Override - Mixed Script and Display
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 4 for Bug 822367</title>
-</head>
-<body>
- <div id="testContent">
- <p id="p1"></p>
- </div>
- <script src="http://example.com/browser/browser/base/content/test/file_bug822367_4.js">
- </script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_4.js b/browser/base/content/test/file_bug822367_4.js
deleted file mode 100644
index 70462f05f..000000000
--- a/browser/base/content/test/file_bug822367_4.js
+++ /dev/null
@@ -1 +0,0 @@
-document.location = "https://example.com/browser/browser/base/content/test/file_bug822367_4B.html";
diff --git a/browser/base/content/test/file_bug822367_4B.html b/browser/base/content/test/file_bug822367_4B.html
deleted file mode 100644
index 05e11d2d0..000000000
--- a/browser/base/content/test/file_bug822367_4B.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 4B for Mixed Content Blocker User Override - Location Changed
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 4B Location Change for Bug 822367</title>
-</head>
-<body>
- <div id="testContent">
- <p id="p1"></p>
- </div>
- <script src="http://example.com/browser/browser/base/content/test/file_bug822367_1.js">
- </script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_5.html b/browser/base/content/test/file_bug822367_5.html
deleted file mode 100644
index e45408761..000000000
--- a/browser/base/content/test/file_bug822367_5.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 5 for Mixed Content Blocker User Override - Mixed Script in document.open()
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 5 for Bug 822367</title>
- <script>
- function createDoc()
- {
- var doc=document.open("text/html","replace");
- doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
- doc.close();
- }
- </script>
-</head>
-<body>
- <div id="testContent">
- <img src="https://example.com/tests/image/test/mochitest/blue.png" onload="createDoc()">
- </div>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug822367_6.html b/browser/base/content/test/file_bug822367_6.html
deleted file mode 100644
index c158772f5..000000000
--- a/browser/base/content/test/file_bug822367_6.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-Test 6 for Mixed Content Blocker User Override - Mixed Script in document.open() within an iframe
-https://bugzilla.mozilla.org/show_bug.cgi?id=822367
--->
-<head>
- <meta charset="utf-8">
- <title>Test 6 for Bug 822367</title>
-</head>
-<body>
- <div id="testContent">
- <iframe name="f1" id="f1" src="https://example.com/browser/browser/base/content/test/file_bug822367_5.html"></iframe>
- </div>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug902156.js b/browser/base/content/test/file_bug902156.js
deleted file mode 100644
index 806667204..000000000
--- a/browser/base/content/test/file_bug902156.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * Once the mixed content blocker is disabled for the page, this scripts loads
- * and updates the text inside the div container.
- */
-document.getElementById("mctestdiv").innerHTML = "Mixed Content Blocker disabled";
diff --git a/browser/base/content/test/file_bug902156_1.html b/browser/base/content/test/file_bug902156_1.html
deleted file mode 100644
index 04d525817..000000000
--- a/browser/base/content/test/file_bug902156_1.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
- Test 1 for Bug 902156 - See file browser_bug902156.js for description.
- https://bugzilla.mozilla.org/show_bug.cgi?id=902156
--->
-<head>
- <meta charset="utf-8">
- <title>Test 1 for Bug 902156</title>
-</head>
-<body>
- <div id="mctestdiv">Mixed Content Blocker enabled</div>
- <script src="http://test1.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug902156_2.html b/browser/base/content/test/file_bug902156_2.html
deleted file mode 100644
index 396142520..000000000
--- a/browser/base/content/test/file_bug902156_2.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
- Test 2 for Bug 902156 - See file browser_bug902156.js for description.
- https://bugzilla.mozilla.org/show_bug.cgi?id=902156
--->
-<head>
- <meta charset="utf-8">
- <title>Test 2 for Bug 902156</title>
-</head>
-<body>
- <div id="mctestdiv">Mixed Content Blocker enabled</div>
- <a href="https://test2.example.com/browser/browser/base/content/test/file_bug902156_1.html"
- id="mctestlink" target="_top">Go to http site</a>
- <script src="http://test2.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_bug902156_3.html b/browser/base/content/test/file_bug902156_3.html
deleted file mode 100644
index 23d1b11ba..000000000
--- a/browser/base/content/test/file_bug902156_3.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
- Test 3 for Bug 902156 - See file browser_bug902156.js for description.
- https://bugzilla.mozilla.org/show_bug.cgi?id=902156
--->
-<head>
- <meta charset="utf-8">
- <title>Test 3 for Bug 902156</title>
-</head>
-<body>
- <div id="mctestdiv">Mixed Content Blocker enabled</div>
- <script src="http://test1.example.com/browser/browser/base/content/test/file_bug902156.js" ></script>
-</body>
-</html>
diff --git a/browser/base/content/test/file_fullscreen-window-open.html b/browser/base/content/test/file_fullscreen-window-open.html
deleted file mode 100644
index 1584f4c98..000000000
--- a/browser/base/content/test/file_fullscreen-window-open.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Test for window.open() when browser is in fullscreen</title>
- </head>
- <body>
- <script>
- window.addEventListener("load", function onLoad() {
- window.removeEventListener("load", onLoad, true);
-
- document.getElementById("test").addEventListener("click", onClick, true);
- }, true);
-
- function onClick(aEvent) {
- aEvent.preventDefault();
-
- var dataStr = aEvent.target.getAttribute("data-test-param");
- var data = JSON.parse(dataStr);
- window.open(data.uri, data.title, data.option);
- }
- </script>
- <a id="test" href="" data-test-param="">Test</a>
- </body>
-</html>
diff --git a/browser/base/content/test/gZipOfflineChild.cacheManifest b/browser/base/content/test/gZipOfflineChild.cacheManifest
deleted file mode 100644
index ae0545d12..000000000
--- a/browser/base/content/test/gZipOfflineChild.cacheManifest
+++ /dev/null
@@ -1,2 +0,0 @@
-CACHE MANIFEST
-gZipOfflineChild.html
diff --git a/browser/base/content/test/gZipOfflineChild.cacheManifest^headers^ b/browser/base/content/test/gZipOfflineChild.cacheManifest^headers^
deleted file mode 100644
index 257f2eb60..000000000
--- a/browser/base/content/test/gZipOfflineChild.cacheManifest^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/cache-manifest
diff --git a/browser/base/content/test/gZipOfflineChild.html b/browser/base/content/test/gZipOfflineChild.html
deleted file mode 100644
index bd2d62ee0..000000000
--- a/browser/base/content/test/gZipOfflineChild.html
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/gZipOfflineChild.html^headers^ b/browser/base/content/test/gZipOfflineChild.html^headers^
deleted file mode 100644
index 4204d8601..000000000
--- a/browser/base/content/test/gZipOfflineChild.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Type: text/html
-Content-Encoding: gzip
diff --git a/browser/base/content/test/gZipOfflineChild_uncompressed.html b/browser/base/content/test/gZipOfflineChild_uncompressed.html
deleted file mode 100644
index 4ab8f8d5e..000000000
--- a/browser/base/content/test/gZipOfflineChild_uncompressed.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html manifest="gZipOfflineChild.cacheManifest">
-<head>
- <!-- This file is gzipped to create gZipOfflineChild.html -->
-<title></title>
-<script type="text/javascript">
-
-function finish(success) {
- window.parent.postMessage(success, "*");
-}
-
-applicationCache.oncached = function() { finish("oncache"); }
-applicationCache.onnoupdate = function() { finish("onupdate"); }
-applicationCache.onerror = function() { finish("onerror"); }
-
-</script>
-</head>
-
-<body>
-<h1>Child</h1>
-</body>
-</html>
diff --git a/browser/base/content/test/head.js b/browser/base/content/test/head.js
deleted file mode 100644
index fbc28f41e..000000000
--- a/browser/base/content/test/head.js
+++ /dev/null
@@ -1,400 +0,0 @@
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/commonjs/sdk/core/promise.js");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-
-function whenDelayedStartupFinished(aWindow, aCallback) {
- Services.obs.addObserver(function observer(aSubject, aTopic) {
- if (aWindow == aSubject) {
- Services.obs.removeObserver(observer, aTopic);
- executeSoon(aCallback);
- }
- }, "browser-delayed-startup-finished", false);
-}
-
-function findChromeWindowByURI(aURI) {
- let windows = Services.wm.getEnumerator(null);
- while (windows.hasMoreElements()) {
- let win = windows.getNext();
- if (win.location.href == aURI)
- return win;
- }
- return null;
-}
-
-function updateTabContextMenu(tab) {
- let menu = document.getElementById("tabContextMenu");
- if (!tab)
- tab = gBrowser.selectedTab;
- var evt = new Event("");
- tab.dispatchEvent(evt);
- menu.openPopup(tab, "end_after", 0, 0, true, false, evt);
- is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
- menu.hidePopup();
-}
-
-function findToolbarCustomizationWindow(aBrowserWin) {
- if (!aBrowserWin)
- aBrowserWin = window;
-
- let iframe = aBrowserWin.document.getElementById("customizeToolbarSheetIFrame");
- let win = iframe && iframe.contentWindow;
- if (win)
- return win;
-
- win = findChromeWindowByURI("chrome://global/content/customizeToolbar.xul");
- if (win && win.opener == aBrowserWin)
- return win;
-
- throw Error("Failed to find the customization window");
-}
-
-function openToolbarCustomizationUI(aCallback, aBrowserWin) {
- if (!aBrowserWin)
- aBrowserWin = window;
-
- aBrowserWin.document.getElementById("cmd_CustomizeToolbars").doCommand();
-
- aBrowserWin.gNavToolbox.addEventListener("beforecustomization", function UI_loaded() {
- aBrowserWin.gNavToolbox.removeEventListener("beforecustomization", UI_loaded);
-
- let win = findToolbarCustomizationWindow(aBrowserWin);
- waitForFocus(function () {
- aCallback(win);
- }, win);
- });
-}
-
-function closeToolbarCustomizationUI(aCallback, aBrowserWin) {
- let win = findToolbarCustomizationWindow(aBrowserWin);
-
- win.addEventListener("unload", function unloaded() {
- win.removeEventListener("unload", unloaded);
- executeSoon(aCallback);
- });
-
- let button = win.document.getElementById("donebutton");
- button.focus();
- button.doCommand();
-}
-
-function waitForCondition(condition, nextTest, errorMsg) {
- var tries = 0;
- var interval = setInterval(function() {
- if (tries >= 30) {
- ok(false, errorMsg);
- moveOn();
- }
- if (condition()) {
- moveOn();
- }
- tries++;
- }, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
-}
-
-function getTestPlugin(aName) {
- var pluginName = aName || "Test Plug-in";
- var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
- var tags = ph.getPluginTags();
-
- // Find the test plugin
- for (var i = 0; i < tags.length; i++) {
- if (tags[i].name == pluginName)
- return tags[i];
- }
- ok(false, "Unable to find plugin");
- return null;
-}
-
-// after a test is done using the plugin doorhanger, we should just clear
-// any permissions that may have crept in
-function clearAllPluginPermissions() {
- let perms = Services.perms.enumerator;
- while (perms.hasMoreElements()) {
- let perm = perms.getNext();
- if (perm.type.startsWith('plugin')) {
- Services.perms.remove(perm.host, perm.type);
- }
- }
-}
-
-function updateBlocklist(aCallback) {
- var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
- .getService(Ci.nsITimerCallback);
- var observer = function() {
- Services.obs.removeObserver(observer, "blocklist-updated");
- SimpleTest.executeSoon(aCallback);
- };
- Services.obs.addObserver(observer, "blocklist-updated", false);
- blocklistNotifier.notify(null);
-}
-
-var _originalTestBlocklistURL = null;
-function setAndUpdateBlocklist(aURL, aCallback) {
- if (!_originalTestBlocklistURL)
- _originalTestBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
- Services.prefs.setCharPref("extensions.blocklist.url", aURL);
- updateBlocklist(aCallback);
-}
-
-function resetBlocklist() {
- Services.prefs.setCharPref("extensions.blocklist.url", _originalTestBlocklistURL);
-}
-
-function whenNewWindowLoaded(aOptions, aCallback) {
- let win = OpenBrowserWindow(aOptions);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- aCallback(win);
- }, false);
-}
-
-/**
- * Waits for all pending async statements on the default connection, before
- * proceeding with aCallback.
- *
- * @param aCallback
- * Function to be called when done.
- * @param aScope
- * Scope for the callback.
- * @param aArguments
- * Arguments array for the callback.
- *
- * @note The result is achieved by asynchronously executing a query requiring
- * a write lock. Since all statements on the same connection are
- * serialized, the end of this write operation means that all writes are
- * complete. Note that WAL makes so that writers don't block readers, but
- * this is a problem only across different connections.
- */
-function waitForAsyncUpdates(aCallback, aScope, aArguments) {
- let scope = aScope || this;
- let args = aArguments || [];
- let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
- .DBConnection;
- let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
- begin.executeAsync();
- begin.finalize();
-
- let commit = db.createAsyncStatement("COMMIT");
- commit.executeAsync({
- handleResult: function() {},
- handleError: function() {},
- handleCompletion: function(aReason) {
- aCallback.apply(scope, args);
- }
- });
- commit.finalize();
-}
-
-/**
- * Asynchronously check a url is visited.
-
- * @param aURI The URI.
- * @param aExpectedValue The expected value.
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aURI, aExpectedValue) {
- let deferred = Promise.defer();
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
- deferred.resolve(aIsVisited);
- });
-
- return deferred.promise;
-}
-
-function whenNewTabLoaded(aWindow, aCallback) {
- aWindow.BrowserOpenTab();
-
- let browser = aWindow.gBrowser.selectedBrowser;
- if (browser.contentDocument.readyState === "complete") {
- aCallback();
- return;
- }
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- aCallback();
- }, true);
-}
-
-function addVisits(aPlaceInfo, aCallback) {
- let places = [];
- if (aPlaceInfo instanceof Ci.nsIURI) {
- places.push({ uri: aPlaceInfo });
- } else if (Array.isArray(aPlaceInfo)) {
- places = places.concat(aPlaceInfo);
- } else {
- places.push(aPlaceInfo);
- }
-
- // Create mozIVisitInfo for each entry.
- let now = Date.now();
- for (let i = 0; i < places.length; i++) {
- if (!places[i].title) {
- places[i].title = "test visit for " + places[i].uri.spec;
- }
- places[i].visits = [{
- transitionType: places[i].transition === undefined ? Ci.nsINavHistoryService.TRANSITION_LINK
- : places[i].transition,
- visitDate: places[i].visitDate || (now++) * 1000,
- referrerURI: places[i].referrer
- }];
- }
-
- PlacesUtils.asyncHistory.updatePlaces(
- places,
- {
- handleError: function AAV_handleError() {
- throw("Unexpected error in adding visit.");
- },
- handleResult: function () {},
- handleCompletion: function UP_handleCompletion() {
- if (aCallback)
- aCallback();
- }
- }
- );
-}
-
-/**
- * Ensures that the specified URIs are either cleared or not.
- *
- * @param aURIs
- * Array of page URIs
- * @param aShouldBeCleared
- * True if each visit to the URI should be cleared, false otherwise
- */
-function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
- let deferred = Promise.defer();
- let callbackCount = 0;
- let niceStr = aShouldBeCleared ? "no longer" : "still";
- function callbackDone() {
- if (++callbackCount == aURIs.length)
- deferred.resolve();
- }
- aURIs.forEach(function (aURI) {
- PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
- is(aIsVisited, !aShouldBeCleared,
- "history visit " + aURI.spec + " should " + niceStr + " exist");
- callbackDone();
- });
- });
-
- return deferred.promise;
-}
-
-let FullZoomHelper = {
-
- selectTabAndWaitForLocationChange: function selectTabAndWaitForLocationChange(tab) {
- if (!tab)
- throw new Error("tab must be given.");
- if (gBrowser.selectedTab == tab)
- return Promise.resolve();
- gBrowser.selectedTab = tab;
- return this.waitForLocationChange();
- },
-
- removeTabAndWaitForLocationChange: function removeTabAndWaitForLocationChange(tab) {
- tab = tab || gBrowser.selectedTab;
- let selected = gBrowser.selectedTab == tab;
- gBrowser.removeTab(tab);
- if (selected)
- return this.waitForLocationChange();
- return Promise.resolve();
- },
-
- waitForLocationChange: function waitForLocationChange() {
- let deferred = Promise.defer();
- Services.obs.addObserver(function obs() {
- Services.obs.removeObserver(obs, "browser-fullZoom:locationChange");
- deferred.resolve();
- }, "browser-fullZoom:locationChange", false);
- return deferred.promise;
- },
-
- load: function load(tab, url) {
- let deferred = Promise.defer();
- let didLoad = false;
- let didZoom = false;
-
- tab.linkedBrowser.addEventListener("load", function (event) {
- event.currentTarget.removeEventListener("load", arguments.callee, true);
- didLoad = true;
- if (didZoom)
- deferred.resolve();
- }, true);
-
- this.waitForLocationChange().then(function () {
- didZoom = true;
- if (didLoad)
- deferred.resolve();
- });
-
- tab.linkedBrowser.loadURI(url);
-
- return deferred.promise;
- },
-
- zoomTest: function zoomTest(tab, val, msg) {
- is(ZoomManager.getZoomForBrowser(tab.linkedBrowser), val, msg);
- },
-
- enlarge: function enlarge() {
- let deferred = Promise.defer();
- FullZoom.enlarge(function () deferred.resolve());
- return deferred.promise;
- },
-
- reduce: function reduce() {
- let deferred = Promise.defer();
- FullZoom.reduce(function () deferred.resolve());
- return deferred.promise;
- },
-
- reset: function reset() {
- let deferred = Promise.defer();
- FullZoom.reset(function () deferred.resolve());
- return deferred.promise;
- },
-
- BACK: 0,
- FORWARD: 1,
- navigate: function navigate(direction) {
- let deferred = Promise.defer();
- let didPs = false;
- let didZoom = false;
-
- gBrowser.addEventListener("pageshow", function (event) {
- gBrowser.removeEventListener("pageshow", arguments.callee, true);
- didPs = true;
- if (didZoom)
- deferred.resolve();
- }, true);
-
- if (direction == this.BACK)
- gBrowser.goBack();
- else if (direction == this.FORWARD)
- gBrowser.goForward();
-
- this.waitForLocationChange().then(function () {
- didZoom = true;
- if (didPs)
- deferred.resolve();
- });
- return deferred.promise;
- },
-
- failAndContinue: function failAndContinue(func) {
- return function (err) {
- ok(false, err);
- func();
- };
- },
-};
diff --git a/browser/base/content/test/head_plain.js b/browser/base/content/test/head_plain.js
deleted file mode 100644
index 62f9afb2e..000000000
--- a/browser/base/content/test/head_plain.js
+++ /dev/null
@@ -1,15 +0,0 @@
-
-function waitForCondition(condition, nextTest, errorMsg) {
- var tries = 0;
- var interval = setInterval(function() {
- if (tries >= 30) {
- ok(false, errorMsg);
- moveOn();
- }
- if (condition()) {
- moveOn();
- }
- tries++;
- }, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
-}
diff --git a/browser/base/content/test/healthreport_testRemoteCommands.html b/browser/base/content/test/healthreport_testRemoteCommands.html
deleted file mode 100644
index 1cd6de841..000000000
--- a/browser/base/content/test/healthreport_testRemoteCommands.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
-
-<script>
-
-function init() {
- window.addEventListener("message", function process(e) {doTest(e)}, false);
- doTest();
-}
-
-function checkSubmissionValue(payload, expectedValue) {
- return payload.enabled == expectedValue;
-}
-
-function validatePayload(payload) {
- payload = JSON.parse(payload);
-
- // xxxmpc - this is some pretty low-bar validation, but we have plenty of tests of that API elsewhere
- if (!payload.thisPingDate)
- return false;
-
- return true;
-}
-
-var tests = [
-{
- info: "Checking initial value is enabled",
- event: "RequestCurrentPrefs",
- payloadType: "prefs",
- validateResponse: function(payload) {
- return checkSubmissionValue(payload, true);
- },
-},
-{
- info: "Verifying disabling works",
- event: "DisableDataSubmission",
- payloadType: "prefs",
- validateResponse: function(payload) {
- return checkSubmissionValue(payload, false);
- },
-},
-{
- info: "Verifying we're still disabled",
- event: "RequestCurrentPrefs",
- payloadType: "prefs",
- validateResponse: function(payload) {
- return checkSubmissionValue(payload, false);
- },
-},
-{
- info: "Verifying we can get a payload while submission is disabled",
- event: "RequestCurrentPayload",
- payloadType: "payload",
- validateResponse: function(payload) {
- return validatePayload(payload);
- },
-},
-{
- info: "Verifying enabling works",
- event: "EnableDataSubmission",
- payloadType: "prefs",
- validateResponse: function(payload) {
- return checkSubmissionValue(payload, true);
- },
-},
-{
- info: "Verifying we're still re-enabled",
- event: "RequestCurrentPrefs",
- payloadType: "prefs",
- validateResponse: function(payload) {
- return checkSubmissionValue(payload, true);
- },
-},
-{
- info: "Verifying we can get a payload after re-enabling",
- event: "RequestCurrentPayload",
- payloadType: "payload",
- validateResponse: function(payload) {
- return validatePayload(payload);
- },
-},
-];
-
-var currentTest = -1;
-function doTest(evt) {
- if (evt) {
- if (currentTest < 0 || !evt.data.content)
- return; // not yet testing
-
- var test = tests[currentTest];
- if (evt.data.type != test.payloadType)
- return; // skip unrequested events
-
- var error = JSON.stringify(evt.data.content);
- var pass = false;
- try {
- pass = test.validateResponse(evt.data.content)
- } catch (e) {}
- reportResult(test.info, pass, error);
- }
- // start the next test if there are any left
- if (tests[++currentTest])
- sendToBrowser(tests[currentTest].event);
- else
- reportFinished();
-}
-
-function reportResult(info, pass, error) {
- var data = {type: "testResult", info: info, pass: pass, error: error};
- window.parent.postMessage(data, "*");
-}
-
-function reportFinished(cmd) {
- var data = {type: "testsComplete", count: tests.length};
- window.parent.postMessage(data, "*");
-}
-
-function sendToBrowser(type) {
- var event = new CustomEvent("RemoteHealthReportCommand", {detail: {command: type}, bubbles: true});
- document.dispatchEvent(event);
-}
-
-</script>
- </head>
- <body onload="init()">
- </body>
-</html>
diff --git a/browser/base/content/test/moz.build b/browser/base/content/test/moz.build
deleted file mode 100644
index 27399e075..000000000
--- a/browser/base/content/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['newtab', 'social']
-
diff --git a/browser/base/content/test/moz.png b/browser/base/content/test/moz.png
deleted file mode 100644
index 769c63634..000000000
--- a/browser/base/content/test/moz.png
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/newtab/Makefile.in b/browser/base/content/test/newtab/Makefile.in
deleted file mode 100644
index 6ac460d14..000000000
--- a/browser/base/content/test/newtab/Makefile.in
+++ /dev/null
@@ -1,38 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_newtab_block.js \
- browser_newtab_disable.js \
- browser_newtab_drag_drop.js \
- browser_newtab_drag_drop_ext.js \
- browser_newtab_drop_preview.js \
- browser_newtab_focus.js \
- browser_newtab_reset.js \
- browser_newtab_tabsync.js \
- browser_newtab_undo.js \
- browser_newtab_unpin.js \
- browser_newtab_bug721442.js \
- browser_newtab_bug722273.js \
- browser_newtab_bug723102.js \
- browser_newtab_bug723121.js \
- browser_newtab_bug725996.js \
- browser_newtab_bug734043.js \
- browser_newtab_bug735987.js \
- browser_newtab_bug752841.js \
- browser_newtab_bug765628.js \
- browser_newtab_bug876313.js \
- browser_newtab_perwindow_private_browsing.js \
- head.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/base/content/test/newtab/browser_newtab_block.js b/browser/base/content/test/newtab/browser_newtab_block.js
deleted file mode 100644
index bcb3d7baf..000000000
--- a/browser/base/content/test/newtab/browser_newtab_block.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that blocking/removing sites from the grid works
- * as expected. Pinned tabs should not be moved. Gaps will be re-filled
- * if more sites are available.
- */
-function runTests() {
- // we remove sites and expect the gaps to be filled as long as there still
- // are some sites available
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- yield blockCell(4);
- checkGrid("0,1,2,3,5,6,7,8,9");
-
- yield blockCell(4);
- checkGrid("0,1,2,3,6,7,8,9,");
-
- yield blockCell(4);
- checkGrid("0,1,2,3,7,8,9,,");
-
- // we removed a pinned site
- yield restore();
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",1");
-
- yield addNewTabPageTab();
- checkGrid("0,1p,2,3,4,5,6,7,8");
-
- yield blockCell(1);
- checkGrid("0,2,3,4,5,6,7,8,");
-
- // we remove the last site on the grid (which is pinned) and expect the gap
- // to be re-filled and the new site to be unpinned
- yield restore();
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
- setPinnedLinks(",,,,,,,,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8p");
-
- yield blockCell(8);
- checkGrid("0,1,2,3,4,5,6,7,9");
-
- // we remove the first site on the grid with the last one pinned. all cells
- // but the last one should shift to the left and a new site fades in
- yield restore();
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
- setPinnedLinks(",,,,,,,,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8p");
-
- yield blockCell(0);
- checkGrid("1,2,3,4,5,6,7,9,8p");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug721442.js b/browser/base/content/test/newtab/browser_newtab_bug721442.js
deleted file mode 100644
index 597aed251..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug721442.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks([
- {url: "http://example.com/#7", title: ""},
- {url: "http://example.com/#8", title: "title"},
- {url: "http://example.com/#9", title: "http://example.com/#9"}
- ]);
-
- yield addNewTabPageTab();
- checkGrid("7p,8p,9p,0,1,2,3,4,5");
-
- checkTooltip(0, "http://example.com/#7", "1st tooltip is correct");
- checkTooltip(1, "title\nhttp://example.com/#8", "2nd tooltip is correct");
- checkTooltip(2, "http://example.com/#9", "3rd tooltip is correct");
-}
-
-function checkTooltip(aIndex, aExpected, aMessage) {
- let link = getCell(aIndex).node.querySelector(".newtab-link");
- is(link.getAttribute("title"), aExpected, aMessage);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug722273.js b/browser/base/content/test/newtab/browser_newtab_bug722273.js
deleted file mode 100644
index bc561b321..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug722273.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const NOW = Date.now() * 1000;
-const URL = "http://fake-site.com/";
-
-let tmp = {};
-Cc["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tmp);
-
-let {Sanitizer} = tmp;
-
-function runTests() {
- sanitizeHistory();
- yield addFakeVisits();
- yield addNewTabPageTab();
-
- is(getCell(0).site.url, URL, "first site is our fake site");
-
- whenPagesUpdated();
- yield sanitizeHistory();
-
- ok(!getCell(0).site, "the fake site is gone");
-}
-
-function addFakeVisits() {
- let visits = [];
- for (let i = 59; i > 0; i--) {
- visits.push({
- visitDate: NOW - i * 60 * 1000000,
- transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
- });
- }
- let place = {
- uri: makeURI(URL),
- title: "fake site",
- visits: visits
- };
- PlacesUtils.asyncHistory.updatePlaces(place, {
- handleError: function () ok(false, "couldn't add visit"),
- handleResult: function () {},
- handleCompletion: function () {
- NewTabUtils.links.populateCache(function () {
- NewTabUtils.allPages.update();
- TestRunner.next();
- }, true);
- }
- });
-}
-
-function sanitizeHistory() {
- let s = new Sanitizer();
- s.prefDomain = "privacy.cpd.";
-
- let prefs = gPrefService.getBranch(s.prefDomain);
- prefs.setBoolPref("history", true);
- prefs.setBoolPref("downloads", false);
- prefs.setBoolPref("cache", false);
- prefs.setBoolPref("cookies", false);
- prefs.setBoolPref("formdata", false);
- prefs.setBoolPref("offlineApps", false);
- prefs.setBoolPref("passwords", false);
- prefs.setBoolPref("sessions", false);
- prefs.setBoolPref("siteSettings", false);
-
- s.sanitize();
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug723102.js b/browser/base/content/test/newtab/browser_newtab_bug723102.js
deleted file mode 100644
index aa04b1150..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug723102.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- // create a new tab page and hide it.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- let firstTab = gBrowser.selectedTab;
-
- yield addNewTabPageTab();
- gBrowser.removeTab(firstTab);
-
- ok(NewTabUtils.allPages.enabled, "page is enabled");
- NewTabUtils.allPages.enabled = false;
- ok(getGrid().node.hasAttribute("page-disabled"), "page is disabled");
- NewTabUtils.allPages.enabled = true;
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug723121.js b/browser/base/content/test/newtab/browser_newtab_bug723121.js
deleted file mode 100644
index 5ad8e7ca0..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug723121.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGridLocked(false, "grid is unlocked");
-
- let cell = getCell(0).node;
- let site = getCell(0).site.node;
- let link = site.querySelector(".newtab-link");
-
- sendDragEvent("dragstart", link);
- checkGridLocked(true, "grid is now locked");
-
- sendDragEvent("dragend", link);
- checkGridLocked(false, "grid isn't locked anymore");
-
- sendDragEvent("dragstart", cell);
- checkGridLocked(false, "grid isn't locked - dragstart was ignored");
-
- sendDragEvent("dragstart", site);
- checkGridLocked(false, "grid isn't locked - dragstart was ignored");
-}
-
-function checkGridLocked(aLocked, aMessage) {
- is(getGrid().node.hasAttribute("locked"), aLocked, aMessage);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug725996.js b/browser/base/content/test/newtab/browser_newtab_bug725996.js
deleted file mode 100644
index 4d3ef7d5e..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug725996.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- let cell = getCell(0).node;
-
- sendDragEvent("drop", cell, "http://example.com/#99\nblank");
- is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99",
- "first cell is pinned and contains the dropped site");
-
- yield whenPagesUpdated();
- checkGrid("99p,0,1,2,3,4,5,6,7");
-
- sendDragEvent("drop", cell, "");
- is(NewTabUtils.pinnedLinks.links[0].url, "http://example.com/#99",
- "first cell is still pinned with the site we dropped before");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug734043.js b/browser/base/content/test/newtab/browser_newtab_bug734043.js
deleted file mode 100644
index dff7a14b4..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug734043.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- let receivedError = false;
- let block = getContentDocument().querySelector(".newtab-control-block");
-
- function onError() {
- receivedError = true;
- }
-
- let cw = getContentWindow();
- cw.addEventListener("error", onError);
-
- for (let i = 0; i < 3; i++)
- EventUtils.synthesizeMouseAtCenter(block, {}, cw);
-
- yield whenPagesUpdated();
- ok(!receivedError, "we got here without any errors");
- cw.removeEventListener("error", onError);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug735987.js b/browser/base/content/test/newtab/browser_newtab_bug735987.js
deleted file mode 100644
index 8dda601b9..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug735987.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- yield simulateDrop(1);
- checkGrid("0,99p,1,2,3,4,5,6,7");
-
- yield blockCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- yield simulateDrop(1);
- checkGrid("0,99p,1,2,3,4,5,6,7");
-
- NewTabUtils.blockedLinks.resetCache();
- yield addNewTabPageTab();
- checkGrid("0,99p,1,2,3,4,5,6,7");
-
- yield blockCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug752841.js b/browser/base/content/test/newtab/browser_newtab_bug752841.js
deleted file mode 100644
index 91c347b0c..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug752841.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
-const PREF_NEWTAB_COLUMNS = "browser.newtabpage.columns";
-
-function runTests() {
- let testValues = [
- {row: 0, column: 0},
- {row: -1, column: -1},
- {row: -1, column: 0},
- {row: 0, column: -1},
- {row: 2, column: 4},
- {row: 2, column: 5},
- ];
-
- // Expected length of grid
- let expectedValues = [1, 1, 1, 1, 8, 10];
-
- // Values before setting new pref values (9 is the default value -> 3 x 3)
- let previousValues = [9, 1, 1, 1, 1, 8];
-
- let existingTab, existingTabGridLength, newTab, newTabGridLength;
- yield addNewTabPageTab();
- existingTab = gBrowser.selectedTab;
-
- for (let i = 0; i < expectedValues.length; i++) {
- gBrowser.selectedTab = existingTab;
- existingTabGridLength = getGrid().cells.length;
- is(existingTabGridLength, previousValues[i],
- "Grid length of existing page before update is correctly.");
-
- Services.prefs.setIntPref(PREF_NEWTAB_ROWS, testValues[i].row);
- Services.prefs.setIntPref(PREF_NEWTAB_COLUMNS, testValues[i].column);
-
- existingTabGridLength = getGrid().cells.length;
- is(existingTabGridLength, expectedValues[i],
- "Existing page grid is updated correctly.");
-
- yield addNewTabPageTab();
- newTab = gBrowser.selectedTab;
- newTabGridLength = getGrid().cells.length;
- is(newTabGridLength, expectedValues[i],
- "New page grid is updated correctly.");
-
- gBrowser.removeTab(newTab);
- }
-
- gBrowser.removeTab(existingTab);
-
- Services.prefs.clearUserPref(PREF_NEWTAB_ROWS);
- Services.prefs.clearUserPref(PREF_NEWTAB_COLUMNS);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug765628.js b/browser/base/content/test/newtab/browser_newtab_bug765628.js
deleted file mode 100644
index 6b93c8e6d..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug765628.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff";
-const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99";
-
-function runTests() {
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- sendDropEvent(0, BAD_DRAG_DATA);
- sendDropEvent(1, GOOD_DRAG_DATA);
-
- yield whenPagesUpdated();
- checkGrid("0,99p,1,2,3,4,5,6,7");
-}
-
-function sendDropEvent(aCellIndex, aDragData) {
- let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor);
- let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils);
-
- let event = createDragEvent("drop", aDragData);
- windowUtils.dispatchDOMEventViaPresShell(getCell(aCellIndex).node, event, true);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_bug876313.js b/browser/base/content/test/newtab/browser_newtab_bug876313.js
deleted file mode 100644
index ed9e8fbb3..000000000
--- a/browser/base/content/test/newtab/browser_newtab_bug876313.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * This test makes sure that the changes made by unpinning
- * a site are actually written to NewTabUtils' storage.
- */
-function runTests() {
- // Second cell is pinned with page #99.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",99");
-
- yield addNewTabPageTab();
- checkGrid("0,99p,1,2,3,4,5,6,7");
-
- // Unpin the second cell's site.
- yield unpinCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- // Clear the pinned cache to force NewTabUtils to read the pref again.
- NewTabUtils.pinnedLinks.resetCache();
- NewTabUtils.allPages.update();
- checkGrid("0,1,2,3,4,5,6,7,8");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_disable.js b/browser/base/content/test/newtab/browser_newtab_disable.js
deleted file mode 100644
index 57aa59761..000000000
--- a/browser/base/content/test/newtab/browser_newtab_disable.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that the 'New Tab Page' feature can be disabled if the
- * decides not to use it.
- */
-function runTests() {
- // create a new tab page and hide it.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- let gridNode = getGrid().node;
-
- ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
-
- NewTabUtils.allPages.enabled = false;
- ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
-
- let oldGridNode = gridNode;
-
- // create a second new tage page and make sure it's disabled. enable it
- // again and check if the former page gets enabled as well.
- yield addNewTabPageTab();
- ok(gridNode.hasAttribute("page-disabled"), "page is disabled");
-
- // check that no sites have been rendered
- is(0, getContentDocument().querySelectorAll(".site").length, "no sites have been rendered");
-
- NewTabUtils.allPages.enabled = true;
- ok(!gridNode.hasAttribute("page-disabled"), "page is not disabled");
- ok(!oldGridNode.hasAttribute("page-disabled"), "old page is not disabled");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_drag_drop.js b/browser/base/content/test/newtab/browser_newtab_drag_drop.js
deleted file mode 100644
index 1c64ddf72..000000000
--- a/browser/base/content/test/newtab/browser_newtab_drag_drop.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that dragging and dropping sites works as expected.
- * Sites contained in the grid need to shift around to indicate the result
- * of the drag-and-drop operation. If the grid is full and we're dragging
- * a new site into it another one gets pushed out.
- */
-function runTests() {
- requestLongerTimeout(2);
-
- // test a simple drag-and-drop scenario
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- yield simulateDrop(1, 0);
- checkGrid("1,0p,2,3,4,5,6,7,8");
-
- // drag a cell to its current cell and make sure it's not pinned afterwards
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- yield simulateDrop(0, 0);
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- // ensure that pinned pages aren't moved if that's not necessary
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",1,2");
-
- yield addNewTabPageTab();
- checkGrid("0,1p,2p,3,4,5,6,7,8");
-
- yield simulateDrop(3, 0);
- checkGrid("3,1p,2p,0p,4,5,6,7,8");
-
- // pinned sites should always be moved around as blocks. if a pinned site is
- // moved around, neighboring pinned are affected as well
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("0,1");
-
- yield addNewTabPageTab();
- checkGrid("0p,1p,2,3,4,5,6,7,8");
-
- yield simulateDrop(0, 2);
- checkGrid("2p,0p,1p,3,4,5,6,7,8");
-
- // pinned sites should not be pushed out of the grid (unless there are only
- // pinned ones left on the grid)
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",,,,,,,7,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7p,8p");
-
- yield simulateDrop(8, 2);
- checkGrid("0,1,3,4,5,6,7p,8p,2p");
-
- // make sure that pinned sites are re-positioned correctly
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("0,1,2,,,5");
-
- yield addNewTabPageTab();
- checkGrid("0p,1p,2p,3,4,5p,6,7,8");
-
- yield simulateDrop(4, 0);
- checkGrid("3,1p,2p,4,0p,5p,6,7,8");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js b/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js
deleted file mode 100644
index 527ea2cc7..000000000
--- a/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that dragging and dropping sites works as expected.
- * Sites contained in the grid need to shift around to indicate the result
- * of the drag-and-drop operation. If the grid is full and we're dragging
- * a new site into it another one gets pushed out.
- * This is a continuation of browser_newtab_drag_drop.js
- * to decrease test run time, focusing on external sites.
- */
-function runTests() {
- // drag a new site onto the very first cell
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",,,,,,,7,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7p,8p");
-
- yield simulateDrop(0);
- checkGrid("99p,0,1,2,3,4,5,7p,8p");
-
- // drag a new site onto the grid and make sure that pinned cells don't get
- // pushed out
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",,,,,,,7,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7p,8p");
-
- yield simulateDrop(7);
- checkGrid("0,1,2,3,4,5,7p,99p,8p");
-
- // drag a new site beneath a pinned cell and make sure the pinned cell is
- // not moved
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",,,,,,,,8");
-
- yield addNewTabPageTab();
- checkGrid("0,1,2,3,4,5,6,7,8p");
-
- yield simulateDrop(7);
- checkGrid("0,1,2,3,4,5,6,99p,8p");
-
- // drag a new site onto a block of pinned sites and make sure they're shifted
- // around accordingly
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("0,1,2,,,,,,");
-
- yield addNewTabPageTab();
- checkGrid("0p,1p,2p");
-
- yield simulateDrop(1);
- checkGrid("0p,99p,1p,2p,3,4,5,6,7");
-} \ No newline at end of file
diff --git a/browser/base/content/test/newtab/browser_newtab_drop_preview.js b/browser/base/content/test/newtab/browser_newtab_drop_preview.js
deleted file mode 100644
index 61c163d9d..000000000
--- a/browser/base/content/test/newtab/browser_newtab_drop_preview.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests ensure that the drop preview correctly arranges sites when
- * dragging them around.
- */
-function runTests() {
- // the first three sites are pinned - make sure they're re-arranged correctly
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("0,1,2,,,5");
-
- yield addNewTabPageTab();
- checkGrid("0p,1p,2p,3,4,5p,6,7,8");
-
- let cw = getContentWindow();
- cw.gDrag._draggedSite = getCell(0).site;
- let sites = cw.gDropPreview.rearrange(getCell(4));
- cw.gDrag._draggedSite = null;
-
- checkGrid("3,1p,2p,4,0p,5p,6,7,8", sites);
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_focus.js b/browser/base/content/test/newtab/browser_newtab_focus.js
deleted file mode 100644
index e841d3537..000000000
--- a/browser/base/content/test/newtab/browser_newtab_focus.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that focusing the 'New Tage Page' works as expected.
- */
-function runTests() {
- // Handle the OSX full keyboard access setting
- Services.prefs.setIntPref("accessibility.tabfocus", 7);
-
- // Focus count in new tab page.
- // 28 = 9 * 3 + 1 = 9 sites and 1 toggle button, each site has a link, a pin
- // and a remove button.
- let FOCUS_COUNT = 28;
-
- // Create a new tab page.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- gURLBar.focus();
-
- // Count the focus with the enabled page.
- yield countFocus(FOCUS_COUNT);
-
- // Disable page and count the focus with the disabled page.
- NewTabUtils.allPages.enabled = false;
- yield countFocus(1);
-
- Services.prefs.clearUserPref("accessibility.tabfocus");
- NewTabUtils.allPages.enabled = true;
-}
-
-/**
- * Focus the urlbar and count how many focus stops to return again to the urlbar.
- */
-function countFocus(aExpectedCount) {
- let focusCount = 0;
- let contentDoc = getContentDocument();
-
- window.addEventListener("focus", function onFocus() {
- let focusedElement = document.commandDispatcher.focusedElement;
- if (focusedElement && focusedElement.classList.contains("urlbar-input")) {
- window.removeEventListener("focus", onFocus, true);
- is(focusCount, aExpectedCount, "Validate focus count in the new tab page.");
- executeSoon(TestRunner.next);
- } else {
- if (focusedElement && focusedElement.ownerDocument == contentDoc &&
- focusedElement instanceof HTMLElement) {
- focusCount++;
- }
- document.commandDispatcher.advanceFocus();
- }
- }, true);
-
- document.commandDispatcher.advanceFocus();
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js b/browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js
deleted file mode 100644
index 68717a304..000000000
--- a/browser/base/content/test/newtab/browser_newtab_perwindow_private_browsing.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests ensure that all changes made to the new tab page in private
- * browsing mode are discarded after switching back to normal mode again.
- * The private browsing mode should start with the current grid shown in normal
- * mode.
- */
-
-function runTests() {
- // prepare the grid
- yield testOnWindow(undefined);
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
-
- yield addNewTabPageTab();
- pinCell(0);
- checkGrid("0p,1,2,3,4,5,6,7,8");
-
- // open private window
- yield testOnWindow({private: true});
-
- yield addNewTabPageTab();
- checkGrid("0p,1,2,3,4,5,6,7,8");
-
- // modify the grid while we're in pb mode
- yield blockCell(1);
- checkGrid("0p,2,3,4,5,6,7,8");
-
- yield unpinCell(0);
- checkGrid("0,2,3,4,5,6,7,8");
-
- // open normal window
- yield testOnWindow(undefined);
-
- // check that the grid is the same as before entering pb mode
- yield addNewTabPageTab();
- checkGrid("0,2,3,4,5,6,7,8")
-}
-
-var windowsToClose = [];
-function testOnWindow(options) {
- var win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- gWindow = win;
- whenDelayedStartupFinished(win, TestRunner.next);
- }, false);
-}
-
-function whenDelayedStartupFinished(win, callback) {
- const topic = "browser-delayed-startup-finished";
- Services.obs.addObserver(function onStartup(subject) {
- if (win == subject) {
- Services.obs.removeObserver(onStartup, topic);
- executeSoon(callback);
- }
- }, topic, false);
-}
-
-registerCleanupFunction(function () {
- gWindow = window;
- windowsToClose.forEach(function(win) {
- win.close();
- });
-});
-
diff --git a/browser/base/content/test/newtab/browser_newtab_reset.js b/browser/base/content/test/newtab/browser_newtab_reset.js
deleted file mode 100644
index 3503fbb8d..000000000
--- a/browser/base/content/test/newtab/browser_newtab_reset.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that resetting the 'New Tage Page' works as expected.
- */
-function runTests() {
- // Disabled until bug 716543 is fixed.
- return;
-
- // create a new tab page and check its modified state after blocking a site
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("");
-
- yield addNewTabPageTab();
- let resetButton = getContentDocument().getElementById("toolbar-button-reset");
-
- checkGrid("0,1,2,3,4,5,6,7,8");
- ok(!resetButton.hasAttribute("modified"), "page is not modified");
-
- yield blockCell(4);
- checkGrid("0,1,2,3,5,6,7,8,");
- ok(resetButton.hasAttribute("modified"), "page is modified");
-
- yield getContentWindow().gToolbar.reset(TestRunner.next);
- checkGrid("0,1,2,3,4,5,6,7,8");
- ok(!resetButton.hasAttribute("modified"), "page is not modified");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_tabsync.js b/browser/base/content/test/newtab/browser_newtab_tabsync.js
deleted file mode 100644
index 2ffd11b30..000000000
--- a/browser/base/content/test/newtab/browser_newtab_tabsync.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that all changes that are made to a specific
- * 'New Tab Page' are synchronized with all other open 'New Tab Pages'
- * automatically. All about:newtab pages should always be in the same
- * state.
- */
-function runTests() {
- // Disabled until bug 716543 is fixed.
- return;
-
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
- setPinnedLinks(",1");
-
- yield addNewTabPageTab();
- checkGrid("0,1p,2,3,4,5,6,7,8");
-
- let resetButton = getContentDocument().getElementById("toolbar-button-reset");
- ok(!resetButton.hasAttribute("modified"), "page is not modified");
-
- let oldSites = getGrid().sites;
- let oldResetButton = resetButton;
-
- // create the new tab page
- yield addNewTabPageTab();
- checkGrid("0,1p,2,3,4,5,6,7,8");
-
- resetButton = getContentDocument().getElementById("toolbar-button-reset");
- ok(!resetButton.hasAttribute("modified"), "page is not modified");
-
- // unpin a cell
- yield unpinCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
- checkGrid("0,1,2,3,4,5,6,7,8", oldSites);
-
- // remove a cell
- yield blockCell(1);
- checkGrid("0,2,3,4,5,6,7,8,9");
- checkGrid("0,2,3,4,5,6,7,8,9", oldSites);
- ok(resetButton.hasAttribute("modified"), "page is modified");
- ok(oldResetButton.hasAttribute("modified"), "page is modified");
-
- // insert a new cell by dragging
- yield simulateDrop(1);
- checkGrid("0,99p,2,3,4,5,6,7,8");
- checkGrid("0,99p,2,3,4,5,6,7,8", oldSites);
-
- // drag a cell around
- yield simulateDrop(1, 2);
- checkGrid("0,2p,99p,3,4,5,6,7,8");
- checkGrid("0,2p,99p,3,4,5,6,7,8", oldSites);
-
- // reset the new tab page
- yield getContentWindow().gToolbar.reset(TestRunner.next);
- checkGrid("0,1,2,3,4,5,6,7,8");
- checkGrid("0,1,2,3,4,5,6,7,8", oldSites);
- ok(!resetButton.hasAttribute("modified"), "page is not modified");
- ok(!oldResetButton.hasAttribute("modified"), "page is not modified");
-}
diff --git a/browser/base/content/test/newtab/browser_newtab_undo.js b/browser/base/content/test/newtab/browser_newtab_undo.js
deleted file mode 100644
index bc0eb3df2..000000000
--- a/browser/base/content/test/newtab/browser_newtab_undo.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that the undo dialog works as expected.
- */
-function runTests() {
- // remove unpinned sites and undo it
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks("5");
-
- yield addNewTabPageTab();
- checkGrid("5p,0,1,2,3,4,6,7,8");
-
- yield blockCell(4);
- yield blockCell(4);
- checkGrid("5p,0,1,2,6,7,8");
-
- yield undo();
- checkGrid("5p,0,1,2,4,6,7,8");
-
- // now remove a pinned site and undo it
- yield blockCell(0);
- checkGrid("0,1,2,4,6,7,8");
-
- yield undo();
- checkGrid("5p,0,1,2,4,6,7,8");
-
- // remove a site and restore all
- yield blockCell(1);
- checkGrid("5p,1,2,4,6,7,8");
-
- yield undoAll();
- checkGrid("5p,0,1,2,3,4,6,7,8");
-}
-
-function undo() {
- let cw = getContentWindow();
- let target = cw.document.getElementById("newtab-undo-button");
- EventUtils.synthesizeMouseAtCenter(target, {}, cw);
- whenPagesUpdated();
-}
-
-function undoAll() {
- let cw = getContentWindow();
- let target = cw.document.getElementById("newtab-undo-restore-button");
- EventUtils.synthesizeMouseAtCenter(target, {}, cw);
- whenPagesUpdated();
-} \ No newline at end of file
diff --git a/browser/base/content/test/newtab/browser_newtab_unpin.js b/browser/base/content/test/newtab/browser_newtab_unpin.js
deleted file mode 100644
index 6d2d45b1e..000000000
--- a/browser/base/content/test/newtab/browser_newtab_unpin.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * These tests make sure that when a site gets unpinned it is either moved to
- * its actual place in the grid or removed in case it's not on the grid anymore.
- */
-function runTests() {
- // we have a pinned link that didn't change its position since it was pinned.
- // nothing should happend when we unpin it.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",1");
-
- yield addNewTabPageTab();
- checkGrid("0,1p,2,3,4,5,6,7,8");
-
- yield unpinCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- // we have a pinned link that is not anymore in the list of the most-visited
- // links. this should disappear, the remaining links adjust their positions
- // and a new link will appear at the end of the grid.
- yield setLinks("0,1,2,3,4,5,6,7,8");
- setPinnedLinks(",99");
-
- yield addNewTabPageTab();
- checkGrid("0,99p,1,2,3,4,5,6,7");
-
- yield unpinCell(1);
- checkGrid("0,1,2,3,4,5,6,7,8");
-
- // we have a pinned link that changed its position since it was pinned. it
- // should be moved to its new position after being unpinned.
- yield setLinks("0,1,2,3,4,5,6,7");
- setPinnedLinks(",1,,,,,,,0");
-
- yield addNewTabPageTab();
- checkGrid("2,1p,3,4,5,6,7,,0p");
-
- yield unpinCell(1);
- checkGrid("1,2,3,4,5,6,7,,0p");
-
- yield unpinCell(8);
- checkGrid("0,1,2,3,4,5,6,7,");
-
- // we have pinned link that changed its position since it was pinned. the
- // link will disappear from the grid because it's now a much lower priority
- yield setLinks("0,1,2,3,4,5,6,7,8,9");
- setPinnedLinks("9");
-
- yield addNewTabPageTab();
- checkGrid("9p,0,1,2,3,4,5,6,7");
-
- yield unpinCell(0);
- checkGrid("0,1,2,3,4,5,6,7,8");
-}
diff --git a/browser/base/content/test/newtab/head.js b/browser/base/content/test/newtab/head.js
deleted file mode 100644
index b14d20f27..000000000
--- a/browser/base/content/test/newtab/head.js
+++ /dev/null
@@ -1,390 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled";
-
-Services.prefs.setBoolPref(PREF_NEWTAB_ENABLED, true);
-
-let tmp = {};
-Cu.import("resource://gre/modules/NewTabUtils.jsm", tmp);
-Cc["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Ci.mozIJSSubScriptLoader)
- .loadSubScript("chrome://browser/content/sanitize.js", tmp);
-
-let {NewTabUtils, Sanitizer} = tmp;
-
-let uri = Services.io.newURI("about:newtab", null, null);
-let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
-
-let gWindow = window;
-
-registerCleanupFunction(function () {
- while (gWindow.gBrowser.tabs.length > 1)
- gWindow.gBrowser.removeTab(gWindow.gBrowser.tabs[1]);
-
- Services.prefs.clearUserPref(PREF_NEWTAB_ENABLED);
-});
-
-/**
- * Provide the default test function to start our test runner.
- */
-function test() {
- TestRunner.run();
-}
-
-/**
- * The test runner that controls the execution flow of our tests.
- */
-let TestRunner = {
- /**
- * Starts the test runner.
- */
- run: function () {
- waitForExplicitFinish();
-
- this._iter = runTests();
- this.next();
- },
-
- /**
- * Runs the next available test or finishes if there's no test left.
- */
- next: function () {
- try {
- TestRunner._iter.next();
- } catch (e if e instanceof StopIteration) {
- TestRunner.finish();
- }
- },
-
- /**
- * Finishes all tests and cleans up.
- */
- finish: function () {
- function cleanupAndFinish() {
- clearHistory(function () {
- whenPagesUpdated(finish);
- NewTabUtils.restore();
- });
- }
-
- let callbacks = NewTabUtils.links._populateCallbacks;
- let numCallbacks = callbacks.length;
-
- if (numCallbacks)
- callbacks.splice(0, numCallbacks, cleanupAndFinish);
- else
- cleanupAndFinish();
- }
-};
-
-/**
- * Returns the selected tab's content window.
- * @return The content window.
- */
-function getContentWindow() {
- return gWindow.gBrowser.selectedBrowser.contentWindow;
-}
-
-/**
- * Returns the selected tab's content document.
- * @return The content document.
- */
-function getContentDocument() {
- return gWindow.gBrowser.selectedBrowser.contentDocument;
-}
-
-/**
- * Returns the newtab grid of the selected tab.
- * @return The newtab grid.
- */
-function getGrid() {
- return getContentWindow().gGrid;
-}
-
-/**
- * Returns the cell at the given index of the selected tab's newtab grid.
- * @param aIndex The cell index.
- * @return The newtab cell.
- */
-function getCell(aIndex) {
- return getGrid().cells[aIndex];
-}
-
-/**
- * Allows to provide a list of links that is used to construct the grid.
- * @param aLinksPattern the pattern (see below)
- *
- * Example: setLinks("1,2,3")
- * Result: [{url: "http://example.com/#1", title: "site#1"},
- * {url: "http://example.com/#2", title: "site#2"}
- * {url: "http://example.com/#3", title: "site#3"}]
- */
-function setLinks(aLinks) {
- let links = aLinks;
-
- if (typeof links == "string") {
- links = aLinks.split(/\s*,\s*/).map(function (id) {
- return {url: "http://example.com/#" + id, title: "site#" + id};
- });
- }
-
- // Call populateCache() once to make sure that all link fetching that is
- // currently in progress has ended. We clear the history, fill it with the
- // given entries and call populateCache() now again to make sure the cache
- // has the desired contents.
- NewTabUtils.links.populateCache(function () {
- clearHistory(function () {
- fillHistory(links, function () {
- NewTabUtils.links.populateCache(function () {
- NewTabUtils.allPages.update();
- TestRunner.next();
- }, true);
- });
- });
- });
-}
-
-function clearHistory(aCallback) {
- Services.obs.addObserver(function observe(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observe, aTopic);
- executeSoon(aCallback);
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
-
- PlacesUtils.history.removeAllPages();
-}
-
-function fillHistory(aLinks, aCallback) {
- let numLinks = aLinks.length;
- let transitionLink = Ci.nsINavHistoryService.TRANSITION_LINK;
-
- for (let link of aLinks.reverse()) {
- let place = {
- uri: makeURI(link.url),
- title: link.title,
- visits: [{visitDate: Date.now() * 1000, transitionType: transitionLink}]
- };
-
- PlacesUtils.asyncHistory.updatePlaces(place, {
- handleError: function () ok(false, "couldn't add visit to history"),
- handleResult: function () {},
- handleCompletion: function () {
- if (--numLinks == 0)
- aCallback();
- }
- });
- }
-}
-
-/**
- * Allows to specify the list of pinned links (that have a fixed position in
- * the grid.
- * @param aLinksPattern the pattern (see below)
- *
- * Example: setPinnedLinks("3,,1")
- * Result: 'http://example.com/#3' is pinned in the first cell. 'http://example.com/#1' is
- * pinned in the third cell.
- */
-function setPinnedLinks(aLinks) {
- let links = aLinks;
-
- if (typeof links == "string") {
- links = aLinks.split(/\s*,\s*/).map(function (id) {
- if (id)
- return {url: "http://example.com/#" + id, title: "site#" + id};
- });
- }
-
- let string = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString);
- string.data = JSON.stringify(links);
- Services.prefs.setComplexValue("browser.newtabpage.pinned",
- Ci.nsISupportsString, string);
-
- NewTabUtils.pinnedLinks.resetCache();
- NewTabUtils.allPages.update();
-}
-
-/**
- * Restore the grid state.
- */
-function restore() {
- whenPagesUpdated();
- NewTabUtils.restore();
-}
-
-/**
- * Creates a new tab containing 'about:newtab'.
- */
-function addNewTabPageTab() {
- let tab = gWindow.gBrowser.selectedTab = gWindow.gBrowser.addTab("about:newtab");
- let browser = tab.linkedBrowser;
-
- function whenNewTabLoaded() {
- if (NewTabUtils.allPages.enabled) {
- // Continue when the link cache has been populated.
- NewTabUtils.links.populateCache(function () {
- executeSoon(TestRunner.next);
- });
- } else {
- // It's important that we call next() asynchronously.
- // 'yield addNewTabPageTab()' would fail if next() is called
- // synchronously because the iterator is already executing.
- executeSoon(TestRunner.next);
- }
- }
-
- // The new tab page might have been preloaded in the background.
- if (browser.contentDocument.readyState == "complete") {
- whenNewTabLoaded();
- return;
- }
-
- // Wait for the new tab page to be loaded.
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- whenNewTabLoaded();
- }, true);
-}
-
-/**
- * Compares the current grid arrangement with the given pattern.
- * @param the pattern (see below)
- * @param the array of sites to compare with (optional)
- *
- * Example: checkGrid("3p,2,,1p")
- * Result: We expect the first cell to contain the pinned site 'http://example.com/#3'.
- * The second cell contains 'http://example.com/#2'. The third cell is empty.
- * The fourth cell contains the pinned site 'http://example.com/#4'.
- */
-function checkGrid(aSitesPattern, aSites) {
- let length = aSitesPattern.split(",").length;
- let sites = (aSites || getGrid().sites).slice(0, length);
- let current = sites.map(function (aSite) {
- if (!aSite)
- return "";
-
- let pinned = aSite.isPinned();
- let pinButton = aSite.node.querySelector(".newtab-control-pin");
- let hasPinnedAttr = pinButton.hasAttribute("pinned");
-
- if (pinned != hasPinnedAttr)
- ok(false, "invalid state (site.isPinned() != site[pinned])");
-
- return aSite.url.replace(/^http:\/\/example\.com\/#(\d+)$/, "$1") + (pinned ? "p" : "");
- });
-
- is(current, aSitesPattern, "grid status = " + aSitesPattern);
-}
-
-/**
- * Blocks a site from the grid.
- * @param aIndex The cell index.
- */
-function blockCell(aIndex) {
- whenPagesUpdated();
- getCell(aIndex).site.block();
-}
-
-/**
- * Pins a site on a given position.
- * @param aIndex The cell index.
- * @param aPinIndex The index the defines where the site should be pinned.
- */
-function pinCell(aIndex, aPinIndex) {
- getCell(aIndex).site.pin(aPinIndex);
-}
-
-/**
- * Unpins the given cell's site.
- * @param aIndex The cell index.
- */
-function unpinCell(aIndex) {
- whenPagesUpdated();
- getCell(aIndex).site.unpin();
-}
-
-/**
- * Simulates a drop and drop operation.
- * @param aDropIndex The cell index of the drop target.
- * @param aDragIndex The cell index containing the dragged site (optional).
- */
-function simulateDrop(aDropIndex, aDragIndex) {
- let draggedSite;
- let {gDrag: drag, gDrop: drop} = getContentWindow();
- let event = createDragEvent("drop", "http://example.com/#99\nblank");
-
- if (typeof aDragIndex != "undefined")
- draggedSite = getCell(aDragIndex).site;
-
- if (draggedSite)
- drag.start(draggedSite, event);
-
- whenPagesUpdated();
- drop.drop(getCell(aDropIndex), event);
-
- if (draggedSite)
- drag.end(draggedSite);
-}
-
-/**
- * Sends a custom drag event to a given DOM element.
- * @param aEventType The drag event's type.
- * @param aTarget The DOM element that the event is dispatched to.
- * @param aData The event's drag data (optional).
- */
-function sendDragEvent(aEventType, aTarget, aData) {
- let event = createDragEvent(aEventType, aData);
- let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor);
- let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils);
- windowUtils.dispatchDOMEventViaPresShell(aTarget, event, true);
-}
-
-/**
- * Creates a custom drag event.
- * @param aEventType The drag event's type.
- * @param aData The event's drag data (optional).
- * @return The drag event.
- */
-function createDragEvent(aEventType, aData) {
- let dataTransfer = {
- mozUserCancelled: false,
- setData: function () null,
- setDragImage: function () null,
- getData: function () aData,
-
- types: {
- contains: function (aType) aType == "text/x-moz-url"
- },
-
- mozGetDataAt: function (aType, aIndex) {
- if (aIndex || aType != "text/x-moz-url")
- return null;
-
- return aData;
- }
- };
-
- let event = getContentDocument().createEvent("DragEvents");
- event.initDragEvent(aEventType, true, true, getContentWindow(), 0, 0, 0, 0, 0,
- false, false, false, false, 0, null, dataTransfer);
-
- return event;
-}
-
-/**
- * Resumes testing when all pages have been updated.
- */
-function whenPagesUpdated(aCallback) {
- let page = {
- update: function () {
- NewTabUtils.allPages.unregister(this);
- executeSoon(aCallback || TestRunner.next);
- }
- };
-
- NewTabUtils.allPages.register(page);
- registerCleanupFunction(function () {
- NewTabUtils.allPages.unregister(page);
- });
-}
diff --git a/browser/base/content/test/newtab/moz.build b/browser/base/content/test/newtab/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/base/content/test/newtab/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/base/content/test/offlineChild.cacheManifest b/browser/base/content/test/offlineChild.cacheManifest
deleted file mode 100644
index 091fe7194..000000000
--- a/browser/base/content/test/offlineChild.cacheManifest
+++ /dev/null
@@ -1,2 +0,0 @@
-CACHE MANIFEST
-offlineChild.html
diff --git a/browser/base/content/test/offlineChild.cacheManifest^headers^ b/browser/base/content/test/offlineChild.cacheManifest^headers^
deleted file mode 100644
index 257f2eb60..000000000
--- a/browser/base/content/test/offlineChild.cacheManifest^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/cache-manifest
diff --git a/browser/base/content/test/offlineChild.html b/browser/base/content/test/offlineChild.html
deleted file mode 100644
index 43f225b3b..000000000
--- a/browser/base/content/test/offlineChild.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html manifest="offlineChild.cacheManifest">
-<head>
-<title></title>
-<script type="text/javascript">
-
-function finish(success) {
- window.parent.postMessage(success ? "success" : "failure", "*");
-}
-
-applicationCache.oncached = function() { finish(true); }
-applicationCache.onnoupdate = function() { finish(true); }
-applicationCache.onerror = function() { finish(false); }
-
-</script>
-</head>
-
-<body>
-<h1>Child</h1>
-</body>
-</html>
diff --git a/browser/base/content/test/offlineChild2.cacheManifest b/browser/base/content/test/offlineChild2.cacheManifest
deleted file mode 100644
index 19efe54fe..000000000
--- a/browser/base/content/test/offlineChild2.cacheManifest
+++ /dev/null
@@ -1,2 +0,0 @@
-CACHE MANIFEST
-offlineChild2.html
diff --git a/browser/base/content/test/offlineChild2.cacheManifest^headers^ b/browser/base/content/test/offlineChild2.cacheManifest^headers^
deleted file mode 100644
index 257f2eb60..000000000
--- a/browser/base/content/test/offlineChild2.cacheManifest^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/cache-manifest
diff --git a/browser/base/content/test/offlineChild2.html b/browser/base/content/test/offlineChild2.html
deleted file mode 100644
index ac762e759..000000000
--- a/browser/base/content/test/offlineChild2.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<html manifest="offlineChild2.cacheManifest">
-<head>
-<title></title>
-<script type="text/javascript">
-
-function finish(success) {
- window.parent.postMessage(success ? "success" : "failure", "*");
-}
-
-applicationCache.oncached = function() { finish(true); }
-applicationCache.onnoupdate = function() { finish(true); }
-applicationCache.onerror = function() { finish(false); }
-
-</script>
-</head>
-
-<body>
-<h1>Child</h1>
-</body>
-</html>
diff --git a/browser/base/content/test/offlineEvent.cacheManifest b/browser/base/content/test/offlineEvent.cacheManifest
deleted file mode 100644
index 091fe7194..000000000
--- a/browser/base/content/test/offlineEvent.cacheManifest
+++ /dev/null
@@ -1,2 +0,0 @@
-CACHE MANIFEST
-offlineChild.html
diff --git a/browser/base/content/test/offlineEvent.cacheManifest^headers^ b/browser/base/content/test/offlineEvent.cacheManifest^headers^
deleted file mode 100644
index 257f2eb60..000000000
--- a/browser/base/content/test/offlineEvent.cacheManifest^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/cache-manifest
diff --git a/browser/base/content/test/offlineEvent.html b/browser/base/content/test/offlineEvent.html
deleted file mode 100644
index f6e2494e2..000000000
--- a/browser/base/content/test/offlineEvent.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html manifest="offlineEvent.cacheManifest">
-<head>
-<title></title>
-</head>
-
-<body>
-<h1>Child</h1>
-</body>
-</html>
diff --git a/browser/base/content/test/offlineQuotaNotification.cacheManifest b/browser/base/content/test/offlineQuotaNotification.cacheManifest
deleted file mode 100644
index 2e210abd2..000000000
--- a/browser/base/content/test/offlineQuotaNotification.cacheManifest
+++ /dev/null
@@ -1,7 +0,0 @@
-CACHE MANIFEST
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-# store a "large" file so an "over quota warning" will be issued - any file
-# larger than 1kb and in '_BROWSER_FILES' should be right...
-title_test.svg
diff --git a/browser/base/content/test/offlineQuotaNotification.html b/browser/base/content/test/offlineQuotaNotification.html
deleted file mode 100644
index b1b91bf9e..000000000
--- a/browser/base/content/test/offlineQuotaNotification.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML>
-<html manifest="offlineQuotaNotification.cacheManifest">
-<head>
- <meta charset="utf-8">
- <title>Test offline app quota notification</title>
- <!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
-</head>
-</html>
diff --git a/browser/base/content/test/page_style_sample.html b/browser/base/content/test/page_style_sample.html
deleted file mode 100644
index 56637a58d..000000000
--- a/browser/base/content/test/page_style_sample.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<html>
- <head>
- <title>Test for page style menu</title>
- <!-- data-state values:
- 0: should not appear in the page style menu
- 0-todo: should not appear in the page style menu, but does
- 1: should appear in the page style menu
- 2: should appear in the page style menu as the selected stylesheet -->
- <link data-state="1" href="404.css" title="1" rel="alternate stylesheet">
- <link data-state="0" title="2" rel="alternate stylesheet">
- <link data-state="0" href="404.css" rel="alternate stylesheet">
- <link data-state="0" href="404.css" title="" rel="alternate stylesheet">
- <link data-state="1" href="404.css" title="3" rel="stylesheet alternate">
- <link data-state="1" href="404.css" title="4" rel=" alternate stylesheet ">
- <link data-state="1" href="404.css" title="5" rel="alternate stylesheet">
- <link data-state="2" href="404.css" title="6" rel="stylesheet">
- <link data-state="1" href="404.css" title="7" rel="foo stylesheet">
- <link data-state="0" href="404.css" title="8" rel="alternate">
- <link data-state="1" href="404.css" title="9" rel="alternate STYLEsheet">
- <link data-state="1" href="404.css" title="10" rel="alternate stylesheet" media="">
- <link data-state="1" href="404.css" title="11" rel="alternate stylesheet" media="all">
- <link data-state="1" href="404.css" title="12" rel="alternate stylesheet" media="ALL ">
- <link data-state="1" href="404.css" title="13" rel="alternate stylesheet" media="screen">
- <link data-state="1" href="404.css" title="14" rel="alternate stylesheet" media=" Screen">
- <link data-state="0" href="404.css" title="15" rel="alternate stylesheet" media="screen foo">
- <link data-state="0" href="404.css" title="16" rel="alternate stylesheet" media="all screen">
- <link data-state="0" href="404.css" title="17" rel="alternate stylesheet" media="foo bar">
- <link data-state="1" href="404.css" title="18" rel="alternate stylesheet" media="all,screen">
- <link data-state="1" href="404.css" title="19" rel="alternate stylesheet" media="all, screen">
- <link data-state="0" href="404.css" title="20" rel="alternate stylesheet" media="all screen">
- <link data-state="0" href="404.css" title="21" rel="alternate stylesheet" media="foo">
- <link data-state="0" href="404.css" title="22" rel="alternate stylesheet" media="allscreen">
- <link data-state="0" href="404.css" title="23" rel="alternate stylesheet" media="_all">
- <link data-state="0" href="404.css" title="24" rel="alternate stylesheet" media="not screen">
- <link data-state="1" href="404.css" title="25" rel="alternate stylesheet" media="only screen">
- <link data-state="1" href="404.css" title="26" rel="alternate stylesheet" media="screen and (min-device-width: 1px)">
- <link data-state="0" href="404.css" title="27" rel="alternate stylesheet" media="screen and (max-device-width: 1px)">
- </head>
- <body></body>
-</html>
diff --git a/browser/base/content/test/pluginCrashCommentAndURL.html b/browser/base/content/test/pluginCrashCommentAndURL.html
deleted file mode 100644
index 711a19ed3..000000000
--- a/browser/base/content/test/pluginCrashCommentAndURL.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript">
- function crash() {
- var plugin = document.getElementById("plugin");
- var argStr = decodeURIComponent(window.location.search.substr(1));
- if (argStr) {
- var args = JSON.parse(argStr);
- for (var key in args)
- plugin.setAttribute(key, args[key]);
- }
- try {
- plugin.crash();
- }
- catch (err) {}
- }
- </script>
- </head>
- <body onload="crash();">
- <embed id="plugin" type="application/x-test"
- width="400" height="400"
- drawmode="solid" color="FF00FFFF">
- </embed>
- </body>
-</html>
diff --git a/browser/base/content/test/plugin_add_dynamically.html b/browser/base/content/test/plugin_add_dynamically.html
deleted file mode 100644
index 3fdaf110c..000000000
--- a/browser/base/content/test/plugin_add_dynamically.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<script>
-function addPlugin(type="application/x-test") {
- var embed = document.createElement("embed");
- embed.style.width = "200px";
- embed.style.height = "200px";
- embed.setAttribute("type", type);
- return document.body.appendChild(embed);
-}
-</script>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_alternate_content.html b/browser/base/content/test/plugin_alternate_content.html
deleted file mode 100644
index f8acc833c..000000000
--- a/browser/base/content/test/plugin_alternate_content.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- bug 739575 -->
-<html>
-<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
-<body>
-<object id="test" type="application/x-test" style="height: 200px; width:200px">
-<p><a href="about:blank">you should not see this link when plugins are click-to-play</a></p>
-</object>
-</body></html>
diff --git a/browser/base/content/test/plugin_both.html b/browser/base/content/test/plugin_both.html
deleted file mode 100644
index 2f3d2efe8..000000000
--- a/browser/base/content/test/plugin_both.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_both2.html b/browser/base/content/test/plugin_both2.html
deleted file mode 100644
index ba605d6e8..000000000
--- a/browser/base/content/test/plugin_both2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_bug744745.html b/browser/base/content/test/plugin_bug744745.html
deleted file mode 100644
index d0691c9c0..000000000
--- a/browser/base/content/test/plugin_bug744745.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<style>
-.x {
- opacity: 0 !important;
-}
-</style>
-<object id="test" class="x" type="application/x-test" width=200 height=200></object>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_bug749455.html b/browser/base/content/test/plugin_bug749455.html
deleted file mode 100644
index 831dc82f7..000000000
--- a/browser/base/content/test/plugin_bug749455.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!-- bug 749455 -->
-<html>
-<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
-<body>
-<embed src="plugin_bug749455.html" type="application/x-test" width="100px" height="100px"></embed>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_bug752516.html b/browser/base/content/test/plugin_bug752516.html
deleted file mode 100644
index 6121e7068..000000000
--- a/browser/base/content/test/plugin_bug752516.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8"/>
- <style type="text/css">
- div {
- padding: 2%;
- position: absolute;
- top: 0; bottom: 0;
- left: 0; right: 0;
- text-align: center;
- border: 4px solid red;
- }
- </style>
-</head>
-<body>
- <div id="container">
- <object id="test" type="application/x-test" width="159" height="91"></object>
- </div>
- <div id="overlay">
- <h1>overlay</h1>
- </div>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_bug787619.html b/browser/base/content/test/plugin_bug787619.html
deleted file mode 100644
index cb91116f0..000000000
--- a/browser/base/content/test/plugin_bug787619.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
- <a id="wrapper">
- <embed id="plugin" style="width: 200px; height: 200px" type="application/x-test">
- </a>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_bug797677.html b/browser/base/content/test/plugin_bug797677.html
deleted file mode 100644
index 1545f3647..000000000
--- a/browser/base/content/test/plugin_bug797677.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body><embed id="plugin" type="9000"></embed></body>
-</html>
diff --git a/browser/base/content/test/plugin_bug820497.html b/browser/base/content/test/plugin_bug820497.html
deleted file mode 100644
index 4884e9dbe..000000000
--- a/browser/base/content/test/plugin_bug820497.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<object id="test" type="application/x-test" width=200 height=200></object>
-<script>
- function addSecondPlugin() {
- var object = document.createElement("object");
- object.type = "application/x-second-test";
- object.width = 200;
- object.height = 200;
- object.id = "secondtest";
- document.body.appendChild(object);
- }
-</script>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_clickToPlayAllow.html b/browser/base/content/test/plugin_clickToPlayAllow.html
deleted file mode 100644
index 3f5df1984..000000000
--- a/browser/base/content/test/plugin_clickToPlayAllow.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_clickToPlayDeny.html b/browser/base/content/test/plugin_clickToPlayDeny.html
deleted file mode 100644
index 3f5df1984..000000000
--- a/browser/base/content/test/plugin_clickToPlayDeny.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_data_url.html b/browser/base/content/test/plugin_data_url.html
deleted file mode 100644
index 77e101144..000000000
--- a/browser/base/content/test/plugin_data_url.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<body>
- <a id="data-link-1" href='data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>'>
- data: with one plugin
- </a><br />
- <a id="data-link-2" href='data:text/html,<embed id="test1" style="width: 200px; height: 200px" type="application/x-test"/><embed id="test2" style="width: 200px; height: 200px" type="application/x-second-test"/>'>
- data: with two plugins
- </a><br />
- <object id="test" style="width: 200px; height: 200px" type="application/x-test"></object>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_hidden_to_visible.html b/browser/base/content/test/plugin_hidden_to_visible.html
deleted file mode 100644
index e8d92c68c..000000000
--- a/browser/base/content/test/plugin_hidden_to_visible.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
- <div id="container" style="display: none">
- <object id="plugin" type="application/x-test" style="width: 200px; height: 200px;"></object>
- </div>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_test.html b/browser/base/content/test/plugin_test.html
deleted file mode 100644
index 3f5df1984..000000000
--- a/browser/base/content/test/plugin_test.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_test2.html b/browser/base/content/test/plugin_test2.html
deleted file mode 100644
index 95614c930..000000000
--- a/browser/base/content/test/plugin_test2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test1" style="width: 200px; height: 200px" type="application/x-test">
-<embed id="test2" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_test3.html b/browser/base/content/test/plugin_test3.html
deleted file mode 100644
index af14c0024..000000000
--- a/browser/base/content/test/plugin_test3.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 0px; height: 0px" type="application/x-test">
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_two_types.html b/browser/base/content/test/plugin_two_types.html
deleted file mode 100644
index 2359d2ec1..000000000
--- a/browser/base/content/test/plugin_two_types.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>
-<embed id="secondtestA" style="width: 200px; height: 200px" type="application/x-second-test"/>
-<embed id="secondtestB" style="width: 200px; height: 200px" type="application/x-second-test"/>
-</body>
-</html>
diff --git a/browser/base/content/test/plugin_unknown.html b/browser/base/content/test/plugin_unknown.html
deleted file mode 100644
index a35674549..000000000
--- a/browser/base/content/test/plugin_unknown.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-</body>
-</html>
diff --git a/browser/base/content/test/print_postdata.sjs b/browser/base/content/test/print_postdata.sjs
deleted file mode 100644
index 4175a2480..000000000
--- a/browser/base/content/test/print_postdata.sjs
+++ /dev/null
@@ -1,22 +0,0 @@
-const CC = Components.Constructor;
-const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
- "nsIBinaryInputStream",
- "setInputStream");
-
-function handleRequest(request, response) {
- response.setHeader("Content-Type", "text/plain", false);
- if (request.method == "GET") {
- response.write(request.queryString);
- } else {
- var body = new BinaryInputStream(request.bodyInputStream);
-
- var avail;
- var bytes = [];
-
- while ((avail = body.available()) > 0)
- Array.prototype.push.apply(bytes, body.readByteArray(avail));
-
- var data = String.fromCharCode.apply(null, bytes);
- response.bodyOutputStream.write(data, data.length);
- }
-}
diff --git a/browser/base/content/test/privateBrowsingMode.js b/browser/base/content/test/privateBrowsingMode.js
deleted file mode 100644
index a624d5281..000000000
--- a/browser/base/content/test/privateBrowsingMode.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// This file is only present in per-window private browsing buikds.
-var perWindowPrivateBrowsing = true;
-
diff --git a/browser/base/content/test/redirect_bug623155.sjs b/browser/base/content/test/redirect_bug623155.sjs
deleted file mode 100644
index 64c6f143b..000000000
--- a/browser/base/content/test/redirect_bug623155.sjs
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
-
-function handleRequest(aRequest, aResponse) {
- // Set HTTP Status
- aResponse.setStatusLine(aRequest.httpVersion, 301, "Moved Permanently");
-
- // Set redirect URI, mirroring the hash value.
- let hash = (/\#.+/.test(aRequest.path))?
- "#" + aRequest.path.split("#")[1]:
- "";
- aResponse.setHeader("Location", REDIRECT_TO + hash);
-}
diff --git a/browser/base/content/test/social/Makefile.in b/browser/base/content/test/social/Makefile.in
deleted file mode 100644
index 1aabbcdca..000000000
--- a/browser/base/content/test/social/Makefile.in
+++ /dev/null
@@ -1,47 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- blocklist.xml \
- browser_blocklist.js \
- browser_defaults.js \
- browser_addons.js \
- browser_chat_tearoff.js \
- browser_social_activation.js \
- browser_social_perwindowPB.js \
- browser_social_toolbar.js \
- browser_social_markButton.js \
- browser_social_sidebar.js \
- browser_social_flyout.js \
- browser_social_mozSocial_API.js \
- browser_social_isVisible.js \
- browser_social_chatwindow.js \
- browser_social_chatwindow_resize.js \
- browser_social_chatwindowfocus.js \
- browser_social_multiprovider.js \
- browser_social_errorPage.js \
- browser_social_window.js \
- social_activate.html \
- social_activate_iframe.html \
- browser_share.js \
- social_panel.html \
- social_mark_image.png \
- social_sidebar.html \
- social_chat.html \
- social_flyout.html \
- social_window.html \
- social_worker.js \
- share.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/base/content/test/social/blocklist.xml b/browser/base/content/test/social/blocklist.xml
deleted file mode 100644
index 2e3665c36..000000000
--- a/browser/base/content/test/social/blocklist.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
- <emItems>
- <emItem blockID="s1" id="test1.example.com@services.mozilla.org"></emItem>
- </emItems>
-</blocklist>
diff --git a/browser/base/content/test/social/browser_addons.js b/browser/base/content/test/social/browser_addons.js
deleted file mode 100644
index 1e3b336bd..000000000
--- a/browser/base/content/test/social/browser_addons.js
+++ /dev/null
@@ -1,327 +0,0 @@
-
-
-let AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm", {}).AddonManager;
-let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
-
-const ADDON_TYPE_SERVICE = "service";
-const ID_SUFFIX = "@services.mozilla.org";
-const STRING_TYPE_NAME = "type.%ID%.name";
-const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
-
-let manifest = { // builtin provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
-};
-let manifest2 = { // used for testing install
- name: "provider 2",
- origin: "https://test1.example.com",
- sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png",
- version: 1
-};
-
-function test() {
- waitForExplicitFinish();
-
- let prefname = getManifestPrefname(manifest);
- setBuiltinManifestPref(prefname, manifest);
- // ensure that manifest2 is NOT showing as builtin
- is(SocialService.getOriginActivationType(manifest.origin), "builtin", "manifest is builtin");
- is(SocialService.getOriginActivationType(manifest2.origin), "foreign", "manifest2 is not builtin");
-
- Services.prefs.setBoolPref("social.remote-install.enabled", true);
- runSocialTests(tests, undefined, undefined, function () {
- Services.prefs.clearUserPref("social.remote-install.enabled");
- // clear our builtin pref
- ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
- resetBuiltinManifestPref(prefname);
- // just in case the tests failed, clear these here as well
- Services.prefs.clearUserPref("social.whitelist");
- Services.prefs.clearUserPref("social.directories");
- finish();
- });
-}
-
-function installListener(next, aManifest) {
- let expectEvent = "onInstalling";
- let prefname = getManifestPrefname(aManifest);
- // wait for the actual removal to call next
- SocialService.registerProviderListener(function providerListener(topic, data) {
- if (topic == "provider-removed") {
- SocialService.unregisterProviderListener(providerListener);
- executeSoon(next);
- }
- });
-
- return {
- onInstalling: function(addon) {
- is(expectEvent, "onInstalling", "install started");
- is(addon.manifest.origin, aManifest.origin, "provider about to be installed");
- ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
- expectEvent = "onInstalled";
- },
- onInstalled: function(addon) {
- is(addon.manifest.origin, aManifest.origin, "provider installed");
- ok(addon.installDate.getTime() > 0, "addon has installDate");
- ok(addon.updateDate.getTime() > 0, "addon has updateDate");
- ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
- expectEvent = "onUninstalling";
- },
- onUninstalling: function(addon) {
- is(expectEvent, "onUninstalling", "uninstall started");
- is(addon.manifest.origin, aManifest.origin, "provider about to be uninstalled");
- ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
- expectEvent = "onUninstalled";
- },
- onUninstalled: function(addon) {
- is(expectEvent, "onUninstalled", "provider has been uninstalled");
- is(addon.manifest.origin, aManifest.origin, "provider uninstalled");
- ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
- AddonManager.removeAddonListener(this);
- }
- };
-}
-
-var tests = {
- testAddonEnableToggle: function(next) {
- let expectEvent;
- let prefname = getManifestPrefname(manifest);
- let listener = {
- onEnabled: function(addon) {
- is(expectEvent, "onEnabled", "provider onEnabled");
- ok(!addon.userDisabled, "provider enabled");
- executeSoon(function() {
- expectEvent = "onDisabling";
- addon.userDisabled = true;
- });
- },
- onEnabling: function(addon) {
- is(expectEvent, "onEnabling", "provider onEnabling");
- expectEvent = "onEnabled";
- },
- onDisabled: function(addon) {
- is(expectEvent, "onDisabled", "provider onDisabled");
- ok(addon.userDisabled, "provider disabled");
- AddonManager.removeAddonListener(listener);
- // clear the provider user-level pref
- Services.prefs.clearUserPref(prefname);
- executeSoon(next);
- },
- onDisabling: function(addon) {
- is(expectEvent, "onDisabling", "provider onDisabling");
- expectEvent = "onDisabled";
- }
- };
- AddonManager.addAddonListener(listener);
-
- // we're only testing enable disable, so we quickly set the user-level pref
- // for this provider and test enable/disable toggling
- setManifestPref(prefname, manifest);
- ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
- AddonManager.getAddonsByTypes([ADDON_TYPE_SERVICE], function(addons) {
- for (let addon of addons) {
- if (addon.userDisabled) {
- expectEvent = "onEnabling";
- addon.userDisabled = false;
- // only test with one addon
- return;
- }
- }
- ok(false, "no addons toggled");
- next();
- });
- },
- testProviderEnableToggle: function(next) {
- // enable and disabel a provider from the SocialService interface, check
- // that the addon manager is updated
-
- let expectEvent;
- let prefname = getManifestPrefname(manifest);
-
- let listener = {
- onEnabled: function(addon) {
- is(expectEvent, "onEnabled", "provider onEnabled");
- is(addon.manifest.origin, manifest.origin, "provider enabled");
- ok(!addon.userDisabled, "provider !userDisabled");
- },
- onEnabling: function(addon) {
- is(expectEvent, "onEnabling", "provider onEnabling");
- is(addon.manifest.origin, manifest.origin, "provider about to be enabled");
- expectEvent = "onEnabled";
- },
- onDisabled: function(addon) {
- is(expectEvent, "onDisabled", "provider onDisabled");
- is(addon.manifest.origin, manifest.origin, "provider disabled");
- ok(addon.userDisabled, "provider userDisabled");
- },
- onDisabling: function(addon) {
- is(expectEvent, "onDisabling", "provider onDisabling");
- is(addon.manifest.origin, manifest.origin, "provider about to be disabled");
- expectEvent = "onDisabled";
- }
- };
- AddonManager.addAddonListener(listener);
-
- expectEvent = "onEnabling";
- setManifestPref(prefname, manifest);
- SocialService.addBuiltinProvider(manifest.origin, function(provider) {
- expectEvent = "onDisabling";
- SocialService.removeProvider(provider.origin, function() {
- AddonManager.removeAddonListener(listener);
- Services.prefs.clearUserPref(prefname);
- next();
- });
- });
- },
- testForeignInstall: function(next) {
- AddonManager.addAddonListener(installListener(next, manifest2));
-
- // we expect the addon install dialog to appear, we need to accept the
- // install from the dialog.
- info("Waiting for install dialog");
- let panel = document.getElementById("servicesInstall-notification");
- PopupNotifications.panel.addEventListener("popupshown", function onpopupshown() {
- PopupNotifications.panel.removeEventListener("popupshown", onpopupshown);
- info("servicesInstall-notification panel opened");
- panel.button.click();
- })
-
- let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- Services.prefs.setCharPref("social.whitelist", "");
- is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
- Social.installProvider(doc, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.whitelist");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
- gBrowser.removeTab(tab);
- });
- });
- });
- },
- testBuiltinInstallWithoutManifest: function(next) {
- // send installProvider null for the manifest
- AddonManager.addAddonListener(installListener(next, manifest));
-
- let prefname = getManifestPrefname(manifest);
- let activationURL = manifest.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- is(SocialService.getOriginActivationType(installFrom), "builtin", "testing builtin install");
- ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
- Social.installProvider(doc, null, function(addonManifest) {
- ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
- gBrowser.removeTab(tab);
- });
- });
- });
- },
- testBuiltinInstall: function(next) {
- // send installProvider a json object for the manifest
- AddonManager.addAddonListener(installListener(next, manifest));
-
- let prefname = getManifestPrefname(manifest);
- let activationURL = manifest.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- is(SocialService.getOriginActivationType(installFrom), "builtin", "testing builtin install");
- ok(!Services.prefs.prefHasUserValue(prefname), "manifest is not in user-prefs");
- Social.installProvider(doc, manifest, function(addonManifest) {
- ok(Services.prefs.prefHasUserValue(prefname), "manifest is in user-prefs");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
- gBrowser.removeTab(tab);
- });
- });
- });
- },
- testWhitelistInstall: function(next) {
- AddonManager.addAddonListener(installListener(next, manifest2));
-
- let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- Services.prefs.setCharPref("social.whitelist", installFrom);
- is(SocialService.getOriginActivationType(installFrom), "whitelist", "testing whitelist install");
- Social.installProvider(doc, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.whitelist");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
- gBrowser.removeTab(tab);
- });
- });
- });
- },
- testDirectoryInstall: function(next) {
- AddonManager.addAddonListener(installListener(next, manifest2));
-
- let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- Services.prefs.setCharPref("social.directories", installFrom);
- is(SocialService.getOriginActivationType(installFrom), "directory", "testing directory install");
- Social.installProvider(doc, manifest2, function(addonManifest) {
- Services.prefs.clearUserPref("social.directories");
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- Social.uninstallProvider(addonManifest.origin);
- gBrowser.removeTab(tab);
- });
- });
- });
- },
- testUpgradeProviderFromWorker: function(next) {
- // add the provider, change the pref, add it again. The provider at that
- // point should be upgraded
- let activationURL = manifest2.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- Services.prefs.setCharPref("social.whitelist", installFrom);
- Social.installProvider(doc, manifest2, function(addonManifest) {
- SocialService.addBuiltinProvider(addonManifest.origin, function(provider) {
- is(provider.manifest.version, 1, "manifest version is 1");
- Social.enabled = true;
-
- // watch for the provider-update and test the new version
- SocialService.registerProviderListener(function providerListener(topic, data) {
- if (topic != "provider-update")
- return;
- SocialService.unregisterProviderListener(providerListener);
- Services.prefs.clearUserPref("social.whitelist");
- let provider = Social._getProviderFromOrigin(addonManifest.origin);
- is(provider.manifest.version, 2, "manifest version is 2");
- Social.uninstallProvider(addonManifest.origin, function() {
- gBrowser.removeTab(tab);
- next();
- });
- });
-
- let port = provider.getWorkerPort();
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- ok(true, "got the sidebar message from provider 1");
- port.postMessage({topic: "worker.update", data: true});
- break;
- }
- };
- port.postMessage({topic: "test-init"});
-
- });
- });
- });
- }
-}
diff --git a/browser/base/content/test/social/browser_blocklist.js b/browser/base/content/test/social/browser_blocklist.js
deleted file mode 100644
index 6f61b1ac2..000000000
--- a/browser/base/content/test/social/browser_blocklist.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// a place for miscellaneous social tests
-
-let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
-
-const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul";
-let blocklistURL = "http://example.org/browser/browser/base/content/test/social/blocklist.xml";
-
-let manifest = { // normal provider
- name: "provider ok",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
-};
-let manifest_bad = { // normal provider
- name: "provider blocked",
- origin: "https://test1.example.com",
- sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://test1.example.com/browser/browser/base/content/test/moz.png"
-};
-
-function test() {
- waitForExplicitFinish();
-
- runSocialTests(tests, undefined, undefined, function () {
- resetBlocklist(finish); //restore to original pref
- });
-}
-
-var tests = {
- testSimpleBlocklist: function(next) {
- // this really just tests adding and clearing our blocklist for later tests
- setAndUpdateBlocklist(blocklistURL, function() {
- ok(Services.blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocking 'blocked'");
- ok(!Services.blocklist.isAddonBlocklisted("example.com@services.mozilla.org", "0", "0", "0"), "not blocking 'good'");
- resetBlocklist(function() {
- ok(!Services.blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocklist cleared");
- next();
- });
- });
- },
- testAddingNonBlockedProvider: function(next) {
- function finish(isgood) {
- ok(isgood, "adding non-blocked provider ok");
- Services.prefs.clearUserPref("social.manifest.good");
- resetBlocklist(next);
- }
- setManifestPref("social.manifest.good", manifest);
- setAndUpdateBlocklist(blocklistURL, function() {
- try {
- SocialService.addProvider(manifest, function(provider) {
- try {
- SocialService.removeProvider(provider.origin, function() {
- ok(true, "added and removed provider");
- finish(true);
- });
- } catch(e) {
- ok(false, "SocialService.removeProvider threw exception: " + e);
- finish(false);
- }
- });
- } catch(e) {
- ok(false, "SocialService.addProvider threw exception: " + e);
- finish(false);
- }
- });
- },
- testAddingBlockedProvider: function(next) {
- function finish(good) {
- ok(good, "Unable to add blocklisted provider");
- Services.prefs.clearUserPref("social.manifest.blocked");
- resetBlocklist(next);
- }
- setManifestPref("social.manifest.blocked", manifest_bad);
- setAndUpdateBlocklist(blocklistURL, function() {
- try {
- SocialService.addProvider(manifest_bad, function(provider) {
- ok(false, "SocialService.addProvider should throw blocklist exception");
- finish(false);
- });
- } catch(e) {
- ok(true, "SocialService.addProvider should throw blocklist exception: " + e);
- finish(true);
- }
- });
- },
- testInstallingBlockedProvider: function(next) {
- function finish(good) {
- ok(good, "Unable to add blocklisted provider");
- Services.prefs.clearUserPref("social.whitelist");
- resetBlocklist(next);
- }
- let activationURL = manifest_bad.origin + "/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- let doc = tab.linkedBrowser.contentDocument;
- let installFrom = doc.nodePrincipal.origin;
- // whitelist to avoid the 3rd party install dialog, we only want to test
- // the blocklist inside installProvider.
- Services.prefs.setCharPref("social.whitelist", installFrom);
- setAndUpdateBlocklist(blocklistURL, function() {
- try {
- // expecting an exception when attempting to install a hard blocked
- // provider
- Social.installProvider(doc, manifest_bad, function(addonManifest) {
- gBrowser.removeTab(tab);
- finish(false);
- });
- } catch(e) {
- gBrowser.removeTab(tab);
- finish(true);
- }
- });
- });
- },
- testBlockingExistingProvider: function(next) {
- let windowWasClosed = false;
- function finish() {
- waitForCondition(function() windowWasClosed, function() {
- Services.wm.removeListener(listener);
- next();
- }, "blocklist dialog was closed");
- }
-
- let listener = {
- _window: null,
- onOpenWindow: function(aXULWindow) {
- Services.wm.removeListener(this);
- this._window = aXULWindow;
- let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
-
- domwindow.addEventListener("unload", function _unload() {
- domwindow.removeEventListener("unload", _unload, false);
- windowWasClosed = true;
- }, false);
- info("dialog opened, waiting for focus");
- waitForFocus(function() {
- is(domwindow.document.location.href, URI_EXTENSION_BLOCKLIST_DIALOG, "dialog opened and focused");
- executeSoon(function() {
- domwindow.close();
- });
- }, domwindow);
- },
- onCloseWindow: function(aXULWindow) { },
- onWindowTitleChange: function(aXULWindow, aNewTitle) { }
- };
-
- Services.wm.addListener(listener);
-
- setManifestPref("social.manifest.blocked", manifest_bad);
- try {
- SocialService.addProvider(manifest_bad, function(provider) {
- // the act of blocking should cause a 'provider-removed' notification
- // from SocialService.
- SocialService.registerProviderListener(function providerListener(topic) {
- if (topic != "provider-removed")
- return;
- SocialService.unregisterProviderListener(providerListener);
- SocialService.getProvider(provider.origin, function(p) {
- ok(p==null, "blocklisted provider removed");
- Services.prefs.clearUserPref("social.manifest.blocked");
- resetBlocklist(finish);
- });
- });
- // no callback - the act of updating should cause the listener above
- // to fire.
- setAndUpdateBlocklist(blocklistURL);
- });
- } catch(e) {
- ok(false, "unable to add provider " + e);
- finish();
- }
- }
-}
diff --git a/browser/base/content/test/social/browser_chat_tearoff.js b/browser/base/content/test/social/browser_chat_tearoff.js
deleted file mode 100644
index 7ee8acfab..000000000
--- a/browser/base/content/test/social/browser_chat_tearoff.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- requestLongerTimeout(2); // only debug builds seem to need more time...
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
-
- let postSubTest = function(cb) {
- let chats = document.getElementById("pinnedchats");
- ok(chats.children.length == 0, "no chatty children left behind");
- cb();
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, postSubTest, function() {
- finishcb();
- });
- });
-}
-
-var tests = {
- testTearoffChat: function(next) {
- let chats = document.getElementById("pinnedchats");
- let chatTitle;
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "got-chatbox-visibility":
- // chatbox is open, lets detach. The new chat window will be caught in
- // the window watcher below
- let doc = chats.selectedChat.contentDocument;
- // This message is (sometimes!) received a second time
- // before we start our tests from the onCloseWindow
- // callback.
- if (doc.location == "about:blank")
- return;
- chatTitle = doc.title;
- ok(chats.selectedChat.getAttribute("label") == chatTitle,
- "the new chatbox should show the title of the chat window");
- let div = doc.createElement("div");
- div.setAttribute("id", "testdiv");
- div.setAttribute("test", "1");
- doc.body.appendChild(div);
- let swap = document.getAnonymousElementByAttribute(chats.selectedChat, "anonid", "swap");
- swap.click();
- break;
- case "got-chatbox-message":
- ok(true, "got chatbox message");
- ok(e.data.result == "ok", "got chatbox windowRef result: "+e.data.result);
- chats.selectedChat.toggle();
- break;
- }
- }
-
- Services.wm.addListener({
- onWindowTitleChange: function() {},
- onCloseWindow: function(xulwindow) {},
- onOpenWindow: function(xulwindow) {
- var domwindow = xulwindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
- Services.wm.removeListener(this);
- // wait for load to ensure the window is ready for us to test
- domwindow.addEventListener("load", function _load() {
- domwindow.removeEventListener("load", _load, false);
- let doc = domwindow.document;
- is(doc.documentElement.getAttribute("windowtype"), "Social:Chat", "Social:Chat window opened");
- is(doc.location.href, "chrome://browser/content/chatWindow.xul", "Should have seen the right window open");
- // window is loaded, but the docswap does not happen until after load,
- // and we have no event to wait on, so we'll wait for document state
- // to be ready
- let chatbox = doc.getElementById("chatter");
- waitForCondition(function() {
- return chats.selectedChat == null &&
- chatbox.contentDocument &&
- chatbox.contentDocument.readyState == "complete";
- },function() {
- ok(chatbox.getAttribute("label") == chatTitle,
- "detached window should show the title of the chat window");
- let testdiv = chatbox.contentDocument.getElementById("testdiv");
- is(testdiv.getAttribute("test"), "1", "docshell should have been swapped");
- testdiv.setAttribute("test", "2");
- // swap the window back to the chatbar
- let swap = doc.getAnonymousElementByAttribute(chatbox, "anonid", "swap");
- swap.click();
- }, domwindow);
- }, false);
- domwindow.addEventListener("unload", function _close() {
- domwindow.removeEventListener("unload", _close, false);
- info("window has been closed");
- waitForCondition(function() {
- return chats.selectedChat && chats.selectedChat.contentDocument &&
- chats.selectedChat.contentDocument.readyState == "complete";
- },function () {
- ok(chats.selectedChat, "should have a chatbox in our window again");
- ok(chats.selectedChat.getAttribute("label") == chatTitle,
- "the new chatbox should show the title of the chat window again");
- let testdiv = chats.selectedChat.contentDocument.getElementById("testdiv");
- is(testdiv.getAttribute("test"), "2", "docshell should have been swapped");
- chats.selectedChat.close();
- next();
- });
- }, false);
- }
- });
-
- port.postMessage({topic: "test-init", data: { id: 1 }});
- }
-} \ No newline at end of file
diff --git a/browser/base/content/test/social/browser_defaults.js b/browser/base/content/test/social/browser_defaults.js
deleted file mode 100644
index 653509a98..000000000
--- a/browser/base/content/test/social/browser_defaults.js
+++ /dev/null
@@ -1,14 +0,0 @@
-
-let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
-
-// this test ensures that any builtin providers have the builtin flag that we
-// need to help with "install" of a builtin.
-function test() {
- let manifestPrefs = Services.prefs.getDefaultBranch("social.manifest.");
- let prefs = manifestPrefs.getChildList("", []);
- ok(prefs.length > 0, "we have builtin providers");
- for (let pref of prefs) {
- let manifest = JSON.parse(manifestPrefs.getComplexValue(pref, Ci.nsISupportsString).data);
- ok(manifest.builtin, "manifest is builtin " + manifest.origin);
- }
-}
diff --git a/browser/base/content/test/social/browser_share.js b/browser/base/content/test/social/browser_share.js
deleted file mode 100644
index 146bb6fca..000000000
--- a/browser/base/content/test/social/browser_share.js
+++ /dev/null
@@ -1,140 +0,0 @@
-
-let baseURL = "https://example.com/browser/browser/base/content/test/social/";
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- shareURL: "https://example.com/browser/browser/base/content/test/social/share.html"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-let corpus = [
- {
- url: baseURL+"opengraph/opengraph.html",
- options: {
- // og:title
- title: ">This is my title<",
- // og:description
- description: "A test corpus file for open graph tags we care about",
- //medium: this.getPageMedium(),
- //source: this.getSourceURL(),
- // og:url
- url: "https://www.mozilla.org/",
- //shortUrl: this.getShortURL(),
- // og:image
- previews:["https://www.mozilla.org/favicon.png"],
- // og:site_name
- siteName: ">My simple test page<"
- }
- },
- {
- // tests that og:url doesn't override the page url if it is bad
- url: baseURL+"opengraph/og_invalid_url.html",
- options: {
- description: "A test corpus file for open graph tags passing a bad url",
- url: baseURL+"opengraph/og_invalid_url.html",
- previews: [],
- siteName: "Evil chrome delivering website"
- }
- },
- {
- url: baseURL+"opengraph/shorturl_link.html",
- options: {
- previews: ["http://example.com/1234/56789.jpg"],
- url: "http://www.example.com/photos/56789/",
- shortUrl: "http://imshort/p/abcde"
- }
- },
- {
- url: baseURL+"opengraph/shorturl_linkrel.html",
- options: {
- previews: ["http://example.com/1234/56789.jpg"],
- url: "http://www.example.com/photos/56789/",
- shortUrl: "http://imshort/p/abcde"
- }
- },
- {
- url: baseURL+"opengraph/shortlink_linkrel.html",
- options: {
- previews: ["http://example.com/1234/56789.jpg"],
- url: "http://www.example.com/photos/56789/",
- shortUrl: "http://imshort/p/abcde"
- }
- }
-];
-
-function loadURLInTab(url, callback) {
- info("Loading tab with "+url);
- let tab = gBrowser.selectedTab = gBrowser.addTab(url);
- tab.linkedBrowser.addEventListener("load", function listener() {
- is(tab.linkedBrowser.currentURI.spec, url, "tab loaded")
- tab.linkedBrowser.removeEventListener("load", listener, true);
- callback(tab);
- }, true);
-}
-
-function hasoptions(testOptions, options) {
- let msg;
- for (let option in testOptions) {
- let data = testOptions[option];
- info("data: "+JSON.stringify(data));
- let message_data = options[option];
- info("message_data: "+JSON.stringify(message_data));
- if (Array.isArray(data)) {
- // the message may have more array elements than we are testing for, this
- // is ok since some of those are hard to test. So we just test that
- // anything in our test data IS in the message.
- ok(Array.every(data, function(item) { return message_data.indexOf(item) >= 0 }), "option "+option);
- } else {
- is(message_data, data, "option "+option);
- }
- }
-}
-
-var tests = {
- testSharePage: function(next) {
- let panel = document.getElementById("social-flyout-panel");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- let testTab;
- let testIndex = 0;
- let testData = corpus[testIndex++];
-
- function runOneTest() {
- loadURLInTab(testData.url, function(tab) {
- testTab = tab;
- SocialShare.sharePage();
- });
- }
-
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- // open a tab with share data, then open the share panel
- runOneTest();
- break;
- case "got-share-data-message":
- gBrowser.removeTab(testTab);
- hasoptions(testData.options, e.data.result);
- testData = corpus[testIndex++];
- if (testData) {
- runOneTest();
- } else {
- next();
- }
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- }
-}
diff --git a/browser/base/content/test/social/browser_social_activation.js b/browser/base/content/test/social/browser_social_activation.js
deleted file mode 100644
index 7d7b499a7..000000000
--- a/browser/base/content/test/social/browser_social_activation.js
+++ /dev/null
@@ -1,348 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
-
-let tabsToRemove = [];
-
-function postTestCleanup(callback) {
- Social.provider = null;
- // any tabs opened by the test.
- for (let tab of tabsToRemove)
- gBrowser.removeTab(tab);
- tabsToRemove = [];
- // theses tests use the notification panel but don't bother waiting for it
- // to fully open - the end result is that the panel might stay open
- SocialUI.activationPanel.hidePopup();
-
- Services.prefs.clearUserPref("social.whitelist");
-
- // all providers may have had their manifests added.
- for (let manifest of gProviders)
- Services.prefs.clearUserPref("social.manifest." + manifest.origin);
-
- // all the providers may have been added.
- let providers = gProviders.slice(0)
- function removeProviders() {
- if (providers.length < 1) {
- executeSoon(function() {
- is(Social.providers.length, 0, "all providers removed");
- callback();
- });
- return;
- }
-
- let provider = providers.pop();
- try {
- SocialService.removeProvider(provider.origin, removeProviders);
- } catch(ex) {
- removeProviders();
- }
- }
- removeProviders();
-}
-
-function addBuiltinManifest(manifest) {
- let prefname = getManifestPrefname(manifest);
- setBuiltinManifestPref(prefname, manifest);
- return prefname;
-}
-
-function addTab(url, callback) {
- let tab = gBrowser.selectedTab = gBrowser.addTab(url, {skipAnimation: true});
- tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- tabsToRemove.push(tab);
- executeSoon(function() {callback(tab)});
- }, true);
-}
-
-function sendActivationEvent(tab, callback, nullManifest) {
- // hack Social.lastEventReceived so we don't hit the "too many events" check.
- Social.lastEventReceived = 0;
- let doc = tab.linkedBrowser.contentDocument;
- // if our test has a frame, use it
- if (doc.defaultView.frames[0])
- doc = doc.defaultView.frames[0].document;
- let button = doc.getElementById(nullManifest ? "activation-old" : "activation");
- EventUtils.synthesizeMouseAtCenter(button, {}, doc.defaultView);
- executeSoon(callback);
-}
-
-function activateProvider(domain, callback, nullManifest) {
- let activationURL = domain+"/browser/browser/base/content/test/social/social_activate.html"
- addTab(activationURL, function(tab) {
- sendActivationEvent(tab, callback, nullManifest);
- });
-}
-
-function activateIFrameProvider(domain, callback) {
- let activationURL = domain+"/browser/browser/base/content/test/social/social_activate_iframe.html"
- addTab(activationURL, function(tab) {
- sendActivationEvent(tab, callback, false);
- });
-}
-
-function waitForProviderLoad(cb) {
- Services.obs.addObserver(function providerSet(subject, topic, data) {
- Services.obs.removeObserver(providerSet, "social:provider-set");
- info("social:provider-set observer was notified");
- waitForCondition(function() {
- let sbrowser = document.getElementById("social-sidebar-browser");
- return Social.provider &&
- Social.provider.profile &&
- Social.provider.profile.displayName &&
- sbrowser.docShellIsActive;
- }, function() {
- // executeSoon to let the browser UI observers run first
- executeSoon(cb);
- },
- "waitForProviderLoad: provider profile was not set");
- }, "social:provider-set", false);
-}
-
-
-function getAddonItemInList(aId, aList) {
- var item = aList.firstChild;
- while (item) {
- if ("mAddon" in item && item.mAddon.id == aId) {
- aList.ensureElementIsVisible(item);
- return item;
- }
- item = item.nextSibling;
- }
- return null;
-}
-
-function clickAddonRemoveButton(tab, aCallback) {
- AddonManager.getAddonsByTypes(["service"], function(aAddons) {
- let addon = aAddons[0];
-
- let doc = tab.linkedBrowser.contentDocument;
- let list = doc.getElementById("addon-list");
-
- let item = getAddonItemInList(addon.id, list);
- isnot(item, null, "Should have found the add-on in the list");
-
- var button = doc.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- isnot(button, null, "Should have a remove button");
- ok(!button.disabled, "Button should not be disabled");
-
- EventUtils.synthesizeMouseAtCenter(button, { }, doc.defaultView);
-
- // Force XBL to apply
- item.clientTop;
-
- is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
-
- executeSoon(function() { aCallback(addon); });
- });
-}
-
-function activateOneProvider(manifest, finishActivation, aCallback) {
- activateProvider(manifest.origin, function() {
- waitForProviderLoad(function() {
- ok(!SocialUI.activationPanel.hidden, "activation panel is showing");
- is(Social.provider.origin, manifest.origin, "new provider is active");
- checkSocialUI();
-
- if (finishActivation)
- document.getElementById("social-activation-button").click();
- else
- document.getElementById("social-undoactivation-button").click();
-
- executeSoon(aCallback);
- });
- });
-}
-
-let gTestDomains = ["https://example.com", "https://test1.example.com", "https://test2.example.com"];
-let gProviders = [
- {
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html?provider1",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js#no-profile,no-recommend",
- iconURL: "chrome://branding/content/icon48.png"
- },
- {
- name: "provider 2",
- origin: "https://test1.example.com",
- sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html?provider2",
- workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js#no-profile,no-recommend",
- iconURL: "chrome://branding/content/icon64.png"
- },
- {
- name: "provider 3",
- origin: "https://test2.example.com",
- sidebarURL: "https://test2.example.com/browser/browser/base/content/test/social/social_sidebar.html?provider2",
- workerURL: "https://test2.example.com/browser/browser/base/content/test/social/social_worker.js#no-profile,no-recommend",
- iconURL: "chrome://branding/content/about-logo.png"
- }
-];
-
-
-function test() {
- waitForExplicitFinish();
- runSocialTests(tests, undefined, postTestCleanup);
-}
-
-var tests = {
- testActivationWrongOrigin: function(next) {
- // At this stage none of our providers exist, so we expect failure.
- Services.prefs.setBoolPref("social.remote-install.enabled", false);
- activateProvider(gTestDomains[0], function() {
- is(SocialUI.enabled, false, "SocialUI is not enabled");
- ok(SocialUI.activationPanel.hidden, "activation panel still hidden");
- checkSocialUI();
- Services.prefs.clearUserPref("social.remote-install.enabled");
- next();
- });
- },
-
- testIFrameActivation: function(next) {
- Services.prefs.setCharPref("social.whitelist", gTestDomains.join(","));
- activateIFrameProvider(gTestDomains[0], function() {
- is(SocialUI.enabled, false, "SocialUI is not enabled");
- ok(!Social.provider, "provider is not installed");
- ok(SocialUI.activationPanel.hidden, "activation panel still hidden");
- checkSocialUI();
- Services.prefs.clearUserPref("social.whitelist");
- next();
- });
- },
-
- testActivationFirstProvider: function(next) {
- Services.prefs.setCharPref("social.whitelist", gTestDomains.join(","));
- // first up we add a manifest entry for a single provider.
- activateOneProvider(gProviders[0], false, function() {
- // we deactivated leaving no providers left, so Social is disabled.
- ok(!Social.provider, "should be no provider left after disabling");
- checkSocialUI();
- Services.prefs.clearUserPref("social.whitelist");
- next();
- });
- },
-
- testActivationBuiltin: function(next) {
- let prefname = addBuiltinManifest(gProviders[0]);
- is(SocialService.getOriginActivationType(gTestDomains[0]), "builtin", "manifest is builtin");
- // first up we add a manifest entry for a single provider.
- activateOneProvider(gProviders[0], false, function() {
- // we deactivated leaving no providers left, so Social is disabled.
- ok(!Social.provider, "should be no provider left after disabling");
- checkSocialUI();
- resetBuiltinManifestPref(prefname);
- next();
- });
- },
-
- testActivationMultipleProvider: function(next) {
- // The trick with this test is to make sure that Social.providers[1] is
- // the current provider when doing the undo - this makes sure that the
- // Social code doesn't fallback to Social.providers[0], which it will
- // do in some cases (but those cases do not include what this test does)
- // first enable the 2 providers
- Services.prefs.setCharPref("social.whitelist", gTestDomains.join(","));
- SocialService.addProvider(gProviders[0], function() {
- SocialService.addProvider(gProviders[1], function() {
- Social.provider = Social.providers[1];
- checkSocialUI();
- // activate the last provider.
- let prefname = addBuiltinManifest(gProviders[2]);
- activateOneProvider(gProviders[2], false, function() {
- // we deactivated - the first provider should be enabled.
- is(Social.provider.origin, Social.providers[1].origin, "original provider should have been reactivated");
- checkSocialUI();
- Services.prefs.clearUserPref("social.whitelist");
- resetBuiltinManifestPref(prefname);
- next();
- });
- });
- });
- },
-
- testRemoveNonCurrentProvider: function(next) {
- Services.prefs.setCharPref("social.whitelist", gTestDomains.join(","));
- SocialService.addProvider(gProviders[0], function() {
- SocialService.addProvider(gProviders[1], function() {
- Social.provider = Social.providers[1];
- checkSocialUI();
- // activate the last provider.
- let prefname = addBuiltinManifest(gProviders[2]);
- activateProvider(gTestDomains[2], function() {
- waitForProviderLoad(function() {
- ok(!SocialUI.activationPanel.hidden, "activation panel is showing");
- is(Social.provider.origin, gTestDomains[2], "new provider is active");
- checkSocialUI();
- // A bit contrived, but set a new provider current while the
- // activation ui is up.
- Social.provider = Social.providers[1];
- // hit "undo"
- document.getElementById("social-undoactivation-button").click();
- executeSoon(function() {
- // we deactivated - the same provider should be enabled.
- is(Social.provider.origin, Social.providers[1].origin, "original provider still be active");
- checkSocialUI();
- Services.prefs.clearUserPref("social.whitelist");
- resetBuiltinManifestPref(prefname);
- next();
- });
- });
- });
- });
- });
- },
-
- testAddonManagerDoubleInstall: function(next) {
- Services.prefs.setCharPref("social.whitelist", gTestDomains.join(","));
- // Create a new tab and load about:addons
- let blanktab = gBrowser.addTab();
- gBrowser.selectedTab = blanktab;
- BrowserOpenAddonsMgr('addons://list/service');
-
- is(blanktab, gBrowser.selectedTab, "Current tab should be blank tab");
-
- gBrowser.selectedBrowser.addEventListener("load", function tabLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", tabLoad, true);
- let browser = blanktab.linkedBrowser;
- is(browser.currentURI.spec, "about:addons", "about:addons should load into blank tab.");
-
- let prefname = addBuiltinManifest(gProviders[0]);
- activateOneProvider(gProviders[0], true, function() {
- gBrowser.removeTab(gBrowser.selectedTab);
- tabsToRemove.pop();
- // uninstall the provider
- clickAddonRemoveButton(blanktab, function(addon) {
- checkSocialUI();
- activateOneProvider(gProviders[0], true, function() {
-
- // after closing the addons tab, verify provider is still installed
- gBrowser.tabContainer.addEventListener("TabClose", function onTabClose() {
- gBrowser.tabContainer.removeEventListener("TabClose", onTabClose);
- AddonManager.getAddonsByTypes(["service"], function(aAddons) {
- is(aAddons.length, 1, "there can be only one");
- Services.prefs.clearUserPref("social.whitelist");
- resetBuiltinManifestPref(prefname);
- next();
- });
- });
-
- // verify only one provider in list
- AddonManager.getAddonsByTypes(["service"], function(aAddons) {
- is(aAddons.length, 1, "there can be only one");
-
- let doc = blanktab.linkedBrowser.contentDocument;
- let list = doc.getElementById("addon-list");
- is(list.childNodes.length, 1, "only one addon is displayed");
-
- gBrowser.removeTab(blanktab);
- });
-
- });
- });
- });
- }, true);
- }
-}
diff --git a/browser/base/content/test/social/browser_social_chatwindow.js b/browser/base/content/test/social/browser_social_chatwindow.js
deleted file mode 100644
index 9fb47d3f9..000000000
--- a/browser/base/content/test/social/browser_social_chatwindow.js
+++ /dev/null
@@ -1,472 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- requestLongerTimeout(2); // only debug builds seem to need more time...
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- let oldwidth = window.outerWidth; // we futz with these, so we restore them
- let oldleft = window.screenX;
- window.moveTo(0, window.screenY)
- let postSubTest = function(cb) {
- let chats = document.getElementById("pinnedchats");
- ok(chats.children.length == 0, "no chatty children left behind");
- cb();
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, postSubTest, function() {
- window.moveTo(oldleft, window.screenY)
- window.resizeTo(oldwidth, window.outerHeight);
- finishcb();
- });
- });
-}
-
-var tests = {
- testOpenCloseChat: function(next) {
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "got-chatbox-visibility":
- if (e.data.result == "hidden") {
- ok(true, "chatbox got minimized");
- chats.selectedChat.toggle();
- } else if (e.data.result == "shown") {
- ok(true, "chatbox got shown");
- // close it now
- let content = chats.selectedChat.content;
- content.addEventListener("unload", function chatUnload() {
- content.removeEventListener("unload", chatUnload, true);
- ok(true, "got chatbox unload on close");
- port.close();
- next();
- }, true);
- chats.selectedChat.close();
- }
- break;
- case "got-chatbox-message":
- ok(true, "got chatbox message");
- ok(e.data.result == "ok", "got chatbox windowRef result: "+e.data.result);
- chats.selectedChat.toggle();
- break;
- }
- }
- port.postMessage({topic: "test-init", data: { id: 1 }});
- },
- testOpenMinimized: function(next) {
- // In this case the sidebar opens a chat (without specifying minimized).
- // We then minimize it and have the sidebar reopen the chat (again without
- // minimized). On that second call the chat should open and no longer
- // be minimized.
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- let seen_opened = false;
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "chatbox-opened":
- is(e.data.result, "ok", "the sidebar says it got a chatbox");
- if (!seen_opened) {
- // first time we got the opened message, so minimize the chat then
- // re-request the same chat to be opened - we should get the
- // message again and the chat should be restored.
- ok(!chats.selectedChat.minimized, "chat not initially minimized")
- chats.selectedChat.minimized = true
- seen_opened = true;
- port.postMessage({topic: "test-chatbox-open"});
- } else {
- // This is the second time we've seen this message - there should
- // be exactly 1 chat open and it should no longer be minimized.
- let chats = document.getElementById("pinnedchats");
- ok(!chats.selectedChat.minimized, "chat no longer minimized")
- chats.selectedChat.close();
- is(chats.selectedChat, null, "should only have been one chat open");
- port.close();
- next();
- }
- }
- }
- port.postMessage({topic: "test-init", data: { id: 1 }});
- },
- testManyChats: function(next) {
- // open enough chats to overflow the window, then check
- // if the menupopup is visible
- let port = Social.provider.getWorkerPort();
- let chats = document.getElementById("pinnedchats");
- ok(port, "provider has a port");
- ok(chats.menupopup.parentNode.collapsed, "popup nub collapsed at start");
- port.postMessage({topic: "test-init"});
- // we should *never* find a test box that needs more than this to cause
- // an overflow!
- let maxToOpen = 20;
- let numOpened = 0;
- let maybeOpenAnother = function() {
- if (numOpened++ >= maxToOpen) {
- ok(false, "We didn't find a collapsed chat after " + maxToOpen + "chats!");
- closeAllChats();
- next();
- }
- port.postMessage({topic: "test-chatbox-open", data: { id: numOpened }});
- }
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-chatbox-message":
- if (!chats.menupopup.parentNode.collapsed) {
- maybeOpenAnother();
- break;
- }
- ok(true, "popup nub became visible");
- // close our chats now
- while (chats.selectedChat) {
- chats.selectedChat.close();
- }
- ok(!chats.selectedChat, "chats are all closed");
- port.close();
- next();
- break;
- }
- }
- maybeOpenAnother();
- },
- testWorkerChatWindow: function(next) {
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-chatbox-message":
- ok(true, "got a chat window opened");
- ok(chats.selectedChat, "chatbox from worker opened");
- while (chats.selectedChat) {
- chats.selectedChat.close();
- }
- ok(!chats.selectedChat, "chats are all closed");
- gURLsNotRemembered.push(chatUrl);
- port.close();
- next();
- break;
- }
- }
- ok(!chats.selectedChat, "chats are all closed");
- port.postMessage({topic: "test-worker-chat", data: chatUrl});
- },
- testCloseSelf: function(next) {
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "got-chatbox-visibility":
- is(e.data.result, "shown", "chatbox shown");
- port.close(); // don't want any more visibility messages.
- let chat = chats.selectedChat;
- ok(chat.parentNode, "chat has a parent node before it is closed");
- // ask it to close itself.
- let doc = chat.contentDocument;
- let evt = doc.createEvent("CustomEvent");
- evt.initCustomEvent("socialTest-CloseSelf", true, true, {});
- doc.documentElement.dispatchEvent(evt);
- ok(!chat.parentNode, "chat is now closed");
- port.close();
- next();
- break;
- }
- }
- port.postMessage({topic: "test-init", data: { id: 1 }});
- },
- testSameChatCallbacks: function(next) {
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- let seen_opened = false;
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "chatbox-opened":
- is(e.data.result, "ok", "the sidebar says it got a chatbox");
- if (seen_opened) {
- // This is the second time we've seen this message - there should
- // be exactly 1 chat open.
- let chats = document.getElementById("pinnedchats");
- chats.selectedChat.close();
- is(chats.selectedChat, null, "should only have been one chat open");
- port.close();
- next();
- } else {
- // first time we got the opened message, so re-request the same
- // chat to be opened - we should get the message again.
- seen_opened = true;
- port.postMessage({topic: "test-chatbox-open"});
- }
- }
- }
- port.postMessage({topic: "test-init", data: { id: 1 }});
- },
-
- // check removeAll does the right thing
- testRemoveAll: function(next, mode) {
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- get3ChatsForCollapsing(mode || "normal", function() {
- let chatbar = window.SocialChatBar.chatbar;
- chatbar.removeAll();
- // should be no evidence of any chats left.
- is(chatbar.childNodes.length, 0, "should be no chats left");
- checkPopup();
- is(chatbar.selectedChat, null, "nothing should be selected");
- is(chatbar.chatboxForURL.size, 0, "chatboxForURL map should be empty");
- port.close();
- next();
- });
- },
-
- testRemoveAllMinimized: function(next) {
- this.testRemoveAll(next, "minimized");
- },
-
- // Check what happens when you close the only visible chat.
- testCloseOnlyVisible: function(next) {
- let chatbar = window.SocialChatBar.chatbar;
- let chatWidth = undefined;
- let num = 0;
- is(chatbar.childNodes.length, 0, "chatbar starting empty");
- is(chatbar.menupopup.childNodes.length, 0, "popup starting empty");
-
- makeChat("normal", "first chat", function() {
- // got the first one.
- checkPopup();
- ok(chatbar.menupopup.parentNode.collapsed, "menu selection isn't visible");
- // we kinda cheat here and get the width of the first chat, assuming
- // that all future chats will have the same width when open.
- chatWidth = chatbar.calcTotalWidthOf(chatbar.selectedChat);
- let desired = chatWidth * 1.5;
- resizeWindowToChatAreaWidth(desired, function(sizedOk) {
- ok(sizedOk, "can't do any tests without this width");
- checkPopup();
- makeChat("normal", "second chat", function() {
- is(chatbar.childNodes.length, 2, "now have 2 chats");
- let first = chatbar.childNodes[0];
- let second = chatbar.childNodes[1];
- is(chatbar.selectedChat, first, "first chat is selected");
- ok(second.collapsed, "second chat is currently collapsed");
- // closing the first chat will leave enough room for the second
- // chat to appear, and thus become selected.
- chatbar.selectedChat.close();
- is(chatbar.selectedChat, second, "second chat is selected");
- closeAllChats();
- next();
- });
- });
- });
- },
-
- testShowWhenCollapsed: function(next) {
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- get3ChatsForCollapsing("normal", function(first, second, third) {
- let chatbar = window.SocialChatBar.chatbar;
- chatbar.showChat(first);
- ok(!first.collapsed, "first should no longer be collapsed");
- ok(second.collapsed || third.collapsed, false, "one of the others should be collapsed");
- closeAllChats();
- port.close();
- next();
- });
- },
-
- testActivity: function(next) {
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- get3ChatsForCollapsing("normal", function(first, second, third) {
- let chatbar = window.SocialChatBar.chatbar;
- is(chatbar.selectedChat, third, "third chat should be selected");
- ok(!chatbar.selectedChat.hasAttribute("activity"), "third chat should have no activity");
- // send an activity message to the second.
- ok(!second.hasAttribute("activity"), "second chat should have no activity");
- let chat2 = second.content;
- let evt = chat2.contentDocument.createEvent("CustomEvent");
- evt.initCustomEvent("socialChatActivity", true, true, {});
- chat2.contentDocument.documentElement.dispatchEvent(evt);
- // second should have activity.
- ok(second.hasAttribute("activity"), "second chat should now have activity");
- // select the second - it should lose "activity"
- chatbar.selectedChat = second;
- ok(!second.hasAttribute("activity"), "second chat should no longer have activity");
- // Now try the first - it is collapsed, so the 'nub' also gets activity attr.
- ok(!first.hasAttribute("activity"), "first chat should have no activity");
- let chat1 = first.content;
- let evt = chat1.contentDocument.createEvent("CustomEvent");
- evt.initCustomEvent("socialChatActivity", true, true, {});
- chat1.contentDocument.documentElement.dispatchEvent(evt);
- ok(first.hasAttribute("activity"), "first chat should now have activity");
- ok(chatbar.nub.hasAttribute("activity"), "nub should also have activity");
- // first is collapsed, so use openChat to get it.
- chatbar.openChat(Social.provider, first.getAttribute("src"));
- ok(!first.hasAttribute("activity"), "first chat should no longer have activity");
- // The nub should lose the activity flag here too
- todo(!chatbar.nub.hasAttribute("activity"), "Bug 806266 - nub should no longer have activity");
- // TODO: tests for bug 806266 should arrange to have 2 chats collapsed
- // then open them checking the nub is updated correctly.
- // Now we will go and change the embedded browser in the second chat and
- // ensure the activity magic still works (ie, check that the unload for
- // the browser didn't cause our event handlers to be removed.)
- ok(!second.hasAttribute("activity"), "second chat should have no activity");
- let subiframe = chat2.contentDocument.getElementById("iframe");
- subiframe.contentWindow.addEventListener("unload", function subunload() {
- subiframe.contentWindow.removeEventListener("unload", subunload);
- // ensure all other unload listeners have fired.
- executeSoon(function() {
- let evt = chat2.contentDocument.createEvent("CustomEvent");
- evt.initCustomEvent("socialChatActivity", true, true, {});
- chat2.contentDocument.documentElement.dispatchEvent(evt);
- ok(second.hasAttribute("activity"), "second chat still has activity after unloading sub-iframe");
- closeAllChats();
- port.close();
- next();
- })
- })
- subiframe.setAttribute("src", "data:text/plain:new location for iframe");
- });
- },
-
- testOnlyOneCallback: function(next) {
- let chats = document.getElementById("pinnedchats");
- let port = Social.provider.getWorkerPort();
- let numOpened = 0;
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-chatbox-open"});
- break;
- case "chatbox-opened":
- numOpened += 1;
- port.postMessage({topic: "ping"});
- break;
- case "pong":
- executeSoon(function() {
- is(numOpened, 1, "only got one open message");
- chats.removeAll();
- port.close();
- next();
- });
- }
- }
- port.postMessage({topic: "test-init", data: { id: 1 }});
- },
-
- testSecondTopLevelWindow: function(next) {
- // Bug 817782 - check chats work in new top-level windows.
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
- let port = Social.provider.getWorkerPort();
- let secondWindow;
- port.onmessage = function(e) {
- if (e.data.topic == "test-init-done") {
- secondWindow = OpenBrowserWindow();
- secondWindow.addEventListener("load", function loadListener() {
- secondWindow.removeEventListener("load", loadListener);
- port.postMessage({topic: "test-worker-chat", data: chatUrl});
- });
- } else if (e.data.topic == "got-chatbox-message") {
- // the chat was created - let's make sure it was created in the second window.
- is(secondWindow.SocialChatBar.chatbar.childElementCount, 1);
- secondWindow.close();
- next();
- }
- }
- port.postMessage({topic: "test-init"});
- },
-
- testChatWindowChooser: function(next) {
- // Tests that when a worker creates a chat, it is opened in the correct
- // window.
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
- let chatId = 1;
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
-
- function openChat(callback) {
- port.onmessage = function(e) {
- if (e.data.topic == "got-chatbox-message")
- callback();
- }
- let url = chatUrl + "?" + (chatId++);
- port.postMessage({topic: "test-worker-chat", data: url});
- }
-
- // open a chat (it will open in the main window)
- ok(!window.SocialChatBar.hasChats, "first window should start with no chats");
- openChat(function() {
- ok(window.SocialChatBar.hasChats, "first window has the chat");
- // create a second window - this will be the "most recent" and will
- // therefore be the window that hosts the new chat (see bug 835111)
- let secondWindow = OpenBrowserWindow();
- secondWindow.addEventListener("load", function loadListener() {
- secondWindow.removeEventListener("load", loadListener);
- ok(!secondWindow.SocialChatBar.hasChats, "second window has no chats");
- openChat(function() {
- ok(secondWindow.SocialChatBar.hasChats, "second window now has chats");
- is(window.SocialChatBar.chatbar.childElementCount, 1, "first window still has 1 chat");
- window.SocialChatBar.chatbar.removeAll();
- // now open another chat - it should still open in the second.
- openChat(function() {
- ok(!window.SocialChatBar.hasChats, "first window has no chats");
- ok(secondWindow.SocialChatBar.hasChats, "second window has a chat");
- secondWindow.close();
- next();
- });
- });
- })
- });
- },
-
- // XXX - note this must be the last test until we restore the login state
- // between tests...
- testCloseOnLogout: function(next) {
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-chatbox-message":
- ok(true, "got a chat window opened");
- port.postMessage({topic: "test-logout"});
- port.close();
- waitForCondition(function() document.getElementById("pinnedchats").firstChild == null,
- next,
- "chat windows didn't close");
- break;
- }
- }
- port.postMessage({topic: "test-worker-chat", data: chatUrl});
- },
-}
diff --git a/browser/base/content/test/social/browser_social_chatwindow_resize.js b/browser/base/content/test/social/browser_social_chatwindow_resize.js
deleted file mode 100644
index c6bd72078..000000000
--- a/browser/base/content/test/social/browser_social_chatwindow_resize.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- requestLongerTimeout(2); // only debug builds seem to need more time...
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- // added for test purposes
- chatURL: "https://example.com/browser/browser/base/content/test/social/social_chat.html"
- };
- let oldwidth = window.outerWidth; // we futz with these, so we restore them
- let oldleft = window.screenX;
- window.moveTo(0, window.screenY)
- let postSubTest = function(cb) {
- let chats = document.getElementById("pinnedchats");
- ok(chats.children.length == 0, "no chatty children left behind");
- cb();
- };
-
- runSocialTestWithProvider(manifest, function (finishcb) {
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.postMessage({topic: "test-init"});
- // we require a logged in user for chats, wait for that
- waitForCondition(function() {
- let sbrowser = document.getElementById("social-sidebar-browser");
- return Social.provider &&
- Social.provider.profile &&
- Social.provider.profile.displayName &&
- sbrowser.docShellIsActive;
- }, function() {
- // executeSoon to let the browser UI observers run first
- runSocialTests(tests, undefined, postSubTest, function() {
- window.moveTo(oldleft, window.screenY)
- window.resizeTo(oldwidth, window.outerHeight);
- port.close();
- finishcb();
- });
- },
- "waitForProviderLoad: provider profile was not set");
- });
-}
-
-var tests = {
-
- // resize and collapse testing.
- testBrowserResize: function(next, mode) {
- let chats = document.getElementById("pinnedchats");
- get3ChatsForCollapsing(mode || "normal", function(first, second, third) {
- let chatWidth = chats.getTotalChildWidth(first);
- ok(chatWidth, "have a chatwidth");
- let popupWidth = getPopupWidth();
- ok(popupWidth, "have a popupwidth");
- info("starting resize tests - each chat's width is " + chatWidth +
- " and the popup width is " + popupWidth);
- // Note that due to a difference between "device", "app" and "css" pixels
- // we allow use 2 pixels as the minimum size difference.
- resizeAndCheckWidths(first, second, third, [
- [chatWidth-2, 1, "to < 1 chat width - only last should be visible."],
- [chatWidth+2, 1, "2 pixels more then one fully exposed (not counting popup) - still only 1."],
- [chatWidth+popupWidth+2, 1, "2 pixels more than one fully exposed (including popup) - still only 1."],
- [chatWidth*2-2, 1, "second not showing by 2 pixels (not counting popup) - only 1 exposed."],
- [chatWidth*2+popupWidth-2, 1, "second not showing by 2 pixelx (including popup) - only 1 exposed."],
- [chatWidth*2+popupWidth+2, 2, "big enough to fit 2 - nub remains visible as first is still hidden"],
- [chatWidth*3+popupWidth-2, 2, "one smaller than the size necessary to display all three - first still hidden"],
- [chatWidth*3+popupWidth+2, 3, "big enough to fit all - all exposed (which removes the nub)"],
- [chatWidth*3+2, 3, "now the nub is hidden we can resize back down to chatWidth*3 before overflow."],
- [chatWidth*3-2, 2, "2 pixels less and the first is again collapsed (and the nub re-appears)"],
- [chatWidth*2+popupWidth+2, 2, "back down to just big enough to fit 2"],
- [chatWidth*2+popupWidth-2, 1, "back down to just not enough to fit 2"],
- [chatWidth*3+popupWidth+2, 3, "now a large jump to make all 3 visible (ie, affects 2)"],
- [chatWidth*1.5, 1, "and a large jump back down to 1 visible (ie, affects 2)"],
- ], function() {
- closeAllChats();
- next();
- });
- });
- },
-
- testBrowserResizeMinimized: function(next) {
- this.testBrowserResize(next);
- }
-}
diff --git a/browser/base/content/test/social/browser_social_chatwindowfocus.js b/browser/base/content/test/social/browser_social_chatwindowfocus.js
deleted file mode 100644
index 96824326b..000000000
--- a/browser/base/content/test/social/browser_social_chatwindowfocus.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Is the currently opened tab focused?
-function isTabFocused() {
- let tabb = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- return Services.focus.focusedWindow == tabb.contentWindow;
-}
-
-function isChatFocused(chat) {
- return SocialChatBar.chatbar._isChatFocused(chat);
-}
-
-function openChatViaUser() {
- let sidebarDoc = document.getElementById("social-sidebar-browser").contentDocument;
- let button = sidebarDoc.getElementById("chat-opener");
- // Note we must use synthesizeMouseAtCenter() rather than calling
- // .click() directly as this causes nsIDOMWindowUtils.isHandlingUserInput
- // to be true.
- EventUtils.synthesizeMouseAtCenter(button, {}, sidebarDoc.defaultView);
-}
-
-function openChatViaSidebarMessage(port, data, callback) {
- port.onmessage = function (e) {
- if (e.data.topic == "chatbox-opened")
- callback();
- }
- port.postMessage({topic: "test-chatbox-open", data: data});
-}
-
-function openChatViaWorkerMessage(port, data, callback) {
- // sadly there is no message coming back to tell us when the chat has
- // been opened, so we wait until one appears.
- let chatbar = SocialChatBar.chatbar;
- let numExpected = chatbar.childElementCount + 1;
- port.postMessage({topic: "test-worker-chat", data: data});
- waitForCondition(function() chatbar.childElementCount == numExpected,
- function() {
- // so the child has been added, but we don't know if it
- // has been intialized - re-request it and the callback
- // means it's done. Minimized, same as the worker.
- SocialChatBar.openChat(Social.provider,
- data,
- function() {
- callback();
- },
- "minimized");
- },
- "No new chat appeared");
-}
-
-
-let isSidebarLoaded = false;
-
-function startTestAndWaitForSidebar(callback) {
- let doneCallback;
- let port = Social.provider.getWorkerPort();
- function maybeCallback() {
- if (!doneCallback)
- callback(port);
- doneCallback = true;
- }
- port.onmessage = function(e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- // if sidebar loaded too fast, we need a backup ping
- case "got-isVisible-response":
- isSidebarLoaded = true;
- maybeCallback();
- break;
- case "test-init-done":
- if (isSidebarLoaded)
- maybeCallback();
- else
- port.postMessage({topic: "test-isVisible"});
- break;
- }
- }
- port.postMessage({topic: "test-init"});
-}
-
-let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
-};
-
-function test() {
- waitForExplicitFinish();
-
- // Note that (probably) due to bug 604289, if a tab is focused but the
- // focused element is null, our chat windows can "steal" focus. This is
- // avoided if we explicitly focus an element in the tab.
- // So we load a page with an <input> field and focus that before testing.
- let url = "data:text/html;charset=utf-8," + encodeURI('<input id="theinput">');
- let tab = gBrowser.selectedTab = gBrowser.addTab(url, {skipAnimation: true});
- tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- // before every test we focus the input field.
- let preSubTest = function(cb) {
- // XXX - when bug 604289 is fixed it should be possible to just do:
- // tab.linkedBrowser.contentWindow.focus()
- // but instead we must do:
- tab.linkedBrowser.contentDocument.getElementById("theinput").focus();
- waitForCondition(function() isTabFocused(), cb, "tab should have focus");
- }
- let postSubTest = function(cb) {
- window.SocialChatBar.chatbar.removeAll();
- cb();
- }
- // and run the tests.
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, preSubTest, postSubTest, function () {
- finishcb();
- });
- });
- }, true);
- registerCleanupFunction(function() {
- gBrowser.removeTab(tab);
- });
-
-}
-
-var tests = {
- // In this test the worker asks the sidebar to open a chat. As that means
- // we aren't handling user-input we will not focus the chatbar.
- // Then we do it again - should still not be focused.
- // Then we perform a user-initiated request - it should get focus.
- testNoFocusWhenViaWorker: function(next) {
- startTestAndWaitForSidebar(function(port) {
- openChatViaSidebarMessage(port, {stealFocus: 1}, function() {
- ok(true, "got chatbox message");
- is(SocialChatBar.chatbar.childElementCount, 1, "exactly 1 chat open");
- ok(isTabFocused(), "tab should still be focused");
- // re-request the same chat via a message.
- openChatViaSidebarMessage(port, {stealFocus: 1}, function() {
- is(SocialChatBar.chatbar.childElementCount, 1, "still exactly 1 chat open");
- ok(isTabFocused(), "tab should still be focused");
- // re-request the same chat via user event.
- openChatViaUser();
- waitForCondition(function() isChatFocused(SocialChatBar.chatbar.selectedChat),
- function() {
- is(SocialChatBar.chatbar.childElementCount, 1, "still exactly 1 chat open");
- is(SocialChatBar.chatbar.selectedChat, SocialChatBar.chatbar.firstElementChild, "chat should be selected");
- next();
- }, "chat should be focused");
- });
- });
- });
- },
-
- // In this test we arrange for the sidebar to open the chat via a simulated
- // click. This should cause the new chat to be opened and focused.
- testFocusWhenViaUser: function(next) {
- startTestAndWaitForSidebar(function(port) {
- openChatViaUser();
- ok(SocialChatBar.chatbar.firstElementChild, "chat opened");
- waitForCondition(function() isChatFocused(SocialChatBar.chatbar.selectedChat),
- function() {
- is(SocialChatBar.chatbar.selectedChat, SocialChatBar.chatbar.firstElementChild, "chat is selected");
- next();
- }, "chat should be focused");
- });
- },
-
- // Open a chat via the worker - it will open and not have focus.
- // Then open the same chat via a sidebar message - it will be restored but
- // should still not have grabbed focus.
- testNoFocusOnAutoRestore: function(next) {
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html?id=1";
- let chatbar = SocialChatBar.chatbar;
- startTestAndWaitForSidebar(function(port) {
- openChatViaWorkerMessage(port, chatUrl, function() {
- is(chatbar.childElementCount, 1, "exactly 1 chat open");
- // bug 865086 opening minimized still sets the window as selected
- todo(chatbar.selectedChat != chatbar.firstElementChild, "chat is not selected");
- ok(isTabFocused(), "tab should be focused");
- openChatViaSidebarMessage(port, {stealFocus: 1, id: 1}, function() {
- is(chatbar.childElementCount, 1, "still 1 chat open");
- ok(!chatbar.firstElementChild.minimized, "chat no longer minimized");
- // bug 865086 because we marked it selected on open, it still is
- todo(chatbar.selectedChat != chatbar.firstElementChild, "chat is not selected");
- ok(isTabFocused(), "tab should still be focused");
- next();
- });
- });
- });
- },
-
- // Here we open a chat, which will not be focused. Then we minimize it and
- // restore it via a titlebar clock - it should get focus at that point.
- testFocusOnExplicitRestore: function(next) {
- startTestAndWaitForSidebar(function(port) {
- openChatViaSidebarMessage(port, {stealFocus: 1}, function() {
- ok(true, "got chatbox message");
- ok(isTabFocused(), "tab should still be focused");
- let chatbox = SocialChatBar.chatbar.firstElementChild;
- ok(chatbox, "chat opened");
- chatbox.minimized = true;
- ok(isTabFocused(), "tab should still be focused");
- // pretend we clicked on the titlebar
- chatbox.onTitlebarClick({button: 0});
- waitForCondition(function() isChatFocused(SocialChatBar.chatbar.selectedChat),
- function() {
- ok(!chatbox.minimized, "chat should have been restored");
- ok(isChatFocused(chatbox), "chat should be focused");
- is(chatbox, SocialChatBar.chatbar.selectedChat, "chat is marked selected");
- next();
- }, "chat should have focus");
- });
- });
- },
-
- // Open 2 chats and give 1 focus. Minimize the focused one - the second
- // should get focus.
- testMinimizeFocused: function(next) {
- let chatbar = SocialChatBar.chatbar;
- startTestAndWaitForSidebar(function(port) {
- openChatViaSidebarMessage(port, {stealFocus: 1, id: 1}, function() {
- let chat1 = chatbar.firstElementChild;
- openChatViaSidebarMessage(port, {stealFocus: 1, id: 2}, function() {
- is(chatbar.childElementCount, 2, "exactly 2 chats open");
- let chat2 = chat1.nextElementSibling || chat1.previousElementSibling;
- chatbar.selectedChat = chat1;
- chatbar.focus();
- waitForCondition(function() isChatFocused(chat1),
- function() {
- is(chat1, SocialChatBar.chatbar.selectedChat, "chat1 is marked selected");
- isnot(chat2, SocialChatBar.chatbar.selectedChat, "chat2 is not marked selected");
- chat1.minimized = true;
- waitForCondition(function() isChatFocused(chat2),
- function() {
- // minimizing the chat with focus should give it to another.
- isnot(chat1, SocialChatBar.chatbar.selectedChat, "chat1 is not marked selected");
- is(chat2, SocialChatBar.chatbar.selectedChat, "chat2 is marked selected");
- next();
- }, "chat2 should have focus");
- }, "chat1 should have focus");
- });
- });
- });
- },
-
- // Open 2 chats, select (but not focus) one, then re-request it be
- // opened via a message. Focus should not move.
- testReopenNonFocused: function(next) {
- let chatbar = SocialChatBar.chatbar;
- startTestAndWaitForSidebar(function(port) {
- openChatViaSidebarMessage(port, {id: 1}, function() {
- let chat1 = chatbar.firstElementChild;
- openChatViaSidebarMessage(port, {id: 2}, function() {
- let chat2 = chat1.nextElementSibling || chat1.previousElementSibling;
- chatbar.selectedChat = chat2;
- // tab still has focus
- ok(isTabFocused(), "tab should still be focused");
- // re-request the first.
- openChatViaSidebarMessage(port, {id: 1}, function() {
- is(chatbar.selectedChat, chat1, "chat1 now selected");
- ok(isTabFocused(), "tab should still be focused");
- next();
- });
- });
- });
- });
- },
-
- // Open 2 chats, select and focus the second. Pressing the TAB key should
- // cause focus to move between all elements in our chat window before moving
- // to the next chat window.
- testTab: function(next) {
- function sendTabAndWaitForFocus(chat, eltid, callback) {
- // ideally we would use the 'focus' event here, but that doesn't work
- // as expected for the iframe - the iframe itself never gets the focus
- // event (apparently the sub-document etc does.)
- // So just poll for the correct element getting focus...
- let doc = chat.contentDocument;
- EventUtils.sendKey("tab");
- waitForCondition(function() {
- let elt = eltid ? doc.getElementById(eltid) : doc.documentElement;
- return doc.activeElement == elt;
- }, callback, "element " + eltid + " never got focus");
- }
-
- let chatbar = SocialChatBar.chatbar;
- startTestAndWaitForSidebar(function(port) {
- openChatViaSidebarMessage(port, {id: 1}, function() {
- let chat1 = chatbar.firstElementChild;
- openChatViaSidebarMessage(port, {id: 2}, function() {
- let chat2 = chat1.nextElementSibling || chat1.previousElementSibling;
- chatbar.selectedChat = chat2;
- chatbar.focus();
- waitForCondition(function() isChatFocused(chatbar.selectedChat),
- function() {
- // Our chats have 3 focusable elements, so it takes 4 TABs to move
- // to the new chat.
- sendTabAndWaitForFocus(chat2, "input1", function() {
- is(chat2.contentDocument.activeElement.getAttribute("id"), "input1",
- "first input field has focus");
- ok(isChatFocused(chat2), "new chat still focused after first tab");
- sendTabAndWaitForFocus(chat2, "input2", function() {
- ok(isChatFocused(chat2), "new chat still focused after tab");
- is(chat2.contentDocument.activeElement.getAttribute("id"), "input2",
- "second input field has focus");
- sendTabAndWaitForFocus(chat2, "iframe", function() {
- ok(isChatFocused(chat2), "new chat still focused after tab");
- is(chat2.contentDocument.activeElement.getAttribute("id"), "iframe",
- "iframe has focus");
- // this tab now should move to the next chat, but focus the
- // document element itself (hence the null eltid)
- sendTabAndWaitForFocus(chat1, null, function() {
- ok(isChatFocused(chat1), "first chat is focused");
- next();
- });
- });
- });
- });
- }, "chat should have focus");
- });
- });
- });
- },
-
- // Open a chat and focus an element other than the first. Move focus to some
- // other item (the tab itself in this case), then focus the chatbar - the
- // same element that was previously focused should still have focus.
- testFocusedElement: function(next) {
- let chatbar = SocialChatBar.chatbar;
- startTestAndWaitForSidebar(function(port) {
- openChatViaUser();
- let chat = chatbar.firstElementChild;
- // need to wait for the content to load before we can focus it.
- chat.addEventListener("DOMContentLoaded", function DOMContentLoaded() {
- chat.removeEventListener("DOMContentLoaded", DOMContentLoaded);
- chat.contentDocument.getElementById("input2").focus();
- waitForCondition(function() isChatFocused(chat),
- function() {
- is(chat.contentDocument.activeElement.getAttribute("id"), "input2",
- "correct input field has focus");
- // set focus to the tab.
- let tabb = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- Services.focus.moveFocus(tabb.contentWindow, null, Services.focus.MOVEFOCUS_ROOT, 0);
- waitForCondition(function() isTabFocused(),
- function() {
- chatbar.focus();
- waitForCondition(function() isChatFocused(chat),
- function() {
- is(chat.contentDocument.activeElement.getAttribute("id"), "input2",
- "correct input field still has focus");
- next();
- }, "chat took focus");
- }, "tab has focus");
- }, "chat took focus");
- });
- });
- },
-};
diff --git a/browser/base/content/test/social/browser_social_errorPage.js b/browser/base/content/test/social/browser_social_errorPage.js
deleted file mode 100644
index 325d5c80e..000000000
--- a/browser/base/content/test/social/browser_social_errorPage.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function gc() {
- Cu.forceGC();
- let wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils);
- wu.garbageCollect();
-}
-
-// Support for going on and offline.
-// (via browser/base/content/test/browser_bookmark_titles.js)
-let origProxyType = Services.prefs.getIntPref('network.proxy.type');
-
-function goOffline() {
- // Simulate a network outage with offline mode. (Localhost is still
- // accessible in offline mode, so disable the test proxy as well.)
- if (!Services.io.offline)
- BrowserOffline.toggleOfflineStatus();
- Services.prefs.setIntPref('network.proxy.type', 0);
- // LOAD_FLAGS_BYPASS_CACHE isn't good enough. So clear the cache.
- Services.cache.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
-}
-
-function goOnline(callback) {
- Services.prefs.setIntPref('network.proxy.type', origProxyType);
- if (Services.io.offline)
- BrowserOffline.toggleOfflineStatus();
- if (callback)
- callback();
-}
-
-function openPanel(url, panelCallback, loadCallback) {
- // open a flyout
- SocialFlyout.open(url, 0, panelCallback);
- SocialFlyout.panel.firstChild.addEventListener("load", function panelLoad() {
- SocialFlyout.panel.firstChild.removeEventListener("load", panelLoad, true);
- loadCallback();
- }, true);
-}
-
-function openChat(url, panelCallback, loadCallback) {
- // open a chat window
- SocialChatBar.openChat(Social.provider, url, panelCallback);
- SocialChatBar.chatbar.firstChild.addEventListener("DOMContentLoaded", function panelLoad() {
- SocialChatBar.chatbar.firstChild.removeEventListener("DOMContentLoaded", panelLoad, true);
- loadCallback();
- }, true);
-}
-
-function onSidebarLoad(callback) {
- let sbrowser = document.getElementById("social-sidebar-browser");
- sbrowser.addEventListener("load", function load() {
- sbrowser.removeEventListener("load", load, true);
- callback();
- }, true);
-}
-
-function ensureWorkerLoaded(provider, callback) {
- // once the worker responds to a ping we know it must be up.
- let port = provider.getWorkerPort();
- port.onmessage = function(msg) {
- if (msg.data.topic == "pong") {
- port.close();
- callback();
- }
- }
- port.postMessage({topic: "ping"})
-}
-
-let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
-};
-
-function test() {
- waitForExplicitFinish();
- // we don't want the sidebar to auto-load in these tests..
- Services.prefs.setBoolPref("social.sidebar.open", false);
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("social.sidebar.open");
- });
-
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, goOnline, finishcb);
- });
-}
-
-var tests = {
- testSidebar: function(next) {
- let sbrowser = document.getElementById("social-sidebar-browser");
- onSidebarLoad(function() {
- ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?")==0, "is on social error page");
- gc();
- // Add a new load listener, then find and click the "try again" button.
- onSidebarLoad(function() {
- // should still be on the error page.
- ok(sbrowser.contentDocument.location.href.indexOf("about:socialerror?")==0, "is still on social error page");
- // go online and try again - this should work.
- goOnline();
- onSidebarLoad(function() {
- // should now be on the correct page.
- is(sbrowser.contentDocument.location.href, manifest.sidebarURL, "is now on social sidebar page");
- next();
- });
- sbrowser.contentDocument.getElementById("btnTryAgain").click();
- });
- sbrowser.contentDocument.getElementById("btnTryAgain").click();
- });
- // we want the worker to be fully loaded before going offline, otherwise
- // it might fail due to going offline.
- ensureWorkerLoaded(Social.provider, function() {
- // go offline then attempt to load the sidebar - it should fail.
- goOffline();
- Services.prefs.setBoolPref("social.sidebar.open", true);
- });
- },
-
- testFlyout: function(next) {
- let panelCallbackCount = 0;
- let panel = document.getElementById("social-flyout-panel");
- // go offline and open a flyout.
- goOffline();
- openPanel(
- "https://example.com/browser/browser/base/content/test/social/social_panel.html",
- function() { // the panel api callback
- panelCallbackCount++;
- },
- function() { // the "load" callback.
- executeSoon(function() {
- todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads.");
- ok(panel.firstChild.contentDocument.location.href.indexOf("about:socialerror?")==0, "is on social error page");
- // Bug 832943 - the listeners previously stopped working after a GC, so
- // force a GC now and try again.
- gc();
- openPanel(
- "https://example.com/browser/browser/base/content/test/social/social_panel.html",
- function() { // the panel api callback
- panelCallbackCount++;
- },
- function() { // the "load" callback.
- executeSoon(function() {
- todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads.");
- ok(panel.firstChild.contentDocument.location.href.indexOf("about:socialerror?")==0, "is on social error page");
- gc();
- SocialFlyout.unload();
- next();
- });
- }
- );
- });
- }
- );
- },
-
- testChatWindow: function(next) {
- let panelCallbackCount = 0;
- // go offline and open a flyout.
- goOffline();
- openChat(
- "https://example.com/browser/browser/base/content/test/social/social_chat.html",
- function() { // the panel api callback
- panelCallbackCount++;
- },
- function() { // the "load" callback.
- executeSoon(function() {
- todo_is(panelCallbackCount, 0, "Bug 833207 - should be no callback when error page loads.");
- let chat = SocialChatBar.chatbar.selectedChat;
- waitForCondition(function() chat.contentDocument.location.href.indexOf("about:socialerror?")==0,
- function() {
- chat.close();
- next();
- },
- "error page didn't appear");
- });
- }
- );
- }
-}
diff --git a/browser/base/content/test/social/browser_social_flyout.js b/browser/base/content/test/social/browser_social_flyout.js
deleted file mode 100644
index b8642e338..000000000
--- a/browser/base/content/test/social/browser_social_flyout.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-var tests = {
- testOpenCloseFlyout: function(next) {
- let panel = document.getElementById("social-flyout-panel");
- panel.addEventListener("popupshowing", function onShowing() {
- panel.removeEventListener("popupshowing", onShowing);
- is(panel.firstChild.contentDocument.readyState, "complete", "panel is loaded prior to showing");
- });
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- port.postMessage({topic: "test-flyout-open"});
- break;
- case "got-flyout-visibility":
- if (e.data.result == "hidden") {
- ok(true, "flyout visibility is 'hidden'");
- is(panel.state, "closed", "panel really is closed");
- port.close();
- next();
- } else if (e.data.result == "shown") {
- ok(true, "flyout visibility is 'shown");
- port.postMessage({topic: "test-flyout-close"});
- }
- break;
- case "got-flyout-message":
- ok(e.data.result == "ok", "got flyout message");
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- },
-
- testResizeFlyout: function(next) {
- let panel = document.getElementById("social-flyout-panel");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-flyout-open"});
- break;
- case "got-flyout-visibility":
- if (e.data.result != "shown")
- return;
- // The width of the flyout should be 400px initially
- let iframe = panel.firstChild;
- let body = iframe.contentDocument.body;
- let cs = iframe.contentWindow.getComputedStyle(body);
-
- is(cs.width, "400px", "should be 400px wide");
- is(iframe.boxObject.width, 400, "iframe should now be 400px wide");
- is(cs.height, "400px", "should be 400px high");
- is(iframe.boxObject.height, 400, "iframe should now be 400px high");
-
- iframe.contentWindow.addEventListener("resize", function _doneHandler() {
- iframe.contentWindow.removeEventListener("resize", _doneHandler, false);
- cs = iframe.contentWindow.getComputedStyle(body);
-
- is(cs.width, "500px", "should now be 500px wide");
- is(iframe.boxObject.width, 500, "iframe should now be 500px wide");
- is(cs.height, "500px", "should now be 500px high");
- is(iframe.boxObject.height, 500, "iframe should now be 500px high");
- panel.hidePopup();
- port.close();
- next();
- }, false);
- SocialFlyout.dispatchPanelEvent("socialTest-MakeWider");
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- },
-
- testCloseSelf: function(next) {
- // window.close is affected by the pref dom.allow_scripts_to_close_windows,
- // which defaults to false, but is set to true by the test harness.
- // so temporarily set it back.
- const ALLOW_SCRIPTS_TO_CLOSE_PREF = "dom.allow_scripts_to_close_windows";
- // note clearUserPref doesn't do what we expect, as the test harness itself
- // changes the pref value - so clearUserPref resets it to false rather than
- // the true setup by the test harness.
- let oldAllowScriptsToClose = Services.prefs.getBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF);
- Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, false);
- let panel = document.getElementById("social-flyout-panel");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-flyout-open"});
- break;
- case "got-flyout-visibility":
- let iframe = panel.firstChild;
- iframe.contentDocument.addEventListener("SocialTest-DoneCloseSelf", function _doneHandler() {
- iframe.contentDocument.removeEventListener("SocialTest-DoneCloseSelf", _doneHandler, false);
- is(panel.state, "closed", "flyout should have closed itself");
- Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, oldAllowScriptsToClose);
- next();
- }, false);
- is(panel.state, "open", "flyout should be open");
- port.close(); // so we don't get the -visibility message as it hides...
- SocialFlyout.dispatchPanelEvent("socialTest-CloseSelf");
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- },
-
- testCloseOnLinkTraversal: function(next) {
-
- function onTabOpen(event) {
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
- waitForCondition(function() { return panel.state == "closed" }, function() {
- gBrowser.removeTab(event.target);
- next();
- }, "panel should close after tab open");
- }
-
- let panel = document.getElementById("social-flyout-panel");
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- port.postMessage({topic: "test-flyout-open"});
- break;
- case "got-flyout-visibility":
- if (e.data.result == "shown") {
- // click on our test link
- is(panel.state, "open", "flyout should be open");
- gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
- let iframe = panel.firstChild;
- iframe.contentDocument.getElementById('traversal').click();
- }
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- }
-}
diff --git a/browser/base/content/test/social/browser_social_isVisible.js b/browser/base/content/test/social/browser_social_isVisible.js
deleted file mode 100644
index 6ae6b9d1f..000000000
--- a/browser/base/content/test/social/browser_social_isVisible.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-var tests = {
- testSidebarMessage: function(next) {
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- // The sidebar message will always come first, since it loads by default
- ok(true, "got sidebar message");
- port.close();
- next();
- break;
- }
- };
- },
- testIsVisible: function(next) {
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-isVisible-response":
- is(e.data.result, true, "Sidebar should be visible by default");
- Social.toggleSidebar();
- port.close();
- next();
- }
- };
- port.postMessage({topic: "test-isVisible"});
- },
- testIsNotVisible: function(next) {
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-isVisible-response":
- is(e.data.result, false, "Sidebar should be hidden");
- Services.prefs.clearUserPref("social.sidebar.open");
- port.close();
- next();
- }
- };
- port.postMessage({topic: "test-isVisible"});
- }
-}
diff --git a/browser/base/content/test/social/browser_social_markButton.js b/browser/base/content/test/social/browser_social_markButton.js
deleted file mode 100644
index eb7b6dead..000000000
--- a/browser/base/content/test/social/browser_social_markButton.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let prefName = "social.enabled",
- gFinishCB;
-
-function test() {
- waitForExplicitFinish();
-
- // Need to load a http/https/ftp/ftps page for the social mark button to appear
- let tab = gBrowser.selectedTab = gBrowser.addTab("https://test1.example.com", {skipAnimation: true});
- tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- executeSoon(tabLoaded);
- }, true);
-
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref(prefName);
- gBrowser.removeTab(tab);
- });
-}
-
-function tabLoaded() {
- ok(Social, "Social module loaded");
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- gFinishCB = finishcb;
- testInitial();
- });
-}
-
-function testInitial(finishcb) {
- ok(Social.provider, "Social provider is active");
- ok(Social.provider.enabled, "Social provider is enabled");
- let port = Social.provider.getWorkerPort();
- ok(port, "Social provider has a port to its FrameWorker");
- port.close();
-
- let markButton = SocialMark.button;
- ok(markButton, "mark button exists");
-
- // ensure the worker initialization and handshakes are all done and we
- // have a profile and the worker has sent a page-mark-config msg.
- waitForCondition(function() Social.provider.pageMarkInfo != null, function() {
- is(markButton.hasAttribute("marked"), false, "SocialMark button should not have 'marked' attribute before mark button is clicked");
- // Check the strings from our worker actually ended up on the button.
- is(markButton.getAttribute("tooltiptext"), "Mark this page", "check tooltip text is correct");
- // Check the relative URL was resolved correctly (note this image has offsets of zero...)
- is(markButton.style.listStyleImage, 'url("https://example.com/browser/browser/base/content/test/social/social_mark_image.png")', "check image url is correct");
-
- // Test the mark button command handler
- SocialMark.togglePageMark(function() {
- is(markButton.hasAttribute("marked"), true, "mark button should have 'marked' attribute after mark button is clicked");
- is(markButton.getAttribute("tooltiptext"), "Unmark this page", "check tooltip text is correct");
- // Check the URL and offsets were applied correctly
- is(markButton.style.listStyleImage, 'url("https://example.com/browser/browser/base/content/test/social/social_mark_image.png")', "check image url is correct");
- SocialMark.togglePageMark(function() {
- is(markButton.hasAttribute("marked"), false, "mark button should not be marked");
- executeSoon(function() {
- testStillMarkedIn2Tabs();
- });
- });
- });
- }, "provider didn't provide page-mark-config");
-}
-
-function testStillMarkedIn2Tabs() {
- let toMark = "http://test2.example.com";
- let markUri = Services.io.newURI(toMark, null, null);
- let markButton = SocialMark.button;
- let initialTab = gBrowser.selectedTab;
- info("initialTab has loaded " + gBrowser.currentURI.spec);
- is(markButton.hasAttribute("marked"), false, "SocialMark button should not have 'marked' for the initial tab");
-
- addTab(toMark, function(tab1) {
- addTab(toMark, function(tab2) {
- // should start without either page being marked.
- is(markButton.hasAttribute("marked"), false, "SocialMark button should not have 'marked' before we've done anything");
- Social.isURIMarked(markUri, function(marked) {
- ok(!marked, "page is unmarked in annotations");
- markButton.click();
- waitForCondition(function() markButton.hasAttribute("marked"), function() {
- Social.isURIMarked(markUri, function(marked) {
- ok(marked, "page is marked in annotations");
- // and switching to the first tab (with the same URL) should still reflect marked.
- selectBrowserTab(tab1, function() {
- is(markButton.hasAttribute("marked"), true, "SocialMark button should reflect the marked state");
- // wait for tabselect
- selectBrowserTab(initialTab, function() {
- waitForCondition(function() !markButton.hasAttribute("marked"), function() {
- gBrowser.selectedTab = tab1;
-
- SocialMark.togglePageMark(function() {
- Social.isURIMarked(gBrowser.currentURI, function(marked) {
- ok(!marked, "page is unmarked in annotations");
- is(markButton.hasAttribute("marked"), false, "mark button should not be marked");
- gBrowser.removeTab(tab1);
- gBrowser.removeTab(tab2);
- executeSoon(testStillMarkedAfterReopen);
- });
- });
- }, "button has been unmarked");
- });
- });
- });
- }, "button has been marked");
- });
- });
- });
-}
-
-function testStillMarkedAfterReopen() {
- let toMark = "http://test2.example.com";
- let markButton = SocialMark.button;
-
- is(markButton.hasAttribute("marked"), false, "Reopen: SocialMark button should not have 'marked' for the initial tab");
- addTab(toMark, function(tab) {
- SocialMark.togglePageMark(function() {
- is(markButton.hasAttribute("marked"), true, "SocialMark button should reflect the marked state");
- gBrowser.removeTab(tab);
- // should be on the initial unmarked tab now.
- waitForCondition(function() !markButton.hasAttribute("marked"), function() {
- // now open the same URL - should be back to Marked.
- addTab(toMark, function(tab) {
- is(markButton.hasAttribute("marked"), true, "New tab to previously marked URL should reflect marked state");
- SocialMark.togglePageMark(function() {
- gBrowser.removeTab(tab);
- executeSoon(testOnlyMarkCertainUrlsTabSwitch);
- });
- });
- }, "button is now unmarked");
- });
- });
-}
-
-function testOnlyMarkCertainUrlsTabSwitch() {
- let toMark = "http://test2.example.com";
- let notSharable = "about:blank";
- let markButton = SocialMark.button;
- addTab(toMark, function(tab) {
- ok(!markButton.hidden, "SocialMark button not hidden for http url");
- addTab(notSharable, function(tab2) {
- ok(markButton.disabled, "SocialMark button disabled for about:blank");
- selectBrowserTab(tab, function() {
- ok(!markButton.disabled, "SocialMark button re-shown when switching back to http: url");
- selectBrowserTab(tab2, function() {
- ok(markButton.disabled, "SocialMark button re-hidden when switching back to about:blank");
- gBrowser.removeTab(tab);
- gBrowser.removeTab(tab2);
- executeSoon(testOnlyMarkCertainUrlsSameTab);
- });
- });
- });
- });
-}
-
-function testOnlyMarkCertainUrlsSameTab() {
- let toMark = "http://test2.example.com";
- let notSharable = "about:blank";
- let markButton = SocialMark.button;
- addTab(toMark, function(tab) {
- ok(!markButton.disabled, "SocialMark button not disabled for http url");
- loadIntoTab(tab, notSharable, function() {
- ok(markButton.disabled, "SocialMark button disabled for about:blank");
- loadIntoTab(tab, toMark, function() {
- ok(!markButton.disabled, "SocialMark button re-enabled http url");
- gBrowser.removeTab(tab);
- executeSoon(testDisable);
- });
- });
- });
-}
-
-function testDisable() {
- let markButton = SocialMark.button;
- Services.prefs.setBoolPref(prefName, false);
- is(markButton.hidden, true, "SocialMark button should be hidden when pref is disabled");
- gFinishCB();
-}
diff --git a/browser/base/content/test/social/browser_social_mozSocial_API.js b/browser/base/content/test/social/browser_social_mozSocial_API.js
deleted file mode 100644
index 5a1e08b31..000000000
--- a/browser/base/content/test/social/browser_social_mozSocial_API.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-var tests = {
- testStatusIcons: function(next) {
- let iconsReady = false;
- let gotSidebarMessage = false;
-
- function checkNext() {
- if (iconsReady && gotSidebarMessage)
- triggerIconPanel();
- }
-
- function triggerIconPanel() {
- waitForCondition(function() {
- let mButton = document.getElementById("social-mark-button");
- let pButton = document.getElementById("social-provider-button");
- // wait for a new button to be inserted inbetween the provider and mark
- // button
- return pButton.nextSibling != mButton;
- }, function() {
- // Click the button to trigger its contentPanel
- let statusIcon = document.getElementById("social-provider-button").nextSibling;
- EventUtils.synthesizeMouseAtCenter(statusIcon, {});
- }, "Status icon didn't become non-hidden");
- }
-
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "test-init-done":
- iconsReady = true;
- checkNext();
- break;
- case "got-panel-message":
- ok(true, "got panel message");
- // Check the panel isn't in our history.
- gURLsNotRemembered.push(e.data.location);
- break;
- case "got-social-panel-visibility":
- if (e.data.result == "shown") {
- ok(true, "panel shown");
- let panel = document.getElementById("social-notification-panel");
- panel.hidePopup();
- } else if (e.data.result == "hidden") {
- ok(true, "panel hidden");
- port.close();
- next();
- }
- break;
- case "got-sidebar-message":
- // The sidebar message will always come first, since it loads by default
- ok(true, "got sidebar message");
- gotSidebarMessage = true;
- // load a status panel
- port.postMessage({topic: "test-ambient-notification"});
- checkNext();
- break;
- }
- }
- port.postMessage({topic: "test-init"});
- }
-}
diff --git a/browser/base/content/test/social/browser_social_multiprovider.js b/browser/base/content/test/social/browser_social_multiprovider.js
deleted file mode 100644
index 7ec7f0e2a..000000000
--- a/browser/base/content/test/social/browser_social_multiprovider.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- runSocialTestWithProvider(gProviders, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-let gProviders = [
- {
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html?provider1",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "chrome://branding/content/icon48.png"
- },
- {
- name: "provider 2",
- origin: "https://test1.example.com",
- sidebarURL: "https://test1.example.com/browser/browser/base/content/test/social/social_sidebar.html?provider2",
- workerURL: "https://test1.example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "chrome://branding/content/icon48.png"
- }
-];
-
-var tests = {
- testProviderSwitch: function(next) {
- function checkProviderMenu(selectedProvider) {
- let menu = document.getElementById("social-statusarea-popup");
- let menuProviders = menu.querySelectorAll(".social-provider-menuitem");
- is(menuProviders.length, gProviders.length, "correct number of providers listed in the menu");
- // Find the selectedProvider's menu item
- let el = menu.getElementsByAttribute("origin", selectedProvider.origin);
- is(el.length, 1, "selected provider menu item exists");
- is(el[0].getAttribute("checked"), "true", "selected provider menu item is checked");
- }
-
- checkProviderMenu(gProviders[0]);
-
- // Now wait for the initial provider profile to be set
- waitForProviderLoad(function() {
- checkUIStateMatchesProvider(gProviders[0]);
-
- // Now activate "provider 2"
- observeProviderSet(function () {
- waitForProviderLoad(function() {
- checkUIStateMatchesProvider(gProviders[1]);
- // disable social, click on the provider menuitem to switch providers
- Social.enabled = false;
- let menu = document.getElementById("social-statusarea-popup");
- let el = menu.getElementsByAttribute("origin", gProviders[0].origin);
- is(el.length, 1, "selected provider menu item exists");
- el[0].click();
- waitForProviderLoad(function() {
- checkUIStateMatchesProvider(gProviders[0]);
- next();
- });
- });
- });
- Social.activateFromOrigin("https://test1.example.com");
- });
- }
-}
-
-function checkUIStateMatchesProvider(provider) {
- let profileData = getExpectedProfileData(provider);
- // The toolbar
- let loginStatus = document.getElementsByClassName("social-statusarea-loggedInStatus");
- for (let label of loginStatus) {
- is(label.value, profileData.userName, "username name matches provider profile");
- }
- // Sidebar
- is(document.getElementById("social-sidebar-browser").getAttribute("src"), provider.sidebarURL, "side bar URL is set");
-}
-
-function getExpectedProfileData(provider) {
- // This data is defined in social_worker.js
- if (provider.origin == "https://test1.example.com") {
- return {
- displayName: "Test1 User",
- userName: "tester"
- };
- }
-
- return {
- displayName: "Kuma Lisa",
- userName: "trickster"
- };
-}
-
-function observeProviderSet(cb) {
- Services.obs.addObserver(function providerSet(subject, topic, data) {
- Services.obs.removeObserver(providerSet, "social:provider-set");
- info("social:provider-set observer was notified");
- // executeSoon to let the browser UI observers run first
- executeSoon(cb);
- }, "social:provider-set", false);
-}
-
-function waitForProviderLoad(cb) {
- waitForCondition(function() {
- let sbrowser = document.getElementById("social-sidebar-browser");
- return Social.provider.profile &&
- Social.provider.profile.displayName &&
- sbrowser.docShellIsActive;
- }, cb, "waitForProviderLoad: provider profile was not set");
-}
diff --git a/browser/base/content/test/social/browser_social_perwindowPB.js b/browser/base/content/test/social/browser_social_perwindowPB.js
deleted file mode 100644
index 60fc28529..000000000
--- a/browser/base/content/test/social/browser_social_perwindowPB.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function openTab(win, url, callback) {
- let newTab = win.gBrowser.addTab(url);
- let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
- tabBrowser.addEventListener("load", function tabLoadListener() {
- tabBrowser.removeEventListener("load", tabLoadListener, true);
- win.gBrowser.selectedTab = newTab;
- callback(newTab);
- }, true)
-}
-
-// Tests for per-window private browsing.
-function openPBWindow(callback) {
- let w = OpenBrowserWindow({private: true});
- w.addEventListener("load", function loadListener() {
- w.removeEventListener("load", loadListener);
- openTab(w, "http://example.com", function() {
- callback(w);
- });
- });
-}
-
-function postAndReceive(port, postTopic, receiveTopic, callback) {
- port.onmessage = function(e) {
- if (e.data.topic == receiveTopic)
- callback();
- }
- port.postMessage({topic: postTopic});
-}
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/social/moz.png"
- };
- runSocialTestWithProvider(manifest, function (finishcb) {
- openTab(window, "http://example.com", function(newTab) {
- runSocialTests(tests, undefined, undefined, function() {
- window.gBrowser.removeTab(newTab);
- finishcb();
- });
- });
- });
-}
-
-var tests = {
- testPrivateBrowsing: function(next) {
- let port = Social.provider.getWorkerPort();
- ok(port, "provider has a port");
- postAndReceive(port, "test-init", "test-init-done", function() {
- // social features should all be enabled in the existing window.
- info("checking main window ui");
- ok(window.SocialUI.enabled, "social is enabled in normal window");
- checkSocialUI(window);
- // open a new private-window
- openPBWindow(function(pbwin) {
- // The provider should remain alive.
- postAndReceive(port, "ping", "pong", function() {
- // the new window should have no social features at all.
- info("checking private window ui");
- ok(!pbwin.SocialUI.enabled, "social is disabled in a PB window");
- checkSocialUI(pbwin);
- // but they should all remain enabled in the initial window
- info("checking main window ui");
- ok(window.SocialUI.enabled, "social is still enabled in normal window");
- checkSocialUI(window);
- // that's all folks...
- pbwin.close();
- next();
- })
- });
- });
- },
-}
diff --git a/browser/base/content/test/social/browser_social_sidebar.js b/browser/base/content/test/social/browser_social_sidebar.js
deleted file mode 100644
index b9c471899..000000000
--- a/browser/base/content/test/social/browser_social_sidebar.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
- };
- runSocialTestWithProvider(manifest, doTest);
-}
-
-function doTest(finishcb) {
- ok(SocialSidebar.canShow, "social sidebar should be able to be shown");
- ok(SocialSidebar.opened, "social sidebar should be open by default");
-
- let command = document.getElementById("Social:ToggleSidebar");
- let sidebar = document.getElementById("social-sidebar-box");
- let browser = sidebar.firstChild;
-
- function checkShown(shouldBeShown) {
- is(command.getAttribute("checked"), shouldBeShown ? "true" : "false",
- "toggle command should be " + (shouldBeShown ? "checked" : "unchecked"));
- is(sidebar.hidden, !shouldBeShown,
- "sidebar should be " + (shouldBeShown ? "visible" : "hidden"));
- // The sidebar.open pref only reflects the actual state of the sidebar
- // when social is enabled.
- if (Social.enabled)
- is(Services.prefs.getBoolPref("social.sidebar.open"), shouldBeShown,
- "sidebar open pref should be " + shouldBeShown);
- if (shouldBeShown) {
- is(browser.getAttribute('src'), Social.provider.sidebarURL, "sidebar url should be set");
- // We don't currently check docShellIsActive as this is only set
- // after load event fires, and the tests below explicitly wait for this
- // anyway.
- }
- else {
- ok(!browser.docShellIsActive, "sidebar should have an inactive docshell");
- // sidebar will only be immediately unloaded (and thus set to
- // about:blank) when canShow is false.
- if (SocialSidebar.canShow) {
- // should not have unloaded so will still be the provider URL.
- is(browser.getAttribute('src'), Social.provider.sidebarURL, "sidebar url should be set");
- } else {
- // should have been an immediate unload.
- is(browser.getAttribute('src'), "about:blank", "sidebar url should be blank");
- }
- }
- }
-
- // First check the the sidebar is initially visible, and loaded
- ok(!command.hidden, "toggle command should be visible");
- checkShown(true);
-
- browser.addEventListener("socialFrameHide", function sidebarhide() {
- browser.removeEventListener("socialFrameHide", sidebarhide);
-
- checkShown(false);
-
- browser.addEventListener("socialFrameShow", function sidebarshow() {
- browser.removeEventListener("socialFrameShow", sidebarshow);
-
- checkShown(true);
-
- // Set Social.enabled = false and check everything is as expected.
- Social.enabled = false;
- checkShown(false);
-
- Social.enabled = true;
- checkShown(true);
-
- // And an edge-case - disable social and reset the provider.
- Social.provider = null;
- Social.enabled = false;
- checkShown(false);
-
- // Finish the test
- finishcb();
- });
-
- // Toggle it back on
- info("Toggling sidebar back on");
- Social.toggleSidebar();
- });
-
- // use port messaging to ensure that the sidebar is both loaded and
- // ready before we run other tests
- let port = Social.provider.getWorkerPort();
- port.postMessage({topic: "test-init"});
- port.onmessage = function (e) {
- let topic = e.data.topic;
- switch (topic) {
- case "got-sidebar-message":
- ok(true, "sidebar is loaded and ready");
- Social.toggleSidebar();
- }
- };
-}
-
-// XXX test sidebar in popup
diff --git a/browser/base/content/test/social/browser_social_toolbar.js b/browser/base/content/test/social/browser_social_toolbar.js
deleted file mode 100644
index 2a648ade2..000000000
--- a/browser/base/content/test/social/browser_social_toolbar.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png"
-};
-
-function test() {
- waitForExplicitFinish();
-
- runSocialTestWithProvider(manifest, function (finishcb) {
- runSocialTests(tests, undefined, undefined, finishcb);
- });
-}
-
-var tests = {
- testProfileNone: function(next, useNull) {
- let profile = useNull ? null : {};
- Social.provider.updateUserProfile(profile);
- // check dom values
- let portrait = document.getElementsByClassName("social-statusarea-user-portrait")[0].getAttribute("src");
- // this is the default image for the profile area when not logged in.
- ok(!portrait, "portrait is empty");
- let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
- let notLoggedInStatusValue = userDetailsBroadcaster.getAttribute("notLoggedInLabel");
- let userButton = document.getElementsByClassName("social-statusarea-loggedInStatus")[0];
- ok(!userButton.hidden, "username is visible");
- is(userButton.getAttribute("label"), notLoggedInStatusValue, "label reflects not being logged in");
- next();
- },
- testProfileNull: function(next) {
- this.testProfileNone(next, true);
- },
- testProfileSet: function(next) {
- let statusIcon = document.getElementById("social-provider-button").style.listStyleImage;
- is(statusIcon, "url(\"" + manifest.iconURL + "\")", "manifest iconURL is showing");
- let profile = {
- portrait: "https://example.com/portrait.jpg",
- userName: "trickster",
- displayName: "Kuma Lisa",
- profileURL: "http://example.com/Kuma_Lisa",
- iconURL: "https://example.com/browser/browser/base/content/test/social/moz.png"
- }
- Social.provider.updateUserProfile(profile);
- // check dom values
- statusIcon = document.getElementById("social-provider-button").style.listStyleImage;
- is(statusIcon, "url(\"" + profile.iconURL + "\")", "profile iconURL is showing");
- let portrait = document.getElementsByClassName("social-statusarea-user-portrait")[0].getAttribute("src");
- is(profile.portrait, portrait, "portrait is set");
- let userButton = document.getElementsByClassName("social-statusarea-loggedInStatus")[0];
- ok(!userButton.hidden, "username is visible");
- is(userButton.value, profile.userName, "username is set");
- next();
- },
- testNoAmbientNotificationsIsNoKeyboardMenu: function(next) {
- // The menu bar isn't as easy to instrument on Mac.
- if (navigator.platform.contains("Mac")) {
- info("Skipping checking the menubar on Mac OS");
- next();
- return;
- }
-
- // Test that keyboard accessible menuitem doesn't exist when no ambient icons specified.
- let toolsPopup = document.getElementById("menu_ToolsPopup");
- toolsPopup.addEventListener("popupshown", function ontoolspopupshownNoAmbient() {
- toolsPopup.removeEventListener("popupshown", ontoolspopupshownNoAmbient);
- let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
- ok(socialToggleMore, "Keyboard accessible social menu should exist");
- is(socialToggleMore.querySelectorAll("menuitem").length, 6, "The minimum number of menuitems is two when there are no ambient notifications.");
- is(socialToggleMore.hidden, false, "Menu should be visible since we show some non-ambient notifications in the menu.");
- toolsPopup.hidePopup();
- next();
- }, false);
- document.getElementById("menu_ToolsPopup").openPopup();
- },
- testAmbientNotifications: function(next) {
- let ambience = {
- name: "testIcon",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- contentPanel: "about:blank",
- counter: 42,
- label: "Test Ambient 1 \u2046",
- menuURL: "https://example.com/testAmbient1"
- };
- let ambience2 = {
- name: "testIcon2",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- contentPanel: "about:blank",
- counter: 0,
- label: "Test Ambient 2",
- menuURL: "https://example.com/testAmbient2"
- };
- let ambience3 = {
- name: "testIcon3",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- contentPanel: "about:blank",
- counter: 0,
- label: "Test Ambient 3",
- menuURL: "https://example.com/testAmbient3"
- };
- let ambience4 = {
- name: "testIcon4",
- iconURL: "https://example.com/browser/browser/base/content/test/moz.png",
- contentPanel: "about:blank",
- counter: 0,
- label: "Test Ambient 4",
- menuURL: "https://example.com/testAmbient4"
- };
- Social.provider.setAmbientNotification(ambience);
-
- // for Bug 813834. Check preference whether stored data is correct.
- is(JSON.parse(Services.prefs.getComplexValue("social.cached.ambientNotificationIcons", Ci.nsISupportsString).data).data.testIcon.label, "Test Ambient 1 \u2046", "label is stored into preference correctly");
-
- Social.provider.setAmbientNotification(ambience2);
- Social.provider.setAmbientNotification(ambience3);
-
- try {
- Social.provider.setAmbientNotification(ambience4);
- } catch(e) {}
- let numIcons = Object.keys(Social.provider.ambientNotificationIcons).length;
- ok(numIcons == 3, "prevent adding more than 3 ambient notification icons");
-
- let statusIcon = document.getElementById("social-provider-button").nextSibling;
- waitForCondition(function() {
- statusIcon = document.getElementById("social-provider-button").nextSibling;
- return !!statusIcon;
- }, function () {
- let badge = statusIcon.getAttribute("badge");
- is(badge, "42", "status value is correct");
- // If there is a counter, the aria-label should reflect it.
- is(statusIcon.getAttribute("aria-label"), "Test Ambient 1 \u2046 (42)");
-
- ambience.counter = 0;
- Social.provider.setAmbientNotification(ambience);
- badge = statusIcon.getAttribute("badge");
- is(badge, "", "status value is correct");
- // If there is no counter, the aria-label should be the same as the label
- is(statusIcon.getAttribute("aria-label"), "Test Ambient 1 \u2046");
-
- // The menu bar isn't as easy to instrument on Mac.
- if (navigator.platform.contains("Mac")) {
- next();
- return;
- }
-
- // Test that keyboard accessible menuitem was added.
- let toolsPopup = document.getElementById("menu_ToolsPopup");
- toolsPopup.addEventListener("popupshown", function ontoolspopupshownAmbient() {
- toolsPopup.removeEventListener("popupshown", ontoolspopupshownAmbient);
- let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
- ok(socialToggleMore, "Keyboard accessible social menu should exist");
- is(socialToggleMore.querySelectorAll("menuitem").length, 9, "The number of menuitems is minimum plus three ambient notification menuitems.");
- is(socialToggleMore.hidden, false, "Menu is visible when ambient notifications have label & menuURL");
- let menuitem = socialToggleMore.querySelector(".ambient-menuitem");
- is(menuitem.getAttribute("label"), "Test Ambient 1 \u2046", "Keyboard accessible ambient menuitem should have specified label");
- toolsPopup.hidePopup();
- next();
- }, false);
- document.getElementById("menu_ToolsPopup").openPopup();
- }, "statusIcon was never found");
- },
- testProfileUnset: function(next) {
- Social.provider.updateUserProfile({});
- // check dom values
- let ambientIcons = document.querySelectorAll("#social-toolbar-item > box");
- for (let ambientIcon of ambientIcons) {
- ok(ambientIcon.collapsed, "ambient icon (" + ambientIcon.id + ") is collapsed");
- }
-
- next();
- },
- testMenuitemsExist: function(next) {
- let toggleSidebarMenuitems = document.getElementsByClassName("social-toggle-sidebar-menuitem");
- is(toggleSidebarMenuitems.length, 2, "Toggle Sidebar menuitems exist");
- let toggleDesktopNotificationsMenuitems = document.getElementsByClassName("social-toggle-notifications-menuitem");
- is(toggleDesktopNotificationsMenuitems.length, 2, "Toggle notifications menuitems exist");
- let toggleSocialMenuitems = document.getElementsByClassName("social-toggle-menuitem");
- is(toggleSocialMenuitems.length, 2, "Toggle Social menuitems exist");
- next();
- },
- testToggleNotifications: function(next) {
- let enabled = Services.prefs.getBoolPref("social.toast-notifications.enabled");
- let cmd = document.getElementById("Social:ToggleNotifications");
- is(cmd.getAttribute("checked"), enabled ? "true" : "false");
- enabled = !enabled;
- Services.prefs.setBoolPref("social.toast-notifications.enabled", enabled);
- is(cmd.getAttribute("checked"), enabled ? "true" : "false");
- Services.prefs.clearUserPref("social.toast-notifications.enabled");
- next();
- },
-}
diff --git a/browser/base/content/test/social/browser_social_window.js b/browser/base/content/test/social/browser_social_window.js
deleted file mode 100644
index f6a0afab0..000000000
--- a/browser/base/content/test/social/browser_social_window.js
+++ /dev/null
@@ -1,145 +0,0 @@
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-// Test the top-level window UI for social.
-
-// This function should "reset" Social such that the next time Social.init()
-// is called (eg, when a new window is opened), it re-performs all
-// initialization.
-function resetSocial() {
- Social.initialized = false;
- Social._provider = null;
- Social.providers = [];
- // *sob* - listeners keep getting added...
- let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
- SocialService._providerListeners.clear();
-}
-
-let createdWindows = [];
-
-function openWindowAndWaitForInit(callback) {
- // this notification tells us SocialUI.init() has been run...
- let topic = "browser-delayed-startup-finished";
- let w = OpenBrowserWindow();
- createdWindows.push(w);
- Services.obs.addObserver(function providerSet(subject, topic, data) {
- Services.obs.removeObserver(providerSet, topic);
- info(topic + " observer was notified - continuing test");
- // executeSoon to let the browser UI observers run first
- executeSoon(function() {callback(w)});
- }, topic, false);
-}
-
-function postTestCleanup(cb) {
- for (let w of createdWindows)
- w.close();
- createdWindows = [];
- Services.prefs.clearUserPref("social.enabled");
- cb();
-}
-
-let manifest = { // normal provider
- name: "provider 1",
- origin: "https://example.com",
- sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
- workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
- iconURL: "https://example.com/browser/browser/base/content/test/social/moz.png"
-};
-
-function test() {
- waitForExplicitFinish();
- runSocialTests(tests, undefined, postTestCleanup);
-}
-
-let tests = {
- // check when social is totally disabled at startup (ie, no providers)
- testInactiveStartup: function(cbnext) {
- is(Social.providers.length, 0, "needs zero providers to start this test.");
- resetSocial();
- openWindowAndWaitForInit(function(w1) {
- checkSocialUI(w1);
- // Now social is (re-)initialized, open a secondary window and check that.
- openWindowAndWaitForInit(function(w2) {
- checkSocialUI(w2);
- checkSocialUI(w1);
- cbnext();
- });
- });
- },
-
- // Check when providers exist and social is turned on at startup.
- testEnabledStartup: function(cbnext) {
- runSocialTestWithProvider(manifest, function (finishcb) {
- resetSocial();
- openWindowAndWaitForInit(function(w1) {
- ok(Social.enabled, "social is enabled");
- checkSocialUI(w1);
- // now init is complete, open a second window
- openWindowAndWaitForInit(function(w2) {
- checkSocialUI(w2);
- checkSocialUI(w1);
- // disable social and re-check
- Services.prefs.setBoolPref("social.enabled", false);
- executeSoon(function() { // let all the UI observers run...
- ok(!Social.enabled, "social is disabled");
- checkSocialUI(w2);
- checkSocialUI(w1);
- finishcb();
- });
- });
- });
- }, cbnext);
- },
-
- // Check when providers exist but social is turned off at startup.
- testDisabledStartup: function(cbnext) {
- runSocialTestWithProvider(manifest, function (finishcb) {
- Services.prefs.setBoolPref("social.enabled", false);
- resetSocial();
- openWindowAndWaitForInit(function(w1) {
- ok(!Social.enabled, "social is disabled");
- checkSocialUI(w1);
- // now init is complete, open a second window
- openWindowAndWaitForInit(function(w2) {
- checkSocialUI(w2);
- checkSocialUI(w1);
- // enable social and re-check
- Services.prefs.setBoolPref("social.enabled", true);
- executeSoon(function() { // let all the UI observers run...
- ok(Social.enabled, "social is enabled");
- checkSocialUI(w2);
- checkSocialUI(w1);
- finishcb();
- });
- });
- });
- }, cbnext);
- },
-
- // Check when the last provider is removed.
- testRemoveProvider: function(cbnext) {
- runSocialTestWithProvider(manifest, function (finishcb) {
- openWindowAndWaitForInit(function(w1) {
- checkSocialUI(w1);
- // now init is complete, open a second window
- openWindowAndWaitForInit(function(w2) {
- checkSocialUI(w2);
- // remove the current provider.
- let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
- SocialService.removeProvider(manifest.origin, function() {
- ok(!Social.enabled, "social is disabled");
- is(Social.providers.length, 0, "no providers");
- checkSocialUI(w2);
- checkSocialUI(w1);
- // *sob* - runSocialTestWithProvider's cleanup fails when it can't
- // remove the provider, so re-add it.
- SocialService.addProvider(manifest, function() {
- finishcb();
- });
- });
- });
- });
- }, cbnext);
- },
-}
diff --git a/browser/base/content/test/social/head.js b/browser/base/content/test/social/head.js
deleted file mode 100644
index 1e5d8412c..000000000
--- a/browser/base/content/test/social/head.js
+++ /dev/null
@@ -1,517 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/commonjs/sdk/core/promise.js");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-
-function waitForCondition(condition, nextTest, errorMsg) {
- var tries = 0;
- var interval = setInterval(function() {
- if (tries >= 30) {
- ok(false, errorMsg);
- moveOn();
- }
- if (condition()) {
- moveOn();
- }
- tries++;
- }, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
-}
-
-// Check that a specified (string) URL hasn't been "remembered" (ie, is not
-// in history, will not appear in about:newtab or auto-complete, etc.)
-function promiseSocialUrlNotRemembered(url) {
- let deferred = Promise.defer();
- let uri = Services.io.newURI(url, null, null);
- PlacesUtils.asyncHistory.isURIVisited(uri, function(aURI, aIsVisited) {
- ok(!aIsVisited, "social URL " + url + " should not be in global history");
- deferred.resolve();
- });
- return deferred.promise;
-}
-
-let gURLsNotRemembered = [];
-
-
-function checkProviderPrefsEmpty(isError) {
- let MANIFEST_PREFS = Services.prefs.getBranch("social.manifest.");
- let prefs = MANIFEST_PREFS.getChildList("", []);
- let c = 0;
- for (let pref of prefs) {
- if (MANIFEST_PREFS.prefHasUserValue(pref)) {
- info("provider [" + pref + "] manifest left installed from previous test");
- c++;
- }
- }
- is(c, 0, "all provider prefs uninstalled from previous test");
- is(Social.providers.length, 0, "all providers uninstalled from previous test " + Social.providers.length);
-}
-
-function defaultFinishChecks() {
- checkProviderPrefsEmpty(true);
- finish();
-}
-
-function runSocialTestWithProvider(manifest, callback, finishcallback) {
- let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
-
- let manifests = Array.isArray(manifest) ? manifest : [manifest];
-
- // Check that none of the provider's content ends up in history.
- function finishCleanUp() {
- for (let i = 0; i < manifests.length; i++) {
- let m = manifests[i];
- for (let what of ['sidebarURL', 'workerURL', 'iconURL']) {
- if (m[what]) {
- yield promiseSocialUrlNotRemembered(m[what]);
- }
- };
- }
- for (let i = 0; i < gURLsNotRemembered.length; i++) {
- yield promiseSocialUrlNotRemembered(gURLsNotRemembered[i]);
- }
- gURLsNotRemembered = [];
- }
-
- info("runSocialTestWithProvider: " + manifests.toSource());
-
- let finishCount = 0;
- function finishIfDone(callFinish) {
- finishCount++;
- if (finishCount == manifests.length)
- Task.spawn(finishCleanUp).then(finishcallback || defaultFinishChecks);
- }
- function removeAddedProviders(cleanup) {
- manifests.forEach(function (m) {
- // If we're "cleaning up", don't call finish when done.
- let callback = cleanup ? function () {} : finishIfDone;
- // Similarly, if we're cleaning up, catch exceptions from removeProvider
- let removeProvider = SocialService.removeProvider.bind(SocialService);
- if (cleanup) {
- removeProvider = function (origin, cb) {
- try {
- SocialService.removeProvider(origin, cb);
- } catch (ex) {
- // Ignore "provider doesn't exist" errors.
- if (ex.message.indexOf("SocialService.removeProvider: no provider with origin") == 0)
- return;
- info("Failed to clean up provider " + origin + ": " + ex);
- }
- }
- }
- removeProvider(m.origin, callback);
- });
- }
- function finishSocialTest(cleanup) {
- // disable social before removing the providers to avoid providers
- // being activated immediately before we get around to removing it.
- Services.prefs.clearUserPref("social.enabled");
- removeAddedProviders(cleanup);
- }
-
- let providersAdded = 0;
- let firstProvider;
-
- manifests.forEach(function (m) {
- SocialService.addProvider(m, function(provider) {
-
- providersAdded++;
- info("runSocialTestWithProvider: provider added");
-
- // we want to set the first specified provider as the UI's provider
- if (provider.origin == manifests[0].origin) {
- firstProvider = provider;
- }
-
- // If we've added all the providers we need, call the callback to start
- // the tests (and give it a callback it can call to finish them)
- if (providersAdded == manifests.length) {
- // Set the UI's provider (which enables the feature)
- Social.provider = firstProvider;
-
- registerCleanupFunction(function () {
- finishSocialTest(true);
- });
- callback(finishSocialTest);
- }
- });
- });
-}
-
-function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
- let testIter = Iterator(tests);
- let providersAtStart = Social.providers.length;
- info("runSocialTests: start test run with " + providersAtStart + " providers");
-
- if (cbPreTest === undefined) {
- cbPreTest = function(cb) {cb()};
- }
- if (cbPostTest === undefined) {
- cbPostTest = function(cb) {cb()};
- }
-
- function runNextTest() {
- let name, func;
- try {
- [name, func] = testIter.next();
- } catch (err if err instanceof StopIteration) {
- // out of items:
- (cbFinish || defaultFinishChecks)();
- is(providersAtStart, Social.providers.length,
- "runSocialTests: finish test run with " + Social.providers.length + " providers");
- return;
- }
- // We run on a timeout as the frameworker also makes use of timeouts, so
- // this helps keep the debug messages sane.
- executeSoon(function() {
- function cleanupAndRunNextTest() {
- info("sub-test " + name + " complete");
- cbPostTest(runNextTest);
- }
- cbPreTest(function() {
- is(providersAtStart, Social.providers.length, "pre-test: no new providers left enabled");
- info("sub-test " + name + " starting");
- try {
- func.call(tests, cleanupAndRunNextTest);
- } catch (ex) {
- ok(false, "sub-test " + name + " failed: " + ex.toString() +"\n"+ex.stack);
- cleanupAndRunNextTest();
- }
- })
- });
- }
- runNextTest();
-}
-
-// A fairly large hammer which checks all aspects of the SocialUI for
-// internal consistency.
-function checkSocialUI(win) {
- win = win || window;
- let doc = win.document;
- let provider = Social.provider;
- let enabled = win.SocialUI.enabled;
- let active = Social.providers.length > 0 && !win.SocialUI._chromeless &&
- !PrivateBrowsingUtils.isWindowPrivate(win);
-
- function isbool(a, b, msg) {
- is(!!a, !!b, msg);
- }
- isbool(win.SocialSidebar.canShow, enabled, "social sidebar active?");
- if (enabled)
- isbool(win.SocialSidebar.opened, enabled, "social sidebar open?");
- isbool(win.SocialChatBar.isAvailable, enabled && Social.haveLoggedInUser(), "chatbar available?");
- isbool(!win.SocialChatBar.chatbar.hidden, enabled && Social.haveLoggedInUser(), "chatbar visible?");
-
- let markVisible = enabled && provider.pageMarkInfo;
- let canMark = markVisible && win.SocialMark.canMarkPage(win.gBrowser.currentURI);
- isbool(!win.SocialMark.button.hidden, markVisible, "SocialMark button visible?");
- isbool(!win.SocialMark.button.disabled, canMark, "SocialMark button enabled?");
- isbool(!doc.getElementById("social-toolbar-item").hidden, active, "toolbar items visible?");
- if (active) {
- if (!enabled) {
- ok(!win.SocialToolbar.button.style.listStyleImage, "toolbar button is default icon");
- } else {
- is(win.SocialToolbar.button.style.listStyleImage, 'url("' + Social.defaultProvider.iconURL + '")', "toolbar button has provider icon");
- }
- }
- // the menus should always have the provider name
- if (provider) {
- for (let id of ["menu_socialSidebar", "menu_socialAmbientMenu"])
- is(document.getElementById(id).getAttribute("label"), Social.provider.name, "element has the provider name");
- }
-
- // and for good measure, check all the social commands.
- isbool(!doc.getElementById("Social:Toggle").hidden, active, "Social:Toggle visible?");
- isbool(!doc.getElementById("Social:ToggleNotifications").hidden, enabled, "Social:ToggleNotifications visible?");
- isbool(!doc.getElementById("Social:FocusChat").hidden, enabled && Social.haveLoggedInUser(), "Social:FocusChat visible?");
- isbool(doc.getElementById("Social:FocusChat").getAttribute("disabled"), enabled ? "false" : "true", "Social:FocusChat disabled?");
- is(doc.getElementById("Social:TogglePageMark").getAttribute("disabled"), canMark ? "false" : "true", "Social:TogglePageMark enabled?");
-
- // broadcasters.
- isbool(!doc.getElementById("socialActiveBroadcaster").hidden, active, "socialActiveBroadcaster hidden?");
-}
-
-// blocklist testing
-function updateBlocklist(aCallback) {
- var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
- .getService(Ci.nsITimerCallback);
- var observer = function() {
- Services.obs.removeObserver(observer, "blocklist-updated");
- if (aCallback)
- executeSoon(aCallback);
- };
- Services.obs.addObserver(observer, "blocklist-updated", false);
- blocklistNotifier.notify(null);
-}
-
-function setAndUpdateBlocklist(aURL, aCallback) {
- Services.prefs.setCharPref("extensions.blocklist.url", aURL);
- updateBlocklist(aCallback);
-}
-
-function resetBlocklist(aCallback) {
- Services.prefs.clearUserPref("extensions.blocklist.url");
- updateBlocklist(aCallback);
-}
-
-function setManifestPref(name, manifest) {
- let string = Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- string.data = JSON.stringify(manifest);
- Services.prefs.setComplexValue(name, Ci.nsISupportsString, string);
-}
-
-function getManifestPrefname(aManifest) {
- // is same as the generated name in SocialServiceInternal.getManifestPrefname
- let originUri = Services.io.newURI(aManifest.origin, null, null);
- return "social.manifest." + originUri.hostPort.replace('.','-');
-}
-
-function setBuiltinManifestPref(name, manifest) {
- // we set this as a default pref, it must not be a user pref
- manifest.builtin = true;
- let string = Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- string.data = JSON.stringify(manifest);
- Services.prefs.getDefaultBranch(null).setComplexValue(name, Ci.nsISupportsString, string);
- // verify this is set on the default branch
- let stored = Services.prefs.getComplexValue(name, Ci.nsISupportsString).data;
- is(stored, string.data, "manifest '"+name+"' stored in default prefs");
- // don't dirty our manifest, we'll need it without this flag later
- delete manifest.builtin;
- // verify we DO NOT have a user-level pref
- ok(!Services.prefs.prefHasUserValue(name), "manifest '"+name+"' is not in user-prefs");
-}
-
-function resetBuiltinManifestPref(name) {
- Services.prefs.getDefaultBranch(null).deleteBranch(name);
- is(Services.prefs.getDefaultBranch(null).getPrefType(name),
- Services.prefs.PREF_INVALID, "default manifest removed");
-}
-
-function addTab(url, callback) {
- let tab = gBrowser.selectedTab = gBrowser.addTab(url, {skipAnimation: true});
- tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- executeSoon(function() {callback(tab)});
- }, true);
-}
-
-function selectBrowserTab(tab, callback) {
- if (gBrowser.selectedTab == tab) {
- executeSoon(function() {callback(tab)});
- return;
- }
- gBrowser.tabContainer.addEventListener("TabSelect", function onTabSelect() {
- gBrowser.tabContainer.removeEventListener("TabSelect", onTabSelect, false);
- is(gBrowser.selectedTab, tab, "browser tab is selected");
- executeSoon(function() {callback(tab)});
- });
- gBrowser.selectedTab = tab;
-}
-
-function loadIntoTab(tab, url, callback) {
- tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
- tab.linkedBrowser.removeEventListener("load", tabLoad, true);
- executeSoon(function() {callback(tab)});
- }, true);
- tab.linkedBrowser.loadURI(url);
-}
-
-
-// chat test help functions
-
-// And lots of helpers for the resize tests.
-function get3ChatsForCollapsing(mode, cb) {
- // We make one chat, then measure its size. We then resize the browser to
- // ensure a second can be created fully visible but a third can not - then
- // create the other 2. first will will be collapsed, second fully visible
- // and the third also visible and the "selected" one.
- // To make our life easier we don't go via the worker and ports so we get
- // more control over creation *and* to make the code much simpler. We
- // assume the worker/port stuff is individually tested above.
- let chatbar = window.SocialChatBar.chatbar;
- let chatWidth = undefined;
- let num = 0;
- is(chatbar.childNodes.length, 0, "chatbar starting empty");
- is(chatbar.menupopup.childNodes.length, 0, "popup starting empty");
-
- makeChat(mode, "first chat", function() {
- // got the first one.
- checkPopup();
- ok(chatbar.menupopup.parentNode.collapsed, "menu selection isn't visible");
- // we kinda cheat here and get the width of the first chat, assuming
- // that all future chats will have the same width when open.
- chatWidth = chatbar.calcTotalWidthOf(chatbar.selectedChat);
- let desired = chatWidth * 2.5;
- resizeWindowToChatAreaWidth(desired, function(sizedOk) {
- ok(sizedOk, "can't do any tests without this width");
- checkPopup();
- makeChat(mode, "second chat", function() {
- is(chatbar.childNodes.length, 2, "now have 2 chats");
- checkPopup();
- // and create the third.
- makeChat(mode, "third chat", function() {
- is(chatbar.childNodes.length, 3, "now have 3 chats");
- checkPopup();
- // XXX - this is a hacky implementation detail around the order of
- // the chats. Ideally things would be a little more sane wrt the
- // other in which the children were created.
- let second = chatbar.childNodes[2];
- let first = chatbar.childNodes[1];
- let third = chatbar.childNodes[0];
- ok(first.collapsed && !second.collapsed && !third.collapsed, "collapsed state as promised");
- is(chatbar.selectedChat, third, "third is selected as promised")
- info("have 3 chats for collapse testing - starting actual test...");
- cb(first, second, third);
- }, mode);
- }, mode);
- });
- }, mode);
-}
-
-function makeChat(mode, uniqueid, cb) {
- info("making a chat window '" + uniqueid +"'");
- const chatUrl = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
- let provider = Social.provider;
- let isOpened = window.SocialChatBar.openChat(provider, chatUrl + "?id=" + uniqueid, function(chat) {
- info("chat window has opened");
- // we can't callback immediately or we might close the chat during
- // this event which upsets the implementation - it is only 1/2 way through
- // handling the load event.
- chat.document.title = uniqueid;
- executeSoon(cb);
- }, mode);
- if (!isOpened) {
- ok(false, "unable to open chat window, no provider? more failures to come");
- executeSoon(cb);
- }
-}
-
-function checkPopup() {
- // popup only showing if any collapsed popup children.
- let chatbar = window.SocialChatBar.chatbar;
- let numCollapsed = 0;
- for (let chat of chatbar.childNodes) {
- if (chat.collapsed) {
- numCollapsed += 1;
- // and it have a menuitem weakmap
- is(chatbar.menuitemMap.get(chat).nodeName, "menuitem", "collapsed chat has a menu item");
- } else {
- ok(!chatbar.menuitemMap.has(chat), "open chat has no menu item");
- }
- }
- is(chatbar.menupopup.parentNode.collapsed, numCollapsed == 0, "popup matches child collapsed state");
- is(chatbar.menupopup.childNodes.length, numCollapsed, "popup has correct count of children");
- // todo - check each individual elt is what we expect?
-}
-// Resize the main window so the chat area's boxObject is |desired| wide.
-// Does a callback passing |true| if the window is now big enough or false
-// if we couldn't resize large enough to satisfy the test requirement.
-function resizeWindowToChatAreaWidth(desired, cb, count = 0) {
- let current = window.SocialChatBar.chatbar.getBoundingClientRect().width;
- let delta = desired - current;
- info(count + ": resizing window so chat area is " + desired + " wide, currently it is "
- + current + ". Screen avail is " + window.screen.availWidth
- + ", current outer width is " + window.outerWidth);
-
- // WTF? Sometimes we will get fractional values due to the - err - magic
- // of DevPointsPerCSSPixel etc, so we allow a couple of pixels difference.
- let widthDeltaCloseEnough = function(d) {
- return Math.abs(d) < 2;
- }
-
- // attempting to resize by (0,0), unsurprisingly, doesn't cause a resize
- // event - so just callback saying all is well.
- if (widthDeltaCloseEnough(delta)) {
- info(count + ": skipping this as screen width is close enough");
- executeSoon(function() {
- cb(true);
- });
- return;
- }
- // On lo-res screens we may already be maxed out but still smaller than the
- // requested size, so asking to resize up also will not cause a resize event.
- // So just callback now saying the test must be skipped.
- if (window.screen.availWidth - window.outerWidth < delta) {
- info(count + ": skipping this as screen available width is less than necessary");
- executeSoon(function() {
- cb(false);
- });
- return;
- }
- function resize_handler(event) {
- // for whatever reason, sometimes we get called twice for different event
- // phases, only handle one of them.
- if (event.eventPhase != event.AT_TARGET)
- return;
- // we did resize - but did we get far enough to be able to continue?
- let newSize = window.SocialChatBar.chatbar.getBoundingClientRect().width;
- let sizedOk = widthDeltaCloseEnough(newSize - desired);
- if (!sizedOk)
- return;
- window.removeEventListener("resize", resize_handler);
- info(count + ": resized window width is " + newSize);
- executeSoon(function() {
- cb(sizedOk);
- });
- }
- // Otherwise we request resize and expect a resize event
- window.addEventListener("resize", resize_handler);
- window.resizeBy(delta, 0);
-}
-
-function resizeAndCheckWidths(first, second, third, checks, cb) {
- if (checks.length == 0) {
- cb(); // nothing more to check!
- return;
- }
- let count = checks.length;
- let [width, numExpectedVisible, why] = checks.shift();
- info("<< Check " + count + ": " + why);
- info(count + ": " + "resizing window to " + width + ", expect " + numExpectedVisible + " visible items");
- resizeWindowToChatAreaWidth(width, function(sizedOk) {
- checkPopup();
- ok(sizedOk, count+": window resized correctly");
- function collapsedObserver(r, m) {
- if ([first, second, third].filter(function(item) !item.collapsed).length == numExpectedVisible) {
- if (m) {
- m.disconnect();
- }
- ok(true, count + ": " + "correct number of chats visible");
- info(">> Check " + count);
- resizeAndCheckWidths(first, second, third, checks, cb);
- return true;
- }
- return false;
- }
- if (!collapsedObserver()) {
- let m = new MutationObserver(collapsedObserver);
- m.observe(first, {attributes: true });
- m.observe(second, {attributes: true });
- m.observe(third, {attributes: true });
- }
- }, count);
-}
-
-function getPopupWidth() {
- let popup = window.SocialChatBar.chatbar.menupopup;
- ok(!popup.parentNode.collapsed, "asking for popup width when it is visible");
- let cs = document.defaultView.getComputedStyle(popup.parentNode);
- let margins = parseInt(cs.marginLeft) + parseInt(cs.marginRight);
- return popup.parentNode.getBoundingClientRect().width + margins;
-}
-
-function closeAllChats() {
- let chatbar = window.SocialChatBar.chatbar;
- chatbar.removeAll();
-}
-
diff --git a/browser/base/content/test/social/moz.build b/browser/base/content/test/social/moz.build
deleted file mode 100644
index 83fd82cd8..000000000
--- a/browser/base/content/test/social/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['opengraph']
diff --git a/browser/base/content/test/social/moz.png b/browser/base/content/test/social/moz.png
deleted file mode 100644
index 769c63634..000000000
--- a/browser/base/content/test/social/moz.png
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/social/opengraph/Makefile.in b/browser/base/content/test/social/opengraph/Makefile.in
deleted file mode 100644
index d0d5a1890..000000000
--- a/browser/base/content/test/social/opengraph/Makefile.in
+++ /dev/null
@@ -1,21 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- opengraph.html \
- og_invalid_url.html \
- shortlink_linkrel.html \
- shorturl_link.html \
- shorturl_linkrel.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/base/content/test/social/opengraph/moz.build b/browser/base/content/test/social/opengraph/moz.build
deleted file mode 100644
index 89251dc39..000000000
--- a/browser/base/content/test/social/opengraph/moz.build
+++ /dev/null
@@ -1,4 +0,0 @@
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
diff --git a/browser/base/content/test/social/opengraph/og_invalid_url.html b/browser/base/content/test/social/opengraph/og_invalid_url.html
deleted file mode 100644
index ad1dae2be..000000000
--- a/browser/base/content/test/social/opengraph/og_invalid_url.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html xmlns:og="http://ogp.me/ns#">
-<head>
- <meta property="og:url" content="chrome://browser/content/aboutDialog.xul"/>
- <meta property="og:site_name" content="Evil chrome delivering website"/>
- <meta property="og:description"
- content="A test corpus file for open graph tags passing a bad url"/>
-</head>
-<body>
- Open Graph Test Page
-</body>
-</html>
diff --git a/browser/base/content/test/social/opengraph/opengraph.html b/browser/base/content/test/social/opengraph/opengraph.html
deleted file mode 100644
index 50b7703b8..000000000
--- a/browser/base/content/test/social/opengraph/opengraph.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html xmlns:og="http://ogp.me/ns#">
-<head>
- <meta property="og:title" content="&gt;This is my title&lt;"/>
- <meta property="og:url" content="https://www.mozilla.org"/>
- <meta property="og:image" content="https://www.mozilla.org/favicon.png"/>
- <meta property="og:site_name" content="&#62;My simple test page&#60;"/>
- <meta property="og:description"
- content="A test corpus file for open graph tags we care about"/>
-</head>
-<body>
- Open Graph Test Page
-</body>
-</html>
diff --git a/browser/base/content/test/social/opengraph/shortlink_linkrel.html b/browser/base/content/test/social/opengraph/shortlink_linkrel.html
deleted file mode 100644
index 54c40c376..000000000
--- a/browser/base/content/test/social/opengraph/shortlink_linkrel.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<head>
- <link rel="image_src" href="http://example.com/1234/56789.jpg" id="image-src" />
- <link id="canonicalurl" rel="canonical" href="http://www.example.com/photos/56789/" />
- <link rel="shortlink" href="http://imshort/p/abcde" />
-</head>
-<body>
- link[rel='shortlink']
-</body>
-</html>
diff --git a/browser/base/content/test/social/opengraph/shorturl_link.html b/browser/base/content/test/social/opengraph/shorturl_link.html
deleted file mode 100644
index 667122cea..000000000
--- a/browser/base/content/test/social/opengraph/shorturl_link.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<head>
- <link rel="image_src" href="http://example.com/1234/56789.jpg" id="image-src" />
- <link id="canonicalurl" rel="canonical" href="http://www.example.com/photos/56789/" />
- <link id="shorturl" rev="canonical" type="text/html" href="http://imshort/p/abcde" />
-</head>
-<body>
- link id="shorturl"
-</body>
-</html>
diff --git a/browser/base/content/test/social/opengraph/shorturl_linkrel.html b/browser/base/content/test/social/opengraph/shorturl_linkrel.html
deleted file mode 100644
index 36533528e..000000000
--- a/browser/base/content/test/social/opengraph/shorturl_linkrel.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<html>
-<head>
- <title>Test Image</title>
-
- <meta name="description" content="Iron man in a tutu" />
- <meta name="title" content="Test Image" />
-
- <meta name="medium" content="image" />
- <link rel="image_src" href="http://example.com/1234/56789.jpg" id="image-src" />
- <link id="canonicalurl" rel="canonical" href="http://www.example.com/photos/56789/" />
- <link id="shorturl" href="http://imshort/p/abcde" />
-
- <meta property="og:title" content="TestImage" />
- <meta property="og:type" content="photos:photo" />
- <meta property="og:url" content="http://www.example.com/photos/56789/" />
- <meta property="og:site_name" content="My Photo Site" />
- <meta property="og:description" content="Iron man in a tutu" />
- <meta property="og:image" content="http://example.com/1234/56789.jpg" />
- <meta property="og:image:width" content="480" />
- <meta property="og:image:height" content="640" />
-</head>
-<body>
- link[rel='shorturl']
-</body>
-</html>
diff --git a/browser/base/content/test/social/share.html b/browser/base/content/test/social/share.html
deleted file mode 100644
index 6a4dc49b6..000000000
--- a/browser/base/content/test/social/share.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- var shareData;
- addEventListener("OpenGraphData", function(e) {
- shareData = JSON.parse(e.detail);
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "share-data-message", result: shareData});
- // share windows self-close
- window.close();
- })
- </script>
- </head>
- <body>
- <p>This is a test social share window.</p>
- </body>
-</html>
diff --git a/browser/base/content/test/social/social_activate.html b/browser/base/content/test/social/social_activate.html
deleted file mode 100644
index b008aad33..000000000
--- a/browser/base/content/test/social/social_activate.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-<head>
- <title>Activation test</title>
-</head>
-<script>
-// icons from http://findicons.com/icon/158311/firefox?id=356182 by ipapun
-var data = {
- // currently required
- "name": "Demo Social Service",
- "iconURL": "chrome://branding/content/icon16.png",
- "icon32URL": "chrome://branding/content/favicon32.png",
- "icon64URL": "chrome://branding/content/icon64.png",
-
- // at least one of these must be defined
- "sidebarURL": "/browser/browser/base/content/test/social/social_sidebar.html",
- "workerURL": "/browser/browser/base/content/test/social/social_worker.js",
-
- // should be available for display purposes
- "description": "A short paragraph about this provider",
- "author": "Shane Caraveo, Mozilla",
-
- // optional
- "version": 1
-}
-
-function activate(node) {
- node.setAttribute("data-service", JSON.stringify(data));
- var event = new CustomEvent("ActivateSocialFeature");
- node.dispatchEvent(event);
-}
-
-function oldActivate(node) {
- var event = new CustomEvent("ActivateSocialFeature");
- document.dispatchEvent(event);
-}
-</script>
-<body>
-
-nothing to see here
-
-<button id="activation-old" onclick="oldActivate(this)">Activate The Demo Provider</button>
-<button id="activation" onclick="activate(this)">Activate The Demo Provider</button>
-
-</body>
-</html>
diff --git a/browser/base/content/test/social/social_activate_iframe.html b/browser/base/content/test/social/social_activate_iframe.html
deleted file mode 100644
index f8462ec80..000000000
--- a/browser/base/content/test/social/social_activate_iframe.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head>
- <title>Activation iframe test</title>
-</head>
-
-<body>
-
-<iframe src="social_activate.html"/>
-
-</body>
-</html>
diff --git a/browser/base/content/test/social/social_chat.html b/browser/base/content/test/social/social_chat.html
deleted file mode 100644
index ba507592e..000000000
--- a/browser/base/content/test/social/social_chat.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- function pingWorker() {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "chatbox-message", result: "ok"});
- }
- window.addEventListener("socialFrameShow", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "chatbox-visibility", result: "shown"});
- }, false);
- window.addEventListener("socialFrameHide", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "chatbox-visibility", result: "hidden"});
- }, false);
- window.addEventListener("socialTest-CloseSelf", function(e) {
- window.close();
- }, false);
- </script>
- <title>test chat window</title>
- </head>
- <body onload="pingWorker();">
- <p>This is a test social chat window.</p>
- <!-- a couple of input fields to help with focus testing -->
- <input id="input1"/>
- <input id="input2"/>
-
- <!-- an iframe here so this one page generates multiple load events -->
- <iframe id="iframe" src="data:text/plain:this is an iframe"></iframe>
- </body>
-</html>
diff --git a/browser/base/content/test/social/social_flyout.html b/browser/base/content/test/social/social_flyout.html
deleted file mode 100644
index ff426783a..000000000
--- a/browser/base/content/test/social/social_flyout.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- function pingWorker() {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "flyout-message", result: "ok"});
- }
- window.addEventListener("socialFrameShow", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "flyout-visibility", result: "shown"});
- }, false);
- window.addEventListener("socialFrameHide", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "flyout-visibility", result: "hidden"});
- }, false);
- window.addEventListener("socialTest-MakeWider", function(e) {
- document.body.setAttribute("style", "width: 500px; height: 500px; margin: 0; overflow: hidden;");
- document.body.offsetWidth; // force a layout flush
- var evt = document.createEvent("CustomEvent");
- evt.initCustomEvent("SocialTest-DoneMakeWider", true, true, {});
- document.documentElement.dispatchEvent(evt);
- }, false);
- window.addEventListener("socialTest-CloseSelf", function(e) {
- window.close();
- var evt = document.createEvent("CustomEvent");
- evt.initCustomEvent("SocialTest-DoneCloseSelf", true, true, {});
- document.documentElement.dispatchEvent(evt);
- }, false);
- </script>
- </head>
- <body style="width: 400px; height: 400px; margin: 0; overflow: hidden;" onload="pingWorker();">
- <p>This is a test social flyout panel.</p>
- <a id="traversal" href="http://mochi.test">test link</a>
- </body>
-</html>
-
diff --git a/browser/base/content/test/social/social_mark_image.png b/browser/base/content/test/social/social_mark_image.png
deleted file mode 100644
index fa1f8fb0e..000000000
--- a/browser/base/content/test/social/social_mark_image.png
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/social/social_panel.html b/browser/base/content/test/social/social_panel.html
deleted file mode 100644
index ada53d9ed..000000000
--- a/browser/base/content/test/social/social_panel.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- function pingWorker() {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "panel-message",
- result: "ok",
- location: window.location.href});
- }
- window.addEventListener("socialFrameShow", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "status-panel-visibility", result: "shown"});
- }, false);
- window.addEventListener("socialFrameHide", function(e) {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "status-panel-visibility", result: "hidden"});
- }, false);
- </script>
- </head>
- <body onload="pingWorker();">
- <p>This is a test social panel.</p>
- </body>
-</html>
diff --git a/browser/base/content/test/social/social_sidebar.html b/browser/base/content/test/social/social_sidebar.html
deleted file mode 100644
index dc66b5d31..000000000
--- a/browser/base/content/test/social/social_sidebar.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- var testwindow;
- function pingWorker() {
- var port = navigator.mozSocial.getWorker().port;
- port.onmessage = function(e) {
- var topic = e.data.topic;
- switch (topic) {
- case "test-flyout-open":
- navigator.mozSocial.openPanel("social_flyout.html");
- break;
- case "test-flyout-close":
- navigator.mozSocial.closePanel();
- break;
- case "test-chatbox-open":
- var url = "social_chat.html";
- var data = e.data.data;
- if (data && data.id) {
- url = url + "?id="+data.id;
- }
- navigator.mozSocial.openChatWindow(url, function(chatwin) {
- // Note that the following .focus() call should *not* arrange
- // to steal focus - see browser_social_chatwindowfocus.js
- if (data && data.stealFocus && chatwin) {
- chatwin.focus();
- }
- port.postMessage({topic: "chatbox-opened",
- result: chatwin ? "ok" : "failed"});
- });
- break;
- case "test-isVisible":
- port.postMessage({topic: "test-isVisible-response",
- result: navigator.mozSocial.isVisible});
- break;
- }
- }
- port.postMessage({topic: "sidebar-message", result: "ok"});
- }
- </script>
- </head>
- <body onload="pingWorker();">
- <p>This is a test social sidebar.</p>
- <button id="chat-opener" onclick="navigator.mozSocial.openChatWindow('./social_chat.html');"/>
- </body>
-</html>
diff --git a/browser/base/content/test/social/social_window.html b/browser/base/content/test/social/social_window.html
deleted file mode 100644
index 1e95ca0ee..000000000
--- a/browser/base/content/test/social/social_window.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
- <head>
- <meta charset="utf-8">
- <script>
- function pingWorker() {
- var port = navigator.mozSocial.getWorker().port;
- port.postMessage({topic: "service-window-message",
- location: window.location.href,
- result: "ok"
- });
- }
- </script>
- </head>
- <body onload="pingWorker();">
- <p>This is a test social service window.</p>
- </body>
-</html>
diff --git a/browser/base/content/test/social/social_worker.js b/browser/base/content/test/social/social_worker.js
deleted file mode 100644
index 1c1fd43e2..000000000
--- a/browser/base/content/test/social/social_worker.js
+++ /dev/null
@@ -1,149 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let testPort, sidebarPort, apiPort;
-
-onconnect = function(e) {
- let port = e.ports[0];
- port.onmessage = function onMessage(event) {
- let topic = event.data.topic;
- switch (topic) {
- case "test-init":
- testPort = port;
- port.postMessage({topic: "test-init-done"});
- break;
- case "ping":
- port.postMessage({topic: "pong"});
- break;
- case "test-logout":
- apiPort.postMessage({topic: "social.user-profile", data: {}});
- break;
- case "sidebar-message":
- sidebarPort = port;
- if (testPort && event.data.result == "ok")
- testPort.postMessage({topic:"got-sidebar-message"});
- break;
- case "service-window-message":
- testPort.postMessage({topic:"got-service-window-message",
- location: event.data.location});
- break;
- case "service-window-closed-message":
- testPort.postMessage({topic:"got-service-window-closed-message"});
- break;
- case "test-service-window":
- sidebarPort.postMessage({topic:"test-service-window"});
- break;
- case "test-service-window-twice":
- sidebarPort.postMessage({topic:"test-service-window-twice"});
- break;
- case "test-service-window-twice-result":
- testPort.postMessage({topic: "test-service-window-twice-result", result: event.data.result })
- break;
- case "test-close-service-window":
- sidebarPort.postMessage({topic:"test-close-service-window"});
- break;
- case "panel-message":
- if (testPort && event.data.result == "ok")
- testPort.postMessage({topic:"got-panel-message",
- location: event.data.location
- });
- break;
- case "status-panel-visibility":
- testPort.postMessage({topic:"got-social-panel-visibility", result: event.data.result });
- break;
- case "test-chatbox-open":
- sidebarPort.postMessage(event.data);
- break;
- case "chatbox-opened":
- testPort.postMessage(event.data);
- break;
- case "chatbox-message":
- testPort.postMessage({topic:"got-chatbox-message", result: event.data.result});
- break;
- case "chatbox-visibility":
- testPort.postMessage({topic:"got-chatbox-visibility", result: event.data.result});
- break;
- case "test-flyout-open":
- sidebarPort.postMessage({topic:"test-flyout-open"});
- break;
- case "flyout-message":
- testPort.postMessage({topic:"got-flyout-message", result: event.data.result});
- break;
- case "flyout-visibility":
- testPort.postMessage({topic:"got-flyout-visibility", result: event.data.result});
- break;
- case "test-flyout-close":
- sidebarPort.postMessage({topic:"test-flyout-close"});
- break;
- case "test-worker-chat":
- apiPort.postMessage({topic: "social.request-chat", data: event.data.data });
- break;
- case "social.initialize":
- // This is the workerAPI port, respond and set up a notification icon.
- // For multiprovider tests, we support acting like different providers
- // based on the domain we load from.
- apiPort = port;
- let profile;
- if (location.href.indexOf("https://test1.example.com") == 0) {
- profile = {
- portrait: "https://test1.example.com/portrait.jpg",
- userName: "tester",
- displayName: "Test1 User",
- };
- } else {
- profile = {
- portrait: "https://example.com/portrait.jpg",
- userName: "trickster",
- displayName: "Kuma Lisa",
- profileURL: "http://en.wikipedia.org/wiki/Kuma_Lisa"
- };
- }
- port.postMessage({topic: "social.user-profile", data: profile});
- port.postMessage({
- topic: "social.page-mark-config",
- data: {
- images: {
- // this one is relative to test we handle relative ones.
- marked: "/browser/browser/base/content/test/social/social_mark_image.png",
- // absolute to check we handle them too.
- unmarked: "https://example.com/browser/browser/base/content/test/social/social_mark_image.png"
- },
- messages: {
- unmarkedTooltip: "Mark this page",
- markedTooltip: "Unmark this page",
- unmarkedLabel: "Mark",
- markedLabel: "Unmark",
- }
- }
- });
- break;
- case "test-ambient-notification":
- let icon = {
- name: "testIcon",
- iconURL: "chrome://browser/skin/Info.png",
- contentPanel: "https://example.com/browser/browser/base/content/test/social/social_panel.html",
- counter: 1
- };
- apiPort.postMessage({topic: "social.ambient-notification", data: icon});
- break;
- case "test-isVisible":
- sidebarPort.postMessage({topic: "test-isVisible"});
- break;
- case "test-isVisible-response":
- testPort.postMessage({topic: "got-isVisible-response", result: event.data.result});
- break;
- case "share-data-message":
- if (testPort)
- testPort.postMessage({topic:"got-share-data-message", result: event.data.result});
- break;
- case "worker.update":
- apiPort.postMessage({topic: 'social.manifest-get'});
- break;
- case "social.manifest":
- event.data.data.version = 2;
- apiPort.postMessage({topic: 'social.manifest-set', data: event.data.data});
- break;
- }
- }
-}
diff --git a/browser/base/content/test/subtst_contextmenu.html b/browser/base/content/test/subtst_contextmenu.html
deleted file mode 100644
index 9f8687205..000000000
--- a/browser/base/content/test/subtst_contextmenu.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Subtest for browser context menu</title>
-</head>
-<body>
-Browser context menu subtest.
-
-<div id="test-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</div>
-<a id="test-link" href="http://mozilla.com">Click the monkey!</a>
-<a id="test-mailto" href="mailto:codemonkey@mozilla.com">Mail the monkey!</a><br>
-<input id="test-input"><br>
-<img id="test-image" src="ctxmenu-image.png">
-<canvas id="test-canvas" width="100" height="100" style="background-color: blue"></canvas>
-<video controls id="test-video-ok" src="video.ogg" width="100" height="100" style="background-color: green"></video>
-<video id="test-audio-in-video" src="audio.ogg" width="100" height="100" style="background-color: red"></video>
-<video controls id="test-video-bad" src="bogus.duh" width="100" height="100" style="background-color: orange"></video>
-<video controls id="test-video-bad2" width="100" height="100" style="background-color: yellow">
- <source src="bogus.duh" type="video/durrrr;">
-</video>
-<iframe id="test-iframe" width="98" height="98" style="border: 1px solid black"></iframe>
-<iframe id="test-video-in-iframe" src="video.ogg" width="98" height="98" style="border: 1px solid black"></iframe>
-<iframe id="test-image-in-iframe" src="ctxmenu-image.png" width="98" height="98" style="border: 1px solid black"></iframe>
-<textarea id="test-textarea">chssseesbbbie</textarea> <!-- a weird word which generates only one suggestion -->
-<div id="test-contenteditable" contenteditable="true">chssseefsbbbie</div> <!-- a more weird word which generates no suggestions -->
-<input id="test-input-spellcheck" type="text" spellcheck="true" autofocus value="prodkjfgigrty"> <!-- this one also generates one suggestion -->
-<div id="test-contenteditable-spellcheck-false" contenteditable="true" spellcheck="false">test</div> <!-- No Check Spelling menu item -->
-<div id="test-dom-full-screen">DOM full screen FTW</div>
-<div contextmenu="myMenu">
- <p id="test-pagemenu" hopeless="true">I've got a context menu!</p>
- <menu id="myMenu" type="context">
- <menuitem label="Plain item" onclick="document.getElementById('test-pagemenu').removeAttribute('hopeless');"></menuitem>
- <menuitem label="Disabled item" disabled></menuitem>
- <menuitem> Item w/ textContent</menuitem>
- <menu>
- <menuitem type="checkbox" label="Checkbox" checked></menuitem>
- </menu>
- <menu>
- <menuitem type="radio" label="Radio1" checked></menuitem>
- <menuitem type="radio" label="Radio2"></menuitem>
- <menuitem type="radio" label="Radio3"></menuitem>
- </menu>
- <menu>
- <menuitem label="Item w/ icon" icon="favicon.ico"></menuitem>
- <menuitem label="Item w/ bad icon" icon="data://www.mozilla.org/favicon.ico"></menuitem>
- </menu>
- <menu label="Submenu">
- <menuitem type="radio" label="Radio1" radiogroup="rg"></menuitem>
- <menuitem type="radio" label="Radio2" checked radiogroup="rg"></menuitem>
- <menuitem type="radio" label="Radio3" radiogroup="rg"></menuitem>
- <menu>
- <menuitem type="checkbox" label="Checkbox"></menuitem>
- </menu>
- </menu>
- <menu hidden>
- <menuitem label="Bogus item"></menuitem>
- </menu>
- <menu>
- </menu>
- <menuitem label="Hidden item" hidden></menuitem>
- <menuitem></menuitem>
- </menu>
-</div>
-<div id="test-select-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</div>
-<div id="test-select-text-link">http://mozilla.com</div>
-<a id="test-image-link" href="#"><img src="ctxmenu-image.png"></a>
-<input id="test-select-input-text" type="text" value="input">
-<input id="test-select-input-text-type-password" type="password" value="password">
-<embed id="test-plugin" style="width: 200px; height: 200px;" type="application/x-test"></embed>
-</body>
-</html>
diff --git a/browser/base/content/test/test_bug364677.html b/browser/base/content/test/test_bug364677.html
deleted file mode 100644
index 67b9729d1..000000000
--- a/browser/base/content/test/test_bug364677.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=364677
--->
-<head>
- <title>Test for Bug 364677</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=364677">Mozilla Bug 364677</a>
-<p id="display"><iframe id="testFrame" src="bug364677-data.xml"></iframe></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 364677 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- is(SpecialPowers.wrap($("testFrame")).contentDocument.documentElement.id, "feedHandler",
- "Feed served as text/xml without a channel/link should have been sniffed");
-});
-addLoadEvent(SimpleTest.finish);
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/browser/base/content/test/test_bug395533.html b/browser/base/content/test/test_bug395533.html
deleted file mode 100644
index 013c8789f..000000000
--- a/browser/base/content/test/test_bug395533.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=395533
--->
-<head>
- <title>Test for Bug 395533</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=395533">Mozilla Bug 395533</a>
-<p id="display"><iframe id="testFrame" src="bug395533-data.txt"></iframe></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 395533 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- // Need privs because the feed seems to have an about:feeds principal or some
- // such. It's not same-origin with us in any case.
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- is($("testFrame").contentDocument.documentElement.id, "",
- "Text got sniffed as a feed?");
-});
-addLoadEvent(SimpleTest.finish);
-
-
-
-
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/browser/base/content/test/test_bug435035.html b/browser/base/content/test/test_bug435035.html
deleted file mode 100644
index a3d353514..000000000
--- a/browser/base/content/test/test_bug435035.html
+++ /dev/null
@@ -1 +0,0 @@
-<img src="http://example.com/browser/browser/base/content/test/moz.png">
diff --git a/browser/base/content/test/test_bug452451.html b/browser/base/content/test/test_bug452451.html
deleted file mode 100644
index 633bd5fa2..000000000
--- a/browser/base/content/test/test_bug452451.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=452451
--->
-<head>
- <title>Test for Bug 452451</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=452451">Mozilla Bug 452451</a>
-<p id="display"></p>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 452451 **/
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- const prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- ok(prefs.getBoolPref("javascript.options.relimit"),
- "relimit should be enabled by default");
-
- /**
- * Following tests are inspired from:
- * js/src/tests/js1_5/extensions/regress-330569.js
- */
-
- var s;
- const expected = 'InternalError: regular expression too complex';
-
- s = '<!DOCTYPE HTML PUBLIC>' +
- '<html>\n' +
- '<head>\n' +
- '<meta http-equiv="content-type" content="text/html">\n' +
- '<title></title>\n'+
- '</head>\n' +
- '<body>\n' +
- '<!-- hello -->\n' +
- '<script language="JavaScript">\n' +
- 'var s = document. body. innerHTML;\n' +
- 'var d = s. replace (/<!--(.*|\n)*-->/, "");\n' +
- '<\/script>\n' +
- '<\/body>\n' +
- '<\/html>\n';
-
- try {
- /<!--(.*|\n)*-->/.exec(s);
- }
- catch(ex) {
- actual = ex;
- }
-
- is(actual, expected, "reg exp too complex error should have been thrown");
-
- function testre( re, n )
- {
- var txt = '';
- for (var i= 0; i <= n; ++i) {
- txt += ',';
- re.test(txt);
- }
- }
-
- try {
- testre( /(?:,*)*x/, 22 );
- }
- catch(ex) {
- actual = ex;
- }
-
- is(actual, expected, "reg exp too complex error should have been thrown");
-
- try {
- testre( /(?:,|,)*x/, 22 );
- }
- catch(ex) {
- actual = ex;
- }
-
- is(actual, expected, "reg exp too complex error should have been thrown");
-
- try {
- testre( /(?:,|,|,|,|,)*x/, 10 );
- }
- catch(ex) {
- actual = ex;
- }
-
- is(actual, expected, "reg exp too complex error should have been thrown");
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/base/content/test/test_bug462673.html b/browser/base/content/test/test_bug462673.html
deleted file mode 100644
index d864990e4..000000000
--- a/browser/base/content/test/test_bug462673.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html>
-<head>
-<script>
-var w;
-function openIt() {
- w = window.open("", "window2");
-}
-function closeIt() {
- if (w) {
- w.close();
- w = null;
- }
-}
-</script>
-</head>
-<body onload="openIt();" onunload="closeIt();">
-</body>
-</html>
diff --git a/browser/base/content/test/test_bug628179.html b/browser/base/content/test/test_bug628179.html
deleted file mode 100644
index d35e17a7c..000000000
--- a/browser/base/content/test/test_bug628179.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Test for closing the Find bar in subdocuments</title>
- </head>
- <body>
- <iframe id=iframe src="http://example.com/" width=320 height=240></iframe>
- </body>
-</html>
-
diff --git a/browser/base/content/test/test_bug839103.html b/browser/base/content/test/test_bug839103.html
deleted file mode 100644
index 3639d4bda..000000000
--- a/browser/base/content/test/test_bug839103.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Document for Bug 839103</title>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <style></style>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/base/content/test/test_contextmenu.html b/browser/base/content/test/test_contextmenu.html
deleted file mode 100644
index 15555fe31..000000000
--- a/browser/base/content/test/test_contextmenu.html
+++ /dev/null
@@ -1,1088 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Tests for browser context menu</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-Browser context menu tests.
-<p id="display"></p>
-
-<div id="content">
-</div>
-
-<pre id="test">
-<script> var perWindowPrivateBrowsing = false; </script>
-<script type="text/javascript" src="privateBrowsingMode.js"></script>
-<script class="testbody" type="text/javascript">
-
-/** Test for Login Manager: multiple login autocomplete. **/
-
-SpecialPowers.Cu.import("resource://gre/modules/InlineSpellChecker.jsm", window);
-SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm", window);
-
-const Ci = SpecialPowers.Ci;
-
-function openContextMenuFor(element, shiftkey, waitForSpellCheck) {
- // Context menu should be closed before we open it again.
- is(SpecialPowers.wrap(contextMenu).state, "closed", "checking if popup is closed");
-
- if (lastElement)
- lastElement.blur();
- element.focus();
-
- // Some elements need time to focus and spellcheck before any tests are
- // run on them.
- function actuallyOpenContextMenuFor() {
- lastElement = element;
- var eventDetails = { type : "contextmenu", button : 2, shiftKey : shiftkey };
- synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
- }
-
- if (waitForSpellCheck)
- onSpellCheck(element, actuallyOpenContextMenuFor);
- else
- actuallyOpenContextMenuFor();
-}
-
-function closeContextMenu() {
- contextMenu.hidePopup();
-}
-
-function executeCopyCommand(command, expectedValue)
-{
- // Just execute the command directly rather than simulating a context menu
- // press to avoid having to deal with its asynchronous nature
- SpecialPowers.wrap(subwindow).controllers.getControllerForCommand(command).doCommand(command);
-
- // The easiest way to check the clipboard is to paste the contents into a
- // textbox
- input.focus();
- input.value = "";
- SpecialPowers.wrap(input).controllers.getControllerForCommand("cmd_paste").doCommand("cmd_paste");
- is(input.value, expectedValue, "paste for command " + command);
-}
-
-function invokeItemAction(generatedItemId)
-{
- var item = contextMenu.getElementsByAttribute("generateditemid",
- generatedItemId)[0];
- ok(item, "Got generated XUL menu item");
- item.doCommand();
- ok(!pagemenu.hasAttribute("hopeless"), "attribute got removed");
-}
-
-function selectText(element) {
- // Clear any previous selections before selecting new element.
- subwindow.getSelection().removeAllRanges();
-
- var div = subwindow.document.createRange();
- div.setStartBefore(element);
- div.setEndAfter(element);
- subwindow.getSelection().addRange(div);
-}
-
-function selectInputText(element) {
- // Clear any previous selections before selecting new element.
- subwindow.getSelection().removeAllRanges();
-
- element.select();
-}
-
-function getVisibleMenuItems(aMenu, aData) {
- var items = [];
- var accessKeys = {};
- for (var i = 0; i < aMenu.childNodes.length; i++) {
- var item = aMenu.childNodes[i];
- if (item.hidden)
- continue;
-
- var key = item.accessKey;
- if (key)
- key = key.toLowerCase();
-
- var isGenerated = item.hasAttribute("generateditemid");
-
- if (item.nodeName == "menuitem") {
- var isSpellSuggestion = item.className == "spell-suggestion";
- if (isSpellSuggestion) {
- is(item.id, "", "child menuitem #" + i + " is a spelling suggestion");
- } else if (isGenerated) {
- is(item.id, "", "child menuitem #" + i + " is a generated item");
- } else {
- ok(item.id, "child menuitem #" + i + " has an ID");
- }
- var label = item.getAttribute("label");
- ok(label.length, "menuitem " + item.id + " has a label");
- if (isSpellSuggestion) {
- is(key, "", "Spell suggestions shouldn't have an access key");
- items.push("*" + label);
- } else if (isGenerated) {
- items.push("+" + label);
- } else if (item.id.indexOf("spell-check-dictionary-") != 0 &&
- item.id != "spell-no-suggestions" &&
- item.id != "spell-add-dictionaries-main") {
- ok(key, "menuitem " + item.id + " has an access key");
- if (accessKeys[key])
- ok(false, "menuitem " + item.id + " has same accesskey as " + accessKeys[key]);
- else
- accessKeys[key] = item.id;
- }
- if (!isSpellSuggestion && !isGenerated) {
- items.push(item.id);
- }
- if (isGenerated) {
- var p = {};
- p.type = item.getAttribute("type");
- p.icon = item.getAttribute("image");
- p.checked = item.hasAttribute("checked");
- p.disabled = item.hasAttribute("disabled");
- items.push(p);
- } else {
- items.push(!item.disabled);
- }
- } else if (item.nodeName == "menuseparator") {
- ok(true, "--- seperator id is " + item.id);
- items.push("---");
- items.push(null);
- } else if (item.nodeName == "menu") {
- if (isGenerated) {
- item.id = "generated-submenu-" + aData.generatedSubmenuId++;
- }
- ok(item.id, "child menu #" + i + " has an ID");
- if (!isGenerated) {
- ok(key, "menu has an access key");
- if (accessKeys[key])
- ok(false, "menu " + item.id + " has same accesskey as " + accessKeys[key]);
- else
- accessKeys[key] = item.id;
- }
- items.push(item.id);
- items.push(!item.disabled);
- // Add a dummy item to that the indexes in checkMenu are the same
- // for expectedItems and actualItems.
- items.push([]);
- items.push(null);
- } else {
- ok(false, "child #" + i + " of menu ID " + aMenu.id +
- " has an unknown type (" + item.nodeName + ")");
- }
- }
- return items;
-}
-
-function checkContextMenu(expectedItems) {
- is(contextMenu.state, "open", "checking if popup is open");
- var data = { generatedSubmenuId: 1 };
- checkMenu(contextMenu, expectedItems, data);
-}
-
-/*
- * checkMenu - checks to see if the specified <menupopup> contains the
- * expected items and state.
- * expectedItems is a array of (1) item IDs and (2) a boolean specifying if
- * the item is enabled or not (or null to ignore it). Submenus can be checked
- * by providing a nested array entry after the expected <menu> ID.
- * For example: ["blah", true, // item enabled
- * "submenu", null, // submenu
- * ["sub1", true, // submenu contents
- * "sub2", false], null, // submenu contents
- * "lol", false] // item disabled
- *
- */
-function checkMenu(menu, expectedItems, data) {
- var actualItems = getVisibleMenuItems(menu, data);
- //ok(false, "Items are: " + actualItems);
- for (var i = 0; i < expectedItems.length; i+=2) {
- var actualItem = actualItems[i];
- var actualEnabled = actualItems[i + 1];
- var expectedItem = expectedItems[i];
- var expectedEnabled = expectedItems[i + 1];
- if (expectedItem instanceof Array) {
- ok(true, "Checking submenu...");
- var menuID = expectedItems[i - 2]; // The last item was the menu ID.
- var submenu = menu.getElementsByAttribute("id", menuID)[0];
- ok(submenu, "got a submenu element of id='" + menuID + "'");
- if (submenu) {
- is(submenu.nodeName, "menu", "submenu element of id='" + menuID +
- "' has expected nodeName");
- checkMenu(submenu.menupopup, expectedItem, data);
- }
- } else {
- is(actualItem, expectedItem,
- "checking item #" + i/2 + " (" + expectedItem + ") name");
-
- if (typeof expectedEnabled == "object" && expectedEnabled != null ||
- typeof actualEnabled == "object" && actualEnabled != null) {
-
- ok(!(actualEnabled == null), "actualEnabled is not null");
- ok(!(expectedEnabled == null), "expectedEnabled is not null");
- is(typeof actualEnabled, typeof expectedEnabled, "checking types");
-
- if (typeof actualEnabled != typeof expectedEnabled ||
- actualEnabled == null || expectedEnabled == null)
- continue;
-
- is(actualEnabled.type, expectedEnabled.type,
- "checking item #" + i/2 + " (" + expectedItem + ") type attr value");
- var icon = actualEnabled.icon;
- if (icon) {
- var tmp = "";
- var j = icon.length - 1;
- while (j && icon[j] != "/") {
- tmp = icon[j--] + tmp;
- }
- icon = tmp;
- }
- is(icon, expectedEnabled.icon,
- "checking item #" + i/2 + " (" + expectedItem + ") icon attr value");
- is(actualEnabled.checked, expectedEnabled.checked,
- "checking item #" + i/2 + " (" + expectedItem + ") has checked attr");
- is(actualEnabled.disabled, expectedEnabled.disabled,
- "checking item #" + i/2 + " (" + expectedItem + ") has disabled attr");
- } else if (expectedEnabled != null)
- is(actualEnabled, expectedEnabled,
- "checking item #" + i/2 + " (" + expectedItem + ") enabled state");
- }
- }
- // Could find unexpected extra items at the end...
- is(actualItems.length, expectedItems.length, "checking expected number of menu entries");
-}
-
-/*
- * runTest
- *
- * Called by a popupshowing event handler. Each test checks for expected menu
- * contents, closes the popup, and finally triggers the popup on a new element
- * (thus kicking off another cycle).
- *
- */
-function runTest(testNum) {
- // Seems we need to enable this again, or sendKeyEvent() complaints.
- ok(true, "Starting test #" + testNum);
-
- var inspectItems = [];
- if (SpecialPowers.getBoolPref("devtools.inspector.enabled")) {
- inspectItems = ["---", null,
- "context-inspect", true];
- }
-
- switch (testNum) {
- case 1:
- // Invoke context menu for next test.
- openContextMenuFor(text);
- break;
-
- case 2:
- // Context menu for plain text
- plainTextItems = ["context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems);
- checkContextMenu(plainTextItems);
- closeContextMenu();
- openContextMenuFor(link); // Invoke context menu for next test.
- break;
-
- case 3:
- // Context menu for text link
- if (perWindowPrivateBrowsing) {
- checkContextMenu(["context-openlinkintab", true,
- "context-openlink", true,
- "context-openlinkprivate", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copylink", true
- ].concat(inspectItems));
- } else {
- checkContextMenu(["context-openlinkintab", true,
- "context-openlink", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copylink", true
- ].concat(inspectItems));
- }
- closeContextMenu();
- openContextMenuFor(mailto); // Invoke context menu for next test.
- break;
-
- case 4:
- // Context menu for text mailto-link
- checkContextMenu(["context-copyemail", true].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(input); // Invoke context menu for next test.
- break;
-
- case 5:
- // Context menu for text input field
- checkContextMenu(["context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", false,
- "---", null,
- "spell-check-enabled", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(img); // Invoke context menu for next test.
- break;
-
- case 6:
- // Context menu for an image
- checkContextMenu(["context-viewimage", true,
- "context-copyimage-contents", true,
- "context-copyimage", true,
- "---", null,
- "context-saveimage", true,
- "context-sendimage", true,
- "context-setDesktopBackground", true,
- "context-viewimageinfo", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(canvas); // Invoke context menu for next test.
- break;
-
- case 7:
- // Context menu for a canvas
- checkContextMenu(["context-viewimage", true,
- "context-saveimage", true,
- "context-bookmarkpage", true,
- "context-selectall", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(video_ok); // Invoke context menu for next test.
- break;
-
- case 8:
- // Context menu for a video (with a VALID media source)
- checkContextMenu(["context-media-play", true,
- "context-media-mute", true,
- "context-media-playbackrate", null,
- ["context-media-playbackrate-050x", true,
- "context-media-playbackrate-100x", true,
- "context-media-playbackrate-150x", true,
- "context-media-playbackrate-200x", true], null,
- "context-media-hidecontrols", true,
- "context-video-showstats", true,
- "context-video-fullscreen", true,
- "---", null,
- "context-viewvideo", true,
- "context-copyvideourl", true,
- "---", null,
- "context-savevideo", true,
- "context-video-saveimage", true,
- "context-sendvideo", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(audio_in_video); // Invoke context menu for next test.
- break;
-
- case 9:
- // Context menu for a video (with an audio-only file)
- checkContextMenu(["context-media-play", true,
- "context-media-mute", true,
- "context-media-playbackrate", null,
- ["context-media-playbackrate-050x", true,
- "context-media-playbackrate-100x", true,
- "context-media-playbackrate-150x", true,
- "context-media-playbackrate-200x", true], null,
- "context-media-showcontrols", true,
- "---", null,
- "context-copyaudiourl", true,
- "---", null,
- "context-saveaudio", true,
- "context-sendaudio", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(video_bad); // Invoke context menu for next test.
- break;
-
- case 10:
- // Context menu for a video (with an INVALID media source)
- checkContextMenu(["context-media-play", false,
- "context-media-mute", false,
- "context-media-playbackrate", null,
- ["context-media-playbackrate-050x", false,
- "context-media-playbackrate-100x", false,
- "context-media-playbackrate-150x", false,
- "context-media-playbackrate-200x", false], null,
- "context-media-hidecontrols", false,
- "context-video-showstats", false,
- "context-video-fullscreen", false,
- "---", null,
- "context-viewvideo", true,
- "context-copyvideourl", true,
- "---", null,
- "context-savevideo", true,
- "context-video-saveimage", false,
- "context-sendvideo", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(video_bad2); // Invoke context menu for next test.
- break;
-
- case 11:
- // Context menu for a video (with an INVALID media source)
- checkContextMenu(["context-media-play", false,
- "context-media-mute", false,
- "context-media-playbackrate", null,
- ["context-media-playbackrate-050x", false,
- "context-media-playbackrate-100x", false,
- "context-media-playbackrate-150x", false,
- "context-media-playbackrate-200x", false], null,
- "context-media-hidecontrols", false,
- "context-video-showstats", false,
- "context-video-fullscreen", false,
- "---", null,
- "context-viewvideo", false,
- "context-copyvideourl", false,
- "---", null,
- "context-savevideo", false,
- "context-video-saveimage", false,
- "context-sendvideo", false
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(iframe); // Invoke context menu for next test.
- break;
-
- case 12:
- // Context menu for an iframe
- checkContextMenu(["context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "frame", null,
- ["context-showonlythisframe", true,
- "context-openframeintab", true,
- "context-openframe", true,
- "---", null,
- "context-reloadframe", true,
- "---", null,
- "context-bookmarkframe", true,
- "context-saveframe", true,
- "---", null,
- "context-printframe", true,
- "---", null,
- "context-viewframesource", true,
- "context-viewframeinfo", true], null,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(video_in_iframe); // Invoke context menu for next test.
- break;
-
- case 13:
- // Context menu for a video in an iframe
- checkContextMenu(["context-media-play", true,
- "context-media-mute", true,
- "context-media-playbackrate", null,
- ["context-media-playbackrate-050x", true,
- "context-media-playbackrate-100x", true,
- "context-media-playbackrate-150x", true,
- "context-media-playbackrate-200x", true], null,
- "context-media-hidecontrols", true,
- "context-video-showstats", true,
- "context-video-fullscreen", true,
- "---", null,
- "context-viewvideo", true,
- "context-copyvideourl", true,
- "---", null,
- "context-savevideo", true,
- "context-video-saveimage", true,
- "context-sendvideo", true,
- "frame", null,
- ["context-showonlythisframe", true,
- "context-openframeintab", true,
- "context-openframe", true,
- "---", null,
- "context-reloadframe", true,
- "---", null,
- "context-bookmarkframe", true,
- "context-saveframe", true,
- "---", null,
- "context-printframe", true,
- "---", null,
- "context-viewframeinfo", true], null].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(image_in_iframe); // Invoke context menu for next test.
- break;
-
- case 14:
- // Context menu for an image in an iframe
- checkContextMenu(["context-viewimage", true,
- "context-copyimage-contents", true,
- "context-copyimage", true,
- "---", null,
- "context-saveimage", true,
- "context-sendimage", true,
- "context-setDesktopBackground", true,
- "context-viewimageinfo", true,
- "frame", null,
- ["context-showonlythisframe", true,
- "context-openframeintab", true,
- "context-openframe", true,
- "---", null,
- "context-reloadframe", true,
- "---", null,
- "context-bookmarkframe", true,
- "context-saveframe", true,
- "---", null,
- "context-printframe", true,
- "---", null,
- "context-viewframeinfo", true], null].concat(inspectItems));
- closeContextMenu();
- openContextMenuFor(textarea, false, true); // Invoke context menu for next test, but wait for the spellcheck.
- break;
-
- case 15:
- // Context menu for textarea
- checkContextMenu(["*chubbiness", true, // spelling suggestion
- "spell-add-to-dictionary", true,
- "---", null,
- "context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-check-enabled", true,
- "spell-dictionaries", true,
- ["spell-check-dictionary-en-US", true,
- "---", null,
- "spell-add-dictionaries", true], null
- ].concat(inspectItems));
- contextMenu.ownerDocument.getElementById("spell-add-to-dictionary").doCommand(); // Add to dictionary
- closeContextMenu();
- openContextMenuFor(text); // Invoke context menu for next test.
- break;
-
- case 16:
- // Re-check context menu for plain text to make sure it hasn't changed
- checkContextMenu(plainTextItems);
- closeContextMenu();
- openContextMenuFor(textarea, false, true); // Invoke context menu for next test.
- break;
-
- case 17:
- // Context menu for textarea after a word has been added
- // to the dictionary
- checkContextMenu(["spell-undo-add-to-dictionary", true,
- "---", null,
- "context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-check-enabled", true,
- "spell-dictionaries", true,
- ["spell-check-dictionary-en-US", true,
- "---", null,
- "spell-add-dictionaries", true], null
- ].concat(inspectItems));
- contextMenu.ownerDocument.getElementById("spell-undo-add-to-dictionary").doCommand(); // Undo add to dictionary
- closeContextMenu();
- openContextMenuFor(contenteditable, false, true);
- break;
-
- case 18:
- // Context menu for contenteditable
- checkContextMenu(["spell-no-suggestions", false,
- "spell-add-to-dictionary", true,
- "---", null,
- "context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-check-enabled", true,
- "spell-dictionaries", true,
- ["spell-check-dictionary-en-US", true,
- "---", null,
- "spell-add-dictionaries", true], null
- ].concat(inspectItems));
-
- closeContextMenu();
- openContextMenuFor(inputspell, false, true); // Invoke context menu for next test.
- break;
-
- case 19:
- // Context menu for spell-check input
- checkContextMenu(["*prodigality", true, // spelling suggestion
- "spell-add-to-dictionary", true,
- "---", null,
- "context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-check-enabled", true,
- "spell-dictionaries", true,
- ["spell-check-dictionary-en-US", true,
- "---", null,
- "spell-add-dictionaries", true], null
- ].concat(inspectItems));
-
- closeContextMenu();
- openContextMenuFor(inputspellfalse, false, true); // Invoke context menu for next test.
- break;
-
- case 20:
- // Context menu for text input field with spellcheck=false
- checkContextMenu(["context-undo", false,
- "---", null,
- "context-cut", false,
- "context-copy", false,
- "context-paste", null, // ignore clipboard state
- "context-delete", false,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-add-dictionaries-main", true,
- ].concat(inspectItems));
-
- closeContextMenu();
- openContextMenuFor(link); // Invoke context menu for next test.
- break;
-
- case 21:
- executeCopyCommand("cmd_copyLink", "http://mozilla.com/");
- closeContextMenu();
- openContextMenuFor(pagemenu); // Invoke context menu for next test.
- break;
-
- case 22:
- // Context menu for element with assigned content context menu
- checkContextMenu(["+Plain item", {type: "", icon: "", checked: false, disabled: false},
- "+Disabled item", {type: "", icon: "", checked: false, disabled: true},
- "+Item w/ textContent", {type: "", icon: "", checked: false, disabled: false},
- "---", null,
- "+Checkbox", {type: "checkbox", icon: "", checked: true, disabled: false},
- "---", null,
- "+Radio1", {type: "checkbox", icon: "", checked: true, disabled: false},
- "+Radio2", {type: "checkbox", icon: "", checked: false, disabled: false},
- "+Radio3", {type: "checkbox", icon: "", checked: false, disabled: false},
- "---", null,
- "+Item w/ icon", {type: "", icon: "favicon.ico", checked: false, disabled: false},
- "+Item w/ bad icon", {type: "", icon: "", checked: false, disabled: false},
- "---", null,
- "generated-submenu-1", true,
- ["+Radio1", {type: "checkbox", icon: "", checked: false, disabled: false},
- "+Radio2", {type: "checkbox", icon: "", checked: true, disabled: false},
- "+Radio3", {type: "checkbox", icon: "", checked: false, disabled: false},
- "---", null,
- "+Checkbox", {type: "checkbox", icon: "", checked: false, disabled: false}], null,
- "---", null,
- "context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems));
-
- invokeItemAction("0");
- closeContextMenu();
-
- // run mozRequestFullScreen on the element we're testing
- var full_screen_element = subwindow.document.getElementById("test-dom-full-screen");
- var openDomFullScreen = function() {
- subwindow.removeEventListener("mozfullscreenchange", openDomFullScreen, false);
- openContextMenuFor(dom_full_screen, true); // Invoke context menu for next test.
- }
- subwindow.addEventListener("mozfullscreenchange", openDomFullScreen, false);
- SpecialPowers.setBoolPref("full-screen-api.approval-required", false);
- SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
- full_screen_element.mozRequestFullScreen();
- break;
-
- case 23:
- // Context menu for DOM Fullscreen mode (NOTE: this is *NOT* on an img)
- checkContextMenu(["context-leave-dom-fullscreen", true,
- "---", null,
- "context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems));
- closeContextMenu();
- var full_screen_element = subwindow.document.getElementById("test-dom-full-screen");
- var openPagemenu = function() {
- subwindow.removeEventListener("mozfullscreenchange", openPagemenu, false);
- SpecialPowers.clearUserPref("full-screen-api.approval-required");
- SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
- openContextMenuFor(pagemenu, true); // Invoke context menu for next test.
- }
- subwindow.addEventListener("mozfullscreenchange", openPagemenu, false);
- subwindow.document.mozCancelFullScreen();
- break;
-
- case 24:
- // Context menu for element with assigned content context menu
- // The shift key should bypass content context menu processing
- checkContextMenu(["context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems));
- closeContextMenu();
- selectText(selecttext); // Select text prior to opening context menu.
- openContextMenuFor(selecttext); // Invoke context menu for next test.
- return;
-
- case 25:
- // Context menu for selected text
- if (SpecialPowers.Services.appinfo.OS == "Darwin") {
- // This test is only enabled on Mac due to bug 736399.
- checkContextMenu(["context-copy", true,
- "context-selectall", true,
- "---", null,
- "context-searchselect", true,
- "context-viewpartialsource-selection", true
- ].concat(inspectItems));
- }
- closeContextMenu();
- selectText(selecttextlink); // Select text prior to opening context menu.
- openContextMenuFor(selecttextlink); // Invoke context menu for next test.
- return;
-
- case 26:
- // Context menu for selected text which matches valid URL pattern
- if (SpecialPowers.Services.appinfo.OS == "Darwin") {
- // This test is only enabled on Mac due to bug 736399.
- if (perWindowPrivateBrowsing) {
- checkContextMenu(["context-openlinkincurrent", true,
- "context-openlinkintab", true,
- "context-openlink", true,
- "context-openlinkprivate", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copy", true,
- "context-selectall", true,
- "---", null,
- "context-searchselect", true,
- "context-viewpartialsource-selection", true
- ].concat(inspectItems));
- } else {
- checkContextMenu(["context-openlinkincurrent", true,
- "context-openlinkintab", true,
- "context-openlink", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copy", true,
- "context-selectall", true,
- "---", null,
- "context-searchselect", true,
- "context-viewpartialsource-selection", true
- ].concat(inspectItems));
- }
- }
- closeContextMenu();
- // clear the selection because following tests don't expect any selection
- subwindow.getSelection().removeAllRanges();
-
- openContextMenuFor(imagelink)
- break;
-
- case 27:
- // Context menu for image link
- if (perWindowPrivateBrowsing) {
- checkContextMenu(["context-openlinkintab", true,
- "context-openlink", true,
- "context-openlinkprivate", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copylink", true,
- "---", null,
- "context-viewimage", true,
- "context-copyimage-contents", true,
- "context-copyimage", true,
- "---", null,
- "context-saveimage", true,
- "context-sendimage", true,
- "context-setDesktopBackground", true,
- "context-viewimageinfo", true
- ].concat(inspectItems));
- } else {
- checkContextMenu(["context-openlinkintab", true,
- "context-openlink", true,
- "---", null,
- "context-bookmarklink", true,
- "context-savelink", true,
- "context-copylink", true,
- "---", null,
- "context-viewimage", true,
- "context-copyimage-contents", true,
- "context-copyimage", true,
- "---", null,
- "context-saveimage", true,
- "context-sendimage", true,
- "context-setDesktopBackground", true,
- "context-viewimageinfo", true
- ].concat(inspectItems));
- }
- closeContextMenu();
- selectInputText(select_inputtext); // Select text prior to opening context menu.
- openContextMenuFor(select_inputtext); // Invoke context menu for next test.
- return;
-
- case 28:
- // Context menu for selected text in input
- checkContextMenu(["context-undo", false,
- "---", null,
- "context-cut", true,
- "context-copy", true,
- "context-paste", null, // ignore clipboard state
- "context-delete", true,
- "---", null,
- "context-selectall", true,
- "context-searchselect",true,
- "---", null,
- "spell-check-enabled", true
- ].concat(inspectItems));
- closeContextMenu();
- selectInputText(select_inputtext_password); // Select text prior to opening context menu.
- openContextMenuFor(select_inputtext_password); // Invoke context menu for next test.
- return;
-
- case 29:
- // Context menu for selected text in input[type="password"]
- checkContextMenu(["context-undo", false,
- "---", null,
- "context-cut", true,
- "context-copy", true,
- "context-paste", null, // ignore clipboard state
- "context-delete", true,
- "---", null,
- "context-selectall", true,
- "---", null,
- "spell-check-enabled", true,
- //spell checker is shown on input[type="password"] on this testcase
- "spell-dictionaries", true,
- ["spell-check-dictionary-en-US", true,
- "---", null,
- "spell-add-dictionaries", true], null
- ].concat(inspectItems));
- closeContextMenu();
- subwindow.getSelection().removeAllRanges();
- openContextMenuFor(plugin);
- return;
-
- case 30:
- // Context menu for click-to-play blocked plugin
- checkContextMenu(["context-ctp-play", true,
- "context-ctp-hide", true,
- "---", null,
- "context-back", false,
- "context-forward", false,
- "context-reload", true,
- "---", null,
- "context-bookmarkpage", true,
- "context-savepage", true,
- "---", null,
- "context-viewbgimage", false,
- "context-selectall", true,
- "---", null,
- "context-viewsource", true,
- "context-viewinfo", true
- ].concat(inspectItems));
- closeContextMenu();
- SpecialPowers.clearUserPref("plugins.click_to_play");
- var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
- .getService(SpecialPowers.Ci.nsIPluginHost);
- var tags = ph.getPluginTags();
- for (var tag of tags) {
- if (tag.name == "Test Plug-in") {
- tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;
- }
- }
-
- // finish test
- subwindow.close();
- SimpleTest.finish();
- return;
-
- /*
- * Other things that would be nice to test:
- * - spelling / misspelled word (in text input?)
- * - check state of disabled items
- * - test execution of menu items (maybe as a separate test?)
- */
-
- default:
- ok(false, "Unexpected invocation of test #" + testNum);
- subwindow.close();
- SimpleTest.finish();
- return;
- }
-
-}
-
-
-var testNum = 1;
-var subwindow, chromeWin, contextMenu, lastElement;
-var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
- iframe, video_in_iframe, image_in_iframe, textarea, contenteditable,
- inputspell, pagemenu, dom_full_screen, plainTextItems, audio_in_video,
- selecttext, selecttextlink, imagelink, select_inputtext, select_inputtext_password,
- plugin, inputspellfalse;
-
-function startTest() {
- chromeWin = SpecialPowers.wrap(subwindow)
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsIDocShellTreeItem)
- .rootTreeItem
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow)
- .QueryInterface(Ci.nsIDOMChromeWindow);
- contextMenu = chromeWin.document.getElementById("contentAreaContextMenu");
- ok(contextMenu, "Got context menu XUL");
-
- if (chromeWin.document.getElementById("Browser:Stop").getAttribute("disabled") != "true") {
- todo(false, "Wait for subwindow to load... (This should usually happen once.)");
- SimpleTest.executeSoon(startTest);
- return;
- }
-
- subwindow.allowFullscreen = true;
- lastElement = null;
-
- text = subwindow.document.getElementById("test-text");
- link = subwindow.document.getElementById("test-link");
- imagelink = subwindow.document.getElementById("test-image-link");
- mailto = subwindow.document.getElementById("test-mailto");
- input = subwindow.document.getElementById("test-input");
- img = subwindow.document.getElementById("test-image");
- canvas = subwindow.document.getElementById("test-canvas");
- video_ok = subwindow.document.getElementById("test-video-ok");
- audio_in_video = subwindow.document.getElementById("test-audio-in-video");
- video_bad = subwindow.document.getElementById("test-video-bad");
- video_bad2 = subwindow.document.getElementById("test-video-bad2");
- iframe = subwindow.document.getElementById("test-iframe");
- video_in_iframe = subwindow.document.getElementById("test-video-in-iframe").contentDocument.getElementsByTagName("video")[0];
- video_in_iframe.pause();
- image_in_iframe = subwindow.document.getElementById("test-image-in-iframe").contentDocument.getElementsByTagName("img")[0];
- textarea = subwindow.document.getElementById("test-textarea");
- contenteditable = subwindow.document.getElementById("test-contenteditable");
- contenteditable.focus(); // content editable needs to be focused to enable spellcheck
- inputspell = subwindow.document.getElementById("test-input-spellcheck");
- inputspellfalse = subwindow.document.getElementById("test-contenteditable-spellcheck-false");
- pagemenu = subwindow.document.getElementById("test-pagemenu");
- dom_full_screen = subwindow.document.getElementById("test-dom-full-screen");
- selecttext = subwindow.document.getElementById("test-select-text");
- selecttextlink = subwindow.document.getElementById("test-select-text-link");
- select_inputtext = subwindow.document.getElementById("test-select-input-text");
- select_inputtext_password = subwindow.document.getElementById("test-select-input-text-type-password");
- plugin = subwindow.document.getElementById("test-plugin");
-
- contextMenu.addEventListener("popupshown", function() { runTest(++testNum); }, false);
- runTest(1);
-}
-
-// We open this in a separate window, because the Mochitests run inside a frame.
-// The frame causes an extra menu item, and prevents running the test
-// standalone (ie, clicking the test name in the Mochitest window) to see
-// success/failure messages.
-var painted = false, loaded = false;
-
-function waitForEvents(event)
-{
- if (event.type == "MozAfterPaint")
- painted = true;
- else if (event.type == "load")
- loaded = true;
- if (painted && loaded) {
- subwindow.removeEventListener("MozAfterPaint", waitForEvents, false);
- subwindow.onload = null;
- startTest();
- }
-}
-
-const isOSXMtnLion = navigator.userAgent.indexOf("Mac OS X 10.8") != -1;
-
-if (isOSXMtnLion) {
- todo(false, "Mountain Lion doesn't like this test (bug 792304)");
-} else {
- SpecialPowers.setBoolPref("plugins.click_to_play", true);
- var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
- .getService(SpecialPowers.Ci.nsIPluginHost);
- var tags = ph.getPluginTags();
- for (var tag of tags) {
- if (tag.name == "Test Plug-in") {
- tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY;
- }
- }
-
- var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=800");
- subwindow.addEventListener("MozAfterPaint", waitForEvents, false);
- subwindow.onload = waitForEvents;
-
- SimpleTest.waitForExplicitFinish();
-}
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/base/content/test/test_feed_discovery.html b/browser/base/content/test/test_feed_discovery.html
deleted file mode 100644
index 31d716385..000000000
--- a/browser/base/content/test/test_feed_discovery.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=377611
--->
-<head>
- <title>Test for feed discovery</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=377611">Mozilla Bug 377611</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 377611 **/
-
-var rv = { tests: null };
-var testCheckInterval = null;
-
-function startTest() {
- var url = window.location.href.replace(/test_feed_discovery\.html/,
- 'feed_discovery.html');
- SpecialPowers.openDialog(window, [url, '', 'dialog=no,width=10,height=10', rv]);
- testCheckInterval = window.setInterval(tryIfTestIsFinished, 500);
-}
-
-function tryIfTestIsFinished() {
- if (rv.tests) {
- window.clearInterval(testCheckInterval);
- checkTest();
- }
-}
-
-function checkTest() {
- for (var i = 0; i < rv.tests.length; ++ i) {
- var test = rv.tests[i];
- ok(test.check, test.message);
- }
- SimpleTest.finish();
-}
-
-window.onload = startTest;
-
-SimpleTest.waitForExplicitFinish();
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/browser/base/content/test/test_offlineNotification.html b/browser/base/content/test/test_offlineNotification.html
deleted file mode 100644
index 8c603f150..000000000
--- a/browser/base/content/test/test_offlineNotification.html
+++ /dev/null
@@ -1,126 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=462856
--->
-<head>
- <title>Test offline app notification</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body onload="loaded()">
-<p id="display">
-<!-- Load the test frame twice from the same domain,
- to make sure we get notifications for both -->
-<iframe name="testFrame" src="offlineChild.html"></iframe>
-<iframe name="testFrame2" src="offlineChild2.html"></iframe>
-<!-- Load from another domain to make sure we get a second allow/deny
- notification -->
-<iframe name="testFrame3" src="http://example.com/tests/browser/base/content/test/offlineChild.html"></iframe>
-
-<iframe id="eventsTestFrame" src="offlineEvent.html"></iframe>
-
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-SimpleTest.waitForExplicitFinish();
-const Cc = SpecialPowers.Cc;
-
-var numFinished = 0;
-
-window.addEventListener("message", function(event) {
- is(event.data, "success", "Child was successfully cached.");
-
- if (++numFinished == 3) {
- // Clean up after ourself
- var pm = Cc["@mozilla.org/permissionmanager;1"].
- getService(SpecialPowers.Ci.nsIPermissionManager);
- var ioService = Cc["@mozilla.org/network/io-service;1"]
- .getService(SpecialPowers.Ci.nsIIOService);
- var uri1 = ioService.newURI(frames.testFrame.location, null, null);
- var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
-
- var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
- .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
- .getNoAppCodebasePrincipal(uri1);
- var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
- .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
- .getNoAppCodebasePrincipal(uri2);
-
- pm.removeFromPrincipal(principal1, "offline-app");
- pm.removeFromPrincipal(principal2, "offline-app");
-
- SimpleTest.finish();
- }
- }, false);
-
-var count = 0;
-var expectedEvent = "";
-function eventHandler(evt) {
- ++count;
- is(evt.type, expectedEvent, "Wrong event!");
-}
-
-function testEventHandling() {
- var events = [ "checking",
- "error",
- "noupdate",
- "downloading",
- "progress",
- "updateready",
- "cached",
- "obsolete"];
- var w = document.getElementById("eventsTestFrame").contentWindow;
- var e;
- for (var i = 0; i < events.length; ++i) {
- count = 0;
- expectedEvent = events[i];
- e = w.document.createEvent("event");
- e.initEvent(expectedEvent, true, true);
- w.applicationCache["on" + expectedEvent] = eventHandler;
- w.applicationCache.addEventListener(expectedEvent, eventHandler, true);
- w.applicationCache.dispatchEvent(e);
- is(count, 2, "Wrong number events!");
- w.applicationCache["on" + expectedEvent] = null;
- w.applicationCache.removeEventListener(expectedEvent, eventHandler, true);
- w.applicationCache.dispatchEvent(e);
- is(count, 2, "Wrong number events!");
- }
-
- // Test some random event.
- count = 0;
- expectedEvent = "foo";
- e = w.document.createEvent("event");
- e.initEvent(expectedEvent, true, true);
- w.applicationCache.addEventListener(expectedEvent, eventHandler, true);
- w.applicationCache.dispatchEvent(e);
- is(count, 1, "Wrong number events!");
- w.applicationCache.removeEventListener(expectedEvent, eventHandler, true);
- w.applicationCache.dispatchEvent(e);
- is(count, 1, "Wrong number events!");
-}
-
-function loaded() {
- testEventHandling();
-
- // Click the notification panel's "Allow" button. This should kick
- // off updates, which will eventually lead to getting messages from
- // the children.
- var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(SpecialPowers.Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
- var panel = win.PopupNotifications.panel;
- is(panel.childElementCount, 2, "2 notifications being displayed");
- panel.firstElementChild.button.click();
-
- // should have dismissed one of the notifications.
- is(panel.childElementCount, 1, "1 notification now being displayed");
- panel.firstElementChild.button.click();
-}
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/base/content/test/test_offline_gzip.html b/browser/base/content/test/test_offline_gzip.html
deleted file mode 100644
index 09713da92..000000000
--- a/browser/base/content/test/test_offline_gzip.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=501422
-
-When content which was transported over the network with
-Content-Type: gzip is added to the offline
-cache, it can be fetched from the cache successfully.
--->
-<head>
- <title>Test gzipped offline resources</title>
- <script type="text/javascript"
- src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript"
- src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body onload="loaded()">
-<p id="display">
-<iframe name="testFrame" src="gZipOfflineChild.html"></iframe>
-
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-var cacheCount = 0;
-var intervalID = 0;
-
-window.addEventListener("message", handleMessageEvents, false);
-SimpleTest.waitForExplicitFinish();
-
-function finishTest() {
- // Clean up after ourselves.
- var Cc = SpecialPowers.Cc;
- var pm = Cc["@mozilla.org/permissionmanager;1"].
- getService(SpecialPowers.Ci.nsIPermissionManager);
-
- var uri = Cc["@mozilla.org/network/io-service;1"].getService(SpecialPowers.Ci.nsIIOService)
- .newURI(window.frames[0].location, null, null);
- var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
- .getService(SpecialPowers.Ci.nsIScriptSecurityManager)
- .getNoAppCodebasePrincipal(uri);
-
- pm.removeFromPrincipal(principal, "offline-app");
-
- window.removeEventListener("message", handleMessageEvents, false);
-
- SimpleTest.finish();
-}
-
-////
-// Handle "message" events which are posted from the iframe upon
-// offline cache events.
-//
-function handleMessageEvents(event) {
- cacheCount++;
- switch (cacheCount) {
- case 1:
- // This is the initial caching off offline data.
- is(event.data, "oncache", "Child was successfully cached.");
- // Reload the frame; this will generate an error message
- // in the case of bug 501422.
- frames.testFrame.window.location.reload();
- // Use setInterval to repeatedly call a function which
- // checks that one of two things has occurred: either
- // the offline cache is udpated (which means our iframe
- // successfully reloaded), or the string "error" appears
- // in the iframe, as in the case of bug 501422.
- intervalID = setInterval(function() {
- // Sometimes document.body may not exist, and trying to access
- // it will throw an exception, so handle this case.
- try {
- var bodyInnerHTML = frames.testFrame.document.body.innerHTML;
- }
- catch (e) {
- var bodyInnerHTML = "";
- }
- if (cacheCount == 2 || bodyInnerHTML.contains("error")) {
- clearInterval(intervalID);
- is(cacheCount, 2, "frame not reloaded successfully");
- if (cacheCount != 2) {
- finishTest();
- }
- }
- }, 100);
- break;
- case 2:
- is(event.data, "onupdate", "Child was successfully updated.");
- finishTest();
- break;
- default:
- // how'd we get here?
- ok(false, "cacheCount not 1 or 2");
- }
-}
-
-function loaded() {
- // Click the notification panel's "Allow" button. This should kick
- // off updates, which will eventually lead to getting messages from
- // the iframe.
- var wm = SpecialPowers.Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(SpecialPowers.Ci.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
- var panel = win.PopupNotifications.panel;
- panel.firstElementChild.button.click();
-}
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/base/content/test/test_wyciwyg_copying.html b/browser/base/content/test/test_wyciwyg_copying.html
deleted file mode 100644
index 3a8c3a150..000000000
--- a/browser/base/content/test/test_wyciwyg_copying.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<body>
-<script>
- function go() {
- var w = window.open();
- w.document.open();
- w.document.write("<html><body>test document</body></html>");
- w.document.close();
- }
-</script>
-<button id="btn" onclick="go();">test</button>
-</body>
-</html>
diff --git a/browser/base/content/test/title_test.svg b/browser/base/content/test/title_test.svg
deleted file mode 100644
index 6ab5b2f5c..000000000
--- a/browser/base/content/test/title_test.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-<svg width="640px" height="480px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
- <title>This is a root SVG element's title</title>
- <foreignObject>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <body>
- <svg xmlns="http://www.w3.org/2000/svg" id="svg1">
- <title>This is a non-root SVG element title</title>
- </svg>
- </body>
- </html>
- </foreignObject>
- <text id="text1" x="10px" y="32px" font-size="24px">
- This contains only &lt;title&gt;
- <title>
-
-
- This is a title
-
- </title>
- </text>
- <text id="text2" x="10px" y="96px" font-size="24px">
- This contains only &lt;desc&gt;
- <desc>This is a desc</desc>
- </text>
- <text id="text3" x="10px" y="128px" font-size="24px">
- This contains nothing.
- </text>
- <a id="link1" xlink:href="#">
- This link contains &lt;title&gt;
- <title>
- This is a title
- </title>
- <text id="text4" x="10px" y="192px" font-size="24px">
- </text>
- </a>
- <a id="link2" xlink:href="#">
- <text x="10px" y="192px" font-size="24px">
- This text contains &lt;title&gt;
- <title>
- This is a title
- </title>
- </text>
- </a>
- <a id="link3" xlink:href="#" xlink:title="This is an xlink:title attribute">
- <text x="10px" y="224px" font-size="24px">
- This link contains &lt;title&gt; &amp; xlink:title attr.
- <title>This is a title</title>
- </text>
- </a>
- <a id="link4" xlink:href="#" xlink:title="This is an xlink:title attribute">
- <text x="10px" y="256px" font-size="24px">
- This link contains xlink:title attr.
- </text>
- </a>
- <text id="text5" x="10px" y="160px" font-size="24px"
- xlink:title="This is an xlink:title attribute but it isn't on a link" >
- This contains nothing.
- </text>
-</svg>
diff --git a/browser/base/content/test/video.ogg b/browser/base/content/test/video.ogg
deleted file mode 100644
index ac7ece351..000000000
--- a/browser/base/content/test/video.ogg
+++ /dev/null
Binary files differ
diff --git a/browser/base/content/test/zoom_test.html b/browser/base/content/test/zoom_test.html
deleted file mode 100644
index bf80490ca..000000000
--- a/browser/base/content/test/zoom_test.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=416661
--->
- <head>
- <title>Test for zoom setting</title>
-
- </head>
- <body>
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=416661">Bug 416661</a>
- <p>Site specific zoom settings should not apply to image documents.</p>
- </body>
-</html>
diff --git a/browser/base/moz.build b/browser/base/moz.build
index d13541370..8deb0b138 100644
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['content/test']
+
diff --git a/browser/components/certerror/moz.build b/browser/components/certerror/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/components/certerror/moz.build
+++ b/browser/components/certerror/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/components/certerror/test/Makefile.in b/browser/components/certerror/test/Makefile.in
deleted file mode 100644
index 6037dae12..000000000
--- a/browser/components/certerror/test/Makefile.in
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_bug431826.js \
- browser_bug633691.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/certerror/test/browser_bug431826.js b/browser/components/certerror/test/browser_bug431826.js
deleted file mode 100644
index 5d07b5905..000000000
--- a/browser/components/certerror/test/browser_bug431826.js
+++ /dev/null
@@ -1,41 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- // Navigate to a site with a broken cert
- window.addEventListener("DOMContentLoaded", testBrokenCert, true);
- content.location = "https://nocert.example.com/";
-}
-
-function testBrokenCert() {
- window.removeEventListener("DOMContentLoaded", testBrokenCert, true);
-
- // Confirm that we are displaying the contributed error page, not the default
- ok(gBrowser.contentDocument.documentURI.startsWith("about:certerror"), "Broken page should go to about:certerror, not about:neterror");
-
- // Confirm that the expert section is collapsed
- var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
- ok(expertDiv, "Expert content div should exist");
- ok(expertDiv.hasAttribute("collapsed"), "Expert content should be collapsed by default");
-
- // Tweak the expert mode pref
- gPrefService.setBoolPref("browser.xul.error_pages.expert_bad_cert", true);
-
- window.addEventListener("DOMContentLoaded", testExpertPref, true);
- gBrowser.reload();
-}
-
-function testExpertPref() {
- window.removeEventListener("DOMContentLoaded", testExpertPref, true);
- var expertDiv = gBrowser.contentDocument.getElementById("expertContent");
- var technicalDiv = gBrowser.contentDocument.getElementById("technicalContent");
- ok(!expertDiv.hasAttribute("collapsed"), "Expert content should not be collapsed with the expert mode pref set");
- ok(!technicalDiv.hasAttribute("collapsed"), "Technical content should not be collapsed with the expert mode pref set");
-
- // Clean up
- gBrowser.removeCurrentTab();
- if (gPrefService.prefHasUserValue("browser.xul.error_pages.expert_bad_cert"))
- gPrefService.clearUserPref("browser.xul.error_pages.expert_bad_cert");
- finish();
-}
diff --git a/browser/components/certerror/test/browser_bug633691.js b/browser/components/certerror/test/browser_bug633691.js
deleted file mode 100644
index 17ce7fcdc..000000000
--- a/browser/components/certerror/test/browser_bug633691.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- // Open a html page with about:certerror in an iframe
- window.content.addEventListener("load", testIframeCert, true);
- content.location = "data:text/html,<iframe width='700' height='700' src='about:certerror'></iframe>";
-}
-
-function testIframeCert() {
- window.content.removeEventListener("load", testIframeCert, true);
- // Confirm that the expert section is hidden
- var doc = gBrowser.contentDocument.getElementsByTagName('iframe')[0].contentDocument;
- var eC = doc.getElementById("expertContent");
- ok(eC, "Expert content should exist")
- ok(eC.hasAttribute("hidden"), "Expert content should be hidded by default");
-
- // Clean up
- gBrowser.removeCurrentTab();
-
- finish();
-}
diff --git a/browser/components/certerror/test/moz.build b/browser/components/certerror/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/certerror/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/dirprovider/moz.build b/browser/components/dirprovider/moz.build
index 82c902f96..2976a921f 100644
--- a/browser/components/dirprovider/moz.build
+++ b/browser/components/dirprovider/moz.build
@@ -4,8 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['tests']
-
MODULE = 'browserdir'
EXPORTS.mozilla.browser += [
diff --git a/browser/components/dirprovider/tests/moz.build b/browser/components/dirprovider/tests/moz.build
deleted file mode 100644
index 3e825b7cd..000000000
--- a/browser/components/dirprovider/tests/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'test_browserdir'
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/dirprovider/tests/unit/head_dirprovider.js b/browser/components/dirprovider/tests/unit/head_dirprovider.js
deleted file mode 100644
index 7c3904707..000000000
--- a/browser/components/dirprovider/tests/unit/head_dirprovider.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-var gProfD = do_get_profile();
-var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties);
-var gPrefSvc = Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch);
-
-function writeTestFile(aParent, aName) {
- let file = aParent.clone();
- file.append(aName);
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
- return file;
-}
-
diff --git a/browser/components/dirprovider/tests/unit/test_bookmark_pref.js b/browser/components/dirprovider/tests/unit/test_bookmark_pref.js
deleted file mode 100644
index 1bacc15af..000000000
--- a/browser/components/dirprovider/tests/unit/test_bookmark_pref.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// We need to run this test separately since DirectoryProvider persists BMarks
-
-function run_test() {
- let dir = gProfD.clone();
- let tfile = writeTestFile(dir, "bookmarkfile.test");
- gPrefSvc.setCharPref("browser.bookmarks.file", tfile.path);
-
- let bmarks = gDirSvc.get("BMarks", Ci.nsIFile);
- do_check_true(tfile.equals(bmarks));
-}
diff --git a/browser/components/dirprovider/tests/unit/test_keys.js b/browser/components/dirprovider/tests/unit/test_keys.js
deleted file mode 100644
index 8f0773b27..000000000
--- a/browser/components/dirprovider/tests/unit/test_keys.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test_bookmarkhtml() {
- let bmarks = gProfD.clone();
- bmarks.append("bookmarks.html");
-
- let tbmarks = gDirSvc.get("BMarks", Ci.nsIFile);
- do_check_true(bmarks.equals(tbmarks));
-}
-
-function run_test() {
- [test_bookmarkhtml
- ].forEach(function(f) {
- do_test_pending();
- print("Running test: " + f.name);
- f();
- do_test_finished();
- });
-}
diff --git a/browser/components/dirprovider/tests/unit/xpcshell.ini b/browser/components/dirprovider/tests/unit/xpcshell.ini
deleted file mode 100644
index 27afed650..000000000
--- a/browser/components/dirprovider/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-head = head_dirprovider.js
-tail =
-firefox-appdir = browser
-
-[test_bookmark_pref.js]
-[test_keys.js]
diff --git a/browser/components/downloads/moz.build b/browser/components/downloads/moz.build
index 6f65f014f..009942516 100644
--- a/browser/components/downloads/moz.build
+++ b/browser/components/downloads/moz.build
@@ -5,4 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['src']
-TEST_DIRS += ['test']
+
diff --git a/browser/components/downloads/test/browser/Makefile.in b/browser/components/downloads/test/browser/Makefile.in
deleted file mode 100644
index 1fc7a4522..000000000
--- a/browser/components/downloads/test/browser/Makefile.in
+++ /dev/null
@@ -1,19 +0,0 @@
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_basic_functionality.js \
- browser_first_download_panel.js \
- head.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/downloads/test/browser/browser_basic_functionality.js b/browser/components/downloads/test/browser/browser_basic_functionality.js
deleted file mode 100644
index f235b6f8a..000000000
--- a/browser/components/downloads/test/browser/browser_basic_functionality.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure the downloads panel can display items in the right order and
- * contains the expected data.
- */
-function gen_test()
-{
- // Display one of each download state.
- const DownloadData = [
- { endTime: 1180493839859239, state: nsIDM.DOWNLOAD_NOTSTARTED },
- { endTime: 1180493839859238, state: nsIDM.DOWNLOAD_DOWNLOADING },
- { endTime: 1180493839859237, state: nsIDM.DOWNLOAD_PAUSED },
- { endTime: 1180493839859236, state: nsIDM.DOWNLOAD_SCANNING },
- { endTime: 1180493839859235, state: nsIDM.DOWNLOAD_QUEUED },
- { endTime: 1180493839859234, state: nsIDM.DOWNLOAD_FINISHED },
- { endTime: 1180493839859233, state: nsIDM.DOWNLOAD_FAILED },
- { endTime: 1180493839859232, state: nsIDM.DOWNLOAD_CANCELED },
- { endTime: 1180493839859231, state: nsIDM.DOWNLOAD_BLOCKED_PARENTAL },
- { endTime: 1180493839859230, state: nsIDM.DOWNLOAD_DIRTY },
- { endTime: 1180493839859229, state: nsIDM.DOWNLOAD_BLOCKED_POLICY },
- ];
-
- // For testing purposes, show all the download items at once.
- var originalCountLimit = DownloadsView.kItemCountLimit;
- DownloadsView.kItemCountLimit = DownloadData.length;
- registerCleanupFunction(function () {
- DownloadsView.kItemCountLimit = originalCountLimit;
- });
-
- try {
- // Ensure that state is reset in case previous tests didn't finish.
- for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
-
- // Populate the downloads database with the data required by this test.
- for (let yy in gen_addDownloadRows(DownloadData)) yield;
-
- // Open the user interface and wait for data to be fully loaded.
- for (let yy in gen_openPanel(DownloadsCommon.getData(window))) yield;
-
- // Test item data and count. This also tests the ordering of the display.
- let richlistbox = document.getElementById("downloadsListBox");
-/* disabled for failing intermittently (bug 767828)
- is(richlistbox.children.length, DownloadData.length,
- "There is the correct number of richlistitems");
-*/
- for (let i = 0; i < richlistbox.children.length; i++) {
- let element = richlistbox.children[i];
- let dataItem = new DownloadsViewItemController(element).dataItem;
- is(dataItem.target, DownloadData[i].name, "Download names match up");
- is(dataItem.state, DownloadData[i].state, "Download states match up");
- is(dataItem.file, DownloadData[i].target, "Download targets match up");
- is(dataItem.uri, DownloadData[i].source, "Download sources match up");
- }
- } finally {
- // Clean up when the test finishes.
- for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
- }
-}
diff --git a/browser/components/downloads/test/browser/browser_first_download_panel.js b/browser/components/downloads/test/browser/browser_first_download_panel.js
deleted file mode 100644
index dc8f0ff43..000000000
--- a/browser/components/downloads/test/browser/browser_first_download_panel.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure the downloads panel only opens automatically on the first
- * download it notices. All subsequent downloads, even across sessions, should
- * not open the panel automatically.
- */
-function gen_test()
-{
- try {
- // Ensure that state is reset in case previous tests didn't finish.
- for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
-
- // With this set to false, we should automatically open the panel
- // the first time a download is started.
- DownloadsCommon.getData(window).panelHasShownBefore = false;
-
- prepareForPanelOpen();
- DownloadsCommon.getData(window)._notifyDownloadEvent("start");
- yield;
-
- // If we got here, that means the panel opened.
- DownloadsPanel.hidePanel();
-
- ok(DownloadsCommon.getData(window).panelHasShownBefore,
- "Should have recorded that the panel was opened on a download.")
-
- // Next, make sure that if we start another download, we don't open
- // the panel automatically.
- panelShouldNotOpen();
- DownloadsCommon.getData(window)._notifyDownloadEvent("start");
- yield waitFor(2);
- } catch(e) {
- ok(false, e);
- } finally {
- // Clean up when the test finishes.
- for (let yy in gen_resetState(DownloadsCommon.getData(window))) yield;
- }
-}
-
-/**
- * Call this to record a test failure for the next time the downloads panel
- * opens.
- */
-function panelShouldNotOpen()
-{
- // Hook to wait until the test data has been loaded.
- let originalOnViewLoadCompleted = DownloadsPanel.onViewLoadCompleted;
- DownloadsPanel.onViewLoadCompleted = function () {
- DownloadsPanel.onViewLoadCompleted = originalOnViewLoadCompleted;
- ok(false, "Should not have opened the downloads panel.");
- };
-}
diff --git a/browser/components/downloads/test/browser/head.js b/browser/components/downloads/test/browser/head.js
deleted file mode 100644
index 6d3d60777..000000000
--- a/browser/components/downloads/test/browser/head.js
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Provides infrastructure for automated download components tests.
- */
-
-////////////////////////////////////////////////////////////////////////////////
-//// Globals
-
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
- "resource://gre/modules/FileUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon",
- "resource:///modules/DownloadsCommon.jsm");
-const nsIDM = Ci.nsIDownloadManager;
-
-let gTestTargetFile = FileUtils.getFile("TmpD", ["dm-ui-test.file"]);
-gTestTargetFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-registerCleanupFunction(function () {
- gTestTargetFile.remove(false);
-});
-
-/**
- * This objects contains a property for each column in the downloads table.
- */
-let gDownloadRowTemplate = {
- name: "test-download.txt",
- source: "http://www.example.com/test-download.txt",
- target: NetUtil.newURI(gTestTargetFile).spec,
- startTime: 1180493839859230,
- endTime: 1180493839859234,
- state: nsIDM.DOWNLOAD_FINISHED,
- currBytes: 0,
- maxBytes: -1,
- preferredAction: 0,
- autoResume: 0
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//// Infrastructure
-
-// All test are run through the test runner.
-function test()
-{
- testRunner.runTest(this.gen_test);
-}
-
-/**
- * Runs a browser-chrome test defined through a generator function.
- *
- * This object is a singleton, initialized automatically when this script is
- * included. Every browser-chrome test file includes a new copy of this object.
- */
-var testRunner = {
- _testIterator: null,
- _lastEventResult: undefined,
- _testRunning: false,
- _eventRaised: false,
-
- // --- Main test runner ---
-
- /**
- * Runs the test described by the provided generator function asynchronously.
- *
- * Calling yield in the generator will cause it to wait until continueTest is
- * called. The parameter provided to continueTest will be the return value of
- * the yield operator.
- *
- * @param aGenerator
- * Test generator function. The function will be called with no
- * arguments to retrieve its iterator.
- */
- runTest: function TR_runTest(aGenerator) {
- waitForExplicitFinish();
- testRunner._testIterator = aGenerator();
- testRunner.continueTest();
- },
-
- /**
- * Continues the currently running test.
- *
- * @param aEventResult
- * This will be the return value of the yield operator in the test.
- */
- continueTest: function TR_continueTest(aEventResult) {
- // Store the last event result, or set it to undefined.
- testRunner._lastEventResult = aEventResult;
-
- // Never reenter the main loop, but notify that the event has been raised.
- if (testRunner._testRunning) {
- testRunner._eventRaised = true;
- return;
- }
-
- // Enter the main iteration loop.
- testRunner._testRunning = true;
- try {
- do {
- // Call the iterator, but don't leave the loop if the expected event is
- // raised during the execution of the generator.
- testRunner._eventRaised = false;
- testRunner._testIterator.send(testRunner._lastEventResult);
- } while (testRunner._eventRaised);
- }
- catch (e) {
- // This block catches exceptions raised by the generator, including the
- // normal StopIteration exception. Unexpected exceptions are reported as
- // test failures.
- if (!(e instanceof StopIteration))
- ok(false, e);
- // In any case, stop the tests in this file.
- finish();
- }
-
- // Wait for the next event or finish.
- testRunner._testRunning = false;
- }
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//// Asynchronous generator-based support subroutines
-
-//
-// The following functions are all generators that can be used inside the main
-// test generator to perform specific tasks asynchronously. To invoke these
-// subroutines correctly, an iteration syntax should be used:
-//
-// for (let yy in gen_example("Parameter")) yield;
-//
-
-function gen_resetState(aData)
-{
- let statement = Services.downloads.DBConnection.createAsyncStatement(
- "DELETE FROM moz_downloads");
- try {
- statement.executeAsync({
- handleResult: function(aResultSet) { },
- handleError: function(aError)
- {
- Cu.reportError(aError);
- },
- handleCompletion: function(aReason)
- {
- testRunner.continueTest();
- }
- });
- yield;
- } finally {
- statement.finalize();
- }
-
- // Reset any prefs that might have been changed.
- Services.prefs.clearUserPref("browser.download.panel.shown");
-
- // Ensure that the panel is closed and data is unloaded.
- aData.clear();
- aData._loadState = aData.kLoadNone;
- DownloadsPanel.hidePanel();
-
- // Wait for focus on the main window.
- waitForFocus(testRunner.continueTest);
- yield;
-}
-
-function gen_addDownloadRows(aDataRows)
-{
- let columnNames = Object.keys(gDownloadRowTemplate).join(", ");
- let parameterNames = Object.keys(gDownloadRowTemplate)
- .map(function(n) ":" + n)
- .join(", ");
- let statement = Services.downloads.DBConnection.createAsyncStatement(
- "INSERT INTO moz_downloads (" + columnNames +
- ", guid) VALUES(" + parameterNames + ", GENERATE_GUID())");
- try {
- // Execute the statement for each of the provided downloads in reverse.
- for (let i = aDataRows.length - 1; i >= 0; i--) {
- let dataRow = aDataRows[i];
-
- // Populate insert parameters from the provided data.
- for (let columnName in gDownloadRowTemplate) {
- if (!(columnName in dataRow)) {
- // Update the provided row object with data from the global template,
- // for columns whose value is not provided explicitly.
- dataRow[columnName] = gDownloadRowTemplate[columnName];
- }
- statement.params[columnName] = dataRow[columnName];
- }
-
- // Run the statement asynchronously and wait.
- statement.executeAsync({
- handleResult: function(aResultSet) { },
- handleError: function(aError)
- {
- Cu.reportError(aError.message + " (Result = " + aError.result + ")");
- },
- handleCompletion: function(aReason)
- {
- testRunner.continueTest();
- }
- });
- yield;
-
- // At each iteration, ensure that the start and end time in the global
- // template is distinct, as these column are used to sort each download
- // in its category.
- gDownloadRowTemplate.startTime++;
- gDownloadRowTemplate.endTime++;
- }
- } finally {
- statement.finalize();
- }
-}
-
-function gen_openPanel(aData)
-{
- // Hook to wait until the test data has been loaded.
- let originalOnViewLoadCompleted = DownloadsPanel.onViewLoadCompleted;
- DownloadsPanel.onViewLoadCompleted = function () {
- DownloadsPanel.onViewLoadCompleted = originalOnViewLoadCompleted;
- originalOnViewLoadCompleted.apply(this);
- testRunner.continueTest();
- };
-
- // Start loading all the downloads from the database asynchronously.
- aData.ensurePersistentDataLoaded(false);
-
- // Wait for focus on the main window.
- waitForFocus(testRunner.continueTest);
- yield;
-
- // Open the downloads panel, waiting until loading is completed.
- DownloadsPanel.showPanel();
- yield;
-}
-
-/**
- * Spin the event loop for aSeconds seconds, and then signal the test to
- * continue.
- *
- * @param aSeconds the number of seconds to wait.
- * @note This helper should _only_ be used when there's no valid event to
- * listen to and one can't be made.
- */
-function waitFor(aSeconds)
-{
- setTimeout(function() {
- testRunner.continueTest();
- }, aSeconds * 1000);
-}
-
-/**
- * Make it so that the next time the downloads panel opens, we signal to
- * continue the test. This function needs to be called each time you want
- * to wait for the panel to open.
- *
- * Example usage:
- *
- * prepareForPanelOpen();
- * // Do something to open the panel
- * yield;
- * // We can assume the panel is open now.
- */
-function prepareForPanelOpen()
-{
- // Hook to wait until the test data has been loaded.
- let originalOnPopupShown = DownloadsPanel.onPopupShown;
- DownloadsPanel.onPopupShown = function (aEvent) {
- DownloadsPanel.onPopupShown = originalOnPopupShown;
- DownloadsPanel.onPopupShown.apply(this, [aEvent]);
- testRunner.continueTest();
- };
-}
diff --git a/browser/components/downloads/test/browser/moz.build b/browser/components/downloads/test/browser/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/downloads/test/browser/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/downloads/test/moz.build b/browser/components/downloads/test/moz.build
deleted file mode 100644
index 30780a141..000000000
--- a/browser/components/downloads/test/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['browser']
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/downloads/test/unit/head.js b/browser/components/downloads/test/unit/head.js
deleted file mode 100644
index fb75c12c8..000000000
--- a/browser/components/downloads/test/unit/head.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Provides infrastructure for automated download components tests.
- */
-
-////////////////////////////////////////////////////////////////////////////////
-//// Globals
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-
-Cu.import("resource:///modules/DownloadsCommon.jsm");
diff --git a/browser/components/downloads/test/unit/test_DownloadsCommon.js b/browser/components/downloads/test/unit/test_DownloadsCommon.js
deleted file mode 100644
index f065907cc..000000000
--- a/browser/components/downloads/test/unit/test_DownloadsCommon.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests for the functions located directly in the "DownloadsCommon" object.
- */
-
-function testFormatTimeLeft(aSeconds, aExpectedValue, aExpectedUnitString)
-{
- let expected = "";
- if (aExpectedValue) {
- // Format the expected result based on the current language.
- expected = DownloadsCommon.strings[aExpectedUnitString](aExpectedValue);
- }
- do_check_eq(DownloadsCommon.formatTimeLeft(aSeconds), expected);
-}
-
-function run_test()
-{
- testFormatTimeLeft( 0, "", "");
- testFormatTimeLeft( 1, "1", "shortTimeLeftSeconds");
- testFormatTimeLeft( 29, "29", "shortTimeLeftSeconds");
- testFormatTimeLeft( 30, "30", "shortTimeLeftSeconds");
- testFormatTimeLeft( 31, "1", "shortTimeLeftMinutes");
- testFormatTimeLeft( 60, "1", "shortTimeLeftMinutes");
- testFormatTimeLeft( 89, "1", "shortTimeLeftMinutes");
- testFormatTimeLeft( 90, "2", "shortTimeLeftMinutes");
- testFormatTimeLeft( 91, "2", "shortTimeLeftMinutes");
- testFormatTimeLeft( 3600, "1", "shortTimeLeftHours");
- testFormatTimeLeft( 86400, "24", "shortTimeLeftHours");
- testFormatTimeLeft( 169200, "47", "shortTimeLeftHours");
- testFormatTimeLeft( 172800, "2", "shortTimeLeftDays");
- testFormatTimeLeft(8553600, "99", "shortTimeLeftDays");
- testFormatTimeLeft(8640000, "99", "shortTimeLeftDays");
-}
diff --git a/browser/components/downloads/test/unit/xpcshell.ini b/browser/components/downloads/test/unit/xpcshell.ini
deleted file mode 100644
index 924123c74..000000000
--- a/browser/components/downloads/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-head = head.js
-tail =
-firefox-appdir = browser
-
-[test_DownloadsCommon.js]
diff --git a/browser/components/feeds/moz.build b/browser/components/feeds/moz.build
index 92950f537..76218104c 100644
--- a/browser/components/feeds/moz.build
+++ b/browser/components/feeds/moz.build
@@ -5,4 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']
-TEST_DIRS += ['test']
+
diff --git a/browser/components/feeds/test/Makefile.in b/browser/components/feeds/test/Makefile.in
deleted file mode 100644
index bfc6e9869..000000000
--- a/browser/components/feeds/test/Makefile.in
+++ /dev/null
@@ -1,27 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_FILES = \
- bug408328-data.xml \
- bug368464-data.xml \
- test_bug494328.html \
- bug494328-data.xml \
- test_bug589543.html \
- bug589543-data.xml \
- test_bug436801.html \
- bug436801-data.xml \
- test_registerHandler.html \
- valid-feed.xml \
- valid-unsniffable-feed.xml \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/feeds/test/bug368464-data.xml b/browser/components/feeds/test/bug368464-data.xml
deleted file mode 100644
index 2745b061d..000000000
--- a/browser/components/feeds/test/bug368464-data.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
- <rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns="http://my.netscape.com/rdf/simple/0.9/">
- <channel>
- <title>Tinderbox - Firefox</title>
- <description>Build bustages for Firefox</description>
- <link>http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox</link>
- </channel>
- <image>
- <title>Bad</title>
- <url>http://tinderbox.mozilla.org/channelflames.gif</url>
- <link>http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox</link>
- </image>
- <item><title>The tree is currently closed</title><link>http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox</link></item>
-
-<item><title>MacOSX Darwin 8.8.4 qm-xserve01 dep unit test is in flames</title><link>http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox</link></item>
-</rdf:RDF>
diff --git a/browser/components/feeds/test/bug408328-data.xml b/browser/components/feeds/test/bug408328-data.xml
deleted file mode 100644
index e9385e5ab..000000000
--- a/browser/components/feeds/test/bug408328-data.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2003-12-13T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
-
- <entry>
-
- <title>Good item</title>
- <link href="http://example.org/first"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- <updated>2003-12-13T18:30:02Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
- <entry>
-
- <title>data: link</title>
- <link href="data:text/plain,Hi"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6b</id>
- <updated>2003-12-13T18:30:03Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
- <entry>
-
- <title>javascript: link</title>
- <link href="javascript:alert('Hi')"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6c</id>
- <updated>2003-12-13T18:30:04Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
- <entry>
-
- <title>file: link</title>
- <link href="file:///var/"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6d</id>
- <updated>2003-12-13T18:30:05Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
- <entry>
-
- <title>chrome: link</title>
- <link href="chrome://browser/content/browser.js"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6e</id>
- <updated>2003-12-13T18:30:06Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/feeds/test/bug436801-data.xml b/browser/components/feeds/test/bug436801-data.xml
deleted file mode 100644
index 0e45c7ed8..000000000
--- a/browser/components/feeds/test/bug436801-data.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://www.example.com/">
-
- <title type="xhtml" xml:base="/foo/bar/">
- <div xmlns="http://www.w3.org/1999/xhtml">Example of a <em>special</em> feed (<img height="20px" src="baz.png" alt="base test sprite"/>)</div>
- </title>
-
- <subtitle type="html" xml:base="/foo/bar/">
- <![CDATA[
- With a <em>special</em> subtitle (<img height="20px" src="baz.png" alt="base test sprite"/>)
- ]]>
- </subtitle>
-
- <link href="http://example.org/"/>
-
- <updated>2010-09-02T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
-
- <id>urn:uuid:22906062-ecbd-46e2-b6a7-3039506a398f</id>
-
- <entry>
- <title type="xhtml" xml:base="/foo/bar/">
- <div xmlns="http://www.w3.org/1999/xhtml">Some <abbr title="Extensible Hyper-text Mark-up Language">XHTML</abbr> examples (<img height="20px" src="baz.png" alt="base test sprite"/>)</div>
- </title>
- <id>urn:uuid:b48083a7-71a7-4c9c-8515-b7c0d22955e7</id>
- <updated>2010-09-02T18:30:02Z</updated>
- <summary>Some text.</summary>
- </entry>
-
- <entry>
- <title type="html" xml:base="/foo/bar/">
- <![CDATA[
- Some <abbr title="Hyper-text Mark-up Language">HTML</abbr> examples (<img height="20px" src="baz.png" alt="base test sprite"/>)
- ]]>
- </title>
- <id>urn:uuid:1424967a-280a-414d-b0ab-8b11c4ac1bb7</id>
- <updated>2010-09-02T18:30:02Z</updated>
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/feeds/test/bug494328-data.xml b/browser/components/feeds/test/bug494328-data.xml
deleted file mode 100644
index 58342bafc..000000000
--- a/browser/components/feeds/test/bug494328-data.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<rss version="2.0">
- <channel>
- <title>Channel title</title>
- <description>Channel description</description>
- <link>Channel link</link>
- <item>
- <title>Episode 1</title>
- <enclosure url="http://www.example.com/podcasts/Episode%201" length="0" type="audio/x-m4a" />
- </item>
- <item>
- <title>Episode 2</title>
- <enclosure url="http://www.example.com/podcasts/Episode%20%232" length="0" type="audio/x-m4a" />
- </item>
- <item>
- <title>Episode 3</title>
- <enclosure url="http://www.example.com/podcasts/Episode%20%233/" length="0" type="audio/x-m4a" />
- </item>
- <item>
- <title>Episode 4</title>
- <enclosure url="http://www.example.com/podcasts/Is%20This%20Episode%20%234%3F" length="0" type="audio/x-m4a" />
- </item>
- </channel>
-</rss>
diff --git a/browser/components/feeds/test/bug589543-data.xml b/browser/components/feeds/test/bug589543-data.xml
deleted file mode 100644
index 0e700b6d8..000000000
--- a/browser/components/feeds/test/bug589543-data.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:e2df8375-99be-4848-b05e-b9d407555267</id>
-
- <entry>
-
- <title>Item</title>
- <link href="http://example.org/first"/>
- <id>urn:uuid:9e0f4bed-33d3-4a9d-97ab-ecaa31b3f14a</id>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/feeds/test/chrome/Makefile.in b/browser/components/feeds/test/chrome/Makefile.in
deleted file mode 100644
index 020e4b652..000000000
--- a/browser/components/feeds/test/chrome/Makefile.in
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-# sample_feed.atom was copied from toolkit/components/places/tests/chrome
-MOCHITEST_FILES = \
- sample_feed.atom \
- $(NULL)
-
-MOCHITEST_CHROME_FILES = \
- test_423060.xul \
- test_bug368464.html \
- test_bug408328.html \
- test_maxSniffing.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
diff --git a/browser/components/feeds/test/chrome/moz.build b/browser/components/feeds/test/chrome/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/feeds/test/chrome/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/feeds/test/chrome/sample_feed.atom b/browser/components/feeds/test/chrome/sample_feed.atom
deleted file mode 100644
index add75efb4..000000000
--- a/browser/components/feeds/test/chrome/sample_feed.atom
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2003-12-13T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
-
- <entry>
-
- <title>Atom-Powered Robots Run Amok</title>
- <link href="http://example.org/2003/12/13/atom03"/>
- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- <updated>2003-12-13T18:30:02Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/feeds/test/chrome/test_423060.xul b/browser/components/feeds/test/chrome/test_423060.xul
deleted file mode 100644
index 465cf2dd2..000000000
--- a/browser/components/feeds/test/chrome/test_423060.xul
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet
- href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-<window title="Make sure feed preview works when a default reader is selected"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <script type="application/javascript">
- SimpleTest.waitForExplicitFinish();
-
- const Cc = Components.classes;
- const Ci = Components.interfaces;
-
- var wccrID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
- /* abort the test if web feed handlers are not available */
- if (!Cc[wccrID])
- SimpleTest.finish()
-
- /* Turn off the first run UI */
- var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
- prefBranch.setBoolPref("browser.feeds.showFirstRunUI", false);
-
- /* register a handler for the feed type */
- const MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
- var handlerPage = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=%s";
- var wccr = Cc[wccrID].getService(Ci.nsIWebContentConverterService);
- wccr.registerContentHandler(MAYBE_FEED, handlerPage, "Demo handler", null);
- var demoHandler = wccr.getWebContentHandlerByURI(MAYBE_FEED, handlerPage);
- wccr.setAutoHandler(MAYBE_FEED, demoHandler);
-
- /* Don't show the preview page */
- prefBranch.setCharPref("browser.feeds.handler", "reader");
-
- function finishUp() {
- var theframe = document.getElementById('theframe');
- var previewURL = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=http%3A%2F%2Fmochi.test%3A8888%2Ftests%2Ftoolkit%2Fcomponents%2Fplaces%2Ftests%2Fchrome%2Fsample_feed.atom";
- is(theframe.contentDocument.URL, previewURL);
-
- /* remove our demoHandler */
- wccr.setAutoHandler(MAYBE_FEED, null);
- wccr.removeContentHandler(MAYBE_FEED, handlerPage);
- prefBranch.setCharPref("browser.feeds.handler", "ask");
- prefBranch.setBoolPref("browser.feeds.showFirstRunUI", true);
-
- SimpleTest.finish();
- }
- </script>
- <html:iframe src="http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom" height="400px"
- id="theframe" onload="finishUp();">
- </html:iframe>
-</window>
diff --git a/browser/components/feeds/test/chrome/test_bug368464.html b/browser/components/feeds/test/chrome/test_bug368464.html
deleted file mode 100644
index dd7486f66..000000000
--- a/browser/components/feeds/test/chrome/test_bug368464.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=368464
--->
-<head>
- <title>Test that RSS 0.90 isn't sniffed</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=368464">Mozilla Bug 368464</a>
-<p id="display"><iframe id="testFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/bug368464-data.xml"></iframe></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 368464 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- ok($("testFrame").contentDocument.documentElement.id != "feedHandler",
- "RSS 0.90 shouldn't be sniffed as a feed");
-});
-addLoadEvent(SimpleTest.finish);
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/components/feeds/test/chrome/test_bug408328.html b/browser/components/feeds/test/chrome/test_bug408328.html
deleted file mode 100644
index e4901320a..000000000
--- a/browser/components/feeds/test/chrome/test_bug408328.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=408328
--->
-<head>
- <title>Test feed preview safe-linkification</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=408328">Mozilla Bug 408328</a>
-<p id="display"><iframe id="testFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/bug408328-data.xml"></iframe></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 408328 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- var links = $("testFrame").contentDocument.getElementById("feedContent").getElementsByTagName("a");
- is(links.length, 5, "wrong number of linked items in feed preview");
- for (var i = 0; i < links.length; i++) {
- if (links[i].href)
- is(links[i].href, "http://example.org/first", "bad linkified item");
- }
-});
-addLoadEvent(SimpleTest.finish);
-
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/browser/components/feeds/test/chrome/test_maxSniffing.html b/browser/components/feeds/test/chrome/test_maxSniffing.html
deleted file mode 100644
index 7a2044687..000000000
--- a/browser/components/feeds/test/chrome/test_maxSniffing.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=739040
--->
-<head>
- <title>Test that we only sniff 512 bytes</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=739040">Mozilla Bug 739040</a>
-<p id="display">
- <iframe id="validTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-feed.xml"></iframe>
- <iframe id="unsniffableTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-unsniffable-feed.xml"></iframe>
-</p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 739040 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- is($("validTestFrame").contentDocument.documentElement.id, "feedHandler",
- "valid feed should be sniffed");
- isnot($("unsniffableTestFrame").contentDocument.documentElement.id, "feedHandler",
- "unsniffable feed should not be sniffed");
-});
-addLoadEvent(SimpleTest.finish);
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/components/feeds/test/moz.build b/browser/components/feeds/test/moz.build
deleted file mode 100644
index 51e55b106..000000000
--- a/browser/components/feeds/test/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['chrome']
-
-MODULE = 'test_browser_feeds'
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/feeds/test/test_bug436801.html b/browser/components/feeds/test/test_bug436801.html
deleted file mode 100644
index a72d2c11a..000000000
--- a/browser/components/feeds/test/test_bug436801.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=436801
--->
-<head>
- <title>Test feed preview subscribe UI</title>
- <script type="text/javascript" src="/MochiKit/packed.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=436801">Mozilla Bug 436801</a>
-<p id="display"><iframe id="testFrame" src="bug436801-data.xml"></iframe></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function () {
- var doc = SpecialPowers.wrap($("testFrame")).contentDocument;
-
- checkNode(doc.getElementById("feedTitleText"), [
- "ELEMENT", "h1", { "xml:base": "http://www.example.com/foo/bar/" }, [
- ["TEXT", "Example of a "],
- ["ELEMENT", "em", [
- ["TEXT", "special"],
- ]],
- ["TEXT", " feed ("],
- ["ELEMENT", "img", { "src": "baz.png" }],
- ["TEXT", ")"],
- ]
- ]);
-
- checkNode(doc.getElementById("feedSubtitleText"), [
- "ELEMENT", "h2", { "xml:base": "http://www.example.com/foo/bar/" }, [
- ["TEXT", "With a "],
- ["ELEMENT", "em", [
- ["TEXT", "special"],
- ]],
- ["TEXT", " subtitle ("],
- ["ELEMENT", "img", { "src": "baz.png" }],
- ["TEXT", ")"],
- ]
- ]);
-
- checkNode(doc.querySelector(".entry").firstChild.firstChild.firstChild, [
- "ELEMENT", "span", { "xml:base": "http://www.example.com/foo/bar/" }, [
- ["TEXT", "Some "],
- ["ELEMENT", "abbr", { title: "Extensible Hyper-text Mark-up Language" }, [
- ["TEXT", "XHTML"],
- ]],
- ["TEXT", " examples ("],
- ["ELEMENT", "img", { "src": "baz.png" }],
- ["TEXT", ")"],
- ]
- ]);
-
- checkNode(doc.querySelectorAll(".entry")[1].firstChild.firstChild.firstChild, [
- "ELEMENT", "span", { "xml:base": "http://www.example.com/foo/bar/" }, [
- ["TEXT", "Some "],
- ["ELEMENT", "abbr", { title: "Hyper-text Mark-up Language" }, [
- ["TEXT", "HTML"],
- ]],
- ["TEXT", " examples ("],
- ["ELEMENT", "img", { "src": "baz.png" }],
- ["TEXT", ")"],
- ]
- ]);
-});
-
-addLoadEvent(SimpleTest.finish);
-
-function checkNode(node, schema) {
- var typeName = schema.shift() + "_NODE";
- var type = Node[typeName];
- is(node.nodeType, type, "Node should be expected type " + typeName);
- if (type == Node.TEXT_NODE) {
- var text = schema.shift();
- is(node.data, text, "Text should match");
- return;
- }
- // type == Node.ELEMENT_NODE
- var tag = schema.shift();
- is(node.localName, tag, "Element should have expected tag");
- while (schema.length) {
- var val = schema.shift();
- if (Array.isArray(val))
- var childSchema = val;
- else
- var attrSchema = val;
- }
- if (attrSchema) {
- var nsTable = {
- xml: "http://www.w3.org/XML/1998/namespace",
- };
- for (var name in attrSchema) {
- var [ns, nsName] = name.split(":");
- var val = nsName ? node.getAttributeNS(nsTable[ns], nsName) :
- node.getAttribute(name);
- is(val, attrSchema[name], "Attribute " + name + " should match");
- }
- }
- if (childSchema) {
- var numChildren = node.childNodes.length;
- is(childSchema.length, numChildren,
- "Element should have expected number of children");
- for (var i = 0; i < numChildren; i++)
- checkNode(node.childNodes[i], childSchema[i]);
- }
-}
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/components/feeds/test/test_bug494328.html b/browser/components/feeds/test/test_bug494328.html
deleted file mode 100644
index 054f62c1d..000000000
--- a/browser/components/feeds/test/test_bug494328.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=494328
--->
-<head>
- <title>Test for bug 494328</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=494328">Mozilla Bug 494328</a>
-<p id="display"><iframe id="testFrame" src="bug494328-data.xml"></iframe></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 494328 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- var links = SpecialPowers.wrap($("testFrame")).contentDocument.getElementById("feedContent").querySelectorAll("div.enclosure > a");
- is(links[0].textContent, "Episode 1", "filename decoded incorrectly");
- is(links[1].textContent, "Episode #2", "filename decoded incorrectly");
- is(links[2].textContent, "http://www.example.com/podcasts/Episode #3/", "filename decoded incorrectly");
- is(links[3].textContent, "Is This Episode #4?", "filename decoded incorrectly");
-});
-addLoadEvent(SimpleTest.finish);
-
-</script>
-</pre>
-</body>
-</html>
-
diff --git a/browser/components/feeds/test/test_bug589543.html b/browser/components/feeds/test/test_bug589543.html
deleted file mode 100644
index a6dd0b283..000000000
--- a/browser/components/feeds/test/test_bug589543.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=589543
--->
-<head>
- <title>Test feed preview subscribe UI</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589543">Mozilla Bug 589543</a>
-<p id="display"><iframe id="testFrame" src="bug589543-data.xml"></iframe></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 589543 **/
-SimpleTest.waitForExplicitFinish();
-
-addLoadEvent(function() {
- var doc = SpecialPowers.wrap($("testFrame")).contentDocument;
- var daddy = doc.getElementById("feedSubscribeLine");
- var popup = doc.getAnonymousElementByAttribute(daddy, "anonid", "handlersMenuPopup");
- isnot(popup, null, "Feed preview should have a handlers popup");
-});
-addLoadEvent(SimpleTest.finish);
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/components/feeds/test/test_registerHandler.html b/browser/components/feeds/test/test_registerHandler.html
deleted file mode 100644
index 4df5f326d..000000000
--- a/browser/components/feeds/test/test_registerHandler.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=402788
--->
-<head>
- <title>Test for Bug 402788</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402788">Mozilla Bug 402788</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 402788 **/
-
- // return false if an exception has been catched, true otherwise
- function testRegisterHandler(aIsProtocol, aTxt, aUri, aTitle)
- {
- try {
- if (aIsProtocol)
- navigator.registerProtocolHandler(aTxt, aUri, aTitle);
- else
- navigator.registerContentHandler(aTxt, aUri, aTitle);
- }
- catch(e) {
- return false;
- }
-
- return true;
- }
-
- ok(navigator.registerProtocolHandler, "navigator.registerProtocolHandler should be defined");
- ok(navigator.registerContentHandler, "navigator.registerContentHandler should be defined");
-
- // testing a generic case
- is(true, testRegisterHandler(true, "foo", "http://mochi.test:8888/%s", "Foo handler"), "registering a foo protocol handler should work");
- is(true, testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/%s", "Foo handler"), "registering a foo content handler should work");
-
- // testing with wrong uris
- is(false, testRegisterHandler(true, "foo", "http://mochi.test:8888/", "Foo handler"), "a protocol handler uri should contain %s");
- is(false, testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/", "Foo handler"), "a content handler uri should contain %s");
-
- // the spec says we should not throw here, but it probably needs to be changed
- is(false, testRegisterHandler(true, "foo", "foo/%s", "Foo handler"), "a protocol handler uri should be valid");
- is(false, testRegisterHandler(false, "application/rss+xml", "foo/%s", "Foo handler"), "a content handler uri should be valid");
-
- // we should only accept to register when the handler has the same host as the current page (bug 402287)
- is(false, testRegisterHandler(true, "foo", "http://remotehost:8888/%s", "Foo handler"), "registering a foo protocol handler with a different host should not work");
- is(false, testRegisterHandler(false, "application/rss+xml", "http://remotehost:8888/%s", "Foo handler"), "registering a foo content handler with a different host should not work");
-
- // restriction to http(s) for the uri of the handler (bug 401343)
- // https should work (http already tested in the generic case)
- is(true, testRegisterHandler(true, "foo", "https://mochi.test:8888/%s", "Foo handler"), "registering a foo protocol handler with https scheme should work");
- is(true, testRegisterHandler(false, "application/rss+xml", "https://mochi.test:8888/%s", "Foo handler"), "registering a foo content handler with https scheme should work");
- // ftp should not work
- is(false, testRegisterHandler(true, "foo", "ftp://mochi.test:8888/%s", "Foo handler"), "registering a foo protocol handler with ftp scheme should not work");
- is(false, testRegisterHandler(false, "application/rss+xml", "ftp://mochi.test:8888/%s", "Foo handler"), "registering a foo content handler with ftp scheme should not work");
- // chrome should not work
- is(false, testRegisterHandler(true, "foo", "chrome://mochi.test:8888/%s", "Foo handler"), "registering a foo protocol handler with chrome scheme should not work");
- is(false, testRegisterHandler(false, "application/rss+xml", "chrome://mochi.test:8888/%s", "Foo handler"), "registering a foo content handler with chrome scheme should not work");
- // foo should not work
- is(false, testRegisterHandler(true, "foo", "foo://mochi.test:8888/%s", "Foo handler"), "registering a foo protocol handler with foo scheme should not work");
- is(false, testRegisterHandler(false, "application/rss+xml", "foo://mochi.test:8888/%s", "Foo handler"), "registering a foo content handler with foo scheme should not work");
-
- // for security reasons, protocol handlers should never be registered for some schemes (chrome, vbscript, ...) (bug 402788)
- is(false, testRegisterHandler(true, "chrome", "http://mochi.test:8888/%s", "chrome handler"), "registering a chrome protocol handler should not work");
- is(false, testRegisterHandler(true, "vbscript", "http://mochi.test:8888/%s", "vbscript handler"), "registering a vbscript protocol handler should not work");
- is(false, testRegisterHandler(true, "javascript", "http://mochi.test:8888/%s", "javascript handler"), "registering a javascript protocol handler should not work");
- is(false, testRegisterHandler(true, "moz-icon", "http://mochi.test:8888/%s", "moz-icon handler"), "registering a moz-icon protocol handler should not work");
-
- // for security reasons, content handlers should never be registered for some types (html, ...)
- is(true, testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/%s", "Foo handler"), "registering rss content handlers should work");
- is(true, testRegisterHandler(false, "application/atom+xml", "http://mochi.test:8888/%s", "Foo handler"), "registering atom content handlers should work");
- todo(false, testRegisterHandler(false, "text/html", "http://mochi.test:8888/%s", "Foo handler"), "registering html content handlers should not work"); // bug 403798
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/browser/components/feeds/test/unit/head_feeds.js b/browser/components/feeds/test/unit/head_feeds.js
deleted file mode 100644
index 841f68157..000000000
--- a/browser/components/feeds/test/unit/head_feeds.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
diff --git a/browser/components/feeds/test/unit/test_355473.js b/browser/components/feeds/test/unit/test_355473.js
deleted file mode 100644
index 54900a5a7..000000000
--- a/browser/components/feeds/test/unit/test_355473.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function run_test() {
- var feedFeedURI = ios.newURI("feed://example.com/feed.xml", null, null);
- var httpFeedURI = ios.newURI("feed:http://example.com/feed.xml", null, null);
- var httpURI = ios.newURI("http://example.com/feed.xml", null, null);
-
- var httpsFeedURI =
- ios.newURI("feed:https://example.com/feed.xml", null, null);
- var httpsURI = ios.newURI("https://example.com/feed.xml", null, null);
-
- var feedChannel = ios.newChannelFromURI(feedFeedURI, null);
- var httpChannel = ios.newChannelFromURI(httpFeedURI, null);
- var httpsChannel = ios.newChannelFromURI(httpsFeedURI, null);
-
- // not setting .originalURI to the original URI is naughty
- do_check_true(feedFeedURI.equals(feedChannel.originalURI));
- do_check_true(httpFeedURI.equals(httpChannel.originalURI));
- do_check_true(httpsFeedURI.equals(httpsChannel.originalURI));
-
- // actually using the horrible mess that's a feed: URI is suicidal
- do_check_true(httpURI.equals(feedChannel.URI));
- do_check_true(httpURI.equals(httpChannel.URI));
- do_check_true(httpsURI.equals(httpsChannel.URI));
-
- // check that we don't throw creating feed: URIs from file and ftp
- var ftpFeedURI = ios.newURI("feed:ftp://example.com/feed.xml", null, null);
- var fileFeedURI = ios.newURI("feed:file:///var/feed.xml", null, null);
-}
diff --git a/browser/components/feeds/test/unit/test_758990.js b/browser/components/feeds/test/unit/test_758990.js
deleted file mode 100644
index 3a1dde770..000000000
--- a/browser/components/feeds/test/unit/test_758990.js
+++ /dev/null
@@ -1,42 +0,0 @@
-function run_test() {
- var success = false;
- try {
- var newURI = ios.newURI("feed:javascript:alert('hi');", null, null);
- }
- catch (e) {
- success = e.result == Cr.NS_ERROR_MALFORMED_URI;
- }
- if (!success)
- do_throw("We didn't throw NS_ERROR_MALFORMED_URI creating a feed:javascript: URI");
-
- success = false;
- try {
- newURI = ios.newURI("feed:data:text/html,hi", null, null);
- }
- catch (e) {
- success = e.result == Cr.NS_ERROR_MALFORMED_URI;
- }
- if (!success)
- do_throw("We didn't throw NS_ERROR_MALFORMED_URI creating a feed:data: URI");
-
- success = false;
- try {
- newURI = ios.newURI("pcast:javascript:alert('hi');", null, null);
- }
- catch (e) {
- success = e.result == Cr.NS_ERROR_MALFORMED_URI;
- }
- if (!success)
- do_throw("We didn't throw NS_ERROR_MALFORMED_URI creating a pcast:javascript: URI");
-
- success = false;
- try {
- newURI = ios.newURI("pcast:data:text/html,hi", null, null);
- }
- catch (e) {
- success = e.result == Cr.NS_ERROR_MALFORMED_URI;
- }
- if (!success)
- do_throw("We didn't throw NS_ERROR_MALFORMED_URI creating a pcast:data: URI");
-
-}
diff --git a/browser/components/feeds/test/unit/xpcshell.ini b/browser/components/feeds/test/unit/xpcshell.ini
deleted file mode 100644
index abe786897..000000000
--- a/browser/components/feeds/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-head = head_feeds.js
-tail =
-firefox-appdir = browser
-
-[test_355473.js]
-[test_758990.js]
diff --git a/browser/components/feeds/test/valid-feed.xml b/browser/components/feeds/test/valid-feed.xml
deleted file mode 100644
index 0e700b6d8..000000000
--- a/browser/components/feeds/test/valid-feed.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:e2df8375-99be-4848-b05e-b9d407555267</id>
-
- <entry>
-
- <title>Item</title>
- <link href="http://example.org/first"/>
- <id>urn:uuid:9e0f4bed-33d3-4a9d-97ab-ecaa31b3f14a</id>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/feeds/test/valid-unsniffable-feed.xml b/browser/components/feeds/test/valid-unsniffable-feed.xml
deleted file mode 100644
index e75315739..000000000
--- a/browser/components/feeds/test/valid-unsniffable-feed.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 512 bytes!
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- -->
-<feed xmlns="http://www.w3.org/2005/Atom">
-
- <title>Example Feed</title>
- <link href="http://example.org/"/>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <author>
- <name>John Doe</name>
- </author>
- <id>urn:uuid:e2df8375-99be-4848-b05e-b9d407555267</id>
-
- <entry>
-
- <title>Item</title>
- <link href="http://example.org/first"/>
- <id>urn:uuid:9e0f4bed-33d3-4a9d-97ab-ecaa31b3f14a</id>
- <updated>2010-08-22T18:30:02Z</updated>
-
- <summary>Some text.</summary>
- </entry>
-
-</feed>
diff --git a/browser/components/migration/moz.build b/browser/components/migration/moz.build
index 7f633c4e9..76218104c 100644
--- a/browser/components/migration/moz.build
+++ b/browser/components/migration/moz.build
@@ -5,4 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']
-TEST_DIRS += ['tests']
+
diff --git a/browser/components/migration/tests/moz.build b/browser/components/migration/tests/moz.build
deleted file mode 100644
index 191c90f0b..000000000
--- a/browser/components/migration/tests/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/migration/tests/unit/head_migration.js b/browser/components/migration/tests/unit/head_migration.js
deleted file mode 100644
index 2f84eac2b..000000000
--- a/browser/components/migration/tests/unit/head_migration.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
- "resource://gre/modules/FileUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils",
- "resource:///modules/MigrationUtils.jsm");
-// Initialize profile.
-let gProfD = do_get_profile();
-
-// Create a fake XULAppInfo to satisfy the eventual needs of the migrators.
-let (XULAppInfo = {
- // nsIXUlAppInfo
- get vendor() "Mozilla",
- get name() "XPCShell",
- get ID() "xpcshell@tests.mozilla.org",
- get version() "1",
- get appBuildID() "2007010101",
- get platformVersion() "1.0",
- get platformBuildID() "2007010101",
-
- // nsIXUlRuntime (partial)
- get inSafeMode() false,
- logConsoleErrors: true,
- get OS() "XPCShell",
- get XPCOMABI() "noarch-spidermonkey",
- invalidateCachesOnRestart: function () {},
-
- // nsIWinAppHelper
- get userCanElevate() false,
-
- QueryInterface: function (aIID) {
- let interfaces = [Ci.nsIXULAppInfo, Ci.nsIXULRuntime];
- if ("nsIWinAppHelper" in Ci)
- interfaces.push(Ci.nsIWinAppHelper);
- if (!interfaces.some(function (v) aIID.equals(v)))
- throw Cr.NS_ERROR_NO_INTERFACE;
- return this;
- }
-}) {
- const CONTRACT_ID = "@mozilla.org/xre/app-info;1";
- const CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
-
- let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- registrar.registerFactory(CID, "XULAppInfo", CONTRACT_ID, {
- createInstance: function (aOuter, aIID) {
- if (aOuter != null)
- throw Cr.NS_ERROR_NO_AGGREGATION;
- return XULAppInfo.QueryInterface(aIID);
- },
- QueryInterface: XPCOMUtils.generateQI(Ci.nsIFactory)
- });
-}
diff --git a/browser/components/migration/tests/unit/test_IE_bookmarks.js b/browser/components/migration/tests/unit/test_IE_bookmarks.js
deleted file mode 100644
index abead5736..000000000
--- a/browser/components/migration/tests/unit/test_IE_bookmarks.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function run_test() {
- do_test_pending();
-
- let migrator = MigrationUtils.getMigrator("ie");
-
- // Sanity check for the source.
- do_check_true(migrator.sourceExists);
-
- // Ensure bookmarks migration is available.
- let availableSources = migrator.getMigrateData("FieldOfFlowers", false);
- do_check_true((availableSources & MigrationUtils.resourceTypes.BOOKMARKS) > 0);
-
- // Wait for the imported bookmarks. Check that "From Internet Explorer"
- // folders are created in the menu and on the toolbar.
- let source = MigrationUtils.getLocalizedString("sourceNameIE");
- let label = MigrationUtils.getLocalizedString("importedBookmarksFolder", [source]);
-
- let expectedParents = [ PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.toolbarFolderId ];
-
- PlacesUtils.bookmarks.addObserver({
- onItemAdded: function onItemAdded(aItemId, aParentId, aIndex, aItemType,
- aURI, aTitle) {
- if (aTitle == label) {
- let index = expectedParents.indexOf(aParentId);
- do_check_neq(index, -1);
- expectedParents.splice(index, 1);
- if (expectedParents.length == 0)
- PlacesUtils.bookmarks.removeObserver(this);
- }
- },
- onBeginUpdateBatch: function () {},
- onEndUpdateBatch: function () {},
- onItemRemoved: function () {},
- onItemChanged: function () {},
- onItemVisited: function () {},
- onItemMoved: function () {},
- }, false);
-
- // Wait for migration.
- Services.obs.addObserver(function onMigrationEnded() {
- Services.obs.removeObserver(onMigrationEnded, "Migration:Ended");
-
- // Check the bookmarks have been imported to all the expected parents.
- do_check_eq(expectedParents.length, 0);
-
- do_test_finished();
- }, "Migration:Ended", false);
-
- migrator.migrate(MigrationUtils.resourceTypes.BOOKMARKS, null,
- "FieldOfFlowers");
-}
diff --git a/browser/components/migration/tests/unit/xpcshell.ini b/browser/components/migration/tests/unit/xpcshell.ini
deleted file mode 100644
index c08c2533f..000000000
--- a/browser/components/migration/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-head = head_migration.js
-tail =
-firefox-appdir = browser
-
-[test_IE_bookmarks.js]
-skip-if = os != "win"
diff --git a/browser/components/moz.build b/browser/components/moz.build
index f17553cbc..9a842528b 100644
--- a/browser/components/moz.build
+++ b/browser/components/moz.build
@@ -23,7 +23,6 @@ PARALLEL_DIRS += [
if CONFIG['MOZ_SAFE_BROWSING']:
PARALLEL_DIRS += ['safebrowsing']
-TEST_DIRS += ['test']
DIRS += ['build']
XPIDL_SOURCES += [
diff --git a/browser/components/places/moz.build b/browser/components/places/moz.build
index 003d9ed15..52d271a42 100644
--- a/browser/components/places/moz.build
+++ b/browser/components/places/moz.build
@@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['src']
-TEST_DIRS += ['tests']
XPIDL_FLAGS += [
'-I$(topsrcdir)/browser/components/',
diff --git a/browser/components/places/tests/browser/Makefile.in b/browser/components/places/tests/browser/Makefile.in
deleted file mode 100644
index 177fa0fc9..000000000
--- a/browser/components/places/tests/browser/Makefile.in
+++ /dev/null
@@ -1,47 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_0_library_left_pane_migration.js \
- browser_library_left_pane_fixnames.js \
- browser_425884.js \
- browser_475045.js \
- browser_423515.js \
- browser_410196_paste_into_tags.js \
- browser_sort_in_library.js \
- browser_library_open_leak.js \
- browser_library_panel_leak.js \
- browser_library_search.js \
- browser_history_sidebar_search.js \
- browser_bookmarksProperties.js \
- $(filter disabled-for-very-frequent-oranges--bug-551540, browser_forgetthissite_single.js) \
- browser_library_left_pane_commands.js \
- browser_drag_bookmarks_on_toolbar.js \
- browser_library_middleclick.js \
- browser_library_views_liveupdate.js \
- browser_views_liveupdate.js \
- $(filter temporarily-disabled-for-breaking-the-treeview--bug-658744, browser_sidebarpanels_click.js) \
- sidebarpanels_click_test_page.html \
- browser_library_infoBox.js \
- browser_markPageAsFollowedLink.js \
- framedPage.html \
- frameLeft.html \
- frameRight.html \
- browser_toolbar_migration.js \
- browser_library_batch_delete.js \
- browser_555547.js \
- browser_416459_cut.js \
- browser_library_downloads.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js b/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js
deleted file mode 100644
index b0be0ee12..000000000
--- a/browser/components/places/tests/browser/browser_0_library_left_pane_migration.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test we correctly migrate Library left pane to the latest version.
- * Note: this test MUST be the first between browser chrome tests, or results
- * of next tests could be unexpected due to PlacesUIUtils getters.
- */
-
-const TEST_URI = "http://www.mozilla.org/";
-
-function onLibraryReady(organizer) {
- // Check left pane.
- ok(PlacesUIUtils.leftPaneFolderId > 0,
- "Left pane folder correctly created");
- var leftPaneItems =
- PlacesUtils.annotations
- .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(leftPaneItems.length, 1,
- "We correctly have only 1 left pane folder");
- var leftPaneRoot = leftPaneItems[0];
- is(leftPaneRoot, PlacesUIUtils.leftPaneFolderId,
- "leftPaneFolderId getter has correct value");
- // Check version has been upgraded.
- var version =
- PlacesUtils.annotations.getItemAnnotation(leftPaneRoot,
- PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION,
- "Left pane version has been correctly upgraded");
-
- // Check left pane is populated.
- organizer.PlacesOrganizer.selectLeftPaneQuery('History');
- is(organizer.PlacesOrganizer._places.selectedNode.itemId,
- PlacesUIUtils.leftPaneQueries["History"],
- "Library left pane is populated and working");
-
- // Close Library window.
- organizer.close();
- // No need to cleanup anything, we have a correct left pane now.
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils is running in chrome context");
- ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
- ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
- "Left pane version in chrome context, current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
-
- // Check if we have any left pane folder already set, remove it eventually.
- var leftPaneItems = PlacesUtils.annotations
- .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- if (leftPaneItems.length > 0) {
- // The left pane has already been created, touching it now would cause
- // next tests to rely on wrong values (and possibly crash)
- is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
- // Check version.
- var version = PlacesUtils.annotations.getItemAnnotation(leftPaneItems[0],
- PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, "Left pane version is actual");
- ok(true, "left pane has already been created, skipping test");
- finish();
- return;
- }
-
- // Create a fake left pane folder with an old version (current version - 1).
- var fakeLeftPaneRoot =
- PlacesUtils.bookmarks.createFolder(PlacesUtils.placesRootId, "",
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(fakeLeftPaneRoot,
- PlacesUIUtils.ORGANIZER_FOLDER_ANNO,
- PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION - 1,
- 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
-
- // Check fake left pane root has been correctly created.
- var leftPaneItems =
- PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
- is(leftPaneItems[0], fakeLeftPaneRoot, "left pane root itemId is correct");
-
- // Check version.
- var version = PlacesUtils.annotations.getItemAnnotation(fakeLeftPaneRoot,
- PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION - 1, "Left pane version correctly set");
-
- // Open Library, this will upgrade our left pane version.
- openLibrary(onLibraryReady);
-}
diff --git a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
deleted file mode 100644
index 8688a938f..000000000
--- a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function add_bookmark(aURI) {
- return PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- aURI, PlacesUtils.bookmarks.DEFAULT_INDEX,
- "bookmark/" + aURI.spec);
-}
-
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
-const TEST_URL = "http://example.com/";
-const MOZURISPEC = "http://mozilla.com/";
-
-let gLibrary;
-let PlacesOrganizer;
-let ContentTree;
-
-function test() {
- waitForExplicitFinish();
- gLibrary = openLibrary(onLibraryReady);
-}
-
-function onLibraryReady() {
- ok(PlacesUtils, "PlacesUtils in scope");
- ok(PlacesUIUtils, "PlacesUIUtils in scope");
-
- PlacesOrganizer = gLibrary.PlacesOrganizer;
- ok(PlacesOrganizer, "Places organizer in scope");
-
- ContentTree = gLibrary.ContentTree;
- ok(ContentTree, "ContentTree is in scope");
-
- tests.makeHistVisit(function() {
- tests.makeTag();
- tests.focusTag();
- waitForClipboard(function(aData) !!aData,
- tests.copyHistNode,
- onClipboardReady,
- PlacesUtils.TYPE_X_MOZ_PLACE);
- });
-}
-
-function onClipboardReady() {
- tests.focusTag();
- PlacesOrganizer._places.controller.paste();
- tests.historyNode();
- tests.checkForBookmarkInUI();
-
- gLibrary.close();
-
- // Remove new Places data we created.
- PlacesUtils.tagging.untagURI(NetUtil.newURI(MOZURISPEC), ["foo"]);
- PlacesUtils.tagging.untagURI(NetUtil.newURI(TEST_URL), ["foo"]);
- let tags = PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(TEST_URL));
- is(tags.length, 0, "tags are gone");
- PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
-
- waitForClearHistory(finish);
-}
-
-let tests = {
-
- makeHistVisit: function(aCallback) {
- // need to add a history object
- let testURI1 = NetUtil.newURI(MOZURISPEC);
- isnot(testURI1, null, "testURI is not null");
- addVisits(
- {uri: testURI1, transition: PlacesUtils.history.TRANSITION_TYPED},
- window,
- aCallback);
- },
-
- makeTag: function() {
- // create an initial tag to work with
- let bmId = add_bookmark(NetUtil.newURI(TEST_URL));
- ok(bmId > 0, "A bookmark was added");
- PlacesUtils.tagging.tagURI(NetUtil.newURI(TEST_URL), ["foo"]);
- let tags = PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(TEST_URL));
- is(tags[0], 'foo', "tag is foo");
- },
-
- focusTag: function (){
- // focus the new tag
- PlacesOrganizer.selectLeftPaneQuery("Tags");
- let tags = PlacesOrganizer._places.selectedNode;
- tags.containerOpen = true;
- let fooTag = tags.getChild(0);
- let tagNode = fooTag;
- PlacesOrganizer._places.selectNode(fooTag);
- is(tagNode.title, 'foo', "tagNode title is foo");
- let ip = PlacesOrganizer._places.insertionPoint;
- ok(ip.isTag, "IP is a tag");
- },
-
- copyHistNode: function (){
- // focus the history object
- PlacesOrganizer.selectLeftPaneQuery("History");
- let histContainer = PlacesOrganizer._places.selectedNode;
- PlacesUtils.asContainer(histContainer);
- histContainer.containerOpen = true;
- PlacesOrganizer._places.selectNode(histContainer.getChild(0));
- let histNode = ContentTree.view.view.nodeForTreeIndex(0);
- ContentTree.view.selectNode(histNode);
- is(histNode.uri, MOZURISPEC,
- "historyNode exists: " + histNode.uri);
- // copy the history node
- ContentTree.view.controller.copy();
- },
-
- historyNode: function (){
- // re-focus the history again
- PlacesOrganizer.selectLeftPaneQuery("History");
- let histContainer = PlacesOrganizer._places.selectedNode;
- PlacesUtils.asContainer(histContainer);
- histContainer.containerOpen = true;
- PlacesOrganizer._places.selectNode(histContainer.getChild(0));
- let histNode = ContentTree.view.view.nodeForTreeIndex(0);
- ok(histNode, "histNode exists: " + histNode.title);
- // check to see if the history node is tagged!
- let tags = PlacesUtils.tagging.getTagsForURI(NetUtil.newURI(MOZURISPEC));
- ok(tags.length == 1, "history node is tagged: " + tags.length);
- // check if a bookmark was created
- let isBookmarked = PlacesUtils.bookmarks.isBookmarked(NetUtil.newURI(MOZURISPEC));
- is(isBookmarked, true, MOZURISPEC + " is bookmarked");
- let bookmarkIds = PlacesUtils.bookmarks.getBookmarkIdsForURI(
- NetUtil.newURI(histNode.uri));
- ok(bookmarkIds.length > 0, "bookmark exists for the tagged history item: " + bookmarkIds);
- },
-
- checkForBookmarkInUI: function(){
- // is the bookmark visible in the UI?
- // get the Unsorted Bookmarks node
- PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
- // now we can see what is in the ContentTree tree
- let unsortedNode = ContentTree.view.view.nodeForTreeIndex(1);
- ok(unsortedNode, "unsortedNode is not null: " + unsortedNode.uri);
- is(unsortedNode.uri, MOZURISPEC, "node uri's are the same");
- },
-};
diff --git a/browser/components/places/tests/browser/browser_416459_cut.js b/browser/components/places/tests/browser/browser_416459_cut.js
deleted file mode 100644
index ec78df1b7..000000000
--- a/browser/components/places/tests/browser/browser_416459_cut.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const TEST_URL = "http://example.com/";
-
-let gLibrary;
-let gItemId;
-let PlacesOrganizer;
-let ContentTree;
-
-function test() {
- waitForExplicitFinish();
- gLibrary = openLibrary(onLibraryReady);
-}
-
-function onLibraryReady() {
- PlacesOrganizer = gLibrary.PlacesOrganizer;
- ContentTree = gLibrary.ContentTree;
-
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils in scope");
- ok(PlacesUIUtils, "PlacesUIUtils in scope");
- ok(PlacesOrganizer, "PlacesOrganizer in scope");
- ok(ContentTree, "ContentTree is in scope");
-
- gItemId = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.toolbarFolderId, NetUtil.newURI(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX, "test"
- );
-
- selectBookmarkIn("BookmarksToolbar");
-
- waitForClipboard(function(aData) !!aData,
- cutSelection,
- onClipboardReady,
- PlacesUtils.TYPE_X_MOZ_PLACE);
-}
-
-function selectBookmarkIn(aLeftPaneQuery) {
- info("Selecting " + aLeftPaneQuery + " in the left pane");
- PlacesOrganizer.selectLeftPaneQuery(aLeftPaneQuery);
- let rootId = PlacesUtils.getConcreteItemId(PlacesOrganizer._places.selectedNode);
- is(PlacesUtils.bookmarks.getFolderIdForItem(gItemId), rootId,
- "Bookmark has the right parent");
- info("Selecting the bookmark in the right pane");
- ContentTree.view.selectItems([gItemId]);
- let bookmarkNode = ContentTree.view.selectedNode;
- is(bookmarkNode.uri, TEST_URL, "Found the expected bookmark");
-}
-
-function cutSelection() {
- info("Cutting selection");
- ContentTree.view.controller.cut();
-}
-
-function pasteClipboard(aLeftPaneQuery) {
- info("Selecting " + aLeftPaneQuery + " in the left pane");
- PlacesOrganizer.selectLeftPaneQuery(aLeftPaneQuery);
- info("Pasting clipboard");
- ContentTree.view.controller.paste();
-}
-
-function onClipboardReady() {
- pasteClipboard("UnfiledBookmarks");
- selectBookmarkIn("UnfiledBookmarks");
-
- // Cleanup.
- gLibrary.close();
- PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- finish();
-}
diff --git a/browser/components/places/tests/browser/browser_423515.js b/browser/components/places/tests/browser/browser_423515.js
deleted file mode 100644
index 6be928881..000000000
--- a/browser/components/places/tests/browser/browser_423515.js
+++ /dev/null
@@ -1,220 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // sanity check
- ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
- ok(PlacesUIUtils, "checking PlacesUIUtils, running in chrome context?");
- ok(PlacesControllerDragHelper, "checking PlacesControllerDragHelper, running in chrome context?");
-
- const IDX = PlacesUtils.bookmarks.DEFAULT_INDEX;
-
- // setup
- var rootId = PlacesUtils.bookmarks.createFolder(PlacesUtils.toolbarFolderId, "", IDX);
- var rootNode = PlacesUtils.getFolderContents(rootId, false, true).root;
- is(rootNode.childCount, 0, "confirm test root is empty");
-
- var tests = [];
-
- // add a regular folder, should be moveable
- tests.push({
- populate: function() {
- this.id =
- PlacesUtils.bookmarks.createFolder(rootId, "", IDX);
- },
- validate: function() {
- is(rootNode.childCount, 1,
- "populate added data to the test root");
- is(PlacesControllerDragHelper.canMoveContainer(this.id),
- true, "can move regular folder id");
- is(PlacesControllerDragHelper.canMoveNode(rootNode.getChild(0)),
- true, "can move regular folder node");
- }
- });
-
- // add a regular folder shortcut, should be moveable
- tests.push({
- populate: function() {
- this.folderId =
- PlacesUtils.bookmarks.createFolder(rootId, "foo", IDX);
- this.shortcutId =
- PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("place:folder="+this.folderId), IDX, "bar");
- },
- validate: function() {
- is(rootNode.childCount, 2,
- "populated data to the test root");
-
- var folderNode = rootNode.getChild(0);
- is(folderNode.type, 6, "node is folder");
- is(this.folderId, folderNode.itemId, "folder id and folder node item id match");
-
- var shortcutNode = rootNode.getChild(1);
- is(shortcutNode.type, 9, "node is folder shortcut");
- is(this.shortcutId, shortcutNode.itemId, "shortcut id and shortcut node item id match");
-
- var concreteId = PlacesUtils.getConcreteItemId(shortcutNode);
- is(concreteId, folderNode.itemId, "shortcut node id and concrete id match");
-
- is(PlacesControllerDragHelper.canMoveContainer(this.shortcutId),
- true, "can move folder shortcut id");
-
- is(PlacesControllerDragHelper.canMoveNode(shortcutNode),
- true, "can move folder shortcut node");
- }
- });
-
- // add a regular query, should be moveable
- tests.push({
- populate: function() {
- this.bookmarkId =
- PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("http://foo.com"), IDX, "foo");
- this.queryId =
- PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("place:terms=foo"), IDX, "bar");
- },
- validate: function() {
- is(rootNode.childCount, 2,
- "populated data to the test root");
-
- var bmNode = rootNode.getChild(0);
- is(bmNode.itemId, this.bookmarkId, "bookmark id and bookmark node item id match");
-
- var queryNode = rootNode.getChild(1);
- is(queryNode.itemId, this.queryId, "query id and query node item id match");
-
- is(PlacesControllerDragHelper.canMoveContainer(this.queryId),
- true, "can move query id");
-
- is(PlacesControllerDragHelper.canMoveNode(queryNode),
- true, "can move query node");
- }
- });
-
- // test that special folders cannot be moved
- // test that special folders shortcuts can be moved
- tests.push({
- folders: [PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.tagsFolderId, PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.toolbarFolderId],
- shortcuts: {},
- populate: function() {
- for (var i = 0; i < this.folders.length; i++) {
- var id = this.folders[i];
- this.shortcuts[id] =
- PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("place:folder=" + id), IDX, "");
- }
- },
- validate: function() {
- // test toolbar shortcut node
- is(rootNode.childCount, this.folders.length,
- "populated data to the test root");
-
- function getRootChildNode(aId) {
- var node = PlacesUtils.getFolderContents(PlacesUtils.placesRootId, false, true).root;
- for (var i = 0; i < node.childCount; i++) {
- var child = node.getChild(i);
- if (child.itemId == aId) {
- node.containerOpen = false;
- return child;
- }
- }
- node.containerOpen = false;
- ok(false, "Unable to find child node");
- return null;
- }
-
- for (var i = 0; i < this.folders.length; i++) {
- var id = this.folders[i];
-
- is(PlacesControllerDragHelper.canMoveContainer(id),
- false, "shouldn't be able to move special folder id");
-
- var node = getRootChildNode(id);
- isnot(node, null, "Node found");
- is(PlacesControllerDragHelper.canMoveNode(node),
- false, "shouldn't be able to move special folder node");
-
- var shortcutId = this.shortcuts[id];
- var shortcutNode = rootNode.getChild(i);
-
- is(shortcutNode.itemId, shortcutId, "shortcut id and shortcut node item id match");
-
- dump("can move shortcut id?\n");
- is(PlacesControllerDragHelper.canMoveContainer(shortcutId),
- true, "should be able to move special folder shortcut id");
-
- dump("can move shortcut node?\n");
- is(PlacesControllerDragHelper.canMoveNode(shortcutNode),
- true, "should be able to move special folder shortcut node");
- }
- }
- });
-
- // test that a tag container cannot be moved
- tests.push({
- populate: function() {
- // tag a uri
- this.uri = makeURI("http://foo.com");
- PlacesUtils.tagging.tagURI(this.uri, ["bar"]);
- },
- validate: function() {
- // get tag root
- var query = PlacesUtils.history.getNewQuery();
- var options = PlacesUtils.history.getNewQueryOptions();
- options.resultType = Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY;
- var tagsNode = PlacesUtils.history.executeQuery(query, options).root;
-
- tagsNode.containerOpen = true;
- is(tagsNode.childCount, 1, "has new tag");
-
- var tagNode = tagsNode.getChild(0);
-
- is(PlacesControllerDragHelper.canMoveNode(tagNode),
- false, "should not be able to move tag container node");
-
- tagsNode.containerOpen = false;
- }
- });
-
- // test that any child of a read-only node cannot be moved
- tests.push({
- populate: function() {
- this.id =
- PlacesUtils.bookmarks.createFolder(rootId, "foo", IDX);
- PlacesUtils.bookmarks.createFolder(this.id, "bar", IDX);
- PlacesUtils.bookmarks.setFolderReadonly(this.id, true);
- },
- validate: function() {
- is(rootNode.childCount, 1,
- "populate added data to the test root");
- var readOnlyFolder = rootNode.getChild(0);
-
- // test that we can move the read-only folder
- is(PlacesControllerDragHelper.canMoveContainer(this.id),
- true, "can move read-only folder id");
- is(PlacesControllerDragHelper.canMoveNode(readOnlyFolder),
- true, "can move read-only folder node");
-
- // test that we cannot move the child of a read-only folder
- readOnlyFolder.QueryInterface(Ci.nsINavHistoryContainerResultNode);
- readOnlyFolder.containerOpen = true;
- var childFolder = readOnlyFolder.getChild(0);
-
- is(PlacesControllerDragHelper.canMoveContainer(childFolder.itemId),
- false, "cannot move a child of a read-only folder");
- is(PlacesControllerDragHelper.canMoveNode(childFolder),
- false, "cannot move a child node of a read-only folder node");
- readOnlyFolder.containerOpen = false;
- }
- });
-
- tests.forEach(function(aTest) {
- PlacesUtils.bookmarks.removeFolderChildren(rootId);
- aTest.populate();
- aTest.validate();
- });
-
- rootNode.containerOpen = false;
- PlacesUtils.bookmarks.removeItem(rootId);
-}
diff --git a/browser/components/places/tests/browser/browser_425884.js b/browser/components/places/tests/browser/browser_425884.js
deleted file mode 100644
index 4140ac023..000000000
--- a/browser/components/places/tests/browser/browser_425884.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // sanity check
- ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
- ok(PlacesUIUtils, "checking PlacesUIUtils, running in chrome context?");
-
- /*
- Deep copy of bookmark data, using the front-end codepath:
-
- - create test folder A
- - add a subfolder to folder A, and add items to it
- - validate folder A (sanity check)
- - copy folder A, creating new folder B, using the front-end path
- - validate folder B
- - undo copy transaction
- - validate folder B (empty)
- - redo copy transaction
- - validate folder B's contents
-
- */
-
- var toolbarId = PlacesUtils.toolbarFolderId;
- var toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
-
- var oldCount = toolbarNode.childCount;
- var testRootId = PlacesUtils.bookmarks.createFolder(toolbarId, "test root", -1);
- is(toolbarNode.childCount, oldCount+1, "confirm test root node is a container, and is empty");
- var testRootNode = toolbarNode.getChild(toolbarNode.childCount-1);
- testRootNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
- testRootNode.containerOpen = true;
- is(testRootNode.childCount, 0, "confirm test root node is a container, and is empty");
-
- // create folder A, fill it, validate its contents
- var folderAId = PlacesUtils.bookmarks.createFolder(testRootId, "A", -1);
- populate(folderAId);
- var folderANode = PlacesUtils.getFolderContents(folderAId).root;
- validate(folderANode);
- is(testRootNode.childCount, 1, "create test folder");
-
- // copy it, using the front-end helper functions
- var serializedNode = PlacesUtils.wrapNode(folderANode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
- var rawNode = PlacesUtils.unwrapNodes(serializedNode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER).shift();
- // confirm serialization
- ok(rawNode.type, "confirm json node");
- folderANode.containerOpen = false;
-
- var transaction = PlacesUIUtils.makeTransaction(rawNode,
- PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
- testRootId,
- -1,
- true);
- ok(transaction, "create transaction");
- PlacesUtils.transactionManager.doTransaction(transaction);
- // confirm copy
- is(testRootNode.childCount, 2, "create test folder via copy");
-
- // validate the copy
- var folderBNode = testRootNode.getChild(1);
- validate(folderBNode);
-
- // undo the transaction, confirm the removal
- PlacesUtils.transactionManager.undoTransaction();
- is(testRootNode.childCount, 1, "confirm undo removed the copied folder");
-
- // redo the transaction
- PlacesUtils.transactionManager.redoTransaction();
- is(testRootNode.childCount, 2, "confirm redo re-copied the folder");
- folderBNode = testRootNode.getChild(1);
- validate(folderBNode);
-
- // Close containers, cleaning up their observers.
- testRootNode.containerOpen = false;
- toolbarNode.containerOpen = false;
-
- // clean up
- PlacesUtils.transactionManager.undoTransaction();
- PlacesUtils.bookmarks.removeItem(folderAId);
-}
-
-function populate(aFolderId) {
- var folderId = PlacesUtils.bookmarks.createFolder(aFolderId, "test folder", -1);
- PlacesUtils.bookmarks.insertBookmark(folderId, PlacesUtils._uri("http://foo"), -1, "test bookmark");
- PlacesUtils.bookmarks.insertSeparator(folderId, -1);
-}
-
-function validate(aNode) {
- PlacesUtils.asContainer(aNode);
- aNode.containerOpen = true;
- is(aNode.childCount, 1, "confirm child count match");
- var folderNode = aNode.getChild(0);
- is(folderNode.title, "test folder", "confirm folder title");
- PlacesUtils.asContainer(folderNode);
- folderNode.containerOpen = true;
- is(folderNode.childCount, 2, "confirm child count match");
- var bookmarkNode = folderNode.getChild(0);
- var separatorNode = folderNode.getChild(1);
- folderNode.containerOpen = false;
- aNode.containerOpen = false;
-}
diff --git a/browser/components/places/tests/browser/browser_475045.js b/browser/components/places/tests/browser/browser_475045.js
deleted file mode 100644
index e8ca50278..000000000
--- a/browser/components/places/tests/browser/browser_475045.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-// Instead of loading ChromeUtils.js into the test scope in browser-test.js for all tests,
-// we only need ChromeUtils.js for a few files which is why we are using loadSubScript.
-var ChromeUtils = {};
-this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
-this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
-function test() {
- // Make sure the bookmarks bar is visible and restore its state on cleanup.
- let toolbar = document.getElementById("PersonalToolbar");
- ok(toolbar, "PersonalToolbar should not be null");
-
- if (toolbar.collapsed) {
- setToolbarVisibility(toolbar, true);
- registerCleanupFunction(function() {
- setToolbarVisibility(toolbar, false);
- });
- }
-
- // Setup the node we will use to be dropped. The actual node used does not
- // matter because we will set its data, effect, and mimeType manually.
- let placesItems = document.getElementById("PlacesToolbarItems");
- ok(placesItems, "PlacesToolbarItems should not be null");
- ok(placesItems.localName == "scrollbox", "PlacesToolbarItems should not be null");
- ok(placesItems.childNodes[0], "PlacesToolbarItems must have at least one child");
-
- /**
- * Simulates a drop of a URI onto the bookmarks bar.
- *
- * @param aEffect
- * The effect to use for the drop operation: move, copy, or link.
- * @param aMimeType
- * The mime type to use for the drop operation.
- */
- let simulateDragDrop = function(aEffect, aMimeType) {
- const uriSpec = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
- let uri = makeURI(uriSpec);
- ChromeUtils.synthesizeDrop(placesItems.childNodes[0],
- placesItems,
- [[{type: aMimeType,
- data: uriSpec}]],
- aEffect, window);
-
- // Verify that the drop produces exactly one bookmark.
- let bookmarkIds = PlacesUtils.bookmarks
- .getBookmarkIdsForURI(uri);
- ok(bookmarkIds.length == 1, "There should be exactly one bookmark");
-
- PlacesUtils.bookmarks.removeItem(bookmarkIds[0]);
-
- // Verify that we removed the bookmark successfully.
- ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed");
- }
-
- // Simulate a bookmark drop for all of the mime types and effects.
- let mimeTypes = ["text/plain", "text/unicode", "text/x-moz-url"];
- let effects = ["move", "copy", "link"];
- effects.forEach(function (effect) {
- mimeTypes.forEach(function (mimeType) {
- simulateDragDrop(effect, mimeType);
- });
- });
-}
diff --git a/browser/components/places/tests/browser/browser_555547.js b/browser/components/places/tests/browser/browser_555547.js
deleted file mode 100644
index 42deecbb7..000000000
--- a/browser/components/places/tests/browser/browser_555547.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function test() {
- waitForExplicitFinish();
-
- let sidebarBox = document.getElementById("sidebar-box");
- is(sidebarBox.hidden, true, "The sidebar should be hidden");
-
- // Uncollapse the personal toolbar if needed.
- let toolbar = document.getElementById("PersonalToolbar");
- let wasCollapsed = toolbar.collapsed;
- if (wasCollapsed)
- setToolbarVisibility(toolbar, true);
-
- let sidebar = document.getElementById("sidebar");
- sidebar.addEventListener("load", function() {
- sidebar.removeEventListener("load", arguments.callee, true);
- let tree = sidebar.contentDocument.getElementById("bookmarks-view");
-
- // The Places view is build on load, so we enqueue our test.
- executeSoon(function() {
- // Focus the tree and check if its controller is returned.
- tree.focus();
-
- let controller = doGetPlacesControllerForCommand("placesCmd_copy");
- let treeController = tree.controllers
- .getControllerForCommand("placesCmd_copy");
- ok(controller == treeController, "tree controller was returned");
-
- // Open the context menu for a toolbar item, and check if the toolbar's
- // controller is returned.
- let toolbarItems = document.getElementById("PlacesToolbarItems");
- EventUtils.synthesizeMouse(toolbarItems.childNodes[0],
- 4, 4, { type: "contextmenu", button: 2 },
- window);
- controller = doGetPlacesControllerForCommand("placesCmd_copy");
- let toolbarController = document.getElementById("PlacesToolbar")
- .controllers
- .getControllerForCommand("placesCmd_copy");
- ok(controller == toolbarController, "the toolbar controller was returned");
-
- document.getElementById("placesContext").hidePopup();
-
- // Now that the context menu is closed, try to get the tree controller again.
- tree.focus();
- controller = doGetPlacesControllerForCommand("placesCmd_copy");
- ok(controller == treeController, "tree controller was returned");
-
- toggleSidebar();
- if (wasCollapsed)
- setToolbarVisibility(toolbar, false);
-
- finish();
- });
- }, true);
- toggleSidebar("viewBookmarksSidebar", true);
-}
diff --git a/browser/components/places/tests/browser/browser_bookmarksProperties.js b/browser/components/places/tests/browser/browser_bookmarksProperties.js
deleted file mode 100644
index 46bf5272f..000000000
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ /dev/null
@@ -1,601 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests the bookmarks Properties dialog.
- */
-
-// DOM ids of Places sidebar trees.
-const SIDEBAR_HISTORY_TREE_ID = "historyTree";
-const SIDEBAR_BOOKMARKS_TREE_ID = "bookmarks-view";
-
-const SIDEBAR_HISTORY_ID = "viewHistorySidebar";
-const SIDEBAR_BOOKMARKS_ID = "viewBookmarksSidebar";
-
-// For history sidebar.
-const SIDEBAR_HISTORY_BYLASTVISITED_VIEW = "bylastvisited";
-const SIDEBAR_HISTORY_BYMOSTVISITED_VIEW = "byvisited";
-const SIDEBAR_HISTORY_BYDATE_VIEW = "byday";
-const SIDEBAR_HISTORY_BYSITE_VIEW = "bysite";
-const SIDEBAR_HISTORY_BYDATEANDSITE_VIEW = "bydateandsite";
-
-// Action to execute on the current node.
-const ACTION_EDIT = 0;
-const ACTION_ADD = 1;
-
-// If action is ACTION_ADD, set type to one of those, to define what do you
-// want to create.
-const TYPE_FOLDER = 0;
-const TYPE_BOOKMARK = 1;
-
-const TEST_URL = "http://www.example.com/";
-
-const DIALOG_URL = "chrome://browser/content/places/bookmarkProperties.xul";
-const DIALOG_URL_MINIMAL_UI = "chrome://browser/content/places/bookmarkProperties2.xul";
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Ci.nsIWindowWatcher);
-
-function add_bookmark(aURI) {
- var bId = PlacesUtils.bookmarks
- .insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- aURI,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "bookmark/" + aURI.spec);
- return bId;
-}
-
-// Each test is an obj w/ a desc property and run method.
-var gTests = [];
-var gCurrentTest = null;
-
-//------------------------------------------------------------------------------
-// TEST SKELETON: use this template to add new tests.
-/*
-gTests.push({
- desc: "Bug Description",
- sidebar: SIDEBAR_BOOKMARKS_ID, // See SIDEBAR_ constants above.
- action: ACTION_EDIT, // See ACTION_ constants above.
- itemType: null, // See TYPE_ constants above, required for ACTION_ADD, only for Bookmarks sidebar.
- historyView: SIDEBAR_HISTORY_BYLASTVISITED_VIEW, // See constants above, only for History sidebar.
- window: null, // Will contain handle of dialog window
-
- setup: function(aCallback) {
- // Setup everything needed for this test, runs before everything else.
- aCallback();
- },
-
- selectNode: function(tree) {
- // Select the node to edit or to add to, runs when sidebar tree is visible.
- },
-
- run: function() {
- // Actual test, runs when dialog is open.
- },
-
- finish: function() {
- // Close window, toggle sidebar and goto next test.
- this.window.document.documentElement.cancelDialog();
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- // Undo everything added during setup, runs after dialog has been closed.
- }
-});
-*/
-
-//------------------------------------------------------------------------------
-// Bug 479348 - Properties on a root should be read-only
-
-gTests.push({
- desc: "Bug 479348 - Properties on a root should be read-only",
- sidebar: SIDEBAR_BOOKMARKS_ID,
- action: ACTION_EDIT,
- itemType: null,
- window: null,
-
- setup: function(aCallback) {
- // Nothing to do.
- aCallback();
- },
-
- selectNode: function(tree) {
- // Select Unfiled Bookmarks root.
- var itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
- tree.selectItems([itemId]);
- this.selectedNode = tree.selectedNode;
- },
-
- run: function() {
- // Check that the dialog is read-only.
- ok(this.window.BookmarkPropertiesPanel._readOnly, "Dialog is read-only");
-
- // Check that accept button is disabled
- var acceptButton = this.window.document.documentElement.getButton("accept");
- ok(acceptButton.disabled, "Accept button is disabled");
-
- // Check that name picker is read only
- var namepicker = this.window.document.getElementById("editBMPanel_namePicker");
- ok(namepicker.readOnly, "Name field is disabled");
- is(namepicker.value,
- PlacesUtils.bookmarks.getItemTitle(PlacesUtils.unfiledBookmarksFolderId),
- "Node title is correct");
- // Blur the field and ensure root's name has not been changed.
- this.window.gEditItemOverlay.onNamePickerChange();
- is(namepicker.value,
- PlacesUtils.bookmarks.getItemTitle(PlacesUtils.unfiledBookmarksFolderId),
- "Root title is correct");
- // Check the shortcut's title.
- is(PlacesUtils.bookmarks.getItemTitle(this.selectedNode.itemId), null,
- "Shortcut title is null");
- this.finish();
- },
-
- finish: function() {
- this.window.document.documentElement.cancelDialog();
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- // Nothing to do.
- }
-});
-
-//------------------------------------------------------------------------------
-// Bug 462662 - Pressing Enter to select tag from autocomplete closes bookmarks properties dialog
-
-gTests.push({
- desc: "Bug 462662 - Pressing Enter to select tag from autocomplete closes bookmarks properties dialog",
- sidebar: SIDEBAR_BOOKMARKS_ID,
- action: ACTION_EDIT,
- itemType: null,
- window: null,
- _itemId: null,
- _cleanShutdown: false,
-
- setup: function(aCallback) {
- // Add a bookmark in unsorted bookmarks folder.
- this._itemId = add_bookmark(PlacesUtils._uri(TEST_URL));
- ok(this._itemId > 0, "Correctly added a bookmark");
- // Add a tag to this bookmark.
- PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
- ["testTag"]);
- var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
- is(tags[0], "testTag", "Correctly added a tag");
- aCallback();
- },
-
- selectNode: function(tree) {
- tree.selectItems([this._itemId]);
- is(tree.selectedNode.itemId, this._itemId, "Bookmark has been selected");
- },
-
- run: function() {
- // open tags autocomplete and press enter
- var tagsField = this.window.document.getElementById("editBMPanel_tagsField");
- var self = this;
-
- this.window.addEventListener("unload", function(event) {
- self.window.removeEventListener("unload", arguments.callee, true);
- tagsField.popup.removeEventListener("popuphidden", popupListener, true);
- ok(self._cleanShutdown, "Dialog window should not be closed by pressing Enter on the autocomplete popup");
- executeSoon(function () {
- self.finish();
- });
- }, true);
-
- var popupListener = {
- handleEvent: function(aEvent) {
- switch (aEvent.type) {
- case "popuphidden":
- // Everything worked fine, we can stop observing the window.
- self._cleanShutdown = true;
- self.window.document.documentElement.cancelDialog();
- break;
- case "popupshown":
- tagsField.popup.removeEventListener("popupshown", this, true);
- // In case this test fails the window will close, the test will fail
- // since we didn't set _cleanShutdown.
- var tree = tagsField.popup.tree;
- // Focus and select first result.
- isnot(tree, null, "Autocomplete results tree exists");
- is(tree.view.rowCount, 1, "We have 1 autocomplete result");
- tagsField.popup.selectedIndex = 0;
- is(tree.view.selection.count, 1,
- "We have selected a tag from the autocomplete popup");
- info("About to focus the autocomplete results tree");
- tree.focus();
- EventUtils.synthesizeKey("VK_RETURN", {}, self.window);
- break;
- default:
- ok(false, "unknown event: " + aEvent.type);
- return;
- }
- }
- };
- tagsField.popup.addEventListener("popupshown", popupListener, true);
- tagsField.popup.addEventListener("popuphidden", popupListener, true);
-
- // Open tags autocomplete popup.
- info("About to focus the tagsField");
- tagsField.focus();
- tagsField.value = "";
- EventUtils.synthesizeKey("t", {}, this.window);
- },
-
- finish: function() {
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- // Check tags have not changed.
- var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
- is(tags[0], "testTag", "Tag on node has not changed");
-
- // Cleanup.
- PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL), ["testTag"]);
- PlacesUtils.bookmarks.removeItem(this._itemId);
- }
-});
-
-//------------------------------------------------------------------------------
-// Bug 475529 - Add button in new folder dialog not default anymore
-
-gTests.push({
- desc: "Bug 475529 - Add button in new folder dialog not default anymore",
- sidebar: SIDEBAR_BOOKMARKS_ID,
- action: ACTION_ADD,
- itemType: TYPE_FOLDER,
- window: null,
- _itemId: null,
-
- setup: function(aCallback) {
- // Nothing to do.
- aCallback();
- },
-
- selectNode: function(tree) {
- // Select Unfiled Bookmarks root.
- var itemId = PlacesUIUtils.leftPaneQueries["UnfiledBookmarks"];
- tree.selectItems([itemId]);
- this.selectedNode = tree.selectedNode;
- },
-
- run: function() {
- this._itemId = this.window.gEditItemOverlay._itemId;
- // Change folder name
- var namePicker = this.window.document.getElementById("editBMPanel_namePicker");
- var self = this;
-
- this.window.addEventListener("unload", function(event) {
- self.window.removeEventListener("unload", arguments.callee, false);
- executeSoon(function () {
- self.finish();
- });
- }, false);
-
- namePicker.value = "n";
- info("About to focus the namePicker field");
- namePicker.focus();
- EventUtils.synthesizeKey("VK_RETURN", {}, this.window);
- },
-
- finish: function() {
- // Window is already closed.
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- // Check that folder name has been changed.
- is(PlacesUtils.bookmarks.getItemTitle(this._itemId), "n",
- "Folder name has been edited");
-
- // Cleanup.
- PlacesUtils.bookmarks.removeItem(this._itemId);
- }
-});
-
-//------------------------------------------------------------------------------
-// Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel
-
-gTests.push({
- desc: "Bug 476020 - Pressing Esc while having the tag autocomplete open closes the bookmarks panel",
- sidebar: SIDEBAR_BOOKMARKS_ID,
- action: ACTION_EDIT,
- itemType: null,
- window: null,
- _itemId: null,
- _cleanShutdown: false,
-
- setup: function(aCallback) {
- // Add a bookmark in unsorted bookmarks folder.
- this._itemId = add_bookmark(PlacesUtils._uri(TEST_URL));
- ok(this._itemId > 0, "Correctly added a bookmark");
- // Add a tag to this bookmark.
- PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL),
- ["testTag"]);
- var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
- is(tags[0], "testTag", "Correctly added a tag");
- aCallback();
- },
-
- selectNode: function(tree) {
- tree.selectItems([this._itemId]);
- is(tree.selectedNode.itemId, this._itemId, "Bookmark has been selected");
- },
-
- run: function() {
- // open tags autocomplete and press enter
- var tagsField = this.window.document.getElementById("editBMPanel_tagsField");
- var self = this;
-
- this.window.addEventListener("unload", function(event) {
- self.window.removeEventListener("unload", arguments.callee, true);
- tagsField.popup.removeEventListener("popuphidden", popupListener, true);
- ok(self._cleanShutdown, "Dialog window should not be closed by pressing Escape on the autocomplete popup");
- executeSoon(function () {
- self.finish();
- });
- }, true);
-
- var popupListener = {
- handleEvent: function(aEvent) {
- switch (aEvent.type) {
- case "popuphidden":
- // Everything worked fine.
- self._cleanShutdown = true;
- self.window.document.documentElement.cancelDialog();
- break;
- case "popupshown":
- tagsField.popup.removeEventListener("popupshown", this, true);
- // In case this test fails the window will close, the test will fail
- // since we didn't set _cleanShutdown.
- var tree = tagsField.popup.tree;
- // Focus and select first result.
- isnot(tree, null, "Autocomplete results tree exists");
- is(tree.view.rowCount, 1, "We have 1 autocomplete result");
- tagsField.popup.selectedIndex = 0;
- is(tree.view.selection.count, 1,
- "We have selected a tag from the autocomplete popup");
- info("About to focus the autocomplete results tree");
- tree.focus();
- EventUtils.synthesizeKey("VK_ESCAPE", {}, self.window);
- break;
- default:
- ok(false, "unknown event: " + aEvent.type);
- return;
- }
- }
- };
- tagsField.popup.addEventListener("popupshown", popupListener, true);
- tagsField.popup.addEventListener("popuphidden", popupListener, true);
-
- // Open tags autocomplete popup.
- info("About to focus the tagsField");
- tagsField.focus();
- tagsField.value = "";
- EventUtils.synthesizeKey("t", {}, this.window);
- },
-
- finish: function() {
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- // Check tags have not changed.
- var tags = PlacesUtils.tagging.getTagsForURI(PlacesUtils._uri(TEST_URL));
- is(tags[0], "testTag", "Tag on node has not changed");
-
- // Cleanup.
- PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL),
- ["testTag"]);
- PlacesUtils.bookmarks.removeItem(this._itemId);
- }
-});
-
-//------------------------------------------------------------------------------
-// Bug 491269 - Test that editing folder name in bookmarks properties dialog does not accept the dialog
-
-gTests.push({
- desc: " Bug 491269 - Test that editing folder name in bookmarks properties dialog does not accept the dialog",
- sidebar: SIDEBAR_HISTORY_ID,
- action: ACTION_ADD,
- historyView: SIDEBAR_HISTORY_BYLASTVISITED_VIEW,
- window: null,
-
- setup: function(aCallback) {
- // Add a visit.
- addVisits(
- {uri: PlacesUtils._uri(TEST_URL),
- transition: PlacesUtils.history.TRANSITION_TYPED},
- window,
- aCallback);
- },
-
- selectNode: function(tree) {
- var visitNode = tree.view.nodeForTreeIndex(0);
- tree.selectNode(visitNode);
- is(tree.selectedNode.uri, TEST_URL, "The correct visit has been selected");
- is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
- },
-
- run: function() {
- // Open folder selector.
- var foldersExpander = this.window.document.getElementById("editBMPanel_foldersExpander");
- var folderTree = this.window.document.getElementById("editBMPanel_folderTree");
- var self = this;
-
- this.window.addEventListener("unload", function(event) {
- self.window.removeEventListener("unload", arguments.callee, true);
- ok(self._cleanShutdown, "Dialog window should not be closed by pressing ESC in folder name textbox");
- executeSoon(function () {
- self.finish();
- });
- }, true);
-
- folderTree.addEventListener("DOMAttrModified", function onDOMAttrModified(event) {
- if (event.attrName != "place")
- return;
- folderTree.removeEventListener("DOMAttrModified", arguments.callee, false);
- executeSoon(function () {
- // Create a new folder.
- var newFolderButton = self.window.document.getElementById("editBMPanel_newFolderButton");
- newFolderButton.doCommand();
- ok(folderTree.hasAttribute("editing"),
- "We are editing new folder name in folder tree");
-
- // Press Escape to discard editing new folder name.
- EventUtils.synthesizeKey("VK_ESCAPE", {}, self.window);
- ok(!folderTree.hasAttribute("editing"),
- "We have finished editing folder name in folder tree");
- self._cleanShutdown = true;
- self.window.document.documentElement.cancelDialog();
- });
- }, false);
- foldersExpander.doCommand();
- },
-
- finish: function() {
- toggleSidebar(this.sidebar, false);
- runNextTest();
- },
-
- cleanup: function() {
- var bh = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
- bh.removeAllPages();
- }
-});
-
-//------------------------------------------------------------------------------
-
-function test() {
- waitForExplicitFinish();
- // This test can take some time, if we timeout too early it could run
- // in the middle of other tests, or hang them.
- requestLongerTimeout(2);
-
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils in context");
- ok(PlacesUIUtils, "PlacesUIUtils in context");
-
- // kick off tests
- runNextTest();
-}
-
-function runNextTest() {
- // Cleanup from previous test.
- if (gCurrentTest) {
- gCurrentTest.cleanup();
- info("End of test: " + gCurrentTest.desc);
- gCurrentTest = null;
- waitForAsyncUpdates(runNextTest);
- return;
- }
-
- if (gTests.length > 0) {
- // Goto next tests.
- gCurrentTest = gTests.shift();
- info("Start of test: " + gCurrentTest.desc);
- gCurrentTest.setup(function() {
- execute_test_in_sidebar();
- });
- }
- else {
- // Finished all tests.
- finish();
- }
-}
-
-/**
- * Global functions to run a test in Properties dialog context.
- */
-
-function execute_test_in_sidebar() {
- var sidebar = document.getElementById("sidebar");
- sidebar.addEventListener("load", function() {
- sidebar.removeEventListener("load", arguments.callee, true);
- // Need to executeSoon since the tree is initialized on sidebar load.
- executeSoon(open_properties_dialog);
- }, true);
- toggleSidebar(gCurrentTest.sidebar, true);
-}
-
-function open_properties_dialog() {
- var sidebar = document.getElementById("sidebar");
-
- // If this is history sidebar, set the required view.
- if (gCurrentTest.sidebar == SIDEBAR_HISTORY_ID)
- sidebar.contentDocument.getElementById(gCurrentTest.historyView).doCommand();
-
- // Get sidebar's Places tree.
- var sidebarTreeID = gCurrentTest.sidebar == SIDEBAR_BOOKMARKS_ID ?
- SIDEBAR_BOOKMARKS_TREE_ID :
- SIDEBAR_HISTORY_TREE_ID;
- var tree = sidebar.contentDocument.getElementById(sidebarTreeID);
- ok(tree, "Sidebar tree has been loaded");
-
- // Ask current test to select the node to edit.
- gCurrentTest.selectNode(tree);
- ok(tree.selectedNode,
- "We have a places node selected: " + tree.selectedNode.title);
-
- // Wait for the Properties dialog.
- function windowObserver(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
- ww.unregisterNotification(windowObserver);
- var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("focus", function (event) {
- win.removeEventListener("focus", arguments.callee, false);
- // Windows has been loaded, execute our test now.
- executeSoon(function () {
- // Ensure overlay is loaded
- ok(win.gEditItemOverlay._initialized, "EditItemOverlay is initialized");
- gCurrentTest.window = win;
- try {
- gCurrentTest.run();
- } catch (ex) {
- ok(false, "An error occured during test run: " + ex.message);
- }
- });
- }, false);
- }
- ww.registerNotification(windowObserver);
-
- var command = null;
- switch (gCurrentTest.action) {
- case ACTION_EDIT:
- command = "placesCmd_show:info";
- break;
- case ACTION_ADD:
- if (gCurrentTest.sidebar == SIDEBAR_BOOKMARKS_ID) {
- if (gCurrentTest.itemType == TYPE_FOLDER)
- command = "placesCmd_new:folder";
- else if (gCurrentTest.itemType == TYPE_BOOKMARK)
- command = "placesCmd_new:bookmark";
- else
- ok(false, "You didn't set a valid itemType for adding an item");
- }
- else
- command = "placesCmd_createBookmark";
- break;
- default:
- ok(false, "You didn't set a valid action for this test");
- }
- // Ensure command is enabled for this node.
- ok(tree.controller.isCommandEnabled(command),
- " command '" + command + "' on current selected node is enabled");
-
- // This will open the dialog.
- tree.controller.doCommand(command);
-}
diff --git a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
deleted file mode 100644
index 699c99127..000000000
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ /dev/null
@@ -1,255 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URL = "http://www.mozilla.org";
-const TEST_TITLE = "example_title";
-
-var gBookmarksToolbar = window.document.getElementById("PlacesToolbar");
-var dragDirections = { LEFT: 0, UP: 1, RIGHT: 2, DOWN: 3 };
-
-/**
- * Tests dragging on toolbar.
- *
- * We must test these 2 cases:
- * - Dragging toward left, top, right should start a drag.
- * - Dragging toward down should should open the container if the item is a
- * container, drag the item otherwise.
- *
- * @param aElement
- * DOM node element we will drag
- * @param aExpectedDragData
- * Array of flavors and values in the form:
- * [ ["text/plain: sometext", "text/html: <b>sometext</b>"], [...] ]
- * Pass an empty array to check that drag even has been canceled.
- * @param aDirection
- * Direction for the dragging gesture, see dragDirections helper object.
- */
-function synthesizeDragWithDirection(aElement, aExpectedDragData, aDirection, aCallback) {
- // Dragstart listener function.
- gBookmarksToolbar.addEventListener("dragstart", function(event)
- {
- info("A dragstart event has been trapped.");
- var dataTransfer = event.dataTransfer;
- is(dataTransfer.mozItemCount, aExpectedDragData.length,
- "Number of dragged items should be the same.");
-
- for (var t = 0; t < dataTransfer.mozItemCount; t++) {
- var types = dataTransfer.mozTypesAt(t);
- var expecteditem = aExpectedDragData[t];
- is(types.length, expecteditem.length,
- "Number of flavors for item " + t + " should be the same.");
-
- for (var f = 0; f < types.length; f++) {
- is(types[f], expecteditem[f].substring(0, types[f].length),
- "Flavor " + types[f] + " for item " + t + " should be the same.");
- is(dataTransfer.mozGetDataAt(types[f], t),
- expecteditem[f].substring(types[f].length + 2),
- "Contents for item " + t + " with flavor " + types[f] + " should be the same.");
- }
- }
-
- if (!aExpectedDragData.length)
- ok(event.defaultPrevented, "Drag has been canceled.");
-
- event.preventDefault();
- event.stopPropagation();
-
- gBookmarksToolbar.removeEventListener("dragstart", arguments.callee, false);
-
- // This is likely to cause a click event, and, in case we are dragging a
- // bookmark, an unwanted page visit. Prevent the click event.
- aElement.addEventListener("click", prevent, false);
- EventUtils.synthesizeMouse(aElement,
- startingPoint.x + xIncrement * 9,
- startingPoint.y + yIncrement * 9,
- { type: "mouseup" });
- aElement.removeEventListener("click", prevent, false);
-
- // Cleanup eventually opened menus.
- if (aElement.localName == "menu" && aElement.open)
- aElement.open = false;
- aCallback()
- }, false);
-
- var prevent = function(aEvent) {aEvent.preventDefault();}
-
- var xIncrement = 0;
- var yIncrement = 0;
-
- switch (aDirection) {
- case dragDirections.LEFT:
- xIncrement = -1;
- break;
- case dragDirections.RIGHT:
- xIncrement = +1;
- break;
- case dragDirections.UP:
- yIncrement = -1;
- break;
- case dragDirections.DOWN:
- yIncrement = +1;
- break;
- }
-
- var rect = aElement.getBoundingClientRect();
- var startingPoint = { x: (rect.right - rect.left)/2,
- y: (rect.bottom - rect.top)/2 };
-
- EventUtils.synthesizeMouse(aElement,
- startingPoint.x,
- startingPoint.y,
- { type: "mousedown" });
- EventUtils.synthesizeMouse(aElement,
- startingPoint.x + xIncrement * 1,
- startingPoint.y + yIncrement * 1,
- { type: "mousemove" });
- EventUtils.synthesizeMouse(aElement,
- startingPoint.x + xIncrement * 9,
- startingPoint.y + yIncrement * 9,
- { type: "mousemove" });
-}
-
-function getToolbarNodeForItemId(aItemId) {
- var children = document.getElementById("PlacesToolbarItems").childNodes;
- var node = null;
- for (var i = 0; i < children.length; i++) {
- if (aItemId == children[i]._placesNode.itemId) {
- node = children[i];
- break;
- }
- }
- return node;
-}
-
-function getExpectedDataForPlacesNode(aNode) {
- var wrappedNode = [];
- var flavors = ["text/x-moz-place",
- "text/x-moz-url",
- "text/plain",
- "text/html"];
-
- flavors.forEach(function(aFlavor) {
- var wrappedFlavor = aFlavor + ": " +
- PlacesUtils.wrapNode(aNode, aFlavor);
- wrappedNode.push(wrappedFlavor);
- });
-
- return [wrappedNode];
-}
-
-var gTests = [
-
-//------------------------------------------------------------------------------
-
- {
- desc: "Drag a folder on toolbar",
- run: function() {
- // Create a test folder to be dragged.
- var folderId = PlacesUtils.bookmarks
- .createFolder(PlacesUtils.toolbarFolderId,
- TEST_TITLE,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- var element = getToolbarNodeForItemId(folderId);
- isnot(element, null, "Found node on toolbar");
-
- isnot(element._placesNode, null, "Toolbar node has an associated Places node.");
- var expectedData = getExpectedDataForPlacesNode(element._placesNode);
-
- info("Dragging left");
- synthesizeDragWithDirection(element, expectedData, dragDirections.LEFT,
- function ()
- {
- info("Dragging right");
- synthesizeDragWithDirection(element, expectedData, dragDirections.RIGHT,
- function ()
- {
- info("Dragging up");
- synthesizeDragWithDirection(element, expectedData, dragDirections.UP,
- function ()
- {
- info("Dragging down");
- synthesizeDragWithDirection(element, new Array(), dragDirections.DOWN,
- function () {
- // Cleanup.
- PlacesUtils.bookmarks.removeItem(folderId);
- nextTest();
- });
- });
- });
- });
- }
- },
-
-//------------------------------------------------------------------------------
-
- {
- desc: "Drag a bookmark on toolbar",
- run: function() {
- // Create a test bookmark to be dragged.
- var itemId = PlacesUtils.bookmarks
- .insertBookmark(PlacesUtils.toolbarFolderId,
- PlacesUtils._uri(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- TEST_TITLE);
- var element = getToolbarNodeForItemId(itemId);
- isnot(element, null, "Found node on toolbar");
-
- isnot(element._placesNode, null, "Toolbar node has an associated Places node.");
- var expectedData = getExpectedDataForPlacesNode(element._placesNode);
-
- info("Dragging left");
- synthesizeDragWithDirection(element, expectedData, dragDirections.LEFT,
- function ()
- {
- info("Dragging right");
- synthesizeDragWithDirection(element, expectedData, dragDirections.RIGHT,
- function ()
- {
- info("Dragging up");
- synthesizeDragWithDirection(element, expectedData, dragDirections.UP,
- function ()
- {
- info("Dragging down");
- synthesizeDragWithDirection(element, expectedData, dragDirections.DOWN,
- function () {
- // Cleanup.
- PlacesUtils.bookmarks.removeItem(itemId);
- nextTest();
- });
- });
- });
- });
- }
- },
-];
-
-function nextTest() {
- if (gTests.length) {
- var test = gTests.shift();
- waitForFocus(function() {
- info("Start of test: " + test.desc);
- test.run();
- });
- }
- else {
- // Collapse the personal toolbar if needed.
- if (wasCollapsed)
- setToolbarVisibility(toolbar, false);
- finish();
- }
-}
-
-let toolbar = document.getElementById("PersonalToolbar");
-let wasCollapsed = toolbar.collapsed;
-
-function test() {
- waitForExplicitFinish();
-
- // Uncollapse the personal toolbar if needed.
- if (wasCollapsed)
- setToolbarVisibility(toolbar, true);
-
- nextTest();
-}
-
diff --git a/browser/components/places/tests/browser/browser_forgetthissite_single.js b/browser/components/places/tests/browser/browser_forgetthissite_single.js
deleted file mode 100644
index 57451ccc8..000000000
--- a/browser/components/places/tests/browser/browser_forgetthissite_single.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the Forget This Site command is hidden for multiple
-// selections.
-function test() {
- // initialization
- waitForExplicitFinish();
-
- // Add a history entry.
- let TEST_URIs = ["http://www.mozilla.org/test1", "http://www.mozilla.org/test2"];
- ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
- let places = [];
- TEST_URIs.forEach(function(TEST_URI) {
- places.push({uri: PlacesUtils._uri(TEST_URI),
- transition: PlacesUtils.history.TRANSITION_TYPED});
- });
- addVisits(places, window, function() {
- testForgetThisSiteVisibility(1, function() {
- testForgetThisSiteVisibility(2, function() {
- // Cleanup
- waitForClearHistory(finish);
- });
- });
- });
-
- function testForgetThisSiteVisibility(selectionCount, funcNext) {
- openLibrary(function (organizer) {
- // Select History in the left pane.
- organizer.PlacesOrganizer.selectLeftPaneQuery('History');
- let PO = organizer.PlacesOrganizer;
- let histContainer = PO._places.selectedNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
- histContainer.containerOpen = true;
- PO._places.selectNode(histContainer.getChild(0));
- // Select the first history entry.
- let doc = organizer.document;
- let tree = PO._content;
- let selection = tree.view.selection;
- selection.clearSelection();
- selection.rangedSelect(0, selectionCount - 1, true);
- is(selection.count, selectionCount,
- "The selected range is as big as expected");
- // Open the context menu
- let contextmenu = doc.getElementById("placesContext");
- contextmenu.addEventListener("popupshown", function() {
- contextmenu.removeEventListener("popupshown", arguments.callee, true);
- let forgetThisSite = doc.getElementById("placesContext_deleteHost");
- let hideForgetThisSite = (selectionCount != 1);
- is(forgetThisSite.hidden, hideForgetThisSite,
- "The Forget this site menu item should " + (hideForgetThisSite ? "" : "not ") +
- "be hidden with " + selectionCount + " items selected");
- // Close the context menu
- contextmenu.hidePopup();
- // Wait for the Organizer window to actually be closed
- organizer.addEventListener("unload", function () {
- organizer.removeEventListener("unload", arguments.callee, false);
- // Proceed
- funcNext();
- }, false);
- // Close Library window.
- organizer.close();
- }, true);
- // Get cell coordinates
- var x = {}, y = {}, width = {}, height = {};
- tree.treeBoxObject.getCoordsForCellItem(0, tree.columns[0], "text",
- x, y, width, height);
- // Initiate a context menu for the selected cell
- EventUtils.synthesizeMouse(tree.body, x.value + width.value / 2, y.value + height.value / 2, {type: "contextmenu"}, organizer);
- });
- }
-}
-
diff --git a/browser/components/places/tests/browser/browser_history_sidebar_search.js b/browser/components/places/tests/browser/browser_history_sidebar_search.js
deleted file mode 100644
index 93e5305bb..000000000
--- a/browser/components/places/tests/browser/browser_history_sidebar_search.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Bug 392497 - search in history sidebar loses sort
- */
-
-var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-var bh = hs.QueryInterface(Ci.nsIBrowserHistory);
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
-function uri(spec) {
- return ios.newURI(spec, null, null);
-}
-
-var sidebar = document.getElementById("sidebar");
-
-// Visited pages listed by descending visit date.
-var pages = [
- "http://sidebar.mozilla.org/a",
- "http://sidebar.mozilla.org/b",
- "http://sidebar.mozilla.org/c",
- "http://www.mozilla.org/d",
-];
-// Number of pages that will be filtered out by the search.
-const FILTERED_COUNT = 1;
-
-function test() {
- waitForExplicitFinish();
-
- // Cleanup.
- waitForClearHistory(continue_test);
-}
-
-function continue_test() {
- // Add some visited page.
- var time = Date.now();
- var pagesLength = pages.length;
- var places = [];
- for (var i = 0; i < pagesLength; i++) {
- places.push({uri: uri(pages[i]), visitDate: (time - i) * 1000,
- transition: hs.TRANSITION_TYPED});
- }
- addVisits(places, window, function() {
- toggleSidebar("viewHistorySidebar", true);
- });
-
- sidebar.addEventListener("load", function() {
- sidebar.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- // Set "by last visited" in the sidebar (sort by visit date descendind).
- sidebar.contentDocument.getElementById("bylastvisited").doCommand();
- check_sidebar_tree_order(pages.length);
- var searchBox = sidebar.contentDocument.getElementById("search-box");
- ok(searchBox, "search box is in context");
- searchBox.value = "sidebar.mozilla";
- searchBox.doCommand();
- check_sidebar_tree_order(pages.length - FILTERED_COUNT);
- searchBox.value = "";
- searchBox.doCommand();
- check_sidebar_tree_order(pages.length);
-
- // Cleanup.
- toggleSidebar("viewHistorySidebar", false);
- waitForClearHistory(finish);
- });
- }, true);
-}
-
-function check_sidebar_tree_order(aExpectedRows) {
- var tree = sidebar.contentDocument.getElementById("historyTree");
- var treeView = tree.view;
- var rc = treeView.rowCount;
- var columns = tree.columns;
- is(columns.count, 1, "There should be only 1 column in the sidebar");
- var found = 0;
- for (var r = 0; r < rc; r++) {
- var node = treeView.nodeForTreeIndex(r);
- // We could inherit visits from previous tests, skip them since they are
- // not interesting for us.
- if (pages.indexOf(node.uri) == -1)
- continue;
- is(node.uri, pages[r], "Node is in correct position based on its visit date");
- found++;
- }
- ok(found, aExpectedRows, "Found all expected results");
-}
diff --git a/browser/components/places/tests/browser/browser_library_batch_delete.js b/browser/components/places/tests/browser/browser_library_batch_delete.js
deleted file mode 100644
index 2a65b6b90..000000000
--- a/browser/components/places/tests/browser/browser_library_batch_delete.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that Library handles correctly batch deletes.
- */
-
-const TEST_URL = "http://www.batch.delete.me/";
-
-var gTests = [];
-var gLibrary;
-
-//------------------------------------------------------------------------------
-
-gTests.push({
- desc: "Create and batch remove bookmarks",
- run: function() {
- let testURI = makeURI(TEST_URL);
- PlacesUtils.history.runInBatchMode({
- runBatched: function (aUserData) {
- // Create a folder in unserted and populate it with bookmarks.
- let folder = PlacesUtils.bookmarks.createFolder(
- PlacesUtils.unfiledBookmarksFolderId, "deleteme",
- PlacesUtils.bookmarks.DEFAULT_INDEX
- );
- PlacesUtils.bookmarks.createFolder(
- PlacesUtils.unfiledBookmarksFolderId, "keepme",
- PlacesUtils.bookmarks.DEFAULT_INDEX
- );
- for (let i = 0; i < 10; i++) {
- PlacesUtils.bookmarks.insertBookmark(folder,
- testURI,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "bm" + i);
- }
- }
- }, null);
-
- // Select and open the left pane "History" query.
- let PO = gLibrary.PlacesOrganizer;
- PO.selectLeftPaneQuery("UnfiledBookmarks");
- isnot(PO._places.selectedNode, null, "Selected unsorted bookmarks");
-
- let unsortedNode = PlacesUtils.asContainer(PO._places.selectedNode);
- unsortedNode.containerOpen = true;
- is(unsortedNode.childCount, 2, "Unsorted node has 2 children");
- let folderNode = unsortedNode.getChild(0);
- is(folderNode.title, "deleteme", "Folder found in unsorted bookmarks");
- // Check delete command is available.
- PO._places.selectNode(folderNode);
- is(PO._places.selectedNode.title, "deleteme", "Folder node selected");
- ok(PO._places.controller.isCommandEnabled("cmd_delete"),
- "Delete command is enabled");
- // Execute the delete command and check bookmark has been removed.
- PO._places.controller.doCommand("cmd_delete");
- ok(!PlacesUtils.bookmarks.isBookmarked(testURI),
- "Bookmark has been correctly removed");
- // Test live update.
- is(unsortedNode.childCount, 1, "Unsorted node has 1 child");
- is(PO._places.selectedNode.title, "keepme", "Folder node selected");
- unsortedNode.containerOpen = false;
- nextTest();
- }
-});
-
-//------------------------------------------------------------------------------
-
-gTests.push({
- desc: "Ensure correct selection and functionality in Library",
- run: function() {
- let PO = gLibrary.PlacesOrganizer;
- let ContentTree = gLibrary.ContentTree;
- // Move selection forth and back.
- PO.selectLeftPaneQuery("History");
- PO.selectLeftPaneQuery("UnfiledBookmarks");
- // Now select the "keepme" folder in the right pane and delete it.
- ContentTree.view.selectNode(ContentTree.view.result.root.getChild(0));
- is(ContentTree.view.selectedNode.title, "keepme",
- "Found folder in content pane");
- // Test live update.
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- makeURI(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "bm");
- is(ContentTree.view.result.root.childCount, 2,
- "Right pane was correctly updated");
- nextTest();
- }
-});
-
-//------------------------------------------------------------------------------
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(function () {
- PlacesUtils.bookmarks
- .removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- });
-
- gLibrary = openLibrary(nextTest);
-}
-
-function nextTest() {
- if (gTests.length) {
- var test = gTests.shift();
- info("Start of test: " + test.desc);
- test.run();
- }
- else {
- // Close Library window.
- gLibrary.close();
- finish();
- }
-}
diff --git a/browser/components/places/tests/browser/browser_library_downloads.js b/browser/components/places/tests/browser/browser_library_downloads.js
deleted file mode 100644
index c761fa15c..000000000
--- a/browser/components/places/tests/browser/browser_library_downloads.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Tests bug 564900: Add folder specifically for downloads to Library left pane.
- * https://bugzilla.mozilla.org/show_bug.cgi?id=564900
- * This test visits various pages then opens the Library and ensures
- * that both the Downloads folder shows up and that the correct visits
- * are shown in it.
- */
-
-let now = Date.now();
-
-function test() {
- waitForExplicitFinish();
-
- let onLibraryReady = function(win) {
- // Add visits to compare contents with.
- let places = [
- { uri: NetUtil.newURI("http://mozilla.com"),
- visits: [ new VisitInfo(PlacesUtils.history.TRANSITION_TYPED) ]
- },
- { uri: NetUtil.newURI("http://google.com"),
- visits: [ new VisitInfo(PlacesUtils.history.TRANSITION_DOWNLOAD) ]
- },
- { uri: NetUtil.newURI("http://en.wikipedia.org"),
- visits: [ new VisitInfo(PlacesUtils.history.TRANSITION_TYPED) ]
- },
- { uri: NetUtil.newURI("http://ubuntu.org"),
- visits: [ new VisitInfo(PlacesUtils.history.TRANSITION_DOWNLOAD) ]
- },
- ]
- PlacesUtils.asyncHistory.updatePlaces(places, {
- handleResult: function () {},
- handleError: function () {
- ok(false, "gHistory.updatePlaces() failed");
- },
- handleCompletion: function () {
- // Make sure Downloads is present.
- isnot(win.PlacesOrganizer._places.selectedNode, null,
- "Downloads is present and selected");
-
-
- // Check results.
- let contentRoot = win.ContentArea.currentView.result.root;
- let len = contentRoot.childCount;
- const TEST_URIS = ["http://ubuntu.org/", "http://google.com/"];
- for (let i = 0; i < len; i++) {
- is(contentRoot.getChild(i).uri, TEST_URIS[i],
- "Comparing downloads shown at index " + i);
- }
-
- win.close();
- waitForClearHistory(finish);
- }
- })
- }
-
- openLibrary(onLibraryReady, "Downloads");
-}
-
-function VisitInfo(aTransitionType)
-{
- this.transitionType =
- aTransitionType === undefined ?
- PlacesUtils.history.TRANSITION_LINK : aTransitionType;
- this.visitDate = now++ * 1000;
-}
-VisitInfo.prototype = {}
diff --git a/browser/components/places/tests/browser/browser_library_infoBox.js b/browser/components/places/tests/browser/browser_library_infoBox.js
deleted file mode 100644
index 87561607f..000000000
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test appropriate visibility of infoBoxExpanderWrapper and
- * additionalInfoFields in infoBox section of library
- */
-
-const TEST_URI = "http://www.mozilla.org/";
-
-var gTests = [];
-var gLibrary;
-
-//------------------------------------------------------------------------------
-
-gTests.push({
- desc: "Bug 430148 - Remove or hide the more/less button in details pane...",
- run: function() {
- var PO = gLibrary.PlacesOrganizer;
- let ContentTree = gLibrary.ContentTree;
- var infoBoxExpanderWrapper = getAndCheckElmtById("infoBoxExpanderWrapper");
-
- function addVisitsCallback() {
- // open all bookmarks node
- PO.selectLeftPaneQuery("AllBookmarks");
- isnot(PO._places.selectedNode, null,
- "Correctly selected all bookmarks node.");
- checkInfoBoxSelected(PO);
- ok(infoBoxExpanderWrapper.hidden,
- "Expander button is hidden for all bookmarks node.");
- checkAddInfoFieldsCollapsed(PO);
-
- // open history node
- PO.selectLeftPaneQuery("History");
- isnot(PO._places.selectedNode, null, "Correctly selected history node.");
- checkInfoBoxSelected(PO);
- ok(infoBoxExpanderWrapper.hidden,
- "Expander button is hidden for history node.");
- checkAddInfoFieldsCollapsed(PO);
-
- // open history child node
- var historyNode = PO._places.selectedNode.
- QueryInterface(Ci.nsINavHistoryContainerResultNode);
- historyNode.containerOpen = true;
- var childNode = historyNode.getChild(0);
- isnot(childNode, null, "History node first child is not null.");
- PO._places.selectNode(childNode);
- checkInfoBoxSelected(PO);
- ok(infoBoxExpanderWrapper.hidden,
- "Expander button is hidden for history child node.");
- checkAddInfoFieldsCollapsed(PO);
-
- // open history item
- var view = ContentTree.view.treeBoxObject.view;
- ok(view.rowCount > 0, "History item exists.");
- view.selection.select(0);
- ok(infoBoxExpanderWrapper.hidden,
- "Expander button is hidden for history item.");
- checkAddInfoFieldsCollapsed(PO);
-
- historyNode.containerOpen = false;
-
- // open bookmarks menu node
- PO.selectLeftPaneQuery("BookmarksMenu");
- isnot(PO._places.selectedNode, null,
- "Correctly selected bookmarks menu node.");
- checkInfoBoxSelected(PO);
- ok(infoBoxExpanderWrapper.hidden,
- "Expander button is hidden for bookmarks menu node.");
- checkAddInfoFieldsCollapsed(PO);
-
- // open recently bookmarked node
- var menuNode = PO._places.selectedNode.
- QueryInterface(Ci.nsINavHistoryContainerResultNode);
- menuNode.containerOpen = true;
- childNode = menuNode.getChild(0);
- isnot(childNode, null, "Bookmarks menu child node exists.");
- var recentlyBookmarkedTitle = PlacesUIUtils.
- getString("recentlyBookmarkedTitle");
- isnot(recentlyBookmarkedTitle, null,
- "Correctly got the recently bookmarked title locale string.");
- is(childNode.title, recentlyBookmarkedTitle,
- "Correctly selected recently bookmarked node.");
- PO._places.selectNode(childNode);
- checkInfoBoxSelected(PO);
- ok(!infoBoxExpanderWrapper.hidden,
- "Expander button is not hidden for recently bookmarked node.");
- checkAddInfoFieldsNotCollapsed(PO);
-
- // open first bookmark
- var view = ContentTree.view.treeBoxObject.view;
- ok(view.rowCount > 0, "Bookmark item exists.");
- view.selection.select(0);
- checkInfoBoxSelected(PO);
- ok(!infoBoxExpanderWrapper.hidden,
- "Expander button is not hidden for bookmark item.");
- checkAddInfoFieldsNotCollapsed(PO);
- checkAddInfoFields(PO, "bookmark item");
-
- // make sure additional fields are still hidden in second bookmark item
- ok(view.rowCount > 1, "Second bookmark item exists.");
- view.selection.select(1);
- checkInfoBoxSelected(PO);
- ok(!infoBoxExpanderWrapper.hidden,
- "Expander button is not hidden for second bookmark item.");
- checkAddInfoFieldsNotCollapsed(PO);
- checkAddInfoFields(PO, "second bookmark item");
-
- menuNode.containerOpen = false;
-
- waitForClearHistory(nextTest);
- }
- // add a visit to browser history
- addVisits(
- { uri: PlacesUtils._uri(TEST_URI), visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_TYPED },
- window,
- addVisitsCallback);
- }
-});
-
-function checkInfoBoxSelected(PO) {
- is(getAndCheckElmtById("detailsDeck").selectedIndex, 1,
- "Selected element in detailsDeck is infoBox.");
-}
-
-function checkAddInfoFieldsCollapsed(PO) {
- PO._additionalInfoFields.forEach(function (id) {
- ok(getAndCheckElmtById(id).collapsed,
- "Additional info field correctly collapsed: #" + id);
- });
-}
-
-function checkAddInfoFieldsNotCollapsed(PO) {
- ok(PO._additionalInfoFields.some(function (id) {
- return !getAndCheckElmtById(id).collapsed;
- }), "Some additional info field correctly not collapsed");
-}
-
-function checkAddInfoFields(PO, nodeName) {
- ok(true, "Checking additional info fields visibiity for node: " + nodeName);
- var expanderButton = getAndCheckElmtById("infoBoxExpander");
-
- // make sure additional fields are hidden by default
- PO._additionalInfoFields.forEach(function (id) {
- ok(getAndCheckElmtById(id).hidden,
- "Additional info field correctly hidden by default: #" + id);
- });
-
- // toggle fields and make sure they are hidden/unhidden as expected
- expanderButton.click();
- PO._additionalInfoFields.forEach(function (id) {
- ok(!getAndCheckElmtById(id).hidden,
- "Additional info field correctly unhidden after toggle: #" + id);
- });
- expanderButton.click();
- PO._additionalInfoFields.forEach(function (id) {
- ok(getAndCheckElmtById(id).hidden,
- "Additional info field correctly hidden after toggle: #" + id);
- });
-}
-
-function getAndCheckElmtById(id) {
- var elmt = gLibrary.document.getElementById(id);
- isnot(elmt, null, "Correctly got element: #" + id);
- return elmt;
-}
-
-//------------------------------------------------------------------------------
-
-function nextTest() {
- if (gTests.length) {
- var test = gTests.shift();
- ok(true, "TEST: " + test.desc);
- dump("TEST: " + test.desc + "\n");
- test.run();
- }
- else {
- // Close Library window.
- gLibrary.close();
- // No need to cleanup anything, we have a correct left pane now.
- finish();
- }
-}
-
-function test() {
- waitForExplicitFinish();
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils is running in chrome context");
- ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
-
- // Open Library.
- openLibrary(function (library) {
- gLibrary = library;
- gLibrary.PlacesOrganizer._places.focus();
- nextTest(gLibrary);
- });
-}
diff --git a/browser/components/places/tests/browser/browser_library_left_pane_commands.js b/browser/components/places/tests/browser/browser_library_left_pane_commands.js
deleted file mode 100644
index b8ef7ecef..000000000
--- a/browser/components/places/tests/browser/browser_library_left_pane_commands.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test enabled commands in the left pane folder of the Library.
- */
-
-const TEST_URI = "http://www.mozilla.org/";
-
-var gTests = [];
-var gLibrary;
-
-//------------------------------------------------------------------------------
-
-gTests.push({
- desc: "Bug 489351 - Date containers under History in Library cannot be deleted/cut",
- run: function() {
- function addVisitsCallback() {
- // Select and open the left pane "History" query.
- var PO = gLibrary.PlacesOrganizer;
- PO.selectLeftPaneQuery('History');
- isnot(PO._places.selectedNode, null, "We correctly selected History");
-
- // Check that both delete and cut commands are disabled.
- ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
- "Cut command is disabled");
- ok(!PO._places.controller.isCommandEnabled("cmd_delete"),
- "Delete command is disabled");
- var historyNode = PO._places.selectedNode
- .QueryInterface(Ci.nsINavHistoryContainerResultNode);
- historyNode.containerOpen = true;
-
- // Check that we have a child container. It is "Today" container.
- is(historyNode.childCount, 1, "History node has one child");
- var todayNode = historyNode.getChild(0);
- var todayNodeExpectedTitle = PlacesUtils.getString("finduri-AgeInDays-is-0");
- is(todayNode.title, todayNodeExpectedTitle,
- "History child is the expected container");
-
- // Select "Today" container.
- PO._places.selectNode(todayNode);
- is(PO._places.selectedNode, todayNode,
- "We correctly selected Today container");
- // Check that delete command is enabled but cut command is disabled.
- ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
- "Cut command is disabled");
- ok(PO._places.controller.isCommandEnabled("cmd_delete"),
- "Delete command is enabled");
-
- // Execute the delete command and check visit has been removed.
- PO._places.controller.doCommand("cmd_delete");
-
- // Test live update of "History" query.
- is(historyNode.childCount, 0, "History node has no more children");
-
- historyNode.containerOpen = false;
-
- let testURI = NetUtil.newURI(TEST_URI);
- PlacesUtils.asyncHistory.isURIVisited(testURI, function(aURI, aIsVisited) {
- ok(!aIsVisited, "Visit has been removed");
- nextTest();
- });
- }
- addVisits(
- {uri: NetUtil.newURI(TEST_URI), visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_TYPED},
- window,
- addVisitsCallback);
- }
-});
-
-//------------------------------------------------------------------------------
-
-gTests.push({
- desc: "Bug 490156 - Can't delete smart bookmark containers",
- run: function() {
- // Select and open the left pane "Bookmarks Toolbar" folder.
- var PO = gLibrary.PlacesOrganizer;
- PO.selectLeftPaneQuery('BookmarksToolbar');
- isnot(PO._places.selectedNode, null, "We have a valid selection");
- is(PlacesUtils.getConcreteItemId(PO._places.selectedNode),
- PlacesUtils.toolbarFolderId,
- "We have correctly selected bookmarks toolbar node.");
-
- // Check that both cut and delete commands are disabled.
- ok(!PO._places.controller.isCommandEnabled("cmd_cut"),
- "Cut command is disabled");
- ok(!PO._places.controller.isCommandEnabled("cmd_delete"),
- "Delete command is disabled");
-
- var toolbarNode = PO._places.selectedNode
- .QueryInterface(Ci.nsINavHistoryContainerResultNode);
- toolbarNode.containerOpen = true;
-
- // Add an History query to the toolbar.
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.toolbarFolderId,
- NetUtil.newURI("place:sort=4"),
- 0, // Insert at start.
- "special_query");
- // Get first child and check it is the "Most Visited" smart bookmark.
- ok(toolbarNode.childCount > 0, "Toolbar node has children");
- var queryNode = toolbarNode.getChild(0);
- is(queryNode.title, "special_query", "Query node is correctly selected");
-
- // Select query node.
- PO._places.selectNode(queryNode);
- is(PO._places.selectedNode, queryNode, "We correctly selected query node");
-
- // Check that both cut and delete commands are enabled.
- ok(PO._places.controller.isCommandEnabled("cmd_cut"),
- "Cut command is enabled");
- ok(PO._places.controller.isCommandEnabled("cmd_delete"),
- "Delete command is enabled");
-
- // Execute the delete command and check bookmark has been removed.
- PO._places.controller.doCommand("cmd_delete");
- try {
- PlacesUtils.bookmarks.getFolderIdForItem(queryNode.itemId);
- ok(false, "Unable to remove query node bookmark");
- } catch(ex) {
- ok(true, "Query node bookmark has been correctly removed");
- }
-
- toolbarNode.containerOpen = false;
- nextTest();
- }
-});
-
-//------------------------------------------------------------------------------
-
-function nextTest() {
- if (gTests.length) {
- var test = gTests.shift();
- info("Start of test: " + test.desc);
- test.run();
- }
- else {
- // Close Library window.
- gLibrary.close();
- // No need to cleanup anything, we have a correct left pane now.
- finish();
- }
-}
-
-function test() {
- waitForExplicitFinish();
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils is running in chrome context");
- ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
-
- // Open Library.
- gLibrary = openLibrary(nextTest);
-}
diff --git a/browser/components/places/tests/browser/browser_library_left_pane_fixnames.js b/browser/components/places/tests/browser/browser_library_left_pane_fixnames.js
deleted file mode 100644
index d7a6bae50..000000000
--- a/browser/components/places/tests/browser/browser_library_left_pane_fixnames.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test we correctly fix broken Library left pane queries names.
- */
-
-// Array of left pane queries objects, each one has the following properties:
-// name: query's identifier got from annotations,
-// itemId: query's itemId,
-// correctTitle: original and correct query's title.
-var leftPaneQueries = [];
-
-function onLibraryReady(organizer) {
- // Check titles have been fixed.
- for (var i = 0; i < leftPaneQueries.length; i++) {
- var query = leftPaneQueries[i];
- is(PlacesUtils.bookmarks.getItemTitle(query.itemId),
- query.correctTitle, "Title is correct for query " + query.name);
- if ("concreteId" in query) {
- is(PlacesUtils.bookmarks.getItemTitle(query.concreteId),
- query.concreteTitle, "Concrete title is correct for query " + query.name);
- }
- }
-
- // Close Library window.
- organizer.close();
- // No need to cleanup anything, we have a correct left pane now.
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils is running in chrome context");
- ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
- ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
- "Left pane version in chrome context, current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
-
- // Ensure left pane is initialized.
- ok(PlacesUIUtils.leftPaneFolderId > 0, "left pane folder is initialized");
-
- // Get the left pane folder.
- var leftPaneItems = PlacesUtils.annotations
- .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
-
- is(leftPaneItems.length, 1, "We correctly have only 1 left pane folder");
- // Check version.
- var version = PlacesUtils.annotations
- .getItemAnnotation(leftPaneItems[0],
- PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(version, PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, "Left pane version is actual");
-
- // Get all left pane queries.
- var items = PlacesUtils.annotations
- .getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_QUERY_ANNO);
- // Get current queries names.
- for (var i = 0; i < items.length; i++) {
- var itemId = items[i];
- var queryName = PlacesUtils.annotations
- .getItemAnnotation(items[i],
- PlacesUIUtils.ORGANIZER_QUERY_ANNO);
- var query = { name: queryName,
- itemId: itemId,
- correctTitle: PlacesUtils.bookmarks.getItemTitle(itemId) }
- switch (queryName) {
- case "BookmarksToolbar":
- query.concreteId = PlacesUtils.toolbarFolderId;
- query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
- break;
- case "BookmarksMenu":
- query.concreteId = PlacesUtils.bookmarksMenuFolderId;
- query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
- break;
- case "UnfiledBookmarks":
- query.concreteId = PlacesUtils.unfiledBookmarksFolderId;
- query.concreteTitle = PlacesUtils.bookmarks.getItemTitle(query.concreteId);
- break;
- }
- leftPaneQueries.push(query);
- // Rename to a bad title.
- PlacesUtils.bookmarks.setItemTitle(query.itemId, "badName");
- if ("concreteId" in query)
- PlacesUtils.bookmarks.setItemTitle(query.concreteId, "badName");
- }
-
- PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
-
- // Open Library, this will kick-off left pane code.
- openLibrary(onLibraryReady);
-}
diff --git a/browser/components/places/tests/browser/browser_library_middleclick.js b/browser/components/places/tests/browser/browser_library_middleclick.js
deleted file mode 100644
index 13a62da30..000000000
--- a/browser/components/places/tests/browser/browser_library_middleclick.js
+++ /dev/null
@@ -1,281 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- /**
- * Tests middle-clicking items in the Library.
- */
-
-const ENABLE_HISTORY_PREF = "places.history.enabled";
-
-var gLibrary = null;
-var gTests = [];
-var gCurrentTest = null;
-
-// Listener for TabOpen and tabs progress.
-var gTabsListener = {
- _loadedURIs: [],
- _openTabsCount: 0,
-
- handleEvent: function(aEvent) {
- if (aEvent.type != "TabOpen")
- return;
-
- if (++this._openTabsCount == gCurrentTest.URIs.length) {
- is(gBrowser.tabs.length, gCurrentTest.URIs.length + 1,
- "We have opened " + gCurrentTest.URIs.length + " new tab(s)");
- }
-
- var tab = aEvent.target;
- is(tab.ownerDocument.defaultView, window,
- "Tab has been opened in current browser window");
- },
-
- onLocationChange: function(aBrowser, aWebProgress, aRequest, aLocationURI,
- aFlags) {
- var spec = aLocationURI.spec;
- ok(true, spec);
- // When a new tab is opened, location is first set to "about:blank", so
- // we can ignore those calls.
- // Ignore multiple notifications for the same URI too.
- if (spec == "about:blank" || this._loadedURIs.indexOf(spec) != -1)
- return;
-
- ok(gCurrentTest.URIs.indexOf(spec) != -1,
- "Opened URI found in list: " + spec);
-
- if (gCurrentTest.URIs.indexOf(spec) != -1 )
- this._loadedURIs.push(spec);
-
- if (this._loadedURIs.length == gCurrentTest.URIs.length) {
- // We have correctly opened all URIs.
-
- // Reset arrays.
- this._loadedURIs.length = 0;
-
- this._openTabsCount = 0;
-
- executeSoon(function () {
- // Close all tabs.
- while (gBrowser.tabs.length > 1)
- gBrowser.removeCurrentTab();
-
- // Test finished. This will move to the next one.
- waitForFocus(gCurrentTest.finish, gBrowser.ownerDocument.defaultView);
- });
- }
- }
-}
-
-//------------------------------------------------------------------------------
-// Open bookmark in a new tab.
-
-gTests.push({
- desc: "Open bookmark in a new tab.",
- URIs: ["about:buildconfig"],
- _itemId: -1,
-
- setup: function() {
- var bs = PlacesUtils.bookmarks;
- // Add a new unsorted bookmark.
- this._itemId = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri(this.URIs[0]),
- bs.DEFAULT_INDEX,
- "Title");
- // Select unsorted bookmarks root in the left pane.
- gLibrary.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
- isnot(gLibrary.PlacesOrganizer._places.selectedNode, null,
- "We correctly have selection in the Library left pane");
- // Get our bookmark in the right pane.
- var bookmarkNode = gLibrary.ContentTree.view.view.nodeForTreeIndex(0);
- is(bookmarkNode.uri, this.URIs[0], "Found bookmark in the right pane");
- },
-
- finish: function() {
- setTimeout(runNextTest, 0);
- },
-
- cleanup: function() {
- PlacesUtils.bookmarks.removeItem(this._itemId);
- }
-});
-
-//------------------------------------------------------------------------------
-// Open a folder in tabs.
-
-gTests.push({
- desc: "Open a folder in tabs.",
- URIs: ["about:buildconfig", "about:"],
- _folderId: -1,
-
- setup: function() {
- var bs = PlacesUtils.bookmarks;
- // Create a new folder.
- var folderId = bs.createFolder(bs.unfiledBookmarksFolder,
- "Folder",
- bs.DEFAULT_INDEX);
- this._folderId = folderId;
-
- // Add bookmarks in folder.
- this.URIs.forEach(function(aURI) {
- bs.insertBookmark(folderId,
- PlacesUtils._uri(aURI),
- bs.DEFAULT_INDEX,
- "Title");
- });
-
- // Select unsorted bookmarks root in the left pane.
- gLibrary.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
- isnot(gLibrary.PlacesOrganizer._places.selectedNode, null,
- "We correctly have selection in the Library left pane");
- // Get our bookmark in the right pane.
- var folderNode = gLibrary.ContentTree.view.view.nodeForTreeIndex(0);
- is(folderNode.title, "Folder", "Found folder in the right pane");
- },
-
- finish: function() {
- setTimeout(runNextTest, 0);
- },
-
- cleanup: function() {
- PlacesUtils.bookmarks.removeItem(this._folderId);
- }
-});
-
-//------------------------------------------------------------------------------
-// Open a query in tabs.
-
-gTests.push({
- desc: "Open a query in tabs.",
- URIs: ["about:buildconfig", "about:"],
- _folderId: -1,
- _queryId: -1,
-
- setup: function() {
- var bs = PlacesUtils.bookmarks;
- // Create a new folder.
- var folderId = bs.createFolder(bs.unfiledBookmarksFolder,
- "Folder",
- bs.DEFAULT_INDEX);
- this._folderId = folderId;
-
- // Add bookmarks in folder.
- this.URIs.forEach(function(aURI) {
- bs.insertBookmark(folderId,
- PlacesUtils._uri(aURI),
- bs.DEFAULT_INDEX,
- "Title");
- });
-
- // Create a bookmarks query containing our bookmarks.
- var hs = PlacesUtils.history;
- var options = hs.getNewQueryOptions();
- options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
- var query = hs.getNewQuery();
- // The colon included in the terms selects only about: URIs. If not included
- // we also may get pages like about.html included in the query result.
- query.searchTerms = "about:";
- var queryString = hs.queriesToQueryString([query], 1, options);
- this._queryId = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri(queryString),
- 0, // It must be the first.
- "Query");
-
- // Select unsorted bookmarks root in the left pane.
- gLibrary.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
- isnot(gLibrary.PlacesOrganizer._places.selectedNode, null,
- "We correctly have selection in the Library left pane");
- // Get our bookmark in the right pane.
- var folderNode = gLibrary.ContentTree.view.view.nodeForTreeIndex(0);
- is(folderNode.title, "Query", "Found query in the right pane");
- },
-
- finish: function() {
- setTimeout(runNextTest, 0);
- },
-
- cleanup: function() {
- PlacesUtils.bookmarks.removeItem(this._folderId);
- PlacesUtils.bookmarks.removeItem(this._queryId);
- }
-});
-
-//------------------------------------------------------------------------------
-
-function test() {
- waitForExplicitFinish();
- // Increase timeout, this test can be quite slow due to waitForFocus calls.
- requestLongerTimeout(2);
-
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils in context");
- ok(PlacesUIUtils, "PlacesUIUtils in context");
-
- // Add tabs listeners.
- gBrowser.tabContainer.addEventListener("TabOpen", gTabsListener, false);
- gBrowser.addTabsProgressListener(gTabsListener);
-
- // Temporary disable history, so we won't record pages navigation.
- gPrefService.setBoolPref(ENABLE_HISTORY_PREF, false);
-
- // Open Library window.
- openLibrary(function (library) {
- gLibrary = library;
- // Kick off tests.
- runNextTest();
- });
-}
-
-function runNextTest() {
- // Cleanup from previous test.
- if (gCurrentTest)
- gCurrentTest.cleanup();
-
- if (gTests.length > 0) {
- // Goto next test.
- gCurrentTest = gTests.shift();
- info("Start of test: " + gCurrentTest.desc);
- // Test setup will set Library so that the bookmark to be opened is the
- // first node in the content (right pane) tree.
- gCurrentTest.setup();
-
- // Middle click on first node in the content tree of the Library.
- gLibrary.focus();
- waitForFocus(function() {
- mouseEventOnCell(gLibrary.ContentTree.view, 0, 0, { button: 1 });
- }, gLibrary);
- }
- else {
- // No more tests.
-
- // Close Library window.
- gLibrary.close();
-
- // Remove tabs listeners.
- gBrowser.tabContainer.removeEventListener("TabOpen", gTabsListener, false);
- gBrowser.removeTabsProgressListener(gTabsListener);
-
- // Restore history.
- try {
- gPrefService.clearUserPref(ENABLE_HISTORY_PREF);
- } catch(ex) {}
-
- finish();
- }
-}
-
-function mouseEventOnCell(aTree, aRowIndex, aColumnIndex, aEventDetails) {
- var selection = aTree.view.selection;
- selection.select(aRowIndex);
- aTree.treeBoxObject.ensureRowIsVisible(aRowIndex);
- var column = aTree.columns[aColumnIndex];
-
- // get cell coordinates
- var x = {}, y = {}, width = {}, height = {};
- aTree.treeBoxObject.getCoordsForCellItem(aRowIndex, column, "text",
- x, y, width, height);
-
- EventUtils.synthesizeMouse(aTree.body, x.value, y.value,
- aEventDetails, gLibrary);
-}
diff --git a/browser/components/places/tests/browser/browser_library_open_leak.js b/browser/components/places/tests/browser/browser_library_open_leak.js
deleted file mode 100644
index 03aa3408f..000000000
--- a/browser/components/places/tests/browser/browser_library_open_leak.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Bug 474831
- * https://bugzilla.mozilla.org/show_bug.cgi?id=474831
- *
- * Tests for leaks caused by simply opening and closing the Places Library
- * window. Opens the Places Library window, waits for it to load, closes it,
- * and finishes.
- */
-
-function test() {
- waitForExplicitFinish();
- openLibrary(function (win) {
- ok(true, "Library has been correctly opened");
- win.close();
- finish();
- });
-}
diff --git a/browser/components/places/tests/browser/browser_library_panel_leak.js b/browser/components/places/tests/browser/browser_library_panel_leak.js
deleted file mode 100644
index 56519d9da..000000000
--- a/browser/components/places/tests/browser/browser_library_panel_leak.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Bug 433231 - Places Library leaks the nsGlobalWindow when closed with a
- * history entry selected.
- * https://bugzilla.mozilla.org/show_bug.cgi?id=433231
- *
- * STRs: Open Library, select an history entry in History, close Library.
- * ISSUE: We were adding a bookmarks observer when editing a bookmark, when
- * selecting an history entry the panel was not un-initialized, and
- * since an histroy entry does not have an itemId, the observer was
- * never removed.
- */
-
-const TEST_URI = "http://www.mozilla.org/";
-
-function test() {
- function onLibraryReady(organizer) {
- let contentTree = organizer.document.getElementById("placeContent");
- isnot(contentTree, null, "Sanity check: placeContent tree should exist");
- isnot(organizer.PlacesOrganizer, null, "Sanity check: PlacesOrganizer should exist");
- isnot(organizer.gEditItemOverlay, null, "Sanity check: gEditItemOverlay should exist");
-
- ok(organizer.gEditItemOverlay._initialized, "gEditItemOverlay is initialized");
- isnot(organizer.gEditItemOverlay.itemId, -1, "Editing a bookmark");
-
- // Select History in the left pane.
- organizer.PlacesOrganizer.selectLeftPaneQuery('History');
- // Select the first history entry.
- let selection = contentTree.view.selection;
- selection.clearSelection();
- selection.rangedSelect(0, 0, true);
- // Check the panel is editing the history entry.
- is(organizer.gEditItemOverlay.itemId, -1, "Editing an history entry");
- // Close Library window.
- organizer.close();
- // Clean up history.
- waitForClearHistory(finish);
- }
-
- waitForExplicitFinish();
- // Add an history entry.
- ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
- addVisits(
- {uri: PlacesUtils._uri(TEST_URI), visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_TYPED},
- window,
- function() {
- openLibrary(onLibraryReady);
- });
-}
diff --git a/browser/components/places/tests/browser/browser_library_search.js b/browser/components/places/tests/browser/browser_library_search.js
deleted file mode 100644
index 8e51fdf76..000000000
--- a/browser/components/places/tests/browser/browser_library_search.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Bug 451151
- * https://bugzilla.mozilla.org/show_bug.cgi?id=451151
- *
- * Summary:
- * Tests frontend Places Library searching -- search, search reset, search scope
- * consistency.
- *
- * Details:
- * Each test below
- * 1. selects a folder in the left pane and ensures that the content tree is
- * appropriately updated,
- * 2. performs a search and ensures that the content tree is correct for the
- * folder and search and that the search UI is visible and appropriate to
- * folder,
- * 5. resets the search and ensures that the content tree is correct and that
- * the search UI is hidden, and
- * 6. if folder scope was clicked, searches again and ensures folder scope
- * remains selected.
- */
-
-const TEST_URL = "http://dummy.mozilla.org/";
-const TEST_DOWNLOAD_URL = "http://dummy.mozilla.org/dummy.pdf";
-
-let gLibrary;
-
-let testCases = [
- function allBookmarksScope() {
- let defScope = getDefaultScope(PlacesUIUtils.allBookmarksFolderId);
- search(PlacesUIUtils.allBookmarksFolderId, "dummy", defScope);
- },
-
- function historyScope() {
- let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries["History"]);
- search(PlacesUIUtils.leftPaneQueries["History"], "dummy", defScope);
- },
-
- function downloadsScope() {
- let defScope = getDefaultScope(PlacesUIUtils.leftPaneQueries["Downloads"]);
- search(PlacesUIUtils.leftPaneQueries["Downloads"], "dummy", defScope);
- },
-];
-
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- * Returns the default search scope for a given folder.
- *
- * @param aFolderId
- * the item ID of a node in the left pane's tree
- * @return the default scope when the folder is newly selected
- */
-function getDefaultScope(aFolderId) {
- switch (aFolderId) {
- case PlacesUIUtils.leftPaneQueries["History"]:
- return "scopeBarHistory"
- case PlacesUIUtils.leftPaneQueries["Downloads"]:
- return "scopeBarDownloads";
- default:
- return "scopeBarAll";
- }
-}
-
-/**
- * Returns the single nsINavHistoryQuery represented by a given place URI.
- *
- * @param aPlaceURI
- * a URI that represents a single query
- * @return an nsINavHistoryQuery object
- */
-function queryStringToQuery(aPlaceURI) {
- let queries = {};
- PlacesUtils.history.queryStringToQueries(aPlaceURI, queries, {}, {});
- return queries.value[0];
-}
-
-/**
- * Resets the search by clearing the search box's text and ensures that the
- * search scope remains as expected.
- *
- * @param aExpectedScopeButtonId
- * this button should be selected after the reset
- */
-function resetSearch(aExpectedScopeButtonId) {
- search(null, "", aExpectedScopeButtonId);
-}
-
-/**
- * Performs a search for a given folder and search string and ensures that the
- * URI of the right pane's content tree is as expected for the folder and search
- * string. Also ensures that the search scope button is as expected after the
- * search.
- *
- * @param aFolderId
- * the item ID of a node in the left pane's tree
- * @param aSearchStr
- * the search text; may be empty to reset the search
- * @param aExpectedScopeButtonId
- * after searching the selected scope button should be this
- */
-function search(aFolderId, aSearchStr, aExpectedScopeButtonId) {
- let doc = gLibrary.document;
- let folderTree = doc.getElementById("placesList");
- let contentTree = doc.getElementById("placeContent");
-
- // First, ensure that selecting the folder in the left pane updates the
- // content tree properly.
- if (aFolderId) {
- folderTree.selectItems([aFolderId]);
- isnot(folderTree.selectedNode, null,
- "Sanity check: left pane tree should have selection after selecting!");
-
- // getFolders() on a History query returns an empty array, so no use
- // comparing against aFolderId in that case.
- if (aFolderId !== PlacesUIUtils.leftPaneQueries["History"] &&
- aFolderId !== PlacesUIUtils.leftPaneQueries["Downloads"]) {
- // contentTree.place should be equal to contentTree.result.root.uri,
- // but it's not until bug 476952 is fixed.
- let query = queryStringToQuery(contentTree.result.root.uri);
- is(query.getFolders()[0], aFolderId,
- "Content tree's folder should be what was selected in the left pane");
- }
- }
-
- // Second, ensure that searching updates the content tree and search UI
- // properly.
- let searchBox = doc.getElementById("searchFilter");
- searchBox.value = aSearchStr;
- gLibrary.PlacesSearchBox.search(searchBox.value);
- let query = queryStringToQuery(contentTree.result.root.uri);
- if (aSearchStr) {
- is(query.searchTerms, aSearchStr,
- "Content tree's searchTerms should be text in search box");
- }
- else {
- is(query.hasSearchTerms, false,
- "Content tree's searchTerms should not exist after search reset");
- }
-}
-
-/**
- * test() contains window-launching boilerplate that calls this to really kick
- * things off. Add functions to the testCases array, and this will call them.
- */
-function onLibraryAvailable() {
- testCases.forEach(function (aTest) aTest());
-
- gLibrary.close();
- gLibrary = null;
-
- // Cleanup.
- PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL), ["dummyTag"]);
- PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- waitForClearHistory(finish);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-function test() {
- waitForExplicitFinish();
-
- // Sanity:
- ok(PlacesUtils, "PlacesUtils in context");
-
- // Add visits, a bookmark and a tag.
- addVisits(
- [{ uri: PlacesUtils._uri(TEST_URL), visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_TYPED },
- { uri: PlacesUtils._uri(TEST_DOWNLOAD_URL), visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_DOWNLOAD }],
- window,
- function() {
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils._uri(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- "dummy");
- PlacesUtils.tagging.tagURI(PlacesUtils._uri(TEST_URL), ["dummyTag"]);
-
- gLibrary = openLibrary(onLibraryAvailable);
- });
-}
diff --git a/browser/components/places/tests/browser/browser_library_views_liveupdate.js b/browser/components/places/tests/browser/browser_library_views_liveupdate.js
deleted file mode 100644
index d339fd447..000000000
--- a/browser/components/places/tests/browser/browser_library_views_liveupdate.js
+++ /dev/null
@@ -1,301 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests Library Left pane view for liveupdate.
- */
-
-var gLibrary = null;
-
-function test() {
- waitForExplicitFinish();
- // This test takes quite some time, and timeouts frequently, so we require
- // more time to run.
- // See Bug 525610.
- requestLongerTimeout(2);
-
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils in context");
- ok(PlacesUIUtils, "PlacesUIUtils in context");
-
- // Open Library, we will check the left pane.
- openLibrary(function (library) {
- gLibrary = library;
- startTest();
- });
-}
-
-/**
- * Adds bookmarks observer, and executes a bunch of bookmarks operations.
- */
-function startTest() {
- var bs = PlacesUtils.bookmarks;
- // Add observers.
- bs.addObserver(bookmarksObserver, false);
- PlacesUtils.annotations.addObserver(bookmarksObserver, false);
- var addedBookmarks = [];
-
- // MENU
- ok(true, "*** Acting on menu bookmarks");
- var id = bs.insertBookmark(bs.bookmarksMenuFolder,
- PlacesUtils._uri("http://bm1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bm1");
- addedBookmarks.push(id);
- id = bs.insertBookmark(bs.bookmarksMenuFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "bm2");
- bs.setItemTitle(id, "bm2_edited");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.bookmarksMenuFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.bookmarksMenuFolder,
- "bmf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "bmf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://bmf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bmf1");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.bookmarksMenuFolder, 0);
-
- // TOOLBAR
- ok(true, "*** Acting on toolbar bookmarks");
- bs.insertBookmark(bs.toolbarFolder,
- PlacesUtils._uri("http://tb1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "tb1");
- bs.setItemTitle(id, "tb1_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(bs.toolbarFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "tb2");
- bs.setItemTitle(id, "tb2_edited");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.toolbarFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.toolbarFolder,
- "tbf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "tbf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://tbf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bmf1");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.toolbarFolder, 0);
-
- // UNSORTED
- ok(true, "*** Acting on unsorted bookmarks");
- id = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri("http://ub1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "ub1");
- bs.setItemTitle(id, "ub1_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "ub2");
- bs.setItemTitle(id, "ub2_edited");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.unfiledBookmarksFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.unfiledBookmarksFolder,
- "ubf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "ubf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://ubf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "ubf1");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.unfiledBookmarksFolder, 0);
-
- // Remove all added bookmarks.
- addedBookmarks.forEach(function (aItem) {
- // If we remove an item after its containing folder has been removed,
- // this will throw, but we can ignore that.
- try {
- bs.removeItem(aItem);
- } catch (ex) {}
- });
-
- // Remove observers.
- bs.removeObserver(bookmarksObserver);
- PlacesUtils.annotations.removeObserver(bookmarksObserver);
- finishTest();
-}
-
-/**
- * Restores browser state and calls finish.
- */
-function finishTest() {
- // Close Library window.
- gLibrary.close();
- finish();
-}
-
-/**
- * The observer is where magic happens, for every change we do it will look for
- * nodes positions in the affected views.
- */
-var bookmarksObserver = {
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsINavBookmarkObserver
- , Ci.nsIAnnotationObserver
- ]),
-
- // nsIAnnotationObserver
- onItemAnnotationSet: function() {},
- onItemAnnotationRemoved: function() {},
- onPageAnnotationSet: function() {},
- onPageAnnotationRemoved: function() {},
-
- // nsINavBookmarkObserver
- onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex, aItemType,
- aURI) {
- var node = null;
- var index = null;
- [node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);
- // Left pane should not be updated for normal bookmarks or separators.
- switch (aItemType) {
- case PlacesUtils.bookmarks.TYPE_BOOKMARK:
- var uriString = aURI.spec;
- var isQuery = uriString.substr(0, 6) == "place:";
- if (isQuery) {
- isnot(node, null, "Found new Places node in left pane");
- ok(index >= 0, "Node is at index " + index);
- break;
- }
- // Fallback to separator case if this is not a query.
- case PlacesUtils.bookmarks.TYPE_SEPARATOR:
- is(node, null, "New Places node not added in left pane");
- break;
- default:
- isnot(node, null, "Found new Places node in left pane");
- ok(index >= 0, "Node is at index " + index);
- }
- },
-
- onItemRemoved: function PSB_onItemRemoved(aItemId, aFolder, aIndex) {
- var node = null;
- var index = null;
- [node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);
- is(node, null, "Places node not found in left pane");
- },
-
- onItemMoved: function(aItemId,
- aOldFolderId, aOldIndex,
- aNewFolderId, aNewIndex, aItemType) {
- var node = null;
- var index = null;
- [node, index] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places);
- // Left pane should not be updated for normal bookmarks or separators.
- switch (aItemType) {
- case PlacesUtils.bookmarks.TYPE_BOOKMARK:
- var uriString = PlacesUtils.bookmarks.getBookmarkURI(aItemId).spec;
- var isQuery = uriString.substr(0, 6) == "place:";
- if (isQuery) {
- isnot(node, null, "Found new Places node in left pane");
- ok(index >= 0, "Node is at index " + index);
- break;
- }
- // Fallback to separator case if this is not a query.
- case PlacesUtils.bookmarks.TYPE_SEPARATOR:
- is(node, null, "New Places node not added in left pane");
- break;
- default:
- isnot(node, null, "Found new Places node in left pane");
- ok(index >= 0, "Node is at index " + index);
- }
- },
-
- onBeginUpdateBatch: function PSB_onBeginUpdateBatch() {},
- onEndUpdateBatch: function PSB_onEndUpdateBatch() {},
- onItemVisited: function() {},
- onItemChanged: function PSB_onItemChanged(aItemId, aProperty,
- aIsAnnotationProperty, aNewValue) {
- if (aProperty == "title") {
- let validator = function(aTreeRowIndex) {
- let tree = gLibrary.PlacesOrganizer._places;
- let cellText = tree.view.getCellText(aTreeRowIndex,
- tree.columns.getColumnAt(0));
- return cellText == aNewValue;
- }
- let [node, index, valid] = getNodeForTreeItem(aItemId, gLibrary.PlacesOrganizer._places, validator);
- if (node) // Only visible nodes.
- ok(valid, "Title cell value has been correctly updated");
- }
- }
-};
-
-
-/**
- * Get places node and index for an itemId in a tree view.
- *
- * @param aItemId
- * item id of the item to search.
- * @param aTree
- * Tree to search in.
- * @param aValidator [optional]
- * function to check row validity if found. Defaults to {return true;}.
- * @returns [node, index, valid] or [null, null, false] if not found.
- */
-function getNodeForTreeItem(aItemId, aTree, aValidator) {
-
- function findNode(aContainerIndex) {
- if (aTree.view.isContainerEmpty(aContainerIndex))
- return [null, null, false];
-
- // The rowCount limit is just for sanity, but we will end looping when
- // we have checked the last child of this container or we have found node.
- for (var i = aContainerIndex + 1; i < aTree.view.rowCount; i++) {
- var node = aTree.view.nodeForTreeIndex(i);
-
- if (node.itemId == aItemId) {
- // Minus one because we want relative index inside the container.
- let valid = aValidator ? aValidator(i) : true;
- return [node, i - aTree.view.getParentIndex(i) - 1, valid];
- }
-
- if (PlacesUtils.nodeIsFolder(node)) {
- // Open container.
- aTree.view.toggleOpenState(i);
- // Search inside it.
- var foundNode = findNode(i);
- // Close container.
- aTree.view.toggleOpenState(i);
- // Return node if found.
- if (foundNode[0] != null)
- return foundNode;
- }
-
- // We have finished walking this container.
- if (!aTree.view.hasNextSibling(aContainerIndex + 1, i))
- break;
- }
- return [null, null, false]
- }
-
- // Root node is hidden, so we need to manually walk the first level.
- for (var i = 0; i < aTree.view.rowCount; i++) {
- // Open container.
- aTree.view.toggleOpenState(i);
- // Search inside it.
- var foundNode = findNode(i);
- // Close container.
- aTree.view.toggleOpenState(i);
- // Return node if found.
- if (foundNode[0] != null)
- return foundNode;
- }
- return [null, null, false];
-}
diff --git a/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js b/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js
deleted file mode 100644
index 035fe75a3..000000000
--- a/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * Tests that visits across frames are correctly represented in the database.
- */
-
-const BASE_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser";
-const PAGE_URL = BASE_URL + "/framedPage.html";
-const LEFT_URL = BASE_URL + "/frameLeft.html";
-const RIGHT_URL = BASE_URL + "/frameRight.html";
-
-let gTabLoaded = false;
-let gLeftFrameVisited = false;
-
-let observer = {
- observe: function(aSubject, aTopic, aData)
- {
- let url = aSubject.QueryInterface(Ci.nsIURI).spec;
- if (url == LEFT_URL ) {
- is(getTransitionForUrl(url), null,
- "Embed visits should not get a database entry.");
- gLeftFrameVisited = true;
- maybeClickLink();
- }
- else if (url == RIGHT_URL ) {
- is(getTransitionForUrl(url), PlacesUtils.history.TRANSITION_FRAMED_LINK,
- "User activated visits should get a FRAMED_LINK transition.");
- finish();
- }
- },
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
-};
-Services.obs.addObserver(observer, "uri-visit-saved", false);
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab(PAGE_URL);
- let frameCount = 0;
- gBrowser.selectedTab.linkedBrowser.addEventListener("DOMContentLoaded",
- function (event)
- {
- // Wait for all the frames.
- if (frameCount++ < 2)
- return;
- gBrowser.selectedTab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, false)
- gTabLoaded = true;
- maybeClickLink();
- }, false
- );
-}
-
-function maybeClickLink() {
- if (gTabLoaded && gLeftFrameVisited) {
- // Click on the link in the left frame to cause a page load in the
- // right frame.
- EventUtils.sendMouseEvent({type: "click"}, "clickme", content.frames[0]);
- }
-}
-
-function getTransitionForUrl(aUrl)
-{
- let dbConn = PlacesUtils.history
- .QueryInterface(Ci.nsPIPlacesDatabase).DBConnection;
- let stmt = dbConn.createStatement(
- "SELECT visit_type FROM moz_historyvisits WHERE place_id = " +
- "(SELECT id FROM moz_places WHERE url = :page_url)");
- stmt.params.page_url = aUrl;
- try {
- if (!stmt.executeStep()) {
- return null;
- }
- return stmt.row.visit_type;
- }
- finally {
- stmt.finalize();
- }
-}
-
-registerCleanupFunction(function ()
-{
- gBrowser.removeTab(gBrowser.selectedTab);
- Services.obs.removeObserver(observer, "uri-visit-saved");
-})
diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
deleted file mode 100644
index e5eb685cb..000000000
--- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the items in the bookmarks and history sidebar
-// panels are clickable in both LTR and RTL modes.
-
-function test() {
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- const BOOKMARKS_SIDEBAR_ID = "viewBookmarksSidebar";
- const BOOKMARKS_SIDEBAR_TREE_ID = "bookmarks-view";
- const HISTORY_SIDEBAR_ID = "viewHistorySidebar";
- const HISTORY_SIDEBAR_TREE_ID = "historyTree";
- const TEST_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser/sidebarpanels_click_test_page.html";
-
- // If a sidebar is already open, close it.
- if (!document.getElementById("sidebar-box").hidden) {
- info("Unexpected sidebar found - a previous test failed to cleanup correctly");
- toggleSidebar();
- }
-
- let sidebar = document.getElementById("sidebar");
- let tests = [];
- let currentTest;
-
- tests.push({
- _itemID: null,
- init: function(aCallback) {
- // Add a bookmark to the Unfiled Bookmarks folder.
- this._itemID = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.unfiledBookmarksFolderId, PlacesUtils._uri(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX, "test"
- );
- aCallback();
- },
- prepare: function() {
- },
- selectNode: function(tree) {
- tree.selectItems([this._itemID]);
- },
- cleanup: function(aCallback) {
- PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
- executeSoon(aCallback);
- },
- sidebarName: BOOKMARKS_SIDEBAR_ID,
- treeName: BOOKMARKS_SIDEBAR_TREE_ID,
- desc: "Bookmarks sidebar test"
- });
-
- tests.push({
- init: function(aCallback) {
- // Add a history entry.
- let uri = PlacesUtils._uri(TEST_URL);
- addVisits(
- { uri: uri, visitDate: Date.now() * 1000,
- transition: PlacesUtils.history.TRANSITION_TYPED },
- window,
- aCallback);
- },
- prepare: function() {
- sidebar.contentDocument.getElementById("byvisited").doCommand();
- },
- selectNode: function(tree) {
- tree.selectNode(tree.view.nodeForTreeIndex(0));
- is(tree.selectedNode.uri, TEST_URL, "The correct visit has been selected");
- is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
- },
- cleanup: function(aCallback) {
- waitForClearHistory(aCallback);
- },
- sidebarName: HISTORY_SIDEBAR_ID,
- treeName: HISTORY_SIDEBAR_TREE_ID,
- desc: "History sidebar test"
- });
-
- function testPlacesPanel(preFunc, postFunc) {
- currentTest.init(function() {
- toggleSidebar(currentTest.sidebarName);
- });
-
- sidebar.addEventListener("load", function() {
- sidebar.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- currentTest.prepare();
-
- if (preFunc)
- preFunc();
-
- function observer(aSubject, aTopic, aData) {
- info("alert dialog observed as expected");
- Services.obs.removeObserver(observer, "common-dialog-loaded");
- Services.obs.removeObserver(observer, "tabmodal-dialog-loaded");
-
- aSubject.Dialog.ui.button0.click();
-
- executeSoon(function () {
- toggleSidebar(currentTest.sidebarName);
- currentTest.cleanup(postFunc);
- });
- }
- Services.obs.addObserver(observer, "common-dialog-loaded", false);
- Services.obs.addObserver(observer, "tabmodal-dialog-loaded", false);
-
- let tree = sidebar.contentDocument.getElementById(currentTest.treeName);
-
- // Select the inserted places item.
- currentTest.selectNode(tree);
-
- synthesizeClickOnSelectedTreeCell(tree);
- // Now, wait for the observer to catch the alert dialog.
- // If something goes wrong, the test will time out at this stage.
- // Note that for the history sidebar, the URL itself is not opened,
- // and Places will show the load-js-data-url-error prompt as an alert
- // box, which means that the click actually worked, so it's good enough
- // for the purpose of this test.
- });
- }, true);
- }
-
- function synthesizeClickOnSelectedTreeCell(aTree) {
- let tbo = aTree.treeBoxObject;
- is(tbo.view.selection.count, 1,
- "The test node should be successfully selected");
- // Get selection rowID.
- let min = {}, max = {};
- tbo.view.selection.getRangeAt(0, min, max);
- let rowID = min.value;
- tbo.ensureRowIsVisible(rowID);
-
- // Calculate the click coordinates.
- let x = {}, y = {}, width = {}, height = {};
- tbo.getCoordsForCellItem(rowID, aTree.columns[0], "text",
- x, y, width, height);
- x = x.value + width.value / 2;
- y = y.value + height.value / 2;
- // Simulate the click.
- EventUtils.synthesizeMouse(aTree.body, x, y, {},
- aTree.ownerDocument.defaultView);
- }
-
- function changeSidebarDirection(aDirection) {
- sidebar.contentDocument.documentElement.style.direction = aDirection;
- }
-
- function runNextTest() {
- // Remove eventual tabs created by previous sub-tests.
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeTab(gBrowser.tabContainer.lastChild);
- }
-
- if (tests.length == 0) {
- finish();
- }
- else {
- // Create a new tab and run the test.
- gBrowser.selectedTab = gBrowser.addTab();
- currentTest = tests.shift();
- testPlacesPanel(function() {
- changeSidebarDirection("ltr");
- info("Running " + currentTest.desc + " in LTR mode");
- },
- function() {
- testPlacesPanel(function() {
- // Run the test in RTL mode.
- changeSidebarDirection("rtl");
- info("Running " + currentTest.desc + " in RTL mode");
- },
- function() {
- runNextTest();
- });
- });
- }
- }
-
- // Ensure history is clean before starting the test.
- waitForClearHistory(runNextTest);
-}
diff --git a/browser/components/places/tests/browser/browser_sort_in_library.js b/browser/components/places/tests/browser/browser_sort_in_library.js
deleted file mode 100644
index e59abb2be..000000000
--- a/browser/components/places/tests/browser/browser_sort_in_library.js
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests the following bugs:
- *
- * Bug 443745 - View>Sort>of "alpha" sort items is default to Z>A instead of A>Z
- * https://bugzilla.mozilla.org/show_bug.cgi?id=443745
- *
- * Bug 444179 - Library>Views>Sort>Sort by Tags does nothing
- * https://bugzilla.mozilla.org/show_bug.cgi?id=444179
- *
- * Basically, fully tests sorting the placeContent tree in the Places Library
- * window. Sorting is verified by comparing the nsINavHistoryResult returned by
- * placeContent.result to the expected sort values.
- */
-
-// Two properties of nsINavHistoryResult control the sort of the tree:
-// sortingMode and sortingAnnotation. sortingMode's value is one of the
-// nsINavHistoryQueryOptions.SORT_BY_* constants. sortingAnnotation is the
-// annotation used to sort for SORT_BY_ANNOTATION_* mode.
-//
-// This lookup table maps the possible values of anonid's of the treecols to
-// objects that represent the treecols' correct state after the user sorts the
-// previously unsorted tree by selecting a column from the Views > Sort menu.
-// sortingMode is constructed from the key and dir properties (i.e.,
-// SORT_BY_<key>_<dir>) and sortingAnnotation is checked against anno. anno
-// may be undefined if key is not "ANNOTATION".
-const SORT_LOOKUP_TABLE = {
- title: { key: "TITLE", dir: "ASCENDING" },
- tags: { key: "TAGS", dir: "ASCENDING" },
- url: { key: "URI", dir: "ASCENDING" },
- date: { key: "DATE", dir: "DESCENDING" },
- visitCount: { key: "VISITCOUNT", dir: "DESCENDING" },
- keyword: { key: "KEYWORD", dir: "ASCENDING" },
- dateAdded: { key: "DATEADDED", dir: "DESCENDING" },
- lastModified: { key: "LASTMODIFIED", dir: "DESCENDING" },
- description: { key: "ANNOTATION",
- dir: "ASCENDING",
- anno: "bookmarkProperties/description" }
-};
-
-// This is the column that's sorted if one is not specified and the tree is
-// currently unsorted. Set it to a key substring in the name of one of the
-// nsINavHistoryQueryOptions.SORT_BY_* constants, e.g., "TITLE", "URI".
-// Method ViewMenu.setSortColumn in browser/components/places/content/places.js
-// determines this value.
-const DEFAULT_SORT_KEY = "TITLE";
-
-// Part of the test is checking that sorts stick, so each time we sort we need
-// to remember it.
-let prevSortDir = null;
-let prevSortKey = null;
-
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- * Ensures that the sort of aTree is aSortingMode and aSortingAnno.
- *
- * @param aTree
- * the tree to check
- * @param aSortingMode
- * one of the Ci.nsINavHistoryQueryOptions.SORT_BY_* constants
- * @param aSortingAnno
- * checked only if sorting mode is one of the
- * Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_* constants
- */
-function checkSort(aTree, aSortingMode, aSortingAnno) {
- // The placeContent tree's sort is determined by the nsINavHistoryResult it
- // stores. Get it and check that the sort is what the caller expects.
- let res = aTree.result;
- isnot(res, null,
- "sanity check: placeContent.result should not return null");
-
- // Check sortingMode.
- is(res.sortingMode, aSortingMode,
- "column should now have sortingMode " + aSortingMode);
-
- // Check sortingAnnotation, but only if sortingMode is ANNOTATION.
- if ([Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING,
- Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING].
- indexOf(aSortingMode) >= 0) {
- is(res.sortingAnnotation, aSortingAnno,
- "column should now have sorting annotation " + aSortingAnno);
- }
-}
-
-/**
- * Sets the sort of aTree.
- *
- * @param aOrganizerWin
- * the Places window
- * @param aTree
- * the tree to sort
- * @param aUnsortFirst
- * true if the sort should be set to SORT_BY_NONE before sorting by aCol
- * and aDir
- * @param aShouldFail
- * true if setSortColumn should fail on aCol or aDir
- * @param aCol
- * the column of aTree by which to sort
- * @param aDir
- * either "ascending" or "descending"
- */
-function setSort(aOrganizerWin, aTree, aUnsortFirst, aShouldFail, aCol, aDir) {
- if (aUnsortFirst) {
- aOrganizerWin.ViewMenu.setSortColumn();
- checkSort(aTree, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE, "");
-
- // Remember the sort key and direction.
- prevSortKey = null;
- prevSortDir = null;
- }
-
- let failed = false;
- try {
- aOrganizerWin.ViewMenu.setSortColumn(aCol, aDir);
-
- // Remember the sort key and direction.
- if (!aCol && !aDir) {
- prevSortKey = null;
- prevSortDir = null;
- }
- else {
- if (aCol)
- prevSortKey = SORT_LOOKUP_TABLE[aCol.getAttribute("anonid")].key;
- else if (prevSortKey === null)
- prevSortKey = DEFAULT_SORT_KEY;
-
- if (aDir)
- prevSortDir = aDir.toUpperCase();
- else if (prevSortDir === null)
- prevSortDir = SORT_LOOKUP_TABLE[aCol.getAttribute("anonid")].dir;
- }
- } catch (exc) {
- failed = true;
- }
-
- is(failed, !!aShouldFail,
- "setSortColumn on column " +
- (aCol ? aCol.getAttribute("anonid") : "(no column)") +
- " with direction " + (aDir || "(no direction)") +
- " and table previously " + (aUnsortFirst ? "unsorted" : "sorted") +
- " should " + (aShouldFail ? "" : "not ") + "fail");
-}
-
-/**
- * Tries sorting by an invalid column and sort direction.
- *
- * @param aOrganizerWin
- * the Places window
- * @param aPlaceContentTree
- * the placeContent tree in aOrganizerWin
- */
-function testInvalid(aOrganizerWin, aPlaceContentTree) {
- // Invalid column should fail by throwing an exception.
- let bogusCol = document.createElement("treecol");
- bogusCol.setAttribute("anonid", "bogusColumn");
- setSort(aOrganizerWin, aPlaceContentTree, true, true, bogusCol, "ascending");
-
- // Invalid direction reverts to SORT_BY_NONE.
- setSort(aOrganizerWin, aPlaceContentTree, false, false, null, "bogus dir");
- checkSort(aPlaceContentTree, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE, "");
-}
-
-/**
- * Tests sorting aPlaceContentTree by column only and then by both column
- * and direction.
- *
- * @param aOrganizerWin
- * the Places window
- * @param aPlaceContentTree
- * the placeContent tree in aOrganizerWin
- * @param aUnsortFirst
- * true if, before each sort we try, we should sort to SORT_BY_NONE
- */
-function testSortByColAndDir(aOrganizerWin, aPlaceContentTree, aUnsortFirst) {
- let cols = aPlaceContentTree.getElementsByTagName("treecol");
- ok(cols.length > 0, "sanity check: placeContent should contain columns");
-
- for (let i = 0; i < cols.length; i++) {
- let col = cols.item(i);
- ok(col.hasAttribute("anonid"),
- "sanity check: column " + col.id + " should have anonid");
-
- let colId = col.getAttribute("anonid");
- ok(colId in SORT_LOOKUP_TABLE,
- "sanity check: unexpected placeContent column anonid");
-
- let sortConst =
- "SORT_BY_" + SORT_LOOKUP_TABLE[colId].key + "_" +
- (aUnsortFirst ? SORT_LOOKUP_TABLE[colId].dir : prevSortDir);
- let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
- let expectedAnno = SORT_LOOKUP_TABLE[colId].anno || "";
-
- // Test sorting by only a column.
- setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, col);
- checkSort(aPlaceContentTree, expectedSortMode, expectedAnno);
-
- // Test sorting by both a column and a direction.
- ["ascending", "descending"].forEach(function (dir) {
- let sortConst =
- "SORT_BY_" + SORT_LOOKUP_TABLE[colId].key + "_" + dir.toUpperCase();
- let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
- setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, col, dir);
- checkSort(aPlaceContentTree, expectedSortMode, expectedAnno);
- });
- }
-}
-
-/**
- * Tests sorting aPlaceContentTree by direction only.
- *
- * @param aOrganizerWin
- * the Places window
- * @param aPlaceContentTree
- * the placeContent tree in aOrganizerWin
- * @param aUnsortFirst
- * true if, before each sort we try, we should sort to SORT_BY_NONE
- */
-function testSortByDir(aOrganizerWin, aPlaceContentTree, aUnsortFirst) {
- ["ascending", "descending"].forEach(function (dir) {
- let key = (aUnsortFirst ? DEFAULT_SORT_KEY : prevSortKey);
- let sortConst = "SORT_BY_" + key + "_" + dir.toUpperCase();
- let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
- setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, null, dir);
- checkSort(aPlaceContentTree, expectedSortMode, "");
- });
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-function test() {
- waitForExplicitFinish();
-
- openLibrary(function (win) {
- let tree = win.document.getElementById("placeContent");
- isnot(tree, null, "sanity check: placeContent tree should exist");
- // Run the tests.
- testSortByColAndDir(win, tree, true);
- testSortByColAndDir(win, tree, false);
- testSortByDir(win, tree, true);
- testSortByDir(win, tree, false);
- testInvalid(win, tree);
- // Reset the sort to SORT_BY_NONE.
- setSort(win, tree, false, false);
- // Close the window and finish.
- win.close();
- finish();
- });
-}
diff --git a/browser/components/places/tests/browser/browser_toolbar_migration.js b/browser/components/places/tests/browser/browser_toolbar_migration.js
deleted file mode 100644
index c344aa1c1..000000000
--- a/browser/components/places/tests/browser/browser_toolbar_migration.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * Tests PersonalToolbar migration path.
- */
-
-let bg = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver);
-let gOriginalMigrationVersion;
-const BROWSER_URL = getBrowserURL();
-
-let localStore = {
- get RDF() Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService),
- get store() this.RDF.GetDataSource("rdf:local-store"),
-
- get toolbar()
- {
- delete this.toolbar;
- let toolbar = this.RDF.GetResource(BROWSER_URL + "#PersonalToolbar");
- // Add the entry to the persisted set for this document if it's not there.
- // See XULDocument::Persist.
- let doc = this.RDF.GetResource(BROWSER_URL);
- let persist = this.RDF.GetResource("http://home.netscape.com/NC-rdf#persist");
- if (!this.store.HasAssertion(doc, persist, toolbar, true)) {
- this.store.Assert(doc, persist, toolbar, true);
- }
- return this.toolbar = toolbar;
- },
-
- getPersist: function getPersist(aProperty)
- {
- let property = this.RDF.GetResource(aProperty);
- let target = this.store.GetTarget(this.toolbar, property, true);
- if (target instanceof Ci.nsIRDFLiteral)
- return target.Value;
- return null;
- },
-
- setPersist: function setPersist(aProperty, aValue)
- {
- let property = this.RDF.GetResource(aProperty);
- let value = aValue ? this.RDF.GetLiteral(aValue) : null;
-
- try {
- let oldTarget = this.store.GetTarget(this.toolbar, property, true);
- if (oldTarget && value) {
- this.store.Change(this.toolbar, property, oldTarget, value);
- }
- else if (value) {
- this.store.Assert(this.toolbar, property, value, true);
- }
- else if (oldTarget) {
- this.store.Unassert(this.toolbar, property, oldTarget);
- }
- else {
- return;
- }
- }
- catch(ex) {
- return;
- }
- this.store.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
- }
-};
-
-let gTests = [
-
-function test_explicitly_collapsed_toolbar()
-{
- info("An explicitly collapsed toolbar should not be uncollapsed.");
- localStore.setPersist("collapsed", "true");
- bg.observe(null, "browser-glue-test", "force-ui-migration");
- is(localStore.getPersist("collapsed"), "true", "Toolbar is collapsed");
-},
-
-function test_customized_toolbar()
-{
- info("A customized toolbar should be uncollapsed.");
- localStore.setPersist("currentset", "splitter");
- bg.observe(null, "browser-glue-test", "force-ui-migration");
- is(localStore.getPersist("collapsed"), "false", "Toolbar has been uncollapsed");
-},
-
-function test_many_bookmarks_toolbar()
-{
- info("A toolbar with added bookmarks should be uncollapsed.");
- let ids = [];
- ids.push(
- PlacesUtils.bookmarks.insertSeparator(PlacesUtils.toolbarFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX)
- );
- ids.push(
- PlacesUtils.bookmarks.insertSeparator(PlacesUtils.toolbarFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX)
- );
- ids.push(
- PlacesUtils.bookmarks.insertSeparator(PlacesUtils.toolbarFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX)
- );
- bg.observe(null, "browser-glue-test", "force-ui-migration");
- is(localStore.getPersist("collapsed"), "false", "Toolbar has been uncollapsed");
-},
-
-];
-
-function test()
-{
- gOriginalMigrationVersion = Services.prefs.getIntPref("browser.migration.version");
- registerCleanupFunction(clean);
-
- if (localStore.getPersist("currentset") !== null) {
- info("Toolbar currentset was persisted by a previous test, fixing it.");
- localStore.setPersist("currentset", null);
- }
-
- if (localStore.getPersist("collapsed") !== null) {
- info("Toolbar collapsed status was persisted by a previous test, fixing it.");
- localStore.setPersist("collapsed", null);
- }
-
- while (gTests.length) {
- clean();
- Services.prefs.setIntPref("browser.migration.version", 4);
- gTests.shift().call();
- }
-}
-
-function clean()
-{
- Services.prefs.setIntPref("browser.migration.version", gOriginalMigrationVersion);
- localStore.setPersist("currentset", null);
- localStore.setPersist("collapsed", null);
-}
-
diff --git a/browser/components/places/tests/browser/browser_views_liveupdate.js b/browser/components/places/tests/browser/browser_views_liveupdate.js
deleted file mode 100644
index 506f3d091..000000000
--- a/browser/components/places/tests/browser/browser_views_liveupdate.js
+++ /dev/null
@@ -1,474 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests Places views (menu, toolbar, tree) for liveupdate.
- */
-
-let toolbar = document.getElementById("PersonalToolbar");
-let wasCollapsed = toolbar.collapsed;
-
-function test() {
- // Uncollapse the personal toolbar if needed.
- if (wasCollapsed)
- setToolbarVisibility(toolbar, true);
-
- waitForExplicitFinish();
-
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils in context");
- ok(PlacesUIUtils, "PlacesUIUtils in context");
-
- // Open bookmarks menu.
- var popup = document.getElementById("bookmarksMenuPopup");
- ok(popup, "Menu popup element exists");
- fakeOpenPopup(popup);
-
- // Open bookmarks sidebar.
- var sidebar = document.getElementById("sidebar");
- sidebar.addEventListener("load", function() {
- sidebar.removeEventListener("load", arguments.callee, true);
- // Need to executeSoon since the tree is initialized on sidebar load.
- executeSoon(startTest);
- }, true);
- toggleSidebar("viewBookmarksSidebar", true);
-}
-
-/**
- * Simulates popup opening causing it to populate.
- * We cannot just use menu.open, since it would not work on Mac due to native menubar.
- */
-function fakeOpenPopup(aPopup) {
- var popupEvent = document.createEvent("MouseEvent");
- popupEvent.initMouseEvent("popupshowing", true, true, window, 0,
- 0, 0, 0, 0, false, false, false, false,
- 0, null);
- aPopup.dispatchEvent(popupEvent);
-}
-
-/**
- * Adds bookmarks observer, and executes a bunch of bookmarks operations.
- */
-function startTest() {
- var bs = PlacesUtils.bookmarks;
- // Add observers.
- bs.addObserver(bookmarksObserver, false);
- PlacesUtils.annotations.addObserver(bookmarksObserver, false);
- var addedBookmarks = [];
-
- // MENU
- info("*** Acting on menu bookmarks");
- var id = bs.insertBookmark(bs.bookmarksMenuFolder,
- PlacesUtils._uri("http://bm1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bm1");
- bs.setItemTitle(id, "bm1_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(bs.bookmarksMenuFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "bm2");
- bs.setItemTitle(id, "");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.bookmarksMenuFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.bookmarksMenuFolder,
- "bmf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "bmf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://bmf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bmf1");
- bs.setItemTitle(id, "bmf1_edited");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.bookmarksMenuFolder, 0);
-
- // TOOLBAR
- info("*** Acting on toolbar bookmarks");
- id = bs.insertBookmark(bs.toolbarFolder,
- PlacesUtils._uri("http://tb1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "tb1");
- bs.setItemTitle(id, "tb1_edited");
- addedBookmarks.push(id);
- // Test live update of title.
- bs.setItemTitle(id, "tb1_edited");
- id = bs.insertBookmark(bs.toolbarFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "tb2");
- bs.setItemTitle(id, "");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.toolbarFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.toolbarFolder,
- "tbf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "tbf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://tbf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "tbf1");
- bs.setItemTitle(id, "tbf1_edited");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.toolbarFolder, 0);
-
- // UNSORTED
- info("*** Acting on unsorted bookmarks");
- id = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri("http://ub1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "ub1");
- bs.setItemTitle(id, "ub1_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(bs.unfiledBookmarksFolder,
- PlacesUtils._uri("place:"),
- bs.DEFAULT_INDEX,
- "ub2");
- bs.setItemTitle(id, "ub2_edited");
- addedBookmarks.push(id);
- id = bs.insertSeparator(bs.unfiledBookmarksFolder, bs.DEFAULT_INDEX);
- addedBookmarks.push(id);
- id = bs.createFolder(bs.unfiledBookmarksFolder,
- "ubf",
- bs.DEFAULT_INDEX);
- bs.setItemTitle(id, "ubf_edited");
- addedBookmarks.push(id);
- id = bs.insertBookmark(id,
- PlacesUtils._uri("http://ubf1.mozilla.org/"),
- bs.DEFAULT_INDEX,
- "bubf1");
- bs.setItemTitle(id, "bubf1_edited");
- addedBookmarks.push(id);
- bs.moveItem(id, bs.unfiledBookmarksFolder, 0);
-
- // Remove all added bookmarks.
- addedBookmarks.forEach(function (aItem) {
- // If we remove an item after its containing folder has been removed,
- // this will throw, but we can ignore that.
- try {
- bs.removeItem(aItem);
- } catch (ex) {}
- });
-
- // Remove observers.
- bs.removeObserver(bookmarksObserver);
- PlacesUtils.annotations.removeObserver(bookmarksObserver);
- finishTest();
-}
-
-/**
- * Restores browser state and calls finish.
- */
-function finishTest() {
- // Close bookmarks sidebar.
- toggleSidebar("viewBookmarksSidebar", false);
-
- // Collapse the personal toolbar if needed.
- if (wasCollapsed)
- setToolbarVisibility(toolbar, false);
-
- finish();
-}
-
-/**
- * The observer is where magic happens, for every change we do it will look for
- * nodes positions in the affected views.
- */
-var bookmarksObserver = {
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsINavBookmarkObserver
- , Ci.nsIAnnotationObserver
- ]),
-
- // nsIAnnotationObserver
- onItemAnnotationSet: function() {},
- onItemAnnotationRemoved: function() {},
- onPageAnnotationSet: function() {},
- onPageAnnotationRemoved: function() {},
-
- // nsINavBookmarkObserver
- onItemAdded: function PSB_onItemAdded(aItemId, aFolderId, aIndex,
- aItemType, aURI) {
- var views = getViewsForFolder(aFolderId);
- ok(views.length > 0, "Found affected views (" + views.length + "): " + views);
-
- // Check that item has been added in the correct position.
- for (var i = 0; i < views.length; i++) {
- var [node, index] = searchItemInView(aItemId, views[i]);
- isnot(node, null, "Found new Places node in " + views[i]);
- is(index, aIndex, "Node is at index " + index);
- }
- },
-
- onItemRemoved: function PSB_onItemRemoved(aItemId, aFolder, aIndex,
- aItemType) {
- var views = getViewsForFolder(aFolderId);
- ok(views.length > 0, "Found affected views (" + views.length + "): " + views);
- // Check that item has been removed.
- for (var i = 0; i < views.length; i++) {
- var node = null;
- var index = null;
- [node, index] = searchItemInView(aItemId, views[i]);
- is(node, null, "Places node not found in " + views[i]);
- }
- },
-
- onItemMoved: function(aItemId,
- aOldFolderId, aOldIndex,
- aNewFolderId, aNewIndex,
- aItemType) {
- var views = getViewsForFolder(aNewFolderId);
- ok(views.length > 0, "Found affected views: " + views);
-
- // Check that item has been moved in the correct position.
- for (var i = 0; i < views.length; i++) {
- var node = null;
- var index = null;
- [node, index] = searchItemInView(aItemId, views[i]);
- isnot(node, null, "Found new Places node in " + views[i]);
- is(index, aNewIndex, "Node is at index " + index);
- }
- },
-
- onBeginUpdateBatch: function PSB_onBeginUpdateBatch() {},
- onEndUpdateBatch: function PSB_onEndUpdateBatch() {},
- onItemVisited: function() {},
-
- onItemChanged: function PSB_onItemChanged(aItemId, aProperty,
- aIsAnnotationProperty, aNewValue,
- aLastModified, aItemType,
- aParentId) {
- if (aProperty !== "title")
- return;
-
- var views = getViewsForFolder(aParentId);
- ok(views.length > 0, "Found affected views (" + views.length + "): " + views);
-
- // Check that item has been moved in the correct position.
- let validator = function(aElementOrTreeIndex) {
- if (typeof(aElementOrTreeIndex) == "number") {
- var sidebar = document.getElementById("sidebar");
- var tree = sidebar.contentDocument.getElementById("bookmarks-view");
- let cellText = tree.view.getCellText(aElementOrTreeIndex,
- tree.columns.getColumnAt(0));
- if (!aNewValue)
- return cellText == PlacesUIUtils.getBestTitle(tree.view.nodeForTreeIndex(aElementOrTreeIndex), true);
- return cellText == aNewValue;
- }
- else {
- if (!aNewValue && aElementOrTreeIndex.localName != "toolbarbutton")
- return aElementOrTreeIndex.getAttribute("label") == PlacesUIUtils.getBestTitle(aElementOrTreeIndex._placesNode);
- return aElementOrTreeIndex.getAttribute("label") == aNewValue;
- }
- };
-
- for (var i = 0; i < views.length; i++) {
- var [node, index, valid] = searchItemInView(aItemId, views[i], validator);
- isnot(node, null, "Found changed Places node in " + views[i]);
- is(node.title, aNewValue, "Node has correct title: " + aNewValue);
- ok(valid, "Node element has correct label: " + aNewValue);
- }
- }
-};
-
-/**
- * Search an item id in a view.
- *
- * @param aItemId
- * item id of the item to search.
- * @param aView
- * either "toolbar", "menu" or "sidebar"
- * @param aValidator
- * function to check validity of the found node element.
- * @returns [node, index, valid] or [null, null, false] if not found.
- */
-function searchItemInView(aItemId, aView, aValidator) {
- switch (aView) {
- case "toolbar":
- return getNodeForToolbarItem(aItemId, aValidator);
- case "menu":
- return getNodeForMenuItem(aItemId, aValidator);
- case "sidebar":
- return getNodeForSidebarItem(aItemId, aValidator);
- }
-
- return [null, null, false];
-}
-
-/**
- * Get places node and index for an itemId in bookmarks toolbar view.
- *
- * @param aItemId
- * item id of the item to search.
- * @returns [node, index] or [null, null] if not found.
- */
-function getNodeForToolbarItem(aItemId, aValidator) {
- var toolbar = document.getElementById("PlacesToolbarItems");
-
- function findNode(aContainer) {
- var children = aContainer.childNodes;
- for (var i = 0, staticNodes = 0; i < children.length; i++) {
- var child = children[i];
-
- // Is this a Places node?
- if (!child._placesNode) {
- staticNodes++;
- continue;
- }
-
- if (child._placesNode.itemId == aItemId) {
- let valid = aValidator ? aValidator(child) : true;
- return [child._placesNode, i - staticNodes, valid];
- }
-
- // Don't search in queries, they could contain our item in a
- // different position. Search only folders
- if (PlacesUtils.nodeIsFolder(child._placesNode)) {
- var popup = child.lastChild;
- popup.showPopup(popup);
- var foundNode = findNode(popup);
- popup.hidePopup();
- if (foundNode[0] != null)
- return foundNode;
- }
- }
- return [null, null];
- }
-
- return findNode(toolbar);
-}
-
-/**
- * Get places node and index for an itemId in bookmarks menu view.
- *
- * @param aItemId
- * item id of the item to search.
- * @returns [node, index] or [null, null] if not found.
- */
-function getNodeForMenuItem(aItemId, aValidator) {
- var menu = document.getElementById("bookmarksMenu");
-
- function findNode(aContainer) {
- var children = aContainer.childNodes;
- for (var i = 0, staticNodes = 0; i < children.length; i++) {
- var child = children[i];
-
- // Is this a Places node?
- if (!child._placesNode) {
- staticNodes++;
- continue;
- }
-
- if (child._placesNode.itemId == aItemId) {
- let valid = aValidator ? aValidator(child) : true;
- return [child._placesNode, i - staticNodes, valid];
- }
-
- // Don't search in queries, they could contain our item in a
- // different position. Search only folders
- if (PlacesUtils.nodeIsFolder(child._placesNode)) {
- var popup = child.lastChild;
- fakeOpenPopup(popup);
- var foundNode = findNode(popup);
-
- child.open = false;
- if (foundNode[0] != null)
- return foundNode;
- }
- }
- return [null, null, false];
- }
-
- return findNode(menu.lastChild);
-}
-
-/**
- * Get places node and index for an itemId in sidebar tree view.
- *
- * @param aItemId
- * item id of the item to search.
- * @returns [node, index] or [null, null] if not found.
- */
-function getNodeForSidebarItem(aItemId, aValidator) {
- var sidebar = document.getElementById("sidebar");
- var tree = sidebar.contentDocument.getElementById("bookmarks-view");
-
- function findNode(aContainerIndex) {
- if (tree.view.isContainerEmpty(aContainerIndex))
- return [null, null, false];
-
- // The rowCount limit is just for sanity, but we will end looping when
- // we have checked the last child of this container or we have found node.
- for (var i = aContainerIndex + 1; i < tree.view.rowCount; i++) {
- var node = tree.view.nodeForTreeIndex(i);
-
- if (node.itemId == aItemId) {
- // Minus one because we want relative index inside the container.
- let valid = aValidator ? aValidator(i) : true;
- return [node, i - tree.view.getParentIndex(i) - 1, valid];
- }
-
- if (PlacesUtils.nodeIsFolder(node)) {
- // Open container.
- tree.view.toggleOpenState(i);
- // Search inside it.
- var foundNode = findNode(i);
- // Close container.
- tree.view.toggleOpenState(i);
- // Return node if found.
- if (foundNode[0] != null)
- return foundNode;
- }
-
- // We have finished walking this container.
- if (!tree.view.hasNextSibling(aContainerIndex + 1, i))
- break;
- }
- return [null, null, false]
- }
-
- // Root node is hidden, so we need to manually walk the first level.
- for (var i = 0; i < tree.view.rowCount; i++) {
- // Open container.
- tree.view.toggleOpenState(i);
- // Search inside it.
- var foundNode = findNode(i);
- // Close container.
- tree.view.toggleOpenState(i);
- // Return node if found.
- if (foundNode[0] != null)
- return foundNode;
- }
- return [null, null, false];
-}
-
-/**
- * Get views affected by changes to a folder.
- *
- * @param aFolderId:
- * item id of the folder we have changed.
- * @returns a subset of views: ["toolbar", "menu", "sidebar"]
- */
-function getViewsForFolder(aFolderId) {
- var rootId = aFolderId;
- while (!PlacesUtils.isRootItem(rootId))
- rootId = PlacesUtils.bookmarks.getFolderIdForItem(rootId);
-
- switch (rootId) {
- case PlacesUtils.toolbarFolderId:
- return ["toolbar", "sidebar"]
- break;
- case PlacesUtils.bookmarksMenuFolderId:
- return ["menu", "sidebar"]
- break;
- case PlacesUtils.unfiledBookmarksFolderId:
- return ["sidebar"]
- break;
- }
- return new Array();
-}
diff --git a/browser/components/places/tests/browser/frameLeft.html b/browser/components/places/tests/browser/frameLeft.html
deleted file mode 100644
index 5a54fe353..000000000
--- a/browser/components/places/tests/browser/frameLeft.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>Left frame</title>
- </head>
- <body>
- <a id="clickme" href="frameRight.html" target="right">Open page in the right frame.</a>
- </body>
-</html>
diff --git a/browser/components/places/tests/browser/frameRight.html b/browser/components/places/tests/browser/frameRight.html
deleted file mode 100644
index 226accc34..000000000
--- a/browser/components/places/tests/browser/frameRight.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>Right Frame</title>
- </head>
- <body>
- This is the right frame.
- </body>
-</html>
diff --git a/browser/components/places/tests/browser/framedPage.html b/browser/components/places/tests/browser/framedPage.html
deleted file mode 100644
index d388562e6..000000000
--- a/browser/components/places/tests/browser/framedPage.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
- <head>
- <title>Framed page</title>
- </head>
- <frameset cols="*,*">
- <frame name="left" src="frameLeft.html">
- <frame name="right" src="about:mozilla">
- </frameset>
-</html>
diff --git a/browser/components/places/tests/browser/head.js b/browser/components/places/tests/browser/head.js
deleted file mode 100644
index 8020052a6..000000000
--- a/browser/components/places/tests/browser/head.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
-// We need to cache this before test runs...
-let cachedLeftPaneFolderIdGetter;
-let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) {
- if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function")
- cachedLeftPaneFolderIdGetter = getter;
-}
-// ...And restore it when test ends.
-registerCleanupFunction(function(){
- let (getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId")) {
- if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function")
- PlacesUIUtils.__defineGetter__("leftPaneFolderId",
- cachedLeftPaneFolderIdGetter);
- }
-});
-
-function openLibrary(callback, aLeftPaneRoot) {
- let library = window.openDialog("chrome://browser/content/places/places.xul",
- "", "chrome,toolbar=yes,dialog=no,resizable",
- aLeftPaneRoot);
- waitForFocus(function () {
- callback(library);
- }, library);
-
- return library;
-}
-
-/**
- * Waits for completion of a clear history operation, before
- * proceeding with aCallback.
- *
- * @param aCallback
- * Function to be called when done.
- */
-function waitForClearHistory(aCallback) {
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
-
-/**
- * Waits for all pending async statements on the default connection, before
- * proceeding with aCallback.
- *
- * @param aCallback
- * Function to be called when done.
- * @param aScope
- * Scope for the callback.
- * @param aArguments
- * Arguments array for the callback.
- *
- * @note The result is achieved by asynchronously executing a query requiring
- * a write lock. Since all statements on the same connection are
- * serialized, the end of this write operation means that all writes are
- * complete. Note that WAL makes so that writers don't block readers, but
- * this is a problem only across different connections.
- */
-function waitForAsyncUpdates(aCallback, aScope, aArguments)
-{
- let scope = aScope || this;
- let args = aArguments || [];
- let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
- .DBConnection;
- let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
- begin.executeAsync();
- begin.finalize();
-
- let commit = db.createAsyncStatement("COMMIT");
- commit.executeAsync({
- handleResult: function() {},
- handleError: function() {},
- handleCompletion: function(aReason)
- {
- aCallback.apply(scope, args);
- }
- });
- commit.finalize();
-}
-
-/**
- * Asynchronously adds visits to a page, invoking a callback function when done.
- *
- * @param aPlaceInfo
- * Can be an nsIURI, in such a case a single LINK visit will be added.
- * Otherwise can be an object describing the visit to add, or an array
- * of these objects:
- * { uri: nsIURI of the page,
- * transition: one of the TRANSITION_* from nsINavHistoryService,
- * [optional] title: title of the page,
- * [optional] visitDate: visit date in microseconds from the epoch
- * [optional] referrer: nsIURI of the referrer for this visit
- * }
- * @param [optional] aCallback
- * Function to be invoked on completion.
- * @param [optional] aStack
- * The stack frame used to report errors.
- */
-function addVisits(aPlaceInfo, aWindow, aCallback, aStack) {
- let stack = aStack || Components.stack.caller;
- let places = [];
- if (aPlaceInfo instanceof Ci.nsIURI) {
- places.push({ uri: aPlaceInfo });
- }
- else if (Array.isArray(aPlaceInfo)) {
- places = places.concat(aPlaceInfo);
- } else {
- places.push(aPlaceInfo)
- }
-
- // Create mozIVisitInfo for each entry.
- let now = Date.now();
- for (let i = 0; i < places.length; i++) {
- if (!places[i].title) {
- places[i].title = "test visit for " + places[i].uri.spec;
- }
- places[i].visits = [{
- transitionType: places[i].transition === undefined ? Ci.nsINavHistoryService.TRANSITION_LINK
- : places[i].transition,
- visitDate: places[i].visitDate || (now++) * 1000,
- referrerURI: places[i].referrer
- }];
- }
-
- aWindow.PlacesUtils.asyncHistory.updatePlaces(
- places,
- {
- handleError: function AAV_handleError() {
- throw("Unexpected error in adding visit.");
- },
- handleResult: function () {},
- handleCompletion: function UP_handleCompletion() {
- if (aCallback)
- aCallback();
- }
- }
- );
-}
-
-XPCOMUtils.defineLazyModuleGetter(this, "Promise",
- "resource://gre/modules/commonjs/sdk/core/promise.js");
-
diff --git a/browser/components/places/tests/browser/moz.build b/browser/components/places/tests/browser/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/places/tests/browser/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/places/tests/browser/sidebarpanels_click_test_page.html b/browser/components/places/tests/browser/sidebarpanels_click_test_page.html
deleted file mode 100644
index c73eaa540..000000000
--- a/browser/components/places/tests/browser/sidebarpanels_click_test_page.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<head>
- <title>browser_sidebarpanels_click.js test page</title>
-</head>
-<body onload="alert('test');">
-</body>
-</html>
diff --git a/browser/components/places/tests/chrome/Makefile.in b/browser/components/places/tests/chrome/Makefile.in
deleted file mode 100644
index 06fc35cef..000000000
--- a/browser/components/places/tests/chrome/Makefile.in
+++ /dev/null
@@ -1,26 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_CHROME_FILES = \
- head.js \
- test_treeview_date.xul \
- test_bug485100-change-case-loses-tag.xul \
- test_bug427633_no_newfolder_if_noip.xul \
- test_0_multiple_left_pane.xul \
- test_0_bug510634.xul \
- test_bug549192.xul \
- test_bug549491.xul \
- test_editBookmarkOverlay_tags_liveUpdate.xul \
- test_bug631374_tags_selector_scroll.xul \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/places/tests/chrome/head.js b/browser/components/places/tests/chrome/head.js
deleted file mode 100644
index 878c28c92..000000000
--- a/browser/components/places/tests/chrome/head.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Asynchronously adds visits to a page, invoking a callback function when done.
- *
- * @param aPlaceInfo
- * Can be an nsIURI, in such a case a single LINK visit will be added.
- * Otherwise can be an object describing the visit to add, or an array
- * of these objects:
- * { uri: nsIURI of the page,
- * transition: one of the TRANSITION_* from nsINavHistoryService,
- * [optional] title: title of the page,
- * [optional] visitDate: visit date in microseconds from the epoch
- * [optional] referrer: nsIURI of the referrer for this visit
- * }
- * @param [optional] aCallback
- * Function to be invoked on completion.
- */
-function addVisits(aPlaceInfo, aCallback) {
- let places = [];
- if (aPlaceInfo instanceof Ci.nsIURI) {
- places.push({ uri: aPlaceInfo });
- }
- else if (Array.isArray(aPlaceInfo)) {
- places = places.concat(aPlaceInfo);
- } else {
- places.push(aPlaceInfo)
- }
-
- // Create mozIVisitInfo for each entry.
- let now = Date.now();
- for (let i = 0; i < places.length; i++) {
- if (!places[i].title) {
- places[i].title = "test visit for " + places[i].uri.spec;
- }
- places[i].visits = [{
- transitionType: places[i].transition === undefined ? PlacesUtils.history.TRANSITION_LINK
- : places[i].transition,
- visitDate: places[i].visitDate || (now++) * 1000,
- referrerURI: places[i].referrer
- }];
- }
-
- PlacesUtils.asyncHistory.updatePlaces(
- places,
- {
- handleError: function AAV_handleError() {
- throw("Unexpected error in adding visit.");
- },
- handleResult: function () {},
- handleCompletion: function UP_handleCompletion() {
- if (aCallback)
- aCallback();
- }
- }
- );
-}
-
-/**
- * Clears history invoking callback when done.
- */
-function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observer, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, TOPIC_EXPIRATION_FINISHED, false);
- Cc["@mozilla.org/browser/nav-history-service;1"]
- .getService(Ci.nsINavHistoryService)
- .QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
-}
diff --git a/browser/components/places/tests/chrome/moz.build b/browser/components/places/tests/chrome/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/places/tests/chrome/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/places/tests/chrome/test_0_bug510634.xul b/browser/components/places/tests/chrome/test_0_bug510634.xul
deleted file mode 100644
index 1ff1c960b..000000000
--- a/browser/components/places/tests/chrome/test_0_bug510634.xul
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="510634: Wrong icons on bookmarks sidebar"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <tree id="tree"
- type="places"
- flex="1">
- <treecols>
- <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
- </treecols>
- <treechildren flex="1"/>
- </tree>
-
- <script type="application/javascript">
- <![CDATA[
-
- /**
- * Bug 510634 - Wrong icons on bookmarks sidebar
- * https://bugzilla.mozilla.org/show_bug.cgi?id=510634
- *
- * Ensures that properties for special queries are set on their tree nodes,
- * even if PlacesUIUtils.leftPaneFolderId was not initialized.
- */
-
- SimpleTest.waitForExplicitFinish();
-
- // converts nsISupportsArray of atoms to a simple JS-strings array
- function runTest() {
- // We need to cache and restore this getter in order to simulate
- // Bug 510634
- let cachedLeftPaneFolderIdGetter =
- PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
- // Must also cache and restore this getter as it is affected by
- // leftPaneFolderId, from bug 564900.
- let cachedAllBookmarksFolderIdGetter =
- PlacesUIUtils.__lookupGetter__("allBookmarksFolderId");
-
- let leftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
-
- // restore the getter
- PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
-
- // Setup the places tree contents.
- let tree = document.getElementById("tree");
- tree.place = "place:queryType=1&folder=" + leftPaneFolderId;
-
- // The query-property is set on the title column for each row.
- let titleColumn = tree.treeBoxObject.columns.getColumnAt(0);
-
- // Open All Bookmarks
- tree.selectItems([PlacesUIUtils.leftPaneQueries["AllBookmarks"]]);
- PlacesUtils.asContainer(tree.selectedNode).containerOpen = true;
- is(PlacesUIUtils.allBookmarksFolderId, tree.selectedNode.itemId,
- "Opened All Bookmarks");
-
- ["History", "Downloads", "Tags", "AllBookmarks", "BookmarksToolbar",
- "BookmarksMenu", "UnfiledBookmarks"].forEach(
- function(aQueryName, aRow) {
- let found = false;
- for (let i = 0; i < tree.view.rowCount && !found; i++) {
- rowProperties = tree.view.getCellProperties(i, titleColumn).split(" ");
- found = rowProperties.indexOf("OrganizerQuery_" + aQueryName) != -1;
- }
- ok(found, "OrganizerQuery_" + aQueryName + " is set");
- }
- );
-
- // Close the root node
- tree.result.root.containerOpen = false;
-
- // Restore the getters for the next test.
- PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
- PlacesUIUtils.__defineGetter__("allBookmarksFolderId",
- cachedAllBookmarksFolderIdGetter);
-
- SimpleTest.finish();
- }
-
- ]]>
- </script>
-</window>
diff --git a/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul b/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul
deleted file mode 100644
index 39dddcba7..000000000
--- a/browser/components/places/tests/chrome/test_0_multiple_left_pane.xul
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!-- Bug 466422:
- - Check that we replace the left pane with a correct one if it gets corrupted
- - and we end up having more than one. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="Test handling of multiple left pane folders"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <p id="display"></p>
- <div id="content" style="display: none"></div>
- <pre id="test"></pre>
- </body>
-
- <script type="application/javascript">
- <![CDATA[
-
- function runTest() {
- // Sanity checks.
- ok(PlacesUtils, "PlacesUtils is running in chrome context");
- ok(PlacesUIUtils, "PlacesUIUtils is running in chrome context");
- ok(PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION > 0,
- "Left pane version in chrome context, " +
- "current version is: " + PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION );
-
- var fakeLeftPanes = [];
- var as = PlacesUtils.annotations;
- var bs = PlacesUtils.bookmarks;
-
- // We need 2 left pane folders to simulate a corrupt profile.
- do {
- let leftPaneItems = as.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- // Create a fake left pane folder.
- let fakeLeftPaneRoot = bs.createFolder(PlacesUtils.placesRootId, "",
- bs.DEFAULT_INDEX);
- as.setItemAnnotation(fakeLeftPaneRoot, PlacesUIUtils.ORGANIZER_FOLDER_ANNO,
- PlacesUIUtils.ORGANIZER_LEFTPANE_VERSION, 0,
- as.EXPIRE_NEVER);
- fakeLeftPanes.push(fakeLeftPaneRoot);
- } while (fakeLeftPanes.length < 2);
-
- // Initialize the left pane queries.
- PlacesUIUtils.leftPaneFolderId;
-
- // Check left pane.
- ok(PlacesUIUtils.leftPaneFolderId > 0,
- "Left pane folder correctly created");
- var leftPaneItems = as.getItemsWithAnnotation(PlacesUIUtils.ORGANIZER_FOLDER_ANNO);
- is(leftPaneItems.length, 1,
- "We correctly have only 1 left pane folder");
-
- // Check that all old left pane items have been removed.
- fakeLeftPanes.forEach(function(aItemId) {
- try {
- bs.getItemTitle(aItemId);
- throw("This folder should have been removed");
- } catch (ex) {}
- });
-
- }
- ]]>
- </script>
-
-</window>
diff --git a/browser/components/places/tests/chrome/test_bug427633_no_newfolder_if_noip.xul b/browser/components/places/tests/chrome/test_bug427633_no_newfolder_if_noip.xul
deleted file mode 100644
index c58f380bf..000000000
--- a/browser/components/places/tests/chrome/test_bug427633_no_newfolder_if_noip.xul
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
-
-<!DOCTYPE window [
- <!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
- %editBookmarkOverlayDTD;
-]>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="Bug 427633 - Disable creating a New Folder in the bookmarks dialogs if insertionPoint is invalid"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript"
- src="chrome://browser/content/places/editBookmarkOverlay.js"/>
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <vbox id="editBookmarkPanelContent"/>
-
- <script type="application/javascript">
- <![CDATA[
-
- /**
- * Bug 427633 - Disable creating a New Folder in the bookmarks dialogs if
- * insertionPoint is invalid.
- */
-
- function runTest() {
- var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
- var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
- function uri(spec) {
- return ios.newURI(spec, null, null);
- }
-
- // Add a bookmark.
- var itemId = bs.insertBookmark(PlacesUtils.toolbarFolderId,
- uri("http://www.example.com/"),
- bs.DEFAULT_INDEX,
- "mozilla");
-
- // Init panel.
- ok(gEditItemOverlay, "gEditItemOverlay is in context");
- gEditItemOverlay.initPanel(itemId);
- ok(gEditItemOverlay._initialized, "gEditItemOverlay is initialized");
- // We must be sure tree is initialized, so we wait for place to be set.
- SimpleTest.waitForExplicitFinish();
- var tree = gEditItemOverlay._element("folderTree");
- tree.addEventListener("DOMAttrModified", function(event) {
- if (event.attrName != "place")
- return;
- tree.removeEventListener("DOMAttrModified", arguments.callee, false);
- SimpleTest.executeSoon(function() {
- tree.view.selection.clearSelection();
- ok(document.getElementById("editBMPanel_newFolderButton").disabled,
- "New folder button is disabled if there's no selection");
-
- // Cleanup.
- bs.removeItem(itemId);
- SimpleTest.finish();
- });
- }, false);
- // Open the folder tree.
- document.getElementById("editBMPanel_foldersExpander").doCommand();
- }
- ]]>
- </script>
-
-</window>
diff --git a/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul b/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul
deleted file mode 100644
index 7b7f3669d..000000000
--- a/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
-
-<!DOCTYPE window [
- <!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
- %editBookmarkOverlayDTD;
-]>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="485100: Exchanging a letter of a tag name with its big/small equivalent removes tag from bookmark"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript"
- src="chrome://browser/content/places/editBookmarkOverlay.js"/>
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <vbox id="editBookmarkPanelContent"/>
-
- <script type="application/javascript">
- <![CDATA[
-
- function runTest() {
- var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
- var ts = Cc["@mozilla.org/browser/tagging-service;1"].
- getService(Ci.nsITaggingService);
- var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
- function uri(spec) {
- return ios.newURI(spec, null, null);
- }
-
- var testURI = uri("http://www.example.com/");
- var testTag = "foo";
- var testTagUpper = "Foo";
-
- // Add a bookmark
- var itemId = bs.insertBookmark(bs.toolbarFolder,
- testURI,
- bs.DEFAULT_INDEX,
- "mozilla");
-
- // Init panel
- ok(gEditItemOverlay, "gEditItemOverlay is in context");
- gEditItemOverlay.initPanel(itemId);
-
- // add a tag
- document.getElementById("editBMPanel_tagsField").value = testTag;
- gEditItemOverlay.onTagsFieldBlur();
-
- // test that the tag has been added in the backend
- is(ts.getTagsForURI(testURI)[0], testTag, "tags match");
-
- // change the tag
- document.getElementById("editBMPanel_tagsField").value = testTagUpper;
- gEditItemOverlay.onTagsFieldBlur();
-
- // test that the tag has been added in the backend
- is(ts.getTagsForURI(testURI)[0], testTagUpper, "tags match");
-
- // Cleanup.
- ts.untagURI(testURI, [testTag]);
- bs.removeItem(itemId);
- }
- ]]>
- </script>
-
-</window>
diff --git a/browser/components/places/tests/chrome/test_bug549192.xul b/browser/components/places/tests/chrome/test_bug549192.xul
deleted file mode 100644
index d4c443516..000000000
--- a/browser/components/places/tests/chrome/test_bug549192.xul
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/licenses/publicdomain/
- -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="549192: History view not updated after deleting entry"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript" src="head.js" />
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <tree id="tree"
- type="places"
- flatList="true"
- flex="1">
- <treecols>
- <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
- </treecols>
- <treechildren flex="1"/>
- </tree>
-
- <script type="application/javascript"><![CDATA[
- /**
- * Bug 874407
- * Ensures that history views are updated properly after visits.
- * Bug 549192
- * Ensures that history views are updated after deleting entries.
- */
-
- SimpleTest.waitForExplicitFinish();
-
- function runTest() {
- // The mochitest page is added to history.
- waitForClearHistory(continue_test);
- }
-
- function continue_test() {
- // Add some visits.
- let vtime = Date.now() * 1000;
- const ttype = PlacesUtils.history.TRANSITION_TYPED;
- let places =
- [{ uri: Services.io.newURI("http://example.tld/", null, null),
- visitDate: ++vtime, transition: ttype },
- { uri: Services.io.newURI("http://example2.tld/", null, null),
- visitDate: ++vtime, transition: ttype },
- { uri: Services.io.newURI("http://example3.tld/", null, null),
- visitDate: ++vtime, transition: ttype }];
-
- addVisits(places, function() {
- // Make a history query.
- let query = PlacesUtils.history.getNewQuery();
- let opts = PlacesUtils.history.getNewQueryOptions();
- opts.sortingMode = opts.SORT_BY_DATE_DESCENDING;
- let queryURI = PlacesUtils.history.queriesToQueryString([query], 1, opts);
-
- // Setup the places tree contents.
- var tree = document.getElementById("tree");
- tree.place = queryURI;
-
- // loop through the rows and check them.
- let treeView = tree.view;
- let selection = treeView.selection;
- let rc = treeView.rowCount;
-
- for (let i = 0; i < rc; i++) {
- selection.select(i);
- let node = tree.selectedNode;
- is(node.uri, places[rc - i - 1].uri.spec,
- "Found expected node at position " + i + ".");
- }
-
- is(rc, 3, "Found expected number of rows.");
-
- // First check live-update of the view when adding visits.
- places.forEach(place => place.visitDate = ++vtime);
- addVisits(places, function() {
- for (let i = 0; i < rc; i++) {
- selection.select(i);
- let node = tree.selectedNode;
- is(node.uri, places[rc - i - 1].uri.spec,
- "Found expected node at position " + i + ".");
- }
-
- // Now remove the pages and verify live-update again.
- for (let i = 0; i < rc; i++) {
- selection.select(0);
- let node = tree.selectedNode;
- tree.controller.remove("Removing page");
- ok(treeView.treeIndexForNode(node) == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE,
- node.uri + " removed.");
- ok(treeView.rowCount == rc - i - 1, "Rows count decreased");
- }
-
- // Cleanup.
- waitForClearHistory(SimpleTest.finish);
- });
- });
- }
-
- ]]></script>
-</window>
diff --git a/browser/components/places/tests/chrome/test_bug549491.xul b/browser/components/places/tests/chrome/test_bug549491.xul
deleted file mode 100644
index fdc499245..000000000
--- a/browser/components/places/tests/chrome/test_bug549491.xul
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/licenses/publicdomain/
- -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="549491: 'The root node is never visible' exception when details of the root node are modified "
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript" src="head.js" />
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <tree id="tree"
- type="places"
- flatList="true"
- flex="1">
- <treecols>
- <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol label="Date" anonid="date" flex="1"/>
- </treecols>
- <treechildren flex="1"/>
- </tree>
-
- <script type="application/javascript"><![CDATA[
- /**
- * Bug 549491
- * https://bugzilla.mozilla.org/show_bug.cgi?id=549491
- *
- * Ensures that changing the details of places tree's root-node doesn't
- * throw.
- */
-
- SimpleTest.waitForExplicitFinish();
-
- function runTest() {
- // The mochitest page is added to history.
- waitForClearHistory(continue_test);
- }
-
- function continue_test() {
- addVisits(
- {uri: Services.io.newURI("http://example.tld/", null, null),
- transition: PlacesUtils.history.TRANSITION_TYPED},
- function() {
- // Make a history query.
- let query = PlacesUtils.history.getNewQuery();
- let opts = PlacesUtils.history.getNewQueryOptions();
- let queryURI = PlacesUtils.history.queriesToQueryString([query], 1, opts);
-
- // Setup the places tree contents.
- let tree = document.getElementById("tree");
- tree.place = queryURI;
-
- let rootNode = tree.result.root;
- let obs = tree.view.QueryInterface(Ci.nsINavHistoryResultObserver);
- obs.nodeHistoryDetailsChanged(rootNode, rootNode.time, rootNode.accessCount);
- obs.nodeTitleChanged(rootNode, rootNode.title);
- ok(true, "No exceptions thrown");
-
- // Cleanup.
- waitForClearHistory(SimpleTest.finish);
- });
- }
-
- /**
- * Clears history invoking callback when done.
- */
- function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
- }
-
- ]]></script>
-</window>
diff --git a/browser/components/places/tests/chrome/test_bug631374_tags_selector_scroll.xul b/browser/components/places/tests/chrome/test_bug631374_tags_selector_scroll.xul
deleted file mode 100644
index ffec971b4..000000000
--- a/browser/components/places/tests/chrome/test_bug631374_tags_selector_scroll.xul
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
-
-<!DOCTYPE window [
- <!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
- %editBookmarkOverlayDTD;
-]>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="Bug 631374 - Editing tags in the selector scrolls up the listbox"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript"
- src="chrome://browser/content/places/editBookmarkOverlay.js"/>
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <vbox id="editBookmarkPanelContent"/>
-
- <script type="application/javascript">
- <![CDATA[
-
- /**
- * This test checks that editing tags doesn't scroll the tags selector
- * listbox to wrong positions.
- */
-
- function runTest() {
- SimpleTest.waitForExplicitFinish();
-
- Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
- let tags = ["a", "b", "c", "d", "e", "f", "g",
- "h", "i", "l", "m", "n", "o", "p"];
-
- // Add a bookmark and tag it.
- let uri1 = NetUtil.newURI("http://www1.mozilla.org/");
- let id1 = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.toolbarFolderId, uri1,
- PlacesUtils.bookmarks.DEFAULT_INDEX, "mozilla"
- );
- PlacesUtils.tagging.tagURI(uri1, tags);
-
- // Add a second bookmark so that tags won't disappear when unchecked.
- let uri2 = NetUtil.newURI("http://www2.mozilla.org/");
- let id2 = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.toolbarFolderId, uri2,
- PlacesUtils.bookmarks.DEFAULT_INDEX, "mozilla"
- );
- PlacesUtils.tagging.tagURI(uri2, tags);
-
- // Init panel.
- ok(gEditItemOverlay, "gEditItemOverlay is in context");
- gEditItemOverlay.initPanel(id1);
- ok(gEditItemOverlay._initialized, "gEditItemOverlay is initialized");
-
- // Wait for the tags selector to be open.
- let tagsSelectorRow = document.getElementById("editBMPanel_tagsSelectorRow");
- tagsSelectorRow.addEventListener("DOMAttrModified", function (event) {
- tagsSelectorRow.removeEventListener("DOMAttrModified", arguments.callee, false);
- SimpleTest.executeSoon(function () {
- let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
-
- // Go by two so there is some untouched tag in the middle.
- for (let i = 8; i < tags.length; i += 2) {
- tagsSelector.selectedIndex = i;
- let listItem = tagsSelector.selectedItem;
- SimpleTest.isnot(listItem, null, "Valid listItem found");
-
- tagsSelector.ensureElementIsVisible(listItem);
- let visibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
-
- SimpleTest.ok(listItem.checked, "Item is checked " + i);
- let selectedTag = listItem.label;
-
- // Uncheck the tag.
- listItem.checked = false;
- SimpleTest.is(visibleIndex,
- tagsSelector.getIndexOfFirstVisibleRow(),
- "Scroll position did not change");
-
- // The listbox is rebuilt, so we have to get the new element.
- let newItem = tagsSelector.selectedItem;
- SimpleTest.isnot(newItem, null, "Valid new listItem found");
- SimpleTest.ok(!newItem.checked, "New listItem is unchecked " + i);
- SimpleTest.is(newItem.label, selectedTag,
- "Correct tag is still selected");
-
- // Check the tag.
- newItem.checked = true;
- SimpleTest.is(visibleIndex,
- tagsSelector.getIndexOfFirstVisibleRow(),
- "Scroll position did not change");
- }
-
- // Remove the second bookmark, then nuke some of the tags.
- PlacesUtils.bookmarks.removeItem(id2);
-
- // Doing this backwords tests more interesting paths.
- for (let i = tags.length - 1; i >= 0 ; i -= 2) {
- tagsSelector.selectedIndex = i;
- let listItem = tagsSelector.selectedItem;
- SimpleTest.isnot(listItem, null, "Valid listItem found");
-
- tagsSelector.ensureElementIsVisible(listItem);
- let visibleIndex = tagsSelector.getIndexOfFirstVisibleRow();
-
- SimpleTest.ok(listItem.checked, "Item is checked " + i);
- let selectedTag = listItem.label;
-
- // Uncheck the tag.
- listItem.checked = false;
- SimpleTest.is(tagsSelector.getIndexOfFirstVisibleRow(),
- Math.max(visibleIndex -1, 0),
- "Scroll position is correct");
-
- // The listbox is rebuilt, so we have to get the new element.
- let newItem = tagsSelector.selectedItem;
- SimpleTest.isnot(newItem, null, "Valid new listItem found");
- SimpleTest.ok(newItem.checked, "New listItem is checked " + i);
- SimpleTest.is(tagsSelector.selectedItem.label,
- tags[Math.min(i + 1, tags.length - 2)],
- "The next tag is now selected");
- }
-
- // Cleanup.
- PlacesUtils.bookmarks.removeItem(id1);
-
- SimpleTest.finish();
- });
- }, false);
-
- // Open the tags selector.
- document.getElementById("editBMPanel_tagsSelectorExpander").doCommand();
- }
- ]]>
- </script>
-
-</window>
diff --git a/browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul b/browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul
deleted file mode 100644
index df4f6e2e4..000000000
--- a/browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/skin/places/editBookmarkOverlay.css"?>
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-<?xul-overlay href="chrome://browser/content/places/editBookmarkOverlay.xul"?>
-
-<!DOCTYPE window [
- <!ENTITY % editBookmarkOverlayDTD SYSTEM "chrome://browser/locale/places/editBookmarkOverlay.dtd">
- %editBookmarkOverlayDTD;
-]>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="485100: Exchanging a letter of a tag name with its big/small equivalent removes tag from bookmark"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript"
- src="chrome://browser/content/places/editBookmarkOverlay.js"/>
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <vbox id="editBookmarkPanelContent"/>
-
- <script type="application/javascript">
- <![CDATA[
- function runTest()
- {
- Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
- const TEST_URI = NetUtil.newURI("http://www.test.me/");
- const TEST_URI2 = NetUtil.newURI("http://www.test.again.me/");
- const TEST_TAG = "test-tag";
-
- ok(gEditItemOverlay, "Sanity check: gEditItemOverlay is in context");
-
- // Open the tags selector.
- document.getElementById("editBMPanel_tagsSelectorRow").collapsed = false;
-
- function checkTagsSelector(aAvailableTags, aCheckedTags)
- {
- is(PlacesUtils.tagging.allTags.length, aAvailableTags.length,
- "tagging service is in sync.");
- let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
- let children = tagsSelector.childNodes;
- is(children.length, aAvailableTags.length,
- "Found expected number of tags in the tags selector");
- Array.forEach(children, function (aChild) {
- let tag = aChild.getAttribute("label");
- ok(true, "Found tag '" + tag + "' in the selector");
- ok(aAvailableTags.indexOf(tag) != -1, "Found expected tag");
- let checked = aChild.getAttribute("checked") == "true";
- is(checked, aCheckedTags.indexOf(tag) != -1,
- "Tag is correctly marked");
- });
- }
-
- // Add a bookmark.
- let itemId = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.unfiledBookmarksFolderId, TEST_URI,
- PlacesUtils.bookmarks.DEFAULT_INDEX, "test.me"
- );
-
- // Init panel.
- gEditItemOverlay.initPanel(itemId);
-
- // Add a tag.
- PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
-
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
- "Correctly added tag to a single bookmark");
- is(document.getElementById("editBMPanel_tagsField").value, TEST_TAG,
- "Editing a single bookmark shows the added tag");
- checkTagsSelector([TEST_TAG], [TEST_TAG]);
-
- // Remove tag.
- PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
- "The tag has been removed");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing a single bookmark should not show any tag");
- checkTagsSelector([], []);
-
- // Add a second bookmark.
- let itemId2 = PlacesUtils.bookmarks.insertBookmark(
- PlacesUtils.unfiledBookmarksFolderId, TEST_URI2,
- PlacesUtils.bookmarks.DEFAULT_INDEX, "test.again.me"
- );
-
- // Init panel with multiple bookmarks.
- gEditItemOverlay.initPanel([itemId, itemId2]);
-
- // Add a tag to the first bookmark.
- PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
- "Correctly added a tag to the first bookmark.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple bookmarks without matching tags should not show any tag.");
- checkTagsSelector([TEST_TAG], []);
-
- // Add a tag to the second bookmark.
- PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
- "Correctly added a tag to the second bookmark.");
- is(document.getElementById("editBMPanel_tagsField").value, TEST_TAG,
- "Editing multiple bookmarks should show matching tags.");
- checkTagsSelector([TEST_TAG], [TEST_TAG]);
-
- // Remove tag from the first bookmark.
- PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
- "Correctly removed tag from the first bookmark.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple bookmarks without matching tags should not show any tag.");
- checkTagsSelector([TEST_TAG], []);
-
- // Remove tag from the second bookmark.
- PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
- "Correctly removed tag from the second bookmark.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple bookmarks without matching tags should not show any tag.");
- checkTagsSelector([], []);
-
- // Init panel with a nsIURI entry.
- gEditItemOverlay.initPanel(TEST_URI);
-
- // Add a tag.
- PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
- "Correctly added tag to the first entry.");
- is(document.getElementById("editBMPanel_tagsField").value, TEST_TAG,
- "Editing a single nsIURI entry shows the added tag");
- checkTagsSelector([TEST_TAG], [TEST_TAG]);
-
- // Remove tag.
- PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
- "Correctly removed tag from the nsIURI entry.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing a single nsIURI entry should not show any tag");
- checkTagsSelector([], []);
-
- // Init panel with multiple nsIURI entries.
- gEditItemOverlay.initPanel([TEST_URI, TEST_URI2]);
-
- // Add a tag to the first entry.
- PlacesUtils.tagging.tagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], TEST_TAG,
- "Tag correctly added.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple nsIURIs without matching tags should not show any tag.");
- checkTagsSelector([TEST_TAG], []);
-
- // Add a tag to the second entry.
- PlacesUtils.tagging.tagURI(TEST_URI2, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], TEST_TAG,
- "Tag correctly added.");
- is(document.getElementById("editBMPanel_tagsField").value, TEST_TAG,
- "Editing multiple nsIURIs should show matching tags");
- checkTagsSelector([TEST_TAG], [TEST_TAG]);
-
- // Remove tag from the first entry.
- PlacesUtils.tagging.untagURI(TEST_URI, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI)[0], undefined,
- "Correctly removed tag from the first entry.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple nsIURIs without matching tags should not show any tag.");
- checkTagsSelector([TEST_TAG], []);
-
- // Remove tag from the second entry.
- PlacesUtils.tagging.untagURI(TEST_URI2, [TEST_TAG]);
- is(PlacesUtils.tagging.getTagsForURI(TEST_URI2)[0], undefined,
- "Correctly removed tag from the second entry.");
- is(document.getElementById("editBMPanel_tagsField").value, "",
- "Editing multiple nsIURIs without matching tags should not show any tag.");
- checkTagsSelector([], []);
-
- // Cleanup.
- PlacesUtils.bookmarks.removeFolderChildren(
- PlacesUtils.unfiledBookmarksFolderId
- );
-
- }
- ]]>
- </script>
-
-</window>
diff --git a/browser/components/places/tests/chrome/test_treeview_date.xul b/browser/components/places/tests/chrome/test_treeview_date.xul
deleted file mode 100644
index ba8aa2cc6..000000000
--- a/browser/components/places/tests/chrome/test_treeview_date.xul
+++ /dev/null
@@ -1,188 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<?xml-stylesheet href="chrome://browser/content/places/places.css"?>
-<?xml-stylesheet href="chrome://browser/skin/places/places.css"?>
-<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="435322: Places tree view's formatting"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
- <script type="application/javascript" src="head.js" />
-
- <body xmlns="http://www.w3.org/1999/xhtml" />
-
- <tree id="tree"
- type="places"
- flatList="true"
- flex="1">
- <treecols>
- <treecol label="Title" id="title" anonid="title" primary="true" ordinal="1" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol label="Tags" id="tags" anonid="tags" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol label="Url" id="url" anonid="url" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol label="Visit Date" id="date" anonid="date" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol label="Visit Count" id="visitCount" anonid="visitCount" flex="1"/>
- </treecols>
- <treechildren flex="1"/>
- </tree>
-
- <script type="application/javascript">
- <![CDATA[
-
- /**
- * Bug 435322
- * https://bugzilla.mozilla.org/show_bug.cgi?id=435322
- *
- * Ensures that date in places treeviews is correctly formatted.
- */
-
- SimpleTest.waitForExplicitFinish();
-
- function runTest() {
- // The mochitest page is added to history.
- waitForClearHistory(continue_test);
- }
-
- function continue_test() {
- var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- var bh = hs.QueryInterface(Ci.nsIBrowserHistory);
- var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
- var ds = Cc["@mozilla.org/intl/scriptabledateformat;1"].
- getService(Ci.nsIScriptableDateFormat);
-
- var iosvc = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
- function uri(spec) {
- return iosvc.newURI(spec, null, null);
- }
-
- var midnight = new Date();
- midnight.setHours(0);
- midnight.setMinutes(0);
- midnight.setSeconds(0);
- midnight.setMilliseconds(0);
-
- function addVisitsCallback() {
- // add a bookmark to the midnight visit
- var itemId = bs.insertBookmark(bs.toolbarFolder,
- uri("http://at.midnight.com/"),
- bs.DEFAULT_INDEX,
- "A bookmark at midnight");
-
- // Make a history query.
- var query = hs.getNewQuery();
- var opts = hs.getNewQueryOptions();
- var queryURI = hs.queriesToQueryString([query], 1, opts);
-
- // Setup the places tree contents.
- var tree = document.getElementById("tree");
- tree.place = queryURI;
-
- // loop through the rows and check formatting
- var treeView = tree.view;
- var rc = treeView.rowCount;
- ok(rc >= 3, "Rows found");
- var columns = tree.columns;
- ok(columns.count > 0, "Columns found");
- for (var r = 0; r < rc; r++) {
- var node = treeView.nodeForTreeIndex(r);
- ok(node, "Places node found");
- for (var ci = 0; ci < columns.count; ci++) {
- var c = columns.getColumnAt(ci);
- var text = treeView.getCellText(r, c);
- switch (c.element.getAttribute("anonid")) {
- case "title":
- // The title can differ, we did not set any title so we would
- // expect null, but in such a case the view will generate a title
- // through PlacesUIUtils.getBestTitle.
- if (node.title)
- is(text, node.title, "Title is correct");
- break;
- case "url":
- is(text, node.uri, "Uri is correct");
- break;
- case "date":
- var timeObj = new Date(node.time / 1000);
- // Default is short date format.
- var dateFormat = Ci.nsIScriptableDateFormat.dateFormatShort;
- // For today's visits we don't show date portion.
- if (node.uri == "http://at.midnight.com/" ||
- node.uri == "http://after.midnight.com/")
- dateFormat = Ci.nsIScriptableDateFormat.dateFormatNone;
- else if (node.uri == "http://before.midnight.com/")
- dateFormat = Ci.nsIScriptableDateFormat.dateFormatShort;
- else {
- // Avoid to test spurious uris, due to how the test works
- // a redirecting uri could be put in the tree while we test.
- break;
- }
- var timeStr = ds.FormatDateTime("", dateFormat,
- Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
- timeObj.getFullYear(), timeObj.getMonth() + 1,
- timeObj.getDate(), timeObj.getHours(),
- timeObj.getMinutes(), timeObj.getSeconds())
-
- is(text, timeStr, "Date format is correct");
- break;
- case "visitCount":
- is(text, 1, "Visit count is correct");
- break;
- }
- }
- }
- // Cleanup.
- bs.removeItem(itemId);
- waitForClearHistory(SimpleTest.finish);
- }
-
- // Add a visit 1ms before midnight, a visit at midnight, and
- // a visit 1ms after midnight.
- addVisits(
- [{uri: uri("http://before.midnight.com/"),
- visitDate: (midnight.getTime() - 1) * 1000,
- transition: hs.TRANSITION_TYPED},
- {uri: uri("http://at.midnight.com/"),
- visitDate: (midnight.getTime()) * 1000,
- transition: hs.TRANSITION_TYPED},
- {uri: uri("http://after.midnight.com/"),
- visitDate: (midnight.getTime() + 1) * 1000,
- transition: hs.TRANSITION_TYPED}],
- addVisitsCallback);
- }
-
- /**
- * Clears history invoking callback when done.
- */
- function waitForClearHistory(aCallback) {
- const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
- }
-
- ]]>
- </script>
-</window>
diff --git a/browser/components/places/tests/moz.build b/browser/components/places/tests/moz.build
deleted file mode 100644
index a91509a3f..000000000
--- a/browser/components/places/tests/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['browser', 'chrome']
-
-MODULE = 'test_browser_places'
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/places/tests/unit/bookmarks.glue.html b/browser/components/places/tests/unit/bookmarks.glue.html
deleted file mode 100644
index 07b22e9b3..000000000
--- a/browser/components/places/tests/unit/bookmarks.glue.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE NETSCAPE-Bookmark-file-1>
-<!-- This is an automatically generated file.
- It will be read and overwritten.
- DO NOT EDIT! -->
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
-<TITLE>Bookmarks</TITLE>
-<H1>Bookmarks Menu</H1>
-
-<DL><p>
- <DT><A HREF="http://example.com/" ADD_DATE="1233157972" LAST_MODIFIED="1233157984">example</A>
- <DT><H3 ADD_DATE="1233157910" LAST_MODIFIED="1233157972" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
-<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
- <DL><p>
- <DT><A HREF="http://example.com/" ADD_DATE="1233157972" LAST_MODIFIED="1233157984">example</A>
- </DL><p>
-</DL><p>
diff --git a/browser/components/places/tests/unit/bookmarks.glue.json b/browser/components/places/tests/unit/bookmarks.glue.json
deleted file mode 100644
index 7f639e462..000000000
--- a/browser/components/places/tests/unit/bookmarks.glue.json
+++ /dev/null
@@ -1 +0,0 @@
-{"title":"","id":1,"dateAdded":1233157910552624,"lastModified":1233157955206833,"type":"text/x-moz-place-container","root":"placesRoot","children":[{"title":"Bookmarks Menu","id":2,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157993171424,"type":"text/x-moz-place-container","root":"bookmarksMenuFolder","children":[{"title":"examplejson","id":27,"parent":2,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":1,"title":"Bookmarks Toolbar","id":3,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157972101126,"annos":[{"name":"bookmarkProperties/description","flags":0,"expires":4,"mimeType":null,"type":3,"value":"Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar"}],"type":"text/x-moz-place-container","root":"toolbarFolder","children":[{"title":"examplejson","id":26,"parent":3,"dateAdded":1233157972101126,"lastModified":1233157984999673,"type":"text/x-moz-place","uri":"http://example.com/"}]},{"index":2,"title":"Tags","id":4,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157910582667,"type":"text/x-moz-place-container","root":"tagsFolder","children":[]},{"index":3,"title":"Unsorted Bookmarks","id":5,"parent":1,"dateAdded":1233157910552624,"lastModified":1233157911033315,"type":"text/x-moz-place-container","root":"unfiledBookmarksFolder","children":[]}]}
diff --git a/browser/components/places/tests/unit/corruptDB.sqlite b/browser/components/places/tests/unit/corruptDB.sqlite
deleted file mode 100644
index b234246ca..000000000
--- a/browser/components/places/tests/unit/corruptDB.sqlite
+++ /dev/null
Binary files differ
diff --git a/browser/components/places/tests/unit/distribution.ini b/browser/components/places/tests/unit/distribution.ini
deleted file mode 100644
index f94a1be3c..000000000
--- a/browser/components/places/tests/unit/distribution.ini
+++ /dev/null
@@ -1,21 +0,0 @@
-# Distribution Configuration File
-# Bug 516444 demo
-
-[Global]
-id=516444
-version=1.0
-about=Test distribution file
-
-[BookmarksToolbar]
-item.1.title=Toolbar Link Before
-item.1.link=http://mozilla.com/
-item.2.type=default
-item.3.title=Toolbar Link After
-item.3.link=http://mozilla.com/
-
-[BookmarksMenu]
-item.1.title=Menu Link Before
-item.1.link=http://mozilla.com/
-item.2.type=default
-item.3.title=Menu Link After
-item.3.link=http://mozilla.com/ \ No newline at end of file
diff --git a/browser/components/places/tests/unit/head_bookmarks.js b/browser/components/places/tests/unit/head_bookmarks.js
deleted file mode 100644
index cbe5aa775..000000000
--- a/browser/components/places/tests/unit/head_bookmarks.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-const Cr = Components.results;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-// Import common head.
-let (commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false)) {
- let uri = Services.io.newFileURI(commonFile);
- Services.scriptloader.loadSubScript(uri.spec, this);
-}
-
-// Put any other stuff relative to this test folder below.
-
-
-XPCOMUtils.defineLazyGetter(this, "PlacesUIUtils", function() {
- Cu.import("resource:///modules/PlacesUIUtils.jsm");
- return PlacesUIUtils;
-});
-
-
-const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder";
-const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery";
-
-
-// Needed by some test that relies on having an app registered.
-let (XULAppInfo = {
- vendor: "Mozilla",
- name: "PlacesTest",
- ID: "{230de50e-4cd1-11dc-8314-0800200c9a66}",
- version: "1",
- appBuildID: "2007010101",
- platformVersion: "",
- platformBuildID: "2007010101",
- inSafeMode: false,
- logConsoleErrors: true,
- OS: "XPCShell",
- XPCOMABI: "noarch-spidermonkey",
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIXULAppInfo,
- Ci.nsIXULRuntime,
- ])
-}) {
- let XULAppInfoFactory = {
- createInstance: function (outer, iid) {
- if (outer != null)
- throw Cr.NS_ERROR_NO_AGGREGATION;
- return XULAppInfo.QueryInterface(iid);
- }
- };
- let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
- registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"),
- "XULAppInfo", "@mozilla.org/xre/app-info;1",
- XULAppInfoFactory);
-}
-
-// Smart bookmarks constants.
-const SMART_BOOKMARKS_VERSION = 4;
-const SMART_BOOKMARKS_ON_TOOLBAR = 1;
-const SMART_BOOKMARKS_ON_MENU = 3; // Takes in count the additional separator.
-
-// Default bookmarks constants.
-const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1;
-const DEFAULT_BOOKMARKS_ON_MENU = 1;
diff --git a/browser/components/places/tests/unit/test_421483.js b/browser/components/places/tests/unit/test_421483.js
deleted file mode 100644
index 46eb5dc55..000000000
--- a/browser/components/places/tests/unit/test_421483.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Get bookmarks service
-try {
- var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
-} catch(ex) {
- do_throw("Could not get Bookmarks service\n");
-}
-
-// Get annotation service
-try {
- var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].
- getService(Ci.nsIAnnotationService);
-} catch(ex) {
- do_throw("Could not get Annotation service\n");
-}
-
-// Get browser glue
-try {
- var gluesvc = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIBrowserGlue).
- QueryInterface(Ci.nsIObserver);
- // Avoid default bookmarks import.
- gluesvc.observe(null, "initial-migration-will-import-default-bookmarks", "");
-// gluesvc.observe(null, "initial-migration-did-import-default-bookmarks", "");
-} catch(ex) {
- do_throw("Could not get BrowserGlue service\n");
-}
-
-// Get pref service
-try {
- var pref = Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch);
-} catch(ex) {
- do_throw("Could not get Preferences service\n");
-}
-
-const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
-const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
-
-// main
-function run_test() {
- // TEST 1: smart bookmarks disabled
- pref.setIntPref("browser.places.smartBookmarksVersion", -1);
- gluesvc.ensurePlacesDefaultQueriesInitialized();
- var smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
- do_check_eq(smartBookmarkItemIds.length, 0);
- // check that pref has not been bumped up
- do_check_eq(pref.getIntPref("browser.places.smartBookmarksVersion"), -1);
-
- // TEST 2: create smart bookmarks
- pref.setIntPref("browser.places.smartBookmarksVersion", 0);
- gluesvc.ensurePlacesDefaultQueriesInitialized();
- smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
- do_check_neq(smartBookmarkItemIds.length, 0);
- // check that pref has been bumped up
- do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
-
- var smartBookmarksCount = smartBookmarkItemIds.length;
-
- // TEST 3: smart bookmarks restore
- // remove one smart bookmark and restore
- bmsvc.removeItem(smartBookmarkItemIds[0]);
- pref.setIntPref("browser.places.smartBookmarksVersion", 0);
- gluesvc.ensurePlacesDefaultQueriesInitialized();
- smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
- do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
- // check that pref has been bumped up
- do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
-
- // TEST 4: move a smart bookmark, change its title, then restore
- // smart bookmark should be restored in place
- var parent = bmsvc.getFolderIdForItem(smartBookmarkItemIds[0]);
- var oldTitle = bmsvc.getItemTitle(smartBookmarkItemIds[0]);
- // create a subfolder and move inside it
- var newParent = bmsvc.createFolder(parent, "test", bmsvc.DEFAULT_INDEX);
- bmsvc.moveItem(smartBookmarkItemIds[0], newParent, bmsvc.DEFAULT_INDEX);
- // change title
- bmsvc.setItemTitle(smartBookmarkItemIds[0], "new title");
- // restore
- pref.setIntPref("browser.places.smartBookmarksVersion", 0);
- gluesvc.ensurePlacesDefaultQueriesInitialized();
- smartBookmarkItemIds = annosvc.getItemsWithAnnotation(SMART_BOOKMARKS_ANNO);
- do_check_eq(smartBookmarkItemIds.length, smartBookmarksCount);
- do_check_eq(bmsvc.getFolderIdForItem(smartBookmarkItemIds[0]), newParent);
- do_check_eq(bmsvc.getItemTitle(smartBookmarkItemIds[0]), oldTitle);
- // check that pref has been bumped up
- do_check_true(pref.getIntPref("browser.places.smartBookmarksVersion") > 0);
-}
diff --git a/browser/components/places/tests/unit/test_PUIU_makeTransaction.js b/browser/components/places/tests/unit/test_PUIU_makeTransaction.js
deleted file mode 100644
index 0a2533e1a..000000000
--- a/browser/components/places/tests/unit/test_PUIU_makeTransaction.js
+++ /dev/null
@@ -1,351 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function waitForBookmarkNotification(aNotification, aCallback, aProperty)
-{
- PlacesUtils.bookmarks.addObserver({
- validate: function (aMethodName, aData)
- {
- if (aMethodName == aNotification &&
- (!aProperty || aProperty == aData.property)) {
- PlacesUtils.bookmarks.removeObserver(this);
- aCallback(aData);
- }
- },
-
- // nsINavBookmarkObserver
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver]),
- onBeginUpdateBatch: function onBeginUpdateBatch()
- this.validate(arguments.callee.name, arguments),
- onEndUpdateBatch: function onEndUpdateBatch()
- this.validate(arguments.callee.name, arguments),
- onItemAdded: function onItemAdded(aItemId, aParentId, aIndex, aItemType,
- aURI, aTitle)
- {
- return this.validate(arguments.callee.name, { id: aItemId,
- index: aIndex,
- type: aItemType,
- url: aURI ? aURI.spec : null,
- title: aTitle });
- },
- onItemRemoved: function onItemRemoved()
- this.validate(arguments.callee.name, arguments),
- onItemChanged: function onItemChanged(aItemId, aProperty, aIsAnno,
- aNewValue, aLastModified, aItemType)
- {
- return this.validate(arguments.callee.name,
- { id: aItemId,
- get index() PlacesUtils.bookmarks.getItemIndex(this.id),
- type: aItemType,
- property: aProperty,
- get url() aItemType == PlacesUtils.bookmarks.TYPE_BOOKMARK ?
- PlacesUtils.bookmarks.getBookmarkURI(this.id).spec :
- null,
- get title() PlacesUtils.bookmarks.getItemTitle(this.id),
- });
- },
- onItemVisited: function onItemVisited()
- this.validate(arguments.callee.name, arguments),
- onItemMoved: function onItemMoved(aItemId, aOldParentId, aOldIndex,
- aNewParentId, aNewIndex, aItemType)
- {
- this.validate(arguments.callee.name, { id: aItemId,
- index: aNewIndex,
- type: aItemType });
- }
- }, false);
-}
-
-function wrapNodeByIdAndParent(aItemId, aParentId)
-{
- let wrappedNode;
- let root = PlacesUtils.getFolderContents(aParentId, false, false).root;
- for (let i = 0; i < root.childCount; ++i) {
- let node = root.getChild(i);
- if (node.itemId == aItemId) {
- let type;
- if (PlacesUtils.nodeIsContainer(node)) {
- type = PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER;
- }
- else if (PlacesUtils.nodeIsURI(node)) {
- type = PlacesUtils.TYPE_X_MOZ_PLACE;
- }
- else if (PlacesUtils.nodeIsSeparator(node)) {
- type = PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR;
- }
- else {
- do_throw("Unknown node type");
- }
- wrappedNode = PlacesUtils.wrapNode(node, type);
- }
- }
- root.containerOpen = false;
- return JSON.parse(wrappedNode);
-}
-
-add_test(function test_text_paste()
-{
- const TEST_URL = "http://places.moz.org/"
- const TEST_TITLE = "Places bookmark"
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.url, TEST_URL);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 0);
- run_next_test();
- });
-
- let txn = PlacesUIUtils.makeTransaction(
- { title: TEST_TITLE, uri: TEST_URL },
- PlacesUtils.TYPE_X_MOZ_URL,
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- true // Unused for text.
- );
- PlacesUtils.transactionManager.doTransaction(txn);
-});
-
-add_test(function test_container()
-{
- const TEST_TITLE = "Places folder"
-
- waitForBookmarkNotification("onItemChanged", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
- do_check_eq(aData.index, 1);
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
- do_check_eq(aData.index, 2);
- let id = aData.id;
-
- waitForBookmarkNotification("onItemMoved", function(aData)
- {
- do_check_eq(aData.id, id);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_FOLDER);
- do_check_eq(aData.index, 1);
-
- run_next_test();
- });
-
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- 1, // Move to position 1.
- false
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- });
-
- try {
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- true
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- } catch(ex) {
- do_throw(ex);
- }
- }, "random-anno");
-
- let id = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
- TEST_TITLE,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(id, PlacesUIUtils.DESCRIPTION_ANNO,
- "description", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
- PlacesUtils.annotations.setItemAnnotation(id, "random-anno",
- "random-value", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
-});
-
-
-add_test(function test_separator()
-{
- waitForBookmarkNotification("onItemChanged", function(aData)
- {
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
- do_check_eq(aData.index, 3);
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
- do_check_eq(aData.index, 4);
- let id = aData.id;
-
- waitForBookmarkNotification("onItemMoved", function(aData)
- {
- do_check_eq(aData.id, id);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_SEPARATOR);
- do_check_eq(aData.index, 1);
-
- run_next_test();
- });
-
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- 1, // Move to position 1.
- false
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- });
-
- try {
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- true
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- } catch(ex) {
- do_throw(ex);
- }
- }, "random-anno");
-
- let id = PlacesUtils.bookmarks.insertSeparator(PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(id, "random-anno",
- "random-value", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
-});
-
-add_test(function test_bookmark()
-{
- const TEST_URL = "http://places.moz.org/"
- const TEST_TITLE = "Places bookmark"
-
- waitForBookmarkNotification("onItemChanged", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.url, TEST_URL);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 5);
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.url, TEST_URL);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 6);
- let id = aData.id;
-
- waitForBookmarkNotification("onItemMoved", function(aData)
- {
- do_check_eq(aData.id, id);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 1);
-
- run_next_test();
- });
-
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- 1, // Move to position 1.
- false
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- });
-
- try {
- let txn = PlacesUIUtils.makeTransaction(
- wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId),
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- true
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- } catch(ex) {
- do_throw(ex);
- }
- }, "random-anno");
-
- let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- NetUtil.newURI(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- TEST_TITLE);
- PlacesUtils.annotations.setItemAnnotation(id, PlacesUIUtils.DESCRIPTION_ANNO,
- "description", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
- PlacesUtils.annotations.setItemAnnotation(id, "random-anno",
- "random-value", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
-});
-
-add_test(function test_visit()
-{
- const TEST_URL = "http://places.moz.org/"
- const TEST_TITLE = "Places bookmark"
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.url, TEST_URL);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 7);
-
- waitForBookmarkNotification("onItemAdded", function(aData)
- {
- do_check_eq(aData.title, TEST_TITLE);
- do_check_eq(aData.url, TEST_URL);
- do_check_eq(aData.type, PlacesUtils.bookmarks.TYPE_BOOKMARK);
- do_check_eq(aData.index, 8);
- run_next_test();
- });
-
- try {
- let node = wrapNodeByIdAndParent(aData.id, PlacesUtils.unfiledBookmarksFolderId);
- // Simulate a not-bookmarked node, will copy it to a new bookmark.
- node.id = -1;
- let txn = PlacesUIUtils.makeTransaction(
- node,
- 0, // Unused for real nodes.
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- true
- );
- PlacesUtils.transactionManager.doTransaction(txn);
- } catch(ex) {
- do_throw(ex);
- }
- });
-
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
- NetUtil.newURI(TEST_URL),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- TEST_TITLE);
-});
-
-add_test(function check_annotations() {
- // As last step check how many items for each annotation exist.
-
- // Copies should retain the description annotation.
- let descriptions =
- PlacesUtils.annotations.getItemsWithAnnotation(PlacesUIUtils.DESCRIPTION_ANNO, {});
- do_check_eq(descriptions.length, 4);
-
- // Only the original bookmarks should have this annotation.
- let others = PlacesUtils.annotations.getItemsWithAnnotation("random-anno", {});
- do_check_eq(others.length, 3);
- run_next_test();
-});
-
-function run_test()
-{
- run_next_test();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_corrupt.js b/browser/components/places/tests/unit/test_browserGlue_corrupt.js
deleted file mode 100644
index 55c57add4..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_corrupt.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue correctly restores bookmarks from a JSON backup if
- * database is corrupt and one backup is available.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "bs",
- "@mozilla.org/browser/nav-bookmarks-service;1",
- "nsINavBookmarksService");
-XPCOMUtils.defineLazyServiceGetter(this, "anno",
- "@mozilla.org/browser/annotation-service;1",
- "nsIAnnotationService");
-
-let bookmarksObserver = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
- do_check_neq(itemId, -1);
- if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
- continue_test();
- },
- onItemAdded: function() {},
- onItemRemoved: function(id, folder, index, itemType) {},
- onItemChanged: function() {},
- onItemVisited: function(id, visitID, time) {},
- onItemMoved: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
-};
-
-function run_test() {
- do_test_pending();
-
- // Create our bookmarks.html copying bookmarks.glue.html to the profile
- // folder. It should be ignored.
- create_bookmarks_html("bookmarks.glue.html");
-
- // Create our JSON backup copying bookmarks.glue.json to the profile folder.
- create_JSON_backup("bookmarks.glue.json");
-
- // Remove current database file.
- let db = gProfD.clone();
- db.append("places.sqlite");
- if (db.exists()) {
- db.remove(false);
- do_check_false(db.exists());
- }
- // Create a corrupt database.
- let corruptDB = gTestDir.clone();
- corruptDB.append("corruptDB.sqlite");
- corruptDB.copyTo(gProfD, "places.sqlite");
- do_check_true(db.exists());
-
- // Initialize nsBrowserGlue before Places.
- Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
-
- // Initialize Places through the History Service.
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- // Check the database was corrupt.
- // nsBrowserGlue uses databaseStatus to manage initialization.
- do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
-
- // The test will continue once restore has finished and smart bookmarks
- // have been created.
- bs.addObserver(bookmarksObserver, false);
-}
-
-function continue_test() {
- // Check that JSON backup has been restored.
- // Notice restore from JSON notification is fired before smart bookmarks creation.
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(bs.getItemTitle(itemId), "examplejson");
-
- remove_bookmarks_html();
- remove_all_JSON_backups();
-
- do_test_finished();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup.js b/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup.js
deleted file mode 100644
index e3701f97d..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue correctly imports from bookmarks.html if database
- * is corrupt but a JSON backup is not available.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "bs",
- "@mozilla.org/browser/nav-bookmarks-service;1",
- "nsINavBookmarksService");
-XPCOMUtils.defineLazyServiceGetter(this, "anno",
- "@mozilla.org/browser/annotation-service;1",
- "nsIAnnotationService");
-
-let bookmarksObserver = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
- do_check_neq(itemId, -1);
- if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
- continue_test();
- },
- onItemAdded: function() {},
- onItemRemoved: function(id, folder, index, itemType) {},
- onItemChanged: function() {},
- onItemVisited: function(id, visitID, time) {},
- onItemMoved: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
-};
-
-function run_test() {
- do_test_pending();
-
- // Create bookmarks.html in the profile.
- create_bookmarks_html("bookmarks.glue.html");
- // Remove JSON backup from profile.
- remove_all_JSON_backups();
-
- // Remove current database file.
- let db = gProfD.clone();
- db.append("places.sqlite");
- if (db.exists()) {
- db.remove(false);
- do_check_false(db.exists());
- }
- // Create a corrupt database.
- let corruptDB = gTestDir.clone();
- corruptDB.append("corruptDB.sqlite");
- corruptDB.copyTo(gProfD, "places.sqlite");
- do_check_true(db.exists());
-
- // Initialize nsBrowserGlue before Places.
- Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
-
- // Initialize Places through the History Service.
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- // Check the database was corrupt.
- // nsBrowserGlue uses databaseStatus to manage initialization.
- do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
-
- // The test will continue once import has finished and smart bookmarks
- // have been created.
- bs.addObserver(bookmarksObserver, false);
-}
-
-function continue_test() {
- // Check that bookmarks html has been restored.
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(bs.getItemTitle(itemId), "example");
-
- remove_bookmarks_html();
-
- do_test_finished();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup_default.js b/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup_default.js
deleted file mode 100644
index 3d554ce98..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_corrupt_nobackup_default.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue correctly restores default bookmarks if database is
- * corrupt, nor a JSON backup nor bookmarks.html are available.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "bs",
- "@mozilla.org/browser/nav-bookmarks-service;1",
- "nsINavBookmarksService");
-XPCOMUtils.defineLazyServiceGetter(this, "anno",
- "@mozilla.org/browser/annotation-service;1",
- "nsIAnnotationService");
-
-let bookmarksObserver = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
- do_check_neq(itemId, -1);
- if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
- continue_test();
- },
- onItemAdded: function() {},
- onItemRemoved: function(id, folder, index, itemType) {},
- onItemChanged: function() {},
- onItemVisited: function(id, visitID, time) {},
- onItemMoved: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
-};
-
-function run_test() {
- do_test_pending();
-
- // Remove bookmarks.html from profile.
- remove_bookmarks_html();
- // Remove JSON backup from profile.
- remove_all_JSON_backups();
-
- // Remove current database file.
- let db = gProfD.clone();
- db.append("places.sqlite");
- if (db.exists()) {
- db.remove(false);
- do_check_false(db.exists());
- }
- // Create a corrupt database.
- let corruptDB = gTestDir.clone();
- corruptDB.append("corruptDB.sqlite");
- corruptDB.copyTo(gProfD, "places.sqlite");
- do_check_true(db.exists());
-
- // Initialize nsBrowserGlue before Places.
- Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
-
- // Initialize Places through the History Service.
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- // Check the database was corrupt.
- // nsBrowserGlue uses databaseStatus to manage initialization.
- do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CORRUPT);
-
- // The test will continue once import has finished and smart bookmarks
- // have been created.
- bs.addObserver(bookmarksObserver, false);
-}
-
-function continue_test() {
- // Check that default bookmarks have been restored.
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_true(itemId > 0);
- do_check_eq(bs.getItemTitle(itemId), "Getting Started");
-
- do_test_finished();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_distribution.js b/browser/components/places/tests/unit/test_browserGlue_distribution.js
deleted file mode 100644
index 49839ef7a..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_distribution.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that nsBrowserGlue correctly imports bookmarks from distribution.ini.
- */
-
-const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
-const PREF_BMPROCESSED = "distribution.516444.bookmarksProcessed";
-const PREF_DISTRIBUTION_ID = "distribution.id";
-
-const TOPICDATA_DISTRIBUTION_CUSTOMIZATION = "force-distribution-customization";
-const TOPIC_CUSTOMIZATION_COMPLETE = "distribution-customization-complete";
-const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
-
-function run_test()
-{
- do_test_pending();
-
- // Copy distribution.ini file to our app dir.
- let distroDir = Services.dirsvc.get("XREExeF", Ci.nsIFile);
- distroDir.leafName = "distribution";
- let iniFile = distroDir.clone();
- iniFile.append("distribution.ini");
- if (iniFile.exists()) {
- iniFile.remove(false);
- print("distribution.ini already exists, did some test forget to cleanup?");
- }
- let testDistributionFile = gTestDir.clone();
- testDistributionFile.append("distribution.ini");
- testDistributionFile.copyTo(distroDir, "distribution.ini");
- do_check_true(testDistributionFile.exists());
-
- // Disable Smart Bookmarks creation.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
-
- // Initialize Places through the History Service and check that a new
- // database has been created.
- do_check_eq(PlacesUtils.history.databaseStatus,
- PlacesUtils.history.DATABASE_STATUS_CREATE);
-
- // Force distribution.
- Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_DISTRIBUTION_CUSTOMIZATION);
-
- // Test will continue on customization complete notification.
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(arguments.callee,
- TOPIC_CUSTOMIZATION_COMPLETE,
- false);
- do_execute_soon(onCustomizationComplete);
- }, TOPIC_CUSTOMIZATION_COMPLETE, false);
-}
-
-function onCustomizationComplete()
-{
- // Check the custom bookmarks exist on menu.
- let menuItemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
- do_check_neq(menuItemId, -1);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(menuItemId),
- "Menu Link Before");
- menuItemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
- 1 + DEFAULT_BOOKMARKS_ON_MENU);
- do_check_neq(menuItemId, -1);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(menuItemId),
- "Menu Link After");
-
- // Check the custom bookmarks exist on toolbar.
- let toolbarItemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_neq(toolbarItemId, -1);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(toolbarItemId),
- "Toolbar Link Before");
- toolbarItemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- 1 + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_neq(toolbarItemId, -1);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(toolbarItemId),
- "Toolbar Link After");
-
- // Check the bmprocessed pref has been created.
- do_check_true(Services.prefs.getBoolPref(PREF_BMPROCESSED));
-
- // Check distribution prefs have been created.
- do_check_eq(Services.prefs.getCharPref(PREF_DISTRIBUTION_ID), "516444");
-
- do_test_finished();
-}
-
-do_register_cleanup(function() {
- // Remove the distribution file, even if the test failed, otherwise all
- // next tests will import it.
- let iniFile = Services.dirsvc.get("XREExeF", Ci.nsIFile);
- iniFile.leafName = "distribution";
- iniFile.append("distribution.ini");
- if (iniFile.exists())
- iniFile.remove(false);
- do_check_false(iniFile.exists());
-});
diff --git a/browser/components/places/tests/unit/test_browserGlue_migrate.js b/browser/components/places/tests/unit/test_browserGlue_migrate.js
deleted file mode 100644
index 001f066d3..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_migrate.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that nsBrowserGlue does not overwrite bookmarks imported from the
- * migrators. They usually run before nsBrowserGlue, so if we find any
- * bookmark on init, we should not try to import.
- */
-
-const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
-
-function run_test() {
- do_test_pending();
-
- // Create our bookmarks.html copying bookmarks.glue.html to the profile
- // folder. It should be ignored.
- create_bookmarks_html("bookmarks.glue.html");
-
- // Remove current database file.
- let db = gProfD.clone();
- db.append("places.sqlite");
- if (db.exists()) {
- db.remove(false);
- do_check_false(db.exists());
- }
-
- // Initialize Places through the History Service and check that a new
- // database has been created.
- do_check_eq(PlacesUtils.history.databaseStatus,
- PlacesUtils.history.DATABASE_STATUS_CREATE);
-
- // A migrator would run before nsBrowserGlue Places initialization, so mimic
- // that behavior adding a bookmark and notifying the migration.
- let bg = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIObserver);
-
- bg.observe(null, "initial-migration-will-import-default-bookmarks", null);
-
- PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarks.bookmarksMenuFolder, uri("http://mozilla.org/"),
- PlacesUtils.bookmarks.DEFAULT_INDEX, "migrated");
-
- let bookmarksObserver = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {
- // Check if the currently finished batch created the smart bookmarks.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_neq(itemId, -1);
- if (PlacesUtils.annotations
- .itemHasAnnotation(itemId, "Places/SmartBookmark")) {
- do_execute_soon(onSmartBookmarksCreation);
- }
- },
- onItemAdded: function() {},
- onItemRemoved: function(id, folder, index, itemType) {},
- onItemChanged: function() {},
- onItemVisited: function(id, visitID, time) {},
- onItemMoved: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
- };
- // The test will continue once import has finished and smart bookmarks
- // have been created.
- PlacesUtils.bookmarks.addObserver(bookmarksObserver, false);
-
- bg.observe(null, "initial-migration-did-import-default-bookmarks", null);
-}
-
-function onSmartBookmarksCreation() {
- // Check the created bookmarks still exist.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
- SMART_BOOKMARKS_ON_MENU);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "migrated");
-
- // Check that we have not imported any new bookmark.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
- SMART_BOOKMARKS_ON_MENU + 1)
- do_check_eq(itemId, -1);
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- SMART_BOOKMARKS_ON_MENU)
- do_check_eq(itemId, -1);
-
- remove_bookmarks_html();
-
- do_test_finished();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_prefs.js b/browser/components/places/tests/unit/test_browserGlue_prefs.js
deleted file mode 100644
index e8366a614..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_prefs.js
+++ /dev/null
@@ -1,282 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that nsBrowserGlue is correctly interpreting the preferences settable
- * by the user or by other components.
- */
-
-const PREF_IMPORT_BOOKMARKS_HTML = "browser.places.importBookmarksHTML";
-const PREF_RESTORE_DEFAULT_BOOKMARKS = "browser.bookmarks.restore_default_bookmarks";
-const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
-const PREF_AUTO_EXPORT_HTML = "browser.bookmarks.autoExportHTML";
-
-const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
-const TOPICDATA_FORCE_PLACES_INIT = "force-places-init";
-
-let bg = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIBrowserGlue);
-
-function waitForImportAndSmartBookmarks(aCallback) {
- Services.obs.addObserver(function waitImport() {
- Services.obs.removeObserver(waitImport, "bookmarks-restore-success");
- // Delay to test eventual smart bookmarks creation.
- do_execute_soon(function () {
- promiseAsyncUpdates().then(aCallback);
- });
- }, "bookmarks-restore-success", false);
-}
-
-[
-
- // This test must be the first one.
- function test_checkPreferences() {
- // Initialize Places through the History Service and check that a new
- // database has been created.
- do_check_eq(PlacesUtils.history.databaseStatus,
- PlacesUtils.history.DATABASE_STATUS_CREATE);
-
- // Wait for Places init notification.
- Services.obs.addObserver(function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(arguments.callee,
- "places-browser-init-complete");
- do_execute_soon(function () {
- // Ensure preferences status.
- do_check_false(Services.prefs.getBoolPref(PREF_AUTO_EXPORT_HTML));
-
- try {
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
- do_throw("importBookmarksHTML pref should not exist");
- }
- catch(ex) {}
-
- try {
- do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
- do_throw("importBookmarksHTML pref should not exist");
- }
- catch(ex) {}
-
- run_next_test();
- });
- }, "places-browser-init-complete", false);
- },
-
- function test_import()
- {
- do_log_info("Import from bookmarks.html if importBookmarksHTML is true.");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been imported, and a smart bookmark has been
- // created.
- itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
- // Check preferences have been reverted.
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces().
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
- },
-
- function test_import_noSmartBookmarks()
- {
- do_log_info("import from bookmarks.html, but don't create smart bookmarks \
- if they are disabled");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
- Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been imported, but smart bookmarks have not
- // been created.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
- // Check preferences have been reverted.
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces().
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
- },
-
- function test_import_autoExport_updatedSmartBookmarks()
- {
- do_log_info("Import from bookmarks.html, but don't create smart bookmarks \
- if autoExportHTML is true and they are at latest version");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 999);
- Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
- Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been imported, but smart bookmarks have not
- // been created.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
- // Check preferences have been reverted.
- Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces()
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
- },
-
- function test_import_autoExport_oldSmartBookmarks()
- {
- do_log_info("Import from bookmarks.html, and create smart bookmarks if \
- autoExportHTML is true and they are not at latest version.");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
- Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
- Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been imported, but smart bookmarks have not
- // been created.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "example");
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
- // Check preferences have been reverted.
- Services.prefs.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces()
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
- },
-
- function test_restore()
- {
- do_log_info("restore from default bookmarks.html if \
- restore_default_bookmarks is true.");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been restored.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_true(itemId > 0);
- // Check preferences have been reverted.
- do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces()
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
-
- },
-
- function test_restore_import()
- {
- do_log_info("setting both importBookmarksHTML and \
- restore_default_bookmarks should restore defaults.");
-
- remove_all_bookmarks();
- // Sanity check: we should not have any bookmark on the toolbar.
- let itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_eq(itemId, -1);
-
- // Set preferences.
- Services.prefs.setBoolPref(PREF_IMPORT_BOOKMARKS_HTML, true);
- Services.prefs.setBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS, true);
-
- waitForImportAndSmartBookmarks(function () {
- // Check bookmarks.html has been restored.
- itemId =
- PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId,
- SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_true(itemId > 0);
- // Check preferences have been reverted.
- do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
-
- run_next_test();
- });
- // Force nsBrowserGlue::_initPlaces()
- do_log_info("Simulate Places init");
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- TOPIC_BROWSERGLUE_TEST,
- TOPICDATA_FORCE_PLACES_INIT);
- }
-
-].forEach(add_test);
-
-do_register_cleanup(function () {
- remove_all_bookmarks();
- remove_bookmarks_html();
- remove_all_JSON_backups();
-});
-
-function run_test()
-{
- // Create our bookmarks.html from bookmarks.glue.html.
- create_bookmarks_html("bookmarks.glue.html");
- // Create our JSON backup from bookmarks.glue.json.
- create_JSON_backup("bookmarks.glue.json");
-
- run_next_test();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_restore.js b/browser/components/places/tests/unit/test_browserGlue_restore.js
deleted file mode 100644
index eb7320617..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_restore.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue correctly restores bookmarks from a JSON backup if
- * database has been created and one backup is available.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "bs",
- "@mozilla.org/browser/nav-bookmarks-service;1",
- "nsINavBookmarksService");
-XPCOMUtils.defineLazyServiceGetter(this, "anno",
- "@mozilla.org/browser/annotation-service;1",
- "nsIAnnotationService");
-
-let bookmarksObserver = {
- onBeginUpdateBatch: function() {},
- onEndUpdateBatch: function() {
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, 0);
- do_check_neq(itemId, -1);
- if (anno.itemHasAnnotation(itemId, "Places/SmartBookmark"))
- continue_test();
- },
- onItemAdded: function() {},
- onItemRemoved: function(id, folder, index, itemType) {},
- onItemChanged: function() {},
- onItemVisited: function(id, visitID, time) {},
- onItemMoved: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
-};
-
-function run_test() {
- do_test_pending();
-
- // Create our bookmarks.html copying bookmarks.glue.html to the profile
- // folder. It will be ignored.
- create_bookmarks_html("bookmarks.glue.html");
-
- // Create our JSON backup copying bookmarks.glue.json to the profile
- // folder. It will be ignored.
- create_JSON_backup("bookmarks.glue.json");
-
- // Remove current database file.
- let db = gProfD.clone();
- db.append("places.sqlite");
- if (db.exists()) {
- db.remove(false);
- do_check_false(db.exists());
- }
-
- // Initialize nsBrowserGlue before Places.
- Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue);
-
- // Initialize Places through the History Service.
- let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
- // Check a new database has been created.
- // nsBrowserGlue uses databaseStatus to manage initialization.
- do_check_eq(hs.databaseStatus, hs.DATABASE_STATUS_CREATE);
-
- // The test will continue once restore has finished and smart bookmarks
- // have been created.
- bs.addObserver(bookmarksObserver, false);
-}
-
-function continue_test() {
- // Check that JSON backup has been restored.
- // Notice restore from JSON notification is fired before smart bookmarks creation.
- let itemId = bs.getIdForItemAt(bs.toolbarFolder, SMART_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(bs.getItemTitle(itemId), "examplejson");
-
- remove_bookmarks_html();
- remove_all_JSON_backups();
-
- do_test_finished();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_shutdown.js b/browser/components/places/tests/unit/test_browserGlue_shutdown.js
deleted file mode 100644
index 83e5fd32f..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_shutdown.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue is correctly exporting based on preferences values,
- * and creating bookmarks backup if one does not exist for today.
- */
-
-// Initialize nsBrowserGlue after Places.
-let bg = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIBrowserGlue);
-
-// Initialize Places through Bookmarks Service.
-let bs = PlacesUtils.bookmarks;
-
-// Get other services.
-let ps = Services.prefs;
-let os = Services.obs;
-
-const PREF_AUTO_EXPORT_HTML = "browser.bookmarks.autoExportHTML";
-
-let tests = [];
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "Export to bookmarks.html if autoExportHTML is true.",
- exec: function() {
- // Sanity check: we should have bookmarks on the toolbar.
- do_check_true(bs.getIdForItemAt(bs.toolbarFolder, 0) > 0);
-
- // Set preferences.
- ps.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
-
- // Force nsBrowserGlue::_shutdownPlaces().
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- PlacesUtils.TOPIC_SHUTDOWN,
- null);
-
- // Check bookmarks.html has been created.
- check_bookmarks_html();
- // Check JSON backup has been created.
- check_JSON_backup();
-
- // Check preferences have not been reverted.
- do_check_true(ps.getBoolPref(PREF_AUTO_EXPORT_HTML));
- // Reset preferences.
- ps.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "Export to bookmarks.html if autoExportHTML is true and a bookmarks.html exists.",
- exec: function() {
- // Sanity check: we should have bookmarks on the toolbar.
- do_check_true(bs.getIdForItemAt(bs.toolbarFolder, 0) > 0);
-
- // Set preferences.
- ps.setBoolPref(PREF_AUTO_EXPORT_HTML, true);
-
- // Create a bookmarks.html in the profile.
- let profileBookmarksHTMLFile = create_bookmarks_html("bookmarks.glue.html");
- // Get file lastModified and size.
- let lastMod = profileBookmarksHTMLFile.lastModifiedTime;
- let fileSize = profileBookmarksHTMLFile.fileSize;
-
- // Force nsBrowserGlue::_shutdownPlaces().
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- PlacesUtils.TOPIC_SHUTDOWN,
- null);
-
- // Check a new bookmarks.html has been created.
- let profileBookmarksHTMLFile = check_bookmarks_html();
- //XXX not working on Linux unit boxes. Could be filestats caching issue.
- let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
- if (!isLinux) {
- //XXX this test does not working on Mac boxes as well.
- let isOSX = ("nsILocalFileMac" in Ci);
- if (!isOSX) {
- do_check_true(profileBookmarksHTMLFile.lastModifiedTime > lastMod);
- }
- do_check_neq(profileBookmarksHTMLFile.fileSize, fileSize);
- }
-
- // Check preferences have not been reverted.
- do_check_true(ps.getBoolPref(PREF_AUTO_EXPORT_HTML));
- // Reset preferences.
- ps.setBoolPref(PREF_AUTO_EXPORT_HTML, false);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "Backup to JSON should be a no-op if a backup for today already exists.",
- exec: function() {
- // Sanity check: we should have bookmarks on the toolbar.
- do_check_true(bs.getIdForItemAt(bs.toolbarFolder, 0) > 0);
-
- // Create a JSON backup in the profile.
- let profileBookmarksJSONFile = create_JSON_backup("bookmarks.glue.json");
- // Get file lastModified and size.
- let lastMod = profileBookmarksJSONFile.lastModifiedTime;
- let fileSize = profileBookmarksJSONFile.fileSize;
-
- // Force nsBrowserGlue::_shutdownPlaces().
- bg.QueryInterface(Ci.nsIObserver).observe(null,
- PlacesUtils.TOPIC_SHUTDOWN,
- null);
-
- // Check a new JSON backup has not been created.
- do_check_true(profileBookmarksJSONFile.exists());
- do_check_eq(profileBookmarksJSONFile.lastModifiedTime, lastMod);
- do_check_eq(profileBookmarksJSONFile.fileSize, fileSize);
-
- do_test_finished();
- }
-});
-
-//------------------------------------------------------------------------------
-
-function finish_test() {
- do_test_finished();
-}
-
-var testIndex = 0;
-function next_test() {
- // Remove bookmarks.html from profile.
- remove_bookmarks_html();
- // Remove JSON backups from profile.
- remove_all_JSON_backups();
-
- // Execute next test.
- let test = tests.shift();
- dump("\nTEST " + (++testIndex) + ": " + test.description);
- test.exec();
-}
-
-function run_test() {
- do_test_pending();
-
- // Clean up bookmarks.
- remove_all_bookmarks();
-
- // Create some bookmarks.
- bs.insertBookmark(bs.bookmarksMenuFolder, uri("http://mozilla.org/"),
- bs.DEFAULT_INDEX, "bookmark-on-menu");
- bs.insertBookmark(bs.toolbarFolder, uri("http://mozilla.org/"),
- bs.DEFAULT_INDEX, "bookmark-on-toolbar");
-
- // Kick-off tests.
- next_test();
-}
diff --git a/browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js b/browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js
deleted file mode 100644
index 8fdfca29c..000000000
--- a/browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js
+++ /dev/null
@@ -1,346 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that nsBrowserGlue is correctly interpreting the preferences settable
- * by the user or by other components.
- */
-
-const PREF_SMART_BOOKMARKS_VERSION = "browser.places.smartBookmarksVersion";
-const PREF_AUTO_EXPORT_HTML = "browser.bookmarks.autoExportHTML";
-const PREF_IMPORT_BOOKMARKS_HTML = "browser.places.importBookmarksHTML";
-const PREF_RESTORE_DEFAULT_BOOKMARKS = "browser.bookmarks.restore_default_bookmarks";
-
-const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
-
-/**
- * Rebuilds smart bookmarks listening to console output to report any message or
- * exception generated when calling ensurePlacesDefaultQueriesInitialized().
- */
-function rebuildSmartBookmarks() {
- let consoleListener = {
- observe: function(aMsg) {
- print("Got console message: " + aMsg.message);
- },
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIConsoleListener
- ]),
- };
- Services.console.reset();
- Services.console.registerListener(consoleListener);
- Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue)
- .ensurePlacesDefaultQueriesInitialized();
- Services.console.unregisterListener(consoleListener);
-}
-
-
-let tests = [];
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "All smart bookmarks are created if smart bookmarks version is 0.",
- exec: function() {
- // Sanity check: we should have default bookmark.
- do_check_neq(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0), -1);
- do_check_neq(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0), -1);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
-
- rebuildSmartBookmarks();
-
- // Count items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "An existing smart bookmark is replaced when version changes.",
- exec: function() {
- // Sanity check: we have a smart bookmark on the toolbar.
- let itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_neq(itemId, -1);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
- // Change its title.
- PlacesUtils.bookmarks.setItemTitle(itemId, "new title");
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), "new title");
-
- // Sanity check items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
-
- rebuildSmartBookmarks();
-
- // Count items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check smart bookmark has been replaced, itemId has changed.
- itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0);
- do_check_neq(itemId, -1);
- do_check_neq(PlacesUtils.bookmarks.getItemTitle(itemId), "new title");
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "bookmarks position is retained when version changes.",
- exec: function() {
- // Sanity check items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- let itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
- let firstItemTitle = PlacesUtils.bookmarks.getItemTitle(itemId);
-
- itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 1);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
- let secondItemTitle = PlacesUtils.bookmarks.getItemTitle(itemId);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
-
- rebuildSmartBookmarks();
-
- // Count items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check smart bookmarks are still in correct position.
- itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), firstItemTitle);
-
- itemId = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 1);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId, SMART_BOOKMARKS_ANNO));
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId), secondItemTitle);
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "moved bookmarks position is retained when version changes.",
- exec: function() {
- // Sanity check items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- let itemId1 = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId1, SMART_BOOKMARKS_ANNO));
- let firstItemTitle = PlacesUtils.bookmarks.getItemTitle(itemId1);
-
- let itemId2 = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 1);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId2, SMART_BOOKMARKS_ANNO));
- let secondItemTitle = PlacesUtils.bookmarks.getItemTitle(itemId2);
-
- // Move the first smart bookmark to the end of the menu.
- PlacesUtils.bookmarks.moveItem(itemId1, PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
-
- do_check_eq(itemId1, PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX));
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
-
- rebuildSmartBookmarks();
-
- // Count items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check smart bookmarks are still in correct position.
- itemId2 = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId, 0);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId2, SMART_BOOKMARKS_ANNO));
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId2), secondItemTitle);
-
- itemId1 = PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- do_check_true(PlacesUtils.annotations.itemHasAnnotation(itemId1, SMART_BOOKMARKS_ANNO));
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(itemId1), firstItemTitle);
-
- // Move back the smart bookmark to the original position.
- PlacesUtils.bookmarks.moveItem(itemId1, PlacesUtils.bookmarksMenuFolderId, 1);
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "An explicitly removed smart bookmark should not be recreated.",
- exec: function() {
- // Remove toolbar's smart bookmarks
- PlacesUtils.bookmarks.removeItem(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.toolbarFolderId, 0));
-
- // Sanity check items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
-
- rebuildSmartBookmarks();
-
- // Count items.
- // We should not have recreated the smart bookmark on toolbar.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-
-//------------------------------------------------------------------------------
-
-tests.push({
- description: "Even if a smart bookmark has been removed recreate it if version is 0.",
- exec: function() {
- // Sanity check items.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Set preferences.
- Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
-
- rebuildSmartBookmarks();
-
- // Count items.
- // We should not have recreated the smart bookmark on toolbar.
- do_check_eq(countFolderChildren(PlacesUtils.toolbarFolderId),
- SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- do_check_eq(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
- SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
-
- // Check version has been updated.
- do_check_eq(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
- SMART_BOOKMARKS_VERSION);
-
- next_test();
- }
-});
-//------------------------------------------------------------------------------
-
-function countFolderChildren(aFolderItemId) {
- let rootNode = PlacesUtils.getFolderContents(aFolderItemId).root;
- let cc = rootNode.childCount;
- // Dump contents.
- for (let i = 0; i < cc ; i++) {
- let node = rootNode.getChild(i);
- let title = PlacesUtils.nodeIsSeparator(node) ? "---" : node.title;
- print("Found child(" + i + "): " + title);
- }
- rootNode.containerOpen = false;
- return cc;
-}
-
-function next_test() {
- if (tests.length) {
- // Execute next test.
- let test = tests.shift();
- print("\nTEST: " + test.description);
- test.exec();
- }
- else {
- // Clean up database from all bookmarks.
- remove_all_bookmarks();
- do_test_finished();
- }
-}
-
-function run_test() {
- do_test_pending();
-
- remove_bookmarks_html();
- remove_all_JSON_backups();
-
- // Initialize browserGlue, but remove it's listener to places-init-complete.
- let bg = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver);
- // Initialize Places.
- PlacesUtils.history;
- // Usually places init would async notify to glue, but we want to avoid
- // randomness here, thus we fire the notification synchronously.
- bg.observe(null, "places-init-complete", null);
-
- // Ensure preferences status.
- do_check_false(Services.prefs.getBoolPref(PREF_AUTO_EXPORT_HTML));
- do_check_false(Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
- try {
- do_check_false(Services.prefs.getBoolPref(PREF_IMPORT_BOOKMARKS_HTML));
- do_throw("importBookmarksHTML pref should not exist");
- }
- catch(ex) {}
-
- waitForImportAndSmartBookmarks(next_test);
-}
-
-function waitForImportAndSmartBookmarks(aCallback) {
- Services.obs.addObserver(function waitImport() {
- Services.obs.removeObserver(waitImport, "bookmarks-restore-success");
- // Delay to test eventual smart bookmarks creation.
- do_execute_soon(function () {
- promiseAsyncUpdates().then(aCallback);
- });
- }, "bookmarks-restore-success", false);
-}
diff --git a/browser/components/places/tests/unit/test_clearHistory_shutdown.js b/browser/components/places/tests/unit/test_clearHistory_shutdown.js
deleted file mode 100644
index a3b198008..000000000
--- a/browser/components/places/tests/unit/test_clearHistory_shutdown.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that requesting clear history at shutdown will really clear history.
- */
-
-const URIS = [
- "http://a.example1.com/"
-, "http://b.example1.com/"
-, "http://b.example2.com/"
-, "http://c.example3.com/"
-];
-
-const TOPIC_CONNECTION_CLOSED = "places-connection-closed";
-
-let EXPECTED_NOTIFICATIONS = [
- "places-shutdown"
-, "places-will-close-connection"
-, "places-expiration-finished"
-, "places-connection-closed"
-];
-
-const UNEXPECTED_NOTIFICATIONS = [
- "xpcom-shutdown"
-];
-
-const URL = "ftp://localhost/clearHistoryOnShutdown/";
-
-// Send the profile-after-change notification to the form history component to ensure
-// that it has been initialized.
-var formHistoryStartup = Cc["@mozilla.org/satchel/form-history-startup;1"].
- getService(Ci.nsIObserver);
-formHistoryStartup.observe(null, "profile-after-change", null);
-
-let notificationIndex = 0;
-
-let notificationsObserver = {
- observe: function observe(aSubject, aTopic, aData) {
- print("Received notification: " + aTopic);
-
- // Note that some of these notifications could arrive multiple times, for
- // example in case of sync, we allow that.
- if (EXPECTED_NOTIFICATIONS[notificationIndex] != aTopic)
- notificationIndex++;
- do_check_eq(EXPECTED_NOTIFICATIONS[notificationIndex], aTopic);
-
- if (aTopic != TOPIC_CONNECTION_CLOSED)
- return;
-
- getDistinctNotifications().forEach(
- function (topic) Services.obs.removeObserver(notificationsObserver, topic)
- );
-
- print("Looking for uncleared stuff.");
-
- let stmt = DBConn().createStatement(
- "SELECT id FROM moz_places WHERE url = :page_url "
- );
-
- try {
- URIS.forEach(function(aUrl) {
- stmt.params.page_url = aUrl;
- do_check_false(stmt.executeStep());
- stmt.reset();
- });
- } finally {
- stmt.finalize();
- }
-
- // Check cache.
- checkCache(URL);
- }
-}
-
-let timeInMicroseconds = Date.now() * 1000;
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function test_execute() {
- do_test_pending();
-
- print("Initialize browserglue before Places");
-
- // Avoid default bookmarks import.
- let glue = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIObserver);
- glue.observe(null, "initial-migration-will-import-default-bookmarks", null);
-
- Services.prefs.setBoolPref("privacy.clearOnShutdown.cache", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.cookies", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.offlineApps", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.history", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.downloads", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.cookies", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.formData", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.passwords", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.sessions", true);
- Services.prefs.setBoolPref("privacy.clearOnShutdown.siteSettings", true);
-
- Services.prefs.setBoolPref("privacy.sanitize.sanitizeOnShutdown", true);
-
- print("Add visits.");
- for (let aUrl of URIS) {
- yield promiseAddVisits({uri: uri(aUrl), visitDate: timeInMicroseconds++,
- transition: PlacesUtils.history.TRANSITION_TYPED})
- }
- print("Add cache.");
- storeCache(URL, "testData");
-});
-
-function run_test_continue()
-{
- print("Simulate and wait shutdown.");
- getDistinctNotifications().forEach(
- function (topic)
- Services.obs.addObserver(notificationsObserver, topic, false)
- );
-
- shutdownPlaces();
-
- // Shutdown the download manager.
- Services.obs.notifyObservers(null, "quit-application", null);
-}
-
-function getDistinctNotifications() {
- let ar = EXPECTED_NOTIFICATIONS.concat(UNEXPECTED_NOTIFICATIONS);
- return [ar[i] for (i in ar) if (ar.slice(0, i).indexOf(ar[i]) == -1)];
-}
-
-function storeCache(aURL, aContent) {
- let cache = Cc["@mozilla.org/network/cache-service;1"].
- getService(Ci.nsICacheService);
- let session = cache.createSession("FTP", Ci.nsICache.STORE_ANYWHERE,
- Ci.nsICache.STREAM_BASED);
-
- var storeCacheListener = {
- onCacheEntryAvailable: function (entry, access, status) {
- do_check_eq(status, Cr.NS_OK);
-
- entry.setMetaDataElement("servertype", "0");
- var os = entry.openOutputStream(0);
-
- var written = os.write(aContent, aContent.length);
- if (written != aContent.length) {
- do_throw("os.write has not written all data!\n" +
- " Expected: " + written + "\n" +
- " Actual: " + aContent.length + "\n");
- }
- os.close();
- entry.close();
- do_execute_soon(run_test_continue);
- }
- };
-
- session.asyncOpenCacheEntry(aURL,
- Ci.nsICache.ACCESS_READ_WRITE,
- storeCacheListener);
-}
-
-
-function checkCache(aURL) {
- let cache = Cc["@mozilla.org/network/cache-service;1"].
- getService(Ci.nsICacheService);
- let session = cache.createSession("FTP", Ci.nsICache.STORE_ANYWHERE,
- Ci.nsICache.STREAM_BASED);
-
- var checkCacheListener = {
- onCacheEntryAvailable: function (entry, access, status) {
- do_check_eq(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND);
- do_test_finished();
- }
- };
-
- session.asyncOpenCacheEntry(aURL,
- Ci.nsICache.ACCESS_READ,
- checkCacheListener);
-}
diff --git a/browser/components/places/tests/unit/test_leftpane_corruption_handling.js b/browser/components/places/tests/unit/test_leftpane_corruption_handling.js
deleted file mode 100644
index a88c2b6d2..000000000
--- a/browser/components/places/tests/unit/test_leftpane_corruption_handling.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Tests that we build a working leftpane in various corruption situations.
- */
-
-// Used to store the original leftPaneFolderId getter.
-let gLeftPaneFolderIdGetter;
-let gAllBookmarksFolderIdGetter;
-// Used to store the original left Pane status as a JSON string.
-let gReferenceJSON;
-let gLeftPaneFolderId;
-// Third party annotated folder.
-let gFolderId;
-
-// Corruption cases.
-let gTests = [
-
- function test1() {
- print("1. Do nothing, checks test calibration.");
- },
-
- function test2() {
- print("2. Delete the left pane folder.");
- PlacesUtils.bookmarks.removeItem(gLeftPaneFolderId);
- },
-
- function test3() {
- print("3. Delete a child of the left pane folder.");
- let id = PlacesUtils.bookmarks.getIdForItemAt(gLeftPaneFolderId, 0);
- PlacesUtils.bookmarks.removeItem(id);
- },
-
- function test4() {
- print("4. Delete AllBookmarks.");
- PlacesUtils.bookmarks.removeItem(PlacesUIUtils.allBookmarksFolderId);
- },
-
- function test5() {
- print("5. Create a duplicated left pane folder.");
- let id = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
- "PlacesRoot",
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(id, ORGANIZER_FOLDER_ANNO,
- "PlacesRoot", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
- },
-
- function test6() {
- print("6. Create a duplicated left pane query.");
- let id = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
- "AllBookmarks",
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(id, ORGANIZER_QUERY_ANNO,
- "AllBookmarks", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
- },
-
- function test7() {
- print("7. Remove the left pane folder annotation.");
- PlacesUtils.annotations.removeItemAnnotation(gLeftPaneFolderId,
- ORGANIZER_FOLDER_ANNO);
- },
-
- function test8() {
- print("8. Remove a left pane query annotation.");
- PlacesUtils.annotations.removeItemAnnotation(PlacesUIUtils.allBookmarksFolderId,
- ORGANIZER_QUERY_ANNO);
- },
-
- function test9() {
- print("9. Remove a child of AllBookmarks.");
- let id = PlacesUtils.bookmarks.getIdForItemAt(PlacesUIUtils.allBookmarksFolderId, 0);
- PlacesUtils.bookmarks.removeItem(id);
- },
-
-];
-
-function run_test() {
- // We want empty roots.
- remove_all_bookmarks();
-
- // Sanity check.
- do_check_true(!!PlacesUIUtils);
-
- // Check getters.
- gLeftPaneFolderIdGetter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
- do_check_eq(typeof(gLeftPaneFolderIdGetter), "function");
- gAllBookmarksFolderIdGetter = PlacesUIUtils.__lookupGetter__("allBookmarksFolderId");
- do_check_eq(typeof(gAllBookmarksFolderIdGetter), "function");
-
- // Add a third party bogus annotated item. Should not be removed.
- gFolderId = PlacesUtils.bookmarks.createFolder(PlacesUtils.unfiledBookmarksFolderId,
- "test",
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- PlacesUtils.annotations.setItemAnnotation(gFolderId, ORGANIZER_QUERY_ANNO,
- "test", 0,
- PlacesUtils.annotations.EXPIRE_NEVER);
-
- // Create the left pane, and store its current status, it will be used
- // as reference value.
- gLeftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
-
- do_test_pending();
-
- Task.spawn(function() {
- gReferenceJSON = yield folderToJSON(gLeftPaneFolderId);
-
- // Kick-off tests.
- do_timeout(0, run_next_test);
- });
-}
-
-function run_next_test() {
- if (gTests.length) {
- // Create corruption.
- let test = gTests.shift();
- test();
- // Regenerate getters.
- PlacesUIUtils.__defineGetter__("leftPaneFolderId", gLeftPaneFolderIdGetter);
- gLeftPaneFolderId = PlacesUIUtils.leftPaneFolderId;
- PlacesUIUtils.__defineGetter__("allBookmarksFolderId", gAllBookmarksFolderIdGetter);
- // Check the new left pane folder.
- Task.spawn(function() {
- let leftPaneJSON = yield folderToJSON(gLeftPaneFolderId);
- do_check_true(compareJSON(gReferenceJSON, leftPaneJSON));
- do_check_eq(PlacesUtils.bookmarks.getItemTitle(gFolderId), "test");
- // Go to next test.
- do_timeout(0, run_next_test);
- });
- }
- else {
- // All tests finished.
- remove_all_bookmarks();
- do_test_finished();
- }
-}
-
-/**
- * Convert a folder item id to a JSON representation of it and its contents.
- */
-function folderToJSON(aItemId) {
- return Task.spawn(function() {
- let query = PlacesUtils.history.getNewQuery();
- query.setFolders([aItemId], 1);
- let options = PlacesUtils.history.getNewQueryOptions();
- options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
- let root = PlacesUtils.history.executeQuery(query, options).root;
- let writer = {
- value: "",
- write: function PU_wrapNode__write(aStr, aLen) {
- this.value += aStr;
- }
- };
- yield BookmarkJSONUtils.serializeNodeAsJSONToOutputStream(root, writer,
- false, false);
- do_check_true(writer.value.length > 0);
- throw new Task.Result(writer.value);
- });
-}
-
-/**
- * Compare the JSON representation of 2 nodes, skipping everchanging properties
- * like dates.
- */
-function compareJSON(aNodeJSON_1, aNodeJSON_2) {
- let node1 = JSON.parse(aNodeJSON_1);
- let node2 = JSON.parse(aNodeJSON_2);
-
- // List of properties we should not compare (expected to be different).
- const SKIP_PROPS = ["dateAdded", "lastModified", "id"];
-
- function compareObjects(obj1, obj2) {
- function count(o) { var n = 0; for (let p in o) n++; return n; }
- do_check_eq(count(obj1), count(obj2));
- for (let prop in obj1) {
- // Skip everchanging values.
- if (SKIP_PROPS.indexOf(prop) != -1)
- continue;
- // Skip undefined objects, otherwise we hang on them.
- if (!obj1[prop])
- continue;
- if (typeof(obj1[prop]) == "object")
- return compareObjects(obj1[prop], obj2[prop]);
- if (obj1[prop] !== obj2[prop]) {
- print(prop + ": " + obj1[prop] + "!=" + obj2[prop]);
- return false;
- }
- }
- return true;
- }
-
- return compareObjects(node1, node2);
-}
diff --git a/browser/components/places/tests/unit/xpcshell.ini b/browser/components/places/tests/unit/xpcshell.ini
deleted file mode 100644
index e8b2576f6..000000000
--- a/browser/components/places/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,18 +0,0 @@
-[DEFAULT]
-head = head_bookmarks.js
-tail =
-firefox-appdir = browser
-
-[test_421483.js]
-[test_browserGlue_corrupt.js]
-[test_browserGlue_corrupt_nobackup.js]
-[test_browserGlue_corrupt_nobackup_default.js]
-[test_browserGlue_distribution.js]
-[test_browserGlue_migrate.js]
-[test_browserGlue_prefs.js]
-[test_browserGlue_restore.js]
-[test_browserGlue_shutdown.js]
-[test_browserGlue_smartBookmarks.js]
-[test_clearHistory_shutdown.js]
-[test_leftpane_corruption_handling.js]
-[test_PUIU_makeTransaction.js]
diff --git a/browser/components/preferences/moz.build b/browser/components/preferences/moz.build
index 0a6b67fd8..8deb0b138 100644
--- a/browser/components/preferences/moz.build
+++ b/browser/components/preferences/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['tests']
+
diff --git a/browser/components/preferences/tests/Makefile.in b/browser/components/preferences/tests/Makefile.in
deleted file mode 100644
index 459a4e974..000000000
--- a/browser/components/preferences/tests/Makefile.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- head.js \
- browser_advanced_update.js \
- browser_bug705422.js \
- browser_permissions.js \
- browser_chunk_permissions.js \
- browser_privacypane_1.js \
- browser_privacypane_3.js \
- browser_privacypane_4.js \
- browser_privacypane_5.js \
- browser_privacypane_8.js \
- privacypane_tests_perwindow.js \
- $(NULL)
-
-ifdef MOZ_SERVICES_HEALTHREPORT
-MOCHITEST_BROWSER_FILES += browser_healthreport.js
-endif
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/preferences/tests/browser_advanced_update.js b/browser/components/preferences/tests/browser_advanced_update.js
deleted file mode 100644
index 3de2c44dc..000000000
--- a/browser/components/preferences/tests/browser_advanced_update.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
- resetPreferences();
-
- registerCleanupFunction(resetPreferences);
-
- function observer(win, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- runTest(win);
- }
- Services.obs.addObserver(observer, "advanced-pane-loaded", false);
-
- Services.prefs.setBoolPref("browser.search.update", false);
- openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
- "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
-}
-
-function runTest(win) {
- let doc = win.document;
- let enableSearchUpdate = doc.getElementById("enableSearchUpdate");
-
- // Ensure that the update pref dialog reflects the actual pref value.
- ok(!enableSearchUpdate.checked, "Ensure search updates are disabled");
- Services.prefs.setBoolPref("browser.search.update", true);
- ok(enableSearchUpdate.checked, "Ensure search updates are enabled");
-
- win.close();
- finish();
-}
-
-function resetPreferences() {
- Services.prefs.clearUserPref("browser.search.update");
-}
diff --git a/browser/components/preferences/tests/browser_bug410900.js b/browser/components/preferences/tests/browser_bug410900.js
deleted file mode 100644
index bfb52303d..000000000
--- a/browser/components/preferences/tests/browser_bug410900.js
+++ /dev/null
@@ -1,51 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- // Setup a phony handler to ensure the app pane will be populated.
- var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
- createInstance(Ci.nsIWebHandlerApp);
- handler.name = "App pane alive test";
- handler.uriTemplate = "http://test.mozilla.org/%s";
-
- var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
- getService(Ci.nsIExternalProtocolService);
- var info = extps.getProtocolHandlerInfo("apppanetest");
- info.possibleApplicationHandlers.appendElement(handler, false);
-
- var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
- getService(Ci.nsIHandlerService);
- hserv.store(info);
-
- function observer(win, topic, data) {
- if (topic != "app-handler-pane-loaded")
- return;
-
- Services.obs.removeObserver(observer, "app-handler-pane-loaded");
- runTest(win);
- }
- Services.obs.addObserver(observer, "app-handler-pane-loaded", false);
-
- openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
- "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneApplications");
-}
-
-function runTest(win) {
- var sel = win.document.documentElement.getAttribute("lastSelected");
- ok(sel == "paneApplications", "Specified pane was opened");
-
- var rbox = win.document.getElementById("handlersView");
- ok(rbox, "handlersView is present");
-
- var items = rbox && rbox.getElementsByTagName("richlistitem");
- ok(items && items.length > 0, "App handler list populated");
-
- var handlerAdded = false;
- for (let i = 0; i < items.length; i++) {
- if (items[i].type == "apppanetest")
- handlerAdded = true;
- }
- ok(handlerAdded, "apppanetest protocol handler was successfully added");
-
- win.close();
- finish();
-}
diff --git a/browser/components/preferences/tests/browser_bug705422.js b/browser/components/preferences/tests/browser_bug705422.js
deleted file mode 100644
index b24f60453..000000000
--- a/browser/components/preferences/tests/browser_bug705422.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
- // Allow all cookies, then actually set up the test
- SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]}, initTest);
-}
-
-function initTest() {
- const searchTerm = "example";
- const dummyTerm = "elpmaxe";
-
- var cm = Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager);
-
- // delete all cookies (might be left over from other tests)
- cm.removeAll();
-
- // data for cookies
- var vals = [[searchTerm+".com", dummyTerm, dummyTerm], // match
- [searchTerm+".org", dummyTerm, dummyTerm], // match
- [dummyTerm+".com", searchTerm, dummyTerm], // match
- [dummyTerm+".edu", searchTerm+dummyTerm, dummyTerm],// match
- [dummyTerm+".net", dummyTerm, searchTerm], // match
- [dummyTerm+".org", dummyTerm, searchTerm+dummyTerm],// match
- [dummyTerm+".int", dummyTerm, dummyTerm]]; // no match
-
- // matches must correspond to above data
- const matches = 6;
-
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
- .getService(Components.interfaces.nsICookieService);
- var v;
- // inject cookies
- for (v in vals) {
- let [host, name, value] = vals[v];
- var cookieUri = ios.newURI("http://"+host, null, null);
- cookieSvc.setCookieString(cookieUri, null, name+"="+value+";", null);
- }
-
- // open cookie manager
- var cmd = window.openDialog("chrome://browser/content/preferences/cookies.xul",
- "Browser:Cookies", "", {});
-
- // when it has loaded, run actual tests
- cmd.addEventListener("load", function() {executeSoon(function() {runTest(cmd, searchTerm, vals.length, matches);});}, false);
-}
-
-function isDisabled(win, expectation) {
- var disabled = win.document.getElementById("removeAllCookies").disabled;
- is(disabled, expectation, "Remove all cookies button has correct state: "+(expectation?"disabled":"enabled"));
-}
-
-function runTest(win, searchTerm, cookies, matches) {
- var cm = Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager);
-
-
- // number of cookies should match injected cookies
- var cnt = 0,
- enumerator = cm.enumerator;
- while (enumerator.hasMoreElements()) {
- cnt++;
- enumerator.getNext();
- }
- is(cnt, cookies, "Number of cookies match injected cookies");
-
- // "delete all cookies" should be enabled
- isDisabled(win, false);
-
- // filter cookies and count matches
- win.gCookiesWindow.setFilter(searchTerm);
- is(win.gCookiesWindow._view.rowCount, matches, "Correct number of cookies shown after filter is applied");
-
- // "delete all cookies" should be enabled
- isDisabled(win, false);
-
-
- // select first cookie and delete
- var tree = win.document.getElementById("cookiesList");
- var deleteButton = win.document.getElementById("removeCookie");
- var x = {}, y = {}, width = {}, height = {};
- tree.treeBoxObject.getCoordsForCellItem(0, tree.columns[0], "cell", x, y, width, height);
- EventUtils.synthesizeMouse(tree.body, x.value + width.value / 2, y.value + height.value / 2, {}, win);
- EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
-
- // count cookies should be matches-1
- is(win.gCookiesWindow._view.rowCount, matches-1, "Deleted selected cookie");
-
- // select two adjacent cells and delete
- EventUtils.synthesizeMouse(tree.body, x.value + width.value / 2, y.value + height.value / 2, {}, win);
- deleteButton = win.document.getElementById("removeCookies");
- var eventObj = {};
- if (navigator.platform.indexOf("Mac") >= 0)
- eventObj.metaKey = true;
- else
- eventObj.ctrlKey = true;
- tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[0], "cell", x, y, width, height);
- EventUtils.synthesizeMouse(tree.body, x.value + width.value / 2, y.value + height.value / 2, eventObj, win);
- EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
-
- // count cookies should be matches-3
- is(win.gCookiesWindow._view.rowCount, matches-3, "Deleted selected two adjacent cookies");
-
- // "delete all cookies" should be enabled
- isDisabled(win, false);
-
- // delete all cookies and count
- var deleteAllButton = win.document.getElementById("removeAllCookies");
- EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
- is(win.gCookiesWindow._view.rowCount, 0, "Deleted all matching cookies");
-
- // "delete all cookies" should be disabled
- isDisabled(win, true);
-
- // clear filter and count should be cookies-matches
- win.gCookiesWindow.setFilter("");
- is(win.gCookiesWindow._view.rowCount, cookies-matches, "Unmatched cookies remain");
-
- // "delete all cookies" should be enabled
- isDisabled(win, false);
-
- // delete all cookies and count should be 0
- EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
- is(win.gCookiesWindow._view.rowCount, 0, "Deleted all cookies");
-
- // check that datastore is also at 0
- var cnt = 0,
- enumerator = cm.enumerator;
- while (enumerator.hasMoreElements()) {
- cnt++;
- enumerator.getNext();
- }
- is(cnt, 0, "Zero cookies remain");
-
- // "delete all cookies" should be disabled
- isDisabled(win, true);
-
- // clean up
- win.close();
- finish();
-}
diff --git a/browser/components/preferences/tests/browser_chunk_permissions.js b/browser/components/preferences/tests/browser_chunk_permissions.js
deleted file mode 100644
index 4bd387229..000000000
--- a/browser/components/preferences/tests/browser_chunk_permissions.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
-
-const ABOUT_PERMISSIONS_SPEC = "about:permissions";
-
-const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
-const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
-const TEST_URI_3 = NetUtil.newURI("http://wikipedia.org/");
-
-// values from DefaultPermissions object
-const PERM_UNKNOWN = 0;
-const PERM_ALLOW = 1;
-const PERM_DENY = 2;
-
-// used to set permissions on test sites
-const TEST_PERMS = {
- "password": PERM_ALLOW,
- "cookie": PERM_ALLOW,
- "geo": PERM_UNKNOWN,
- "indexedDB": PERM_UNKNOWN,
- "popup": PERM_DENY
-};
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(cleanUp);
- setup(function() {
- runNextTest();
- });
-}
-
-function setup(aCallback) {
- // add test history visit
- addVisits(TEST_URI_1, function() {
- // set permissions ourselves to avoid problems with different defaults
- // from test harness configuration
- for (let type in TEST_PERMS) {
- if (type == "password") {
- Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
- } else {
- // set permissions on a site without history visits to test enumerateServices
- Services.perms.add(TEST_URI_2, type, TEST_PERMS[type]);
- }
- }
-
- Services.perms.add(TEST_URI_3, "popup", TEST_PERMS["popup"]);
- aCallback();
- });
-}
-
-function cleanUp() {
- for (let type in TEST_PERMS) {
- if (type != "password") {
- Services.perms.remove(TEST_URI_1.host, type);
- Services.perms.remove(TEST_URI_2.host, type);
- Services.perms.remove(TEST_URI_3.host, type);
- }
- }
-}
-
-function runNextTest() {
- if (gTestIndex == tests.length) {
- waitForClearHistory(finish);
- return;
- }
-
- let nextTest = tests[gTestIndex++];
- info(nextTest.desc);
-
- function preinit_observer() {
- Services.obs.removeObserver(preinit_observer, "browser-permissions-preinit");
- nextTest.preInit();
- }
- Services.obs.addObserver(preinit_observer, "browser-permissions-preinit", false);
-
- function init_observer() {
- Services.obs.removeObserver(init_observer, "browser-permissions-initialized");
- nextTest.run();
- }
- Services.obs.addObserver(init_observer, "browser-permissions-initialized", false);
-
- // open about:permissions
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:permissions");
- registerCleanupFunction(function() {
- gBrowser.removeTab(tab);
- });
-}
-
-var gSitesList;
-
-var gTestIndex = 0;
-var tests = [
- // 'preInit' occurs after opening about:permissions, before sites-list is populated
- // 'run' occurs after sites-list is populated
- {
- desc: "test filtering before sites-list is fully constructed.",
- preInit: function() {
- let sitesFilter = gBrowser.contentDocument.getElementById("sites-filter");
- sitesFilter.value = TEST_URI_2.host;
- sitesFilter.doCommand();
- },
- run: function() {
- let testSite1 = getSiteItem(TEST_URI_1.host);
- ok(testSite1.collapsed, "test site 1 is collapsed after early filtering");
- let testSite2 = getSiteItem(TEST_URI_2.host);
- ok(!testSite2.collapsed, "test site 2 is not collapsed after early filtering");
- let testSite3 = getSiteItem(TEST_URI_3.host);
- ok(testSite3.collapsed, "test site 3 is collapsed after early filtering");
-
- runNextTest();
- }
- },
- {
- desc: "test removing from sites-list before it is fully constructed.",
- preInit: function() {
- ForgetAboutSite.removeDataFromDomain(TEST_URI_2.host);
- },
- run: function() {
- let testSite1 = getSiteItem(TEST_URI_1.host);
- ok(!testSite2, "test site 1 was not removed from sites list");
- let testSite2 = getSiteItem(TEST_URI_2.host);
- ok(!testSite2, "test site 2 was pre-removed from sites list");
- let testSite3 = getSiteItem(TEST_URI_3.host);
- ok(!testSite2, "test site 3 was not removed from sites list");
-
- runNextTest();
- }
- }
-];
-
-function getSiteItem(aHost) {
- return gBrowser.contentDocument.
- querySelector(".site[value='" + aHost + "']");
-}
-
-// copied from toolkit/components/places/tests/head_common.js
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
diff --git a/browser/components/preferences/tests/browser_healthreport.js b/browser/components/preferences/tests/browser_healthreport.js
deleted file mode 100644
index 161b1d782..000000000
--- a/browser/components/preferences/tests/browser_healthreport.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
- waitForExplicitFinish();
- resetPreferences();
- registerCleanupFunction(resetPreferences);
-
- function observer(win, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- runTest(win);
- }
- Services.obs.addObserver(observer, "advanced-pane-loaded", false);
- openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
- "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced");
-}
-
-function runTest(win) {
- let doc = win.document;
-
- let policy = Components.classes["@mozilla.org/datareporting/service;1"]
- .getService(Components.interfaces.nsISupports)
- .wrappedJSObject
- .policy;
- ok(policy);
- is(policy.dataSubmissionPolicyAccepted, false, "Data submission policy not accepted.");
- is(policy.healthReportUploadEnabled, true, "Health Report upload enabled on app first run.");
-
- let checkbox = doc.getElementById("submitHealthReportBox");
- ok(checkbox);
- is(checkbox.checked, true, "Health Report checkbox is checked on app first run.");
-
- checkbox.checked = false;
- checkbox.doCommand();
- is(policy.healthReportUploadEnabled, false, "Unchecking checkbox opts out of FHR upload.");
-
- checkbox.checked = true;
- checkbox.doCommand();
- is(policy.healthReportUploadEnabled, true, "Checking checkbox allows FHR upload.");
-
- win.close();
- finish();
-}
-
-function resetPreferences() {
- Services.prefs.clearUserPref("datareporting.healthreport.uploadEnabled");
-}
-
diff --git a/browser/components/preferences/tests/browser_permissions.js b/browser/components/preferences/tests/browser_permissions.js
deleted file mode 100644
index ad978eb77..000000000
--- a/browser/components/preferences/tests/browser_permissions.js
+++ /dev/null
@@ -1,342 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-
-const ABOUT_PERMISSIONS_SPEC = "about:permissions";
-
-const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
-const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
-
-const TEST_PRINCIPAL_1 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_1);
-const TEST_PRINCIPAL_2 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_2);
-
-// values from DefaultPermissions object
-const PERM_UNKNOWN = 0;
-const PERM_ALLOW = 1;
-const PERM_DENY = 2;
-// cookie specific permissions
-const PERM_FIRST_PARTY_ONLY = 9;
-
-// used to set permissions on test sites
-const TEST_PERMS = {
- "password": PERM_ALLOW,
- "cookie": PERM_ALLOW,
- "geo": PERM_UNKNOWN,
- "indexedDB": PERM_UNKNOWN,
- "popup": PERM_DENY,
- "plugins" : PERM_ALLOW,
- "fullscreen" : PERM_UNKNOWN,
-};
-
-const NO_GLOBAL_ALLOW = [
- "geo",
- "indexedDB",
- "fullscreen"
-];
-
-// number of managed permissions in the interface
-const TEST_PERMS_COUNT = 7;
-
-function test() {
- waitForExplicitFinish();
- registerCleanupFunction(cleanUp);
-
- // add test history visit
- addVisits(TEST_URI_1, function() {
- // set permissions ourselves to avoid problems with different defaults
- // from test harness configuration
- for (let type in TEST_PERMS) {
- if (type == "password") {
- Services.logins.setLoginSavingEnabled(TEST_URI_2.prePath, true);
- } else {
- // set permissions on a site without history visits to test enumerateServices
- Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, type, TEST_PERMS[type]);
- }
- }
-
- // open about:permissions
- gBrowser.selectedTab = gBrowser.addTab("about:permissions");
- });
-
- function observer() {
- Services.obs.removeObserver(observer, "browser-permissions-initialized");
- runNextTest();
- }
- Services.obs.addObserver(observer, "browser-permissions-initialized", false);
-}
-
-function cleanUp() {
- for (let type in TEST_PERMS) {
- if (type != "password") {
- Services.perms.removeFromPrincipal(TEST_PRINCIPAL_1, type);
- Services.perms.removeFromPrincipal(TEST_PRINCIPAL_2, type);
- }
- }
-
- gBrowser.removeTab(gBrowser.selectedTab);
-}
-
-function runNextTest() {
- if (gTestIndex == tests.length) {
- waitForClearHistory(finish);
- return;
- }
-
- let nextTest = tests[gTestIndex++];
- info("[" + nextTest.name + "] running test");
- nextTest();
-}
-
-var gSitesList;
-var gHeaderDeck;
-var gSiteLabel;
-
-var gTestIndex = 0;
-var tests = [
- function test_page_load() {
- is(gBrowser.currentURI.spec, ABOUT_PERMISSIONS_SPEC, "about:permissions loaded");
-
- gSitesList = gBrowser.contentDocument.getElementById("sites-list");
- ok(gSitesList, "got sites list");
-
- gHeaderDeck = gBrowser.contentDocument.getElementById("header-deck");
- ok(gHeaderDeck, "got header deck");
-
- gSiteLabel = gBrowser.contentDocument.getElementById("site-label");
- ok(gSiteLabel, "got site label");
-
- runNextTest();
- },
-
- function test_sites_list() {
- is(gSitesList.firstChild.id, "all-sites-item",
- "all sites is the first item in the sites list");
-
- ok(getSiteItem(TEST_URI_1.host), "site item from places db exists");
- ok(getSiteItem(TEST_URI_2.host), "site item from enumerating services exists");
-
- runNextTest();
- },
-
- function test_filter_sites_list() {
- // set filter to test host
- let sitesFilter = gBrowser.contentDocument.getElementById("sites-filter");
- sitesFilter.value = TEST_URI_1.host;
- sitesFilter.doCommand();
-
- // make sure correct sites are collapsed/showing
- let testSite1 = getSiteItem(TEST_URI_1.host);
- ok(!testSite1.collapsed, "test site 1 is not collapsed");
- let testSite2 = getSiteItem(TEST_URI_2.host);
- ok(testSite2.collapsed, "test site 2 is collapsed");
-
- // clear filter
- sitesFilter.value = "";
- sitesFilter.doCommand();
-
- runNextTest();
- },
-
- function test_all_sites() {
- // "All Sites" item should be selected when the page is first loaded
- is(gSitesList.selectedItem, gBrowser.contentDocument.getElementById("all-sites-item"),
- "all sites item is selected");
-
- let defaultsHeader = gBrowser.contentDocument.getElementById("defaults-header");
- is(defaultsHeader, gHeaderDeck.selectedPanel,
- "correct header shown for all sites");
-
- ok(gBrowser.contentDocument.getElementById("passwords-count").hidden,
- "passwords count is hidden");
- ok(gBrowser.contentDocument.getElementById("cookies-count").hidden,
- "cookies count is hidden");
-
- // Test to make sure "Allow" items hidden for certain permission types
- NO_GLOBAL_ALLOW.forEach(function(aType) {
- let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
- ok(menuitem.hidden, aType + " allow menuitem hidden for all sites");
- });
-
- runNextTest();
- },
-
- function test_all_sites_permission() {
- // apply the old default of allowing all cookies
- Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
-
- // there should be no user-set pref for cookie behavior
- is(Services.prefs.getIntPref("network.cookie.cookieBehavior"), PERM_UNKNOWN,
- "network.cookie.cookieBehavior is expected default");
-
- // the default behavior is to allow cookies
- let cookieMenulist = getPermissionMenulist("cookie");
- is(cookieMenulist.value, PERM_ALLOW,
- "menulist correctly shows that cookies are allowed");
-
- // set the pref to block cookies
- Services.prefs.setIntPref("network.cookie.cookieBehavior", PERM_DENY);
- // check to make sure this change is reflected in the UI
- is(cookieMenulist.value, PERM_DENY, "menulist correctly shows that cookies are blocked");
-
- // clear the pref
- Services.prefs.clearUserPref("network.cookie.cookieBehavior");
-
- runNextTest();
- },
-
- function test_manage_all_passwords() {
- // make sure "Manage All Passwords..." button opens the correct dialog
- addWindowListener("chrome://passwordmgr/content/passwordManager.xul", runNextTest);
- gBrowser.contentDocument.getElementById("passwords-manage-all-button").doCommand();
-
- },
-
- function test_manage_all_cookies() {
- // make sure "Manage All Cookies..." button opens the correct dialog
- addWindowListener("chrome://browser/content/preferences/cookies.xul", runNextTest);
- gBrowser.contentDocument.getElementById("cookies-manage-all-button").doCommand();
- },
-
- function test_select_site() {
- // select the site that has the permissions we set at the beginning of the test
- let testSiteItem = getSiteItem(TEST_URI_2.host);
- gSitesList.selectedItem = testSiteItem;
-
- let siteHeader = gBrowser.contentDocument.getElementById("site-header");
- is(siteHeader, gHeaderDeck.selectedPanel,
- "correct header shown for a specific site");
- is(gSiteLabel.value, TEST_URI_2.host, "header updated for selected site");
-
- ok(!gBrowser.contentDocument.getElementById("passwords-count").hidden,
- "passwords count is not hidden");
- ok(!gBrowser.contentDocument.getElementById("cookies-count").hidden,
- "cookies count is not hidden");
-
- // Test to make sure "Allow" items are *not* hidden for certain permission types
- NO_GLOBAL_ALLOW.forEach(function(aType) {
- let menuitem = gBrowser.contentDocument.getElementById(aType + "-" + PERM_ALLOW);
- ok(!menuitem.hidden, aType + " allow menuitem not hidden for single site");
- });
-
- runNextTest();
- },
-
- function test_permissions() {
- let menulists = gBrowser.contentDocument.getElementsByClassName("pref-menulist");
- is(menulists.length, TEST_PERMS_COUNT, "got expected number of managed permissions");
-
- for (let i = 0; i < menulists.length; i++) {
- let permissionMenulist = menulists.item(i);
- let permissionType = permissionMenulist.getAttribute("type");
-
- // permissions should reflect what we set at the beginning of the test
- is(permissionMenulist.value, TEST_PERMS[permissionType],
- "got expected value for " + permissionType + " permission");
- }
-
- runNextTest();
- },
-
- function test_permission_change() {
- let geoMenulist = getPermissionMenulist("geo");
- is(geoMenulist.value, PERM_UNKNOWN, "menulist correctly shows that geolocation permission is unspecified");
-
- // change a permission programatically
- Services.perms.addFromPrincipal(TEST_PRINCIPAL_2, "geo", PERM_DENY);
- // check to make sure this change is reflected in the UI
- is(geoMenulist.value, PERM_DENY, "menulist shows that geolocation is blocked");
-
- // change a permisssion in the UI
- let geoAllowItem = gBrowser.contentDocument.getElementById("geo-" + PERM_ALLOW);
- geoMenulist.selectedItem = geoAllowItem;
- geoMenulist.doCommand();
- // check to make sure this change is reflected in the permission manager
- is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "geo"), PERM_ALLOW,
- "permission manager shows that geolocation is allowed");
-
-
- // change a site-specific cookie permission, just for fun
- let cookieMenuList = getPermissionMenulist("cookie");
- let cookieItem = gBrowser.contentDocument.getElementById("cookie-" + PERM_FIRST_PARTY_ONLY);
- cookieMenuList.selectedItem = cookieItem;
- cookieMenuList.doCommand();
- is(cookieMenuList.value, PERM_FIRST_PARTY_ONLY, "menulist correctly shows that " +
- "first party only cookies are allowed");
- is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, "cookie"),
- PERM_FIRST_PARTY_ONLY, "permission manager shows that first party cookies " +
- "are allowed");
-
- runNextTest();
- },
-
- function test_forget_site() {
- // click "Forget About This Site" button
- gBrowser.contentDocument.getElementById("forget-site-button").doCommand();
- waitForClearHistory(function() {
- is(gSiteLabel.value, "", "site label cleared");
-
- let allSitesItem = gBrowser.contentDocument.getElementById("all-sites-item");
- is(gSitesList.selectedItem, allSitesItem,
- "all sites item selected after forgetting selected site");
-
- // check to make sure site is gone from sites list
- let testSiteItem = getSiteItem(TEST_URI_2.host);
- ok(!testSiteItem, "site removed from sites list");
-
- // check to make sure we forgot all permissions corresponding to site
- for (let type in TEST_PERMS) {
- if (type == "password") {
- ok(Services.logins.getLoginSavingEnabled(TEST_URI_2.prePath),
- "password saving should be enabled by default");
- } else {
- is(Services.perms.testPermissionFromPrincipal(TEST_PRINCIPAL_2, type), PERM_UNKNOWN,
- type + " permission should not be set for test site 2");
- }
- }
-
- runNextTest();
- });
- }
-];
-
-function getPermissionMenulist(aType) {
- return gBrowser.contentDocument.getElementById(aType + "-menulist");
-}
-
-function getSiteItem(aHost) {
- return gBrowser.contentDocument.
- querySelector(".site[value='" + aHost + "']");
-}
-
-function addWindowListener(aURL, aCallback) {
- Services.wm.addListener({
- onOpenWindow: function(aXULWindow) {
- info("window opened, waiting for focus");
- Services.wm.removeListener(this);
-
- var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- waitForFocus(function() {
- is(domwindow.document.location.href, aURL, "should have seen the right window open");
- domwindow.close();
- aCallback();
- }, domwindow);
- },
- onCloseWindow: function(aXULWindow) { },
- onWindowTitleChange: function(aXULWindow, aNewTitle) { }
- });
-}
-
-// copied from toolkit/components/places/tests/head_common.js
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
-}
diff --git a/browser/components/preferences/tests/browser_privacypane_1.js b/browser/components/preferences/tests/browser_privacypane_1.js
deleted file mode 100644
index f478b1aca..000000000
--- a/browser/components/preferences/tests/browser_privacypane_1.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
-
- let rootDir = getRootDirectory(gTestPath);
- let jar = getJar(rootDir);
- if (jar) {
- let tmpdir = extractJarToTmp(jar);
- rootDir = "file://" + tmpdir.path + '/';
- }
- loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
-
- run_test_subset([
- test_pane_visibility,
- test_dependent_elements,
- test_dependent_cookie_elements,
- test_dependent_clearonclose_elements,
- test_dependent_prefs,
-
- // reset all preferences to their default values once we're done
- reset_preferences
- ]);
-}
diff --git a/browser/components/preferences/tests/browser_privacypane_3.js b/browser/components/preferences/tests/browser_privacypane_3.js
deleted file mode 100644
index 8ef887a35..000000000
--- a/browser/components/preferences/tests/browser_privacypane_3.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let rootDir = getRootDirectory(gTestPath);
- let jar = getJar(rootDir);
- if (jar) {
- let tmpdir = extractJarToTmp(jar);
- rootDir = "file://" + tmpdir.path + '/';
- }
- loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
-
- run_test_subset([
- test_custom_retention("rememberHistory", "remember"),
- test_custom_retention("rememberHistory", "custom"),
- test_custom_retention("rememberForms", "remember"),
- test_custom_retention("rememberForms", "custom"),
- test_historymode_retention("remember", "remember"),
-
- // reset all preferences to their default values once we're done
- reset_preferences
- ]);
-}
diff --git a/browser/components/preferences/tests/browser_privacypane_4.js b/browser/components/preferences/tests/browser_privacypane_4.js
deleted file mode 100644
index 55609e542..000000000
--- a/browser/components/preferences/tests/browser_privacypane_4.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let rootDir = getRootDirectory(gTestPath);
- let jar = getJar(rootDir);
- if (jar) {
- let tmpdir = extractJarToTmp(jar);
- rootDir = "file://" + tmpdir.path + '/';
- }
- loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
-
- run_test_subset([
- test_custom_retention("acceptCookies", "remember"),
- test_custom_retention("acceptCookies", "custom"),
- test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
- test_custom_retention("acceptThirdPartyMenu", "custom", "always"),
- test_custom_retention("keepCookiesUntil", "remember", 1),
- test_custom_retention("keepCookiesUntil", "custom", 2),
- test_custom_retention("keepCookiesUntil", "custom", 0),
- test_custom_retention("alwaysClear", "remember"),
- test_custom_retention("alwaysClear", "custom"),
- test_historymode_retention("remember", "remember"),
-
- // reset all preferences to their default values once we're done
- reset_preferences
- ]);
-}
diff --git a/browser/components/preferences/tests/browser_privacypane_5.js b/browser/components/preferences/tests/browser_privacypane_5.js
deleted file mode 100644
index 48a4feb91..000000000
--- a/browser/components/preferences/tests/browser_privacypane_5.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let rootDir = getRootDirectory(gTestPath);
- let jar = getJar(rootDir);
- if (jar) {
- let tmpdir = extractJarToTmp(jar);
- rootDir = "file://" + tmpdir.path + '/';
- }
- loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
-
- run_test_subset([
- test_locbar_suggestion_retention(-1, undefined),
- test_locbar_suggestion_retention(1, -1),
- test_locbar_suggestion_retention(2, 1),
- test_locbar_suggestion_retention(0, 2),
- test_locbar_suggestion_retention(0, 0),
-
- // reset all preferences to their default values once we're done
- reset_preferences
- ]);
-}
diff --git a/browser/components/preferences/tests/browser_privacypane_8.js b/browser/components/preferences/tests/browser_privacypane_8.js
deleted file mode 100644
index bb21d6646..000000000
--- a/browser/components/preferences/tests/browser_privacypane_8.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let rootDir = getRootDirectory(gTestPath);
- let jar = getJar(rootDir);
- if (jar) {
- let tmpdir = extractJarToTmp(jar);
- rootDir = "file://" + tmpdir.path + '/';
- }
- loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
-
- run_test_subset([
- // history mode should be initialized to remember
- test_historymode_retention("remember", undefined),
-
- // history mode should remain remember; toggle acceptCookies checkbox
- test_custom_retention("acceptCookies", "remember"),
-
- // history mode should now be custom; set history mode to dontremember
- test_historymode_retention("dontremember", "custom"),
-
- // history mode should remain custom; set history mode to remember
- test_historymode_retention("remember", "custom"),
-
- // history mode should now be remember
- test_historymode_retention("remember", "remember"),
-
- // reset all preferences to their default values once we're done
- reset_preferences
- ]);
-}
diff --git a/browser/components/preferences/tests/head.js b/browser/components/preferences/tests/head.js
deleted file mode 100644
index b86de7c40..000000000
--- a/browser/components/preferences/tests/head.js
+++ /dev/null
@@ -1,57 +0,0 @@
-Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
-
-/**
- * Asynchronously adds visits to a page, invoking a callback function when done.
- *
- * @param aPlaceInfo
- * Can be an nsIURI, in such a case a single LINK visit will be added.
- * Otherwise can be an object describing the visit to add, or an array
- * of these objects:
- * { uri: nsIURI of the page,
- * transition: one of the TRANSITION_* from nsINavHistoryService,
- * [optional] title: title of the page,
- * [optional] visitDate: visit date in microseconds from the epoch
- * [optional] referrer: nsIURI of the referrer for this visit
- * }
- * @param [optional] aCallback
- * Function to be invoked on completion.
- */
-function addVisits(aPlaceInfo, aCallback) {
- let places = [];
- if (aPlaceInfo instanceof Ci.nsIURI) {
- places.push({ uri: aPlaceInfo });
- }
- else if (Array.isArray(aPlaceInfo)) {
- places = places.concat(aPlaceInfo);
- } else {
- places.push(aPlaceInfo)
- }
-
- // Create mozIVisitInfo for each entry.
- let now = Date.now();
- for (let i = 0; i < places.length; i++) {
- if (!places[i].title) {
- places[i].title = "test visit for " + places[i].uri.spec;
- }
- places[i].visits = [{
- transitionType: places[i].transition === undefined ? PlacesUtils.history.TRANSITION_LINK
- : places[i].transition,
- visitDate: places[i].visitDate || (now++) * 1000,
- referrerURI: places[i].referrer
- }];
- }
-
- PlacesUtils.asyncHistory.updatePlaces(
- places,
- {
- handleError: function AAV_handleError() {
- throw("Unexpected error in adding visit.");
- },
- handleResult: function () {},
- handleCompletion: function UP_handleCompletion() {
- if (aCallback)
- aCallback();
- }
- }
- );
-} \ No newline at end of file
diff --git a/browser/components/preferences/tests/moz.build b/browser/components/preferences/tests/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/preferences/tests/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/preferences/tests/privacypane_tests_perwindow.js b/browser/components/preferences/tests/privacypane_tests_perwindow.js
deleted file mode 100644
index eefa1d995..000000000
--- a/browser/components/preferences/tests/privacypane_tests_perwindow.js
+++ /dev/null
@@ -1,360 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function runTestOnPrivacyPrefPane(testFunc) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- Services.ww.unregisterNotification(this);
-
- let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
- win.addEventListener("load", function() {
- win.removeEventListener("load", arguments.callee, false);
- testFunc(dialog.document.defaultView);
-
- Services.ww.registerNotification(observer);
- dialog.close();
- }, false);
- } else if (aTopic == "domwindowclosed") {
- Services.ww.unregisterNotification(this);
- testRunner.runNext();
- }
- }
- };
- Services.ww.registerNotification(observer);
-
- let dialog = openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
- "chrome,titlebar,toolbar,centerscreen,dialog=no", "panePrivacy");
-}
-
-function controlChanged(element) {
- element.doCommand();
-}
-
-// We can only test the panes that don't trigger a preference update
-function test_pane_visibility(win) {
- let modes = {
- "remember": "historyRememberPane",
- "custom": "historyCustomPane"
- };
-
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
- let historypane = win.document.getElementById("historyPane");
- ok(historypane, "history mode pane should exist");
-
- for (let mode in modes) {
- historymode.value = mode;
- controlChanged(historymode);
- is(historypane.selectedPanel, win.document.getElementById(modes[mode]),
- "The correct pane should be selected for the " + mode + " mode");
- }
-}
-
-function test_dependent_elements(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
- let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
- ok(pbautostart, "the private browsing auto-start checkbox should exist");
- let controls = [
- win.document.getElementById("rememberHistory"),
- win.document.getElementById("rememberForms"),
- win.document.getElementById("keepUntil"),
- win.document.getElementById("keepCookiesUntil"),
- win.document.getElementById("alwaysClear"),
- ];
- controls.forEach(function(control) {
- ok(control, "the dependent controls should exist");
- });
- let independents = [
- win.document.getElementById("acceptCookies"),
- win.document.getElementById("acceptThirdPartyLabel"),
- win.document.getElementById("acceptThirdPartyMenu")
- ];
- independents.forEach(function(control) {
- ok(control, "the independent controls should exist");
- });
- let cookieexceptions = win.document.getElementById("cookieExceptions");
- ok(cookieexceptions, "the cookie exceptions button should exist");
- let keepuntil = win.document.getElementById("keepCookiesUntil");
- ok(keepuntil, "the keep cookies until menulist should exist");
- let alwaysclear = win.document.getElementById("alwaysClear");
- ok(alwaysclear, "the clear data on close checkbox should exist");
- let rememberhistory = win.document.getElementById("rememberHistory");
- ok(rememberhistory, "the remember history checkbox should exist");
- let rememberforms = win.document.getElementById("rememberForms");
- ok(rememberforms, "the remember forms checkbox should exist");
- let alwaysclearsettings = win.document.getElementById("clearDataSettings");
- ok(alwaysclearsettings, "the clear data settings button should exist");
-
- function expect_disabled(disabled) {
- controls.forEach(function(control) {
- is(control.disabled, disabled,
- control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
- });
- is(keepuntil.value, disabled ? 2 : 0,
- "the keep cookies until menulist value should be as expected");
- if (disabled) {
- ok(!alwaysclear.checked,
- "the clear data on close checkbox value should be as expected");
- ok(!rememberhistory.checked,
- "the remember history checkbox value should be as expected");
- ok(!rememberforms.checked,
- "the remember forms checkbox value should be as expected");
- }
- }
- function check_independents(expected) {
- independents.forEach(function(control) {
- is(control.disabled, expected,
- control.getAttribute("id") + " should " + (expected ? "" : "not ") + "be disabled");
- });
- ok(!cookieexceptions.disabled,
- "the cookie exceptions button should never be disabled");
- ok(alwaysclearsettings.disabled,
- "the clear data settings button should always be disabled");
- }
-
- // controls should only change in custom mode
- historymode.value = "remember";
- controlChanged(historymode);
- expect_disabled(false);
- check_independents(false);
-
- // setting the mode to custom shouldn't change anything
- historymode.value = "custom";
- controlChanged(historymode);
- expect_disabled(false);
- check_independents(false);
-}
-
-function test_dependent_cookie_elements(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
- let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
- ok(pbautostart, "the private browsing auto-start checkbox should exist");
- let controls = [
- win.document.getElementById("acceptThirdPartyLabel"),
- win.document.getElementById("acceptThirdPartyMenu"),
- win.document.getElementById("keepUntil"),
- win.document.getElementById("keepCookiesUntil"),
- ];
- controls.forEach(function(control) {
- ok(control, "the dependent cookie controls should exist");
- });
- let acceptcookies = win.document.getElementById("acceptCookies");
- ok(acceptcookies, "the accept cookies checkbox should exist");
-
- function expect_disabled(disabled) {
- controls.forEach(function(control) {
- is(control.disabled, disabled,
- control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
- });
- }
-
- historymode.value = "custom";
- controlChanged(historymode);
- pbautostart.checked = false;
- controlChanged(pbautostart);
- expect_disabled(false);
-
- acceptcookies.checked = false;
- controlChanged(acceptcookies);
- expect_disabled(true);
-
- acceptcookies.checked = true;
- controlChanged(acceptcookies);
- expect_disabled(false);
-
- let accessthirdparty = controls.shift();
- acceptcookies.checked = false;
- controlChanged(acceptcookies);
- expect_disabled(true);
- ok(accessthirdparty.disabled, "access third party button should be disabled");
-
- pbautostart.checked = false;
- controlChanged(pbautostart);
- expect_disabled(true);
- ok(accessthirdparty.disabled, "access third party button should be disabled");
-
- acceptcookies.checked = true;
- controlChanged(acceptcookies);
- expect_disabled(false);
- ok(!accessthirdparty.disabled, "access third party button should be enabled");
-}
-
-function test_dependent_clearonclose_elements(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
- let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
- ok(pbautostart, "the private browsing auto-start checkbox should exist");
- let alwaysclear = win.document.getElementById("alwaysClear");
- ok(alwaysclear, "the clear data on close checkbox should exist");
- let alwaysclearsettings = win.document.getElementById("clearDataSettings");
- ok(alwaysclearsettings, "the clear data settings button should exist");
-
- function expect_disabled(disabled) {
- is(alwaysclearsettings.disabled, disabled,
- "the clear data settings should " + (disabled ? "" : "not ") + "be disabled");
- }
-
- historymode.value = "custom";
- controlChanged(historymode);
- pbautostart.checked = false;
- controlChanged(pbautostart);
- alwaysclear.checked = false;
- controlChanged(alwaysclear);
- expect_disabled(true);
-
- alwaysclear.checked = true;
- controlChanged(alwaysclear);
- expect_disabled(false);
-
- alwaysclear.checked = false;
- controlChanged(alwaysclear);
- expect_disabled(true);
-}
-
-function test_dependent_prefs(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
- let controls = [
- win.document.getElementById("rememberHistory"),
- win.document.getElementById("rememberForms"),
- win.document.getElementById("acceptCookies"),
- ];
- controls.forEach(function(control) {
- ok(control, "the micro-management controls should exist");
- });
-
- let thirdPartyCookieMenu = win.document.getElementById("acceptThirdPartyMenu");
- ok(thirdPartyCookieMenu, "the third-party cookie control should exist");
-
- function expect_checked(checked) {
- controls.forEach(function(control) {
- is(control.checked, checked,
- control.getAttribute("id") + " should " + (checked ? "not " : "") + "be checked");
- });
-
- is(thirdPartyCookieMenu.value == "always" || thirdPartyCookieMenu.value == "visited", checked, "third-party cookies should " + (checked ? "not " : "") + "be limited");
- }
-
- // controls should be checked in remember mode
- historymode.value = "remember";
- controlChanged(historymode);
- expect_checked(true);
-
- // even if they're unchecked in custom mode
- historymode.value = "custom";
- controlChanged(historymode);
- thirdPartyCookieMenu.value = "never";
- controlChanged(thirdPartyCookieMenu);
- controls.forEach(function(control) {
- control.checked = false;
- controlChanged(control);
- });
- expect_checked(false);
- historymode.value = "remember";
- controlChanged(historymode);
- expect_checked(true);
-}
-
-function test_historymode_retention(mode, expect) {
- return function(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
-
- if ((historymode.value == "remember" && mode == "dontremember") ||
- (historymode.value == "dontremember" && mode == "remember") ||
- (historymode.value == "custom" && mode == "dontremember")) {
- return;
- }
-
- if (expect !== undefined) {
- is(historymode.value, expect,
- "history mode is expected to remain " + expect);
- }
-
- historymode.value = mode;
- controlChanged(historymode);
- };
-}
-
-function test_custom_retention(controlToChange, expect, valueIncrement) {
- return function(win) {
- let historymode = win.document.getElementById("historyMode");
- ok(historymode, "history mode menulist should exist");
-
- if (expect !== undefined) {
- is(historymode.value, expect,
- "history mode is expected to remain " + expect);
- }
-
- historymode.value = "custom";
- controlChanged(historymode);
-
- controlToChange = win.document.getElementById(controlToChange);
- ok(controlToChange, "the control to change should exist");
- switch (controlToChange.localName) {
- case "checkbox":
- controlToChange.checked = !controlToChange.checked;
- break;
- case "textbox":
- controlToChange.value = parseInt(controlToChange.value) + valueIncrement;
- break;
- case "menulist":
- controlToChange.value = valueIncrement;
- break;
- }
- controlChanged(controlToChange);
- };
-}
-
-function test_locbar_suggestion_retention(mode, expect) {
- return function(win) {
- let locbarsuggest = win.document.getElementById("locationBarSuggestion");
- ok(locbarsuggest, "location bar suggestion menulist should exist");
-
- if (expect !== undefined) {
- is(locbarsuggest.value, expect,
- "location bar suggestion is expected to remain " + expect);
- }
-
- locbarsuggest.value = mode;
- controlChanged(locbarsuggest);
- };
-}
-
-function reset_preferences(win) {
- let prefs = win.document.getElementsByTagName("preference");
- for (let i = 0; i < prefs.length; ++i)
- if (prefs[i].hasUserValue)
- prefs[i].reset();
-}
-
-let testRunner;
-function run_test_subset(subset) {
- let instantApplyOrig = Services.prefs.getBoolPref("browser.preferences.instantApply");
- Services.prefs.setBoolPref("browser.preferences.instantApply", true);
-
- waitForExplicitFinish();
-
- testRunner = {
- tests: subset,
- counter: 0,
- runNext: function() {
- if (this.counter == this.tests.length) {
- // cleanup
- Services.prefs.setBoolPref("browser.preferences.instantApply", instantApplyOrig);
- finish();
- } else {
- let self = this;
- setTimeout(function() {
- runTestOnPrivacyPrefPane(self.tests[self.counter++]);
- }, 0);
- }
- }
- };
-
- testRunner.runNext();
-}
diff --git a/browser/components/privatebrowsing/moz.build b/browser/components/privatebrowsing/moz.build
index 443915d0d..b90585f09 100644
--- a/browser/components/privatebrowsing/moz.build
+++ b/browser/components/privatebrowsing/moz.build
@@ -4,7 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
-
MODULE = 'privatebrowsing'
diff --git a/browser/components/privatebrowsing/test/browser/Makefile.in b/browser/components/privatebrowsing/test/browser/Makefile.in
deleted file mode 100644
index f15d6056b..000000000
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ /dev/null
@@ -1,58 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js \
- browser_privatebrowsing_aboutSessionRestore.js \
- browser_privatebrowsing_certexceptionsui.js \
- browser_privatebrowsing_concurrent.js \
- browser_privatebrowsing_concurrent_page.html \
- browser_privatebrowsing_cookieacceptdialog.js \
- browser_privatebrowsing_cookieacceptdialog.html \
- browser_privatebrowsing_crh.js \
- browser_privatebrowsing_downloadLastDir.js \
- browser_privatebrowsing_downloadLastDir_c.js \
- browser_privatebrowsing_downloadLastDir_toggle.js \
- browser_privatebrowsing_DownloadLastDirWithCPS.js \
- browser_privatebrowsing_geoprompt.js \
- browser_privatebrowsing_geoprompt_page.html \
- browser_privatebrowsing_lastpbcontextexited.js \
- browser_privatebrowsing_localStorage.js \
- browser_privatebrowsing_localStorage_before_after.js \
- browser_privatebrowsing_localStorage_before_after_page.html \
- browser_privatebrowsing_localStorage_before_after_page2.html \
- browser_privatebrowsing_localStorage_page1.html \
- browser_privatebrowsing_localStorage_page2.html \
- browser_privatebrowsing_nonbrowser.js \
- browser_privatebrowsing_noSessionRestoreMenuOption.js \
- browser_privatebrowsing_opendir.js \
- browser_privatebrowsing_openlocation.js \
- browser_privatebrowsing_openLocationLastURL.js \
- browser_privatebrowsing_placestitle.js \
- browser_privatebrowsing_placesTitleNoUpdate.js \
- browser_privatebrowsing_placesTitleNoUpdate.html \
- browser_privatebrowsing_popupblocker.js \
- browser_privatebrowsing_protocolhandler.js \
- browser_privatebrowsing_protocolhandler_page.html \
- browser_privatebrowsing_theming.js \
- browser_privatebrowsing_ui.js \
- browser_privatebrowsing_urlbarfocus.js \
- browser_privatebrowsing_windowtitle.js \
- browser_privatebrowsing_windowtitle_page.html \
- browser_privatebrowsing_zoom.js \
- browser_privatebrowsing_zoomrestore.js \
- popup.html \
- title.sjs \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_DownloadLastDirWithCPS.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_DownloadLastDirWithCPS.js
deleted file mode 100644
index 29c95e179..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_DownloadLastDirWithCPS.js
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let gTests;
-function test() {
- waitForExplicitFinish();
- requestLongerTimeout(2);
- gTests = runTest();
- gTests.next();
-}
-
-/*
- * ================
- * Helper functions
- * ================
- */
-
-function moveAlong(aResult) {
- try {
- gTests.send(aResult);
- } catch (x if x instanceof StopIteration) {
- finish();
- }
-}
-
-function createWindow(aOptions) {
- whenNewWindowLoaded(aOptions, function(win) {
- moveAlong(win);
- });
-}
-
-function getFile(downloadLastDir, aURI) {
- downloadLastDir.getFileAsync(aURI, function(result) {
- moveAlong(result);
- });
-}
-
-function setFile(downloadLastDir, aURI, aValue) {
- downloadLastDir.setFile(aURI, aValue);
- executeSoon(moveAlong);
-}
-
-function clearHistoryAndWait() {
- clearHistory();
- executeSoon(function() executeSoon(moveAlong));
-}
-
-/*
- * ===================
- * Function with tests
- * ===================
- */
-
-function runTest() {
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let DownloadLastDir =
- Cu.import("resource://gre/modules/DownloadLastDir.jsm", {}).DownloadLastDir;
-
- let tmpDir = FileUtils.getDir("TmpD", [], true);
- let dir1 = newDirectory();
- let dir2 = newDirectory();
- let dir3 = newDirectory();
-
- let uri1 = Services.io.newURI("http://test1.com/", null, null);
- let uri2 = Services.io.newURI("http://test2.com/", null, null);
- let uri3 = Services.io.newURI("http://test3.com/", null, null);
- let uri4 = Services.io.newURI("http://test4.com/", null, null);
-
- // cleanup functions registration
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.download.lastDir.savePerSite");
- Services.prefs.clearUserPref("browser.download.lastDir");
- [dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
- win.close();
- pbWin.close();
- });
-
- function checkDownloadLastDir(gDownloadLastDir, aLastDir) {
- is(gDownloadLastDir.file.path, aLastDir.path,
- "gDownloadLastDir should point to the expected last directory");
- getFile(gDownloadLastDir, uri1);
- }
-
- function checkDownloadLastDirNull(gDownloadLastDir) {
- is(gDownloadLastDir.file, null, "gDownloadLastDir should be null");
- getFile(gDownloadLastDir, uri1);
- }
-
- /*
- * ================================
- * Create a regular and a PB window
- * ================================
- */
-
- let win = yield createWindow({private: false});
- let pbWin = yield createWindow({private: true});
-
- let downloadLastDir = new DownloadLastDir(win);
- let pbDownloadLastDir = new DownloadLastDir(pbWin);
-
- /*
- * ==================
- * Beginning of tests
- * ==================
- */
-
- is(typeof downloadLastDir, "object",
- "downloadLastDir should be a valid object");
- is(downloadLastDir.file, null,
- "LastDir pref should be null to start with");
-
- // set up last dir
- yield setFile(downloadLastDir, null, tmpDir);
- is(downloadLastDir.file.path, tmpDir.path,
- "LastDir should point to the tmpDir");
- isnot(downloadLastDir.file, tmpDir,
- "downloadLastDir.file should not be pointing to tmpDir");
-
- // set uri1 to dir1, all should now return dir1
- // also check that a new object is returned
- yield setFile(downloadLastDir, uri1, dir1);
- is(downloadLastDir.file.path, dir1.path,
- "downloadLastDir should return dir1");
- isnot(downloadLastDir.file, dir1,
- "downloadLastDir.file should not return dir1");
- is((yield getFile(downloadLastDir, uri1)).path, dir1.path,
- "uri1 should return dir1"); // set in CPS
- isnot((yield getFile(downloadLastDir, uri1)), dir1,
- "getFile on uri1 should not return dir1");
- is((yield getFile(downloadLastDir, uri2)).path, dir1.path,
- "uri2 should return dir1"); // fallback
- isnot((yield getFile(downloadLastDir, uri2)), dir1,
- "getFile on uri2 should not return dir1");
- is((yield getFile(downloadLastDir, uri3)).path, dir1.path,
- "uri3 should return dir1"); // fallback
- isnot((yield getFile(downloadLastDir, uri3)), dir1,
- "getFile on uri3 should not return dir1");
- is((yield getFile(downloadLastDir, uri4)).path, dir1.path,
- "uri4 should return dir1"); // fallback
- isnot((yield getFile(downloadLastDir, uri4)), dir1,
- "getFile on uri4 should not return dir1");
-
- // set uri2 to dir2, all except uri1 should now return dir2
- yield setFile(downloadLastDir, uri2, dir2);
- is(downloadLastDir.file.path, dir2.path,
- "downloadLastDir should point to dir2");
- is((yield getFile(downloadLastDir, uri1)).path, dir1.path,
- "uri1 should return dir1"); // set in CPS
- is((yield getFile(downloadLastDir, uri2)).path, dir2.path,
- "uri2 should return dir2"); // set in CPS
- is((yield getFile(downloadLastDir, uri3)).path, dir2.path,
- "uri3 should return dir2"); // fallback
- is((yield getFile(downloadLastDir, uri4)).path, dir2.path,
- "uri4 should return dir2"); // fallback
-
- // set uri3 to dir3, all except uri1 and uri2 should now return dir3
- yield setFile(downloadLastDir, uri3, dir3);
- is(downloadLastDir.file.path, dir3.path,
- "downloadLastDir should point to dir3");
- is((yield getFile(downloadLastDir, uri1)).path, dir1.path,
- "uri1 should return dir1"); // set in CPS
- is((yield getFile(downloadLastDir, uri2)).path, dir2.path,
- "uri2 should return dir2"); // set in CPS
- is((yield getFile(downloadLastDir, uri3)).path, dir3.path,
- "uri3 should return dir3"); // set in CPS
- is((yield getFile(downloadLastDir, uri4)).path, dir3.path,
- "uri4 should return dir4"); // fallback
-
- // set uri1 to dir2, all except uri3 should now return dir2
- yield setFile(downloadLastDir, uri1, dir2);
- is(downloadLastDir.file.path, dir2.path,
- "downloadLastDir should point to dir2");
- is((yield getFile(downloadLastDir, uri1)).path, dir2.path,
- "uri1 should return dir2"); // set in CPS
- is((yield getFile(downloadLastDir, uri2)).path, dir2.path,
- "uri2 should return dir2"); // set in CPS
- is((yield getFile(downloadLastDir, uri3)).path, dir3.path,
- "uri3 should return dir3"); // set in CPS
- is((yield getFile(downloadLastDir, uri4)).path, dir2.path,
- "uri4 should return dir2"); // fallback
-
- yield clearHistoryAndWait();
-
- // check clearHistory removes all data
- is(downloadLastDir.file, null, "clearHistory removes all data");
- //is(Services.contentPrefs.hasPref(uri1, "browser.download.lastDir", null),
- // false, "LastDir preference should be absent");
- is((yield getFile(downloadLastDir, uri1)), null, "uri1 should point to null");
- is((yield getFile(downloadLastDir, uri2)), null, "uri2 should point to null");
- is((yield getFile(downloadLastDir, uri3)), null, "uri3 should point to null");
- is((yield getFile(downloadLastDir, uri4)), null, "uri4 should point to null");
-
- yield setFile(downloadLastDir, null, tmpDir);
-
- // check data set outside PB mode is remembered
- is((yield checkDownloadLastDir(pbDownloadLastDir, tmpDir)).path, tmpDir.path, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDir(downloadLastDir, tmpDir)).path, tmpDir.path, "uri1 should return the expected last directory");
- yield clearHistoryAndWait();
-
- yield setFile(downloadLastDir, uri1, dir1);
-
- // check data set using CPS outside PB mode is remembered
- is((yield checkDownloadLastDir(pbDownloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDir(downloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");
- yield clearHistoryAndWait();
-
- // check data set inside PB mode is forgotten
- yield setFile(pbDownloadLastDir, null, tmpDir);
-
- is((yield checkDownloadLastDir(pbDownloadLastDir, tmpDir)).path, tmpDir.path, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDirNull(downloadLastDir)), null, "uri1 should return the expected last directory");
-
- yield clearHistoryAndWait();
-
- // check data set using CPS inside PB mode is forgotten
- yield setFile(pbDownloadLastDir, uri1, dir1);
-
- is((yield checkDownloadLastDir(pbDownloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDirNull(downloadLastDir)), null, "uri1 should return the expected last directory");
-
- // check data set outside PB mode but changed inside is remembered correctly
- yield setFile(downloadLastDir, uri1, dir1);
- yield setFile(pbDownloadLastDir, uri1, dir2);
- is((yield checkDownloadLastDir(pbDownloadLastDir, dir2)).path, dir2.path, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDir(downloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");
-
- /*
- * ====================
- * Create new PB window
- * ====================
- */
-
- // check that the last dir store got cleared in a new PB window
- pbWin.close();
- let pbWin = yield createWindow({private: true});
- let pbDownloadLastDir = new DownloadLastDir(pbWin);
-
- is((yield checkDownloadLastDir(pbDownloadLastDir, dir1)).path, dir1.path, "uri1 should return the expected last directory");
-
- yield clearHistoryAndWait();
-
- // check clearHistory inside PB mode clears data outside PB mode
- yield setFile(pbDownloadLastDir, uri1, dir2);
-
- yield clearHistoryAndWait();
-
- is((yield checkDownloadLastDirNull(downloadLastDir)), null, "uri1 should return the expected last directory");
- is((yield checkDownloadLastDirNull(pbDownloadLastDir)), null, "uri1 should return the expected last directory");
-
- // check that disabling CPS works
- Services.prefs.setBoolPref("browser.download.lastDir.savePerSite", false);
-
- yield setFile(downloadLastDir, uri1, dir1);
- is(downloadLastDir.file.path, dir1.path, "LastDir should be set to dir1");
- is((yield getFile(downloadLastDir, uri1)).path, dir1.path, "uri1 should return dir1");
- is((yield getFile(downloadLastDir, uri2)).path, dir1.path, "uri2 should return dir1");
- is((yield getFile(downloadLastDir, uri3)).path, dir1.path, "uri3 should return dir1");
- is((yield getFile(downloadLastDir, uri4)).path, dir1.path, "uri4 should return dir1");
-
- downloadLastDir.setFile(uri2, dir2);
- is(downloadLastDir.file.path, dir2.path, "LastDir should be set to dir2");
- is((yield getFile(downloadLastDir, uri1)).path, dir2.path, "uri1 should return dir2");
- is((yield getFile(downloadLastDir, uri2)).path, dir2.path, "uri2 should return dir2");
- is((yield getFile(downloadLastDir, uri3)).path, dir2.path, "uri3 should return dir2");
- is((yield getFile(downloadLastDir, uri4)).path, dir2.path, "uri4 should return dir2");
-
- Services.prefs.clearUserPref("browser.download.lastDir.savePerSite");
-
- // check that passing null to setFile clears the stored value
- yield setFile(downloadLastDir, uri3, dir3);
- is((yield getFile(downloadLastDir, uri3)).path, dir3.path, "LastDir should be set to dir3");
- yield setFile(downloadLastDir, uri3, null);
- is((yield getFile(downloadLastDir, uri3)), null, "uri3 should return null");
-
- yield clearHistoryAndWait();
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js
deleted file mode 100644
index dc61c1e00..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutHomeButtonAfterWindowClose.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test checks that the Session Restore about:home button
-// is disabled in private mode
-
-function test() {
- waitForExplicitFinish();
-
- function testNoSessionRestoreButton() {
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- executeSoon(function() {
- info("The second private window got loaded");
- let newTab = win.gBrowser.addTab();
- win.gBrowser.selectedTab = newTab;
- let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
- tabBrowser.addEventListener("load", function tabLoadListener() {
- if (win.content.location != "about:home") {
- win.content.location = "about:home";
- return;
- }
- tabBrowser.removeEventListener("load", tabLoadListener, true);
- executeSoon(function() {
- info("about:home got loaded");
- let sessionRestoreButton = win.gBrowser
- .contentDocument
- .getElementById("restorePreviousSession");
- is(win.getComputedStyle(sessionRestoreButton).display,
- "none", "The Session Restore about:home button should be disabled");
- win.close();
- finish();
- });
- }, true);
- });
- }, false);
- }
-
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onload() {
- win.removeEventListener("load", onload, false);
- executeSoon(function() {
- info("The first private window got loaded");
- win.close();
- testNoSessionRestoreButton();
- });
- }, false);
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js
deleted file mode 100644
index 610304fc1..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_aboutSessionRestore.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test checks that the session restore button from about:sessionrestore
-// is disabled in private mode
-
-function test() {
- waitForExplicitFinish();
-
- function testNoSessionRestoreButton() {
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- executeSoon(function() {
- info("The second private window got loaded");
- let newTab = win.gBrowser.addTab("about:sessionrestore");
- win.gBrowser.selectedTab = newTab;
- let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
- tabBrowser.addEventListener("load", function tabLoadListener() {
- if (win.gBrowser.contentWindow.location != "about:sessionrestore") {
- win.gBrowser.selectedBrowser.loadURI("about:sessionrestore");
- return;
- }
- tabBrowser.removeEventListener("load", tabLoadListener, true);
- executeSoon(function() {
- info("about:sessionrestore got loaded");
- let restoreButton = win.gBrowser.contentDocument
- .getElementById("errorTryAgain");
- ok(restoreButton.disabled,
- "The Restore about:sessionrestore button should be disabled");
- win.close();
- finish();
- });
- }, true);
- });
- }, false);
- }
-
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onload() {
- win.removeEventListener("load", onload, false);
- executeSoon(function() {
- info("The first private window got loaded");
- win.close();
- testNoSessionRestoreButton();
- });
- }, false);
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
deleted file mode 100644
index 519f43475..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that certificate exceptions UI behaves correctly
-// in private browsing windows, based on whether it's opened from the prefs
-// window or from the SSL error page (see bug 461627).
-
-function test() {
- const EXCEPTIONS_DLG_URL = 'chrome://pippki/content/exceptionDialog.xul';
- const EXCEPTIONS_DLG_FEATURES = 'chrome,centerscreen';
- const INVALID_CERT_LOCATION = 'https://nocert.example.com/';
- waitForExplicitFinish();
-
- // open a private browsing window
- var pbWin = OpenBrowserWindow({private: true});
- pbWin.addEventListener("load", function onLoad() {
- pbWin.removeEventListener("load", onLoad, false);
- doTest();
- }, false);
-
- // Test the certificate exceptions dialog
- function doTest() {
- let params = {
- exceptionAdded : false,
- location: INVALID_CERT_LOCATION,
- prefetchCert: true,
- };
- function testCheckbox() {
- win.removeEventListener("load", testCheckbox, false);
- Services.obs.addObserver(function onCertUI(aSubject, aTopic, aData) {
- Services.obs.removeObserver(onCertUI, "cert-exception-ui-ready");
- ok(win.gCert, "The certificate information should be available now");
-
- let checkbox = win.document.getElementById("permanent");
- ok(checkbox.hasAttribute("disabled"),
- "the permanent checkbox should be disabled when handling the private browsing mode");
- ok(!checkbox.hasAttribute("checked"),
- "the permanent checkbox should not be checked when handling the private browsing mode");
- win.close();
- cleanup();
- }, "cert-exception-ui-ready", false);
- }
- var win = pbWin.openDialog(EXCEPTIONS_DLG_URL, "", EXCEPTIONS_DLG_FEATURES, params);
- win.addEventListener("load", testCheckbox, false);
- }
-
- function cleanup() {
- // close the private browsing window
- pbWin.close();
- finish();
- }
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
deleted file mode 100644
index c06c7c05a..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Test opening two tabs that share a localStorage, but keep one in private mode.
-// Ensure that values from one don't leak into the other, and that values from
-// earlier private storage sessions aren't visible later.
-
-// Step 1: create new tab, load a page that sets test=value in non-private storage
-// Step 2: create a new tab, load a page that sets test2=value2 in private storage
-// Step 3: load a page in the tab from step 1 that checks the value of test2 is value2 and the total count in non-private storage is 1
-// Step 4: load a page in the tab from step 2 that checks the value of test is value and the total count in private storage is 1
-
-function test() {
- let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html';
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- let non_private_tab = gBrowser.selectedBrowser;
- non_private_tab.addEventListener('load', function() {
- non_private_tab.removeEventListener('load', arguments.callee, true);
- gBrowser.selectedTab = gBrowser.addTab();
- let private_tab = gBrowser.selectedBrowser;
- private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
- private_tab.addEventListener('load', function() {
- private_tab.removeEventListener('load', arguments.callee, true);
-
- non_private_tab.addEventListener('load', function() {
- non_private_tab.removeEventListener('load', arguments.callee, true);
- var elts = non_private_tab.contentWindow.document.title.split('|');
- isnot(elts[0], 'value2', "public window shouldn't see private storage");
- is(elts[1], '1', "public window should only see public items");
-
- private_tab.addEventListener('load', function() {
- private_tab.removeEventListener('load', arguments.callee, true);
- var elts = private_tab.contentWindow.document.title.split('|');
- isnot(elts[0], 'value', "private window shouldn't see public storage");
- is(elts[1], '1', "private window should only see private items");
- private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = false;
-
- Components.utils.schedulePreciseGC(function() {
- private_tab.addEventListener('load', function() {
- private_tab.removeEventListener('load', arguments.callee, true);
- var elts = private_tab.contentWindow.document.title.split('|');
- isnot(elts[0], 'value2', "public window shouldn't see cleared private storage");
- is(elts[1], '1', "public window should only see public items");
-
- private_tab.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
- private_tab.addEventListener('load', function() {
- private_tab.removeEventListener('load', arguments.callee, true);
- var elts = private_tab.contentWindow.document.title.split('|');
- is(elts[1], '1', "private window should only see new private items");
-
- non_private_tab.addEventListener('load', function() {
- gBrowser.removeCurrentTab();
- gBrowser.removeCurrentTab();
- finish();
- }, true);
- non_private_tab.loadURI(prefix + '?final=true');
-
- }, true);
- private_tab.loadURI(prefix + '?action=set&name=test3&value=value3');
- }, true);
- private_tab.loadURI(prefix + '?action=get&name=test2');
- });
- }, true);
- private_tab.loadURI(prefix + '?action=get&name=test');
- }, true);
- non_private_tab.loadURI(prefix + '?action=get&name=test2');
- }, true);
- private_tab.loadURI(prefix + '?action=set&name=test2&value=value2');
- }, true);
- non_private_tab.loadURI(prefix + '?action=set&name=test&value=value&initial=true');
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
deleted file mode 100644
index db35b114d..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_concurrent_page.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
- var oGetVars = {};
-
- if (window.location.search.length > 1) {
- for (var aItKey, nKeyId = 0, aCouples = window.location.search.substr(1).split("&");
- nKeyId < aCouples.length;
- nKeyId++) {
- aItKey = aCouples[nKeyId].split("=");
- oGetVars[unescape(aItKey[0])] = aItKey.length > 1 ? unescape(aItKey[1]) : "";
- }
- }
-
- if (oGetVars.initial == 'true') {
- localStorage.clear();
- }
-
- if (oGetVars.action == 'set') {
- localStorage.setItem(oGetVars.name, oGetVars.value);
- document.title = localStorage.getItem(oGetVars.name) + "|" + localStorage.length;
- } else if (oGetVars.action == 'get') {
- document.title = localStorage.getItem(oGetVars.name) + "|" + localStorage.length;
- }
-
- if (oGetVars.final == 'true') {
- localStorage.clear();
- }
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.html
deleted file mode 100644
index 80ac1bd64..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>browser_privatebrowsing_cookieacceptdialog.html</title>
- <script type="application/javascript">
- document.cookie = "foo=bar";
- </script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
deleted file mode 100644
index a21aa7c31..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js
+++ /dev/null
@@ -1,161 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that private browsing mode disables the "remember"
-// option in the cookie accept dialog.
-
-function test() {
- // initialization
- const TEST_URL = "http://mochi.test:8888/browser/browser/components/" +
- "privatebrowsing/test/browser/" +
- "browser_privatebrowsing_cookieacceptdialog.html";
- const BLANK_URL = "http://mochi.test:8888/";
- let cp = Cc["@mozilla.org/embedcomp/cookieprompt-service;1"].
- getService(Ci.nsICookiePromptService);
-
- waitForExplicitFinish();
-
- function checkRememberOption(expectedDisabled, aWindow, callback) {
- function observer(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
-
- Services.ww.unregisterNotification(observer);
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function onLoad(event) {
- win.removeEventListener("load", onLoad, false);
-
- executeSoon(function () {
- let doc = win.document;
- let remember = doc.getElementById("persistDomainAcceptance");
- ok(remember, "The remember checkbox should exist");
-
- if (expectedDisabled)
- is(remember.getAttribute("disabled"), "true",
- "The checkbox should be disabled");
- else
- ok(!remember.hasAttribute("disabled"),
- "The checkbox should not be disabled");
-
- waitForWindowClose(win, callback);
- });
- }, false);
- }
- Services.ww.registerNotification(observer);
-
- let remember = {};
- const time = (new Date("Jan 1, 2030")).getTime() / 1000;
- let cookie = {
- name: "foo",
- value: "bar",
- isDomain: true,
- host: "mozilla.org",
- path: "/baz",
- isSecure: false,
- expires: time,
- status: 0,
- policy: 0,
- isSession: false,
- expiry: time,
- isHttpOnly: true,
- QueryInterface: function(iid) {
- const validIIDs = [Ci.nsISupports, Ci.nsICookie, Ci.nsICookie2];
- for (var i = 0; i < validIIDs.length; ++i)
- if (iid == validIIDs[i])
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- };
- cp.cookieDialog(aWindow, cookie, "mozilla.org", 10, false, remember);
- }
-
- function checkSettingDialog(aIsPrivateWindow, aWindow, aCallback) {
- let selectedBrowser = aWindow.gBrowser.selectedBrowser;
-
- function onLoad() {
- if (aWindow.content.location.href != TEST_URL) {
- selectedBrowser.loadURI(TEST_URL);
- return;
- }
- selectedBrowser.removeEventListener("load", onLoad, true);
- Services.ww.unregisterNotification(observer);
-
- ok(aIsPrivateWindow,
- "Confirm setting dialog is not displayed for private window");
-
- executeSoon(aCallback);
- }
- selectedBrowser.addEventListener("load", onLoad, true);
-
- function observer(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened")
- return;
- selectedBrowser.removeEventListener("load", onLoad, true);
- Services.ww.unregisterNotification(observer);
- ok(!aIsPrivateWindow,
- "Confirm setting dialog is displayed for normal window");
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- executeSoon(function () {
- info("Wait for window close");
- waitForWindowClose(win, aCallback);
- });
- }
- Services.ww.registerNotification(observer);
-
- selectedBrowser.loadURI(TEST_URL);
- }
-
- let windowsToClose = [];
- function testOnWindow(aIsPrivate, aCallback) {
- whenNewWindowLoaded({private: aIsPrivate}, function(aWin) {
- windowsToClose.push(aWin);
- let selectedBrowser = aWin.gBrowser.selectedBrowser;
- selectedBrowser.addEventListener("load", function onLoad() {
- if (aWin.content.location.href != BLANK_URL) {
- selectedBrowser.loadURI(BLANK_URL);
- return;
- }
- selectedBrowser.removeEventListener("load", onLoad, true);
- executeSoon(function() aCallback(aWin));
- }, true);
- selectedBrowser.loadURI(BLANK_URL);
- });
- }
-
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- // Ask all cookies
- Services.prefs.setIntPref("network.cookie.lifetimePolicy", 1);
-
- testOnWindow(false, function(aWin) {
- info("Test on public window");
- checkRememberOption(false, aWin, function() {
- checkSettingDialog(false, aWin, function() {
- testOnWindow(true, function(aPrivWin) {
- info("Test on private window");
- checkRememberOption(true, aPrivWin, function() {
- checkSettingDialog(true, aPrivWin, finish);
- });
- });
- });
- });
- });
-}
-
-function waitForWindowClose(aWin, aCallback) {
- function observer(aSubject, aTopic, aData) {
- if (aTopic == "domwindowclosed") {
- info("Window closed");
- Services.ww.unregisterNotification(observer);
- executeSoon(aCallback);
- }
- }
- Services.ww.registerNotification(observer);
- aWin.close();
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
deleted file mode 100644
index 14f62448b..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_crh.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the Clear Recent History menu item and command
-// is disabled inside the private browsing mode.
-
-function test() {
- waitForExplicitFinish();
-
- function checkDisableOption(aPrivateMode, aWindow, aCallback) {
- executeSoon(function() {
- let crhCommand = aWindow.document.getElementById("Tools:Sanitize");
- ok(crhCommand, "The clear recent history command should exist");
-
- is(PrivateBrowsingUtils.isWindowPrivate(aWindow), aPrivateMode,
- "PrivateBrowsingUtils should report the correct per-window private browsing status");
- is(crhCommand.hasAttribute("disabled"), aPrivateMode,
- "Clear Recent History command should be disabled according to the private browsing mode");
-
- executeSoon(aCallback);
- });
- };
-
- let windowsToClose = [];
- let testURI = "http://mochi.test:8888/";
-
- function testOnWindow(aIsPrivate, aCallback) {
- whenNewWindowLoaded({private: aIsPrivate}, function(aWin) {
- windowsToClose.push(aWin);
- aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- if (aWin.content.location.href != testURI) {
- aWin.gBrowser.loadURI(testURI);
- return;
- }
- aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- executeSoon(function() aCallback(aWin));
- }, true);
-
- aWin.gBrowser.loadURI(testURI);
- });
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- testOnWindow(true, function(aWin) {
- info("Test on private window");
- checkDisableOption(true, aWin, function() {
- testOnWindow(false, function(aPrivWin) {
- info("Test on public window");
- checkDisableOption(false, aPrivWin, finish);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
deleted file mode 100644
index 0012442bd..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let DownloadLastDir =
- Cu.import("resource://gre/modules/DownloadLastDir.jsm", {}).DownloadLastDir;
- let MockFilePicker = SpecialPowers.MockFilePicker;
- let launcher = {
- source: Services.io.newURI("http://test1.com/file", null, null)
- };
-
- MockFilePicker.init(window);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- let prefs = Services.prefs.getBranch("browser.download.");
- let launcherDialog =
- Cc["@mozilla.org/helperapplauncherdialog;1"].
- getService(Ci.nsIHelperAppLauncherDialog);
- let tmpDir = FileUtils.getDir("TmpD", [], true);
- let dir1 = newDirectory();
- let dir2 = newDirectory();
- let dir3 = newDirectory();
- let file1 = newFileInDirectory(dir1);
- let file2 = newFileInDirectory(dir2);
- let file3 = newFileInDirectory(dir3);
-
- // cleanup functions registration
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.download.lastDir");
- [dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
- MockFilePicker.cleanup();
- });
- prefs.setComplexValue("lastDir", Ci.nsIFile, tmpDir);
-
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({private: aPrivate}, function(win) {
- let gDownloadLastDir = new DownloadLastDir(win);
- aCallback(win, gDownloadLastDir);
- gDownloadLastDir.cleanupPrivateFile();
- });
- }
-
- function testDownloadDir(aWin, gDownloadLastDir, aFile, aDisplayDir, aLastDir,
- aGlobalLastDir, aCallback) {
- let context = aWin.gBrowser.selectedBrowser.contentWindow;
-
- // Check lastDir preference.
- is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aDisplayDir.path,
- "LastDir should be the expected display dir");
- // Check gDownloadLastDir value.
- is(gDownloadLastDir.file.path, aDisplayDir.path,
- "gDownloadLastDir should be the expected display dir");
-
- MockFilePicker.returnFiles = [aFile];
- MockFilePicker.displayDirectory = null;
-
- launcher.saveDestinationAvailable = function (file) {
- ok(!!file, "promptForSaveToFile correctly returned a file");
-
- // File picker should start with expected display dir.
- is(MockFilePicker.displayDirectory.path, aDisplayDir.path,
- "File picker should start with browser.download.lastDir");
- // browser.download.lastDir should be modified on not private windows
- is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aLastDir.path,
- "LastDir should be the expected last dir");
- // gDownloadLastDir should be usable outside of private windows
- is(gDownloadLastDir.file.path, aGlobalLastDir.path,
- "gDownloadLastDir should be the expected global last dir");
-
- launcher.saveDestinationAvailable = null;
- aWin.close();
- aCallback();
- };
-
- launcherDialog.promptForSaveToFileAsync(launcher, context, null, null, null);
- }
-
- testOnWindow(false, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file1, tmpDir, dir1, dir1, function() {
- testOnWindow(true, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file2, dir1, dir1, dir2, function() {
- testOnWindow(false, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file3, dir1, dir3, dir3, finish);
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js
deleted file mode 100644
index 1444d3d93..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_c.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let DownloadLastDir =
- Cu.import("resource://gre/modules/DownloadLastDir.jsm", {}).DownloadLastDir;
- let MockFilePicker = SpecialPowers.MockFilePicker;
-
- MockFilePicker.init(window);
- MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
-
- let validateFileNameToRestore = validateFileName;
- let prefs = Services.prefs.getBranch("browser.download.");
- let tmpDir = FileUtils.getDir("TmpD", [], true);
- let dir1 = newDirectory();
- let dir2 = newDirectory();
- let dir3 = newDirectory();
- let file1 = newFileInDirectory(dir1);
- let file2 = newFileInDirectory(dir2);
- let file3 = newFileInDirectory(dir3);
-
- // cleanup function registration
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.download.lastDir");
- [dir1, dir2, dir3].forEach(function(dir) dir.remove(true));
- MockFilePicker.cleanup();
- validateFileName = validateFileNameToRestore;
- });
-
- // Overwrite validateFileName to validate everything
- validateFileName = function(foo) foo;
-
- let params = {
- fileInfo: new FileInfo("test.txt", "test.txt", "test", "txt", "http://mozilla.org/test.txt"),
- contentType: "text/plain",
- saveMode: SAVEMODE_FILEONLY,
- saveAsType: kSaveAsType_Complete,
- file: null
- };
-
- prefs.setComplexValue("lastDir", Ci.nsIFile, tmpDir);
-
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({private: aPrivate}, function(win) {
- let gDownloadLastDir = new DownloadLastDir(win);
- aCallback(win, gDownloadLastDir);
- gDownloadLastDir.cleanupPrivateFile();
- win.close();
- });
- }
-
- function testDownloadDir(aWin, gDownloadLastDir, aFile, aDisplayDir, aLastDir,
- aGlobalLastDir, aCallback) {
- // Check lastDir preference.
- is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aDisplayDir.path,
- "LastDir should be the expected display dir");
- // Check gDownloadLastDir value.
- is(gDownloadLastDir.file.path, aDisplayDir.path,
- "gDownloadLastDir should be the expected display dir");
-
- MockFilePicker.returnFiles = [aFile];
- MockFilePicker.displayDirectory = null;
- aWin.getTargetFile(params, function() {
- // File picker should start with expected display dir.
- is(MockFilePicker.displayDirectory.path, aDisplayDir.path,
- "File picker should start with browser.download.lastDir");
- // browser.download.lastDir should be modified on not private windows
- is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aLastDir.path,
- "LastDir should be the expected last dir");
- // gDownloadLastDir should be usable outside of private windows
- is(gDownloadLastDir.file.path, aGlobalLastDir.path,
- "gDownloadLastDir should be the expected global last dir");
-
- aCallback();
- });
- }
-
- testOnWindow(false, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file1, tmpDir, dir1, dir1, function() {
- testOnWindow(true, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file2, dir1, dir1, dir2, function() {
- testOnWindow(false, function(win, downloadDir) {
- testDownloadDir(win, downloadDir, file3, dir1, dir3, dir3, finish);
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_toggle.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_toggle.js
deleted file mode 100644
index 56ac4cab6..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir_toggle.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let DownloadLastDir =
- Cu.import("resource://gre/modules/DownloadLastDir.jsm", {}).DownloadLastDir;
-
- let tmpDir = FileUtils.getDir("TmpD", [], true);
- let dir1 = newDirectory();
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.download.lastDir");
- dir1.remove(true);
- });
-
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({private: aPrivate}, function(win) {
- let gDownloadLastDir = new DownloadLastDir(win);
- aCallback(win, gDownloadLastDir);
- gDownloadLastDir.cleanupPrivateFile();
- win.close();
- });
- }
-
- function checkDownloadLastDirInit(aWin, gDownloadLastDir, aCallback) {
- is(typeof gDownloadLastDir, "object",
- "gDownloadLastDir should be a valid object");
- is(gDownloadLastDir.file, null,
- "gDownloadLastDir.file should be null to start with");
-
- gDownloadLastDir.file = tmpDir;
- is(gDownloadLastDir.file.path, tmpDir.path,
- "LastDir should point to the temporary directory");
- isnot(gDownloadLastDir.file, tmpDir,
- "gDownloadLastDir.file should not be pointing to the tmpDir");
-
- gDownloadLastDir.file = 1; // not an nsIFile
- is(gDownloadLastDir.file, null, "gDownloadLastDir.file should be null");
-
- gDownloadLastDir.file = tmpDir;
- clearHistory();
- is(gDownloadLastDir.file, null, "gDownloadLastDir.file should be null");
-
- gDownloadLastDir.file = tmpDir;
- aCallback();
- }
-
- function checkDownloadLastDir(aWin, gDownloadLastDir, aLastDir, aUpdate, aCallback) {
- if (aUpdate)
- gDownloadLastDir.file = aLastDir;
- is(gDownloadLastDir.file.path, aLastDir.path,
- "gDownloadLastDir should point to the expected last directory");
- isnot(gDownloadLastDir.file, aLastDir,
- "gDownloadLastDir.file should not be pointing to the last directory");
- aCallback();
- }
-
- function checkDownloadLastDirNull(aWin, gDownloadLastDir, aCallback) {
- is(gDownloadLastDir.file, null, "gDownloadLastDir should be null");
- aCallback();
- }
-
- testOnWindow(false, function(win, downloadDir) {
- checkDownloadLastDirInit(win, downloadDir, function() {
- testOnWindow(true, function(win, downloadDir) {
- checkDownloadLastDir(win, downloadDir, tmpDir, false, function() {
- testOnWindow(false, function(win, downloadDir) {
- checkDownloadLastDir(win, downloadDir, tmpDir, false, function() {
- testOnWindow(true, function(win, downloadDir) {
- checkDownloadLastDir(win, downloadDir, dir1, true, function() {
- testOnWindow(false, function(win, downloadDir) {
- checkDownloadLastDir(win, downloadDir, tmpDir, false, function() {
- testOnWindow(true, function(win, downloadDir) {
- clearHistory();
- checkDownloadLastDirNull(win, downloadDir, function() {
- testOnWindow(false, function(win, downloadDir) {
- checkDownloadLastDirNull(win, downloadDir, finish);
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
deleted file mode 100644
index 1e0a49231..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the geolocation prompt does not show a remember
-// control inside the private browsing mode.
-
-function test() {
- const testPageURL = "http://mochi.test:8888/browser/" +
- "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
- waitForExplicitFinish();
-
- function checkGeolocation(aPrivateMode, aWindow, aCallback) {
- executeSoon(function() {
- aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
- aWindow.gBrowser.selectedBrowser.addEventListener("load", function () {
- if (aWindow.content.location != testPageURL) {
- aWindow.content.location = testPageURL;
- return;
- }
- aWindow.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- function runTest() {
- let notification = aWindow.PopupNotifications.getNotification("geolocation");
- if (!notification) {
- // Wait until the notification is available
- executeSoon(runTest);
- return;
- }
- if (aPrivateMode) {
- // Make sure the notification is correctly displayed without a remember control
- is(notification.secondaryActions.length, 0, "Secondary actions shouldn't exist (always/never remember)");
- } else {
- ok(notification.secondaryActions.length > 1, "Secondary actions should exist (always/never remember)");
- }
- notification.remove();
-
- aWindow.gBrowser.removeCurrentTab();
- aCallback();
- }
- runTest();
- }, true);
- });
- };
-
- let windowsToClose = [];
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- callback(win);
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- testOnWindow({private: false}, function(win) {
- checkGeolocation(false, win, function() {
- testOnWindow({private: true}, function(win) {
- checkGeolocation(true, win, finish);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html
deleted file mode 100644
index 36d5e3cec..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html>
- <head>
- <title>Geolocation invoker</title>
- </head>
- <body>
- <script type="text/javascript">
- navigator.geolocation.getCurrentPosition(function (pos) {
- // ignore
- });
- </script>
- </body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js
deleted file mode 100644
index dbe8ed060..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_lastpbcontextexited.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // We need to open a new window for this so that its docshell would get destroyed
- // when clearing the PB mode flag.
- function runTest(aCloseWindow, aCallback) {
- let newWin = OpenBrowserWindow({private: true});
- SimpleTest.waitForFocus(function() {
- let expectedExiting = true;
- let expectedExited = false;
- let observerExiting = {
- observe: function(aSubject, aTopic, aData) {
- is(aTopic, "last-pb-context-exiting", "Correct topic should be dispatched (exiting)");
- is(expectedExiting, true, "notification not expected yet (exiting)");
- expectedExited = true;
- Services.obs.removeObserver(observerExiting, "last-pb-context-exiting");
- }
- };
- let observerExited = {
- observe: function(aSubject, aTopic, aData) {
- is(aTopic, "last-pb-context-exited", "Correct topic should be dispatched (exited)");
- is(expectedExited, true, "notification not expected yet (exited)");
- Services.obs.removeObserver(observerExited, "last-pb-context-exited");
- aCallback();
- }
- };
- Services.obs.addObserver(observerExiting, "last-pb-context-exiting", false);
- Services.obs.addObserver(observerExited, "last-pb-context-exited", false);
- expectedExiting = true;
- aCloseWindow(newWin);
- newWin = null;
- SpecialPowers.forceGC();
- }, newWin);
- }
-
- waitForExplicitFinish();
-
- runTest(function(newWin) {
- // Simulate pressing the window close button
- newWin.document.getElementById("cmd_closeWindow").doCommand();
- }, function () {
- runTest(function(newWin) {
- // Simulate closing the last tab
- newWin.document.getElementById("cmd_close").doCommand();
- }, finish);
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
deleted file mode 100644
index de39209e2..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- const page1 = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
- 'browser_privatebrowsing_localStorage_page1.html'
-
- function checkLocalStorage(aWindow, aCallback) {
- executeSoon(function() {
- let tab = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
- let browser = aWindow.gBrowser.selectedBrowser;
- browser.addEventListener('load', function() {
- if (browser.contentWindow.location != page1) {
- browser.loadURI(page1);
- return;
- }
- browser.removeEventListener('load', arguments.callee, true);
- let tab2 = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
- browser.contentWindow.location = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/' +
- 'browser_privatebrowsing_localStorage_page2.html';
- browser.addEventListener('load', function() {
- browser.removeEventListener('load', arguments.callee, true);
- is(browser.contentWindow.document.title, '2', "localStorage should contain 2 items");
- aCallback();
- }, true);
- }, true);
- });
- }
-
- let windowsToClose = [];
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- callback(win);
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- testOnWindow({private: true}, function(win) {
- checkLocalStorage(win, finish);
- });
-
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
deleted file mode 100644
index 5cbee92b1..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Ensure that a storage instance used by both private and public sessions at different times does not
-// allow any data to leak due to cached values.
-
-// Step 1: Load browser_privatebrowsing_localStorage_before_after_page.html in a private tab, causing a storage
-// item to exist. Close the tab.
-// Step 2: Load the same page in a non-private tab, ensuring that the storage instance reports only one item
-// existing.
-
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let testURI = "about:blank";
- let prefix = 'http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/';
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- if (aIsPrivateMode) {
- // do something when aIsPrivateMode is true
- is(aWindow.gBrowser.contentWindow.document.title, '1', "localStorage should contain 1 item");
- } else {
- // do something when aIsPrivateMode is false
- is(aWindow.gBrowser.contentWindow.document.title, 'null|0', 'localStorage should contain 0 items');
- }
-
- aCallback();
- }, true);
-
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- }
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- windowsToClose.push(aWin);
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- // this function is called after calling finish() on the test.
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- // test first when on private mode
- testOnWindow({private: true}, function(aWin) {
- testURI = prefix + 'browser_privatebrowsing_localStorage_before_after_page.html';
- doTest(true, aWin, function() {
- // then test when not on private mode
- testOnWindow({}, function(aWin) {
- testURI = prefix + 'browser_privatebrowsing_localStorage_before_after_page2.html';
- doTest(false, aWin, finish);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html
deleted file mode 100644
index 143fea4e7..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
- localStorage.clear();
- localStorage.setItem('zzztest', 'zzzvalue');
- document.title = localStorage.length;
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html
deleted file mode 100644
index 9a7e2da63..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_before_after_page2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
- document.title = localStorage.getItem('zzztest', 'zzzvalue') + '|' + localStorage.length;
- localStorage.clear();
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html
deleted file mode 100644
index 3e79a01bf..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page1.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
- localStorage.clear();
- localStorage.setItem('test1', 'value1');
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html
deleted file mode 100644
index 8c9b28fd8..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_localStorage_page2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
- localStorage.setItem('test2', 'value2');
- document.title = localStorage.length;
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_noSessionRestoreMenuOption.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_noSessionRestoreMenuOption.js
deleted file mode 100644
index 32919c834..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_noSessionRestoreMenuOption.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test checks that the Session Restore menu option is not enabled in private mode
-
-function test() {
- waitForExplicitFinish();
-
- function testNoSessionRestoreMenuItem() {
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- ok(true, "The second private window got loaded");
- let srCommand = win.document.getElementById("Browser:RestoreLastSession");
- ok(srCommand, "The Session Restore command should exist");
- is(PrivateBrowsingUtils.isWindowPrivate(win), true,
- "PrivateBrowsingUtils should report the correct per-window private browsing status");
- is(srCommand.hasAttribute("disabled"), true,
- "The Session Restore command should be disabled in private browsing mode");
- win.close();
- finish();
- }, false);
- }
-
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onload() {
- win.removeEventListener("load", onload, false);
- ok(true, "The first private window got loaded");
- win.gBrowser.addTab("about:mozilla");
- win.close();
- testNoSessionRestoreMenuItem();
- }, false);
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_nonbrowser.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_nonbrowser.js
deleted file mode 100644
index 4a9957e9c..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_nonbrowser.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let windowsToClose = [];
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- let win = OpenBrowserWindow({private: true});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- let consoleWin = win.open("chrome://global/content/console.xul", "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
- consoleWin.addEventListener("load", function consoleLoad() {
- consoleWin.removeEventListener("load", consoleLoad, false);
- win.close();
- }, false);
- windowsToClose.push(consoleWin);
- }, false);
-
- let observer = function() {
- is(true, true, "observer fired");
- Services.obs.removeObserver(observer, "last-pb-context-exited");
- executeSoon(finish);
- };
- Services.obs.addObserver(observer, "last-pb-context-exited", false);
- windowsToClose.push(win);
-} \ No newline at end of file
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js
deleted file mode 100644
index e68aaec3c..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openLocationLastURL.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
- const URL_1 = "mozilla.org";
- const URL_2 = "mozilla.com";
-
- function testURL(aOpenLocation, aTestNumber, aValue) {
- is(aOpenLocation.value, aValue,
- "Test: " + aTestNumber + ": Validate last url value.");
- }
-
- whenNewWindowLoaded({private: false}, function(normalWindow) {
- whenNewWindowLoaded({private: true}, function(privateWindow) {
- let openLocationLastURL = getLocationModule(normalWindow);
- let openLocationLastURLPB = getLocationModule(privateWindow);
-
- // Clean to start testing.
- is(typeof openLocationLastURL, "object", "Validate Normal type of last url.");
- is(typeof openLocationLastURLPB, "object", "Validate PB type of last url.");
- openLocationLastURL.reset();
- openLocationLastURLPB.reset();
- testURL(openLocationLastURL, 1, "");
-
- // Test without private browsing.
- openLocationLastURL.value = URL_1;
- testURL(openLocationLastURL, 2, URL_1);
- openLocationLastURL.value = "";
- testURL(openLocationLastURL, 3, "");
- openLocationLastURL.value = URL_2;
- testURL(openLocationLastURL, 4, URL_2);
- clearHistory();
- testURL(openLocationLastURL, 5, "");
-
- // Test changing private browsing.
- openLocationLastURL.value = URL_2;
- testURL(openLocationLastURLPB, 6, "");
- testURL(openLocationLastURL, 7, URL_2);
- openLocationLastURLPB.value = URL_1;
- testURL(openLocationLastURLPB, 8, URL_1);
- testURL(openLocationLastURL, 9, URL_2);
- openLocationLastURLPB.value = URL_1;
- testURL(openLocationLastURLPB, 10, URL_1);
-
- // Test cleaning history.
- clearHistory();
- testURL(openLocationLastURLPB, 11, "");
- testURL(openLocationLastURL, 12, "");
-
- privateWindow.close();
- normalWindow.close();
- finish();
- });
- });
-}
-
-function getLocationModule(aWindow) {
- let openLocationModule = {};
- Cu.import("resource:///modules/openLocationLastURL.jsm", openLocationModule);
- return new openLocationModule.OpenLocationLastURL(aWindow);
-} \ No newline at end of file
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
deleted file mode 100644
index 1a14385a3..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_opendir.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the last open directory used inside the private
-// browsing mode is not remembered after leaving that mode.
-
-var windowsToClose = [];
-function testOnWindow(options, callback) {
- var win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- callback(win);
- }, false);
-}
-
-registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
-});
-
-function test() {
- // initialization
- waitForExplicitFinish();
- let ds = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties);
- let dir1 = ds.get("ProfD", Ci.nsIFile);
- let dir2 = ds.get("TmpD", Ci.nsIFile);
- let file = dir2.clone();
- file.append("pbtest.file");
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
-
- const kPrefName = "browser.open.lastDir";
-
- function setupCleanSlate(win) {
- win.gLastOpenDirectory.reset();
- gPrefService.clearUserPref(kPrefName);
- }
-
- setupCleanSlate(window);
-
- // open one regular and one private window
- testOnWindow(undefined, function(nonPrivateWindow) {
- setupCleanSlate(nonPrivateWindow);
- testOnWindow({private: true}, function(privateWindow) {
- setupCleanSlate(privateWindow);
-
- // Test 1: general workflow test
-
- // initial checks
- ok(!nonPrivateWindow.gLastOpenDirectory.path,
- "Last open directory path should be initially empty");
- nonPrivateWindow.gLastOpenDirectory.path = dir2;
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir2.path,
- "The path should be successfully set");
- nonPrivateWindow.gLastOpenDirectory.path = null;
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir2.path,
- "The path should be not change when assigning it to null");
- nonPrivateWindow.gLastOpenDirectory.path = dir1;
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The path should be successfully outside of the private browsing mode");
-
- // test the private window
- is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The path should not change when entering the private browsing mode");
- privateWindow.gLastOpenDirectory.path = dir2;
- is(privateWindow.gLastOpenDirectory.path.path, dir2.path,
- "The path should successfully change inside the private browsing mode");
-
- // test the non-private window
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The path should be reset to the same path as before entering the private browsing mode");
-
- setupCleanSlate(nonPrivateWindow);
- setupCleanSlate(privateWindow);
-
- // Test 2: the user first tries to open a file inside the private browsing mode
-
- // test the private window
- ok(!privateWindow.gLastOpenDirectory.path,
- "No original path should exist inside the private browsing mode");
- privateWindow.gLastOpenDirectory.path = dir1;
- is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The path should be successfully set inside the private browsing mode");
- // test the non-private window
- ok(!nonPrivateWindow.gLastOpenDirectory.path,
- "The path set inside the private browsing mode should not leak when leaving that mode");
-
- setupCleanSlate(nonPrivateWindow);
- setupCleanSlate(privateWindow);
-
- // Test 3: the last open directory is set from a previous session, it should be used
- // in normal mode
-
- gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The pref set from last session should take effect outside the private browsing mode");
-
- setupCleanSlate(nonPrivateWindow);
- setupCleanSlate(privateWindow);
-
- // Test 4: the last open directory is set from a previous session, it should be used
- // in private browsing mode mode
-
- gPrefService.setComplexValue(kPrefName, Ci.nsILocalFile, dir1);
- // test the private window
- is(privateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The pref set from last session should take effect inside the private browsing mode");
- // test the non-private window
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
- "The pref set from last session should remain in effect after leaving the private browsing mode");
-
- setupCleanSlate(nonPrivateWindow);
- setupCleanSlate(privateWindow);
-
- // Test 5: setting the path to a file shouldn't work
-
- nonPrivateWindow.gLastOpenDirectory.path = file;
- ok(!nonPrivateWindow.gLastOpenDirectory.path,
- "Setting the path to a file shouldn't work when it's originally null");
- nonPrivateWindow.gLastOpenDirectory.path = dir1;
- nonPrivateWindow.gLastOpenDirectory.path = file;
- is(nonPrivateWindow.gLastOpenDirectory.path.path, dir1.path,
- "Setting the path to a file shouldn't work when it's not originally null");
-
- // cleanup
- file.remove(false);
- finish();
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js
deleted file mode 100644
index 0707004ba..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_openlocation.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that Open Location dialog is usable inside the private browsing
-// mode without leaving any trace of the URLs visited.
-
-function test() {
- // initialization
- waitForExplicitFinish();
-
- function openLocation(aWindow, url, autofilled, callback) {
- function observer(aSubject, aTopic, aData) {
- switch (aTopic) {
- case "domwindowopened":
- let dialog = aSubject.QueryInterface(Ci.nsIDOMWindow);
- dialog.addEventListener("load", function () {
- dialog.removeEventListener("load", arguments.callee, false);
-
- let browser = aWindow.gBrowser.selectedBrowser;
- browser.addEventListener("load", function() {
- // Ignore non-related loads (could be about:privatebrowsing for example, see bug 817932)
- if (browser.currentURI.spec != url) {
- return;
- }
-
- browser.removeEventListener("load", arguments.callee, true);
-
- executeSoon(callback);
- }, true);
-
- SimpleTest.waitForFocus(function() {
- let input = dialog.document.getElementById("dialog.input");
- is(input.value, autofilled, "The input field should be correctly auto-filled");
- input.focus();
- for (let i = 0; i < url.length; ++i)
- EventUtils.synthesizeKey(url[i], {}, dialog);
- EventUtils.synthesizeKey("VK_RETURN", {}, dialog);
- }, dialog);
- }, false);
- break;
-
- case "domwindowclosed":
- Services.ww.unregisterNotification(arguments.callee);
- break;
- }
- }
-
- executeSoon(function() {
- Services.ww.registerNotification(observer);
- gPrefService.setIntPref("general.open_location.last_window_choice", 0);
- aWindow.openDialog("chrome://browser/content/openLocation.xul", "_blank",
- "chrome,titlebar", aWindow);
- });
- }
-
- let windowsToClose = [];
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- callback(win);
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- if (gPrefService.prefHasUserValue("general.open_location.last_url"))
- gPrefService.clearUserPref("general.open_location.last_url");
-
- testOnWindow({private: false}, function(win) {
- openLocation(win, "http://example.com/", "", function() {
- testOnWindow({private: false}, function(win) {
- openLocation(win, "http://example.org/", "http://example.com/", function() {
- testOnWindow({private: true}, function(win) {
- openLocation(win, "about:logo", "", function() {
- testOnWindow({private: true}, function(win) {
- openLocation(win, "about:buildconfig", "about:logo", function() {
- testOnWindow({private: false}, function(win) {
- openLocation(win, "about:blank", "http://example.org/", function() {
- gPrefService.clearUserPref("general.open_location.last_url");
- if (gPrefService.prefHasUserValue("general.open_location.last_window_choice"))
- gPrefService.clearUserPref("general.open_location.last_window_choice");
- finish();
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.html
deleted file mode 100644
index f5bb3212f..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html>
- <head>
- <title>Title 1</title>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
deleted file mode 100644
index 2d9d73652..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Test to make sure that the visited page titles do not get updated inside the
-// private browsing mode.
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PlacesUtils.jsm");
-
-function test() {
- waitForExplicitFinish();
- const TEST_URL = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.html"
- const TEST_URI = Services.io.newURI(TEST_URL, null, null);
- const TITLE_1 = "Title 1";
- const TITLE_2 = "Title 2";
-
- let selectedWin = null;
- let windowsToClose = [];
- let tabToClose = null;
- let testNumber = 0;
- let historyObserver;
-
-
- registerCleanupFunction(function() {
- PlacesUtils.history.removeObserver(historyObserver, false);
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- gBrowser.removeTab(tabToClose);
- });
-
-
- waitForClearHistory(function () {
- historyObserver = {
- onTitleChanged: function(aURI, aPageTitle) {
- switch (++testNumber) {
- case 1:
- afterFirstVisit();
- break;
- case 2:
- afterUpdateVisit();
- break;
- }
- },
- onBeginUpdateBatch: function () {},
- onEndUpdateBatch: function () {},
- onVisit: function () {},
- onDeleteURI: function () {},
- onClearHistory: function () {},
- onPageChanged: function () {},
- onDeleteVisits: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
- };
- PlacesUtils.history.addObserver(historyObserver, false);
-
- tabToClose = gBrowser.addTab();
- gBrowser.selectedTab = tabToClose;
- whenPageLoad(window, function() {});
- });
-
- function afterFirstVisit() {
- is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_1, "The title matches the orignal title after first visit");
-
- let place = {
- uri: TEST_URI,
- title: TITLE_2,
- visits: [{
- visitDate: Date.now() * 1000,
- transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
- }]
- };
- PlacesUtils.asyncHistory.updatePlaces(place, {
- handleError: function () do_throw("Unexpected error in adding visit."),
- handleResult: function () { },
- handleCompletion: function () {}
- });
- }
-
- function afterUpdateVisit() {
- is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_2, "The title matches the updated title after updating visit");
-
- testOnWindow(true, function(aWin) {
- whenPageLoad(aWin, function() {
- executeSoon(afterFirstVisitInPrivateWindow);
- });
- });
- }
-
- function afterFirstVisitInPrivateWindow() {
- is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_2, "The title remains the same after visiting in private window");
- waitForClearHistory(finish);
- }
-
- function whenPageLoad(aWin, aCallback) {
- aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- aCallback();
- }, true);
- aWin.gBrowser.selectedBrowser.loadURI(TEST_URL);
- }
-
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({ private: aPrivate }, function(aWin) {
- selectedWin = aWin;
- windowsToClose.push(aWin);
- executeSoon(function() { aCallback(aWin) });
- });
- }
-
- function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }
- };
- Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
-
- PlacesUtils.bhistory.removeAllPages();
- }
-}
-
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
deleted file mode 100644
index 613036462..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the title of existing history entries does not
-// change inside a private window.
-
-function test() {
- waitForExplicitFinish();
-
- const TEST_URL = "http://mochi.test:8888/browser/browser/components/" +
- "privatebrowsing/test/browser/title.sjs";
- let cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
-
- function waitForCleanup(aCallback) {
- // delete all cookies
- cm.removeAll();
- // delete all history items
- Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
- Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
- aCallback();
- }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
- PlacesUtils.bhistory.removeAllPages();
- }
-
- let testNumber = 0;
- let historyObserver = {
- onTitleChanged: function(aURI, aPageTitle) {
- if (aURI.spec != TEST_URL)
- return;
- switch (++testNumber) {
- case 1:
- // The first time that the page is loaded
- is(aPageTitle, "No Cookie",
- "The page should be loaded without any cookie for the first time");
- openTestPage(selectedWin);
- break;
- case 2:
- // The second time that the page is loaded
- is(aPageTitle, "Cookie",
- "The page should be loaded with a cookie for the second time");
- waitForCleanup(function () {
- openTestPage(selectedWin);
- });
- break;
- case 3:
- // After clean up
- is(aPageTitle, "No Cookie",
- "The page should be loaded without any cookie again");
- testOnWindow(true, function(win) {
- whenPageLoad(win, function() {
- waitForCleanup(finish);
- });
- });
- break;
- default:
- // Checks that opening the page in a private window should not fire a
- // title change.
- ok(false, "Title changed. Unexpected pass: " + testNumber);
- }
- },
-
- onBeginUpdateBatch: function () {},
- onEndUpdateBatch: function () {},
- onVisit: function () {},
- onDeleteURI: function () {},
- onClearHistory: function () {},
- onPageChanged: function () {},
- onDeleteVisits: function() {},
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
- };
- PlacesUtils.history.addObserver(historyObserver, false);
-
- let selectedWin = null;
- let windowsToClose = [];
- registerCleanupFunction(function() {
- PlacesUtils.history.removeObserver(historyObserver);
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- function openTestPage(aWin) {
- aWin.gBrowser.selectedTab = aWin.gBrowser.addTab(TEST_URL);
- }
-
- function whenPageLoad(aWin, aCallback) {
- aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- aCallback();
- }, true);
- aWin.gBrowser.selectedBrowser.loadURI(TEST_URL);
- }
-
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({ private: aPrivate }, function(win) {
- selectedWin = win;
- windowsToClose.push(win);
- executeSoon(function() { aCallback(win) });
- });
- }
-
- waitForCleanup(function() {
- testOnWindow(false, function(win) {
- openTestPage(win);
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
deleted file mode 100644
index 468f45b4b..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_popupblocker.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that private browsing mode disables the remember option
-// for the popup blocker menu.
-function test() {
- // initialization
- waitForExplicitFinish();
-
- let testURI = "http://mochi.test:8888/browser/browser/components/privatebrowsing/test/browser/popup.html";
- let windowsToClose = [];
- let oldPopupPolicy = gPrefService.getBoolPref("dom.disable_open_during_load");
- gPrefService.setBoolPref("dom.disable_open_during_load", true);
-
- function testPopupBlockerMenuItem(aExpectedDisabled, aWindow, aCallback) {
-
- aWindow.gBrowser.addEventListener("DOMUpdatePageReport", function() {
- aWindow.gBrowser.removeEventListener("DOMUpdatePageReport", arguments.callee, false);
-
- executeSoon(function() {
- let notification = aWindow.gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked");
- ok(notification, "The notification box should be displayed");
-
- function checkMenuItem(callback) {
- dump("CMI: in\n");
- aWindow.document.addEventListener("popupshown", function(event) {
- dump("CMI: popupshown\n");
- aWindow.document.removeEventListener("popupshown", arguments.callee, false);
-
- if (aExpectedDisabled)
- is(aWindow.document.getElementById("blockedPopupAllowSite").getAttribute("disabled"), "true",
- "The allow popups menu item should be disabled");
-
- event.originalTarget.hidePopup();
- dump("CMI: calling back\n");
- callback();
- dump("CMI: called back\n");
- }, false);
- dump("CMI: out\n");
- }
-
- checkMenuItem(function() {
- aCallback();
- });
- notification.querySelector("button").doCommand();
- });
-
- }, false);
-
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- }
-
- function finishTest() {
- // cleanup
- gPrefService.setBoolPref("dom.disable_open_during_load", oldPopupPolicy);
- finish();
- };
-
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- executeSoon(function() callback(win));
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- testOnWindow({}, function(win) {
- testPopupBlockerMenuItem(false, win,
- testOnWindow({private: true}, function(win) {
- testPopupBlockerMenuItem(true, win,
- testOnWindow({}, function(win) {
- testPopupBlockerMenuItem(false, win, finishTest);
- })
- );
- })
- );
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js
deleted file mode 100644
index ac978898a..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the web pages can't register protocol handlers
-// inside the private browsing mode.
-
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let notificationValue = "Protocol Registration: testprotocol";
- let testURI = "http://example.com/browser/" +
- "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html";
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- setTimeout(function() {
- let notificationBox = aWindow.gBrowser.getNotificationBox();
- let notification = notificationBox.getNotificationWithValue(notificationValue);
-
- if (aIsPrivateMode) {
- // Make sure the notification is correctly displayed without a remember control
- ok(!notification, "Notification box should not be displayed inside of private browsing mode");
- } else {
- // Make sure the notification is correctly displayed with a remember control
- ok(notification, "Notification box should be displaying outside of private browsing mode");
- }
-
- aCallback();
- }, 100); // remember control is added in a setTimeout(0) call
- }, true);
-
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- }
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- windowsToClose.push(aWin);
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- // this function is called after calling finish() on the test.
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- // test first when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, function() {
- // then test when on private mode
- testOnWindow({private: true}, function(aWin) {
- doTest(true, aWin, finish);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html
deleted file mode 100644
index 74f846d54..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_protocolhandler_page.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html>
- <head>
- <title>Protocol registrar page</title>
- </head>
- <body>
- <script type="text/javascript">
- navigator.registerProtocolHandler("testprotocol",
- "https://example.com/foobar?uri=%s",
- "Test Protocol");
- </script>
- </body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js
deleted file mode 100644
index 432f47748..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_theming.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that privatebrowsingmode attribute of the window is correctly
-// adjusted based on whether the window is a private window.
-
-var windowsToClose = [];
-function testOnWindow(options, callback) {
- var win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- executeSoon(function() callback(win));
- }, false);
-}
-
-registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
-});
-
-function test() {
- // initialization
- waitForExplicitFinish();
-
- ok(!document.documentElement.hasAttribute("privatebrowsingmode"),
- "privatebrowsingmode should not be present in normal mode");
-
- // open a private window
- testOnWindow({private: true}, function(win) {
- is(win.document.documentElement.getAttribute("privatebrowsingmode"), "temporary",
- "privatebrowsingmode should be \"temporary\" inside the private browsing mode");
-
- finish();
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
deleted file mode 100644
index adb67d433..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the gPrivateBrowsingUI object, the Private Browsing
-// menu item and its XUL <command> element work correctly.
-
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let testURI = "about:blank";
- let pbMenuItem;
- let cmd;
-
- function doTest(aIsPrivateMode, aWindow, aCallback) {
- aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- ok(aWindow.gPrivateBrowsingUI, "The gPrivateBrowsingUI object exists");
-
- pbMenuItem = aWindow.document.getElementById("menu_newPrivateWindow");
- ok(pbMenuItem, "The Private Browsing menu item exists");
-
- cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
- isnot(cmd, null, "XUL command object for the private browsing service exists");
-
- is(pbMenuItem.getAttribute("label"), "New Private Window",
- "The Private Browsing menu item should read \"New Private Window\"");
- is(PrivateBrowsingUtils.isWindowPrivate(aWindow), aIsPrivateMode,
- "PrivateBrowsingUtils should report the correct per-window private browsing status (privateBrowsing should be " +
- aIsPrivateMode + ")");
-
- aCallback();
- }, true);
-
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- };
-
- function openPrivateBrowsingModeByUI(aWindow, aCallback) {
- Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
- aSubject.addEventListener("load", function() {
- aSubject.removeEventListener("load", arguments.callee);
- Services.obs.removeObserver(observer, "domwindowopened");
- windowsToClose.push(aSubject);
- aCallback(aSubject);
- }, false);
- }, "domwindowopened", false);
-
- cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
- var func = new Function("", cmd.getAttribute("oncommand"));
- func.call(cmd);
- };
-
- function testOnWindow(aOptions, aCallback) {
- whenNewWindowLoaded(aOptions, function(aWin) {
- windowsToClose.push(aWin);
- // execute should only be called when need, like when you are opening
- // web pages on the test. If calling executeSoon() is not necesary, then
- // call whenNewWindowLoaded() instead of testOnWindow() on your test.
- executeSoon(function() aCallback(aWin));
- });
- };
-
- // this function is called after calling finish() on the test.
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(aWin) {
- aWin.close();
- });
- });
-
- // test first when not on private mode
- testOnWindow({}, function(aWin) {
- doTest(false, aWin, function() {
- // then test when on private mode, opening a new private window from the
- // user interface.
- openPrivateBrowsingModeByUI(aWin, function(aPrivateWin) {
- doTest(true, aPrivateWin, finish);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
deleted file mode 100644
index ff25f3cc0..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the URL bar is focused when entering the private window.
-
-function test() {
- waitForExplicitFinish();
-
- const TEST_URL = "data:text/plain,test";
-
- function checkUrlbarFocus(aWin, aIsPrivate, aCallback) {
- let urlbar = aWin.gURLBar;
- if (aIsPrivate) {
- is(aWin.document.commandDispatcher.focusedElement, urlbar.inputField,
- "URL Bar should be focused inside the private window");
- is(urlbar.value, "",
- "URL Bar should be empty inside the private window");
- } else {
- isnot(aWin.document.commandDispatcher.focusedElement, urlbar.inputField,
- "URL Bar should not be focused after opening window");
- isnot(urlbar.value, "",
- "URL Bar should not be empty after opening window");
- }
- aCallback();
- }
-
- let windowsToClose = [];
- function testOnWindow(aPrivate, aCallback) {
- whenNewWindowLoaded({private: aPrivate}, function(win) {
- windowsToClose.push(win);
- executeSoon(function() aCallback(win));
- });
- }
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- function whenLoadTab(aPrivate, aCallback) {
- testOnWindow(aPrivate, function(win) {
- let browser = win.gBrowser.selectedBrowser;
- browser.addEventListener("load", function() {
- browser.removeEventListener("load", arguments.callee, true);
- aCallback(win);
- }, true);
- if (!aPrivate) {
- browser.focus();
- browser.loadURI(TEST_URL);
- }
- });
- }
-
- whenLoadTab(false, function(win) {
- checkUrlbarFocus(win, false, function() {
- whenLoadTab(true, function(win) {
- checkUrlbarFocus(win, true, function() {
- whenLoadTab(false, function(win) {
- checkUrlbarFocus(win, false, finish);
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
deleted file mode 100644
index 3b6aa964d..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the window title changes correctly while switching
-// from and to private browsing mode.
-
-function test() {
- const testPageURL = "http://mochi.test:8888/browser/" +
- "browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html";
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- // initialization of expected titles
- let test_title = "Test title";
- let app_name = document.documentElement.getAttribute("title");
- const isOSX = ("nsILocalFileMac" in Ci);
- let page_with_title;
- let page_without_title;
- let about_pb_title;
- let pb_page_with_title;
- let pb_page_without_title;
- let pb_about_pb_title;
- if (isOSX) {
- page_with_title = test_title;
- page_without_title = app_name;
- about_pb_title = "Would you like to start Private Browsing?";
- pb_page_with_title = test_title + " - (Private Browsing)";
- pb_page_without_title = app_name + " - (Private Browsing)";
- pb_about_pb_title = pb_page_without_title;
- }
- else {
- page_with_title = test_title + " - " + app_name;
- page_without_title = app_name;
- about_pb_title = "Would you like to start Private Browsing?" + " - " + app_name;
- pb_page_with_title = test_title + " - " + app_name + " (Private Browsing)";
- pb_page_without_title = app_name + " (Private Browsing)";
- pb_about_pb_title = "Private Browsing - " + app_name + " (Private Browsing)";
- }
-
- function testTabTitle(aWindow, url, insidePB, expected_title, funcNext) {
- executeSoon(function () {
- let tab = aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
- let browser = aWindow.gBrowser.selectedBrowser;
- browser.stop();
- // ensure that the test is run after the titlebar has been updated
- browser.addEventListener("pageshow", function () {
- browser.removeEventListener("pageshow", arguments.callee, false);
- executeSoon(function () {
- is(aWindow.document.title, expected_title, "The window title for " + url +
- " is correct (" + (insidePB ? "inside" : "outside") +
- " private browsing mode)");
-
- let win = aWindow.gBrowser.replaceTabWithWindow(tab);
- win.addEventListener("load", function() {
- win.removeEventListener("load", arguments.callee, false);
-
- executeSoon(function() {
- is(win.document.title, expected_title, "The window title for " + url +
- " detached tab is correct (" + (insidePB ? "inside" : "outside") +
- " private browsing mode)");
- win.close();
- aWindow.close();
-
- setTimeout(funcNext, 0);
- });
- }, false);
- });
- }, false);
-
- browser.loadURI(url);
- });
- }
-
- whenNewWindowLoaded({private: false}, function(win) {
- testTabTitle(win, "about:blank", false, page_without_title, function() {
- whenNewWindowLoaded({private: false}, function(win) {
- testTabTitle(win, testPageURL, false, page_with_title, function() {
- whenNewWindowLoaded({private: false}, function(win) {
- testTabTitle(win, "about:privatebrowsing", false, about_pb_title, function() {
- whenNewWindowLoaded({private: true}, function(win) {
- testTabTitle(win, "about:blank", true, pb_page_without_title, function() {
- whenNewWindowLoaded({private: true}, function(win) {
- testTabTitle(win, testPageURL, true, pb_page_with_title, function() {
- whenNewWindowLoaded({private: true}, function(win) {
- testTabTitle(win, "about:privatebrowsing", true, pb_about_pb_title, finish);
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- return;
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html
deleted file mode 100644
index 760bde7d1..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle_page.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html>
- <head>
- <title>Test title</title>
- </head>
- <body>
- Test page for the window title test
- </body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js
deleted file mode 100644
index 8ed67de18..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoom.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that private browsing turns off doesn't cause zoom
-// settings to be reset on tab switch (bug 464962)
-
-function test() {
- waitForExplicitFinish();
-
- function testZoom(aWindow, aCallback) {
- executeSoon(function() {
- let tabAbout = aWindow.gBrowser.addTab();
- aWindow.gBrowser.selectedTab = tabAbout;
-
- let aboutBrowser = aWindow.gBrowser.getBrowserForTab(tabAbout);
- aboutBrowser.addEventListener("load", function onAboutBrowserLoad() {
- aboutBrowser.removeEventListener("load", onAboutBrowserLoad, true);
- let tabMozilla = aWindow.gBrowser.addTab();
- aWindow.gBrowser.selectedTab = tabMozilla;
-
- let mozillaBrowser = aWindow.gBrowser.getBrowserForTab(tabMozilla);
- mozillaBrowser.addEventListener("load", function onMozillaBrowserLoad() {
- mozillaBrowser.removeEventListener("load", onMozillaBrowserLoad, true);
- let mozillaZoom = aWindow.ZoomManager.zoom;
-
- // change the zoom on the mozilla page
- aWindow.FullZoom.enlarge();
- // make sure the zoom level has been changed
- isnot(aWindow.ZoomManager.zoom, mozillaZoom, "Zoom level can be changed");
- mozillaZoom = aWindow.ZoomManager.zoom;
-
- // switch to about: tab
- aWindow.gBrowser.selectedTab = tabAbout;
-
- // switch back to mozilla tab
- aWindow.gBrowser.selectedTab = tabMozilla;
-
- // make sure the zoom level has not changed
- is(aWindow.ZoomManager.zoom, mozillaZoom,
- "Entering private browsing should not reset the zoom on a tab");
-
- // cleanup
- aWindow.FullZoom.reset();
- aWindow.gBrowser.removeTab(tabMozilla);
- aWindow.gBrowser.removeTab(tabAbout);
- aWindow.close();
- aCallback();
-
- }, true);
- mozillaBrowser.contentWindow.location = "about:mozilla";
- }, true);
- aboutBrowser.contentWindow.location = "about:";
- });
- }
-
- whenNewWindowLoaded({private: true}, function(privateWindow) {
- testZoom(privateWindow, finish);
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js
deleted file mode 100644
index 0d664525a..000000000
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_zoomrestore.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that about:privatebrowsing does not appear zoomed in
-// if there is already a zoom site pref for about:blank (bug 487656).
-
-function test() {
- // initialization
- waitForExplicitFinish();
- let windowsToClose = [];
- let windowsToReset = [];
-
- function doTestWhenReady(aIsZoomedWindow, aWindow, aCallback) {
- // Need to wait on two things, the ordering of which is not guaranteed:
- // (1) the page load, and (2) FullZoom's update to the new page's zoom
- // level. FullZoom broadcasts "browser-fullZoom:locationChange" when its
- // update is done. (See bug 856366 for details.)
-
- let n = 0;
-
- let browser = aWindow.gBrowser.selectedBrowser;
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- if (++n == 2)
- doTest(aIsZoomedWindow, aWindow, aCallback);
- }, true);
-
- let topic = "browser-fullZoom:locationChange";
- Services.obs.addObserver(function onLocationChange() {
- Services.obs.removeObserver(onLocationChange, topic);
- if (++n == 2)
- doTest(aIsZoomedWindow, aWindow, aCallback);
- }, topic, false);
-
- browser.loadURI("about:blank");
- }
-
- function doTest(aIsZoomedWindow, aWindow, aCallback) {
- if (aIsZoomedWindow) {
- is(aWindow.ZoomManager.zoom, 1,
- "Zoom level for freshly loaded about:blank should be 1");
- // change the zoom on the blank page
- aWindow.FullZoom.enlarge();
- isnot(aWindow.ZoomManager.zoom, 1, "Zoom level for about:blank should be changed");
- aCallback();
- return;
- }
- // make sure the zoom level is set to 1
- is(aWindow.ZoomManager.zoom, 1, "Zoom level for about:privatebrowsing should be reset");
- aCallback();
- }
-
- function finishTest() {
- // cleanup
- windowsToReset.forEach(function(win) {
- win.FullZoom.reset();
- });
- finish();
- }
-
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- windowsToReset.push(win);
- executeSoon(function() callback(win));
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- testOnWindow({}, function(win) {
- doTestWhenReady(true, win, function() {
- testOnWindow({private: true}, function(win) {
- doTestWhenReady(false, win, finishTest);
- });
- });
- });
-}
diff --git a/browser/components/privatebrowsing/test/browser/head.js b/browser/components/privatebrowsing/test/browser/head.js
deleted file mode 100644
index cabaa7d08..000000000
--- a/browser/components/privatebrowsing/test/browser/head.js
+++ /dev/null
@@ -1,40 +0,0 @@
-function whenNewWindowLoaded(aOptions, aCallback) {
- let win = OpenBrowserWindow(aOptions);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- aCallback(win);
- }, false);
-}
-
-function newDirectory() {
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let tmpDir = FileUtils.getDir("TmpD", [], true);
- let dir = tmpDir.clone();
- dir.append("testdir");
- dir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
- return dir;
-}
-
-function newFileInDirectory(aDir) {
- let FileUtils =
- Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let file = aDir.clone();
- file.append("testfile");
- file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_FILE);
- return file;
-}
-
-function clearHistory() {
- // simulate clearing the private data
- Services.obs.notifyObservers(null, "browser:purge-session-history", "");
-}
-
-function _initTest() {
- // Don't use about:home as the homepage for new windows
- Services.prefs.setIntPref("browser.startup.page", 0);
- registerCleanupFunction(function() Services.prefs.clearUserPref("browser.startup.page"));
-}
-
-_initTest();
-
diff --git a/browser/components/privatebrowsing/test/browser/moz.build b/browser/components/privatebrowsing/test/browser/moz.build
deleted file mode 100644
index ac649901e..000000000
--- a/browser/components/privatebrowsing/test/browser/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-MODULE = 'test_privatebrowsing'
-
diff --git a/browser/components/privatebrowsing/test/browser/popup.html b/browser/components/privatebrowsing/test/browser/popup.html
deleted file mode 100644
index 333a30346..000000000
--- a/browser/components/privatebrowsing/test/browser/popup.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html>
- <head>
- <title>Page creating a popup</title>
- </head>
- <body>
- <script type="text/javascript">
- window.open("data:text/plain,test", "testwin");
- </script>
- </body>
-</html>
diff --git a/browser/components/privatebrowsing/test/browser/title.sjs b/browser/components/privatebrowsing/test/browser/title.sjs
deleted file mode 100644
index 568e235be..000000000
--- a/browser/components/privatebrowsing/test/browser/title.sjs
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This provides the tests with a page with different titles based on whether
-// a cookie is present or not.
-
-function handleRequest(request, response) {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/html", false);
-
- var cookie = "name=value";
- var title = "No Cookie";
- if (request.hasHeader("Cookie") && request.getHeader("Cookie") == cookie)
- title = "Cookie";
- else
- response.setHeader("Set-Cookie", cookie, false);
-
- response.write("<html><head><title>");
- response.write(title);
- response.write("</title><body>test page</body></html>");
-}
diff --git a/browser/components/privatebrowsing/test/moz.build b/browser/components/privatebrowsing/test/moz.build
deleted file mode 100644
index 38cb43f17..000000000
--- a/browser/components/privatebrowsing/test/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['browser']
-
-MODULE = 'test_privatebrowsing'
-
diff --git a/browser/components/safebrowsing/content/test/Makefile.in b/browser/components/safebrowsing/content/test/Makefile.in
deleted file mode 100644
index 1ca03dbe0..000000000
--- a/browser/components/safebrowsing/content/test/Makefile.in
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- head.js \
- browser_bug400731.js \
- $(NULL)
-
-# The browser chrome test for bug 415846 doesn't run on Mac because of its
-# bizarre special-and-unique snowflake of a help menu.
-ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-MOCHITEST_BROWSER_FILES += \
- browser_bug415846.js \
- $(NULL)
-endif
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/safebrowsing/content/test/browser_bug400731.js b/browser/components/safebrowsing/content/test/browser_bug400731.js
deleted file mode 100644
index 313237269..000000000
--- a/browser/components/safebrowsing/content/test/browser_bug400731.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Check for the intended visibility of the "Ignore this warning" text*/
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- // Navigate to malware site. Can't use an onload listener here since
- // error pages don't fire onload. Also can't register the DOMContentLoaded
- // handler here because registering it too soon would mean that we might
- // get it for about:blank, and not about:blocked.
- gBrowser.addTabsProgressListener({
- onLocationChange: function(aTab, aWebProgress, aRequest, aLocation, aFlags) {
- if (aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
- gBrowser.removeTabsProgressListener(this);
- window.addEventListener("DOMContentLoaded", testMalware, true);
- }
- }
- });
- content.location = "http://www.mozilla.org/firefox/its-an-attack.html";
-}
-
-function testMalware() {
- window.removeEventListener("DOMContentLoaded", testMalware, true);
-
- // Confirm that "Ignore this warning" is visible - bug 422410
- var el = content.document.getElementById("ignoreWarningButton");
- ok(el, "Ignore warning button should be present for malware");
-
- var style = content.getComputedStyle(el, null);
- is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for malware");
-
- // Now launch the phishing test
- window.addEventListener("DOMContentLoaded", testPhishing, true);
- content.location = "http://www.mozilla.org/firefox/its-a-trap.html";
-}
-
-function testPhishing() {
- window.removeEventListener("DOMContentLoaded", testPhishing, true);
-
- var el = content.document.getElementById("ignoreWarningButton");
- ok(el, "Ignore warning button should be present for phishing");
-
- var style = content.getComputedStyle(el, null);
- is(style.display, "inline-block", "Ignore Warning button should be display:inline-block for phishing");
-
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/components/safebrowsing/content/test/browser_bug415846.js b/browser/components/safebrowsing/content/test/browser_bug415846.js
deleted file mode 100644
index 079283c8e..000000000
--- a/browser/components/safebrowsing/content/test/browser_bug415846.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Check for the correct behaviour of the report web forgery/not a web forgery
-menu items.
-
-Mac makes this astonishingly painful to test since their help menu is special magic,
-but we can at least test it on the other platforms.*/
-var menu;
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
-
- // Navigate to a normal site
- gBrowser.addEventListener("DOMContentLoaded", testNormal, false);
- content.location = "http://example.com/";
-}
-
-function testNormal() {
- gBrowser.removeEventListener("DOMContentLoaded", testNormal, false);
-
- // open the menu, to force it to update
- menu = document.getElementById("menu_HelpPopup");
- ok(menu, "Help menu should exist!");
-
- menu.addEventListener("popupshown", testNormal_PopupListener, false);
- menu.openPopup(null, "", 0, 0, false, null);
-}
-
-function testNormal_PopupListener() {
- menu.removeEventListener("popupshown", testNormal_PopupListener, false);
-
- var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");
- var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu");
- is(reportMenu.hidden, false, "Report phishing menu should be visible on normal sites");
- is(errorMenu.hidden, true, "Report error menu item should be hidden on normal sites");
- menu.hidePopup();
-
- // Now launch the phishing test. Can't use onload here because error pages don't
- // fire normal load events.
- window.addEventListener("DOMContentLoaded", testPhishing, true);
- content.location = "http://www.mozilla.org/firefox/its-a-trap.html";
-}
-
-function testPhishing() {
- window.removeEventListener("DOMContentLoaded", testPhishing, true);
-
- menu.addEventListener("popupshown", testPhishing_PopupListener, false);
- menu.openPopup(null, "", 0, 0, false, null);
-}
-
-function testPhishing_PopupListener() {
- menu.removeEventListener("popupshown", testPhishing_PopupListener, false);
-
- var reportMenu = document.getElementById("menu_HelpPopup_reportPhishingtoolmenu");
- var errorMenu = document.getElementById("menu_HelpPopup_reportPhishingErrortoolmenu");
- is(reportMenu.hidden, true, "Report phishing menu should be hidden on phishing sites");
- is(errorMenu.hidden, false, "Report error menu item should be visible on phishing sites");
- menu.hidePopup();
-
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/components/safebrowsing/content/test/head.js b/browser/components/safebrowsing/content/test/head.js
deleted file mode 100644
index ca2b3723a..000000000
--- a/browser/components/safebrowsing/content/test/head.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// Force SafeBrowsing to be initialized for the tests
-SafeBrowsing.init();
-
diff --git a/browser/components/safebrowsing/content/test/moz.build b/browser/components/safebrowsing/content/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/safebrowsing/content/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/safebrowsing/moz.build b/browser/components/safebrowsing/moz.build
index 9fb81cdcc..8deb0b138 100644
--- a/browser/components/safebrowsing/moz.build
+++ b/browser/components/safebrowsing/moz.build
@@ -4,5 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['content/test']
diff --git a/browser/components/search/moz.build b/browser/components/search/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/components/search/moz.build
+++ b/browser/components/search/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/components/search/test/426329.xml b/browser/components/search/test/426329.xml
deleted file mode 100644
index e4545cc77..000000000
--- a/browser/components/search/test/426329.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName>Bug 426329</ShortName>
- <Description>426329 Search</Description>
- <InputEncoding>utf-8</InputEncoding>
- <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
- <Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/test.html">
- <Param name="test" value="{searchTerms}"/>
- </Url>
- <moz:SearchForm>http://mochi.test:8888/browser/browser/components/search/test/test.html</moz:SearchForm>
-</OpenSearchDescription>
diff --git a/browser/components/search/test/483086-1.xml b/browser/components/search/test/483086-1.xml
deleted file mode 100644
index 9dbba4886..000000000
--- a/browser/components/search/test/483086-1.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName>483086a</ShortName>
- <Description>Bug 483086 Test 1</Description>
- <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
- <Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/?search">
- <Param name="test" value="{searchTerms}"/>
- </Url>
- <moz:SearchForm>foo://example.com</moz:SearchForm>
-</OpenSearchDescription>
diff --git a/browser/components/search/test/483086-2.xml b/browser/components/search/test/483086-2.xml
deleted file mode 100644
index f130b9068..000000000
--- a/browser/components/search/test/483086-2.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName>483086b</ShortName>
- <Description>Bug 483086 Test 2</Description>
- <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
- <Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/?search">
- <Param name="test" value="{searchTerms}"/>
- </Url>
- <moz:SearchForm>http://example.com</moz:SearchForm>
-</OpenSearchDescription>
diff --git a/browser/components/search/test/Makefile.in b/browser/components/search/test/Makefile.in
deleted file mode 100644
index a9fa3f84c..000000000
--- a/browser/components/search/test/Makefile.in
+++ /dev/null
@@ -1,40 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_405664.js \
- browser_addEngine.js \
- browser_contextmenu.js \
- browser_healthreport.js \
- browser_private_search_perwindowpb.js \
- testEngine.xml \
- testEngine_mozsearch.xml \
- testEngine.src \
- browser_426329.js \
- 426329.xml \
- browser_483086.js \
- 483086-1.xml \
- 483086-2.xml \
- test.html \
- $(NULL)
-
-ifdef ENABLE_TESTS
-pp_mochitest_browser_files := \
- browser_google.js \
- $(NULL)
-pp_mochitest_browser_files_PATH := $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-pp_mochitest_browser_files_FLAGS := -DMOZ_DISTRIBUTION_ID=$(MOZ_DISTRIBUTION_ID)
-PP_TARGETS += pp_mochitest_browser_files
-endif # ENABLE_TESTS
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/search/test/browser_405664.js b/browser/components/search/test/browser_405664.js
deleted file mode 100644
index 2d3ee248f..000000000
--- a/browser/components/search/test/browser_405664.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function test() {
- var searchBar = BrowserSearch.searchBar;
- ok(searchBar, "got search bar");
-
- searchBar.focus();
-
- var pbo = searchBar._popup.popupBoxObject;
- ok(pbo, "popup is nsIPopupBoxObject");
-
- EventUtils.synthesizeKey("VK_UP", { altKey: true });
- is(pbo.popupState, "showing", "popup is opening after Alt+Up");
-
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- is(pbo.popupState, "closed", "popup is closed after ESC");
-
- EventUtils.synthesizeKey("VK_DOWN", { altKey: true });
- is(pbo.popupState, "showing", "popup is opening after Alt+Down");
-
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- is(pbo.popupState, "closed", "popup is closed after ESC 2");
-
- if (!/Mac/.test(navigator.platform)) {
- EventUtils.synthesizeKey("VK_F4", {});
- is(pbo.popupState, "showing", "popup is opening after F4");
-
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- is(pbo.popupState, "closed", "popup is closed after ESC 3");
- }
-}
diff --git a/browser/components/search/test/browser_426329.js b/browser/components/search/test/browser_426329.js
deleted file mode 100644
index 4b2310cd5..000000000
--- a/browser/components/search/test/browser_426329.js
+++ /dev/null
@@ -1,299 +0,0 @@
-// Instead of loading ChromeUtils.js into the test scope in browser-test.js for all tests,
-// we only need ChromeUtils.js for a few files which is why we are using loadSubScript.
-var ChromeUtils = {};
-this._scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
-this._scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
-
-XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
- "resource://gre/modules/FormHistory.jsm");
-
-function test() {
- waitForExplicitFinish();
-
- const ENGINE_HTML_BASE = "http://mochi.test:8888/browser/browser/components/search/test/test.html";
-
- var searchEntries = ["test", "More Text", "Some Text"];
- var searchBar = BrowserSearch.searchBar;
- var searchButton = document.getAnonymousElementByAttribute(searchBar,
- "anonid", "search-go-button");
- ok(searchButton, "got search-go-button");
-
- searchBar.value = "test";
-
- var ss = Services.search;
-
- let testIterator;
-
- function observer(aSub, aTopic, aData) {
- switch (aData) {
- case "engine-added":
- var engine = ss.getEngineByName("Bug 426329");
- ok(engine, "Engine was added.");
- ss.currentEngine = engine;
- break;
- case "engine-current":
- ok(ss.currentEngine.name == "Bug 426329", "currentEngine set");
- testReturn();
- break;
- case "engine-removed":
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
- finish();
- break;
- }
- }
-
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/426329.xml",
- Ci.nsISearchEngine.DATA_XML, "data:image/x-icon,%00",
- false);
-
- var preSelectedBrowser, preTabNo;
- function init() {
- preSelectedBrowser = gBrowser.selectedBrowser;
- preTabNo = gBrowser.tabs.length;
- searchBar.focus();
- }
-
- function testReturn() {
- init();
- EventUtils.synthesizeKey("VK_RETURN", {});
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo, "Return key did not open new tab");
- is(event.originalTarget, preSelectedBrowser.contentDocument,
- "Return key loaded results in current tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- testAltReturn();
- });
- }
-
- function testAltReturn() {
- init();
- EventUtils.synthesizeKey("VK_RETURN", { altKey: true });
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo + 1, "Alt+Return key added new tab");
- isnot(event.originalTarget, preSelectedBrowser.contentDocument,
- "Alt+Return key loaded results in new tab");
- is(event.originalTarget, gBrowser.contentDocument,
- "Alt+Return key loaded results in foreground tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- //Shift key has no effect for now, so skip it
- //testShiftAltReturn();
- testLeftClick();
- });
- }
-
- function testShiftAltReturn() {
- init();
- EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true, altKey: true });
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo + 1, "Shift+Alt+Return key added new tab");
- isnot(event.originalTarget, preSelectedBrowser.contentDocument,
- "Shift+Alt+Return key loaded results in new tab");
- isnot(event.originalTarget, gBrowser.contentDocument,
- "Shift+Alt+Return key loaded results in background tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- testLeftClick();
- });
- }
-
- function testLeftClick() {
- init();
- simulateClick({ button: 0 }, searchButton);
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo, "LeftClick did not open new tab");
- is(event.originalTarget, preSelectedBrowser.contentDocument,
- "LeftClick loaded results in current tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- testMiddleClick();
- });
- }
-
- function testMiddleClick() {
- init();
- simulateClick({ button: 1 }, searchButton);
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo + 1, "MiddleClick added new tab");
- isnot(event.originalTarget, preSelectedBrowser.contentDocument,
- "MiddleClick loaded results in new tab");
- is(event.originalTarget, gBrowser.contentDocument,
- "MiddleClick loaded results in foreground tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- testShiftMiddleClick();
- });
- }
-
- function testShiftMiddleClick() {
- init();
- simulateClick({ button: 1, shiftKey: true }, searchButton);
- doOnloadOnce(function(event) {
-
- is(gBrowser.tabs.length, preTabNo + 1, "Shift+MiddleClick added new tab");
- isnot(event.originalTarget, preSelectedBrowser.contentDocument,
- "Shift+MiddleClick loaded results in new tab");
- isnot(event.originalTarget, gBrowser.contentDocument,
- "Shift+MiddleClick loaded results in background tab");
- is(event.originalTarget.URL, expectedURL(searchBar.value), "Check URL of search page opened");
-
- testDropText();
- });
- }
-
- // prevent the search buttonmenu from opening during the drag tests
- function stopPopup(event) { event.preventDefault(); }
-
- function testDropText() {
- init();
- searchBar.addEventListener("popupshowing", stopPopup, true);
- // drop on the search button so that we don't need to worry about the
- // default handlers for textboxes.
- ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
- doOnloadOnce(function(event) {
- is(searchBar.value, "Some Text", "drop text/plain on searchbar");
- testDropInternalText();
- });
- }
-
- function testDropInternalText() {
- init();
- ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
- doOnloadOnce(function(event) {
- is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar");
- testDropLink();
- });
- }
-
- function testDropLink() {
- init();
- ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
- is(searchBar.value, "More Text", "drop text/uri-list on searchbar");
- SimpleTest.executeSoon(testRightClick);
- }
-
- function testRightClick() {
- init();
- searchBar.removeEventListener("popupshowing", stopPopup, true);
- content.location.href = "about:blank";
- simulateClick({ button: 2 }, searchButton);
- setTimeout(function() {
- is(gBrowser.tabs.length, preTabNo, "RightClick did not open new tab");
- is(gBrowser.currentURI.spec, "about:blank", "RightClick did nothing");
-
- testIterator = testSearchHistory();
- testIterator.next();
- }, 5000);
- }
-
- function countEntries(name, value, message) {
- let count = 0;
- FormHistory.count({ fieldname: name, value: value },
- { handleResult: function(result) { count = result; },
- handleError: function(error) { throw error; },
- handleCompletion: function(reason) {
- if (!reason) {
- ok(count > 0, message);
- testIterator.next();
- }
- }
- });
- }
-
- function testSearchHistory() {
- var textbox = searchBar._textbox;
- for (var i = 0; i < searchEntries.length; i++) {
- yield countEntries(textbox.getAttribute("autocompletesearchparam"), searchEntries[i],
- "form history entry '" + searchEntries[i] + "' should exist");
- }
- testAutocomplete();
- }
-
- function testAutocomplete() {
- var popup = searchBar.textbox.popup;
- popup.addEventListener("popupshown", function testACPopupShowing() {
- popup.removeEventListener("popupshown", testACPopupShowing);
- checkMenuEntries(searchEntries);
- testClearHistory();
- });
- searchBar.textbox.showHistoryPopup();
- }
-
- function testClearHistory() {
- let controller = searchBar.textbox.controllers.getControllerForCommand("cmd_clearhistory")
- ok(controller.isCommandEnabled("cmd_clearhistory"), "Clear history command enabled");
- controller.doCommand("cmd_clearhistory");
- let count = 0;
- FormHistory.count({ },
- { handleResult: function(result) { count = result; },
- handleError: function(error) { throw error; },
- handleCompletion: function(reason) {
- if (!reason) {
- ok(count == 0, "History cleared");
- finalize();
- }
- }
- });
- }
-
- function finalize() {
- searchBar.value = "";
- while (gBrowser.tabs.length != 1) {
- gBrowser.removeTab(gBrowser.tabs[0]);
- }
- content.location.href = "about:blank";
- var engine = ss.getEngineByName("Bug 426329");
- ss.removeEngine(engine);
- }
-
- function simulateClick(aEvent, aTarget) {
- var event = document.createEvent("MouseEvent");
- var ctrlKeyArg = aEvent.ctrlKey || false;
- var altKeyArg = aEvent.altKey || false;
- var shiftKeyArg = aEvent.shiftKey || false;
- var metaKeyArg = aEvent.metaKey || false;
- var buttonArg = aEvent.button || 0;
- event.initMouseEvent("click", true, true, window,
- 0, 0, 0, 0, 0,
- ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg,
- buttonArg, null);
- aTarget.dispatchEvent(event);
- }
-
- function expectedURL(aSearchTerms) {
- var textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"].
- getService(Ci.nsITextToSubURI);
- var searchArg = textToSubURI.ConvertAndEscape("utf-8", aSearchTerms);
- return ENGINE_HTML_BASE + "?test=" + searchArg;
- }
-
- // modified from toolkit/components/satchel/test/test_form_autocomplete.html
- function checkMenuEntries(expectedValues) {
- var actualValues = getMenuEntries();
- is(actualValues.length, expectedValues.length, "Checking length of expected menu");
- for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], "Checking menu entry #" + i);
- }
-
- function getMenuEntries() {
- var entries = [];
- var autocompleteMenu = searchBar.textbox.popup;
- // Could perhaps pull values directly from the controller, but it seems
- // more reliable to test the values that are actually in the tree?
- var column = autocompleteMenu.tree.columns[0];
- var numRows = autocompleteMenu.tree.view.rowCount;
- for (var i = 0; i < numRows; i++) {
- entries.push(autocompleteMenu.tree.view.getValueAt(i, column));
- }
- return entries;
- }
-}
-
diff --git a/browser/components/search/test/browser_483086.js b/browser/components/search/test/browser_483086.js
deleted file mode 100644
index 223db0cc8..000000000
--- a/browser/components/search/test/browser_483086.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-let gSS = Services.search;
-
-function test() {
- waitForExplicitFinish();
-
- function observer(aSubject, aTopic, aData) {
- switch (aData) {
- case "engine-added":
- let engine = gSS.getEngineByName("483086a");
- ok(engine, "Test engine 1 installed");
- isnot(engine.searchForm, "foo://example.com",
- "Invalid SearchForm URL dropped");
- gSS.removeEngine(engine);
- break;
- case "engine-removed":
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
- test2();
- break;
- }
- }
-
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-1.xml",
- Ci.nsISearchEngine.DATA_XML, "data:image/x-icon;%00",
- false);
-}
-
-function test2() {
- function observer(aSubject, aTopic, aData) {
- switch (aData) {
- case "engine-added":
- let engine = gSS.getEngineByName("483086b");
- ok(engine, "Test engine 2 installed");
- is(engine.searchForm, "http://example.com", "SearchForm is correct");
- gSS.removeEngine(engine);
- break;
- case "engine-removed":
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
- finish();
- break;
- }
- }
-
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/483086-2.xml",
- Ci.nsISearchEngine.DATA_XML, "data:image/x-icon;%00",
- false);
-}
diff --git a/browser/components/search/test/browser_addEngine.js b/browser/components/search/test/browser_addEngine.js
deleted file mode 100644
index f546aead6..000000000
--- a/browser/components/search/test/browser_addEngine.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var gSS = Services.search;
-
-function observer(aSubject, aTopic, aData) {
- if (!gCurrentTest) {
- info("Observer called with no test active");
- return;
- }
-
- let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
- info("Observer: " + aData + " for " + engine.name);
- let method;
- switch (aData) {
- case "engine-added":
- if (gCurrentTest.added)
- method = "added"
- break;
- case "engine-current":
- if (gCurrentTest.current)
- method = "current";
- break;
- case "engine-removed":
- if (gCurrentTest.removed)
- method = "removed";
- break;
- }
-
- if (method)
- gCurrentTest[method](engine);
-}
-
-function checkEngine(checkObj, engineObj) {
- info("Checking engine");
- for (var prop in checkObj)
- is(checkObj[prop], engineObj[prop], prop + " is correct");
-}
-
-var gTests = [
- {
- name: "opensearch install",
- engine: {
- name: "Foo",
- alias: null,
- description: "Foo Search",
- searchForm: "http://mochi.test:8888/browser/browser/components/search/test/",
- type: Ci.nsISearchEngine.TYPE_OPENSEARCH
- },
- run: function () {
- gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml",
- Ci.nsISearchEngine.DATA_XML, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC",
- false);
- },
- added: function (engine) {
- ok(engine, "engine was added.");
-
- checkEngine(this.engine, engine);
-
- let engineFromSS = gSS.getEngineByName(this.engine.name);
- is(engine, engineFromSS, "engine is obtainable via getEngineByName");
-
- let aEngine = gSS.getEngineByAlias("fooalias");
- ok(!aEngine, "Alias was not parsed from engine description");
-
- gSS.currentEngine = engine;
- },
- current: function (engine) {
- let currentEngine = gSS.currentEngine;
- is(engine, currentEngine, "engine is current");
- is(engine.name, this.engine.name, "current engine was changed successfully");
-
- gSS.removeEngine(engine);
- },
- removed: function (engine) {
- let currentEngine = gSS.currentEngine;
- ok(currentEngine, "An engine is present.");
- isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");
-
- nextTest();
- }
- },
- {
- name: "sherlock install",
- engine: {
- name: "Test Sherlock",
- alias: null,
- description: "Test Description",
- searchForm: "http://example.com/searchform",
- type: Ci.nsISearchEngine.TYPE_SHERLOCK
- },
- run: function () {
- gSS.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.src",
- Ci.nsISearchEngine.DATA_TEXT, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC",
- false);
- },
- added: function (engine) {
- ok(engine, "engine was added.");
- checkEngine(this.engine, engine);
-
- let engineFromSS = gSS.getEngineByName(this.engine.name);
- is(engineFromSS, engine, "engine is obtainable via getEngineByName");
-
- gSS.removeEngine(engine);
- },
- removed: function (engine) {
- let currentEngine = gSS.currentEngine;
- ok(currentEngine, "An engine is present.");
- isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");
-
- nextTest();
- }
- }
-];
-
-var gCurrentTest = null;
-function nextTest() {
- if (gTests.length) {
- gCurrentTest = gTests.shift();
- info("Running " + gCurrentTest.name);
- gCurrentTest.run();
- } else
- executeSoon(finish);
-}
-
-function test() {
- waitForExplicitFinish();
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- registerCleanupFunction(cleanup);
-
- nextTest();
-}
-
-function cleanup() {
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
-}
diff --git a/browser/components/search/test/browser_contextmenu.js b/browser/components/search/test/browser_contextmenu.js
deleted file mode 100644
index f34bbc60b..000000000
--- a/browser/components/search/test/browser_contextmenu.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * * http://creativecommons.org/publicdomain/zero/1.0/ */
-/*
- * Test searching for the selected text using the context menu
- */
-
-function test() {
- waitForExplicitFinish();
-
- const ss = Services.search;
- const ENGINE_NAME = "Foo";
- var contextMenu;
-
- function observer(aSub, aTopic, aData) {
- switch (aData) {
- case "engine-added":
- var engine = ss.getEngineByName(ENGINE_NAME);
- ok(engine, "Engine was added.");
- ss.currentEngine = engine;
- break;
- case "engine-current":
- is(ss.currentEngine.name, ENGINE_NAME, "currentEngine set");
- startTest();
- break;
- case "engine-removed":
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
- finish();
- break;
- }
- }
-
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- ss.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine_mozsearch.xml",
- Ci.nsISearchEngine.DATA_XML, "data:image/x-icon,%00",
- false);
-
- function startTest() {
- contextMenu = document.getElementById("contentAreaContextMenu");
- ok(contextMenu, "Got context menu XUL");
-
- doOnloadOnce(testContextMenu);
- let tab = gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
- registerCleanupFunction(function () {
- gBrowser.removeTab(tab);
- });
- }
-
- function testContextMenu() {
- function rightClickOnDocument() {
- info("rightClickOnDocument: " + content.window.location);
- waitForBrowserContextMenu(checkContextMenu);
- var clickTarget = content.document.body;
- var eventDetails = { type: "contextmenu", button: 2 };
- EventUtils.synthesizeMouseAtCenter(clickTarget, eventDetails, content);
- }
-
- // check the search menu item and then perform a search
- function checkContextMenu() {
- info("checkContextMenu");
- var searchItem = contextMenu.getElementsByAttribute("id", "context-searchselect")[0];
- ok(searchItem, "Got search context menu item");
- is(searchItem.label, 'Search ' + ENGINE_NAME + ' for "test search"', "Check context menu label");
- is(searchItem.disabled, false, "Check that search context menu item is enabled");
- doOnloadOnce(checkSearchURL);
- searchItem.click();
- contextMenu.hidePopup();
- }
-
- function checkSearchURL(event) {
- is(event.originalTarget.URL,
- "http://mochi.test:8888/browser/browser/components/search/test/?test=test+search&ie=utf-8&client=app&channel=contextsearch",
- "Checking context menu search URL");
- // Remove the tab opened by the search
- gBrowser.removeCurrentTab();
- ss.removeEngine(ss.currentEngine);
- }
-
- var selectionListener = {
- notifySelectionChanged: function(doc, sel, reason) {
- if (reason != Ci.nsISelectionListener.SELECTALL_REASON || sel.toString() != "test search")
- return;
- info("notifySelectionChanged: Text selected");
- content.window.getSelection().QueryInterface(Ci.nsISelectionPrivate).
- removeSelectionListener(selectionListener);
- SimpleTest.executeSoon(rightClickOnDocument);
- }
- };
-
- // Delay the select all to avoid intermittent selection failures.
- setTimeout(function delaySelectAll() {
- info("delaySelectAll: " + content.window.location.toString());
- // add a listener to know when the selection takes effect
- content.window.getSelection().QueryInterface(Ci.nsISelectionPrivate).
- addSelectionListener(selectionListener);
- // select the text on the page
- goDoCommand('cmd_selectAll');
- }, 500);
- }
-}
diff --git a/browser/components/search/test/browser_google.js b/browser/components/search/test/browser_google.js
deleted file mode 100644
index 94b4b6e09..000000000
--- a/browser/components/search/test/browser_google.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * Test Google search plugin URLs
- */
-
-"use strict";
-
-const BROWSER_SEARCH_PREF = "browser.search.";
-
-const MOZ_PARAM_LOCALE = /\{moz:locale\}/g;
-const MOZ_PARAM_DIST_ID = /\{moz:distributionID\}/g;
-const MOZ_PARAM_OFFICIAL = /\{moz:official\}/g;
-
-// Custom search parameters
-#ifdef MOZ_OFFICIAL_BRANDING
-const MOZ_OFFICIAL = "official";
-#else
-const MOZ_OFFICIAL = "unofficial";
-#endif
-
-#if MOZ_UPDATE_CHANNEL == beta
-const GOOGLE_CLIENT = "firefox-beta";
-#elif MOZ_UPDATE_CHANNEL == aurora
-const GOOGLE_CLIENT = "firefox-aurora";
-#elif MOZ_UPDATE_CHANNEL == nightly
-const GOOGLE_CLIENT = "firefox-nightly";
-#else
-const GOOGLE_CLIENT = "firefox-a";
-#endif
-
-#expand const MOZ_DISTRIBUTION_ID = __MOZ_DISTRIBUTION_ID__;
-
-function getLocale() {
- const localePref = "general.useragent.locale";
- return getLocalizedPref(localePref, Services.prefs.getCharPref(localePref));
-}
-
-/**
- * Wrapper for nsIPrefBranch::getComplexValue.
- * @param aPrefName
- * The name of the pref to get.
- * @returns aDefault if the requested pref doesn't exist.
- */
-function getLocalizedPref(aPrefName, aDefault) {
- try {
- return Services.prefs.getComplexValue(aPrefName, Ci.nsIPrefLocalizedString).data;
- } catch (ex) {
- return aDefault;
- }
-
- return aDefault;
-}
-
-function test() {
- let engine = Services.search.getEngineByName("Google");
- ok(engine, "Google");
-
- is(Services.search.defaultEngine, engine, "Check that Google is the default search engine");
-
- let distributionID;
- try {
- distributionID = Services.prefs.getCharPref(BROWSER_SEARCH_PREF + "distributionID");
- } catch (ex) {
- distributionID = MOZ_DISTRIBUTION_ID;
- }
-
- let base = "https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&aq=t&rls={moz:distributionID}:{moz:locale}:{moz:official}&client=" + GOOGLE_CLIENT;
- base = base.replace(MOZ_PARAM_LOCALE, getLocale());
- base = base.replace(MOZ_PARAM_DIST_ID, distributionID);
- base = base.replace(MOZ_PARAM_OFFICIAL, MOZ_OFFICIAL);
-
- let url;
-
- // Test search URLs (including purposes).
- url = engine.getSubmission("foo").uri.spec;
- is(url, base, "Check search URL for 'foo'");
- url = engine.getSubmission("foo", null, "contextmenu").uri.spec;
- is(url, base + "&channel=rcs", "Check context menu search URL for 'foo'");
- url = engine.getSubmission("foo", null, "keyword").uri.spec;
- is(url, base + "&channel=fflb", "Check keyword search URL for 'foo'");
-
- // Check search suggestion URL.
- url = engine.getSubmission("foo", "application/x-suggestions+json").uri.spec;
- is(url, "https://www.google.com/complete/search?client=firefox&q=foo", "Check search suggestion URL for 'foo'");
-
- // Check all other engine properties.
- const EXPECTED_ENGINE = {
- name: "Google",
- alias: null,
- description: "Google Search",
- searchForm: "https://www.google.com/",
- type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
- hidden: false,
- wrappedJSObject: {
- "_iconURL": "data:image/x-icon;base64,AAABAAIAEBAAAAAAAAB9AQAAJgAAACAgAAAAAAAA8gIAAKMBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAFESURBVDjLpZNJSwNBEIXnt4lE4kHxovgT9BDwJHqPy0HEEOJBiAuCRg+KUdC4QS4KrpC4gCBGE3NQ48JsnZ6eZ3UOM6gjaePhQU93v6+qq2q0pqgeJj2S8EdJT1hr0OxBtKCD5iEd8QxDYpvhvOBAuMDKURX9C9aPu4GA1GEVkzvMg10UBfYveWAWgYAP00V01fa+R9M2bA51wJvhIn3qR+ybt3D3JNQBE5sMjCIOLFpoHzOwdsLRO22qA6R6kiZiWwxUvy/PUQZIhYZ1vFM9cvcOOsYNdcBgysISdSJBnZjJMlR0Fw8vAp0xoz5gao/h+NZBy4i/10XGwrPA+hmvDyhVRG2Avu/LwcrkFADZa16L1h330w1RNgc3DiJzCpPYRm1bpveXX11clQR28xwblHpk1vq1iP/5mcoS0CoXDZiL0vsJ+dzfl+3T/VYAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAK5SURBVFjDxVfrSxRRFJ9/Jta/oyWjF5XQm6D6EkHRgygIIgjUTcueVgqVWSRRkppEUQYWWB8ye1iGWilWlo/Ude489s7M6Zw7D9dlt53dmd29cFiWvXvO77x+51xpaaUsoSxBaUWZQ4ECy5xji2xKZDyCMlMEw6lCNiOSgwZKJK1SkcKeSealfP64t0mBjl4Ow39MkDUL0p2RSROOtqhZdeUEYM1pBl39XCg/fEeFtWcY7G9W4csvUxjlBkCsQ4Nt9QyWVfvT6RsAKXw3aoDGATZeYIt+W1kjw7cJG0RctWDTRebbKd8A6h5pwsDb70ba3w/eUr3wt/cmwgfw6Yft4TNMQaY7o1P2ncm4FT4ANQH/jQBJ2xv7kqIXEADDql8eS3+n8bku7oxNm+EDIM/dU92upb3T/NJGeaNbDx/AsbsLRUY5Xn92caWXY5d8RV6gWllxSg4fAEnTC90DQW13BLlgXR2D3dcUeDVkwOthA1bXspxILWcm3HdThcfvufB26LcJpkOEAz9NKI/lzqpSEC7feol5EWnpSeSlIxCALUkApmULdjUqxQVAQnl3D/X/yQda4QBEq2TYc12By091MQ17Bg3R88nHKlQbVmHvj89awNBLYrwT9zXY2aBAxTkGFdiSxP/Jp6FLDw+AS7GfsdJTJ2EqSO5khD43nGfBARy/ZxOQgZHe7GPM1jzUvChUtmnBAXQPcKGMJp3fdFGq6NByEhiAO4b/YptFfQJwNyQ/bZkVQGcf90Ja25ndIyrKBOa/f8wIpwi3X1G8UcxNu7ozUS7tiH0jBswwS3RIaF1w6LYKU/ML2+8sGnjygQswtKrVIy/Qd9qQP6LnO64q4fPAKpxyZIymHo1jWk6p1ag2BsdNwQMHcC+M5kHFJX+YlPxpVlbCx2mZ5DzPI04k4kUwHHdskU3pH76iftG8yWlkAAAAAElFTkSuQmCC",
- _urls : [
- {
- type: "application/x-suggestions+json",
- method: "GET",
- template: "https://www.google.com/complete/search?client=firefox&q={searchTerms}",
- params: "",
- },
- {
- type: "text/html",
- method: "GET",
- template: "https://www.google.com/search",
- params: [
- {
- "name": "q",
- "value": "{searchTerms}",
- "purpose": undefined,
- },
- {
- "name": "ie",
- "value": "utf-8",
- "purpose": undefined,
- },
- {
- "name": "oe",
- "value": "utf-8",
- "purpose": undefined,
- },
- {
- "name": "aq",
- "value": "t",
- "purpose": undefined,
- },
- {
- "name": "rls",
- "value": "{moz:distributionID}:{moz:locale}:{moz:official}",
- "purpose": undefined,
- },
- {
- "name": "client",
- "value": GOOGLE_CLIENT,
- "purpose": undefined,
- },
- {
- "name": "channel",
- "value": "rcs",
- "purpose": "contextmenu",
- },
- {
- "name": "channel",
- "value": "fflb",
- "purpose": "keyword",
- },
- {
- "name": "channel",
- "value": "np",
- "purpose": "homepage",
- },
- {
- "name": "source",
- "value": "hp",
- "purpose": "homepage",
- },
- ],
- mozparams: {
- "client": {
- "name": "client",
- "falseValue": "firefox",
- "trueValue": GOOGLE_CLIENT,
- "condition": "defaultEngine",
- "mozparam": true,
- },
- },
- },
- ],
- },
- };
-
- isSubObjectOf(EXPECTED_ENGINE, engine, "Google");
-}
diff --git a/browser/components/search/test/browser_healthreport.js b/browser/components/search/test/browser_healthreport.js
deleted file mode 100644
index 0cbe2e88c..000000000
--- a/browser/components/search/test/browser_healthreport.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
- requestLongerTimeout(2);
- waitForExplicitFinish();
-
- try {
- let cm = Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Components.interfaces.nsICategoryManager);
- cm.getCategoryEntry("healthreport-js-provider-default", "SearchesProvider");
- } catch (ex) {
- // Health Report disabled, or no SearchesProvider.
- // We need a test or else we'll be marked as failure.
- ok(true, "Firefox Health Report is not enabled.");
- finish();
- return;
- }
-
- function testFHR() {
- let reporter = Components.classes["@mozilla.org/datareporting/service;1"]
- .getService()
- .wrappedJSObject
- .healthReporter;
- ok(reporter, "Health Reporter available.");
- reporter.onInit().then(function onInit() {
- let provider = reporter.getProvider("org.mozilla.searches");
- let m = provider.getMeasurement("counts", 2);
-
- m.getValues().then(function onData(data) {
- let now = new Date();
- let oldCount = 0;
-
- // Foo engine goes into "other" bucket.
- let field = "other.searchbar";
-
- if (data.days.hasDay(now)) {
- let day = data.days.getDay(now);
- if (day.has(field)) {
- oldCount = day.get(field);
- }
- }
-
- // Now perform a search and ensure the count is incremented.
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
- let searchBar = BrowserSearch.searchBar;
-
- searchBar.value = "firefox health report";
- searchBar.focus();
-
- function afterSearch() {
- searchBar.value = "";
- gBrowser.removeTab(tab);
-
- m.getValues().then(function onData(data) {
- ok(data.days.hasDay(now), "Have data for today.");
- let day = data.days.getDay(now);
-
- is(day.get(field), oldCount + 1, "Performing a search increments FHR count by 1.");
-
- let engine = Services.search.getEngineByName("Foo");
- Services.search.removeEngine(engine);
- });
- }
-
- EventUtils.synthesizeKey("VK_RETURN", {});
- executeSoon(() => executeSoon(afterSearch));
- });
- });
- }
-
- function observer(subject, topic, data) {
- switch (data) {
- case "engine-added":
- let engine = Services.search.getEngineByName("Foo");
- ok(engine, "Engine was added.");
- Services.search.currentEngine = engine;
- break;
-
- case "engine-current":
- is(Services.search.currentEngine.name, "Foo", "Current engine is Foo");
- testFHR();
- break;
-
- case "engine-removed":
- Services.obs.removeObserver(observer, "browser-search-engine-modified");
- finish();
- break;
- }
- }
-
- Services.obs.addObserver(observer, "browser-search-engine-modified", false);
- Services.search.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml",
- Ci.nsISearchEngine.DATA_XML,
- "data:image/x-icon,%00",
- false);
-
-}
-
diff --git a/browser/components/search/test/browser_private_search_perwindowpb.js b/browser/components/search/test/browser_private_search_perwindowpb.js
deleted file mode 100644
index 24c733e5e..000000000
--- a/browser/components/search/test/browser_private_search_perwindowpb.js
+++ /dev/null
@@ -1,116 +0,0 @@
-// This test performs a search in a public window, then a different
-// search in a private window, and then checks in the public window
-// whether there is an autocomplete entry for the private search.
-
-function test() {
- // Don't use about:home as the homepage for new windows
- Services.prefs.setIntPref("browser.startup.page", 0);
- registerCleanupFunction(function() Services.prefs.clearUserPref("browser.startup.page"));
-
- waitForExplicitFinish();
-
- let engineURL =
- "http://mochi.test:8888/browser/browser/components/search/test/";
- let windowsToClose = [];
- registerCleanupFunction(function() {
- let engine = Services.search.getEngineByName("Bug 426329");
- Services.search.removeEngine(engine);
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- function onPageLoad(aWin, aCallback) {
- aWin.gBrowser.addEventListener("DOMContentLoaded", function load(aEvent) {
- let doc = aEvent.originalTarget;
- info(doc.location.href);
- if (doc.location.href.indexOf(engineURL) != -1) {
- aWin.gBrowser.removeEventListener("DOMContentLoaded", load, false);
- aCallback();
- }
- }, false);
- }
-
- function performSearch(aWin, aIsPrivate, aCallback) {
- let searchBar = aWin.BrowserSearch.searchBar;
- ok(searchBar, "got search bar");
- onPageLoad(aWin, aCallback);
-
- searchBar.value = aIsPrivate ? "private test" : "public test";
- searchBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {}, aWin);
- }
-
- function addEngine(aCallback) {
- let installCallback = {
- onSuccess: function (engine) {
- Services.search.currentEngine = engine;
- aCallback();
- },
- onError: function (errorCode) {
- ok(false, "failed to install engine: " + errorCode);
- }
- };
- Services.search.addEngine(engineURL + "426329.xml",
- Ci.nsISearchEngine.DATA_XML,
- "data:image/x-icon,%00", false, installCallback);
- }
-
- function testOnWindow(aIsPrivate, aCallback) {
- let win = OpenBrowserWindow({ private: aIsPrivate });
- waitForFocus(function() {
- windowsToClose.push(win);
- executeSoon(function() aCallback(win));
- }, win);
- }
-
- addEngine(function() {
- testOnWindow(false, function(win) {
- performSearch(win, false, function() {
- testOnWindow(true, function(win) {
- performSearch(win, true, function() {
- testOnWindow(false, function(win) {
- checkSearchPopup(win, finish);
- });
- });
- });
- });
- });
- });
-}
-
-function checkSearchPopup(aWin, aCallback) {
- let searchBar = aWin.BrowserSearch.searchBar;
- searchBar.value = "p";
- searchBar.focus();
-
- let popup = searchBar.textbox.popup;
- popup.addEventListener("popupshowing", function showing() {
- popup.removeEventListener("popupshowing", showing, false);
-
- let entries = getMenuEntries(searchBar);
- for (let i = 0; i < entries.length; i++) {
- isnot(entries[i], "private test",
- "shouldn't see private autocomplete entries");
- }
-
- searchBar.textbox.toggleHistoryPopup();
- searchBar.value = "";
- aCallback();
- }, false);
-
- searchBar.textbox.showHistoryPopup();
-}
-
-function getMenuEntries(searchBar) {
- let entries = [];
- let autocompleteMenu = searchBar.textbox.popup;
- // Could perhaps pull values directly from the controller, but it seems
- // more reliable to test the values that are actually in the tree?
- let column = autocompleteMenu.tree.columns[0];
- let numRows = autocompleteMenu.tree.view.rowCount;
- for (let i = 0; i < numRows; i++) {
- entries.push(autocompleteMenu.tree.view.getValueAt(i, column));
- }
- return entries;
-}
diff --git a/browser/components/search/test/head.js b/browser/components/search/test/head.js
deleted file mode 100644
index f9db47879..000000000
--- a/browser/components/search/test/head.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Recursively compare two objects and check that every property of expectedObj has the same value
- * on actualObj.
- */
-function isSubObjectOf(expectedObj, actualObj, name) {
- for (let prop in expectedObj) {
- if (typeof expectedObj[prop] == 'function')
- continue;
- if (expectedObj[prop] instanceof Object) {
- is(actualObj[prop].length, expectedObj[prop].length, name + "[" + prop + "]");
- isSubObjectOf(expectedObj[prop], actualObj[prop], name + "[" + prop + "]");
- } else {
- is(actualObj[prop], expectedObj[prop], name + "[" + prop + "]");
- }
- }
-}
-
-function waitForPopupShown(aPopupId, aCallback) {
- let popup = document.getElementById(aPopupId);
- info("waitForPopupShown: got popup: " + popup.id);
- function onPopupShown() {
- info("onPopupShown");
- removePopupShownListener();
- SimpleTest.executeSoon(aCallback);
- }
- function removePopupShownListener() {
- popup.removeEventListener("popupshown", onPopupShown);
- }
- popup.addEventListener("popupshown", onPopupShown);
- registerCleanupFunction(removePopupShownListener);
-}
-
-function waitForBrowserContextMenu(aCallback) {
- waitForPopupShown(gBrowser.selectedBrowser.contextMenu, aCallback);
-}
-
-function doOnloadOnce(aCallback) {
- function doOnloadOnceListener(aEvent) {
- info("doOnloadOnce: " + aEvent.originalTarget.location);
- removeDoOnloadOnceListener();
- SimpleTest.executeSoon(function doOnloadOnceCallback() {
- aCallback(aEvent);
- });
- }
- function removeDoOnloadOnceListener() {
- gBrowser.removeEventListener("load", doOnloadOnceListener, true);
- }
- gBrowser.addEventListener("load", doOnloadOnceListener, true);
- registerCleanupFunction(removeDoOnloadOnceListener);
-}
diff --git a/browser/components/search/test/moz.build b/browser/components/search/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/search/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/components/search/test/test.html b/browser/components/search/test/test.html
deleted file mode 100644
index a39bece4f..000000000
--- a/browser/components/search/test/test.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8" />
- <title>Bug 426329</title>
-</head>
-<body></body>
-</html>
diff --git a/browser/components/search/test/testEngine.src b/browser/components/search/test/testEngine.src
deleted file mode 100644
index eb39fe826..000000000
--- a/browser/components/search/test/testEngine.src
+++ /dev/null
@@ -1,11 +0,0 @@
-<search
- name="Test Sherlock"
- description="Test Description"
- method="GET"
- searchform="http://example.com/searchform"
- action="http://example.com/action"
- queryCharset="UTF-8"
->
- <input name="userParam" user>
- <input name="param" value="value">
-</search>
diff --git a/browser/components/search/test/testEngine.xml b/browser/components/search/test/testEngine.xml
deleted file mode 100644
index 21ddc4b9a..000000000
--- a/browser/components/search/test/testEngine.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
- xmlns:moz="http://www.mozilla.org/2006/browser/search/">
- <ShortName>Foo</ShortName>
- <Description>Foo Search</Description>
- <InputEncoding>utf-8</InputEncoding>
- <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
- <Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/?search">
- <Param name="test" value="{searchTerms}"/>
- </Url>
- <moz:SearchForm>http://mochi.test:8888/browser/browser/components/search/test/</moz:SearchForm>
- <moz:Alias>fooalias</moz:Alias>
-</OpenSearchDescription>
diff --git a/browser/components/search/test/testEngine_mozsearch.xml b/browser/components/search/test/testEngine_mozsearch.xml
deleted file mode 100644
index 1f691965e..000000000
--- a/browser/components/search/test/testEngine_mozsearch.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
- <ShortName>Foo</ShortName>
- <Description>Foo Search</Description>
- <InputEncoding>utf-8</InputEncoding>
- <Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
- <Url type="application/x-suggestions+json" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/?suggestions&amp;locale={moz:locale}&amp;test={searchTerms}"/>
- <Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/">
- <Param name="test" value="{searchTerms}"/>
- <Param name="ie" value="utf-8"/>
- <MozParam name="client" condition="defaultEngine" trueValue="app-default" falseValue="app"/>
- <MozParam name="channel" condition="purpose" purpose="keyword" value="keywordsearch"/>
- <MozParam name="channel" condition="purpose" purpose="contextmenu" value="contextsearch"/>
- </Url>
- <SearchForm>http://mochi.test:8888/browser/browser/components/search/test/</SearchForm>
-</SearchPlugin>
diff --git a/browser/components/sessionstore/moz.build b/browser/components/sessionstore/moz.build
index 9fbf063f7..11e98fb4d 100644
--- a/browser/components/sessionstore/moz.build
+++ b/browser/components/sessionstore/moz.build
@@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['src']
-TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsISessionStartup.idl',
diff --git a/browser/components/sessionstore/test/Makefile.in b/browser/components/sessionstore/test/Makefile.in
deleted file mode 100644
index 6c12283e9..000000000
--- a/browser/components/sessionstore/test/Makefile.in
+++ /dev/null
@@ -1,169 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-# browser_506482.js is disabled because of frequent failures (bug 538672)
-# browser_526613.js is disabled because of frequent failures (bug 534489)
-# browser_589246.js is disabled for leaking browser windows (bug 752467)
-# browser_580512.js is disabled for leaking browser windows (bug 752467)
-# browser_707862.js & browser_705597.js are disabled whilst waiting for review (bug 861700 & bug 883592)
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_attributes.js \
- browser_capabilities.js \
- browser_dying_cache.js \
- browser_form_restore_events.js \
- browser_form_restore_events_sample.html \
- browser_formdata_format.js \
- browser_formdata_format_sample.html \
- browser_input.js \
- browser_input_sample.html \
- browser_pageshow.js \
- browser_windowRestore_perwindowpb.js \
- browser_248970_b_perwindowpb.js \
- browser_248970_b_sample.html \
- browser_339445.js \
- browser_339445_sample.html \
- browser_345898.js \
- browser_346337.js \
- browser_346337_sample.html \
- browser_350525.js \
- browser_354894_perwindowpb.js \
- browser_367052.js \
- browser_393716.js \
- browser_394759_basic.js \
- browser_394759_behavior.js \
- browser_394759_perwindowpb.js \
- browser_394759_purge.js \
- browser_408470.js \
- browser_408470_sample.html \
- browser_423132.js \
- browser_423132_sample.html \
- browser_447951.js \
- browser_447951_sample.html \
- browser_448741.js \
- browser_454908.js \
- browser_454908_sample.html \
- browser_456342.js \
- browser_456342_sample.xhtml \
- browser_461634.js \
- browser_463205.js \
- browser_463205_helper.html \
- browser_463205_sample.html \
- browser_463206.js \
- browser_463206_sample.html \
- browser_464199.js \
- browser_465215.js \
- browser_465223.js \
- browser_466937.js \
- browser_466937_sample.html \
- browser_467409-backslashplosion.js \
- browser_477657.js \
- browser_480148.js \
- browser_480893.js \
- browser_483330.js \
- browser_485482.js \
- browser_485482_sample.html \
- browser_485563.js \
- browser_490040.js \
- browser_491168.js \
- browser_491577.js \
- browser_495495.js \
- browser_500328.js \
- browser_514751.js \
- browser_522375.js \
- browser_522545.js \
- browser_524745.js \
- browser_528776.js \
- browser_579868.js \
- browser_579879.js \
- browser_581593.js \
- browser_581937.js \
- browser_586147.js \
- browser_586068-apptabs.js \
- browser_586068-apptabs_ondemand.js \
- browser_586068-browser_state_interrupted.js \
- browser_586068-cascade.js \
- browser_586068-multi_window.js \
- browser_586068-reload.js \
- browser_586068-select.js \
- browser_586068-window_state.js \
- browser_586068-window_state_override.js \
- browser_588426.js \
- browser_590268.js \
- browser_590563.js \
- browser_595601-restore_hidden.js \
- browser_597315.js \
- browser_597315_index.html \
- browser_597315_a.html \
- browser_597315_b.html \
- browser_597315_c.html \
- browser_597315_c1.html \
- browser_597315_c2.html \
- browser_599909.js \
- browser_600545.js \
- browser_601955.js \
- browser_607016.js \
- browser_615394-SSWindowState_events.js \
- browser_618151.js \
- browser_623779.js \
- browser_624727.js \
- browser_625257.js \
- browser_628270.js \
- browser_635418.js \
- browser_636279.js \
- browser_637020.js \
- browser_637020_slow.sjs \
- browser_644409-scratchpads.js \
- browser_645428.js \
- browser_659591.js \
- browser_662743.js \
- browser_662743_sample.html \
- browser_662812.js \
- browser_665702-state_session.js \
- browser_682507.js \
- browser_687710.js \
- browser_687710_2.js \
- browser_694378.js \
- browser_701377.js \
- browser_739531.js \
- browser_739531_sample.html \
- browser_739805.js \
- browser_819510_perwindowpb.js \
- browser_833286_atomic_backup.js \
- $(filter disabled-for-intermittent-failures--bug-766044, browser_459906_empty.html) \
- $(filter disabled-for-intermittent-failures--bug-766044, browser_459906_sample.html) \
- $(filter disabled-for-intermittent-failures--bug-765389, browser_461743_sample.html) \
- $(NULL)
-
-# Disabled on Windows for frequent intermittent failures
-ifneq ($(OS_ARCH), WINNT)
-MOCHITEST_FILES += \
- browser_464620_a.js \
- browser_464620_a.html \
- browser_464620_b.js \
- browser_464620_b.html \
- browser_464620_xd.html \
- $(NULL)
-else
-$(filter disabled-for-intermittent-failures-on-windows--bug-552424, browser_464620_a.js)
-$(filter disabled-for-intermittent-failures-on-windows--bug-552424, browser_464620_b.js)
-endif
-
-ifneq ($(OS_ARCH),Darwin)
-MOCHITEST_BROWSER_FILES += \
- browser_597071.js \
- browser_625016.js \
- $(NULL)
-endif
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js b/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
deleted file mode 100644
index 13334fb28..000000000
--- a/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test (B) for Bug 248970 **/
- waitForExplicitFinish();
-
- let windowsToClose = [];
- let file = Services.dirsvc.get("TmpD", Ci.nsIFile);
- let filePath = file.path;
- let fieldList = {
- "//input[@name='input']": Date.now().toString(),
- "//input[@name='spaced 1']": Math.random().toString(),
- "//input[3]": "three",
- "//input[@type='checkbox']": true,
- "//input[@name='uncheck']": false,
- "//input[@type='radio'][1]": false,
- "//input[@type='radio'][2]": true,
- "//input[@type='radio'][3]": false,
- "//select": 2,
- "//select[@multiple]": [1, 3],
- "//textarea[1]": "",
- "//textarea[2]": "Some text... " + Math.random(),
- "//textarea[3]": "Some more text\n" + new Date(),
- "//input[@type='file']": filePath
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- function test(aLambda) {
- try {
- return aLambda() || true;
- } catch(ex) { }
- return false;
- }
-
- function getElementByXPath(aTab, aQuery) {
- let doc = aTab.linkedBrowser.contentDocument;
- let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
- return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
- }
-
- function setFormValue(aTab, aQuery, aValue) {
- let node = getElementByXPath(aTab, aQuery);
- if (typeof aValue == "string")
- node.value = aValue;
- else if (typeof aValue == "boolean")
- node.checked = aValue;
- else if (typeof aValue == "number")
- node.selectedIndex = aValue;
- else
- Array.forEach(node.options, function(aOpt, aIx)
- (aOpt.selected = aValue.indexOf(aIx) > -1));
- }
-
- function compareFormValue(aTab, aQuery, aValue) {
- let node = getElementByXPath(aTab, aQuery);
- if (!node)
- return false;
- if (node instanceof Ci.nsIDOMHTMLInputElement)
- return aValue == (node.type == "checkbox" || node.type == "radio" ?
- node.checked : node.value);
- if (node instanceof Ci.nsIDOMHTMLTextAreaElement)
- return aValue == node.value;
- if (!node.multiple)
- return aValue == node.selectedIndex;
- return Array.every(node.options, function(aOpt, aIx)
- (aValue.indexOf(aIx) > -1) == aOpt.selected);
- }
-
- //////////////////////////////////////////////////////////////////
- // Test (B) : Session data restoration between windows //
- //////////////////////////////////////////////////////////////////
-
- let rootDir = getRootDirectory(gTestPath);
- const testURL = rootDir + "browser_248970_b_sample.html";
- const testURL2 = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_248970_b_sample.html";
-
- whenNewWindowLoaded(false, function(aWin) {
- windowsToClose.push(aWin);
-
- // get closed tab count
- let count = ss.getClosedTabCount(aWin);
- let max_tabs_undo =
- Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
- ok(0 <= count && count <= max_tabs_undo,
- "getClosedTabCount should return zero or at most max_tabs_undo");
-
- // setup a state for tab (A) so we can check later that is restored
- let key = "key";
- let value = "Value " + Math.random();
- let state = { entries: [{ url: testURL }], extData: { key: value } };
-
- // public session, add new tab: (A)
- let tab_A = aWin.gBrowser.addTab(testURL);
- ss.setTabState(tab_A, JSON.stringify(state));
- whenBrowserLoaded(tab_A.linkedBrowser, function() {
- // make sure that the next closed tab will increase getClosedTabCount
- Services.prefs.setIntPref(
- "browser.sessionstore.max_tabs_undo", max_tabs_undo + 1)
-
- // populate tab_A with form data
- for (let i in fieldList)
- setFormValue(tab_A, i, fieldList[i]);
-
- // public session, close tab: (A)
- aWin.gBrowser.removeTab(tab_A);
-
- // verify that closedTabCount increased
- ok(ss.getClosedTabCount(aWin) > count,
- "getClosedTabCount has increased after closing a tab");
-
- // verify tab: (A), in undo list
- let tab_A_restored = test(function() ss.undoCloseTab(aWin, 0));
- ok(tab_A_restored, "a tab is in undo list");
- whenBrowserLoaded(tab_A_restored.linkedBrowser, function() {
- is(testURL, tab_A_restored.linkedBrowser.currentURI.spec,
- "it's the same tab that we expect");
- aWin.gBrowser.removeTab(tab_A_restored);
-
- whenNewWindowLoaded(true, function(aWin) {
- windowsToClose.push(aWin);
-
- // setup a state for tab (B) so we can check that its duplicated
- // properly
- let key1 = "key1";
- let value1 = "Value " + Math.random();
- let state1 = {
- entries: [{ url: testURL2 }], extData: { key1: value1 }
- };
-
- let tab_B = aWin.gBrowser.addTab(testURL2);
- ss.setTabState(tab_B, JSON.stringify(state1));
- whenBrowserLoaded(tab_B.linkedBrowser, function() {
- // populate tab: (B) with different form data
- for (let item in fieldList)
- setFormValue(tab_B, item, fieldList[item]);
-
- // duplicate tab: (B)
- let tab_C = aWin.gBrowser.duplicateTab(tab_B);
- whenBrowserLoaded(tab_C.linkedBrowser, function() {
- // verify the correctness of the duplicated tab
- is(ss.getTabValue(tab_C, key1), value1,
- "tab successfully duplicated - correct state");
-
- for (let item in fieldList)
- ok(compareFormValue(tab_C, item, fieldList[item]),
- "The value for \"" + item + "\" was correctly duplicated");
-
- // private browsing session, close tab: (C) and (B)
- aWin.gBrowser.removeTab(tab_C);
- aWin.gBrowser.removeTab(tab_B);
-
- finish();
- });
- });
- });
- });
- });
- });
-}
diff --git a/browser/components/sessionstore/test/browser_248970_b_sample.html b/browser/components/sessionstore/test/browser_248970_b_sample.html
deleted file mode 100644
index 76c3ae1aa..000000000
--- a/browser/components/sessionstore/test/browser_248970_b_sample.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<meta charset="utf-8">
-<title>Test for bug 248970</title>
-
-<h3>Text Fields</h3>
-<input type="text" name="input">
-<input type="text" name="spaced 1">
-<input>
-
-<h3>Checkboxes and Radio buttons</h3>
-<input type="checkbox" name="check"> Check 1
-<input type="checkbox" name="uncheck" checked> Check 2
-<p>
-<input type="radio" name="group" value="1"> Radio 1
-<input type="radio" name="group" value="some"> Radio 2
-<input type="radio" name="group" checked> Radio 3
-
-<h3>Selects</h3>
-<select name="any">
- <option value="1"> Select 1
- <option value="some"> Select 2
- <option>Select 3
-</select>
-<select multiple="multiple">
- <option value=1> Multi-select 1
- <option value=2> Multi-select 2
- <option value=3> Multi-select 3
- <option value=4> Multi-select 4
-</select>
-
-<h3>Text Areas</h3>
-<textarea name="testarea"></textarea>
-<textarea name="sized one" rows="5" cols="25"></textarea>
-<textarea></textarea>
-
-<h3>File Selector</h3>
-<input type="file">
diff --git a/browser/components/sessionstore/test/browser_339445.js b/browser/components/sessionstore/test/browser_339445.js
deleted file mode 100644
index c130c019f..000000000
--- a/browser/components/sessionstore/test/browser_339445.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 339445 **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_339445_sample.html";
-
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
- is(doc.getElementById("storageTestItem").textContent, "PENDING",
- "sessionStorage value has been set");
-
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- let doc2 = tab2.linkedBrowser.contentDocument;
- is(doc2.getElementById("storageTestItem").textContent, "SUCCESS",
- "sessionStorage value has been duplicated");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_339445_sample.html b/browser/components/sessionstore/test/browser_339445_sample.html
deleted file mode 100644
index 32656a8d9..000000000
--- a/browser/components/sessionstore/test/browser_339445_sample.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<meta charset="utf-8">
-<title>Test for bug 339445</title>
-
-storageTestItem = <span id="storageTestItem">FAIL</span>
-
-<!--
- storageTestItem's textContent will be one of the following:
- * FAIL : sessionStorage wasn't available
- * PENDING : the test value has been initialized on first load
- * SUCCESS : the test value was correctly retrieved
--->
-
-<script type="application/javascript">
- document.getElementById("storageTestItem").textContent =
- sessionStorage["storageTestItem"] || "PENDING";
- sessionStorage["storageTestItem"] = "SUCCESS";
-</script>
diff --git a/browser/components/sessionstore/test/browser_345898.js b/browser/components/sessionstore/test/browser_345898.js
deleted file mode 100644
index c4dc7fbb4..000000000
--- a/browser/components/sessionstore/test/browser_345898.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 345898 **/
-
- function test(aLambda) {
- try {
- aLambda();
- return false;
- }
- catch (ex) {
- return ex.name == "NS_ERROR_ILLEGAL_VALUE";
- }
- }
-
- // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
- ok(test(function() ss.getWindowState({})),
- "Invalid window for getWindowState throws");
- ok(test(function() ss.setWindowState({}, "", false)),
- "Invalid window for setWindowState throws");
- ok(test(function() ss.getTabState({})),
- "Invalid tab for getTabState throws");
- ok(test(function() ss.setTabState({}, "{}")),
- "Invalid tab state for setTabState throws");
- ok(test(function() ss.setTabState({}, JSON.stringify({ entries: [] }))),
- "Invalid tab for setTabState throws");
- ok(test(function() ss.duplicateTab({}, {})),
- "Invalid tab for duplicateTab throws");
- ok(test(function() ss.duplicateTab({}, gBrowser.selectedTab)),
- "Invalid window for duplicateTab throws");
- ok(test(function() ss.getClosedTabData({})),
- "Invalid window for getClosedTabData throws");
- ok(test(function() ss.undoCloseTab({}, 0)),
- "Invalid window for undoCloseTab throws");
- ok(test(function() ss.undoCloseTab(window, -1)),
- "Invalid index for undoCloseTab throws");
- ok(test(function() ss.getWindowValue({}, "")),
- "Invalid window for getWindowValue throws");
- ok(test(function() ss.setWindowValue({}, "", "")),
- "Invalid window for setWindowValue throws");
-}
diff --git a/browser/components/sessionstore/test/browser_346337.js b/browser/components/sessionstore/test/browser_346337.js
deleted file mode 100644
index 8b000b365..000000000
--- a/browser/components/sessionstore/test/browser_346337.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 346337 **/
-
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsILocalFile);
- file.append("346337_test1.file");
- file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
- var filePath1 = file.path;
- file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsILocalFile);
- file.append("346337_test2.file");
- file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
- var filePath2 = file.path;
-
- let fieldList = {
- "//input[@name='input']": Date.now().toString(),
- "//input[@name='spaced 1']": Math.random().toString(),
- "//input[3]": "three",
- "//input[@type='checkbox']": true,
- "//input[@name='uncheck']": false,
- "//input[@type='radio'][1]": false,
- "//input[@type='radio'][2]": true,
- "//input[@type='radio'][3]": false,
- "//select": 2,
- "//select[@multiple]": [1, 3],
- "//textarea[1]": "",
- "//textarea[2]": "Some text... " + Math.random(),
- "//textarea[3]": "Some more text\n" + new Date(),
- "//input[@type='file'][1]": [filePath1],
- "//input[@type='file'][2]": [filePath1, filePath2]
- };
-
- function getElementByXPath(aTab, aQuery) {
- let doc = aTab.linkedBrowser.contentDocument;
- let xptype = Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE;
- return doc.evaluate(aQuery, doc, null, xptype, null).singleNodeValue;
- }
-
- function setFormValue(aTab, aQuery, aValue) {
- let node = getElementByXPath(aTab, aQuery);
- if (typeof aValue == "string")
- node.value = aValue;
- else if (typeof aValue == "boolean")
- node.checked = aValue;
- else if (typeof aValue == "number")
- node.selectedIndex = aValue;
- else if (node instanceof Ci.nsIDOMHTMLInputElement && node.type == "file")
- node.mozSetFileNameArray(aValue, aValue.length);
- else
- Array.forEach(node.options, function(aOpt, aIx)
- (aOpt.selected = aValue.indexOf(aIx) > -1));
- }
-
- function compareFormValue(aTab, aQuery, aValue) {
- let node = getElementByXPath(aTab, aQuery);
- if (!node)
- return false;
- if (node instanceof Ci.nsIDOMHTMLInputElement) {
- if (node.type == "file") {
- let fileNames = node.mozGetFileNameArray();
- return fileNames.length == aValue.length &&
- Array.every(fileNames, function(aFile) aValue.indexOf(aFile) >= 0);
- }
- return aValue == (node.type == "checkbox" || node.type == "radio" ?
- node.checked : node.value);
- }
- if (node instanceof Ci.nsIDOMHTMLTextAreaElement)
- return aValue == node.value;
- if (!node.multiple)
- return aValue == node.selectedIndex;
- return Array.every(node.options, function(aOpt, aIx)
- (aValue.indexOf(aIx) > -1) == aOpt.selected);
- }
-
- // test setup
- let tabbrowser = gBrowser;
- waitForExplicitFinish();
-
- // make sure we don't save form data at all (except for tab duplication)
- gPrefService.setIntPref("browser.sessionstore.privacy_level", 2);
-
- let rootDir = getRootDirectory(gTestPath);
- let testURL = rootDir + "browser_346337_sample.html";
- let tab = tabbrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- for (let xpath in fieldList)
- setFormValue(tab, xpath, fieldList[xpath]);
-
- let tab2 = tabbrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- for (let xpath in fieldList)
- ok(compareFormValue(tab2, xpath, fieldList[xpath]),
- "The value for \"" + xpath + "\" was correctly restored");
-
- // clean up
- tabbrowser.removeTab(tab2);
- tabbrowser.removeTab(tab);
-
- tab = undoCloseTab();
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- for (let xpath in fieldList)
- if (fieldList[xpath])
- ok(!compareFormValue(tab, xpath, fieldList[xpath]),
- "The value for \"" + xpath + "\" was correctly discarded");
-
- if (gPrefService.prefHasUserValue("browser.sessionstore.privacy_level"))
- gPrefService.clearUserPref("browser.sessionstore.privacy_level");
- // undoCloseTab can reuse a single blank tab, so we have to
- // make sure not to close the window when closing our last tab
- if (tabbrowser.tabs.length == 1)
- tabbrowser.addTab();
- tabbrowser.removeTab(tab);
- finish();
- }, true);
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_346337_sample.html b/browser/components/sessionstore/test/browser_346337_sample.html
deleted file mode 100644
index 682162d6a..000000000
--- a/browser/components/sessionstore/test/browser_346337_sample.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<title>Test for bug 346337</title>
-
-<h3>Text Fields</h3>
-<input type="text" name="input">
-<input type="text" name="spaced 1">
-<input>
-
-<h3>Checkboxes and Radio buttons</h3>
-<input type="checkbox" name="check"> Check 1
-<input type="checkbox" name="uncheck" checked> Check 2
-<p>
-<input type="radio" name="group" value="1"> Radio 1
-<input type="radio" name="group" value="some"> Radio 2
-<input type="radio" name="group" checked> Radio 3
-
-<h3>Selects</h3>
-<select name="any">
- <option value="1"> Select 1
- <option value="some"> Select 2
- <option>Select 3
-</select>
-<select multiple="multiple">
- <option value=1> Multi-select 1
- <option value=2> Multi-select 2
- <option value=3> Multi-select 3
- <option value=4> Multi-select 4
-</select>
-
-<h3>Text Areas</h3>
-<textarea name="testarea"></textarea>
-<textarea name="sized one" rows="5" cols="25"></textarea>
-<textarea></textarea>
-
-<h3>File Selector</h3>
-<input type="file">
-<input type="file" multiple>
diff --git a/browser/components/sessionstore/test/browser_350525.js b/browser/components/sessionstore/test/browser_350525.js
deleted file mode 100644
index 0dc23fe21..000000000
--- a/browser/components/sessionstore/test/browser_350525.js
+++ /dev/null
@@ -1,101 +0,0 @@
-function test() {
- /** Test for Bug 350525 **/
-
- function test(aLambda) {
- try {
- return aLambda() || true;
- }
- catch (ex) { }
- return false;
- }
-
- waitForExplicitFinish();
-
- ////////////////////////////
- // setWindowValue, et al. //
- ////////////////////////////
- let key = "Unique name: " + Date.now();
- let value = "Unique value: " + Math.random();
-
- // test adding
- ok(test(function() ss.setWindowValue(window, key, value)), "set a window value");
-
- // test retrieving
- is(ss.getWindowValue(window, key), value, "stored window value matches original");
-
- // test deleting
- ok(test(function() ss.deleteWindowValue(window, key)), "delete the window value");
-
- // value should not exist post-delete
- is(ss.getWindowValue(window, key), "", "window value was deleted");
-
- // test deleting a non-existent value
- ok(test(function() ss.deleteWindowValue(window, key)), "delete non-existent window value");
-
- /////////////////////////
- // setTabValue, et al. //
- /////////////////////////
- key = "Unique name: " + Math.random();
- value = "Unique value: " + Date.now();
- let tab = gBrowser.addTab();
- tab.linkedBrowser.stop();
-
- // test adding
- ok(test(function() ss.setTabValue(tab, key, value)), "store a tab value");
-
- // test retrieving
- is(ss.getTabValue(tab, key), value, "stored tab value match original");
-
- // test deleting
- ok(test(function() ss.deleteTabValue(tab, key)), "delete the tab value");
-
- // value should not exist post-delete
- is(ss.getTabValue(tab, key), "", "tab value was deleted");
-
- // test deleting a non-existent value
- ok(test(function() ss.deleteTabValue(tab, key)), "delete non-existent tab value");
-
- // clean up
- gBrowser.removeTab(tab);
-
- /////////////////////////////////////
- // getClosedTabCount, undoCloseTab //
- /////////////////////////////////////
-
- // get closed tab count
- let count = ss.getClosedTabCount(window);
- let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
- ok(0 <= count && count <= max_tabs_undo,
- "getClosedTabCount returns zero or at most max_tabs_undo");
-
- // create a new tab
- let testURL = "about:";
- tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- // make sure that the next closed tab will increase getClosedTabCount
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
-
- // remove tab
- gBrowser.removeTab(tab);
-
- // getClosedTabCount
- var newcount = ss.getClosedTabCount(window);
- ok(newcount > count, "after closing a tab, getClosedTabCount has been incremented");
-
- // undoCloseTab
- tab = test(function() ss.undoCloseTab(window, 0));
- ok(tab, "undoCloseTab doesn't throw")
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- is(this.currentURI.spec, testURL, "correct tab was reopened");
-
- // clean up
- if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo"))
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
- gBrowser.removeTab(tab);
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_354894_perwindowpb.js b/browser/components/sessionstore/test/browser_354894_perwindowpb.js
deleted file mode 100644
index 78e861ba0..000000000
--- a/browser/components/sessionstore/test/browser_354894_perwindowpb.js
+++ /dev/null
@@ -1,513 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Checks that restoring the last browser window in session is actually
- * working:
- * 1.1) Open a new browser window
- * 1.2) Add some tabs
- * 1.3) Close that window
- * 1.4) Opening another window
- * --> State is restored
- *
- * 2.1) Open a new browser window
- * 2.2) Add some tabs
- * 2.3) Enter private browsing mode
- * 2.4) Close the window while still in private browsing mode
- * 2.5) Opening a new window
- * --> State is not restored, because private browsing mode is still active
- * 2.6) Leaving private browsing mode
- * 2.7) Open another window
- * --> State (that was before entering PBM) is restored
- *
- * 3.1) Open a new browser window
- * 3.2) Add some tabs
- * 3.4) Open some popups
- * 3.5) Add another tab to one popup (so that it gets stored) and close it again
- * 3.5) Close the browser window
- * 3.6) Open another browser window
- * --> State of the closed browser window, but not of the popup, is restored
- *
- * 4.1) Open a popup
- * 4.2) Add another tab to the popup (so that it gets stored) and close it again
- * 4.3) Open a window
- * --> Nothing at all should be restored
- *
- * 5.1) Open two browser windows and close them again
- * 5.2) undoCloseWindow() one
- * 5.3) Open another browser window
- * --> Nothing at all should be restored
- *
- * Checks the new notifications are correctly posted and processed, that is
- * for each successful -requested a -granted is received, but omitted if
- * -requested was cnceled
- * Said notifications are:
- * - browser-lastwindow-close-requested
- * - browser-lastwindow-close-granted
- * Tests are:
- * 6) Cancel closing when first observe a -requested
- * --> Window is kept open
- * 7) Count the number of notifications
- * --> count(-requested) == count(-granted) + 1
- * --> (The first -requested was canceled, so off-by-one)
- * 8) (Mac only) Mac version of Test 5 additionally preparing Test 6
- *
- * @see https://bugzilla.mozilla.org/show_bug.cgi?id=354894
- * @note It is implicitly tested that restoring the last window works when
- * non-browser windows are around. The "Run Tests" window as well as the main
- * browser window (wherein the test code gets executed) won't be considered
- * browser windows. To achiveve this said main browser window has it's windowtype
- * attribute modified so that it's not considered a browser window any longer.
- * This is crucial, because otherwise there would be two browser windows around,
- * said main test window and the one opened by the tests, and hence the new
- * logic wouldn't be executed at all.
- * @note Mac only tests the new notifications, as restoring the last window is
- * not enabled on that platform (platform shim; the application is kept running
- * although there are no windows left)
- * @note There is a difference when closing a browser window with
- * BrowserTryToCloseWindow() as opposed to close(). The former will make
- * nsSessionStore restore a window next time it gets a chance and will post
- * notifications. The latter won't.
- */
-
-function browserWindowsCount(expected, msg) {
- if (typeof expected == "number")
- expected = [expected, expected];
- let count = 0;
- let e = Services.wm.getEnumerator("navigator:browser");
- while (e.hasMoreElements()) {
- if (!e.getNext().closed)
- ++count;
- }
- is(count, expected[0], msg + " (nsIWindowMediator)");
- let state = ss.getBrowserState();
- is(JSON.parse(state).windows.length, expected[1], msg + " (getBrowserState)");
-}
-
-function test() {
- browserWindowsCount(1, "Only one browser window should be open initially");
-
- waitForExplicitFinish();
- // This test takes some time to run, and it could timeout randomly.
- // So we require a longer timeout. See bug 528219.
- requestLongerTimeout(2);
-
- // Some urls that might be opened in tabs and/or popups
- // Do not use about:blank:
- // That one is reserved for special purposes in the tests
- const TEST_URLS = ["about:mozilla", "about:buildconfig"];
-
- // Number of -request notifications to except
- // remember to adjust when adding new tests
- const NOTIFICATIONS_EXPECTED = 6;
-
- // Window features of popup windows
- const POPUP_FEATURES = "toolbar=no,resizable=no,status=no";
-
- // Window features of browser windows
- const CHROME_FEATURES = "chrome,all,dialog=no";
-
- // Store the old window type for cleanup
- let oldWinType = "";
- // Store the old tabs.warnOnClose pref so that we may reset it during
- // cleanup
- let oldWarnTabsOnClose = gPrefService.getBoolPref("browser.tabs.warnOnClose");
-
- // Observe these, and also use to count the number of hits
- let observing = {
- "browser-lastwindow-close-requested": 0,
- "browser-lastwindow-close-granted": 0
- };
-
- /**
- * Helper: Will observe and handle the notifications for us
- */
- let hitCount = 0;
- function observer(aCancel, aTopic, aData) {
- // count so that we later may compare
- observing[aTopic]++;
-
- // handle some tests
- if (++hitCount == 1) {
- // Test 6
- aCancel.QueryInterface(Ci.nsISupportsPRBool).data = true;
- }
- }
-
- /**
- * Helper: Sets prefs as the testsuite requires
- * @note Will be reset in cleanTestSuite just before finishing the tests
- */
- function setPrefs() {
- gPrefService.setIntPref("browser.startup.page", 3);
- gPrefService.setBoolPref(
- "browser.privatebrowsing.keep_current_session",
- true
- );
- gPrefService.setBoolPref("browser.tabs.warnOnClose", false);
- }
-
- /**
- * Helper: Sets up this testsuite
- */
- function setupTestsuite(testFn) {
- // Register our observers
- for (let o in observing)
- Services.obs.addObserver(observer, o, false);
-
- // Make the main test window not count as a browser window any longer
- oldWinType = document.documentElement.getAttribute("windowtype");
- document.documentElement.setAttribute("windowtype", "navigator:testrunner");
- }
-
- /**
- * Helper: Cleans up behind the testsuite
- */
- function cleanupTestsuite(callback) {
- // Finally remove observers again
- for (let o in observing)
- Services.obs.removeObserver(observer, o);
-
- // Reset the prefs we touched
- [
- "browser.startup.page",
- "browser.privatebrowsing.keep_current_session"
- ].forEach(function (pref) {
- if (gPrefService.prefHasUserValue(pref))
- gPrefService.clearUserPref(pref);
- });
- gPrefService.setBoolPref("browser.tabs.warnOnClose", oldWarnTabsOnClose);
-
- // Reset the window type
- document.documentElement.setAttribute("windowtype", oldWinType);
- }
-
- /**
- * Helper: sets the prefs and a new window with our test tabs
- */
- function setupTestAndRun(aIsPrivateWindow, testFn) {
- // Prepare the prefs
- setPrefs();
-
- // Prepare a window; open it and add more tabs
- let options = {};
- if (aIsPrivateWindow) {
- options = {private: true};
- }
-
- let newWin = OpenBrowserWindow(options);
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
- newWin.gBrowser.addEventListener("load", function(aEvent) {
- newWin.gBrowser.removeEventListener("load", arguments.callee, true);
- TEST_URLS.forEach(function (url) {
- newWin.gBrowser.addTab(url);
- });
-
- executeSoon(function() testFn(newWin));
- }, true);
- }, false);
- }
-
- /**
- * Test 1: Normal in-session restore
- * @note: Non-Mac only
- */
- function testOpenCloseNormal(nextFn) {
- setupTestAndRun(false, function(newWin) {
- // Close the window
- // window.close doesn't push any close events,
- // so use BrowserTryToCloseWindow
- newWin.BrowserTryToCloseWindow();
-
- // The first request to close is denied by our observer (Test 6)
- ok(!newWin.closed, "First close request was denied");
- if (!newWin.closed) {
- newWin.BrowserTryToCloseWindow();
- ok(newWin.closed, "Second close request was granted");
- }
-
- // Open a new window
- // The previously closed window should be restored
- newWin = OpenBrowserWindow({});
- newWin.addEventListener("load", function() {
- this.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1,
- "Restored window in-session with otherpopup windows around");
-
- // Cleanup
- newWin.close();
-
- // Next please
- executeSoon(nextFn);
- });
- }, true);
- });
- }
-
- /**
- * Test 2: PrivateBrowsing in-session restore
- * @note: Non-Mac only
- */
- function testOpenClosePrivateBrowsing(nextFn) {
- setupTestAndRun(false, function(newWin) {
- // Close the window
- newWin.BrowserTryToCloseWindow();
-
- // Enter private browsing mode
- // Open a new window.
- // The previously closed window should NOT be restored
- newWin = OpenBrowserWindow({private: true});
- newWin.addEventListener("load", function() {
- this.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- is(newWin.gBrowser.browsers.length, 1,
- "Did not restore in private browing mode");
-
- // Cleanup
- newWin.BrowserTryToCloseWindow();
-
- // Exit private browsing mode again
- newWin = OpenBrowserWindow({});
- newWin.addEventListener("load", function() {
- this.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1,
- "Restored after leaving private browsing again");
-
- newWin.close();
-
- // Next please
- executeSoon(nextFn);
- });
- }, true);
- });
- }, true);
- });
- }
-
- /**
- * Test 3: Open some popup windows to check those aren't restored, but
- * the browser window is
- * @note: Non-Mac only
- */
- function testOpenCloseWindowAndPopup(nextFn) {
- setupTestAndRun(false, function(newWin) {
- // open some popups
- let popup = openDialog(location, "popup", POPUP_FEATURES, TEST_URLS[0]);
- let popup2 = openDialog(location, "popup2", POPUP_FEATURES, TEST_URLS[1]);
- popup2.addEventListener("load", function() {
- popup2.removeEventListener("load", arguments.callee, false);
- popup2.gBrowser.addEventListener("load", function() {
- popup2.gBrowser.removeEventListener("load", arguments.callee, true);
- popup2.gBrowser.addTab(TEST_URLS[0]);
- // close the window
- newWin.BrowserTryToCloseWindow();
-
- // Close the popup window
- // The test is successful when not this popup window is restored
- // but instead newWin
- popup2.close();
-
- // open a new window the previously closed window should be restored to
- newWin = OpenBrowserWindow({});
- newWin.addEventListener("load", function() {
- this.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- is(newWin.gBrowser.browsers.length, TEST_URLS.length + 1,
- "Restored window and associated tabs in session");
-
- // Cleanup
- newWin.close();
- popup.close();
-
- // Next please
- executeSoon(nextFn);
- });
- }, true);
- }, true);
- }, false);
- });
- }
-
- /**
- * Test 4: Open some popup window to check it isn't restored.
- * Instead nothing at all should be restored
- * @note: Non-Mac only
- */
- function testOpenCloseOnlyPopup(nextFn) {
- // prepare the prefs
- setPrefs();
-
- // This will cause nsSessionStore to restore a window the next time it
- // gets a chance.
- let popup = openDialog(location, "popup", POPUP_FEATURES, TEST_URLS[1]);
- popup.addEventListener("load", function() {
- this.removeEventListener("load", arguments.callee, true);
- is(popup.gBrowser.browsers.length, 1,
- "Did not restore the popup window (1)");
- popup.BrowserTryToCloseWindow();
-
- // Real tests
- popup = openDialog(location, "popup", POPUP_FEATURES, TEST_URLS[1]);
- popup.addEventListener("load", function() {
- popup.removeEventListener("load", arguments.callee, false);
- popup.gBrowser.addEventListener("load", function() {
- popup.gBrowser.removeEventListener("load", arguments.callee, true);
- popup.gBrowser.addTab(TEST_URLS[0]);
-
- is(popup.gBrowser.browsers.length, 2,
- "Did not restore to the popup window (2)");
-
- // Close the popup window
- // The test is successful when not this popup window is restored
- // but instead a new window is opened without restoring anything
- popup.close();
-
- let newWin = OpenBrowserWindow({});
- newWin.addEventListener("load", function() {
- newWin.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- isnot(newWin.gBrowser.browsers.length, 2,
- "Did not restore the popup window");
- is(TEST_URLS.indexOf(newWin.gBrowser.browsers[0].currentURI.spec), -1,
- "Did not restore the popup window (2)");
-
- // Cleanup
- newWin.close();
-
- // Next please
- executeSoon(nextFn);
- });
- }, true);
- }, true);
- }, false);
- }, true);
- }
-
- /**
- * Test 5: Open some windows and do undoCloseWindow. This should prevent any
- * restoring later in the test
- * @note: Non-Mac only
- */
- function testOpenCloseRestoreFromPopup(nextFn) {
- setupTestAndRun(false, function(newWin) {
- setupTestAndRun(false, function(newWin2) {
- newWin.BrowserTryToCloseWindow();
- newWin2.BrowserTryToCloseWindow();
-
- browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
-
- newWin = undoCloseWindow(0);
-
- newWin2 = OpenBrowserWindow({});
- newWin2.addEventListener("load", function() {
- newWin2.removeEventListener("load", arguments.callee, true);
- executeSoon(function() {
- is(newWin2.gBrowser.browsers.length, 1,
- "Did not restore, as undoCloseWindow() was last called");
- is(TEST_URLS.indexOf(newWin2.gBrowser.browsers[0].currentURI.spec), -1,
- "Did not restore, as undoCloseWindow() was last called (2)");
-
- browserWindowsCount([2, 3], "browser windows while running testOpenCloseRestoreFromPopup");
-
- // Cleanup
- newWin.close();
- newWin2.close();
-
- browserWindowsCount([0, 1], "browser windows while running testOpenCloseRestoreFromPopup");
-
- // Next please
- executeSoon(nextFn);
- });
- }, true);
- });
- });
- }
-
- /**
- * Test 7: Check whether the right number of notifications was received during
- * the tests
- */
- function testNotificationCount(nextFn) {
- is(observing["browser-lastwindow-close-requested"], NOTIFICATIONS_EXPECTED,
- "browser-lastwindow-close-requested notifications observed");
-
- // -request must be one more as we cancel the first one we hit,
- // and hence won't produce a corresponding -grant
- // @see observer.observe
- is(observing["browser-lastwindow-close-requested"],
- observing["browser-lastwindow-close-granted"] + 1,
- "Notification count for -request and -grant matches");
-
- executeSoon(nextFn);
- }
-
- /**
- * Test 8: Test if closing can be denied on Mac
- * Futhermore prepares the testNotificationCount test (Test 7)
- * @note: Mac only
- */
- function testMacNotifications(nextFn, iteration) {
- iteration = iteration || 1;
- setupTestAndRun(false, function(newWin) {
- // close the window
- // window.close doesn't push any close events,
- // so use BrowserTryToCloseWindow
- newWin.BrowserTryToCloseWindow();
- if (iteration == 1) {
- ok(!newWin.closed, "First close attempt denied");
- if (!newWin.closed) {
- newWin.BrowserTryToCloseWindow();
- ok(newWin.closed, "Second close attempt granted");
- }
- }
-
- if (iteration < NOTIFICATIONS_EXPECTED - 1) {
- executeSoon(function() testMacNotifications(nextFn, ++iteration));
- }
- else {
- executeSoon(nextFn);
- }
- });
- }
-
- // Execution starts here
-
- setupTestsuite();
- if (navigator.platform.match(/Mac/)) {
- // Mac tests
- testMacNotifications(function () {
- testNotificationCount(function () {
- cleanupTestsuite();
- browserWindowsCount(1, "Only one browser window should be open eventually");
- finish();
- });
- });
- }
- else {
- // Non-Mac Tests
- testOpenCloseNormal(function () {
- browserWindowsCount([0, 1], "browser windows after testOpenCloseNormal");
- testOpenClosePrivateBrowsing(function () {
- browserWindowsCount([0, 1], "browser windows after testOpenClosePrivateBrowsing");
- testOpenCloseWindowAndPopup(function () {
- browserWindowsCount([0, 1], "browser windows after testOpenCloseWindowAndPopup");
- testOpenCloseOnlyPopup(function () {
- browserWindowsCount([0, 1], "browser windows after testOpenCloseOnlyPopup");
- testOpenCloseRestoreFromPopup(function () {
- browserWindowsCount([0, 1], "browser windows after testOpenCloseRestoreFromPopup");
- testNotificationCount(function () {
- cleanupTestsuite();
- browserWindowsCount(1, "browser windows after testNotificationCount");
- finish();
- });
- });
- });
- });
- });
- });
- }
-}
diff --git a/browser/components/sessionstore/test/browser_367052.js b/browser/components/sessionstore/test/browser_367052.js
deleted file mode 100644
index ba07a21f9..000000000
--- a/browser/components/sessionstore/test/browser_367052.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 367052 **/
-
- waitForExplicitFinish();
-
- // make sure that the next closed tab will increase getClosedTabCount
- let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", max_tabs_undo + 1);
- let closedTabCount = ss.getClosedTabCount(window);
-
- // restore a blank tab
- let tab = gBrowser.addTab("about:");
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
-
- let history = tab.linkedBrowser.webNavigation.sessionHistory;
- ok(history.count >= 1, "the new tab does have at least one history entry");
-
- ss.setTabState(tab, JSON.stringify({ entries: [] }));
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- ok(history.count == 0, "the tab was restored without any history whatsoever");
-
- gBrowser.removeTab(tab);
- ok(ss.getClosedTabCount(window) == closedTabCount,
- "The closed blank tab wasn't added to Recently Closed Tabs");
-
- // clean up
- if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo"))
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_393716.js b/browser/components/sessionstore/test/browser_393716.js
deleted file mode 100644
index f6c6e6173..000000000
--- a/browser/components/sessionstore/test/browser_393716.js
+++ /dev/null
@@ -1,74 +0,0 @@
-function test() {
- /** Test for Bug 393716 **/
-
- waitForExplicitFinish();
-
- /////////////////
- // getTabState //
- /////////////////
- let key = "Unique key: " + Date.now();
- let value = "Unique value: " + Math.random();
- let testURL = "about:config";
-
- // create a new tab
- let tab = gBrowser.addTab(testURL);
- ss.setTabValue(tab, key, value);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- // get the tab's state
- let state = ss.getTabState(tab);
- ok(state, "get the tab's state");
-
- // verify the tab state's integrity
- state = JSON.parse(state);
- ok(state instanceof Object && state.entries instanceof Array && state.entries.length > 0,
- "state object seems valid");
- ok(state.entries.length == 1 && state.entries[0].url == testURL,
- "Got the expected state object (test URL)");
- ok(state.extData && state.extData[key] == value,
- "Got the expected state object (test manually set tab value)");
-
- // clean up
- gBrowser.removeTab(tab);
- }, true);
-
- //////////////////////////////////
- // setTabState and duplicateTab //
- //////////////////////////////////
- let key2 = "key2";
- let value2 = "Value " + Math.random();
- let value3 = "Another value: " + Date.now();
- let state = { entries: [{ url: testURL }], extData: { key2: value2 } };
-
- // create a new tab
- let tab2 = gBrowser.addTab();
- // set the tab's state
- ss.setTabState(tab2, JSON.stringify(state));
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- // verify the correctness of the restored tab
- ok(ss.getTabValue(tab2, key2) == value2 && this.currentURI.spec == testURL,
- "the tab's state was correctly restored");
-
- // add text data
- let textbox = this.contentDocument.getElementById("textbox");
- textbox.value = value3;
-
- // duplicate the tab
- let duplicateTab = ss.duplicateTab(window, tab2);
- gBrowser.removeTab(tab2);
-
- duplicateTab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
- // verify the correctness of the duplicated tab
- ok(ss.getTabValue(duplicateTab, key2) == value2 && this.currentURI.spec == testURL,
- "correctly duplicated the tab's state");
- let textbox = this.contentDocument.getElementById("textbox");
- is(textbox.value, value3, "also duplicated text data");
-
- // clean up
- gBrowser.removeTab(duplicateTab);
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_394759_basic.js b/browser/components/sessionstore/test/browser_394759_basic.js
deleted file mode 100644
index 5cf411d2d..000000000
--- a/browser/components/sessionstore/test/browser_394759_basic.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- waitForExplicitFinish();
-
- let testURL = "about:config";
- let uniqueKey = "bug 394759";
- let uniqueValue = "unik" + Date.now();
- let uniqueText = "pi != " + Math.random();
-
- // Be consistent: let the page actually display, as we are "interacting" with it.
- Services.prefs.setBoolPref("general.warnOnAboutConfig", false);
-
- // make sure that the next closed window will increase getClosedWindowCount
- let max_windows_undo = Services.prefs.getIntPref("browser.sessionstore.max_windows_undo");
- Services.prefs.setIntPref("browser.sessionstore.max_windows_undo", max_windows_undo + 1);
- let closedWindowCount = ss.getClosedWindowCount();
-
- provideWindow(function onTestURLLoaded(newWin) {
- newWin.gBrowser.addTab().linkedBrowser.stop();
-
- // mark the window with some unique data to be restored later on
- ss.setWindowValue(newWin, uniqueKey, uniqueValue);
- let textbox = newWin.content.document.getElementById("textbox");
- textbox.value = uniqueText;
-
- newWin.close();
-
- is(ss.getClosedWindowCount(), closedWindowCount + 1,
- "The closed window was added to Recently Closed Windows");
- let data = JSON.parse(ss.getClosedWindowData())[0];
- ok(data.title == testURL && JSON.stringify(data).indexOf(uniqueText) > -1,
- "The closed window data was stored correctly");
-
- // reopen the closed window and ensure its integrity
- let newWin2 = ss.undoCloseWindow(0);
-
- ok(newWin2 instanceof ChromeWindow,
- "undoCloseWindow actually returned a window");
- is(ss.getClosedWindowCount(), closedWindowCount,
- "The reopened window was removed from Recently Closed Windows");
-
- // SSTabRestored will fire more than once, so we need to make sure we count them
- let restoredTabs = 0;
- let expectedTabs = data.tabs.length;
- newWin2.addEventListener("SSTabRestored", function sstabrestoredListener(aEvent) {
- ++restoredTabs;
- info("Restored tab " + restoredTabs + "/" + expectedTabs);
- if (restoredTabs < expectedTabs) {
- return;
- }
-
- newWin2.removeEventListener("SSTabRestored", sstabrestoredListener, true);
-
- is(newWin2.gBrowser.tabs.length, 2,
- "The window correctly restored 2 tabs");
- is(newWin2.gBrowser.currentURI.spec, testURL,
- "The window correctly restored the URL");
-
- let textbox = newWin2.content.document.getElementById("textbox");
- is(textbox.value, uniqueText,
- "The window correctly restored the form");
- is(ss.getWindowValue(newWin2, uniqueKey), uniqueValue,
- "The window correctly restored the data associated with it");
-
- // clean up
- newWin2.close();
- Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
- Services.prefs.clearUserPref("general.warnOnAboutConfig");
- finish();
- }, true);
- }, testURL);
-}
diff --git a/browser/components/sessionstore/test/browser_394759_behavior.js b/browser/components/sessionstore/test/browser_394759_behavior.js
deleted file mode 100644
index c0bf2f2af..000000000
--- a/browser/components/sessionstore/test/browser_394759_behavior.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // This test takes quite some time, and timeouts frequently, so we require
- // more time to run.
- // See Bug 518970.
- requestLongerTimeout(2);
-
- waitForExplicitFinish();
-
- // helper function that does the actual testing
- function openWindowRec(windowsToOpen, expectedResults, recCallback) {
- // do actual checking
- if (!windowsToOpen.length) {
- let closedWindowData = JSON.parse(ss.getClosedWindowData());
- let numPopups = closedWindowData.filter(function(el, i, arr) {
- return el.isPopup;
- }).length;
- let numNormal = ss.getClosedWindowCount() - numPopups;
- // #ifdef doesn't work in browser-chrome tests, so do a simple regex on platform
- let oResults = navigator.platform.match(/Mac/) ? expectedResults.mac
- : expectedResults.other;
- is(numPopups, oResults.popup,
- "There were " + oResults.popup + " popup windows to repoen");
- is(numNormal, oResults.normal,
- "There were " + oResults.normal + " normal windows to repoen");
-
- // cleanup & return
- executeSoon(recCallback);
- return;
- }
-
- // hack to force window to be considered a popup (toolbar=no didn't work)
- let winData = windowsToOpen.shift();
- let settings = "chrome,dialog=no," +
- (winData.isPopup ? "all=no" : "all");
- let url = "http://example.com/?window=" + windowsToOpen.length;
-
- provideWindow(function onTestURLLoaded(win) {
- win.close();
- openWindowRec(windowsToOpen, expectedResults, recCallback);
- }, url, settings);
- }
-
- let windowsToOpen = [{isPopup: false},
- {isPopup: false},
- {isPopup: true},
- {isPopup: true},
- {isPopup: true}];
- let expectedResults = {mac: {popup: 3, normal: 0},
- other: {popup: 3, normal: 1}};
- let windowsToOpen2 = [{isPopup: false},
- {isPopup: false},
- {isPopup: false},
- {isPopup: false},
- {isPopup: false}];
- let expectedResults2 = {mac: {popup: 0, normal: 3},
- other: {popup: 0, normal: 3}};
- openWindowRec(windowsToOpen, expectedResults, function() {
- openWindowRec(windowsToOpen2, expectedResults2, finish);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_394759_perwindowpb.js b/browser/components/sessionstore/test/browser_394759_perwindowpb.js
deleted file mode 100644
index e16427f4e..000000000
--- a/browser/components/sessionstore/test/browser_394759_perwindowpb.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/** Private Browsing Test for Bug 394759 **/
-function test() {
- waitForExplicitFinish();
-
- let windowsToClose = [];
- let closedWindowCount = 0;
- // Prevent VM timers issues, cache now and increment it manually.
- let now = Date.now();
- const TESTS = [
- { url: "about:config",
- key: "bug 394759 Non-PB",
- value: "uniq" + (++now) },
- { url: "about:mozilla",
- key: "bug 394759 PB",
- value: "uniq" + (++now) },
- ];
-
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- function testOpenCloseWindow(aIsPrivate, aTest, aCallback) {
- whenNewWindowLoaded(aIsPrivate, function(win) {
- win.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- win.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- executeSoon(function() {
- // Mark the window with some unique data to be restored later on.
- ss.setWindowValue(win, aTest.key, aTest.value);
- // Close.
- win.close();
- aCallback();
- });
- }, true);
- win.gBrowser.selectedBrowser.loadURI(aTest.url);
- });
- }
-
- function testOnWindow(aIsPrivate, aValue, aCallback) {
- whenNewWindowLoaded(aIsPrivate, function(win) {
- windowsToClose.push(win);
- executeSoon(function() checkClosedWindows(aIsPrivate, aValue, aCallback));
- });
- }
-
- function checkClosedWindows(aIsPrivate, aValue, aCallback) {
- let data = JSON.parse(ss.getClosedWindowData())[0];
- is(ss.getClosedWindowCount(), 1, "Check the closed window count");
- ok(JSON.stringify(data).indexOf(aValue) > -1,
- "Check the closed window data was stored correctly");
- aCallback();
- }
-
- function setupBlankState(aCallback) {
- // Set interval to a large time so state won't be written while we setup
- // environment.
- Services.prefs.setIntPref("browser.sessionstore.interval", 100000);
-
- // Set up the browser in a blank state. Popup windows in previous tests
- // result in different states on different platforms.
- let blankState = JSON.stringify({
- windows: [{
- tabs: [{ entries: [{ url: "about:blank" }] }],
- _closedTabs: []
- }],
- _closedWindows: []
- });
- ss.setBrowserState(blankState);
-
- // Wait for the sessionstore.js file to be written before going on.
- // Note: we don't wait for the complete event, since if asyncCopy fails we
- // would timeout.
- Services.obs.addObserver(function (aSubject, aTopic, aData) {
- Services.obs.removeObserver(arguments.callee, aTopic);
- info("sessionstore.js is being written");
-
- closedWindowCount = ss.getClosedWindowCount();
- is(closedWindowCount, 0, "Correctly set window count");
-
- executeSoon(aCallback);
- }, "sessionstore-state-write", false);
-
- // Remove the sessionstore.js file before setting the interval to 0
- let profilePath = Services.dirsvc.get("ProfD", Ci.nsIFile);
- let sessionStoreJS = profilePath.clone();
- sessionStoreJS.append("sessionstore.js");
- if (sessionStoreJS.exists())
- sessionStoreJS.remove(false);
- info("sessionstore.js was correctly removed: " + (!sessionStoreJS.exists()));
-
- // Make sure that sessionstore.js can be forced to be created by setting
- // the interval pref to 0.
- Services.prefs.setIntPref("browser.sessionstore.interval", 0);
- }
-
- setupBlankState(function() {
- testOpenCloseWindow(false, TESTS[0], function() {
- testOpenCloseWindow(true, TESTS[1], function() {
- testOnWindow(false, TESTS[0].value, function() {
- testOnWindow(true, TESTS[0].value, finish);
- });
- });
- });
- });
-}
-
-function whenNewWindowLoaded(aIsPrivate, aCallback) {
- let win = OpenBrowserWindow({private: aIsPrivate});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- aCallback(win);
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_394759_purge.js b/browser/components/sessionstore/test/browser_394759_purge.js
deleted file mode 100644
index 3854ae4ab..000000000
--- a/browser/components/sessionstore/test/browser_394759_purge.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
-
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, "browser:purge-domain-data");
- setTimeout(aCallback, 0);
- }
- };
- Services.obs.addObserver(observer, "browser:purge-domain-data", false);
-}
-
-function test() {
- waitForExplicitFinish();
- // utility functions
- function countClosedTabsByTitle(aClosedTabList, aTitle)
- aClosedTabList.filter(function (aData) aData.title == aTitle).length;
-
- function countOpenTabsByTitle(aOpenTabList, aTitle)
- aOpenTabList.filter(function (aData) aData.entries.some(function (aEntry) aEntry.title == aTitle)).length
-
- // backup old state
- let oldState = ss.getBrowserState();
- let oldState_wins = JSON.parse(oldState).windows.length;
- if (oldState_wins != 1)
- ok(false, "oldState in test_purge has " + oldState_wins + " windows instead of 1");
-
- // create a new state for testing
- const REMEMBER = Date.now(), FORGET = Math.random();
- let testState = {
- windows: [ { tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 } ],
- _closedWindows : [
- // _closedWindows[0]
- {
- tabs: [
- { entries: [{ url: "http://example.com/", title: REMEMBER }] },
- { entries: [{ url: "http://mozilla.org/", title: FORGET }] }
- ],
- selected: 2,
- title: "mozilla.org",
- _closedTabs: []
- },
- // _closedWindows[1]
- {
- tabs: [
- { entries: [{ url: "http://mozilla.org/", title: FORGET }] },
- { entries: [{ url: "http://example.com/", title: REMEMBER }] },
- { entries: [{ url: "http://example.com/", title: REMEMBER }] },
- { entries: [{ url: "http://mozilla.org/", title: FORGET }] },
- { entries: [{ url: "http://example.com/", title: REMEMBER }] }
- ],
- selected: 5,
- _closedTabs: []
- },
- // _closedWindows[2]
- {
- tabs: [
- { entries: [{ url: "http://example.com/", title: REMEMBER }] }
- ],
- selected: 1,
- _closedTabs: [
- {
- state: {
- entries: [
- { url: "http://mozilla.org/", title: FORGET },
- { url: "http://mozilla.org/again", title: "doesn't matter" }
- ]
- },
- pos: 1,
- title: FORGET
- },
- {
- state: {
- entries: [
- { url: "http://example.com", title: REMEMBER }
- ]
- },
- title: REMEMBER
- }
- ]
- }
- ]
- };
-
- // set browser to test state
- ss.setBrowserState(JSON.stringify(testState));
-
- // purge domain & check that we purged correctly for closed windows
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
- waitForClearHistory(function() {
- let closedWindowData = JSON.parse(ss.getClosedWindowData());
-
- // First set of tests for _closedWindows[0] - tests basics
- let win = closedWindowData[0];
- is(win.tabs.length, 1, "1 tab was removed");
- is(countOpenTabsByTitle(win.tabs, FORGET), 0,
- "The correct tab was removed");
- is(countOpenTabsByTitle(win.tabs, REMEMBER), 1,
- "The correct tab was remembered");
- is(win.selected, 1, "Selected tab has changed");
- is(win.title, REMEMBER, "The window title was correctly updated");
-
- // Test more complicated case
- win = closedWindowData[1];
- is(win.tabs.length, 3, "2 tabs were removed");
- is(countOpenTabsByTitle(win.tabs, FORGET), 0,
- "The correct tabs were removed");
- is(countOpenTabsByTitle(win.tabs, REMEMBER), 3,
- "The correct tabs were remembered");
- is(win.selected, 3, "Selected tab has changed");
- is(win.title, REMEMBER, "The window title was correctly updated");
-
- // Tests handling of _closedTabs
- win = closedWindowData[2];
- is(countClosedTabsByTitle(win._closedTabs, REMEMBER), 1,
- "The correct number of tabs were removed, and the correct ones");
- is(countClosedTabsByTitle(win._closedTabs, FORGET), 0,
- "All tabs to be forgotten were indeed removed");
-
- // restore pre-test state
- ss.setBrowserState(oldState);
- finish();
- });
-}
diff --git a/browser/components/sessionstore/test/browser_408470.js b/browser/components/sessionstore/test/browser_408470.js
deleted file mode 100644
index 4435c743a..000000000
--- a/browser/components/sessionstore/test/browser_408470.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 408470 **/
-
- waitForExplicitFinish();
-
- let pendingCount = 1;
- let rootDir = getRootDirectory(gTestPath);
- let testUrl = rootDir + "browser_408470_sample.html";
- let tab = gBrowser.addTab(testUrl);
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- // enable all stylesheets and verify that they're correctly persisted
- Array.forEach(tab.linkedBrowser.contentDocument.styleSheets, function(aSS, aIx) {
- pendingCount++;
- let ssTitle = aSS.title;
- gPageStyleMenu.switchStyleSheet(ssTitle, tab.linkedBrowser.contentWindow);
-
- let newTab = gBrowser.duplicateTab(tab);
- newTab.linkedBrowser.addEventListener("load", function(aEvent) {
- newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let states = Array.map(newTab.linkedBrowser.contentDocument.styleSheets,
- function(aSS) !aSS.disabled);
- let correct = states.indexOf(true) == aIx && states.indexOf(true, aIx + 1) == -1;
-
- if (/^fail_/.test(ssTitle))
- ok(!correct, "didn't restore stylesheet " + ssTitle);
- else
- ok(correct, "restored stylesheet " + ssTitle);
-
- gBrowser.removeTab(newTab);
- if (--pendingCount == 0)
- finish();
- }, true);
- });
-
- // disable all styles and verify that this is correctly persisted
- tab.linkedBrowser.markupDocumentViewer.authorStyleDisabled = true;
- let newTab = gBrowser.duplicateTab(tab);
- newTab.linkedBrowser.addEventListener("load", function(aEvent) {
- newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- is(newTab.linkedBrowser.markupDocumentViewer.authorStyleDisabled, true,
- "disabled all stylesheets");
-
- gBrowser.removeTab(newTab);
- if (--pendingCount == 0)
- finish();
- }, true);
-
- gBrowser.removeTab(tab);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_408470_sample.html b/browser/components/sessionstore/test/browser_408470_sample.html
deleted file mode 100644
index 44122b945..000000000
--- a/browser/components/sessionstore/test/browser_408470_sample.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<html>
-<head>
-<title>Test for bug 408470</title>
-
-<link href="404.css" title="default" rel="stylesheet">
-<link href="404.css" title="alternate" rel="alternate stylesheet">
-<link href="404.css" title="altERnate" rel=" styLEsheet altERnate ">
-<link href="404.css" title="media_empty" rel="alternate stylesheet" media="">
-<link href="404.css" title="media_all" rel="alternate stylesheet" media="all">
-<link href="404.css" title="media_ALL" rel="alternate stylesheet" media=" ALL ">
-<link href="404.css" title="media_screen" rel="alternate stylesheet" media="screen">
-<link href="404.css" title="media_print_screen" rel="alternate stylesheet" media="print,screen">
-<link href="404.css" title="fail_media_print" rel="alternate stylesheet" media="print">
-<link href="404.css" title="fail_media_projection" rel="stylesheet" media="projection">
-<link href="404.css" title="fail_media_invalid" rel="alternate stylesheet" media="hallo">
-
-</head>
-<body></body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_423132.js b/browser/components/sessionstore/test/browser_423132.js
deleted file mode 100644
index a59aa4c5c..000000000
--- a/browser/components/sessionstore/test/browser_423132.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- // test that cookies are stored and restored correctly by sessionstore,
- // bug 423132.
-
- waitForExplicitFinish();
-
- let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
- cs.removeAll();
-
- // make sure that sessionstore.js can be forced to be created by setting
- // the interval pref to 0
- gPrefService.setIntPref("browser.sessionstore.interval", 0);
-
- const testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_423132_sample.html";
-
- // open a new window
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:blank");
-
- // make sure sessionstore saves the cookie data, then close the window
- newWin.addEventListener("load", function (aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- newWin.gBrowser.loadURI(testURL, null, null);
-
- newWin.gBrowser.addEventListener("load", function (aEvent) {
- newWin.gBrowser.removeEventListener("load", arguments.callee, true);
-
- // get the sessionstore state for the window
- let state = ss.getWindowState(newWin);
-
- // verify our cookie got set during pageload
- let e = cs.enumerator;
- let cookie;
- let i = 0;
- while (e.hasMoreElements()) {
- cookie = e.getNext().QueryInterface(Ci.nsICookie);
- i++;
- }
- is(i, 1, "expected one cookie");
-
- // remove the cookie
- cs.removeAll();
-
- // restore the window state
- ss.setWindowState(newWin, state, true);
-
- // at this point, the cookie should be restored...
- e = cs.enumerator;
- let cookie2;
- while (e.hasMoreElements()) {
- cookie2 = e.getNext().QueryInterface(Ci.nsICookie);
- if (cookie.name == cookie2.name)
- break;
- }
- is(cookie.name, cookie2.name, "cookie name successfully restored");
- is(cookie.value, cookie2.value, "cookie value successfully restored");
- is(cookie.path, cookie2.path, "cookie path successfully restored");
-
- // clean up
- if (gPrefService.prefHasUserValue("browser.sessionstore.interval"))
- gPrefService.clearUserPref("browser.sessionstore.interval");
- cs.removeAll();
- newWin.close();
- finish();
- }, true);
- }, false);
-}
-
diff --git a/browser/components/sessionstore/test/browser_423132_sample.html b/browser/components/sessionstore/test/browser_423132_sample.html
deleted file mode 100644
index 6ff7e7aa3..000000000
--- a/browser/components/sessionstore/test/browser_423132_sample.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <script type="text/javascript">
- // generate an enormous random number...
- var r = Math.floor(Math.random() * Math.pow(2, 62)).toString();
-
- // ... and use it to set a randomly named cookie
- document.cookie = r + "=value; path=/ohai";
- </script>
-<body>
-</body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_447951.js b/browser/components/sessionstore/test/browser_447951.js
deleted file mode 100644
index 73785efc2..000000000
--- a/browser/components/sessionstore/test/browser_447951.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 447951 **/
-
- waitForExplicitFinish();
- const baseURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_447951_sample.html#";
-
- let tab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let tabState = { entries: [] };
- let max_entries = gPrefService.getIntPref("browser.sessionhistory.max_entries");
- for (let i = 0; i < max_entries; i++)
- tabState.entries.push({ url: baseURL + i });
-
- ss.setTabState(tab, JSON.stringify(tabState));
- tab.addEventListener("SSTabRestored", function(aEvent) {
- tab.removeEventListener("SSTabRestored", arguments.callee, false);
- tabState = JSON.parse(ss.getTabState(tab));
- is(tabState.entries.length, max_entries, "session history filled to the limit");
- is(tabState.entries[0].url, baseURL + 0, "... but not more");
-
- // visit yet another anchor (appending it to session history)
- let doc = tab.linkedBrowser.contentDocument;
- let event = doc.createEvent("MouseEvents");
- event.initMouseEvent("click", true, true, doc.defaultView, 1,
- 0, 0, 0, 0, false, false, false, false, 0, null);
- doc.querySelector("a").dispatchEvent(event);
-
- executeSoon(function() {
- tabState = JSON.parse(ss.getTabState(tab));
- is(tab.linkedBrowser.currentURI.spec, baseURL + "end",
- "the new anchor was loaded");
- is(tabState.entries[tabState.entries.length - 1].url, baseURL + "end",
- "... and ignored");
- is(tabState.entries[0].url, baseURL + 1,
- "... and the first item was removed");
-
- // clean up
- gBrowser.removeTab(tab);
- finish();
- });
- }, false);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_447951_sample.html b/browser/components/sessionstore/test/browser_447951_sample.html
deleted file mode 100644
index 00282f25e..000000000
--- a/browser/components/sessionstore/test/browser_447951_sample.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Testcase for bug 447951</title>
-
-<a href="#end">click me</a>
diff --git a/browser/components/sessionstore/test/browser_448741.js b/browser/components/sessionstore/test/browser_448741.js
deleted file mode 100644
index 8ed6f66c8..000000000
--- a/browser/components/sessionstore/test/browser_448741.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 448741 **/
-
- waitForExplicitFinish();
-
- let uniqueName = "bug 448741";
- let uniqueValue = "as good as unique: " + Date.now();
-
- // set a unique value on a new, blank tab
- var tab = gBrowser.addTab();
- tab.linkedBrowser.stop();
- ss.setTabValue(tab, uniqueName, uniqueValue);
- let valueWasCleaned = false;
-
- // prevent our value from being written to disk
- function cleaningObserver(aSubject, aTopic, aData) {
- ok(aTopic == "sessionstore-state-write", "observed correct topic?");
- ok(aSubject instanceof Ci.nsISupportsString, "subject is a string?");
- ok(aSubject.data.indexOf(uniqueValue) > -1, "data contains our value?");
-
- // find the data for the newly added tab and delete it
- let state = JSON.parse(aSubject.data);
- state.windows.forEach(function (winData) {
- winData.tabs.forEach(function (tabData) {
- if (tabData.extData && uniqueName in tabData.extData &&
- tabData.extData[uniqueName] == uniqueValue) {
- delete tabData.extData[uniqueName];
- valueWasCleaned = true;
- }
- });
- });
-
- ok(valueWasCleaned, "found and removed the specific tab value");
- aSubject.data = JSON.stringify(state);
- Services.obs.removeObserver(cleaningObserver, aTopic);
- }
-
- // make sure that all later observers don't see that value any longer
- function checkingObserver(aSubject, aTopic, aData) {
- ok(valueWasCleaned && aSubject instanceof Ci.nsISupportsString,
- "ready to check the cleaned state?");
- ok(aSubject.data.indexOf(uniqueValue) == -1, "data no longer contains our value?");
-
- // clean up
- gBrowser.removeTab(tab);
- Services.obs.removeObserver(checkingObserver, aTopic);
- if (gPrefService.prefHasUserValue("browser.sessionstore.interval"))
- gPrefService.clearUserPref("browser.sessionstore.interval");
- finish();
- }
-
- // last added observers are invoked first
- Services.obs.addObserver(checkingObserver, "sessionstore-state-write", false);
- Services.obs.addObserver(cleaningObserver, "sessionstore-state-write", false);
-
- // trigger an immediate save operation
- gPrefService.setIntPref("browser.sessionstore.interval", 0);
-}
diff --git a/browser/components/sessionstore/test/browser_454908.js b/browser/components/sessionstore/test/browser_454908.js
deleted file mode 100644
index 4edb591c8..000000000
--- a/browser/components/sessionstore/test/browser_454908.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 454908 **/
-
- waitForExplicitFinish();
-
- let fieldValues = {
- username: "User " + Math.random(),
- passwd: "pwd" + Date.now()
- };
-
- // make sure we do save form data
- gPrefService.setIntPref("browser.sessionstore.privacy_level", 0);
-
- let rootDir = getRootDirectory(gTestPath);
- let testURL = rootDir + "browser_454908_sample.html";
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
- for (let id in fieldValues)
- doc.getElementById(id).value = fieldValues[id];
-
- gBrowser.removeTab(tab);
-
- tab = undoCloseTab();
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
- for (let id in fieldValues) {
- let node = doc.getElementById(id);
- if (node.type == "password")
- is(node.value, "", "password wasn't saved/restored");
- else
- is(node.value, fieldValues[id], "username was saved/restored");
- }
-
- // clean up
- if (gPrefService.prefHasUserValue("browser.sessionstore.privacy_level"))
- gPrefService.clearUserPref("browser.sessionstore.privacy_level");
- // undoCloseTab can reuse a single blank tab, so we have to
- // make sure not to close the window when closing our last tab
- if (gBrowser.tabs.length == 1)
- gBrowser.addTab();
- gBrowser.removeTab(tab);
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_454908_sample.html b/browser/components/sessionstore/test/browser_454908_sample.html
deleted file mode 100644
index 02f40bf20..000000000
--- a/browser/components/sessionstore/test/browser_454908_sample.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<title>Test for bug 454908</title>
-
-<h3>Dummy Login</h3>
-<form>
-<p>Username: <input type="text" id="username">
-<p>Password: <input type="password" id="passwd">
-</form>
diff --git a/browser/components/sessionstore/test/browser_456342.js b/browser/components/sessionstore/test/browser_456342.js
deleted file mode 100644
index 4177ac304..000000000
--- a/browser/components/sessionstore/test/browser_456342.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 456342 **/
-
- waitForExplicitFinish();
-
- // make sure we do save form data
- gPrefService.setIntPref("browser.sessionstore.privacy_level", 0);
-
- let rootDir = getRootDirectory(gTestPath);
- let testURL = rootDir + "browser_456342_sample.xhtml";
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, true);
-
- let expectedValue = "try to save me";
- // Since bug 537289 we only save non-default values, so we need to set each
- // form field's value after load.
- let formEls = aEvent.originalTarget.forms[0].elements;
- for (let i = 0; i < formEls.length; i++)
- formEls[i].value = expectedValue;
-
- gBrowser.removeTab(tab);
-
- let undoItems = JSON.parse(ss.getClosedTabData(window));
- let savedFormData = undoItems[0].state.entries[0].formdata;
-
- let countGood = 0, countBad = 0;
- for each (let value in savedFormData.id) {
- if (value == expectedValue)
- countGood++;
- else
- countBad++;
- }
- for each (let value in savedFormData.xpath) {
- if (value == expectedValue)
- countGood++;
- else
- countBad++;
- }
-
- is(countGood, 4, "Saved text for non-standard input fields");
- is(countBad, 0, "Didn't save text for ignored field types");
-
- // clean up
- if (gPrefService.prefHasUserValue("browser.sessionstore.privacy_level"))
- gPrefService.clearUserPref("browser.sessionstore.privacy_level");
- finish();
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_456342_sample.xhtml b/browser/components/sessionstore/test/browser_456342_sample.xhtml
deleted file mode 100644
index f0b0005b7..000000000
--- a/browser/components/sessionstore/test/browser_456342_sample.xhtml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head><title>Test for bug 456342</title></head>
-
-<body>
-<form>
-<h3>Non-standard &lt;input&gt;s</h3>
-<p>Search <input type="search" id="searchTerm"/></p>
-<p>Image Search: <input type="image search" /></p>
-<p>Autocomplete: <input type="autocomplete" name="fill-in"/></p>
-<p>Mistyped: <input type="txet" name="mistyped"/></p>
-
-<h3>Ignored types</h3>
-<input type="hidden" name="hideme"/>
-<input type="HIDDEN" name="hideme2"/>
-<input type="submit" name="submit"/>
-<input type="reset" name="reset"/>
-<input type="image" name="image"/>
-<input type="button" name="button"/>
-<input type="password" name="password"/>
-<input type="PassWord" name="password2"/>
-<input type="PASSWORD" name="password3"/>
-</form>
-
-</body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_459906.js b/browser/components/sessionstore/test/browser_459906.js
deleted file mode 100644
index cadab3e5c..000000000
--- a/browser/components/sessionstore/test/browser_459906.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 459906 **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_459906_sample.html";
- let uniqueValue = "<b>Unique:</b> " + Date.now();
-
- var frameCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frameCount++ < 2)
- return;
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let iframes = tab.linkedBrowser.contentWindow.frames;
- iframes[1].document.body.innerHTML = uniqueValue;
-
- frameCount = 0;
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load (and reload!) completely
- if (frameCount++ < 2)
- return;
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- executeSoon(function() {
- let iframes = tab2.linkedBrowser.contentWindow.frames;
- if (iframes[1].document.body.innerHTML !== uniqueValue) {
- // Poll again the value, since we can't ensure to run
- // after SessionStore has injected innerHTML value.
- // See bug 521802.
- info("Polling for innerHTML value");
- setTimeout(arguments.callee, 100);
- return;
- }
-
- is(iframes[1].document.body.innerHTML, uniqueValue,
- "rich textarea's content correctly duplicated");
-
- let innerDomain = null;
- try {
- innerDomain = iframes[0].document.domain;
- }
- catch (ex) { /* throws for chrome: documents */ }
- is(innerDomain, "mochi.test", "XSS exploit prevented!");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- });
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_459906_empty.html b/browser/components/sessionstore/test/browser_459906_empty.html
deleted file mode 100644
index e01aaa339..000000000
--- a/browser/components/sessionstore/test/browser_459906_empty.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<title>Cross Domain File for bug 459906</title>
-
-cheers from localhost
diff --git a/browser/components/sessionstore/test/browser_459906_sample.html b/browser/components/sessionstore/test/browser_459906_sample.html
deleted file mode 100644
index 39b789776..000000000
--- a/browser/components/sessionstore/test/browser_459906_sample.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!-- Testcase originally by David Bloom <bloom@google.com> -->
-
-<!DOCTYPE html>
-<title>Test for bug 459906</title>
-
-<body>
-<iframe src="data:text/html;charset=utf-8,not_on_localhost"></iframe>
-<iframe></iframe>
-
-<script type="application/javascript">
- var loadCount = 0;
- frames[0].addEventListener("DOMContentLoaded", handleLoad, false);
- frames[1].addEventListener("DOMContentLoaded", handleLoad, false);
- function handleLoad() {
- if (++loadCount < 2)
- return;
- frames[0].removeEventListener("DOMContentLoaded", handleLoad, false);
- frames[1].removeEventListener("DOMContentLoaded", handleLoad, false);
- frames[0].document.designMode = "on";
- frames[0].document.__defineGetter__("designMode", function() {
- // inject a cross domain file ...
- var documentInjected = false;
- document.getElementsByTagName("iframe")[0].onload =
- function() { documentInjected = true; };
- frames[0].location = "browser_459906_empty.html";
-
- // ... and ensure that it has time to load
- for (var c = 0; !documentInjected && c < 20; c++) {
- var r = new XMLHttpRequest();
- r.open("GET", location.href, false);
- r.overrideMimeType("text/plain");
- r.send(null);
- }
-
- return "on";
- });
-
- frames[1].document.designMode = "on";
- };
-</script>
-</body>
diff --git a/browser/components/sessionstore/test/browser_461634.js b/browser/components/sessionstore/test/browser_461634.js
deleted file mode 100644
index 931f12ccb..000000000
--- a/browser/components/sessionstore/test/browser_461634.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 461634 **/
-
- waitForExplicitFinish();
-
- const REMEMBER = Date.now(), FORGET = Math.random();
- let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
- { state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://www.example.net/" }] }, title: REMEMBER },
- { state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://www.example.net/" }] }, title: REMEMBER },
- ] }] };
- let remember_count = 2;
-
- function countByTitle(aClosedTabList, aTitle)
- aClosedTabList.filter(function(aData) aData.title == aTitle).length;
-
- function testForError(aFunction) {
- try {
- aFunction();
- return false;
- }
- catch (ex) {
- return ex.name == "NS_ERROR_ILLEGAL_VALUE";
- }
- }
-
- // open a window and add the above closed tab list
- let newWin = openDialog(location, "", "chrome,all,dialog=no");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
- test_state.windows[0]._closedTabs.length);
- ss.setWindowState(newWin, JSON.stringify(test_state), true);
-
- let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
- is(closedTabs.length, test_state.windows[0]._closedTabs.length,
- "Closed tab list has the expected length");
- is(countByTitle(closedTabs, FORGET),
- test_state.windows[0]._closedTabs.length - remember_count,
- "The correct amout of tabs are to be forgotten");
- is(countByTitle(closedTabs, REMEMBER), remember_count,
- "Everything is set up.");
-
- // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
- ok(testForError(function() ss.forgetClosedTab({}, 0)),
- "Invalid window for forgetClosedTab throws");
- ok(testForError(function() ss.forgetClosedTab(newWin, -1)),
- "Invalid tab for forgetClosedTab throws");
- ok(testForError(function() ss.forgetClosedTab(newWin, test_state.windows[0]._closedTabs.length + 1)),
- "Invalid tab for forgetClosedTab throws");
-
- // Remove third tab, then first tab
- ss.forgetClosedTab(newWin, 2);
- ss.forgetClosedTab(newWin, null);
-
- closedTabs = JSON.parse(ss.getClosedTabData(newWin));
- is(closedTabs.length, remember_count,
- "The correct amout of tabs was removed");
- is(countByTitle(closedTabs, FORGET), 0,
- "All tabs specifically forgotten were indeed removed");
- is(countByTitle(closedTabs, REMEMBER), remember_count,
- "... and tabs not specifically forgetten weren't.");
-
- // clean up
- newWin.close();
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
- finish();
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_461743.js b/browser/components/sessionstore/test/browser_461743.js
deleted file mode 100644
index 263fff5f2..000000000
--- a/browser/components/sessionstore/test/browser_461743.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 461743 **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_461743_sample.html";
-
- let frameCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // Wait for all frames to load completely.
- if (frameCount++ < 2)
- return;
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("461743", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("461743", arguments.callee, true);
- is(aEvent.data, "done", "XSS injection was attempted");
-
- executeSoon(function() {
- let iframes = tab2.linkedBrowser.contentWindow.frames;
- let innerHTML = iframes[1].document.body.innerHTML;
- isnot(innerHTML, Components.utils.reportError.toString(),
- "chrome access denied!");
-
- // Clean up.
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- });
- }, true, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_461743_sample.html b/browser/components/sessionstore/test/browser_461743_sample.html
deleted file mode 100644
index 22c478d4c..000000000
--- a/browser/components/sessionstore/test/browser_461743_sample.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<!DOCTYPE html>
-<title>Test for bug 461743</title>
-
-<body>
-<iframe src="data:text/html;charset=utf-8,empty"></iframe>
-<iframe></iframe>
-
-<script type="application/javascript">
- var chromeUrl = "chrome://global/content/mozilla.xhtml";
- var exploitUrl = "javascript:try { document.body.innerHTML = Components.utils.reportError; } catch (ex) { }";
-
- var loadCount = 0;
- frames[0].addEventListener("DOMContentLoaded", handleLoad, false);
- frames[1].addEventListener("DOMContentLoaded", handleLoad, false);
- function handleLoad() {
- if (++loadCount < 2)
- return;
- frames[0].removeEventListener("DOMContentLoaded", handleLoad, false);
- frames[1].removeEventListener("DOMContentLoaded", handleLoad, false);
-
- var flip = 0;
- MutationEvent.prototype.toString = function() {
- return flip++ == 0 ? chromeUrl : exploitUrl;
- };
-
- var href = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(frames[1].location), "href").get;
- var loadChrome = { handleEvent: href };
- var loadExploit = { handleEvent: href };
-
- function delay() {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", location.href, false);
- xhr.send(null);
- }
- function done() {
- var event = document.createEvent("MessageEvent");
- event.initMessageEvent("461743", true, false, "done", location.href, "", window);
- document.dispatchEvent(event);
- frames[0].document.removeEventListener("DOMNodeInserted", loadChrome, true);
- frames[0].document.removeEventListener("DOMNodeInserted", delay, true);
- frames[0].document.removeEventListener("DOMNodeInserted", loadExploit, true);
- frames[0].document.removeEventListener("DOMNodeInserted", done, true);
- }
-
- frames[0].document.addEventListener("DOMNodeInserted", loadChrome, true);
- frames[0].document.addEventListener("DOMNodeInserted", delay, true);
- frames[0].document.addEventListener("DOMNodeInserted", loadExploit, true);
- frames[0].document.addEventListener("DOMNodeInserted", done, true);
-
- frames[0].document.designMode = "on";
- };
-</script>
-</body>
diff --git a/browser/components/sessionstore/test/browser_463205.js b/browser/components/sessionstore/test/browser_463205.js
deleted file mode 100644
index 93ba1d8d1..000000000
--- a/browser/components/sessionstore/test/browser_463205.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 463205 **/
-
- waitForExplicitFinish();
-
- let rootDir = "http://mochi.test:8888/browser/browser/components/sessionstore/test/";
- let testURL = rootDir + "browser_463205_sample.html";
-
- let doneURL = "done";
-
- let mainURL = testURL;
- let frame1URL = "data:text/html;charset=utf-8,<input%20id='original'>";
- let frame2URL = rootDir + "browser_463205_helper.html";
- let frame3URL = "data:text/html;charset=utf-8,mark2";
-
- let frameCount = 0;
-
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frame1URL != doneURL && aEvent.target.location.href == frame1URL) {
- frame1URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frame2URL != doneURL && aEvent.target.location.href == frame2URL) {
- frame2URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frame3URL != doneURL && aEvent.target.location.href == frame3URL) {
- frame3URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (mainURL != doneURL && aEvent.target.location.href == mainURL) {
- mainURL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frameCount < 3) {
- return;
- }
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- function typeText(aTextField, aValue) {
- aTextField.value = aValue;
-
- let event = aTextField.ownerDocument.createEvent("UIEvents");
- event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0);
- aTextField.dispatchEvent(event);
- }
-
- let uniqueValue = "Unique: " + Math.random();
- let win = tab.linkedBrowser.contentWindow;
- typeText(win.frames[0].document.getElementById("original"), uniqueValue);
- typeText(win.frames[1].document.getElementById("original"), uniqueValue);
-
- mainURL = testURL;
- frame1URL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_463205_helper.html";
- frame2URL = rootDir + "browser_463205_helper.html";
- frame3URL = "data:text/html;charset=utf-8,mark2";
-
- frameCount = 0;
-
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load (and reload!) completely
- if (frame1URL != doneURL && aEvent.target.location.href == frame1URL) {
- frame1URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frame2URL != doneURL && (aEvent.target.location.href == frame2URL ||
- aEvent.target.location.href == frame2URL + "#original")) {
- frame2URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frame3URL != doneURL && aEvent.target.location.href == frame3URL) {
- frame3URL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (mainURL != doneURL && aEvent.target.location.href == mainURL) {
- mainURL = doneURL;
- if (frameCount++ < 3) {
- return;
- }
- }
- if (frameCount < 3) {
- return;
- }
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let win = tab2.linkedBrowser.contentWindow;
- isnot(win.frames[0].document.getElementById("original").value, uniqueValue,
- "subframes must match URL to get text restored");
- is(win.frames[0].document.getElementById("original").value, "preserve me",
- "subframes must match URL to get text restored");
- is(win.frames[1].document.getElementById("original").value, uniqueValue,
- "text still gets restored for all other subframes");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_463205_helper.html b/browser/components/sessionstore/test/browser_463205_helper.html
deleted file mode 100644
index d6c2209d8..000000000
--- a/browser/components/sessionstore/test/browser_463205_helper.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Test for bug 463205 (cross domain)</title>
-
-<input id="original" value="preserve me">
diff --git a/browser/components/sessionstore/test/browser_463205_sample.html b/browser/components/sessionstore/test/browser_463205_sample.html
deleted file mode 100644
index 483ea3538..000000000
--- a/browser/components/sessionstore/test/browser_463205_sample.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Test for bug 463205</title>
-
-<body onload="onLoad()">
-<iframe src="data:text/html;charset=utf-8,<input%20id='original'>"></iframe>
-<iframe src="browser_463205_helper.html"></iframe>
-<iframe src="data:text/html;charset=utf-8,mark1"></iframe>
-
-<script type="application/javascript">
- function onLoad() {
- if (frames[2].document.location.href == "data:text/html;charset-utf-8,mark1") {
- frames[2].document.location = "data:text/html;charset=utf-8,mark2";
- }
- else {
- frames[1].document.location.hash = "#original";
- frames[0].document.location = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_463205_helper.html";
- }
- }
-</script>
-</body>
diff --git a/browser/components/sessionstore/test/browser_463206.js b/browser/components/sessionstore/test/browser_463206.js
deleted file mode 100644
index 696a5aa9c..000000000
--- a/browser/components/sessionstore/test/browser_463206.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 463206 **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_463206_sample.html";
-
- var frameCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frameCount++ < 5)
- return;
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- function typeText(aTextField, aValue) {
- aTextField.value = aValue;
-
- let event = aTextField.ownerDocument.createEvent("UIEvents");
- event.initUIEvent("input", true, true, aTextField.ownerDocument.defaultView, 0);
- aTextField.dispatchEvent(event);
- }
-
- let doc = tab.linkedBrowser.contentDocument;
- typeText(doc.getElementById("out1"), Date.now());
- typeText(doc.getElementsByName("1|#out2")[0], Math.random());
- typeText(doc.defaultView.frames[0].frames[1].document.getElementById("in1"), new Date());
-
- frameCount = 0;
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frameCount++ < 5)
- return;
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- let doc = tab2.linkedBrowser.contentDocument;
- let win = tab2.linkedBrowser.contentWindow;
- isnot(doc.getElementById("out1").value,
- win.frames[1].document.getElementById("out1").value,
- "text isn't reused for frames");
- isnot(doc.getElementsByName("1|#out2")[0].value, "",
- "text containing | and # is correctly restored");
- is(win.frames[1].document.getElementById("out2").value, "",
- "id prefixes can't be faked");
- // Disabled for now, Bug 588077
- // isnot(win.frames[0].frames[1].document.getElementById("in1").value, "",
- // "id prefixes aren't mixed up");
- is(win.frames[1].frames[0].document.getElementById("in1").value, "",
- "id prefixes aren't mixed up");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_463206_sample.html b/browser/components/sessionstore/test/browser_463206_sample.html
deleted file mode 100644
index 0d31f2906..000000000
--- a/browser/components/sessionstore/test/browser_463206_sample.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Test for bug 463206</title>
-
-<iframe src="data:text/html;charset=utf-8,<iframe></iframe><iframe%20src='data:text/html;charset=utf-8,<input%2520id=%2522in1%2522>'></iframe>"></iframe>
-<iframe src="data:text/html;charset=utf-8,<input%20id='out1'><input%20id='out2'><iframe%20src='data:text/html;charset=utf-8,<input%2520id=%2522in1%2522>'>"></iframe>
-
-<input id="out1">
-<input name="1|#out2">
diff --git a/browser/components/sessionstore/test/browser_464199.js b/browser/components/sessionstore/test/browser_464199.js
deleted file mode 100644
index f3593ae9e..000000000
--- a/browser/components/sessionstore/test/browser_464199.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
-
-function waitForClearHistory(aCallback) {
- let observer = {
- observe: function(aSubject, aTopic, aData) {
- Services.obs.removeObserver(this, "browser:purge-domain-data");
- setTimeout(aCallback, 0);
- }
- };
- Services.obs.addObserver(observer, "browser:purge-domain-data", false);
-}
-
-function test() {
- /** Test for Bug 464199 **/
-
- waitForExplicitFinish();
-
- const REMEMBER = Date.now(), FORGET = Math.random();
- let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
- { state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://www.example.org/" }] }, title: REMEMBER },
- { state: { entries: [{ url: "http://www.example.net/" },
- { url: "http://www.example.org/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://example.net/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://sub.example.net/" }] }, title: FORGET },
- { state: { entries: [{ url: "http://www.example.net:8080/" }] }, title: FORGET },
- { state: { entries: [{ url: "about:license" }] }, title: REMEMBER },
- { state: { entries: [{ url: "http://www.example.org/frameset",
- children: [
- { url: "http://www.example.org/frame" },
- { url: "http://www.example.org:8080/frame2" }
- ] }] }, title: REMEMBER },
- { state: { entries: [{ url: "http://www.example.org/frameset",
- children: [
- { url: "http://www.example.org/frame" },
- { url: "http://www.example.net/frame" }
- ] }] }, title: FORGET },
- { state: { entries: [{ url: "http://www.example.org/form",
- formdata: { id: { "url": "http://www.example.net/" } }
- }] }, title: REMEMBER },
- { state: { entries: [{ url: "http://www.example.org/form" }],
- extData: { "setTabValue": "http://example.net:80" } }, title: REMEMBER }
- ] }] };
- let remember_count = 5;
-
- function countByTitle(aClosedTabList, aTitle)
- aClosedTabList.filter(function(aData) aData.title == aTitle).length;
-
- // open a window and add the above closed tab list
- let newWin = openDialog(location, "", "chrome,all,dialog=no");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
- test_state.windows[0]._closedTabs.length);
- ss.setWindowState(newWin, JSON.stringify(test_state), true);
-
- let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
- is(closedTabs.length, test_state.windows[0]._closedTabs.length,
- "Closed tab list has the expected length");
- is(countByTitle(closedTabs, FORGET),
- test_state.windows[0]._closedTabs.length - remember_count,
- "The correct amout of tabs are to be forgotten");
- is(countByTitle(closedTabs, REMEMBER), remember_count,
- "Everything is set up.");
-
- ForgetAboutSite.removeDataFromDomain("example.net");
- waitForClearHistory(function() {
- closedTabs = JSON.parse(ss.getClosedTabData(newWin));
- is(closedTabs.length, remember_count,
- "The correct amout of tabs was removed");
- is(countByTitle(closedTabs, FORGET), 0,
- "All tabs to be forgotten were indeed removed");
- is(countByTitle(closedTabs, REMEMBER), remember_count,
- "... and tabs to be remembered weren't.");
-
- // clean up
- newWin.close();
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
- finish();
- });
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_464620_a.html b/browser/components/sessionstore/test/browser_464620_a.html
deleted file mode 100644
index 44dc07a93..000000000
--- a/browser/components/sessionstore/test/browser_464620_a.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<title>Test for bug 464620 (injection on input)</title>
-
-<iframe></iframe>
-<iframe onload="setup()"></iframe>
-
-<script>
- var targetUrl = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_464620_xd.html";
- var firstPass;
-
- function setup() {
- if (firstPass !== undefined)
- return;
- firstPass = frames[1].location.href == "about:blank";
- if (firstPass) {
- frames[0].location = 'data:text/html;charset=utf-8,<body onload="if (parent.firstPass) parent.step();"><input id="x" oninput="parent.xss()">XXX</body>';
- }
- frames[1].location = targetUrl;
- }
-
- function step() {
- var x = frames[0].document.getElementById("x");
- if (x.value == "")
- x.value = "ready";
- x.style.display = "none";
- frames[0].document.designMode = "on";
- }
-
- function xss() {
- step();
-
- var documentInjected = false;
- document.getElementsByTagName("iframe")[0].onload =
- function() { documentInjected = true; };
- frames[0].location = targetUrl;
-
- for (var c = 0; !documentInjected && c < 20; c++) {
- var r = new XMLHttpRequest();
- r.open("GET", location.href, false);
- r.overrideMimeType("text/plain");
- r.send(null);
- }
- document.getElementById("state").textContent = "done";
-
- var event = document.createEvent("MessageEvent");
- event.initMessageEvent("464620_a", true, false, "done", location.href, "", window);
- document.dispatchEvent(event);
- }
-</script>
-
-<p id="state">pending</p>
diff --git a/browser/components/sessionstore/test/browser_464620_a.js b/browser/components/sessionstore/test/browser_464620_a.js
deleted file mode 100644
index 9756fa703..000000000
--- a/browser/components/sessionstore/test/browser_464620_a.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 464620 (injection on input) **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_464620_a.html";
-
- var frameCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frameCount++ < 4)
- return;
- this.removeEventListener("load", arguments.callee, true);
-
- executeSoon(function() {
- frameCount = 0;
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("464620_a", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("464620_a", arguments.callee, true);
- is(aEvent.data, "done", "XSS injection was attempted");
-
- // let form restoration complete and take into account the
- // setTimeout(..., 0) in sss_restoreDocument_proxy
- executeSoon(function() {
- setTimeout(function() {
- let win = tab2.linkedBrowser.contentWindow;
- isnot(win.frames[0].document.location, testURL,
- "cross domain document was loaded");
- ok(!/XXX/.test(win.frames[0].document.body.innerHTML),
- "no content was injected");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, 0);
- });
- }, true, true);
- });
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_464620_b.html b/browser/components/sessionstore/test/browser_464620_b.html
deleted file mode 100644
index 4e2e10ae5..000000000
--- a/browser/components/sessionstore/test/browser_464620_b.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<title>Test for bug 464620 (injection on DOM node insertion)</title>
-
-<iframe></iframe>
-<iframe></iframe>
-<iframe onload="setup()"></iframe>
-
-<script>
- var targetUrl = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_464620_xd.html";
- var firstPass;
-
- function setup() {
- if (firstPass !== undefined)
- return;
- firstPass = frames[2].location.href == "about:blank";
- if (firstPass) {
- frames[0].location = 'data:text/html;charset=utf-8,<body onload="parent.step()">a</body>';
- frames[1].location = 'data:text/html;charset=utf-8,<body onload="document.designMode=\'on\';">XXX</body>';
- }
- frames[2].location = targetUrl;
- }
-
- function step() {
- frames[0].document.designMode = "on";
- if (firstPass)
- return;
-
- var body = frames[0].document.body;
- body.addEventListener("DOMNodeInserted", function() {
- body.removeEventListener("DOMNodeInserted", arguments.callee, true);
- xss();
- }, true);
- }
-
- function xss() {
- var documentInjected = false;
- document.getElementsByTagName("iframe")[1].onload =
- function() { documentInjected = true; };
- frames[1].location = targetUrl;
-
- for (var c = 0; !documentInjected && c < 20; c++) {
- var r = new XMLHttpRequest();
- r.open("GET", location.href, false);
- r.overrideMimeType("text/plain");
- r.send(null);
- }
- document.getElementById("state").textContent = "done";
-
- var event = document.createEvent("MessageEvent");
- event.initMessageEvent("464620_b", true, false, "done", location.href, "", window);
- document.dispatchEvent(event);
- }
-</script>
-
-<p id="state">pending</p>
diff --git a/browser/components/sessionstore/test/browser_464620_b.js b/browser/components/sessionstore/test/browser_464620_b.js
deleted file mode 100644
index cf23aa460..000000000
--- a/browser/components/sessionstore/test/browser_464620_b.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 464620 (injection on DOM node insertion) **/
-
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_464620_b.html";
-
- var frameCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- // wait for all frames to load completely
- if (frameCount++ < 6)
- return;
- this.removeEventListener("load", arguments.callee, true);
-
- executeSoon(function() {
- frameCount = 0;
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("464620_b", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("464620_b", arguments.callee, true);
- is(aEvent.data, "done", "XSS injection was attempted");
-
- // let form restoration complete and take into account the
- // setTimeout(..., 0) in sss_restoreDocument_proxy
- executeSoon(function() {
- setTimeout(function() {
- let win = tab2.linkedBrowser.contentWindow;
- isnot(win.frames[1].document.location, testURL,
- "cross domain document was loaded");
- ok(!/XXX/.test(win.frames[1].document.body.innerHTML),
- "no content was injected");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, 0);
- });
- }, true, true);
- });
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_464620_xd.html b/browser/components/sessionstore/test/browser_464620_xd.html
deleted file mode 100644
index 9ec51c4c7..000000000
--- a/browser/components/sessionstore/test/browser_464620_xd.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<title>Cross Document File for bug 464620</title>
-
-<body onload="document.designMode='on';" bgcolor="red">
- This document is editable.
-</body>
diff --git a/browser/components/sessionstore/test/browser_465215.js b/browser/components/sessionstore/test/browser_465215.js
deleted file mode 100644
index 471ffc70f..000000000
--- a/browser/components/sessionstore/test/browser_465215.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 465215 **/
-
- waitForExplicitFinish();
-
- let uniqueName = "bug 465215";
- let uniqueValue1 = "as good as unique: " + Date.now();
- let uniqueValue2 = "as good as unique: " + Math.random();
-
- // set a unique value on a new, blank tab
- let tab1 = gBrowser.addTab();
- tab1.linkedBrowser.addEventListener("load", function() {
- tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
- ss.setTabValue(tab1, uniqueName, uniqueValue1);
-
- // duplicate the tab with that value
- let tab2 = ss.duplicateTab(window, tab1);
- is(ss.getTabValue(tab2, uniqueName), uniqueValue1, "tab value was duplicated");
-
- ss.setTabValue(tab2, uniqueName, uniqueValue2);
- isnot(ss.getTabValue(tab1, uniqueName), uniqueValue2, "tab values aren't sync'd");
-
- // overwrite the tab with the value which should remove it
- ss.setTabState(tab1, JSON.stringify({ entries: [] }));
- tab1.linkedBrowser.addEventListener("load", function() {
- tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
- is(ss.getTabValue(tab1, uniqueName), "", "tab value was cleared");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab1);
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_465223.js b/browser/components/sessionstore/test/browser_465223.js
deleted file mode 100644
index 4becc7d15..000000000
--- a/browser/components/sessionstore/test/browser_465223.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 465223 **/
-
- // test setup
- waitForExplicitFinish();
-
- let uniqueKey1 = "bug 465223.1";
- let uniqueKey2 = "bug 465223.2";
- let uniqueValue1 = "unik" + Date.now();
- let uniqueValue2 = "pi != " + Math.random();
-
- // open a window and set a value on it
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
-
- let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] };
- newState.windows[0].extData[uniqueKey2] = uniqueValue2;
- ss.setWindowState(newWin, JSON.stringify(newState), false);
-
- is(newWin.gBrowser.tabs.length, 2,
- "original tab wasn't overwritten");
- is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
- "window value wasn't overwritten when the tabs weren't");
- is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue2,
- "new window value was correctly added");
-
- newState.windows[0].extData[uniqueKey2] = uniqueValue1;
- ss.setWindowState(newWin, JSON.stringify(newState), true);
-
- is(newWin.gBrowser.tabs.length, 1,
- "original tabs were overwritten");
- is(ss.getWindowValue(newWin, uniqueKey1), "",
- "window value was cleared");
- is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue1,
- "window value was correctly overwritten");
-
- // clean up
- newWin.close();
- finish();
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_466937.js b/browser/components/sessionstore/test/browser_466937.js
deleted file mode 100644
index 4a3b1239f..000000000
--- a/browser/components/sessionstore/test/browser_466937.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 466937 **/
-
- waitForExplicitFinish();
-
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsILocalFile);
- file.append("466937_test.file");
- file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
- let testPath = file.path;
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_466937_sample.html";
-
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
- doc.getElementById("reverse_thief").value = "/home/user/secret2";
- doc.getElementById("bystander").value = testPath;
-
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- doc = tab2.linkedBrowser.contentDocument;
- is(doc.getElementById("thief").value, "",
- "file path wasn't set to text field value");
- is(doc.getElementById("reverse_thief").value, "",
- "text field value wasn't set to full file path");
- is(doc.getElementById("bystander").value, testPath,
- "normal case: file path was correctly preserved");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_466937_sample.html b/browser/components/sessionstore/test/browser_466937_sample.html
deleted file mode 100644
index 1d46c649a..000000000
--- a/browser/components/sessionstore/test/browser_466937_sample.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- Testcase originally by <moz_bug_r_a4@yahoo.com> -->
-
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Test for bug 466937</title>
-
-<input id="thief" value="/home/user/secret">
-<input type="file" id="reverse_thief">
-<input type="file" id="bystander">
-
-<script>
- window.addEventListener("DOMContentLoaded", function() {
- window.removeEventListener("DOMContentLoaded", arguments.callee, false);
- if (!document.location.hash) {
- document.location.hash = "#ready";
- }
- else {
- document.getElementById("thief").type = "file";
- document.getElementById("reverse_thief").type = "text";
- }
- }, false);
-</script>
diff --git a/browser/components/sessionstore/test/browser_467409-backslashplosion.js b/browser/components/sessionstore/test/browser_467409-backslashplosion.js
deleted file mode 100644
index aa3d85a8f..000000000
--- a/browser/components/sessionstore/test/browser_467409-backslashplosion.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test Summary:
-// 1. Open about:sessionrestore via setBrowserState where formdata is a JS object, not a string
-// 1a. Check that #sessionData on the page is readable after JSON.parse (skipped, checking formdata is sufficient)
-// 1b. Check that there are no backslashes in the formdata
-// 1c. Check that formdata (via getBrowserState) doesn't require JSON.parse
-//
-// 2. Use the current state (currently about:sessionrestore with data) and then open than in a new instance of about:sessionrestore
-// 2a. Check that there are no backslashes in the formdata
-// 2b. Check that formdata (via getBrowserState) doesn't require JSON.parse
-//
-// 3. [backwards compat] Use a stringified state as formdata when opening about:sessionrestore
-// 3a. Make sure there are nodes in the tree on about:sessionrestore (skipped, checking formdata is sufficient)
-// 3b. Check that there are no backslashes in the formdata
-// 3c. Check that formdata (via getBrowserState) doesn't require JSON.parse
-
-function test() {
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
- let crashState = { windows: [{ tabs: [{ entries: [{ url: "about:mozilla" }] }]}]};
-
- let pagedata = { url: "about:sessionrestore",
- formdata: { id: {"sessionData": crashState } } };
- let state = { windows: [{ tabs: [{ entries: [pagedata] }] }] };
-
- // test1 calls test2 calls test3 calls finish
- test1(state);
-
-
- function test1(aState) {
- waitForBrowserState(aState, function() {
- checkState("test1", test2);
- });
- }
-
- function test2(aState) {
- let pagedata2 = { url: "about:sessionrestore",
- formdata: { id: { "sessionData": aState } } };
- let state2 = { windows: [{ tabs: [{ entries: [pagedata2] }] }] };
-
- waitForBrowserState(state2, function() {
- checkState("test2", test3);
- });
- }
-
- function test3(aState) {
- let pagedata3 = { url: "about:sessionrestore",
- formdata: { id: { "sessionData": JSON.stringify(crashState) } } };
- let state3 = { windows: [{ tabs: [{ entries: [pagedata3] }] }] };
- waitForBrowserState(state3, function() {
- // In theory we should do inspection of the treeview on about:sessionrestore,
- // but we don't actually need to. If we fail tests in checkState then
- // about:sessionrestore won't be able to turn the form value into a usable page.
- checkState("test3", function() waitForBrowserState(blankState, finish));
- });
- }
-
- function checkState(testName, callback) {
- let curState = JSON.parse(ss.getBrowserState());
- let formdata = curState.windows[0].tabs[0].entries[0].formdata;
-
- ok(formdata.id["sessionData"], testName + ": we have form data for about:sessionrestore");
-
- let sessionData_raw = JSON.stringify(formdata.id["sessionData"]);
- ok(!/\\/.test(sessionData_raw), testName + ": #sessionData contains no backslashes");
- info(sessionData_raw);
-
- let gotError = false;
- try {
- JSON.parse(formdata.id["sessionData"]);
- }
- catch (e) {
- info(testName + ": got error: " + e);
- gotError = true;
- }
- ok(gotError, testName + ": attempting to JSON.parse form data threw error");
-
- // Panorama sticks JSON into extData, which we stringify causing the
- // naive backslash check to fail. extData doesn't matter in the grand
- // scheme here, so we'll delete the extData so doesn't end up in future states.
- delete curState.windows[0].extData;
- delete curState.windows[0].tabs[0].extData;
- callback(curState);
- }
-
-}
-
diff --git a/browser/components/sessionstore/test/browser_477657.js b/browser/components/sessionstore/test/browser_477657.js
deleted file mode 100644
index 7c6562166..000000000
--- a/browser/components/sessionstore/test/browser_477657.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 477657 **/
- waitForExplicitFinish();
-
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- let newState = { windows: [{
- tabs: [{ entries: [] }],
- _closedTabs: [{
- state: { entries: [{ url: "about:" }]},
- title: "About:"
- }],
- sizemode: "maximized"
- }] };
-
- let uniqueKey = "bug 477657";
- let uniqueValue = "unik" + Date.now();
-
- ss.setWindowValue(newWin, uniqueKey, uniqueValue);
- is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
- "window value was set before the window was overwritten");
- ss.setWindowState(newWin, JSON.stringify(newState), true);
-
- // use newWin.setTimeout(..., 0) to mirror sss_restoreWindowFeatures
- newWin.setTimeout(function() {
- is(ss.getWindowValue(newWin, uniqueKey), "",
- "window value was implicitly cleared");
-
- is(newWin.windowState, newWin.STATE_MAXIMIZED,
- "the window was maximized");
-
- is(JSON.parse(ss.getClosedTabData(newWin)).length, 1,
- "the closed tab was added before the window was overwritten");
- delete newState.windows[0]._closedTabs;
- delete newState.windows[0].sizemode;
- ss.setWindowState(newWin, JSON.stringify(newState), true);
-
- newWin.setTimeout(function() {
- is(JSON.parse(ss.getClosedTabData(newWin)).length, 0,
- "closed tabs were implicitly cleared");
-
- is(newWin.windowState, newWin.STATE_MAXIMIZED,
- "the window remains maximized");
- newState.windows[0].sizemode = "normal";
- ss.setWindowState(newWin, JSON.stringify(newState), true);
-
- newWin.setTimeout(function() {
- isnot(newWin.windowState, newWin.STATE_MAXIMIZED,
- "the window was explicitly unmaximized");
-
- newWin.close();
- finish();
- }, 0);
- }, 0);
- }, 0);
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_480148.js b/browser/components/sessionstore/test/browser_480148.js
deleted file mode 100644
index a88882fe7..000000000
--- a/browser/components/sessionstore/test/browser_480148.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 484108 **/
- waitForExplicitFinish();
- requestLongerTimeout(5);
-
- // builds the tests state based on a few parameters
- function buildTestState(num, selected, hidden, pinned) {
- let state = { windows: [ { "tabs": [], "selected": selected + 1 } ] };
- while (num--) {
- state.windows[0].tabs.push({
- entries: [
- { url: "http://example.com/?t=" + state.windows[0].tabs.length }
- ]
- });
- let i = state.windows[0].tabs.length - 1;
- if (hidden.length > 0 && i == hidden[0]) {
- state.windows[0].tabs[i].hidden = true;
- hidden.splice(0, 1);
- }
- if (pinned.length > 0 && i == pinned[0]) {
- state.windows[0].tabs[i].pinned = true;
- pinned.splice(0, 1);
- }
- }
- return state;
- }
-
- let tests = [
- { testNum: 1,
- totalTabs: 13,
- selectedTab: 0,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [],
- order: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
- },
- { testNum: 2,
- totalTabs: 13,
- selectedTab: 12,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [],
- order: [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6]
- },
- { testNum: 3,
- totalTabs: 13,
- selectedTab: 3,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [],
- order: [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12]
- },
- { testNum: 4,
- totalTabs: 13,
- selectedTab: 10,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [],
- order: [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6]
- },
- { testNum: 5,
- totalTabs: 13,
- selectedTab: 12,
- shownTabs: 6,
- hiddenTabs: [0, 4, 9],
- pinnedTabs: [],
- order: [12, 6, 7, 8, 10, 11, 1, 2, 3, 5, 0, 4, 9]
- },
- { testNum: 6,
- totalTabs: 13,
- selectedTab: 3,
- shownTabs: 6,
- hiddenTabs: [1, 7, 12],
- pinnedTabs: [],
- order: [3, 4, 5, 6, 8, 9, 0, 2, 10, 11, 1, 7, 12]
- },
- { testNum: 7,
- totalTabs: 13,
- selectedTab: 3,
- shownTabs: 6,
- hiddenTabs: [0, 1, 2],
- pinnedTabs: [],
- order: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2]
- },
- { testNum: 8,
- totalTabs: 13,
- selectedTab: 0,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [0],
- order: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
- },
- { testNum: 9,
- totalTabs: 13,
- selectedTab: 1,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [0],
- order: [1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
- },
- { testNum: 10,
- totalTabs: 13,
- selectedTab: 3,
- shownTabs: 6,
- hiddenTabs: [2],
- pinnedTabs: [0,1],
- order: [3, 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 2]
- },
- { testNum: 11,
- totalTabs: 13,
- selectedTab: 12,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [0,1,2],
- order: [12, 0, 1, 2, 7, 8, 9, 10, 11, 3, 4, 5, 6]
- },
- { testNum: 12,
- totalTabs: 13,
- selectedTab: 6,
- shownTabs: 6,
- hiddenTabs: [3,4,5],
- pinnedTabs: [0,1,2],
- order: [6, 0, 1, 2, 7, 8, 9, 10, 11, 12, 3, 4, 5]
- },
- { testNum: 13,
- totalTabs: 13,
- selectedTab: 1,
- shownTabs: 6,
- hiddenTabs: [3,4,5],
- pinnedTabs: [0,1,2],
- order: [1, 0, 2, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5]
- },
- { testNum: 14,
- totalTabs: 13,
- selectedTab: 2,
- shownTabs: 6,
- hiddenTabs: [],
- pinnedTabs: [0,1,2],
- order: [2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
- },
- { testNum: 15,
- totalTabs: 13,
- selectedTab: 3,
- shownTabs: 6,
- hiddenTabs: [1,4],
- pinnedTabs: [0,1,2],
- order: [3, 0, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 4]
- }
- ];
-
- let tabMinWidth =
- parseInt(getComputedStyle(gBrowser.selectedTab, null).minWidth);
- let testIndex = 0;
-
- function runNextTest() {
- if (tests.length == 0) {
- finish();
- return;
- }
-
- let wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils);
- wu.garbageCollect();
-
- setTimeout(function() {
- info ("Starting test " + (++testIndex));
- let test = tests.shift();
- let state = buildTestState(test.totalTabs, test.selectedTab,
- test.hiddenTabs, test.pinnedTabs);
- let tabbarWidth = Math.floor((test.shownTabs - 0.5) * tabMinWidth);
- let win = openDialog(location, "_blank", "chrome,all,dialog=no");
- let tabsRestored = [];
-
- win.addEventListener("SSTabRestoring", function onSSTabRestoring(aEvent) {
- let tab = aEvent.originalTarget;
- let tabLink = tab.linkedBrowser.currentURI.spec;
- let tabIndex =
- tabLink.substring(tabLink.indexOf("?t=") + 3, tabLink.length);
-
- // we need to compare with the tab's restoring index, no with the
- // position index, since the pinned tabs change the positions in the
- // tabbar.
- tabsRestored.push(tabIndex);
-
- if (tabsRestored.length < state.windows[0].tabs.length)
- return;
-
- // all of the tabs should be restoring or restored by now
- is(tabsRestored.length, state.windows[0].tabs.length,
- "Test #" + testIndex + ": Number of restored tabs is as expected");
-
- is(tabsRestored.join(" "), test.order.join(" "),
- "Test #" + testIndex + ": 'visible' tabs restored first");
-
- // cleanup
- win.removeEventListener("SSTabRestoring", onSSTabRestoring, false);
- win.close();
- executeSoon(runNextTest);
- }, false);
-
- whenWindowLoaded(win, function(aEvent) {
- let extent =
- win.outerWidth - win.gBrowser.tabContainer.mTabstrip.scrollClientSize;
- let windowWidth = tabbarWidth + extent;
- win.resizeTo(windowWidth, win.outerHeight);
- ss.setWindowState(win, JSON.stringify(state), true);
- });
- }, 1000);
- };
-
- runNextTest();
-}
diff --git a/browser/components/sessionstore/test/browser_480893.js b/browser/components/sessionstore/test/browser_480893.js
deleted file mode 100644
index 719cacff1..000000000
--- a/browser/components/sessionstore/test/browser_480893.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 480893 **/
-
- waitForExplicitFinish();
-
- // Test that starting a new session loads a blank page if Firefox is
- // configured to display a blank page at startup (browser.startup.page = 0)
- gPrefService.setIntPref("browser.startup.page", 0);
- let tab = gBrowser.addTab("about:sessionrestore");
- gBrowser.selectedTab = tab;
- let browser = tab.linkedBrowser;
- browser.addEventListener("load", function(aEvent) {
- browser.removeEventListener("load", arguments.callee, true);
- let doc = browser.contentDocument;
-
- // click on the "Start New Session" button after about:sessionrestore is loaded
- doc.getElementById("errorCancel").click();
- browser.addEventListener("load", function(aEvent) {
- browser.removeEventListener("load", arguments.callee, true);
- let doc = browser.contentDocument;
-
- is(doc.URL, "about:blank", "loaded page is about:blank");
-
- // Test that starting a new session loads the homepage (set to http://mochi.test:8888)
- // if Firefox is configured to display a homepage at startup (browser.startup.page = 1)
- let homepage = "http://mochi.test:8888/";
- gPrefService.setCharPref("browser.startup.homepage", homepage);
- gPrefService.setIntPref("browser.startup.page", 1);
- gBrowser.loadURI("about:sessionrestore");
- browser.addEventListener("load", function(aEvent) {
- browser.removeEventListener("load", arguments.callee, true);
- let doc = browser.contentDocument;
-
- // click on the "Start New Session" button after about:sessionrestore is loaded
- doc.getElementById("errorCancel").click();
- browser.addEventListener("load", function(aEvent) {
- browser.removeEventListener("load", arguments.callee, true);
- let doc = browser.contentDocument;
-
- is(doc.URL, homepage, "loaded page is the homepage");
-
- // close tab, restore default values and finish the test
- gBrowser.removeTab(tab);
- gPrefService.clearUserPref("browser.startup.page");
- gPrefService.clearUserPref("browser.startup.homepage");
- finish();
- }, true);
- }, true);
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_483330.js b/browser/components/sessionstore/test/browser_483330.js
deleted file mode 100644
index 50f3a6a19..000000000
--- a/browser/components/sessionstore/test/browser_483330.js
+++ /dev/null
@@ -1,37 +0,0 @@
-function test() {
- /** Test for Bug 483330 **/
-
- waitForExplicitFinish();
-
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
-
- let browser = tab.linkedBrowser;
- browser.addEventListener("load", function loadListener(e) {
- browser.removeEventListener("load", arguments.callee, true);
-
- // Scroll the content document
- browser.contentWindow.scrollTo(1100, 1200);
- is(browser.contentWindow.scrollX, 1100, "scrolled horizontally");
- is(browser.contentWindow.scrollY, 1200, "scrolled vertically");
-
- gBrowser.removeTab(tab);
-
- let newTab = ss.undoCloseTab(window, 0);
- newTab.addEventListener("SSTabRestored", function tabRestored(e) {
- newTab.removeEventListener("SSTabRestored", arguments.callee, true);
-
- let newBrowser = newTab.linkedBrowser;
-
- // check that the scroll position was restored
- is(newBrowser.contentWindow.scrollX, 1100, "still scrolled horizontally");
- is(newBrowser.contentWindow.scrollY, 1200, "still scrolled vertically");
-
- gBrowser.removeTab(newTab);
-
- finish();
- }, true);
- }, true);
-
- browser.loadURI("data:text/html;charset=utf-8,<body style='width: 100000px; height: 100000px;'><p>top</p></body>");
-}
diff --git a/browser/components/sessionstore/test/browser_485482.js b/browser/components/sessionstore/test/browser_485482.js
deleted file mode 100644
index 19cfa0a2a..000000000
--- a/browser/components/sessionstore/test/browser_485482.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 485482 **/
-
- waitForExplicitFinish();
-
- let uniqueValue = Math.random();
-
- let rootDir = getRootDirectory(gTestPath);
- let testURL = rootDir + "browser_485482_sample.html";
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
- doc.querySelector("input[type=text]").value = uniqueValue;
- doc.querySelector("input[type=checkbox]").checked = true;
-
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- doc = tab2.linkedBrowser.contentDocument;
- is(doc.querySelector("input[type=text]").value, uniqueValue,
- "generated XPath expression was valid");
- ok(doc.querySelector("input[type=checkbox]").checked,
- "generated XPath expression was valid");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_485482_sample.html b/browser/components/sessionstore/test/browser_485482_sample.html
deleted file mode 100644
index c2097b593..000000000
--- a/browser/components/sessionstore/test/browser_485482_sample.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<title>Test for bug 485482</title>
-
-<bad=name>
- <input type="text">
-</bad=name>
-
-<worse=name>
- <l0c@l+na~e"'§>
- <input type="checkbox" name="check"> Check
- </l0c@l+na~e"'§>
-</worse=name>
diff --git a/browser/components/sessionstore/test/browser_485563.js b/browser/components/sessionstore/test/browser_485563.js
deleted file mode 100644
index 56e198477..000000000
--- a/browser/components/sessionstore/test/browser_485563.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 485563 **/
-
- waitForExplicitFinish();
-
- let uniqueValue = Math.random() + "\u2028Second line\u2029Second paragraph\u2027";
-
- let tab = gBrowser.addTab();
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- ss.setTabValue(tab, "bug485563", uniqueValue);
- let tabState = JSON.parse(ss.getTabState(tab));
- is(tabState.extData["bug485563"], uniqueValue,
- "unicode line separator wasn't over-encoded");
- ss.deleteTabValue(tab, "bug485563");
- ss.setTabState(tab, JSON.stringify(tabState));
- is(ss.getTabValue(tab, "bug485563"), uniqueValue,
- "unicode line separator was correctly preserved");
-
- gBrowser.removeTab(tab);
- finish();
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_490040.js b/browser/components/sessionstore/test/browser_490040.js
deleted file mode 100644
index 0cfdc9784..000000000
--- a/browser/components/sessionstore/test/browser_490040.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 490040 **/
-
- waitForExplicitFinish();
-
- function testWithState(aState) {
- // Ensure we can store the window if needed.
- let curClosedWindowCount = ss.getClosedWindowCount();
- gPrefService.setIntPref("browser.sessionstore.max_windows_undo",
- curClosedWindowCount + 1);
-
- var origWin;
- function windowObserver(aSubject, aTopic, aData) {
- let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
- if (origWin && theWin != origWin)
- return;
-
- switch (aTopic) {
- case "domwindowopened":
- origWin = theWin;
- theWin.addEventListener("load", function () {
- theWin.removeEventListener("load", arguments.callee, false);
- executeSoon(function () {
- // Close the window as soon as the first tab loads, or
- // immediately if there are no tabs.
- if (aState.windowState.windows[0].tabs[0].entries.length) {
- theWin.gBrowser.addEventListener("load", function() {
- theWin.gBrowser.removeEventListener("load",
- arguments.callee, true);
- theWin.close();
- }, true);
- } else {
- executeSoon(function () {
- theWin.close();
- });
- }
- ss.setWindowState(theWin, JSON.stringify(aState.windowState),
- true);
- });
- }, false);
- break;
-
- case "domwindowclosed":
- Services.ww.unregisterNotification(windowObserver);
- // Use executeSoon to ensure this happens after SS observer.
- executeSoon(function () {
- is(ss.getClosedWindowCount(),
- curClosedWindowCount + (aState.shouldBeAdded ? 1 : 0),
- "That window should " + (aState.shouldBeAdded ? "" : "not ") +
- "be restorable");
- executeSoon(runNextTest);
- });
- break;
- }
- }
- Services.ww.registerNotification(windowObserver);
- Services.ww.openWindow(null,
- location,
- "_blank",
- "chrome,all,dialog=no",
- null);
- }
-
- // Only windows with open tabs are restorable. Windows where a lone tab is
- // detached may have _closedTabs, but is left with just an empty tab.
- let states = [
- {
- shouldBeAdded: true,
- windowState: {
- windows: [{
- tabs: [{ entries: [{ url: "http://example.com", title: "example.com" }] }],
- selected: 1,
- _closedTabs: []
- }]
- }
- },
- {
- shouldBeAdded: false,
- windowState: {
- windows: [{
- tabs: [{ entries: [] }],
- _closedTabs: []
- }]
- }
- },
- {
- shouldBeAdded: false,
- windowState: {
- windows: [{
- tabs: [{ entries: [] }],
- _closedTabs: [{ state: { entries: [{ url: "http://example.com", index: 1 }] } }]
- }]
- }
- },
- {
- shouldBeAdded: false,
- windowState: {
- windows: [{
- tabs: [{ entries: [] }],
- _closedTabs: [],
- extData: { keyname: "pi != " + Math.random() }
- }]
- }
- }
- ];
-
- function runNextTest() {
- if (states.length) {
- let state = states.shift();
- testWithState(state);
- }
- else {
- gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
- finish();
- }
- }
- runNextTest();
-}
-
diff --git a/browser/components/sessionstore/test/browser_491168.js b/browser/components/sessionstore/test/browser_491168.js
deleted file mode 100644
index 01572dc65..000000000
--- a/browser/components/sessionstore/test/browser_491168.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 491168 **/
-
- waitForExplicitFinish();
-
- const REFERRER1 = "http://example.org/?" + Date.now();
- const REFERRER2 = "http://example.org/?" + Math.random();
-
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
-
- let browser = tab.linkedBrowser;
- browser.addEventListener("load", function() {
- browser.removeEventListener("load", arguments.callee, true);
-
- let tabState = JSON.parse(ss.getTabState(tab));
- is(tabState.entries[0].referrer, REFERRER1,
- "Referrer retrieved via getTabState matches referrer set via loadURI.");
-
- tabState.entries[0].referrer = REFERRER2;
- ss.setTabState(tab, JSON.stringify(tabState));
-
- tab.addEventListener("SSTabRestored", function() {
- tab.removeEventListener("SSTabRestored", arguments.callee, true);
- is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState.");
-
- gBrowser.removeTab(tab);
- let newTab = ss.undoCloseTab(window, 0);
- newTab.addEventListener("SSTabRestored", function() {
- newTab.removeEventListener("SSTabRestored", arguments.callee, true);
-
- is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab.");
- gBrowser.removeTab(newTab);
-
- finish();
- }, true);
- }, true);
- },true);
-
- let referrerURI = Services.io.newURI(REFERRER1, null, null);
- browser.loadURI("http://example.org", referrerURI, null);
-}
diff --git a/browser/components/sessionstore/test/browser_491577.js b/browser/components/sessionstore/test/browser_491577.js
deleted file mode 100644
index 7626db1a4..000000000
--- a/browser/components/sessionstore/test/browser_491577.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 491577 **/
-
- // test setup
- waitForExplicitFinish();
-
- const REMEMBER = Date.now(), FORGET = Math.random();
- let test_state = {
- windows: [ { tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 } ],
- _closedWindows : [
- // _closedWindows[0]
- {
- tabs: [
- { entries: [{ url: "http://example.com/", title: "title" }] },
- { entries: [{ url: "http://mozilla.org/", title: "title" }] }
- ],
- selected: 2,
- title: FORGET,
- _closedTabs: []
- },
- // _closedWindows[1]
- {
- tabs: [
- { entries: [{ url: "http://mozilla.org/", title: "title" }] },
- { entries: [{ url: "http://example.com/", title: "title" }] },
- { entries: [{ url: "http://mozilla.org/", title: "title" }] },
- ],
- selected: 3,
- title: REMEMBER,
- _closedTabs: []
- },
- // _closedWindows[2]
- {
- tabs: [
- { entries: [{ url: "http://example.com/", title: "title" }] }
- ],
- selected: 1,
- title: FORGET,
- _closedTabs: [
- {
- state: {
- entries: [
- { url: "http://mozilla.org/", title: "title" },
- { url: "http://mozilla.org/again", title: "title" }
- ]
- },
- pos: 1,
- title: "title"
- },
- {
- state: {
- entries: [
- { url: "http://example.com", title: "title" }
- ]
- },
- title: "title"
- }
- ]
- }
- ]
- };
- let remember_count = 1;
-
- function countByTitle(aClosedWindowList, aTitle)
- aClosedWindowList.filter(function(aData) aData.title == aTitle).length;
-
- function testForError(aFunction) {
- try {
- aFunction();
- return false;
- }
- catch (ex) {
- return ex.name == "NS_ERROR_ILLEGAL_VALUE";
- }
- }
-
- // open a window and add the above closed window list
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
- newWin.addEventListener("load", function(aEvent) {
- this.removeEventListener("load", arguments.callee, false);
- gPrefService.setIntPref("browser.sessionstore.max_windows_undo",
- test_state._closedWindows.length);
- ss.setWindowState(newWin, JSON.stringify(test_state), true);
-
- let closedWindows = JSON.parse(ss.getClosedWindowData());
- is(closedWindows.length, test_state._closedWindows.length,
- "Closed window list has the expected length");
- is(countByTitle(closedWindows, FORGET),
- test_state._closedWindows.length - remember_count,
- "The correct amount of windows are to be forgotten");
- is(countByTitle(closedWindows, REMEMBER), remember_count,
- "Everything is set up.");
-
- // all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
- ok(testForError(function() ss.forgetClosedWindow(-1)),
- "Invalid window for forgetClosedWindow throws");
- ok(testForError(function() ss.forgetClosedWindow(test_state._closedWindows.length + 1)),
- "Invalid window for forgetClosedWindow throws");
-
- // Remove third window, then first window
- ss.forgetClosedWindow(2);
- ss.forgetClosedWindow(null);
-
- closedWindows = JSON.parse(ss.getClosedWindowData());
- is(closedWindows.length, remember_count,
- "The correct amount of windows were removed");
- is(countByTitle(closedWindows, FORGET), 0,
- "All windows specifically forgotten were indeed removed");
- is(countByTitle(closedWindows, REMEMBER), remember_count,
- "... and windows not specifically forgetten weren't.");
-
- // clean up
- newWin.close();
- gPrefService.clearUserPref("browser.sessionstore.max_windows_undo");
- finish();
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_495495.js b/browser/components/sessionstore/test/browser_495495.js
deleted file mode 100644
index 982bcdcaf..000000000
--- a/browser/components/sessionstore/test/browser_495495.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 495495 **/
-
- waitForExplicitFinish();
-
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no,toolbar=yes");
- newWin.addEventListener("load", function() {
- newWin.removeEventListener("load", arguments.callee, false);
-
- executeSoon(function() {
- let state1 = ss.getWindowState(newWin);
- newWin.close();
-
- newWin = openDialog(location, "_blank",
- "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar=no,location,personal,directories,dialog=no");
- newWin.addEventListener("load", function() {
- newWin.removeEventListener("load", arguments.callee, false);
-
- executeSoon(function() {
- let state2 = ss.getWindowState(newWin);
- newWin.close();
-
- function testState(state, expected, callback) {
- let win = openDialog(location, "_blank", "chrome,all,dialog=no");
- win.addEventListener("load", function() {
- win.removeEventListener("load", arguments.callee, false);
-
- is(win.gURLBar.readOnly, false,
- "URL bar should not be read-only before setting the state");
- is(win.gURLBar.getAttribute("enablehistory"), "true",
- "URL bar autocomplete should be enabled before setting the state");
- ss.setWindowState(win, state, true);
- is(win.gURLBar.readOnly, expected.readOnly,
- "URL bar read-only state should be restored correctly");
- is(win.gURLBar.getAttribute("enablehistory"), expected.enablehistory,
- "URL bar autocomplete state should be restored correctly");
-
- win.close();
- executeSoon(callback);
- }, false);
- }
-
- testState(state1, {readOnly: false, enablehistory: "true"}, function() {
- testState(state2, {readOnly: true, enablehistory: "false"}, finish);
- });
- });
- }, false);
- });
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_500328.js b/browser/components/sessionstore/test/browser_500328.js
deleted file mode 100644
index bd0c95131..000000000
--- a/browser/components/sessionstore/test/browser_500328.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function checkState(tab) {
- // Go back and then forward, and make sure that the state objects received
- // from the popState event are as we expect them to be.
- //
- // We also add a node to the document's body when after going back and make
- // sure it's still there after we go forward -- this is to test that the two
- // history entries correspond to the same document.
-
- let popStateCount = 0;
-
- tab.linkedBrowser.addEventListener('popstate', function(aEvent) {
- let contentWindow = tab.linkedBrowser.contentWindow;
- if (popStateCount == 0) {
- popStateCount++;
-
- is(tab.linkedBrowser.contentWindow.testState, 'foo',
- 'testState after going back');
-
- ok(aEvent.state, "Event should have a state property.");
- is(JSON.stringify(tab.linkedBrowser.contentWindow.history.state), JSON.stringify({obj1:1}),
- "first popstate object.");
-
- // Add a node with id "new-elem" to the document.
- let doc = contentWindow.document;
- ok(!doc.getElementById("new-elem"),
- "doc shouldn't contain new-elem before we add it.");
- let elem = doc.createElement("div");
- elem.id = "new-elem";
- doc.body.appendChild(elem);
-
- contentWindow.history.forward();
- }
- else if (popStateCount == 1) {
- popStateCount++;
- is(aEvent.state.obj3.toString(), '/^a$/', "second popstate object.");
-
- // Make sure that the new-elem node is present in the document. If it's
- // not, then this history entry has a different doc identifier than the
- // previous entry, which is bad.
- let doc = contentWindow.document;
- let newElem = doc.getElementById("new-elem");
- ok(newElem, "doc should contain new-elem.");
- newElem.parentNode.removeChild(newElem);
- ok(!doc.getElementById("new-elem"), "new-elem should be removed.");
-
- // Clean up after ourselves and finish the test.
- tab.linkedBrowser.removeEventListener("popstate", arguments.callee, true);
- gBrowser.removeTab(tab);
- finish();
- }
- }, true);
-
- // Set some state in the page's window. When we go back(), the page should
- // be retrieved from bfcache, and this state should still be there.
- tab.linkedBrowser.contentWindow.testState = 'foo';
-
- // Now go back. This should trigger the popstate event handler above.
- tab.linkedBrowser.contentWindow.history.back();
-}
-
-function test() {
- // Tests session restore functionality of history.pushState and
- // history.replaceState(). (Bug 500328)
-
- waitForExplicitFinish();
-
- // We open a new blank window, let it load, and then load in
- // http://example.com. We need to load the blank window first, otherwise the
- // docshell gets confused and doesn't have a current history entry.
- let tab = gBrowser.addTab("about:blank");
- let tabBrowser = tab.linkedBrowser;
-
- tabBrowser.addEventListener("load", function(aEvent) {
- tabBrowser.removeEventListener("load", arguments.callee, true);
-
- tabBrowser.loadURI("http://example.com", null, null);
-
- tabBrowser.addEventListener("load", function(aEvent) {
- tabBrowser.removeEventListener("load", arguments.callee, true);
-
- // After these push/replaceState calls, the window should have three
- // history entries:
- // testURL (state object: null) <-- oldest
- // testURL (state object: {obj1:1})
- // testURL?page2 (state object: {obj3:/^a$/}) <-- newest
- let contentWindow = tab.linkedBrowser.contentWindow;
- let history = contentWindow.history;
- history.pushState({obj1:1}, "title-obj1");
- history.pushState({obj2:2}, "title-obj2", "?page2");
- history.replaceState({obj3:/^a$/}, "title-obj3");
-
- let state = ss.getTabState(tab);
- gBrowser.removeTab(tab);
-
- // Restore the state into a new tab. Things don't work well when we
- // restore into the old tab, but that's not a real use case anyway.
- let tab2 = gBrowser.addTab("about:blank");
- ss.setTabState(tab2, state, true);
-
- // Run checkState() once the tab finishes loading its restored state.
- tab2.linkedBrowser.addEventListener("load", function() {
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- SimpleTest.executeSoon(function() {
- checkState(tab2);
- });
- }, true);
-
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_506482.js b/browser/components/sessionstore/test/browser_506482.js
deleted file mode 100644
index 3d0a68d71..000000000
--- a/browser/components/sessionstore/test/browser_506482.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 506482 **/
-
- // test setup
- waitForExplicitFinish();
-
- // read the sessionstore.js mtime (picked from browser_248970_a.js)
- let profilePath = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties).
- get("ProfD", Ci.nsIFile);
- function getSessionstoreFile() {
- let sessionStoreJS = profilePath.clone();
- sessionStoreJS.append("sessionstore.js");
- return sessionStoreJS;
- }
- function getSessionstorejsModificationTime() {
- let file = getSessionstoreFile();
- if (file.exists())
- return file.lastModifiedTime;
- else
- return -1;
- }
-
- // delete existing sessionstore.js, to make sure we're not reading
- // the mtime of an old one initialy
- let (sessionStoreJS = getSessionstoreFile()) {
- if (sessionStoreJS.exists())
- sessionStoreJS.remove(false);
- }
-
- // test content URL
- const TEST_URL = "data:text/html;charset=utf-8,"
- + "<body style='width: 100000px; height: 100000px;'><p>top</p></body>"
-
- // preferences that we use
- const PREF_INTERVAL = "browser.sessionstore.interval";
-
- // make sure sessionstore.js is saved ASAP on all events
- gPrefService.setIntPref(PREF_INTERVAL, 0);
-
- // get the initial sessionstore.js mtime (-1 if it doesn't exist yet)
- let mtime0 = getSessionstorejsModificationTime();
-
- // create and select a first tab
- let tab = gBrowser.addTab(TEST_URL);
- tab.linkedBrowser.addEventListener("load", function loadListener(e) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- // step1: the above has triggered some saveStateDelayed(), sleep until
- // it's done, and get the initial sessionstore.js mtime
- setTimeout(function step1(e) {
- let mtime1 = getSessionstorejsModificationTime();
- isnot(mtime1, mtime0, "initial sessionstore.js update");
-
- // step2: test sessionstore.js is not updated on tab selection
- // or content scrolling
- gBrowser.selectedTab = tab;
- tab.linkedBrowser.contentWindow.scrollTo(1100, 1200);
- setTimeout(function step2(e) {
- let mtime2 = getSessionstorejsModificationTime();
- is(mtime2, mtime1,
- "tab selection and scrolling: sessionstore.js not updated");
-
- // ok, done, cleanup and finish
- if (gPrefService.prefHasUserValue(PREF_INTERVAL))
- gPrefService.clearUserPref(PREF_INTERVAL);
- gBrowser.removeTab(tab);
- finish();
- }, 3500); // end of sleep after tab selection and scrolling
- }, 3500); // end of sleep after initial saveStateDelayed()
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_514751.js b/browser/components/sessionstore/test/browser_514751.js
deleted file mode 100644
index b30807751..000000000
--- a/browser/components/sessionstore/test/browser_514751.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 514751 (Wallpaper) **/
-
- waitForExplicitFinish();
-
- let state = {
- windows: [{
- tabs: [{
- entries: [
- { url: "http://www.mozilla.org/projects/minefield/", title: "Minefield Start Page" },
- {}
- ]
- }]
- }]
- };
-
- var theWin = openDialog(location, "", "chrome,all,dialog=no");
- theWin.addEventListener("load", function () {
- theWin.removeEventListener("load", arguments.callee, false);
-
- executeSoon(function () {
- var gotError = false;
- try {
- ss.setWindowState(theWin, JSON.stringify(state), true);
- } catch (e) {
- if (/NS_ERROR_MALFORMED_URI/.test(e))
- gotError = true;
- }
- ok(!gotError, "Didn't get a malformed URI error.");
- theWin.close();
- finish();
- });
- }, false);
-}
-
diff --git a/browser/components/sessionstore/test/browser_522375.js b/browser/components/sessionstore/test/browser_522375.js
deleted file mode 100644
index 50b74d6cd..000000000
--- a/browser/components/sessionstore/test/browser_522375.js
+++ /dev/null
@@ -1,21 +0,0 @@
-function test() {
- var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup).getStartupInfo();
- // No .process info on mac
-
- // Check if we encountered a telemetry error for the the process creation
- // timestamp and turn the first test into a known failure.
- var telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
- var snapshot = telemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
- .snapshot();
-
- if (snapshot.counts[0] == 0)
- ok(startup_info.process <= startup_info.main, "process created before main is run " + uneval(startup_info));
- else
- todo(false, "An error occurred while recording the process creation timestamp, skipping this test");
-
- // on linux firstPaint can happen after everything is loaded (especially with remote X)
- if (startup_info.firstPaint)
- ok(startup_info.main <= startup_info.firstPaint, "main ran before first paint " + uneval(startup_info));
-
- ok(startup_info.main < startup_info.sessionRestored, "Session restored after main " + uneval(startup_info));
-}
diff --git a/browser/components/sessionstore/test/browser_522545.js b/browser/components/sessionstore/test/browser_522545.js
deleted file mode 100644
index ac05865de..000000000
--- a/browser/components/sessionstore/test/browser_522545.js
+++ /dev/null
@@ -1,270 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 522545 **/
-
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- // This tests the following use case:
- // User opens a new tab which gets focus. The user types something into the
- // address bar, then crashes or quits.
- function test_newTabFocused() {
- let state = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:mozilla" }] },
- { entries: [], userTypedValue: "example.com", userTypedClear: 0 }
- ],
- selected: 2
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.selectedBrowser;
- is(browser.currentURI.spec, "about:blank",
- "No history entries still sets currentURI to about:blank");
- is(browser.userTypedValue, "example.com",
- "userTypedValue was correctly restored");
- is(browser.userTypedClear, 0,
- "userTypeClear restored as expected");
- is(gURLBar.value, "example.com",
- "Address bar's value correctly restored");
- // Change tabs to make sure address bar value gets updated
- gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(0);
- is(gURLBar.value, "about:mozilla",
- "Address bar's value correctly updated");
- runNextTest();
- });
- }
-
- // This tests the following use case:
- // User opens a new tab which gets focus. The user types something into the
- // address bar, switches back to the first tab, then crashes or quits.
- function test_newTabNotFocused() {
- let state = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:mozilla" }] },
- { entries: [], userTypedValue: "example.org", userTypedClear: 0 }
- ],
- selected: 1
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.getBrowserAtIndex(1);
- is(browser.currentURI.spec, "about:blank",
- "No history entries still sets currentURI to about:blank");
- is(browser.userTypedValue, "example.org",
- "userTypedValue was correctly restored");
- is(browser.userTypedClear, 0,
- "userTypeClear restored as expected");
- is(gURLBar.value, "about:mozilla",
- "Address bar's value correctly restored");
- // Change tabs to make sure address bar value gets updated
- gBrowser.selectedTab = gBrowser.tabContainer.getItemAtIndex(1);
- is(gURLBar.value, "example.org",
- "Address bar's value correctly updated");
- runNextTest();
- });
- }
-
- // This tests the following use case:
- // User is in a tab with session history, then types something in the
- // address bar, then crashes or quits.
- function test_existingSHEnd_noClear() {
- let state = {
- windows: [{
- tabs: [{
- entries: [{ url: "about:mozilla" }, { url: "about:config" }],
- index: 2,
- userTypedValue: "example.com",
- userTypedClear: 0
- }]
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.selectedBrowser;
- is(browser.currentURI.spec, "about:config",
- "browser.currentURI set to current entry in SH");
- is(browser.userTypedValue, "example.com",
- "userTypedValue was correctly restored");
- is(browser.userTypedClear, 0,
- "userTypeClear restored as expected");
- is(gURLBar.value, "example.com",
- "Address bar's value correctly restored to userTypedValue");
- runNextTest();
- });
- }
-
- // This tests the following use case:
- // User is in a tab with session history, presses back at some point, then
- // types something in the address bar, then crashes or quits.
- function test_existingSHMiddle_noClear() {
- let state = {
- windows: [{
- tabs: [{
- entries: [{ url: "about:mozilla" }, { url: "about:config" }],
- index: 1,
- userTypedValue: "example.org",
- userTypedClear: 0
- }]
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.selectedBrowser;
- is(browser.currentURI.spec, "about:mozilla",
- "browser.currentURI set to current entry in SH");
- is(browser.userTypedValue, "example.org",
- "userTypedValue was correctly restored");
- is(browser.userTypedClear, 0,
- "userTypeClear restored as expected");
- is(gURLBar.value, "example.org",
- "Address bar's value correctly restored to userTypedValue");
- runNextTest();
- });
- }
-
- // This test simulates lots of tabs opening at once and then quitting/crashing.
- function test_getBrowserState_lotsOfTabsOpening() {
- gBrowser.stop();
-
- let uris = [];
- for (let i = 0; i < 25; i++)
- uris.push("http://example.com/" + i);
-
- // We're waiting for the first location change, which should indicate
- // one of the tabs has loaded and the others haven't. So one should
- // be in a non-userTypedValue case, while others should still have
- // userTypedValue and userTypedClear set.
- gBrowser.addTabsProgressListener({
- onLocationChange: function (aBrowser) {
- if (uris.indexOf(aBrowser.currentURI.spec) > -1) {
- gBrowser.removeTabsProgressListener(this);
- firstLocationChange();
- }
- }
- });
-
- function firstLocationChange() {
- let state = JSON.parse(ss.getBrowserState());
- let hasUTV = state.windows[0].tabs.some(function(aTab) {
- return aTab.userTypedValue && aTab.userTypedClear && !aTab.entries.length;
- });
-
- ok(hasUTV, "At least one tab has a userTypedValue with userTypedClear with no loaded URL");
-
- gBrowser.addEventListener("load", firstLoad, true);
- }
-
- function firstLoad() {
- gBrowser.removeEventListener("load", firstLoad, true);
-
- let state = JSON.parse(ss.getBrowserState());
- let hasSH = state.windows[0].tabs.some(function(aTab) {
- return !("userTypedValue" in aTab) && aTab.entries[0].url;
- });
-
- ok(hasSH, "At least one tab has its entry in SH");
-
- runNextTest();
- }
-
- gBrowser.loadTabs(uris);
- }
-
- // This simulates setting a userTypedValue and ensures that just typing in the
- // URL bar doesn't set userTypedClear as well.
- function test_getBrowserState_userTypedValue() {
- let state = {
- windows: [{
- tabs: [{ entries: [] }]
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.selectedBrowser;
- // Make sure this tab isn't loading and state is clear before we test.
- is(browser.userTypedValue, null, "userTypedValue is empty to start");
- is(browser.userTypedClear, 0, "userTypedClear is 0 to start");
-
- gURLBar.value = "example.org";
- let event = document.createEvent("Events");
- event.initEvent("input", true, false);
- gURLBar.dispatchEvent(event);
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- executeSoon(function () {
- is(browser.userTypedValue, "example.org",
- "userTypedValue was set when changing gURLBar.value");
- is(browser.userTypedClear, 0,
- "userTypedClear was not changed when changing gURLBar.value");
-
- // Now make sure ss gets these values too
- let newState = JSON.parse(ss.getBrowserState());
- is(newState.windows[0].tabs[0].userTypedValue, "example.org",
- "sessionstore got correct userTypedValue");
- is(newState.windows[0].tabs[0].userTypedClear, 0,
- "sessionstore got correct userTypedClear");
- runNextTest();
- });
- }, true);
- });
- }
-
- // test_getBrowserState_lotsOfTabsOpening tested userTypedClear in a few cases,
- // but not necessarily any that had legitimate URIs in the state of loading
- // (eg, "http://example.com"), so this test will cover that case.
- function test_userTypedClearLoadURI() {
- let state = {
- windows: [{
- tabs: [
- { entries: [], userTypedValue: "http://example.com", userTypedClear: 2 }
- ]
- }]
- };
-
- waitForBrowserState(state, function() {
- let browser = gBrowser.selectedBrowser;
- is(browser.currentURI.spec, "http://example.com/",
- "userTypedClear=2 caused userTypedValue to be loaded");
- is(browser.userTypedValue, null,
- "userTypedValue was null after loading a URI");
- is(browser.userTypedClear, 0,
- "userTypeClear reset to 0");
- is(gURLBar.value, gURLBar.trimValue("http://example.com/"),
- "Address bar's value set after loading URI");
- runNextTest();
- });
- }
-
-
- let tests = [test_newTabFocused, test_newTabNotFocused,
- test_existingSHEnd_noClear, test_existingSHMiddle_noClear,
- test_getBrowserState_lotsOfTabsOpening,
- test_getBrowserState_userTypedValue, test_userTypedClearLoadURI];
- let originalState = ss.getBrowserState();
- let state = {
- windows: [{
- tabs: [{ entries: [{ url: "about:blank" }] }]
- }]
- };
- function runNextTest() {
- if (tests.length) {
- waitForBrowserState(state, tests.shift());
- } else {
- ss.setBrowserState(originalState);
- executeSoon(finish);
- }
- }
-
- // Run the tests!
- runNextTest();
-}
diff --git a/browser/components/sessionstore/test/browser_524745.js b/browser/components/sessionstore/test/browser_524745.js
deleted file mode 100644
index b531f4c8d..000000000
--- a/browser/components/sessionstore/test/browser_524745.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 524745 **/
-
- let uniqKey = "bug524745";
- let uniqVal = Date.now();
-
- waitForExplicitFinish();
-
- let window_B = openDialog(location, "_blank", "chrome,all,dialog=no");
- window_B.addEventListener("load", function(aEvent) {
- window_B.removeEventListener("load", arguments.callee, false);
-
- waitForFocus(function() {
- // Add identifying information to window_B
- ss.setWindowValue(window_B, uniqKey, uniqVal);
- let state = JSON.parse(ss.getBrowserState());
- let selectedWindow = state.windows[state.selectedWindow - 1];
- is(selectedWindow.extData && selectedWindow.extData[uniqKey], uniqVal,
- "selectedWindow is window_B");
-
- // Now minimize window_B. The selected window shouldn't have the secret data
- window_B.minimize();
- waitForFocus(function() {
- state = JSON.parse(ss.getBrowserState());
- selectedWindow = state.windows[state.selectedWindow - 1];
- ok(!selectedWindow.extData || !selectedWindow.extData[uniqKey],
- "selectedWindow is not window_B after minimizing it");
-
- // Now minimize the last open window (assumes no other tests left windows open)
- window.minimize();
- state = JSON.parse(ss.getBrowserState());
- is(state.selectedWindow, 0,
- "selectedWindow should be 0 when all windows are minimized");
-
- // Cleanup
- window.restore();
- window_B.close();
- finish();
- });
- }, window_B);
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_526613.js b/browser/components/sessionstore/test/browser_526613.js
deleted file mode 100644
index 7e7fe8059..000000000
--- a/browser/components/sessionstore/test/browser_526613.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 526613 **/
-
- // test setup
- waitForExplicitFinish();
-
- function browserWindowsCount(expected) {
- let count = 0;
- let e = Services.wm.getEnumerator("navigator:browser");
- while (e.hasMoreElements()) {
- if (!e.getNext().closed)
- ++count;
- }
- is(count, expected,
- "number of open browser windows according to nsIWindowMediator");
- let state = ss.getBrowserState();
- info(state);
- is(JSON.parse(state).windows.length, expected,
- "number of open browser windows according to getBrowserState");
- }
-
- browserWindowsCount(1);
-
- // backup old state
- let oldState = ss.getBrowserState();
- // create a new state for testing
- let testState = {
- windows: [
- { tabs: [{ entries: [{ url: "http://example.com/" }] }], selected: 1 },
- { tabs: [{ entries: [{ url: "about:mozilla" }] }], selected: 1 },
- ],
- // make sure the first window is focused, otherwise when restoring the
- // old state, the first window is closed and the test harness gets unloaded
- selectedWindow: 1
- };
-
- let pass = 1;
- function observer(aSubject, aTopic, aData) {
- is(aTopic, "sessionstore-browser-state-restored",
- "The sessionstore-browser-state-restored notification was observed");
-
- if (pass++ == 1) {
- browserWindowsCount(2);
-
- // let the first window be focused (see above)
- function pollMostRecentWindow() {
- if (Services.wm.getMostRecentWindow("navigator:browser") == window) {
- ss.setBrowserState(oldState);
- } else {
- info("waiting for the current window to become active");
- setTimeout(pollMostRecentWindow, 0);
- window.focus(); //XXX Why is this needed?
- }
- }
- pollMostRecentWindow();
- }
- else {
- browserWindowsCount(1);
- ok(!window.closed, "Restoring the old state should have left this window open");
- Services.obs.removeObserver(observer, "sessionstore-browser-state-restored");
- finish();
- }
- }
- Services.obs.addObserver(observer, "sessionstore-browser-state-restored", false);
-
- // set browser to test state
- ss.setBrowserState(JSON.stringify(testState));
-}
diff --git a/browser/components/sessionstore/test/browser_528776.js b/browser/components/sessionstore/test/browser_528776.js
deleted file mode 100644
index b25812195..000000000
--- a/browser/components/sessionstore/test/browser_528776.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function browserWindowsCount(expected) {
- var count = 0;
- var e = Services.wm.getEnumerator("navigator:browser");
- while (e.hasMoreElements()) {
- if (!e.getNext().closed)
- ++count;
- }
- is(count, expected,
- "number of open browser windows according to nsIWindowMediator");
- is(JSON.parse(ss.getBrowserState()).windows.length, expected,
- "number of open browser windows according to getBrowserState");
-}
-
-function test() {
- waitForExplicitFinish();
-
- browserWindowsCount(1);
-
- var win = openDialog(location, "", "chrome,all,dialog=no");
- win.addEventListener("load", function () {
- win.removeEventListener("load", arguments.callee, false);
- browserWindowsCount(2);
- win.close();
- browserWindowsCount(1);
- finish();
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_579868.js b/browser/components/sessionstore/test/browser_579868.js
deleted file mode 100644
index 683ead7c3..000000000
--- a/browser/components/sessionstore/test/browser_579868.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- let tab1 = gBrowser.addTab("about:rights");
- let tab2 = gBrowser.addTab("about:mozilla");
- tab1.linkedBrowser.addEventListener("load", mainPart, true);
- waitForExplicitFinish();
-
- function mainPart() {
- tab1.linkedBrowser.removeEventListener("load", mainPart, true);
-
- // Tell the session storer that the tab is pinned
- let newTabState = '{"entries":[{"url":"about:rights"}],"pinned":true,"userTypedValue":"Hello World!"}';
- ss.setTabState(tab1, newTabState);
-
- // Undo pinning
- gBrowser.unpinTab(tab1);
-
- is(tab1.linkedBrowser.__SS_tabStillLoading, true,
- "_tabStillLoading should be true.");
-
- // Close and restore tab
- gBrowser.removeTab(tab1);
- let savedState = JSON.parse(ss.getClosedTabData(window))[0].state;
- isnot(savedState.pinned, true, "Pinned should not be true");
- tab1 = ss.undoCloseTab(window, 0);
-
- isnot(tab1.pinned, true, "Should not be pinned");
- gBrowser.removeTab(tab1);
- gBrowser.removeTab(tab2);
- finish();
- }
-}
diff --git a/browser/components/sessionstore/test/browser_579879.js b/browser/components/sessionstore/test/browser_579879.js
deleted file mode 100644
index e6c689d36..000000000
--- a/browser/components/sessionstore/test/browser_579879.js
+++ /dev/null
@@ -1,23 +0,0 @@
-function test() {
- waitForExplicitFinish();
-
- var tab1 = gBrowser.addTab("data:text/plain;charset=utf-8,foo");
- gBrowser.pinTab(tab1);
-
- tab1.linkedBrowser.addEventListener("load", function () {
- tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- var tab2 = gBrowser.addTab();
- gBrowser.pinTab(tab2);
-
- is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 is at the first position");
- gBrowser.removeTab(tab1);
- tab1 = undoCloseTab();
- ok(tab1.pinned, "pinned tab 1 has been restored as a pinned tab");
- is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 has been restored to the first position");
-
- gBrowser.removeTab(tab1);
- gBrowser.removeTab(tab2);
- finish();
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_580512.js b/browser/components/sessionstore/test/browser_580512.js
deleted file mode 100644
index 9d385d29d..000000000
--- a/browser/components/sessionstore/test/browser_580512.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const URIS_PINNED = ["about:license", "about:about"];
-const URIS_NORMAL_A = ["about:mozilla"];
-const URIS_NORMAL_B = ["about:buildconfig"];
-
-function test() {
- waitForExplicitFinish();
-
- isnot(Services.prefs.getIntPref("browser.startup.page"), 3,
- "pref to save session must not be set for this test");
- ok(!Services.prefs.getBoolPref("browser.sessionstore.resume_session_once"),
- "pref to save session once must not be set for this test");
-
- document.documentElement.setAttribute("windowtype", "navigator:browsertestdummy");
-
- openWinWithCb(closeFirstWin, URIS_PINNED.concat(URIS_NORMAL_A));
-}
-
-function closeFirstWin(win) {
- win.gBrowser.pinTab(win.gBrowser.tabs[0]);
- win.gBrowser.pinTab(win.gBrowser.tabs[1]);
- win.BrowserTryToCloseWindow();
- ok(win.closed, "window closed");
-
- openWinWithCb(checkSecondWin, URIS_NORMAL_B, URIS_PINNED.concat(URIS_NORMAL_B));
-}
-
-function checkSecondWin(win) {
- is(win.gBrowser.browsers[0].currentURI.spec, URIS_PINNED[0], "first pinned tab restored");
- is(win.gBrowser.browsers[1].currentURI.spec, URIS_PINNED[1], "second pinned tab restored");
- ok(win.gBrowser.tabs[0].pinned, "first pinned tab is still pinned");
- ok(win.gBrowser.tabs[1].pinned, "second pinned tab is still pinned");
- win.close();
-
- // cleanup
- document.documentElement.setAttribute("windowtype", "navigator:browser");
- finish();
-}
-
-function openWinWithCb(cb, argURIs, expectedURIs) {
- if (!expectedURIs)
- expectedURIs = argURIs;
-
- var win = openDialog(getBrowserURL(), "_blank",
- "chrome,all,dialog=no", argURIs.join("|"));
-
- win.addEventListener("load", function () {
- win.removeEventListener("load", arguments.callee, false);
- info("the window loaded");
-
- var expectedLoads = expectedURIs.length;
-
- win.gBrowser.addTabsProgressListener({
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aRequest &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
- expectedURIs.indexOf(aRequest.QueryInterface(Ci.nsIChannel).originalURI.spec) > -1 &&
- --expectedLoads <= 0) {
- win.gBrowser.removeTabsProgressListener(this);
- info("all tabs loaded");
- is(win.gBrowser.tabs.length, expectedURIs.length, "didn't load any unexpected tabs");
- executeSoon(function () {
- cb(win);
- });
- }
- }
- });
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_581593.js b/browser/components/sessionstore/test/browser_581593.js
deleted file mode 100644
index 7544db3f9..000000000
--- a/browser/components/sessionstore/test/browser_581593.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let stateBackup = ss.getBrowserState();
-
-function test() {
- /** Test for bug 581593 **/
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- let oldState = { windows: [{ tabs: [{ entries: [{ url: "example.com" }] }] }]};
- let pageData = {
- url: "about:sessionrestore",
- formdata: { id: { "sessionData": "(" + JSON.stringify(oldState) + ")" } }
- };
- let state = { windows: [{ tabs: [{ entries: [pageData] }] }] };
-
- // The form data will be restored before SSTabRestored, so we want to listen
- // for that on the currently selected tab (it will be reused)
- gBrowser.selectedTab.addEventListener("SSTabRestored", onSSTabRestored, true);
-
- ss.setBrowserState(JSON.stringify(state));
-}
-
-function onSSTabRestored(aEvent) {
- info("SSTabRestored event");
- gBrowser.selectedTab.removeEventListener("SSTabRestored", onSSTabRestored, true);
- gBrowser.selectedBrowser.addEventListener("input", onInput, true);
-}
-
-function onInput(aEvent) {
- info("input event");
- gBrowser.selectedBrowser.removeEventListener("input", onInput, true);
-
- // This is an ok way to check this because we will make sure that the text
- // field is parsable.
- let val = gBrowser.selectedBrowser.contentDocument.getElementById("sessionData").value;
- try {
- JSON.parse(val);
- ok(true, "JSON.parse succeeded");
- }
- catch (e) {
- ok(false, "JSON.parse failed");
- }
- cleanup();
-}
-
-function cleanup() {
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
-}
diff --git a/browser/components/sessionstore/test/browser_581937.js b/browser/components/sessionstore/test/browser_581937.js
deleted file mode 100644
index 71bb91e90..000000000
--- a/browser/components/sessionstore/test/browser_581937.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that an about:blank tab with no history will not be saved into
-// session store and thus, it will not show up in Recently Closed Tabs.
-
-let tab;
-function test() {
- waitForExplicitFinish();
-
- gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
- gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
-
- is(ss.getClosedTabCount(window), 0, "should be no closed tabs");
-
- gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
-
- tab = gBrowser.addTab();
-}
-
-function onTabOpen(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
-
- // Let other listeners react to the TabOpen event before removing the tab.
- executeSoon(function() {
- is(gBrowser.browsers[1].currentURI.spec, "about:blank",
- "we will be removing an about:blank tab");
-
- gBrowser.removeTab(tab);
-
- is(ss.getClosedTabCount(window), 0, "should still be no closed tabs");
-
- executeSoon(finish);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_586068-apptabs.js b/browser/components/sessionstore/test/browser_586068-apptabs.js
deleted file mode 100644
index f94b5b539..000000000
--- a/browser/components/sessionstore/test/browser_586068-apptabs.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, true);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org/#1" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#2" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#3" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#4" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#6" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#7" }], extData: { "uniq": r() } },
- ], selected: 5 }] };
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- loadCount++;
-
- // We'll make sure that the loads we get come from pinned tabs or the
- // the selected tab.
-
- // get the tab
- let tab;
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- if (!tab && window.gBrowser.tabs[i].linkedBrowser == aBrowser)
- tab = window.gBrowser.tabs[i];
- }
-
- ok(tab.pinned || tab.selected,
- "load came from pinned or selected tab");
-
- // We should get 4 loads: 3 app tabs + 1 normal selected tab
- if (loadCount < 4)
- return;
-
- gProgressListener.unsetCallback();
- executeSoon(next);
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-apptabs_ondemand.js b/browser/components/sessionstore/test/browser_586068-apptabs_ondemand.js
deleted file mode 100644
index 3a9b0a35b..000000000
--- a/browser/components/sessionstore/test/browser_586068-apptabs_ondemand.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-const PREF_RESTORE_PINNED_TABS_ON_DEMAND = "browser.sessionstore.restore_pinned_tabs_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, true);
- Services.prefs.setBoolPref(PREF_RESTORE_PINNED_TABS_ON_DEMAND, true);
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- Services.prefs.clearUserPref(PREF_RESTORE_PINNED_TABS_ON_DEMAND);
- });
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org/#1" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#2" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#3" }], extData: { "uniq": r() }, pinned: true },
- { entries: [{ url: "http://example.org/#4" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#6" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#7" }], extData: { "uniq": r() } },
- ], selected: 5 }] };
-
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- // get the tab
- let tab;
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- if (!tab && window.gBrowser.tabs[i].linkedBrowser == aBrowser)
- tab = window.gBrowser.tabs[i];
- }
-
- // Check that the load only comes from the selected tab.
- ok(tab.selected, "load came from selected tab");
- is(aNeedRestore, 6, "six tabs left to restore");
- is(aRestoring, 1, "one tab is restoring");
- is(aRestored, 0, "no tabs have been restored, yet");
-
- gProgressListener.unsetCallback();
- executeSoon(next);
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js b/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js
deleted file mode 100644
index 9a440fda9..000000000
--- a/browser/components/sessionstore/test/browser_586068-browser_state_interrupted.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- // The first state will be loaded using setBrowserState, followed by the 2nd
- // state also being loaded using setBrowserState, interrupting the first restore.
- let state1 = { windows: [
- {
- tabs: [
- { entries: [{ url: "http://example.org#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#4" }], extData: { "uniq": r() } }
- ],
- selected: 1
- },
- {
- tabs: [
- { entries: [{ url: "http://example.com#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#4" }], extData: { "uniq": r() } },
- ],
- selected: 3
- }
- ] };
- let state2 = { windows: [
- {
- tabs: [
- { entries: [{ url: "http://example.org#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#6" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#7" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#8" }], extData: { "uniq": r() } }
- ],
- selected: 3
- },
- {
- tabs: [
- { entries: [{ url: "http://example.com#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#6" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#7" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#8" }], extData: { "uniq": r() } },
- ],
- selected: 1
- }
- ] };
-
- // interruptedAfter will be set after the selected tab from each window have loaded.
- let interruptedAfter = 0;
- let loadedWindow1 = false;
- let loadedWindow2 = false;
- let numTabs = state2.windows[0].tabs.length + state2.windows[1].tabs.length;
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- loadCount++;
-
- if (aBrowser.currentURI.spec == state1.windows[0].tabs[2].entries[0].url)
- loadedWindow1 = true;
- if (aBrowser.currentURI.spec == state1.windows[1].tabs[0].entries[0].url)
- loadedWindow2 = true;
-
- if (!interruptedAfter && loadedWindow1 && loadedWindow2) {
- interruptedAfter = loadCount;
- ss.setBrowserState(JSON.stringify(state2));
- return;
- }
-
- if (loadCount < numTabs + interruptedAfter)
- return;
-
- // We don't actually care about load order in this test, just that they all
- // do load.
- is(loadCount, numTabs + interruptedAfter, "all tabs were restored");
- is(aNeedRestore, 0, "there are no tabs left needing restore");
-
- // Remove the progress listener from this window, it will be removed from
- // theWin when that window is closed (in setBrowserState).
- gProgressListener.unsetCallback();
- executeSoon(next);
- });
-
- // We also want to catch the extra windows (there should be 2), so we need to observe domwindowopened
- Services.ww.registerNotification(function observer(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad);
- Services.ww.unregisterNotification(observer);
- win.gBrowser.addTabsProgressListener(gProgressListener);
- });
- }
- });
-
- yield ss.setBrowserState(JSON.stringify(state1));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-cascade.js b/browser/components/sessionstore/test/browser_586068-cascade.js
deleted file mode 100644
index 9c49bdf2d..000000000
--- a/browser/components/sessionstore/test/browser_586068-cascade.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com" }], extData: { "uniq": r() } }
- ] }] };
-
- let expectedCounts = [
- [3, 3, 0],
- [2, 3, 1],
- [1, 3, 2],
- [0, 3, 3],
- [0, 2, 4],
- [0, 1, 5]
- ];
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- loadCount++;
- let expected = expectedCounts[loadCount - 1];
-
- is(aNeedRestore, expected[0], "load " + loadCount + " - # tabs that need to be restored");
- is(aRestoring, expected[1], "load " + loadCount + " - # tabs that are restoring");
- is(aRestored, expected[2], "load " + loadCount + " - # tabs that has been restored");
-
- if (loadCount == state.windows[0].tabs.length) {
- gProgressListener.unsetCallback();
- executeSoon(next);
- }
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-multi_window.js b/browser/components/sessionstore/test/browser_586068-multi_window.js
deleted file mode 100644
index f69de2e45..000000000
--- a/browser/components/sessionstore/test/browser_586068-multi_window.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- // The first window will be put into the already open window and the second
- // window will be opened with _openWindowWithState, which is the source of the problem.
- let state = { windows: [
- {
- tabs: [
- { entries: [{ url: "http://example.org#0" }], extData: { "uniq": r() } }
- ],
- selected: 1
- },
- {
- tabs: [
- { entries: [{ url: "http://example.com#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#4" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#6" }], extData: { "uniq": r() } }
- ],
- selected: 4
- }
- ] };
- let numTabs = state.windows[0].tabs.length + state.windows[1].tabs.length;
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- if (++loadCount == numTabs) {
- // We don't actually care about load order in this test, just that they all
- // do load.
- is(loadCount, numTabs, "all tabs were restored");
- is(aNeedRestore, 0, "there are no tabs left needing restore");
-
- gProgressListener.unsetCallback();
- executeSoon(next);
- }
- });
-
- // We also want to catch the 2nd window, so we need to observe domwindowopened
- Services.ww.registerNotification(function observer(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad);
- Services.ww.unregisterNotification(observer);
- win.gBrowser.addTabsProgressListener(gProgressListener);
- });
- }
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-reload.js b/browser/components/sessionstore/test/browser_586068-reload.js
deleted file mode 100644
index f68d7a0bb..000000000
--- a/browser/components/sessionstore/test/browser_586068-reload.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- // Request a longer timeout because the test takes quite a while
- // to complete on slow Windows debug machines and we would otherwise
- // see a lot of (not so) intermittent test failures.
- requestLongerTimeout(2);
-
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, true);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org/#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#4" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#6" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#7" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#8" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#9" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#10" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#11" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#12" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#13" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#14" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#15" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#16" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#17" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org/#18" }], extData: { "uniq": r() } }
- ], selected: 1 }] };
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- loadCount++;
- is(aBrowser.currentURI.spec, state.windows[0].tabs[loadCount - 1].entries[0].url,
- "load " + loadCount + " - browser loaded correct url");
-
- if (loadCount <= state.windows[0].tabs.length) {
- // double check that this tab was the right one
- let expectedData = state.windows[0].tabs[loadCount - 1].extData.uniq;
- let tab;
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- if (!tab && window.gBrowser.tabs[i].linkedBrowser == aBrowser)
- tab = window.gBrowser.tabs[i];
- }
- is(ss.getTabValue(tab, "uniq"), expectedData,
- "load " + loadCount + " - correct tab was restored");
-
- if (loadCount == state.windows[0].tabs.length) {
- gProgressListener.unsetCallback();
- executeSoon(function () {
- reloadAllTabs(state, function () {
- waitForBrowserState(TestRunner.backupState, testCascade);
- });
- });
- } else {
- // reload the next tab
- window.gBrowser.reloadTab(window.gBrowser.tabs[loadCount]);
- }
- }
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
-
-function testCascade() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.com/#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com/#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com/#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com/#4" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com/#5" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com/#6" }], extData: { "uniq": r() } }
- ] }] };
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- if (++loadCount < state.windows[0].tabs.length) {
- return;
- }
-
- gProgressListener.unsetCallback();
- executeSoon(function () {
- reloadAllTabs(state, next);
- });
- });
-
- ss.setBrowserState(JSON.stringify(state));
-}
-
-function reloadAllTabs(aState, aCallback) {
- // Simulate a left mouse button click with no modifiers, which is what
- // Command-R, or clicking reload does.
- let fakeEvent = {
- button: 0,
- metaKey: false,
- altKey: false,
- ctrlKey: false,
- shiftKey: false
- };
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- if (++loadCount <= aState.windows[0].tabs.length) {
- // double check that this tab was the right one
- let expectedData = aState.windows[0].tabs[loadCount - 1].extData.uniq;
- let tab;
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- if (!tab && window.gBrowser.tabs[i].linkedBrowser == aBrowser)
- tab = window.gBrowser.tabs[i];
- }
- is(ss.getTabValue(tab, "uniq"), expectedData,
- "load " + loadCount + " - correct tab was reloaded");
-
- if (loadCount == aState.windows[0].tabs.length) {
- gProgressListener.unsetCallback();
- executeSoon(aCallback);
- } else {
- // reload the next tab
- window.gBrowser.selectTabAtIndex(loadCount);
- BrowserReloadOrDuplicate(fakeEvent);
- }
- }
- }, false);
-
- BrowserReloadOrDuplicate(fakeEvent);
-}
diff --git a/browser/components/sessionstore/test/browser_586068-select.js b/browser/components/sessionstore/test/browser_586068-select.js
deleted file mode 100644
index 66a947236..000000000
--- a/browser/components/sessionstore/test/browser_586068-select.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, true);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org" }], extData: { "uniq": r() } }
- ], selected: 1 }] };
-
- let expectedCounts = [
- [5, 1, 0],
- [4, 1, 1],
- [3, 1, 2],
- [2, 1, 3],
- [1, 1, 4],
- [0, 1, 5]
- ];
- let tabOrder = [0, 5, 1, 4, 3, 2];
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- loadCount++;
- let expected = expectedCounts[loadCount - 1];
-
- is(aNeedRestore, expected[0], "load " + loadCount + " - # tabs that need to be restored");
- is(aRestoring, expected[1], "load " + loadCount + " - # tabs that are restoring");
- is(aRestored, expected[2], "load " + loadCount + " - # tabs that has been restored");
-
- if (loadCount < state.windows[0].tabs.length) {
- // double check that this tab was the right one
- let expectedData = state.windows[0].tabs[tabOrder[loadCount - 1]].extData.uniq;
- let tab;
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- if (!tab && window.gBrowser.tabs[i].linkedBrowser == aBrowser)
- tab = window.gBrowser.tabs[i];
- }
-
- is(ss.getTabValue(tab, "uniq"), expectedData,
- "load " + loadCount + " - correct tab was restored");
-
- // select the next tab
- window.gBrowser.selectTabAtIndex(tabOrder[loadCount]);
- } else {
- gProgressListener.unsetCallback();
- executeSoon(next);
- }
- });
-
- yield ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_586068-window_state.js b/browser/components/sessionstore/test/browser_586068-window_state.js
deleted file mode 100644
index 9fb9424eb..000000000
--- a/browser/components/sessionstore/test/browser_586068-window_state.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- // We'll use 2 states so that we can make sure calling setWindowState doesn't
- // wipe out currently restoring data.
- let state1 = { windows: [{ tabs: [
- { entries: [{ url: "http://example.com#1" }] },
- { entries: [{ url: "http://example.com#2" }] },
- { entries: [{ url: "http://example.com#3" }] },
- { entries: [{ url: "http://example.com#4" }] },
- { entries: [{ url: "http://example.com#5" }] },
- ] }] };
- let state2 = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org#1" }] },
- { entries: [{ url: "http://example.org#2" }] },
- { entries: [{ url: "http://example.org#3" }] },
- { entries: [{ url: "http://example.org#4" }] },
- { entries: [{ url: "http://example.org#5" }] }
- ] }] };
- let numTabs = state1.windows[0].tabs.length + state2.windows[0].tabs.length;
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- // When loadCount == 2, we'll also restore state2 into the window
- if (++loadCount == 2) {
- ss.setWindowState(window, JSON.stringify(state2), false);
- }
-
- if (loadCount < numTabs) {
- return;
- }
-
- // We don't actually care about load order in this test, just that they all
- // do load.
- is(loadCount, numTabs, "test_setWindowStateNoOverwrite: all tabs were restored");
- // window.__SS_tabsToRestore isn't decremented until after the progress
- // listener is called. Since we get in here before that, we still expect
- // the count to be 1.
- is(window.__SS_tabsToRestore, 1, "window doesn't think there are more tabs to restore");
- is(aNeedRestore, 0, "there are no tabs left needing restore");
-
- gProgressListener.unsetCallback();
- executeSoon(next);
- });
-
- yield ss.setWindowState(window, JSON.stringify(state1), true);
-}
diff --git a/browser/components/sessionstore/test/browser_586068-window_state_override.js b/browser/components/sessionstore/test/browser_586068-window_state_override.js
deleted file mode 100644
index f20eea13c..000000000
--- a/browser/components/sessionstore/test/browser_586068-window_state_override.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-
-function test() {
- TestRunner.run();
-}
-
-function runTests() {
- Services.prefs.setBoolPref(PREF_RESTORE_ON_DEMAND, false);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_RESTORE_ON_DEMAND);
- });
-
- // We'll use 2 states so that we can make sure calling setWindowState doesn't
- // wipe out currently restoring data.
- let state1 = { windows: [{ tabs: [
- { entries: [{ url: "http://example.com#1" }] },
- { entries: [{ url: "http://example.com#2" }] },
- { entries: [{ url: "http://example.com#3" }] },
- { entries: [{ url: "http://example.com#4" }] },
- { entries: [{ url: "http://example.com#5" }] },
- ] }] };
- let state2 = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org#1" }] },
- { entries: [{ url: "http://example.org#2" }] },
- { entries: [{ url: "http://example.org#3" }] },
- { entries: [{ url: "http://example.org#4" }] },
- { entries: [{ url: "http://example.org#5" }] }
- ] }] };
- let numTabs = 2 + state2.windows[0].tabs.length;
-
- let loadCount = 0;
- gProgressListener.setCallback(function (aBrowser, aNeedRestore, aRestoring, aRestored) {
- // When loadCount == 2, we'll also restore state2 into the window
- if (++loadCount == 2) {
- ss.setWindowState(window, JSON.stringify(state2), true);
- }
-
- if (loadCount < numTabs) {
- return;
- }
-
- // We don't actually care about load order in this test, just that they all
- // do load.
- is(loadCount, numTabs, "all tabs were restored");
- // window.__SS_tabsToRestore isn't decremented until after the progress
- // listener is called. Since we get in here before that, we still expect
- // the count to be 1.
- is(window.__SS_tabsToRestore, 1, "window doesn't think there are more tabs to restore");
- is(aNeedRestore, 0, "there are no tabs left needing restore");
-
- gProgressListener.unsetCallback();
- executeSoon(next);
- });
-
- yield ss.setWindowState(window, JSON.stringify(state1), true);
-}
diff --git a/browser/components/sessionstore/test/browser_586147.js b/browser/components/sessionstore/test/browser_586147.js
deleted file mode 100644
index d70f406b9..000000000
--- a/browser/components/sessionstore/test/browser_586147.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function observeOneRestore(callback) {
- let topic = "sessionstore-browser-state-restored";
- Services.obs.addObserver(function onRestore() {
- Services.obs.removeObserver(onRestore, topic);
- callback();
- }, topic, false);
-};
-
-function test() {
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- // There should be one tab when we start the test
- let [origTab] = gBrowser.visibleTabs;
- let hiddenTab = gBrowser.addTab();
-
- is(gBrowser.visibleTabs.length, 2, "should have 2 tabs before hiding");
- gBrowser.showOnlyTheseTabs([origTab]);
- is(gBrowser.visibleTabs.length, 1, "only 1 after hiding");
- ok(hiddenTab.hidden, "sanity check that it's hidden");
-
- let extraTab = gBrowser.addTab();
- let state = ss.getBrowserState();
- let stateObj = JSON.parse(state);
- let tabs = stateObj.windows[0].tabs;
- is(tabs.length, 3, "just checking that browser state is correct");
- ok(!tabs[0].hidden, "first tab is visible");
- ok(tabs[1].hidden, "second is hidden");
- ok(!tabs[2].hidden, "third is visible");
-
- // Make the third tab hidden and then restore the modified state object
- tabs[2].hidden = true;
-
- observeOneRestore(function() {
- let testWindow = Services.wm.getEnumerator("navigator:browser").getNext();
- is(testWindow.gBrowser.visibleTabs.length, 1, "only restored 1 visible tab");
- let tabs = testWindow.gBrowser.tabs;
- ok(!tabs[0].hidden, "first is still visible");
- ok(tabs[1].hidden, "second tab is still hidden");
- ok(tabs[2].hidden, "third tab is now hidden");
-
- // Restore the original state and clean up now that we're done
- gBrowser.removeTab(hiddenTab);
- gBrowser.removeTab(extraTab);
- finish();
- });
- ss.setBrowserState(JSON.stringify(stateObj));
-}
diff --git a/browser/components/sessionstore/test/browser_588426.js b/browser/components/sessionstore/test/browser_588426.js
deleted file mode 100644
index 7a20fd0a6..000000000
--- a/browser/components/sessionstore/test/browser_588426.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let state = { windows: [{ tabs: [
- {entries: [{url: "about:mozilla"}], hidden: true},
- {entries: [{url: "about:rights"}], hidden: true}
- ] }] };
-
- waitForExplicitFinish();
-
- newWindowWithState(state, function (win) {
- registerCleanupFunction(function () win.close());
-
- is(win.gBrowser.tabs.length, 2, "two tabs were restored");
- is(win.gBrowser.visibleTabs.length, 1, "one tab is visible");
-
- let tab = win.gBrowser.visibleTabs[0];
- is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "visible tab is about:mozilla");
-
- finish();
- });
-}
-
-function newWindowWithState(state, callback) {
- let opts = "chrome,all,dialog=no,height=800,width=800";
- let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
-
- executeSoon(function () {
- win.addEventListener("SSWindowStateReady", function onReady() {
- win.removeEventListener("SSWindowStateReady", onReady, false);
- executeSoon(function () callback(win));
- }, false);
-
- ss.setWindowState(win, JSON.stringify(state), true);
- });
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_589246.js b/browser/components/sessionstore/test/browser_589246.js
deleted file mode 100644
index 379d038e1..000000000
--- a/browser/components/sessionstore/test/browser_589246.js
+++ /dev/null
@@ -1,243 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Mirrors WINDOW_ATTRIBUTES IN nsSessionStore.js
-const WINDOW_ATTRIBUTES = ["width", "height", "screenX", "screenY", "sizemode"];
-
-let stateBackup = ss.getBrowserState();
-
-let originalWarnOnClose = gPrefService.getBoolPref("browser.tabs.warnOnClose");
-let originalStartupPage = gPrefService.getIntPref("browser.startup.page");
-let originalWindowType = document.documentElement.getAttribute("windowtype");
-
-let gotLastWindowClosedTopic = false;
-let shouldPinTab = false;
-let shouldOpenTabs = false;
-let shouldCloseTab = false;
-let testNum = 0;
-let afterTestCallback;
-
-// Set state so we know the closed windows content
-let testState = {
- windows: [
- { tabs: [{ entries: [{ url: "http://example.org" }] }] }
- ],
- _closedWindows: []
-};
-
-// We'll push a set of conditions and callbacks into this array
-// Ideally we would also test win/linux under a complete set of conditions, but
-// the tests for osx mirror the other set of conditions possible on win/linux.
-let tests = [];
-
-// the third & fourth test share a condition check, keep it DRY
-function checkOSX34Generator(num) {
- return function(aPreviousState, aCurState) {
- // In here, we should have restored the pinned tab, so only the unpinned tab
- // should be in aCurState. So let's shape our expectations.
- let expectedState = JSON.parse(aPreviousState);
- expectedState[0].tabs.shift();
- // size attributes are stripped out in _prepDataForDeferredRestore in nsSessionStore.
- // This isn't the best approach, but neither is comparing JSON strings
- WINDOW_ATTRIBUTES.forEach(function (attr) delete expectedState[0][attr]);
-
- is(aCurState, JSON.stringify(expectedState),
- "test #" + num + ": closedWindowState is as expected");
- };
-}
-function checkNoWindowsGenerator(num) {
- return function(aPreviousState, aCurState) {
- is(aCurState, "[]", "test #" + num + ": there should be no closedWindowsLeft");
- };
-}
-
-// The first test has 0 pinned tabs and 1 unpinned tab
-tests.push({
- pinned: false,
- extra: false,
- close: false,
- checkWinLin: checkNoWindowsGenerator(1),
- checkOSX: function(aPreviousState, aCurState) {
- is(aCurState, aPreviousState, "test #1: closed window state is unchanged");
- }
-});
-
-// The second test has 1 pinned tab and 0 unpinned tabs.
-tests.push({
- pinned: true,
- extra: false,
- close: false,
- checkWinLin: checkNoWindowsGenerator(2),
- checkOSX: checkNoWindowsGenerator(2)
-});
-
-// The third test has 1 pinned tab and 2 unpinned tabs.
-tests.push({
- pinned: true,
- extra: true,
- close: false,
- checkWinLin: checkNoWindowsGenerator(3),
- checkOSX: checkOSX34Generator(3)
-});
-
-// The fourth test has 1 pinned tab, 2 unpinned tabs, and closes one unpinned tab.
-tests.push({
- pinned: true,
- extra: true,
- close: "one",
- checkWinLin: checkNoWindowsGenerator(4),
- checkOSX: checkOSX34Generator(4)
-});
-
-// The fifth test has 1 pinned tab, 2 unpinned tabs, and closes both unpinned tabs.
-tests.push({
- pinned: true,
- extra: true,
- close: "both",
- checkWinLin: checkNoWindowsGenerator(5),
- checkOSX: checkNoWindowsGenerator(5)
-});
-
-
-function test() {
- /** Test for Bug 589246 - Closed window state getting corrupted when closing
- and reopening last browser window without exiting browser **/
- waitForExplicitFinish();
- // windows opening & closing, so extending the timeout
- requestLongerTimeout(2);
-
- // We don't want the quit dialog pref
- gPrefService.setBoolPref("browser.tabs.warnOnClose", false);
- // Ensure that we would restore the session (important for Windows)
- gPrefService.setIntPref("browser.startup.page", 3);
-
- runNextTestOrFinish();
-}
-
-function runNextTestOrFinish() {
- if (tests.length) {
- setupForTest(tests.shift())
- }
- else {
- // some state is cleaned up at the end of each test, but not all
- ["browser.tabs.warnOnClose", "browser.startup.page"].forEach(function(p) {
- if (gPrefService.prefHasUserValue(p))
- gPrefService.clearUserPref(p);
- });
-
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
- }
-}
-
-function setupForTest(aConditions) {
- // reset some checks
- gotLastWindowClosedTopic = false;
- shouldPinTab = aConditions.pinned;
- shouldOpenTabs = aConditions.extra;
- shouldCloseTab = aConditions.close;
- testNum++;
-
- // set our test callback
- afterTestCallback = /Mac/.test(navigator.platform) ? aConditions.checkOSX
- : aConditions.checkWinLin;
-
- // Add observers
- Services.obs.addObserver(onLastWindowClosed, "browser-lastwindow-close-granted", false);
-
- // Set the state
- Services.obs.addObserver(onStateRestored, "sessionstore-browser-state-restored", false);
- ss.setBrowserState(JSON.stringify(testState));
-}
-
-function onStateRestored(aSubject, aTopic, aData) {
- info("test #" + testNum + ": onStateRestored");
- Services.obs.removeObserver(onStateRestored, "sessionstore-browser-state-restored");
-
- // change this window's windowtype so that closing a new window will trigger
- // browser-lastwindow-close-granted.
- document.documentElement.setAttribute("windowtype", "navigator:testrunner");
-
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "http://example.com");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- newWin.gBrowser.selectedBrowser.addEventListener("load", function() {
- newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- // pin this tab
- if (shouldPinTab)
- newWin.gBrowser.pinTab(newWin.gBrowser.selectedTab);
-
- newWin.addEventListener("unload", function () {
- newWin.removeEventListener("unload", arguments.callee, false);
- onWindowUnloaded();
- }, false);
- // Open a new tab as well. On Windows/Linux this will be restored when the
- // new window is opened below (in onWindowUnloaded). On OS X we'll just
- // restore the pinned tabs, leaving the unpinned tab in the closedWindowsData.
- if (shouldOpenTabs) {
- let newTab = newWin.gBrowser.addTab("about:config");
- let newTab2 = newWin.gBrowser.addTab("about:buildconfig");
-
- newTab.linkedBrowser.addEventListener("load", function() {
- newTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- if (shouldCloseTab == "one") {
- newWin.gBrowser.removeTab(newTab2);
- }
- else if (shouldCloseTab == "both") {
- newWin.gBrowser.removeTab(newTab);
- newWin.gBrowser.removeTab(newTab2);
- }
- newWin.BrowserTryToCloseWindow();
- }, true);
- }
- else {
- newWin.BrowserTryToCloseWindow();
- }
- }, true);
- }, false);
-}
-
-// This will be called before the window is actually closed
-function onLastWindowClosed(aSubject, aTopic, aData) {
- info("test #" + testNum + ": onLastWindowClosed");
- Services.obs.removeObserver(onLastWindowClosed, "browser-lastwindow-close-granted");
- gotLastWindowClosedTopic = true;
-}
-
-// This is the unload event listener on the new window (from onStateRestored).
-// Unload is fired after the window is closed, so sessionstore has already
-// updated _closedWindows (which is important). We'll open a new window here
-// which should actually trigger the bug.
-function onWindowUnloaded() {
- info("test #" + testNum + ": onWindowClosed");
- ok(gotLastWindowClosedTopic, "test #" + testNum + ": browser-lastwindow-close-granted was notified prior");
-
- let previousClosedWindowData = ss.getClosedWindowData();
-
- // Now we want to open a new window
- let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:mozilla");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- newWin.gBrowser.selectedBrowser.addEventListener("load", function () {
- newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
- // Good enough for checking the state
- afterTestCallback(previousClosedWindowData, ss.getClosedWindowData());
- afterTestCleanup(newWin);
- }, true);
-
- }, false);
-}
-
-function afterTestCleanup(aNewWin) {
- executeSoon(function() {
- aNewWin.close();
- document.documentElement.setAttribute("windowtype", originalWindowType);
- runNextTestOrFinish();
- });
-}
diff --git a/browser/components/sessionstore/test/browser_590268.js b/browser/components/sessionstore/test/browser_590268.js
deleted file mode 100644
index 34eef0e0c..000000000
--- a/browser/components/sessionstore/test/browser_590268.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const NUM_TABS = 12;
-
-let stateBackup = ss.getBrowserState();
-
-function test() {
- /** Test for Bug 590268 - Provide access to sessionstore tab data sooner **/
- waitForExplicitFinish();
-
- let startedTest = false;
-
- // wasLoaded will be used to keep track of tabs that have already had SSTabRestoring
- // fired for them.
- let wasLoaded = { };
- let restoringTabsCount = 0;
- let restoredTabsCount = 0;
- let uniq2 = { };
- let uniq2Count = 0;
- let state = { windows: [{ tabs: [] }] };
- // We're going to put a bunch of tabs into this state
- for (let i = 0; i < NUM_TABS; i++) {
- let uniq = r();
- let tabData = {
- entries: [{ url: "http://example.com/#" + i }],
- extData: { "uniq": uniq, "baz": "qux" }
- };
- state.windows[0].tabs.push(tabData);
- wasLoaded[uniq] = false;
- }
-
-
- function onSSTabRestoring(aEvent) {
- restoringTabsCount++;
- let uniq = ss.getTabValue(aEvent.originalTarget, "uniq");
- wasLoaded[uniq] = true;
-
- is(ss.getTabValue(aEvent.originalTarget, "foo"), "",
- "There is no value for 'foo'");
-
- // On the first SSTabRestoring we're going to run the the real test.
- // We'll keep this listener around so we can keep marking tabs as restored.
- if (restoringTabsCount == 1)
- onFirstSSTabRestoring();
- else if (restoringTabsCount == NUM_TABS)
- onLastSSTabRestoring();
- }
-
- function onSSTabRestored(aEvent) {
- if (++restoredTabsCount < NUM_TABS)
- return;
- cleanup();
- }
-
- function onTabOpen(aEvent) {
- // To test bug 614708, we'll just set a value on the tab here. This value
- // would previously cause us to not recognize the values in extData until
- // much later. So testing "uniq" failed.
- ss.setTabValue(aEvent.originalTarget, "foo", "bar");
- }
-
- // This does the actual testing. SSTabRestoring should be firing on tabs from
- // left to right, so we're going to start with the rightmost tab.
- function onFirstSSTabRestoring() {
- info("onFirstSSTabRestoring...");
- for (let i = gBrowser.tabs.length - 1; i >= 0; i--) {
- let tab = gBrowser.tabs[i];
- let actualUniq = ss.getTabValue(tab, "uniq");
- let expectedUniq = state.windows[0].tabs[i].extData["uniq"];
-
- if (wasLoaded[actualUniq]) {
- info("tab " + i + ": already restored");
- continue;
- }
- is(actualUniq, expectedUniq, "tab " + i + ": extData was correct");
-
- // Now we're going to set a piece of data back on the tab so it can be read
- // to test setting a value "early".
- uniq2[actualUniq] = r();
- ss.setTabValue(tab, "uniq2", uniq2[actualUniq]);
-
- // Delete the value we have for "baz". This tests that deleteTabValue
- // will delete "early access" values (c.f. bug 617175). If this doesn't throw
- // then the test is successful.
- try {
- ss.deleteTabValue(tab, "baz");
- }
- catch (e) {
- ok(false, "no error calling deleteTabValue - " + e);
- }
-
- // This will be used in the final comparison to make sure we checked the
- // same number as we set.
- uniq2Count++;
- }
- }
-
- function onLastSSTabRestoring() {
- let checked = 0;
- for (let i = 0; i < gBrowser.tabs.length; i++) {
- let tab = gBrowser.tabs[i];
- let uniq = ss.getTabValue(tab, "uniq");
-
- // Look to see if we set a uniq2 value for this uniq value
- if (uniq in uniq2) {
- is(ss.getTabValue(tab, "uniq2"), uniq2[uniq], "tab " + i + " has correct uniq2 value");
- checked++;
- }
- }
- ok(uniq2Count > 0, "at least 1 tab properly checked 'early access'");
- is(checked, uniq2Count, "checked the same number of uniq2 as we set");
- }
-
- function cleanup() {
- // remove the event listener and clean up before finishing
- gBrowser.tabContainer.removeEventListener("SSTabRestoring", onSSTabRestoring, false);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, true);
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, false);
- // Put this in an executeSoon because we still haven't called restoreNextTab
- // in sessionstore for the last tab (we'll call it after this). We end up
- // trying to restore the tab (since we then add a closed tab to the array).
- executeSoon(function() {
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
- });
- }
-
- // Add the event listeners
- gBrowser.tabContainer.addEventListener("SSTabRestoring", onSSTabRestoring, false);
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, true);
- gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, false);
- // Restore state
- ss.setBrowserState(JSON.stringify(state));
-}
diff --git a/browser/components/sessionstore/test/browser_590563.js b/browser/components/sessionstore/test/browser_590563.js
deleted file mode 100644
index 2ede82323..000000000
--- a/browser/components/sessionstore/test/browser_590563.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let oldState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:mozilla" }], hidden: true },
- { entries: [{ url: "about:blank" }], hidden: false }
- ]
- }]
- };
- let pageData = {
- url: "about:sessionrestore",
- formdata: { id: { "sessionData": oldState } }
- };
- let state = { windows: [{ tabs: [{ entries: [pageData] }] }] };
-
- waitForExplicitFinish();
-
- newWindowWithState(state, function (win) {
- registerCleanupFunction(function () win.close());
-
- is(gBrowser.tabs.length, 1, "The total number of tabs should be 1");
- is(gBrowser.visibleTabs.length, 1, "The total number of visible tabs should be 1");
-
- executeSoon(function () {
- waitForFocus(function () {
- middleClickTest(win);
- finish();
- }, win);
- });
- });
-}
-
-function middleClickTest(win) {
- let browser = win.gBrowser.selectedBrowser;
- let tree = browser.contentDocument.getElementById("tabList");
- is(tree.view.rowCount, 3, "There should be three items");
-
- let x = {}, y = {}, width = {}, height = {};
-
- // click on the first tab item
- tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[1], "text", x, y, width, height);
- EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
- browser.contentWindow);
- // click on the second tab item
- tree.treeBoxObject.getCoordsForCellItem(2, tree.columns[1], "text", x, y, width, height);
- EventUtils.synthesizeMouse(tree.body, x.value, y.value, { button: 1 },
- browser.contentWindow);
-
- is(win.gBrowser.tabs.length, 3,
- "The total number of tabs should be 3 after restoring 2 tabs by middle click.");
- is(win.gBrowser.visibleTabs.length, 3,
- "The total number of visible tabs should be 3 after restoring 2 tabs by middle click");
-}
-
-function newWindowWithState(state, callback) {
- let opts = "chrome,all,dialog=no,height=800,width=800";
- let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
-
- let tab = win.gBrowser.selectedTab;
-
- // The form data will be restored before SSTabRestored, so we want to listen
- // for that on the currently selected tab (it will be reused)
- tab.addEventListener("SSTabRestored", function onRestored() {
- tab.removeEventListener("SSTabRestored", onRestored, true);
- callback(win);
- }, true);
-
- executeSoon(function () {
- ss.setWindowState(win, JSON.stringify(state), true);
- });
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_595601-restore_hidden.js b/browser/components/sessionstore/test/browser_595601-restore_hidden.js
deleted file mode 100644
index cff2d9c5d..000000000
--- a/browser/components/sessionstore/test/browser_595601-restore_hidden.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let state = {windows:[{tabs:[
- {entries:[{url:"http://example.com#1"}]},
- {entries:[{url:"http://example.com#2"}]},
- {entries:[{url:"http://example.com#3"}]},
- {entries:[{url:"http://example.com#4"}]},
- {entries:[{url:"http://example.com#5"}], hidden: true},
- {entries:[{url:"http://example.com#6"}], hidden: true},
- {entries:[{url:"http://example.com#7"}], hidden: true},
- {entries:[{url:"http://example.com#8"}], hidden: true}
-]}]};
-
-function test() {
- waitForExplicitFinish();
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.restore_hidden_tabs");
- });
-
- // First stage: restoreHiddenTabs = true
- // Second stage: restoreHiddenTabs = false
- test_loadTabs(true, function () {
- test_loadTabs(false, finish);
- });
-}
-
-function test_loadTabs(restoreHiddenTabs, callback) {
- Services.prefs.setBoolPref("browser.sessionstore.restore_hidden_tabs", restoreHiddenTabs);
-
- let expectedTabs = restoreHiddenTabs ? 8 : 4;
- let firstProgress = true;
-
- newWindowWithState(state, function (win, needsRestore, isRestoring) {
- if (firstProgress) {
- firstProgress = false;
- is(isRestoring, 3, "restoring 3 tabs concurrently");
- } else {
- ok(isRestoring < 4, "restoring max. 3 tabs concurrently");
- }
-
- // We're explicity checking for (isRestoring == 1) here because the test
- // progress listener is called before the session store one. So when we're
- // called with one tab left to restore we know that the last tab has
- // finished restoring and will soon be handled by the SS listener.
- let tabsNeedingRestore = win.gBrowser.tabs.length - needsRestore;
- if (isRestoring == 1 && tabsNeedingRestore == expectedTabs) {
- is(win.gBrowser.visibleTabs.length, 4, "only 4 visible tabs");
-
- TabsProgressListener.uninit();
- executeSoon(callback);
- }
- });
-}
-
-let TabsProgressListener = {
- init: function (win) {
- this.window = win;
-
- this.window.gBrowser.addTabsProgressListener(this);
- },
-
- uninit: function () {
- this.window.gBrowser.removeTabsProgressListener(this);
-
- delete this.window;
- delete this.callback;
- },
-
- setCallback: function (callback) {
- this.callback = callback;
- },
-
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (this.callback && aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
- this.callback.apply(null, [this.window].concat(this.countTabs()));
- },
-
- countTabs: function () {
- let needsRestore = 0, isRestoring = 0;
-
- for (let i = 0; i < this.window.gBrowser.tabs.length; i++) {
- let browser = this.window.gBrowser.tabs[i].linkedBrowser;
- if (browser.__SS_restoreState == TAB_STATE_RESTORING)
- isRestoring++;
- else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
- needsRestore++;
- }
-
- return [needsRestore, isRestoring];
- }
-}
-
-// ----------
-function newWindowWithState(state, callback) {
- let opts = "chrome,all,dialog=no,height=800,width=800";
- let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
- registerCleanupFunction(function () win.close());
-
- whenWindowLoaded(win, function onWindowLoaded(aWin) {
- TabsProgressListener.init(aWin);
- TabsProgressListener.setCallback(callback);
-
- ss.setWindowState(aWin, JSON.stringify(state), true);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_597071.js b/browser/components/sessionstore/test/browser_597071.js
deleted file mode 100644
index bc56718ec..000000000
--- a/browser/components/sessionstore/test/browser_597071.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 597071 **/
-
- waitForExplicitFinish();
-
- // set the pref to 1 greater than it currently is so we have room for an extra
- // closed window
- let closedWindowCount = ss.getClosedWindowCount();
- Services.prefs.setIntPref("browser.sessionstore.max_windows_undo",
- closedWindowCount + 1);
-
- let currentState = ss.getBrowserState();
- let popupState = { windows:[
- { tabs:[ {entries:[] }], isPopup: true, hidden: "toolbar" }
- ] };
-
- // set this window to be a popup.
- ss.setWindowState(window, JSON.stringify(popupState), true);
-
- // open a new non-popup window
- let newWin = openDialog(location, "", "chrome,all,dialog=no", "http://example.com");
- newWin.addEventListener("load", function(aEvent) {
- newWin.removeEventListener("load", arguments.callee, false);
-
- newWin.gBrowser.addEventListener("load", function(aEvent) {
- newWin.gBrowser.removeEventListener("load", arguments.callee, true);
-
- newWin.gBrowser.addTab().linkedBrowser.stop();
-
- // make sure sessionstore sees this window
- let state = JSON.parse(ss.getBrowserState());
- is(state.windows.length, 2, "sessionstore knows about this window");
-
- newWin.close();
- newWin.addEventListener("unload", function(aEvent) {
- newWin.removeEventListener("unload", arguments.callee, false);
-
- is(ss.getClosedWindowCount(), closedWindowCount + 1,
- "increased closed window count");
-
- Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
- ss.setBrowserState(currentState);
- executeSoon(finish);
-
- }, false);
- }, true);
- }, false);
-}
-
diff --git a/browser/components/sessionstore/test/browser_597315.js b/browser/components/sessionstore/test/browser_597315.js
deleted file mode 100644
index d139e83ae..000000000
--- a/browser/components/sessionstore/test/browser_597315.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Test for Bug 597315 - Frameset history does not work properly when restoring a tab **/
- waitForExplicitFinish();
-
- let testURL = getRootDirectory(gTestPath) + "browser_597315_index.html";
- let tab = gBrowser.addTab(testURL);
- gBrowser.selectedTab = tab;
-
- waitForLoadsInBrowser(tab.linkedBrowser, 4, function() {
- let browser_b = tab.linkedBrowser.contentDocument.getElementsByTagName("frame")[1];
- let document_b = browser_b.contentDocument;
- let links = document_b.getElementsByTagName("a");
-
- // We're going to click on the first link, so listen for another load event
- waitForLoadsInBrowser(tab.linkedBrowser, 1, function() {
- waitForLoadsInBrowser(tab.linkedBrowser, 1, function() {
-
- gBrowser.removeTab(tab);
- // wait for 4 loads again...
- let newTab = ss.undoCloseTab(window, 0);
-
- waitForLoadsInBrowser(newTab.linkedBrowser, 4, function() {
- gBrowser.goBack();
- waitForLoadsInBrowser(newTab.linkedBrowser, 1, function() {
-
- let expectedURLEnds = ["a.html", "b.html", "c1.html"];
- let frames = newTab.linkedBrowser.contentDocument.getElementsByTagName("frame");
- for (let i = 0; i < frames.length; i++) {
- is(frames[i].contentDocument.location,
- getRootDirectory(gTestPath) + "browser_597315_" + expectedURLEnds[i],
- "frame " + i + " has the right url");
- }
- gBrowser.removeTab(newTab);
- executeSoon(finish);
- });
- });
- });
- EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
- });
- EventUtils.sendMouseEvent({type:"click"}, links[0], browser_b.contentWindow);
- });
-}
-
-// helper function
-function waitForLoadsInBrowser(aBrowser, aLoadCount, aCallback) {
- let loadCount = 0;
- aBrowser.addEventListener("load", function(aEvent) {
- if (++loadCount < aLoadCount)
- return;
-
- aBrowser.removeEventListener("load", arguments.callee, true);
- aCallback();
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_597315_a.html b/browser/components/sessionstore/test/browser_597315_a.html
deleted file mode 100644
index 8e7b35d7a..000000000
--- a/browser/components/sessionstore/test/browser_597315_a.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- I'm A!
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_597315_b.html b/browser/components/sessionstore/test/browser_597315_b.html
deleted file mode 100644
index f8dbfb2a2..000000000
--- a/browser/components/sessionstore/test/browser_597315_b.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
- <body>
- I'm B!<br/>
- <a target="c" href="browser_597315_c1.html">click me first</a><br/>
- <a target="c" href="browser_597315_c2.html">then click me</a><br/>
- Close this tab.<br/>
- Restore this tab.<br/>
- Click back.<br/>
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_597315_c.html b/browser/components/sessionstore/test/browser_597315_c.html
deleted file mode 100644
index 0efd7d902..000000000
--- a/browser/components/sessionstore/test/browser_597315_c.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- I'm C!
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_597315_c1.html b/browser/components/sessionstore/test/browser_597315_c1.html
deleted file mode 100644
index b55c1d45a..000000000
--- a/browser/components/sessionstore/test/browser_597315_c1.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- I'm C1!
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_597315_c2.html b/browser/components/sessionstore/test/browser_597315_c2.html
deleted file mode 100644
index aec504141..000000000
--- a/browser/components/sessionstore/test/browser_597315_c2.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- I'm C2!
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_597315_index.html b/browser/components/sessionstore/test/browser_597315_index.html
deleted file mode 100644
index 1465ddf04..000000000
--- a/browser/components/sessionstore/test/browser_597315_index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
- <frameset cols="20%,80%">
- <frameset rows="30%,70%">
- <frame src="browser_597315_a.html"/>
- <frame src="browser_597315_b.html"/>
- </frameset>
- <frame src="browser_597315_c.html" name="c"/>
- </frameset>
-</html>
-
diff --git a/browser/components/sessionstore/test/browser_599909.js b/browser/components/sessionstore/test/browser_599909.js
deleted file mode 100644
index 31d190139..000000000
--- a/browser/components/sessionstore/test/browser_599909.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let stateBackup = ss.getBrowserState();
-
-function cleanup() {
- // Reset the pref
- try {
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
- } catch (e) {}
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
-}
-
-function test() {
- /** Bug 599909 - to-be-reloaded tabs don't show up in switch-to-tab **/
- waitForExplicitFinish();
-
- // Set the pref to true so we know exactly how many tabs should be restoring at
- // any given time. This guarantees that a finishing load won't start another.
- Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org/#1" }] },
- { entries: [{ url: "http://example.org/#2" }] },
- { entries: [{ url: "http://example.org/#3" }] },
- { entries: [{ url: "http://example.org/#4" }] }
- ], selected: 1 }] };
-
- let tabsForEnsure = {};
- state.windows[0].tabs.forEach(function(tab) {
- tabsForEnsure[tab.entries[0].url] = 1;
- });
-
- let tabsRestoring = 0;
- let tabsRestored = 0;
-
- function handleEvent(aEvent) {
- if (aEvent.type == "SSTabRestoring")
- tabsRestoring++;
- else
- tabsRestored++;
-
- if (tabsRestoring < state.windows[0].tabs.length ||
- tabsRestored < 1)
- return;
-
- gBrowser.tabContainer.removeEventListener("SSTabRestoring", handleEvent, true);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", handleEvent, true);
- executeSoon(function() {
- checkAutocompleteResults(tabsForEnsure, cleanup);
- });
- }
-
- // currentURI is set before SSTabRestoring is fired, so we can sucessfully check
- // after that has fired for all tabs. Since 1 tab will be restored though, we
- // also need to wait for 1 SSTabRestored since currentURI will be set, unset, then set.
- gBrowser.tabContainer.addEventListener("SSTabRestoring", handleEvent, true);
- gBrowser.tabContainer.addEventListener("SSTabRestored", handleEvent, true);
- ss.setBrowserState(JSON.stringify(state));
-}
-
-// The following was taken from browser/base/content/test/browser_tabMatchesInAwesomebar.js
-// so that we could do the same sort of checking.
-var gController = Cc["@mozilla.org/autocomplete/controller;1"].
- getService(Ci.nsIAutoCompleteController);
-
-function checkAutocompleteResults(aExpected, aCallback) {
- gController.input = {
- timeout: 10,
- textValue: "",
- searches: ["history"],
- searchParam: "enable-actions",
- popupOpen: false,
- minResultsForPopup: 0,
- invalidate: function() {},
- disableAutoComplete: false,
- completeDefaultIndex: false,
- get popup() { return this; },
- onSearchBegin: function() {},
- onSearchComplete: function ()
- {
- info("Found " + gController.matchCount + " matches.");
- // Check to see the expected uris and titles match up (in any order)
- for (let i = 0; i < gController.matchCount; i++) {
- let uri = gController.getValueAt(i).replace(/^moz-action:[^,]+,/i, "");
-
- info("Search for '" + uri + "' in open tabs.");
- ok(uri in aExpected, "Registered open page found in autocomplete.");
- // Remove the found entry from expected results.
- delete aExpected[uri];
- }
-
- // Make sure there is no reported open page that is not open.
- for (let entry in aExpected) {
- ok(false, "'" + entry + "' not found in autocomplete.");
- }
-
- executeSoon(aCallback);
- },
- setSelectedIndex: function() {},
- get searchCount() { return this.searches.length; },
- getSearchAt: function(aIndex) this.searches[aIndex],
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIAutoCompleteInput,
- Ci.nsIAutoCompletePopup,
- ])
- };
-
- info("Searching open pages.");
- gController.startSearch(Services.prefs.getCharPref("browser.urlbar.restrict.openpage"));
-}
diff --git a/browser/components/sessionstore/test/browser_600545.js b/browser/components/sessionstore/test/browser_600545.js
deleted file mode 100644
index a5a81f5cb..000000000
--- a/browser/components/sessionstore/test/browser_600545.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let stateBackup = ss.getBrowserState();
-
-function test() {
- /** Test for Bug 600545 **/
- waitForExplicitFinish();
- testBug600545();
-}
-
-function testBug600545() {
- // Set the pref to false to cause non-app tabs to be stripped out on a save
- Services.prefs.setBoolPref("browser.sessionstore.resume_from_crash", false);
- Services.prefs.setIntPref("browser.sessionstore.interval", 2000);
-
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.resume_from_crash");
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- });
-
- // This tests the following use case:
- // When multiple windows are open and browser.sessionstore.resume_from_crash
- // preference is false, tab session data for non-active window is stripped for
- // non-pinned tabs. This occurs after "sessionstore-state-write" fires which
- // will only fire in this case if there is at least one pinned tab.
- let state = { windows: [
- {
- tabs: [
- { entries: [{ url: "http://example.org#0" }], pinned:true },
- { entries: [{ url: "http://example.com#1" }] },
- { entries: [{ url: "http://example.com#2" }] },
- ],
- selected: 2
- },
- {
- tabs: [
- { entries: [{ url: "http://example.com#3" }] },
- { entries: [{ url: "http://example.com#4" }] },
- { entries: [{ url: "http://example.com#5" }] },
- { entries: [{ url: "http://example.com#6" }] }
- ],
- selected: 3
- }
- ] };
-
- waitForBrowserState(state, function() {
- // Need to wait for SessionStore's saveState function to be called
- // so that non-pinned tabs will be stripped from non-active window
- waitForSaveState(function () {
- let expectedNumberOfTabs = getStateTabCount(state);
- let retrievedState = JSON.parse(ss.getBrowserState());
- let actualNumberOfTabs = getStateTabCount(retrievedState);
-
- is(actualNumberOfTabs, expectedNumberOfTabs,
- "Number of tabs in retreived session data, matches number of tabs set.");
-
- done();
- });
- });
-}
-
-function done() {
- // Enumerate windows and close everything but our primary window. We can't
- // use waitForFocus() because apparently it's buggy. See bug 599253.
- let windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while (windowsEnum.hasMoreElements()) {
- let currentWindow = windowsEnum.getNext();
- if (currentWindow != window)
- currentWindow.close();
- }
-
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
-}
-
-// Count up the number of tabs in the state data
-function getStateTabCount(aState) {
- let tabCount = 0;
- for (let i in aState.windows)
- tabCount += aState.windows[i].tabs.length;
- return tabCount;
-}
diff --git a/browser/components/sessionstore/test/browser_601955.js b/browser/components/sessionstore/test/browser_601955.js
deleted file mode 100644
index f1044d459..000000000
--- a/browser/components/sessionstore/test/browser_601955.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This tests that pinning/unpinning a tab, on its own, eventually triggers a
-// session store.
-
-function test() {
- waitForExplicitFinish();
- // We speed up the interval between session saves to ensure that the test
- // runs quickly.
- Services.prefs.setIntPref("browser.sessionstore.interval", 2000);
-
- // Loading a tab causes a save state and this is meant to catch that event.
- waitForSaveState(testBug601955_1);
-
- // Assumption: Only one window is open and it has one tab open.
- gBrowser.addTab("about:mozilla");
-}
-
-function testBug601955_1() {
- // Because pinned tabs are at the front of |gBrowser.tabs|, pinning tabs
- // re-arranges the |tabs| array.
- ok(!gBrowser.tabs[0].pinned, "first tab should not be pinned yet");
- ok(!gBrowser.tabs[1].pinned, "second tab should not be pinned yet");
-
- waitForSaveState(testBug601955_2);
- gBrowser.pinTab(gBrowser.tabs[0]);
-}
-
-function testBug601955_2() {
- let state = JSON.parse(ss.getBrowserState());
- ok(state.windows[0].tabs[0].pinned, "first tab should be pinned by now");
- ok(!state.windows[0].tabs[1].pinned, "second tab should still not be pinned");
-
- waitForSaveState(testBug601955_3);
- gBrowser.unpinTab(window.gBrowser.tabs[0]);
-}
-
-function testBug601955_3() {
- let state = JSON.parse(ss.getBrowserState());
- ok(!state.windows[0].tabs[0].pinned, "first tab should not be pinned");
- ok(!state.windows[0].tabs[1].pinned, "second tab should not be pinned");
-
- done();
-}
-
-function done() {
- gBrowser.removeTab(window.gBrowser.tabs[0]);
-
- Services.prefs.clearUserPref("browser.sessionstore.interval");
-
- executeSoon(finish);
-}
diff --git a/browser/components/sessionstore/test/browser_607016.js b/browser/components/sessionstore/test/browser_607016.js
deleted file mode 100644
index 6534b6e45..000000000
--- a/browser/components/sessionstore/test/browser_607016.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let stateBackup = ss.getBrowserState();
-
-function cleanup() {
- // Reset the pref
- try {
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
- } catch (e) {}
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
-}
-
-function test() {
- /** Bug 607016 - If a tab is never restored, attributes (eg. hidden) aren't updated correctly **/
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- // Set the pref to true so we know exactly how many tabs should be restoring at
- // any given time. This guarantees that a finishing load won't start another.
- Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
-
- // We have our own progress listener for this test, which we'll attach before our state is set
- let progressListener = {
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
- progressCallback(aBrowser);
- }
- }
-
- let state = { windows: [{ tabs: [
- { entries: [{ url: "http://example.org#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#2" }], extData: { "uniq": r() } }, // overwriting
- { entries: [{ url: "http://example.org#3" }], extData: { "uniq": r() } }, // hiding
- { entries: [{ url: "http://example.org#4" }], extData: { "uniq": r() } }, // adding
- { entries: [{ url: "http://example.org#5" }], extData: { "uniq": r() } }, // deleting
- { entries: [{ url: "http://example.org#6" }] } // creating
- ], selected: 1 }] };
-
- function progressCallback(aBrowser) {
- // We'll remove the progress listener after the first one because we aren't
- // loading any other tabs
- window.gBrowser.removeTabsProgressListener(progressListener);
-
- let curState = JSON.parse(ss.getBrowserState());
- for (let i = 0; i < curState.windows[0].tabs.length; i++) {
- let tabState = state.windows[0].tabs[i];
- let tabCurState = curState.windows[0].tabs[i];
- if (tabState.extData) {
- is(tabCurState.extData["uniq"], tabState.extData["uniq"],
- "sanity check that tab has correct extData");
- }
- else {
- // We aren't expecting there to be any data on extData, but panorama
- // may be setting something, so we need to make sure that if we do have
- // data, we just don't have anything for "uniq".
- ok(!("extData" in tabCurState) || !("uniq" in tabCurState.extData),
- "sanity check that tab doesn't have extData or extData doesn't have 'uniq'");
- }
- }
-
- // Now we'll set a new unique value on 1 of the tabs
- let newUniq = r();
- ss.setTabValue(gBrowser.tabs[1], "uniq", newUniq);
- gBrowser.removeTab(gBrowser.tabs[1]);
- let closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
- is(closedTabData.state.extData.uniq, newUniq,
- "(overwriting) new data is stored in extData");
-
- // hide the next tab before closing it
- gBrowser.hideTab(gBrowser.tabs[1]);
- gBrowser.removeTab(gBrowser.tabs[1]);
- closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
- ok(closedTabData.state.hidden, "(hiding) tab data has hidden == true");
-
- // set data that's not in a conflicting key
- let stillUniq = r();
- ss.setTabValue(gBrowser.tabs[1], "stillUniq", stillUniq);
- gBrowser.removeTab(gBrowser.tabs[1]);
- closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
- is(closedTabData.state.extData.stillUniq, stillUniq,
- "(adding) new data is stored in extData");
-
- // remove the uniq value and make sure it's not there in the closed data
- ss.deleteTabValue(gBrowser.tabs[1], "uniq");
- gBrowser.removeTab(gBrowser.tabs[1]);
- closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
- // Since Panorama might have put data in, first check if there is extData.
- // If there is explicitly check that "uniq" isn't in it. Otherwise, we're ok
- if ("extData" in closedTabData.state) {
- ok(!("uniq" in closedTabData.state.extData),
- "(deleting) uniq not in existing extData");
- }
- else {
- ok(true, "(deleting) no data is stored in extData");
- }
-
- // set unique data on the tab that never had any set, make sure that's saved
- let newUniq2 = r();
- ss.setTabValue(gBrowser.tabs[1], "uniq", newUniq2);
- gBrowser.removeTab(gBrowser.tabs[1]);
- closedTabData = (JSON.parse(ss.getClosedTabData(window)))[0];
- is(closedTabData.state.extData.uniq, newUniq2,
- "(creating) new data is stored in extData where there was none");
-
- cleanup();
- }
-
- window.gBrowser.addTabsProgressListener(progressListener);
- ss.setBrowserState(JSON.stringify(state));
-}
-
diff --git a/browser/components/sessionstore/test/browser_615394-SSWindowState_events.js b/browser/components/sessionstore/test/browser_615394-SSWindowState_events.js
deleted file mode 100644
index 26064be22..000000000
--- a/browser/components/sessionstore/test/browser_615394-SSWindowState_events.js
+++ /dev/null
@@ -1,359 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const stateBackup = JSON.parse(ss.getBrowserState());
-const testState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:blank" }] },
- { entries: [{ url: "about:rights" }] }
- ]
- }]
-};
-const lameMultiWindowState = { windows: [
- {
- tabs: [
- { entries: [{ url: "http://example.org#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.org#4" }], extData: { "uniq": r() } }
- ],
- selected: 1
- },
- {
- tabs: [
- { entries: [{ url: "http://example.com#1" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#2" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#3" }], extData: { "uniq": r() } },
- { entries: [{ url: "http://example.com#4" }], extData: { "uniq": r() } },
- ],
- selected: 3
- }
- ] };
-
-
-function getOuterWindowID(aWindow) {
- return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
-}
-
-function test() {
- /** Test for Bug 615394 - Session Restore should notify when it is beginning and ending a restore **/
- waitForExplicitFinish();
- // Preemptively extend the timeout to prevent [orange]
- requestLongerTimeout(2);
- runNextTest();
-}
-
-
-let tests = [
- test_setTabState,
- test_duplicateTab,
- test_undoCloseTab,
- test_setWindowState,
- test_setBrowserState,
- test_undoCloseWindow
-];
-function runNextTest() {
- // set an empty state & run the next test, or finish
- if (tests.length) {
- // Enumerate windows and close everything but our primary window. We can't
- // use waitForFocus() because apparently it's buggy. See bug 599253.
- var windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while (windowsEnum.hasMoreElements()) {
- var currentWindow = windowsEnum.getNext();
- if (currentWindow != window) {
- currentWindow.close();
- }
- }
-
- let currentTest = tests.shift();
- info("prepping for " + currentTest.name);
- waitForBrowserState(testState, currentTest);
- }
- else {
- waitForBrowserState(stateBackup, finish);
- }
-}
-
-/** ACTUAL TESTS **/
-
-function test_setTabState() {
- let tab = gBrowser.tabs[1];
- let newTabState = JSON.stringify({ entries: [{ url: "http://example.org" }], extData: { foo: "bar" } });
- let busyEventCount = 0;
- let readyEventCount = 0;
-
- function onSSWindowStateBusy(aEvent) {
- busyEventCount++;
- }
-
- function onSSWindowStateReady(aEvent) {
- readyEventCount++;
- is(ss.getTabValue(tab, "foo"), "bar");
- ss.setTabValue(tab, "baz", "qux");
- }
-
- function onSSTabRestored(aEvent) {
- is(busyEventCount, 1);
- is(readyEventCount, 1);
- is(ss.getTabValue(tab, "baz"), "qux");
- is(tab.linkedBrowser.currentURI.spec, "http://example.org/");
-
- window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
-
- runNextTest();
- }
-
- window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
- ss.setTabState(tab, newTabState);
-}
-
-
-function test_duplicateTab() {
- let tab = gBrowser.tabs[1];
- let busyEventCount = 0;
- let readyEventCount = 0;
- let newTab;
-
- // We'll look to make sure this value is on the duplicated tab
- ss.setTabValue(tab, "foo", "bar");
-
- function onSSWindowStateBusy(aEvent) {
- busyEventCount++;
- }
-
- // duplicateTab is "synchronous" in tab creation. Since restoreHistory is called
- // via setTimeout, newTab will be assigned before the SSWindowStateReady event
- function onSSWindowStateReady(aEvent) {
- readyEventCount++;
- is(ss.getTabValue(newTab, "foo"), "bar");
- ss.setTabValue(newTab, "baz", "qux");
- }
-
- function onSSTabRestored(aEvent) {
- is(busyEventCount, 1);
- is(readyEventCount, 1);
- is(ss.getTabValue(newTab, "baz"), "qux");
- is(newTab.linkedBrowser.currentURI.spec, "about:rights");
-
- window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
-
- runNextTest();
- }
-
- window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
-
- newTab = ss.duplicateTab(window, tab);
-}
-
-
-function test_undoCloseTab() {
- let tab = gBrowser.tabs[1],
- busyEventCount = 0,
- readyEventCount = 0,
- reopenedTab;
-
- ss.setTabValue(tab, "foo", "bar");
-
- function onSSWindowStateBusy(aEvent) {
- busyEventCount++;
- }
-
- // undoCloseTab is "synchronous" in tab creation. Since restoreHistory is called
- // via setTimeout, reopenedTab will be assigned before the SSWindowStateReady event
- function onSSWindowStateReady(aEvent) {
- readyEventCount++;
- is(ss.getTabValue(reopenedTab, "foo"), "bar");
- ss.setTabValue(reopenedTab, "baz", "qux");
- }
-
- function onSSTabRestored(aEvent) {
- is(busyEventCount, 1);
- is(readyEventCount, 1);
- is(ss.getTabValue(reopenedTab, "baz"), "qux");
- is(reopenedTab.linkedBrowser.currentURI.spec, "about:rights");
-
- window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
-
- runNextTest();
- }
-
- window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
-
- gBrowser.removeTab(tab);
- reopenedTab = ss.undoCloseTab(window, 0);
-}
-
-
-function test_setWindowState() {
- let testState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:mozilla" }], extData: { "foo": "bar" } },
- { entries: [{ url: "http://example.org" }], extData: { "baz": "qux" } }
- ]
- }]
- };
-
- let busyEventCount = 0,
- readyEventCount = 0,
- tabRestoredCount = 0;
-
- function onSSWindowStateBusy(aEvent) {
- busyEventCount++;
- }
-
- function onSSWindowStateReady(aEvent) {
- readyEventCount++;
- is(ss.getTabValue(gBrowser.tabs[0], "foo"), "bar");
- is(ss.getTabValue(gBrowser.tabs[1], "baz"), "qux");
- }
-
- function onSSTabRestored(aEvent) {
- if (++tabRestoredCount < 2)
- return;
-
- is(busyEventCount, 1);
- is(readyEventCount, 1);
- is(gBrowser.tabs[0].linkedBrowser.currentURI.spec, "about:mozilla");
- is(gBrowser.tabs[1].linkedBrowser.currentURI.spec, "http://example.org/");
-
- window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
-
- runNextTest();
- }
-
- window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
-
- ss.setWindowState(window, JSON.stringify(testState), true);
-}
-
-
-function test_setBrowserState() {
- // We'll track events per window so we are sure that they are each happening once
- // pre window.
- let windowEvents = {};
- windowEvents[getOuterWindowID(window)] = { busyEventCount: 0, readyEventCount: 0 };
-
- // waitForBrowserState does it's own observing for windows, but doesn't attach
- // the listeners we want here, so do it ourselves.
- let newWindow;
- function windowObserver(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
- newWindow.addEventListener("load", function() {
- newWindow.removeEventListener("load", arguments.callee, false);
-
- Services.ww.unregisterNotification(windowObserver);
-
- windowEvents[getOuterWindowID(newWindow)] = { busyEventCount: 0, readyEventCount: 0 };
-
- newWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- newWindow.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- }, false);
- }
- }
-
- function onSSWindowStateBusy(aEvent) {
- windowEvents[getOuterWindowID(aEvent.originalTarget)].busyEventCount++;
- }
-
- function onSSWindowStateReady(aEvent) {
- windowEvents[getOuterWindowID(aEvent.originalTarget)].readyEventCount++;
- }
-
- window.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- Services.ww.registerNotification(windowObserver);
-
- waitForBrowserState(lameMultiWindowState, function() {
- let checkedWindows = 0;
- for each (let [id, winEvents] in Iterator(windowEvents)) {
- is(winEvents.busyEventCount, 1,
- "[test_setBrowserState] window" + id + " busy event count correct");
- is(winEvents.readyEventCount, 1,
- "[test_setBrowserState] window" + id + " ready event count correct");
- checkedWindows++;
- }
- is(checkedWindows, 2,
- "[test_setBrowserState] checked 2 windows");
- window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- newWindow.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- newWindow.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- runNextTest();
- });
-}
-
-
-function test_undoCloseWindow() {
- let newWindow, reopenedWindow;
-
- function firstWindowObserver(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
- Services.ww.unregisterNotification(firstWindowObserver);
- }
- }
- Services.ww.registerNotification(firstWindowObserver);
-
- waitForBrowserState(lameMultiWindowState, function() {
- // Close the window which isn't window
- newWindow.close();
- reopenedWindow = ss.undoCloseWindow(0);
- reopenedWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- reopenedWindow.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
-
- reopenedWindow.addEventListener("load", function() {
- reopenedWindow.removeEventListener("load", arguments.callee, false);
-
- reopenedWindow.gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
- }, false);
- });
-
- let busyEventCount = 0,
- readyEventCount = 0,
- tabRestoredCount = 0;
- // These will listen to the reopened closed window...
- function onSSWindowStateBusy(aEvent) {
- busyEventCount++;
- }
-
- function onSSWindowStateReady(aEvent) {
- readyEventCount++;
- }
-
- function onSSTabRestored(aEvent) {
- if (++tabRestoredCount < 4)
- return;
-
- is(busyEventCount, 1);
- is(readyEventCount, 1);
-
- reopenedWindow.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
- reopenedWindow.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
- reopenedWindow.gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
-
- reopenedWindow.close();
-
- runNextTest();
- }
-}
diff --git a/browser/components/sessionstore/test/browser_618151.js b/browser/components/sessionstore/test/browser_618151.js
deleted file mode 100644
index cba2e924a..000000000
--- a/browser/components/sessionstore/test/browser_618151.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const stateBackup = ss.getBrowserState();
-const testState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:blank" }] },
- { entries: [{ url: "about:mozilla" }] }
- ]
- }]
-};
-
-
-function test() {
- /** Test for Bug 618151 - Overwriting state can lead to unrestored tabs **/
- waitForExplicitFinish();
- runNextTest();
-}
-
-// Just a subset of tests from bug 615394 that causes a timeout.
-let tests = [test_setup, test_hang];
-function runNextTest() {
- // set an empty state & run the next test, or finish
- if (tests.length) {
- // Enumerate windows and close everything but our primary window. We can't
- // use waitForFocus() because apparently it's buggy. See bug 599253.
- var windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while (windowsEnum.hasMoreElements()) {
- var currentWindow = windowsEnum.getNext();
- if (currentWindow != window) {
- currentWindow.close();
- }
- }
-
- let currentTest = tests.shift();
- info("running " + currentTest.name);
- waitForBrowserState(testState, currentTest);
- }
- else {
- ss.setBrowserState(stateBackup);
- executeSoon(finish);
- }
-}
-
-function test_setup() {
- function onSSTabRestored(aEvent) {
- gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, false);
- runNextTest();
- }
-
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
- ss.setTabState(gBrowser.tabs[1], JSON.stringify({
- entries: [{ url: "http://example.org" }],
- extData: { foo: "bar" } }));
-}
-
-function test_hang() {
- ok(true, "test didn't time out");
- runNextTest();
-}
diff --git a/browser/components/sessionstore/test/browser_623779.js b/browser/components/sessionstore/test/browser_623779.js
deleted file mode 100644
index 34a6d7788..000000000
--- a/browser/components/sessionstore/test/browser_623779.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function test() {
- gBrowser.pinTab(gBrowser.selectedTab);
- var newTab = gBrowser.duplicateTab(gBrowser.selectedTab);
- ok(!newTab.pinned, "duplicating a pinned tab creates unpinned tab");
- gBrowser.removeTab(newTab);
- gBrowser.unpinTab(gBrowser.selectedTab);
-}
diff --git a/browser/components/sessionstore/test/browser_624727.js b/browser/components/sessionstore/test/browser_624727.js
deleted file mode 100644
index 9884058f2..000000000
--- a/browser/components/sessionstore/test/browser_624727.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let assertNumberOfTabs = function (num, msg) {
- is(gBrowser.tabs.length, num, msg);
- }
-
- let assertNumberOfPinnedTabs = function (num, msg) {
- is(gBrowser._numPinnedTabs, num, msg);
- }
-
- // check prerequisites
- assertNumberOfTabs(1, "we start off with one tab");
- assertNumberOfPinnedTabs(0, "no pinned tabs so far");
-
- // setup
- gBrowser.addTab("about:blank");
- assertNumberOfTabs(2, "there are two tabs, now");
-
- let [tab1, tab2] = gBrowser.tabs;
- let linkedBrowser = tab1.linkedBrowser;
- gBrowser.pinTab(tab1);
- gBrowser.pinTab(tab2);
- assertNumberOfPinnedTabs(2, "both tabs are now pinned");
-
- // run the test
- waitForBrowserState(
- { windows: [{ tabs: [{ url: "about:blank" }] }] },
- function () {
- assertNumberOfTabs(1, "one tab left after setBrowserState()");
- assertNumberOfPinnedTabs(0, "there are no pinned tabs");
- is(gBrowser.tabs[0].linkedBrowser, linkedBrowser, "first tab's browser got re-used");
- finish();
- }
- );
-}
diff --git a/browser/components/sessionstore/test/browser_625016.js b/browser/components/sessionstore/test/browser_625016.js
deleted file mode 100644
index 1f1c2d2b3..000000000
--- a/browser/components/sessionstore/test/browser_625016.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let newWin;
-let newTab;
-
-function test() {
- /** Test for Bug 625016 - Restore windows closed in succession to quit (non-OSX only) **/
-
- // We'll test this by opening a new window, waiting for the save event, then
- // closing that window. We'll observe the "sessionstore-state-write" notification
- // and check that the state contains no _closedWindows. We'll then add a new
- // tab and make sure that the state following that was reset and the closed
- // window is now in _closedWindows.
-
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- // We speed up the interval between session saves to ensure that the test
- // runs quickly.
- Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- });
-
- waitForSaveState(setup);
-}
-
-function setup() {
- // We'll clear all closed windows to make sure our state is clean
- // forgetClosedWindow doesn't trigger a delayed save
- while (ss.getClosedWindowCount()) {
- ss.forgetClosedWindow(0);
- }
- is(ss.getClosedWindowCount(), 0, "starting with no closed windows");
-
- // Open a new window, which should trigger a save event soon.
- waitForSaveState(onSaveState);
- newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:rights");
-}
-
-function onSaveState() {
- try {
- ss.getWindowValue(newWin, "foobar");
- } catch (e) {
- // The window is untracked which means that the saveState() call isn't the
- // one we're waiting for. It's most likely been triggered by an async
- // collection running in the background.
- waitForSaveState(onSaveState);
- return;
- }
-
- // Double check that we have no closed windows
- is(ss.getClosedWindowCount(), 0, "no closed windows on first save");
-
- Services.obs.addObserver(observe1, "sessionstore-state-write", false);
-
- // Now close the new window, which should trigger another save event
- newWin.close();
-}
-
-function observe1(aSubject, aTopic, aData) {
- info("observe1: " + aTopic);
- switch (aTopic) {
- case "sessionstore-state-write":
- aSubject.QueryInterface(Ci.nsISupportsString);
- let state = JSON.parse(aSubject.data);
- is(state.windows.length, 2,
- "observe1: 2 windows in data being writted to disk");
- is(state._closedWindows.length, 0,
- "observe1: no closed windows in data being writted to disk");
-
- // The API still treats the closed window as closed, so ensure that window is there
- is(ss.getClosedWindowCount(), 1,
- "observe1: 1 closed window according to API");
- Services.obs.removeObserver(observe1, "sessionstore-state-write");
- Services.obs.addObserver(observe1, "sessionstore-state-write-complete", false);
- break;
- case "sessionstore-state-write-complete":
- Services.obs.removeObserver(observe1, "sessionstore-state-write-complete");
- openTab();
- break;
- }
-}
-
-function observe2(aSubject, aTopic, aData) {
- info("observe2: " + aTopic);
- switch (aTopic) {
- case "sessionstore-state-write":
- aSubject.QueryInterface(Ci.nsISupportsString);
- let state = JSON.parse(aSubject.data);
- is(state.windows.length, 1,
- "observe2: 1 window in data being writted to disk");
- is(state._closedWindows.length, 1,
- "observe2: 1 closed window in data being writted to disk");
-
- // The API still treats the closed window as closed, so ensure that window is there
- is(ss.getClosedWindowCount(), 1,
- "observe2: 1 closed window according to API");
- Services.obs.removeObserver(observe2, "sessionstore-state-write");
- Services.obs.addObserver(observe2, "sessionstore-state-write-complete", false);
- break;
- case "sessionstore-state-write-complete":
- Services.obs.removeObserver(observe2, "sessionstore-state-write-complete");
- done();
- break;
- }
-}
-
-// We'll open a tab, which should trigger another state save which would wipe
-// the _shouldRestore attribute from the closed window
-function openTab() {
- Services.obs.addObserver(observe2, "sessionstore-state-write", false);
- newTab = gBrowser.addTab("about:mozilla");
-}
-
-function done() {
- gBrowser.removeTab(newTab);
- // The API still represents the closed window as closed, so we can clear it
- // with the API, but just to make sure...
- is(ss.getClosedWindowCount(), 1, "1 closed window according to API");
- ss.forgetClosedWindow(0);
- executeSoon(finish);
-}
-
diff --git a/browser/components/sessionstore/test/browser_625257.js b/browser/components/sessionstore/test/browser_625257.js
deleted file mode 100644
index 9bd69cf58..000000000
--- a/browser/components/sessionstore/test/browser_625257.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This tests that a tab which is closed while loading is not lost.
-// Specifically, that session store does not rely on an invalid cache when
-// constructing data for a tab which is loading.
-
-// The newly created tab which we load a URL into and try closing/undoing.
-let tab;
-
-// This test steps through the following parts:
-// 1. Tab has been created is loading URI_TO_LOAD.
-// 2. Before URI_TO_LOAD finishes loading, browser.currentURI has changed and
-// tab is scheduled to be removed.
-// 3. After the tab has been closed, undoCloseTab() has been called and the tab
-// should fully load.
-const URI_TO_LOAD = "about:mozilla";
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.addTabsProgressListener(tabsListener);
-
- tab = gBrowser.addTab();
-
- tab.linkedBrowser.addEventListener("load", firstOnLoad, true);
-
- gBrowser.tabContainer.addEventListener("TabClose", onTabClose, true);
-}
-
-function firstOnLoad(aEvent) {
- tab.linkedBrowser.removeEventListener("load", firstOnLoad, true);
-
- let uri = aEvent.target.location;
- is(uri, "about:blank", "first load should be for about:blank");
-
- // Trigger a save state.
- ss.getBrowserState();
-
- is(gBrowser.tabs[1], tab, "newly created tab should exist by now");
- ok(tab.linkedBrowser.__SS_data, "newly created tab should be in save state");
-
- tab.linkedBrowser.loadURI(URI_TO_LOAD);
-}
-
-let tabsListener = {
- onLocationChange: function onLocationChange(aBrowser) {
- gBrowser.removeTabsProgressListener(tabsListener);
-
- is(aBrowser.currentURI.spec, URI_TO_LOAD,
- "should occur after about:blank load and be loading next page");
-
- // Since we are running in the context of tabs listeners, we do not
- // want to disrupt other tabs listeners.
- executeSoon(function() {
- gBrowser.removeTab(tab);
- });
- }
-};
-
-function onTabClose(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", onTabClose, true);
-
- is(tab.linkedBrowser.currentURI.spec, URI_TO_LOAD,
- "should only remove when loading page");
-
- executeSoon(function() {
- tab = ss.undoCloseTab(window, 0);
- tab.linkedBrowser.addEventListener("load", secondOnLoad, true);
- });
-}
-
-function secondOnLoad(aEvent) {
- let uri = aEvent.target.location;
- is(uri, URI_TO_LOAD, "should load page from undoCloseTab");
- done();
-}
-
-function done() {
- tab.linkedBrowser.removeEventListener("load", secondOnLoad, true);
- gBrowser.removeTab(tab);
-
- executeSoon(finish);
-}
diff --git a/browser/components/sessionstore/test/browser_628270.js b/browser/components/sessionstore/test/browser_628270.js
deleted file mode 100644
index d3dbc95cf..000000000
--- a/browser/components/sessionstore/test/browser_628270.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let assertNumberOfTabs = function (num, msg) {
- is(gBrowser.tabs.length, num, msg);
- }
-
- let assertNumberOfVisibleTabs = function (num, msg) {
- is(gBrowser.visibleTabs.length, num, msg);
- }
-
- let assertNumberOfPinnedTabs = function (num, msg) {
- is(gBrowser._numPinnedTabs, num, msg);
- }
-
- waitForExplicitFinish();
-
- // check prerequisites
- assertNumberOfTabs(1, "we start off with one tab");
-
- // setup
- let tab = gBrowser.addTab("about:mozilla");
-
- whenTabIsLoaded(tab, function () {
- // hide the newly created tab
- assertNumberOfVisibleTabs(2, "there are two visible tabs");
- gBrowser.showOnlyTheseTabs([gBrowser.tabs[0]]);
- assertNumberOfVisibleTabs(1, "there is one visible tab");
- ok(tab.hidden, "newly created tab is now hidden");
-
- // close and restore hidden tab
- gBrowser.removeTab(tab);
- tab = ss.undoCloseTab(window, 0);
-
- // check that everything was restored correctly, clean up and finish
- whenTabIsLoaded(tab, function () {
- is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "restored tab has correct url");
-
- gBrowser.removeTab(tab);
- finish();
- });
- });
-}
-
-function whenTabIsLoaded(tab, callback) {
- tab.linkedBrowser.addEventListener("load", function onLoad() {
- tab.linkedBrowser.removeEventListener("load", onLoad, true);
- callback();
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_635418.js b/browser/components/sessionstore/test/browser_635418.js
deleted file mode 100644
index 461ad1ee8..000000000
--- a/browser/components/sessionstore/test/browser_635418.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This tests that hiding/showing a tab, on its own, eventually triggers a
-// session store.
-
-function test() {
- waitForExplicitFinish();
- // We speed up the interval between session saves to ensure that the test
- // runs quickly.
- Services.prefs.setIntPref("browser.sessionstore.interval", 2000);
-
- // Loading a tab causes a save state and this is meant to catch that event.
- waitForSaveState(testBug635418_1);
-
- // Assumption: Only one window is open and it has one tab open.
- gBrowser.addTab("about:mozilla");
-}
-
-function testBug635418_1() {
- ok(!gBrowser.tabs[0].hidden, "first tab should not be hidden");
- ok(!gBrowser.tabs[1].hidden, "second tab should not be hidden");
-
- waitForSaveState(testBug635418_2);
-
- // We can't hide the selected tab, so hide the new one
- gBrowser.hideTab(gBrowser.tabs[1]);
-}
-
-function testBug635418_2() {
- let state = JSON.parse(ss.getBrowserState());
- ok(!state.windows[0].tabs[0].hidden, "first tab should still not be hidden");
- ok(state.windows[0].tabs[1].hidden, "second tab should be hidden by now");
-
- waitForSaveState(testBug635418_3);
- gBrowser.showTab(gBrowser.tabs[1]);
-}
-
-function testBug635418_3() {
- let state = JSON.parse(ss.getBrowserState());
- ok(!state.windows[0].tabs[0].hidden, "first tab should still still not be hidden");
- ok(!state.windows[0].tabs[1].hidden, "second tab should not be hidden again");
-
- done();
-}
-
-function done() {
- gBrowser.removeTab(window.gBrowser.tabs[1]);
-
- Services.prefs.clearUserPref("browser.sessionstore.interval");
-
- executeSoon(finish);
-}
diff --git a/browser/components/sessionstore/test/browser_636279.js b/browser/components/sessionstore/test/browser_636279.js
deleted file mode 100644
index 653199209..000000000
--- a/browser/components/sessionstore/test/browser_636279.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let stateBackup = ss.getBrowserState();
-
-let statePinned = {windows:[{tabs:[
- {entries:[{url:"http://example.com#1"}], pinned: true}
-]}]};
-
-let state = {windows:[{tabs:[
- {entries:[{url:"http://example.com#1"}]},
- {entries:[{url:"http://example.com#2"}]},
- {entries:[{url:"http://example.com#3"}]},
- {entries:[{url:"http://example.com#4"}]},
-]}]};
-
-function test() {
- waitForExplicitFinish();
-
- registerCleanupFunction(function () {
- TabsProgressListener.uninit();
- ss.setBrowserState(stateBackup);
- });
-
-
- TabsProgressListener.init();
-
- window.addEventListener("SSWindowStateReady", function onReady() {
- window.removeEventListener("SSWindowStateReady", onReady, false);
-
- let firstProgress = true;
-
- TabsProgressListener.setCallback(function (needsRestore, isRestoring) {
- if (firstProgress) {
- firstProgress = false;
- is(isRestoring, 3, "restoring 3 tabs concurrently");
- } else {
- ok(isRestoring <= 3, "restoring max. 2 tabs concurrently");
- }
-
- if (0 == needsRestore) {
- TabsProgressListener.unsetCallback();
- waitForFocus(finish);
- }
- });
-
- ss.setBrowserState(JSON.stringify(state));
- }, false);
-
- ss.setBrowserState(JSON.stringify(statePinned));
-}
-
-function countTabs() {
- let needsRestore = 0, isRestoring = 0;
- let windowsEnum = Services.wm.getEnumerator("navigator:browser");
-
- while (windowsEnum.hasMoreElements()) {
- let window = windowsEnum.getNext();
- if (window.closed)
- continue;
-
- for (let i = 0; i < window.gBrowser.tabs.length; i++) {
- let browser = window.gBrowser.tabs[i].linkedBrowser;
- if (browser.__SS_restoreState == TAB_STATE_RESTORING)
- isRestoring++;
- else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
- needsRestore++;
- }
- }
-
- return [needsRestore, isRestoring];
-}
-
-let TabsProgressListener = {
- init: function () {
- gBrowser.addTabsProgressListener(this);
- },
-
- uninit: function () {
- this.unsetCallback();
- gBrowser.removeTabsProgressListener(this);
- },
-
- setCallback: function (callback) {
- this.callback = callback;
- },
-
- unsetCallback: function () {
- delete this.callback;
- },
-
- onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (this.callback && aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
- this.callback.apply(null, countTabs());
- }
-}
diff --git a/browser/components/sessionstore/test/browser_637020.js b/browser/components/sessionstore/test/browser_637020.js
deleted file mode 100644
index dbe145445..000000000
--- a/browser/components/sessionstore/test/browser_637020.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URL = "http://mochi.test:8888/browser/browser/components/" +
- "sessionstore/test/browser_637020_slow.sjs";
-
-const TEST_STATE = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:mozilla" }] },
- { entries: [{ url: "about:robots" }] }
- ]
- }, {
- tabs: [
- { entries: [{ url: TEST_URL }] },
- { entries: [{ url: TEST_URL }] }
- ]
- }]
-};
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test ensures that windows that have just been restored will be marked
- * as dirty, otherwise _getCurrentState() might ignore them when collecting
- * state for the first time and we'd just save them as empty objects.
- *
- * The dirty state acts as a cache to not collect data from all windows all the
- * time, so at the beginning, each window must be dirty so that we collect
- * their state at least once.
- */
-
-function runTests() {
- let win;
-
- // Wait until the new window has been opened.
- Services.obs.addObserver(function onOpened(subject) {
- Services.obs.removeObserver(onOpened, "domwindowopened");
- win = subject;
- executeSoon(next);
- }, "domwindowopened", false);
-
- // Set the new browser state that will
- // restore a window with two slowly loading tabs.
- yield SessionStore.setBrowserState(JSON.stringify(TEST_STATE));
-
- // The window has now been opened. Check the state that is returned,
- // this should come from the cache while the window isn't restored, yet.
- info("the window has been opened");
- checkWindows();
-
- // The history has now been restored and the tabs are loading. The data must
- // now come from the window, if it's correctly been marked as dirty before.
- yield whenDelayedStartupFinished(win, next);
- info("the delayed startup has finished");
- checkWindows();
-}
-
-function checkWindows() {
- let state = JSON.parse(SessionStore.getBrowserState());
- is(state.windows[0].tabs.length, 2, "first window has two tabs");
- is(state.windows[1].tabs.length, 2, "second window has two tabs");
-}
-
-function whenDelayedStartupFinished(aWindow, aCallback) {
- Services.obs.addObserver(function observer(aSubject, aTopic) {
- if (aWindow == aSubject) {
- Services.obs.removeObserver(observer, aTopic);
- executeSoon(aCallback);
- }
- }, "browser-delayed-startup-finished", false);
-}
diff --git a/browser/components/sessionstore/test/browser_637020_slow.sjs b/browser/components/sessionstore/test/browser_637020_slow.sjs
deleted file mode 100644
index 41da3c2ad..000000000
--- a/browser/components/sessionstore/test/browser_637020_slow.sjs
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-const DELAY_MS = "2000";
-
-let timer;
-
-function handleRequest(req, resp) {
- resp.processAsync();
- resp.setHeader("Cache-Control", "no-cache", false);
- resp.setHeader("Content-Type", "text/html;charset=utf-8", false);
-
- timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
- timer.init(() => {
- resp.write("hi");
- resp.finish();
- }, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT);
-}
diff --git a/browser/components/sessionstore/test/browser_644409-scratchpads.js b/browser/components/sessionstore/test/browser_644409-scratchpads.js
deleted file mode 100644
index cc79a7b4b..000000000
--- a/browser/components/sessionstore/test/browser_644409-scratchpads.js
+++ /dev/null
@@ -1,67 +0,0 @@
- /* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const testState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:blank" }] },
- ]
- }],
- scratchpads: [
- { text: "text1", executionContext: 1 },
- { text: "", executionContext: 2, filename: "test.js" }
- ]
-};
-
-// only finish() when correct number of windows opened
-var restored = [];
-function addState(state) {
- restored.push(state);
-
- if (restored.length == testState.scratchpads.length) {
- ok(statesMatch(restored, testState.scratchpads),
- "Two scratchpad windows restored");
-
- Services.ww.unregisterNotification(windowObserver);
- finish();
- }
-}
-
-function test() {
- waitForExplicitFinish();
-
- Services.ww.registerNotification(windowObserver);
-
- ss.setBrowserState(JSON.stringify(testState));
-}
-
-function windowObserver(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
-
- if (win.Scratchpad) {
- win.Scratchpad.addObserver({
- onReady: function() {
- win.Scratchpad.removeObserver(this);
-
- let state = win.Scratchpad.getState();
- win.close();
- addState(state);
- },
- });
- }
- }, false);
- }
-}
-
-function statesMatch(restored, states) {
- return states.every(function(state) {
- return restored.some(function(restoredState) {
- return state.filename == restoredState.filename &&
- state.text == restoredState.text &&
- state.executionContext == restoredState.executionContext;
- })
- });
-}
diff --git a/browser/components/sessionstore/test/browser_645428.js b/browser/components/sessionstore/test/browser_645428.js
deleted file mode 100644
index 124a7aea9..000000000
--- a/browser/components/sessionstore/test/browser_645428.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const NOTIFICATION = "sessionstore-browser-state-restored";
-
-function test() {
- waitForExplicitFinish();
-
- function observe(subject, topic, data) {
- if (NOTIFICATION == topic) {
- finish();
- ok(true, "TOPIC received");
- }
- }
-
- Services.obs.addObserver(observe, NOTIFICATION, false);
- registerCleanupFunction(function () {
- Services.obs.removeObserver(observe, NOTIFICATION);
- });
-
- ss.setBrowserState(JSON.stringify({ windows: [] }));
-}
diff --git a/browser/components/sessionstore/test/browser_659591.js b/browser/components/sessionstore/test/browser_659591.js
deleted file mode 100644
index 3608ea793..000000000
--- a/browser/components/sessionstore/test/browser_659591.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- let eventReceived = false;
-
- registerCleanupFunction(function () {
- ok(eventReceived, "SSWindowClosing event received");
- });
-
- newWindow(function (win) {
- win.addEventListener("SSWindowClosing", function onWindowClosing() {
- win.removeEventListener("SSWindowClosing", onWindowClosing, false);
- eventReceived = true;
- waitForFocus(finish);
- }, false);
-
- win.close();
- });
-}
-
-function newWindow(callback) {
- let opts = "chrome,all,dialog=no,height=800,width=800";
- let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- executeSoon(function () callback(win));
- }, false);
-}
diff --git a/browser/components/sessionstore/test/browser_662743.js b/browser/components/sessionstore/test/browser_662743.js
deleted file mode 100644
index 6d49a2fec..000000000
--- a/browser/components/sessionstore/test/browser_662743.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// This tests that session restore component does restore the right <select> option.
-// Session store should not rely only on previous user's selectedIndex, it should
-// check its value as well.
-
-function test() {
- /** Tests selected options **/
- waitForExplicitFinish();
-
- let testTabCount = 0;
- let formData = [
- // default case
- { },
- // old format
- { "#select_id" : 0 },
- { "#select_id" : 2 },
- // invalid index
- { "#select_id" : 8 },
- { "/xhtml:html/xhtml:body/xhtml:select" : 5},
- { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 6},
-
- // new format
- // index doesn't match value (testing an option in between (two))
- { id:{ "select_id": {"selectedIndex":0,"value":"val2"} } },
- // index doesn't match value (testing an invalid value)
- { id:{ "select_id": {"selectedIndex":4,"value":"val8"} } },
- // index doesn't match value (testing an invalid index)
- { id:{ "select_id": {"selectedIndex":8,"value":"val5"} } },
- // index and value match position zero
- { id:{ "select_id": {"selectedIndex":0,"value":"val0"} }, xpath: {} },
- // index doesn't match value (testing the last option (seven))
- { id:{},"xpath":{ "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']": {"selectedIndex":1,"value":"val7"} } },
- // index and value match the default option "selectedIndex":3,"value":"val3"
- { xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":3,"value":"val3"} } },
- // index matches default option however it doesn't match value
- { id:{ "select_id": {"selectedIndex":3,"value":"val4"} } },
-
- // combinations
- { "#select_id" : 3, id:{ "select_id": {"selectedIndex":1,"value":"val1"} } },
- { "#select_id" : 5, xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":4,"value":"val4"} } },
- { "/xhtml:html/xhtml:body/xhtml:select" : 5, id:{ "select_id": {"selectedIndex":1,"value":"val1"} }},
- { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : 2, xpath: { "/xhtml:html/xhtml:body/xhtml:select[@name='select_name']" : {"selectedIndex":7,"value":"val7"} } }
- ];
-
- let expectedValues = [
- [ "val3"], // default value
- [ "val0"],
- [ "val2"],
- [ "val3"], // default value (invalid index)
- [ "val5"],
- [ "val6"],
- [ "val2"],
- [ "val3"], // default value (invalid value)
- [ "val5"], // value is still valid (even it has an invalid index)
- [ "val0"],
- [ "val7"],
- [ "val3"],
- [ "val4"],
- [ "val1"],
- [ "val4"],
- [ "val1"],
- [ "val7"]
- ];
- let callback = function() {
- testTabCount--;
- if (testTabCount == 0) {
- finish();
- }
- };
-
- for (let i = 0; i < formData.length; i++) {
- testTabCount++;
- testTabRestoreData(formData[i], expectedValues[i], callback);
- }
-}
-
-function testTabRestoreData(aFormData, aExpectedValues, aCallback) {
- let testURL =
- getRootDirectory(gTestPath) + "browser_662743_sample.html";
- let tab = gBrowser.addTab(testURL);
- let tabState = { entries: [{ url: testURL, formdata: aFormData}] };
-
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- ss.setTabState(tab, JSON.stringify(tabState));
-
- tab.addEventListener("SSTabRestored", function(aEvent) {
- tab.removeEventListener("SSTabRestored", arguments.callee);
- let doc = tab.linkedBrowser.contentDocument;
- let select = doc.getElementById("select_id");
- let value = select.options[select.selectedIndex].value;
-
- // test select options values
- is(value, aExpectedValues[0],
- "Select Option by selectedIndex &/or value has been restored correctly");
-
- // clean up
- gBrowser.removeTab(tab);
- aCallback();
- });
-
- tab.addEventListener("TabClose", function(aEvent) {
- tab.removeEventListener("TabClose", arguments.callee);
- let restoredTabState = JSON.parse(ss.getTabState(tab));
- let restoredFormData = restoredTabState.entries[0].formdata;
- let selectIdFormData = restoredFormData.id.select_id;
- let value = restoredFormData.id.select_id.value;
-
- // test format
- ok("id" in restoredFormData && "xpath" in restoredFormData,
- "FormData format is valid");
- // validate that there are no old keys
- is(Object.keys(restoredFormData).length, 2,
- "FormData key length is valid");
- // test format
- ok("selectedIndex" in selectIdFormData && "value" in selectIdFormData,
- "select format is valid");
- // validate that there are no old keys
- is(Object.keys(selectIdFormData).length, 2,
- "select_id length is valid");
- // test set collection values
- is(value, aExpectedValues[0],
- "Collection has been saved correctly");
- });
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_662743_sample.html b/browser/components/sessionstore/test/browser_662743_sample.html
deleted file mode 100644
index de48fa0c9..000000000
--- a/browser/components/sessionstore/test/browser_662743_sample.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<title>Test 662743</title>
-
-<!-- Select events -->
-<h3>Select options</h3>
-<select id="select_id" name="select_name">
- <option value="val0">Zero</option>
- <option value="val1">One</option>
- <option value="val2">Two</option>
- <option value="val3" selected="selected">Three</option>
- <option value="val4">Four</option>
- <option value="val5">Five</option>
- <option value="val6">Six</option>
- <option value="val7">Seven</option>
-</select> \ No newline at end of file
diff --git a/browser/components/sessionstore/test/browser_662812.js b/browser/components/sessionstore/test/browser_662812.js
deleted file mode 100644
index 44cfe7ba3..000000000
--- a/browser/components/sessionstore/test/browser_662812.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- waitForExplicitFinish();
-
- window.addEventListener("SSWindowStateBusy", function onBusy() {
- window.removeEventListener("SSWindowStateBusy", onBusy, false);
-
- let state = JSON.parse(ss.getWindowState(window));
- ok(state.windows[0].busy, "window is busy");
-
- window.addEventListener("SSWindowStateReady", function onReady() {
- window.removeEventListener("SSWindowStateReady", onReady, false);
-
- let state = JSON.parse(ss.getWindowState(window));
- ok(!state.windows[0].busy, "window is not busy");
-
- gBrowser.removeTab(gBrowser.tabs[1]);
- executeSoon(finish);
- }, false);
- }, false);
-
- // create a new tab
- let tab = gBrowser.addTab("about:mozilla");
- let browser = tab.linkedBrowser;
-
- // close and restore it
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- gBrowser.removeTab(tab);
- ss.undoCloseTab(window, 0);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_665702-state_session.js b/browser/components/sessionstore/test/browser_665702-state_session.js
deleted file mode 100644
index aee0f2554..000000000
--- a/browser/components/sessionstore/test/browser_665702-state_session.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function compareArray(a, b) {
- if (a.length !== b.length) {
- return false;
- }
- for (let i = 0; i < a.length; i++) {
- if (a[i] !== b[i]) {
- return false;
- }
- }
- return true;
-}
-
-function test() {
- let currentState = JSON.parse(ss.getBrowserState());
- ok(currentState.session, "session data returned by getBrowserState");
-
- let keys = Object.keys(currentState.session);
- let expectedKeys = ["state", "lastUpdate", "startTime", "recentCrashes"];
- ok(compareArray(keys.sort(), expectedKeys.sort()),
- "session object from getBrowserState has correct keys");
-}
diff --git a/browser/components/sessionstore/test/browser_682507.js b/browser/components/sessionstore/test/browser_682507.js
deleted file mode 100644
index 52b95341b..000000000
--- a/browser/components/sessionstore/test/browser_682507.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
- gBrowser.addTab("about:mozilla");
-
- ss.setTabState(gBrowser.tabs[1], ss.getTabState(gBrowser.tabs[1]));
- ok(gBrowser.tabs[1].hasAttribute("pending"), "second tab should have 'pending' attribute");
-
- gBrowser.selectedTab = gBrowser.tabs[1];
- ok(!gBrowser.tabs[1].hasAttribute("pending"), "second tab should have not 'pending' attribute");
-
- gBrowser.removeTab(gBrowser.tabs[1]);
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
-}
diff --git a/browser/components/sessionstore/test/browser_687710.js b/browser/components/sessionstore/test/browser_687710.js
deleted file mode 100644
index be8d9cec1..000000000
--- a/browser/components/sessionstore/test/browser_687710.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that sessionrestore handles cycles in the shentry graph properly.
-//
-// These cycles shouldn't be there in the first place, but they cause hangs
-// when they mysteriously appear (bug 687710). Docshell code assumes this
-// graph is a tree and tires to walk to the root. But if there's a cycle,
-// there is no root, and we loop forever.
-
-let stateBackup = ss.getBrowserState();
-
-let state = {windows:[{tabs:[{entries:[
- {
- docIdentifier: 1,
- url: "http://example.com",
- children: [
- {
- docIdentifier: 2,
- url: "http://example.com"
- }
- ]
- },
- {
- docIdentifier: 2,
- url: "http://example.com",
- children: [
- {
- docIdentifier: 1,
- url: "http://example.com"
- }
- ]
- }
-]}]}]}
-
-function test() {
- registerCleanupFunction(function () {
- ss.setBrowserState(stateBackup);
- });
-
- /* This test fails by hanging. */
- ss.setBrowserState(JSON.stringify(state));
- ok(true, "Didn't hang!");
-}
diff --git a/browser/components/sessionstore/test/browser_687710_2.js b/browser/components/sessionstore/test/browser_687710_2.js
deleted file mode 100644
index 6b36fdc35..000000000
--- a/browser/components/sessionstore/test/browser_687710_2.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that the fix for bug 687710 isn't too aggressive -- shentries which are
-// cousins should be able to share bfcache entries.
-
-let stateBackup = ss.getBrowserState();
-
-let state = {entries:[
- {
- docIdentifier: 1,
- url: "http://example.com?1",
- children: [{ docIdentifier: 10,
- url: "http://example.com?10" }]
- },
- {
- docIdentifier: 1,
- url: "http://example.com?1#a",
- children: [{ docIdentifier: 10,
- url: "http://example.com?10#aa" }]
- }
-]};
-
-function test()
-{
- registerCleanupFunction(function () {
- ss.setBrowserState(stateBackup);
- });
-
- let tab = gBrowser.addTab("about:blank");
- ss.setTabState(tab, JSON.stringify(state));
- let history = tab.linkedBrowser.webNavigation.sessionHistory;
-
- is(history.count, 2, "history.count");
- for (let i = 0; i < history.count; i++) {
- for (let j = 0; j < history.count; j++) {
- compareEntries(i, j, history);
- }
- }
-}
-
-function compareEntries(i, j, history)
-{
- let e1 = history.getEntryAtIndex(i, false)
- .QueryInterface(Ci.nsISHEntry)
- .QueryInterface(Ci.nsISHContainer);
-
- let e2 = history.getEntryAtIndex(j, false)
- .QueryInterface(Ci.nsISHEntry)
- .QueryInterface(Ci.nsISHContainer);
-
- ok(e1.sharesDocumentWith(e2),
- i + ' should share doc with ' + j);
- is(e1.childCount, e2.childCount,
- 'Child count mismatch (' + i + ', ' + j + ')');
-
- for (let c = 0; c < e1.childCount; c++) {
- let c1 = e1.GetChildAt(c);
- let c2 = e2.GetChildAt(c);
-
- ok(c1.sharesDocumentWith(c2),
- 'Cousins should share documents. (' + i + ', ' + j + ', ' + c + ')');
- }
-}
diff --git a/browser/components/sessionstore/test/browser_694378.js b/browser/components/sessionstore/test/browser_694378.js
deleted file mode 100644
index 8578428d8..000000000
--- a/browser/components/sessionstore/test/browser_694378.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test Summary:
-// 1. call ss.setWindowState with a broken state
-// 1a. ensure that it doesn't throw.
-
-function test() {
- waitForExplicitFinish();
-
- let brokenState = {
- windows: [
- { tabs: [{ entries: [{ url: "about:mozilla" }] }] }
- ],
- selectedWindow: 2
- };
- let brokenStateString = JSON.stringify(brokenState);
-
- let gotError = false;
- try {
- ss.setWindowState(window, brokenStateString, true);
- }
- catch (ex) {
- gotError = true;
- info(ex);
- }
-
- ok(!gotError, "ss.setWindowState did not throw an error");
-
- // Make sure that we reset the state. Use a full state just in case things get crazy.
- let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
- waitForBrowserState(blankState, finish);
-}
diff --git a/browser/components/sessionstore/test/browser_701377.js b/browser/components/sessionstore/test/browser_701377.js
deleted file mode 100644
index e526b7eb7..000000000
--- a/browser/components/sessionstore/test/browser_701377.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let state = {windows:[{tabs:[
- {entries:[{url:"http://example.com#1"}]},
- {entries:[{url:"http://example.com#2"}], hidden: true}
-]}]};
-
-function test() {
- waitForExplicitFinish();
-
- newWindowWithState(state, function (aWindow) {
- let tab = aWindow.gBrowser.tabs[1];
- ok(tab.hidden, "the second tab is hidden");
-
- let tabShown = false;
- let tabShowCallback = function () tabShown = true;
- tab.addEventListener("TabShow", tabShowCallback, false);
-
- let tabState = ss.getTabState(tab);
- ss.setTabState(tab, tabState);
-
- tab.removeEventListener("TabShow", tabShowCallback, false);
- ok(tab.hidden && !tabShown, "tab remains hidden");
-
- finish();
- });
-}
-
-// ----------
-function newWindowWithState(aState, aCallback) {
- let opts = "chrome,all,dialog=no,height=800,width=800";
- let win = window.openDialog(getBrowserURL(), "_blank", opts);
-
- registerCleanupFunction(function () win.close());
-
- whenWindowLoaded(win, function onWindowLoaded(aWin) {
- ss.setWindowState(aWin, JSON.stringify(aState), true);
- executeSoon(function () aCallback(aWin));
- });
-}
diff --git a/browser/components/sessionstore/test/browser_705597.js b/browser/components/sessionstore/test/browser_705597.js
deleted file mode 100644
index 8810c88e6..000000000
--- a/browser/components/sessionstore/test/browser_705597.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tabState = {
- entries: [{url: "about:robots", children: [{url: "about:mozilla"}]}]
-};
-
-function test() {
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- });
-
- let tab = gBrowser.addTab("about:blank");
-
- let browser = tab.linkedBrowser;
-
- waitForTabState(tab, tabState, function () {
-
- let sessionHistory = browser.sessionHistory;
- let entry = sessionHistory.getEntryAtIndex(0, false);
- entry.QueryInterface(Ci.nsISHContainer);
-
- whenChildCount(entry, 1, function () {
- whenChildCount(entry, 2, function () {
- whenBrowserLoaded(browser, function () {
- let {entries} = JSON.parse(ss.getTabState(tab));
- is(entries.length, 1, "tab has one history entry");
- ok(!entries[0].children, "history entry has no subframes");
-
- // Make sure that we reset the state.
- let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
- waitForBrowserState(blankState, finish);
- });
-
- // reload the browser to deprecate the subframes
- browser.reload();
- });
-
- // create a dynamic subframe
- let doc = browser.contentDocument;
- let iframe = doc.createElement("iframe");
- doc.body.appendChild(iframe);
- iframe.setAttribute("src", "about:mozilla");
- });
- });
-}
-
-function whenChildCount(aEntry, aChildCount, aCallback) {
- if (aEntry.childCount == aChildCount)
- aCallback();
- else
- setTimeout(function () whenChildCount(aEntry, aChildCount, aCallback), 100);
-}
diff --git a/browser/components/sessionstore/test/browser_707862.js b/browser/components/sessionstore/test/browser_707862.js
deleted file mode 100644
index db09e0d05..000000000
--- a/browser/components/sessionstore/test/browser_707862.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tabState = {
- entries: [{url: "about:robots", children: [{url: "about:mozilla"}]}]
-};
-
-function test() {
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- });
-
- let tab = gBrowser.addTab("about:blank");
-
- let browser = tab.linkedBrowser;
-
- waitForTabState(tab, tabState, function() {
-
- let sessionHistory = browser.sessionHistory;
- let entry = sessionHistory.getEntryAtIndex(0, false);
- entry.QueryInterface(Ci.nsISHContainer);
-
- whenChildCount(entry, 1, function () {
- whenChildCount(entry, 2, function () {
- whenBrowserLoaded(browser, function () {
- let sessionHistory = browser.sessionHistory;
- let entry = sessionHistory.getEntryAtIndex(0, false);
-
- whenChildCount(entry, 0, function () {
- // Make sure that we reset the state.
- let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
- waitForBrowserState(blankState, finish);
- });
- });
-
- // reload the browser to deprecate the subframes
- browser.reload();
- });
-
- // create a dynamic subframe
- let doc = browser.contentDocument;
- let iframe = doc.createElement("iframe");
- doc.body.appendChild(iframe);
- iframe.setAttribute("src", "about:mozilla");
- });
- });
-}
-
-function whenChildCount(aEntry, aChildCount, aCallback) {
- if (aEntry.childCount == aChildCount)
- aCallback();
- else
- setTimeout(function () whenChildCount(aEntry, aChildCount, aCallback), 100);
-}
diff --git a/browser/components/sessionstore/test/browser_739531.js b/browser/components/sessionstore/test/browser_739531.js
deleted file mode 100644
index e5927caf6..000000000
--- a/browser/components/sessionstore/test/browser_739531.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// This test ensures that attempts made to save/restore ("duplicate") pages
-// using designmode AND make changes to document structure (remove body)
-// don't result in uncaught errors and a broken browser state.
-
-function test() {
- waitForExplicitFinish();
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_739531_sample.html";
-
- let loadCount = 0;
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) {
- // make sure both the page and the frame are loaded
- if (++loadCount < 2)
- return;
- tab.linkedBrowser.removeEventListener("load", onLoad, true);
-
- // executeSoon to allow the JS to execute on the page
- executeSoon(function() {
-
- let tab2;
- let caughtError = false;
- try {
- tab2 = ss.duplicateTab(window, tab);
- }
- catch (e) {
- caughtError = true;
- info(e);
- }
-
- is(gBrowser.tabs.length, 3, "there should be 3 tabs")
-
- ok(!caughtError, "duplicateTab didn't throw");
-
- // if the test fails, we don't want to try to close a tab that doesn't exist
- if (tab2)
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- });
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_739531_sample.html b/browser/components/sessionstore/test/browser_739531_sample.html
deleted file mode 100644
index ad317ab0c..000000000
--- a/browser/components/sessionstore/test/browser_739531_sample.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!-- originally a crash test for bug 713417
- https://bug713417.bugzilla.mozilla.org/attachment.cgi?id=584240 -->
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<script>
-
-function boom()
-{
- var w = document.getElementById("f").contentWindow;
- var d = w.document;
- d.designMode = 'on';
- var r = d.documentElement;
- d.removeChild(r);
- document.adoptNode(r);
-}
-
-</script>
-</head>
-<body onload="boom();">
-<iframe src="data:text/html;charset=utf-8,1" id="f"></iframe>
-</body>
-</html>
-
diff --git a/browser/components/sessionstore/test/browser_739805.js b/browser/components/sessionstore/test/browser_739805.js
deleted file mode 100644
index 077916456..000000000
--- a/browser/components/sessionstore/test/browser_739805.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tabState = {
- entries: [{url: "data:text/html;charset=utf-8,<input%20id='foo'>", formdata: { id: { "foo": "bar" } } }]
-};
-
-function test() {
- waitForExplicitFinish();
- Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
-
- registerCleanupFunction(function () {
- if (gBrowser.tabs.length > 1)
- gBrowser.removeTab(gBrowser.tabs[1]);
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
- });
-
- let tab = gBrowser.addTab("about:blank");
- let browser = tab.linkedBrowser;
-
- whenBrowserLoaded(browser, function () {
- isnot(gBrowser.selectedTab, tab, "newly created tab is not selected");
-
- ss.setTabState(tab, JSON.stringify(tabState));
- is(browser.__SS_restoreState, TAB_STATE_NEEDS_RESTORE, "tab needs restoring");
-
- let state = JSON.parse(ss.getTabState(tab));
- let formdata = state.entries[0].formdata;
- is(formdata && formdata.id["foo"], "bar", "tab state's formdata is valid");
-
- whenTabRestored(tab, function () {
- let input = browser.contentDocument.getElementById("foo");
- is(input.value, "bar", "formdata has been restored correctly");
- finish();
- });
-
- // Restore the tab by selecting it.
- gBrowser.selectedTab = tab;
- });
-}
-
-function whenBrowserLoaded(aBrowser, aCallback) {
- aBrowser.addEventListener("load", function onLoad() {
- aBrowser.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
-}
-
-function whenTabRestored(aTab, aCallback) {
- aTab.addEventListener("SSTabRestored", function onRestored() {
- aTab.removeEventListener("SSTabRestored", onRestored);
- executeSoon(aCallback);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_819510_perwindowpb.js b/browser/components/sessionstore/test/browser_819510_perwindowpb.js
deleted file mode 100644
index 291e8aa50..000000000
--- a/browser/components/sessionstore/test/browser_819510_perwindowpb.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const originalState = ss.getBrowserState();
-
-/** Private Browsing Test for Bug 819510 **/
-function test() {
- waitForExplicitFinish();
-
- registerCleanupFunction(function() {
- ss.setBrowserState(originalState);
- });
-
- runNextTest();
-}
-
-let tests = [test_1, test_2, test_3 ];
-
-const testState = {
- windows: [{
- tabs: [
- { entries: [{ url: "about:blank" }] },
- ]
- }]
-};
-
-function runNextTest() {
- // Set an empty state
- closeAllButPrimaryWindow();
-
- // Run the next test, or finish
- if (tests.length) {
- let currentTest = tests.shift();
- waitForBrowserState(testState, currentTest);
- } else {
- finish();
- }
-}
-
-// Test opening default mochitest-normal-private-normal-private windows
-// (saving the state with last window being private)
-function test_1() {
- testOnWindow(false, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/1");
- testOnWindow(true, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/2");
- testOnWindow(false, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/3");
- testOnWindow(true, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/4");
-
- let curState = JSON.parse(ss.getBrowserState());
- is (curState.windows.length, 5, "Browser has opened 5 windows");
- is (curState.windows[2].isPrivate, true, "Window is private");
- is (curState.windows[4].isPrivate, true, "Last window is private");
- is (curState.selectedWindow, 5, "Last window opened is the one selected");
-
- forceWriteState(function(state) {
- is(state.windows.length, 3,
- "sessionstore state: 3 windows in data being written to disk");
- is (state.selectedWindow, 3,
- "Selected window is updated to match one of the saved windows");
- state.windows.forEach(function(win) {
- is(!win.isPrivate, true, "Saved window is not private");
- });
- is(state._closedWindows.length, 0,
- "sessionstore state: no closed windows in data being written to disk");
- runNextTest();
- });
- });
- });
- });
- });
-}
-
-// Test opening default mochitest window + 2 private windows
-function test_2() {
- testOnWindow(true, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/1");
- testOnWindow(true, function(aWindow) {
- aWindow.gBrowser.addTab("http://www.example.com/2");
-
- let curState = JSON.parse(ss.getBrowserState());
- is (curState.windows.length, 3, "Browser has opened 3 windows");
- is (curState.windows[1].isPrivate, true, "Window 1 is private");
- is (curState.windows[2].isPrivate, true, "Window 2 is private");
- is (curState.selectedWindow, 3, "Last window opened is the one selected");
-
- forceWriteState(function(state) {
- is(state.windows.length, 1,
- "sessionstore state: 1 windows in data being written to disk");
- is (state.selectedWindow, 1,
- "Selected window is updated to match one of the saved windows");
- is(state._closedWindows.length, 0,
- "sessionstore state: no closed windows in data being written to disk");
- runNextTest();
- });
- });
- });
-}
-
-// Test opening default-normal-private-normal windows and closing a normal window
-function test_3() {
- testOnWindow(false, function(normalWindow) {
- waitForTabLoad(normalWindow, "http://www.example.com/", function() {
- testOnWindow(true, function(aWindow) {
- waitForTabLoad(aWindow, "http://www.example.com/", function() {
- testOnWindow(false, function(aWindow) {
- waitForTabLoad(aWindow, "http://www.example.com/", function() {
-
- let curState = JSON.parse(ss.getBrowserState());
- is(curState.windows.length, 4, "Browser has opened 4 windows");
- is(curState.windows[2].isPrivate, true, "Window 2 is private");
- is(curState.selectedWindow, 4, "Last window opened is the one selected");
-
- waitForWindowClose(normalWindow, function() {
- // Load another tab before checking the written state so that
- // the list of restoring windows gets cleared. Otherwise the
- // window we just closed would be marked as not closed.
- waitForTabLoad(aWindow, "http://www.example.com/", function() {
- forceWriteState(function(state) {
- is(state.windows.length, 2,
- "sessionstore state: 2 windows in data being written to disk");
- is(state.selectedWindow, 2,
- "Selected window is updated to match one of the saved windows");
- state.windows.forEach(function(win) {
- is(!win.isPrivate, true, "Saved window is not private");
- });
- is(state._closedWindows.length, 1,
- "sessionstore state: 1 closed window in data being written to disk");
- state._closedWindows.forEach(function(win) {
- is(!win.isPrivate, true, "Closed window is not private");
- });
- runNextTest();
- });
- });
- });
- });
- });
- });
- });
- });
- });
-}
-
-function waitForWindowClose(aWin, aCallback) {
- let winCount = JSON.parse(ss.getBrowserState()).windows.length;
- aWin.addEventListener("SSWindowClosing", function onWindowClosing() {
- aWin.removeEventListener("SSWindowClosing", onWindowClosing, false);
- function checkCount() {
- let state = JSON.parse(ss.getBrowserState());
- if (state.windows.length == (winCount - 1)) {
- aCallback();
- } else {
- executeSoon(checkCount);
- }
- }
- executeSoon(checkCount);
- }, false);
- aWin.close();
-}
-
-function forceWriteState(aCallback) {
- Services.obs.addObserver(function observe(aSubject, aTopic, aData) {
- if (aTopic == "sessionstore-state-write") {
- Services.obs.removeObserver(observe, aTopic);
- Services.prefs.clearUserPref("browser.sessionstore.interval");
- aSubject.QueryInterface(Ci.nsISupportsString);
- aCallback(JSON.parse(aSubject.data));
- }
- }, "sessionstore-state-write", false);
- Services.prefs.setIntPref("browser.sessionstore.interval", 0);
-}
-
-function testOnWindow(aIsPrivate, aCallback) {
- let win = OpenBrowserWindow({private: aIsPrivate});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- executeSoon(function() { aCallback(win); });
- }, false);
-}
-
-function waitForTabLoad(aWin, aURL, aCallback) {
- aWin.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWin.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
- aWin.gBrowser.selectedBrowser.loadURI(aURL);
-}
diff --git a/browser/components/sessionstore/test/browser_833286_atomic_backup.js b/browser/components/sessionstore/test/browser_833286_atomic_backup.js
deleted file mode 100644
index bc21ae399..000000000
--- a/browser/components/sessionstore/test/browser_833286_atomic_backup.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// This tests are for a sessionstore.js atomic backup.
-
-let tmp = {};
-Cu.import("resource://gre/modules/osfile.jsm", tmp);
-Cu.import("resource://gre/modules/Task.jsm", tmp);
-Cu.import("resource:///modules/sessionstore/_SessionFile.jsm", tmp);
-
-const {OS, Task, _SessionFile} = tmp;
-
-const PREF_SS_INTERVAL = "browser.sessionstore.interval";
-// Full paths for sessionstore.js and sessionstore.bak.
-const path = OS.Path.join(OS.Constants.Path.profileDir, "sessionstore.js");
-const backupPath = OS.Path.join(OS.Constants.Path.profileDir,
- "sessionstore.bak");
-
-// A text decoder.
-let gDecoder = new TextDecoder();
-// Global variables that contain sessionstore.js and sessionstore.bak data for
-// comparison between tests.
-let gSSData;
-let gSSBakData;
-
-// waitForSaveStateComplete waits for a state write completion.
-function waitForSaveStateComplete(aSaveStateCallback) {
- let topic = "sessionstore-state-write-complete";
-
- function observer() {
- Services.prefs.clearUserPref(PREF_SS_INTERVAL);
- Services.obs.removeObserver(observer, topic);
- executeSoon(function taskCallback() {
- Task.spawn(aSaveStateCallback);
- });
- }
-
- Services.obs.addObserver(observer, topic, false);
-}
-
-// Register next test callback and trigger state saving change.
-function nextTest(testFunc) {
- waitForSaveStateComplete(testFunc);
- Services.prefs.setIntPref(PREF_SS_INTERVAL, 0);
-}
-
-registerCleanupFunction(function() {
- // Cleaning up after the test: removing the sessionstore.bak file.
- Task.spawn(function cleanupTask() {
- yield OS.File.remove(backupPath);
- });
-});
-
-function test() {
- waitForExplicitFinish();
- nextTest(testInitialWriteNoBackup);
-}
-
-function testInitialWriteNoBackup() {
- // Ensure that sessionstore.js is created, but not sessionstore.bak.
- let ssExists = yield OS.File.exists(path);
- let ssBackupExists = yield OS.File.exists(backupPath);
- ok(ssExists, "sessionstore.js should be created.");
- ok(!ssBackupExists, "sessionstore.bak should not have been created, yet.");
-
- nextTest(testWriteNoBackup);
-}
-
-function testWriteNoBackup() {
- // Ensure sessionstore.bak is not created.
- let ssExists = yield OS.File.exists(path);
- let ssBackupExists = yield OS.File.exists(backupPath);
- ok(ssExists, "sessionstore.js should exist.");
- ok(!ssBackupExists, "sessionstore.bak should not have been created, yet");
-
- // Save sessionstore.js data to compare to the sessionstore.bak data in the
- // next test.
- let array = yield OS.File.read(path);
- gSSData = gDecoder.decode(array);
-
- // Manually trigger _SessionFile.createBackupCopy since the backup once
- // promise is already resolved and backup would not be triggered again.
- yield _SessionFile.createBackupCopy();
-
- nextTest(testWriteBackup);
-}
-
-function testWriteBackup() {
- // Ensure sessionstore.bak is finally created.
- let ssExists = yield OS.File.exists(path);
- let ssBackupExists = yield OS.File.exists(backupPath);
- ok(ssExists, "sessionstore.js exists.");
- ok(ssBackupExists, "sessionstore.bak should now be created.");
-
- // Read sessionstore.bak data.
- let array = yield OS.File.read(backupPath);
- gSSBakData = gDecoder.decode(array);
-
- // Make sure that the sessionstore.bak is identical to the last
- // sessionstore.js.
- is(gSSBakData, gSSData, "sessionstore.js is backed up correctly.");
-
- // Read latest sessionstore.js.
- array = yield OS.File.read(path);
- gSSData = gDecoder.decode(array);
-
- // Read sessionstore.js with _SessionFile.read.
- let ssDataRead = yield _SessionFile.read();
- is(ssDataRead, gSSData, "_SessionFile.read read sessionstore.js correctly.");
-
- // Read sessionstore.js with _SessionFile.syncRead.
- ssDataRead = _SessionFile.syncRead();
- is(ssDataRead, gSSData,
- "_SessionFile.syncRead read sessionstore.js correctly.");
-
- // Remove sessionstore.js to test fallback onto sessionstore.bak.
- yield OS.File.remove(path);
- ssExists = yield OS.File.exists(path);
- ok(!ssExists, "sessionstore.js should be removed now.");
-
- // Read sessionstore.bak with _SessionFile.read.
- ssDataRead = yield _SessionFile.read();
- is(ssDataRead, gSSBakData,
- "_SessionFile.read read sessionstore.bak correctly.");
-
- // Read sessionstore.bak with _SessionFile.syncRead.
- ssDataRead = _SessionFile.syncRead();
- is(ssDataRead, gSSBakData,
- "_SessionFile.syncRead read sessionstore.bak correctly.");
- nextTest(testNoWriteBackup);
-}
-
-function testNoWriteBackup() {
- // Ensure sessionstore.bak is backed up only once.
-
- // Read sessionstore.bak data.
- let array = yield OS.File.read(backupPath);
- let ssBakData = gDecoder.decode(array);
- // Ensure the sessionstore.bak did not change.
- is(ssBakData, gSSBakData, "sessionstore.bak is unchanged.");
-
- executeSoon(finish);
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/browser_attributes.js b/browser/components/sessionstore/test/browser_attributes.js
deleted file mode 100644
index 29b748b85..000000000
--- a/browser/components/sessionstore/test/browser_attributes.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test makes sure that we correctly preserve tab attributes when storing
- * and restoring tabs. It also ensures that we skip special attributes like
- * 'image' and 'pending' that need to be handled differently or internally.
- */
-
-const PREF = "browser.sessionstore.restore_on_demand";
-
-function runTests() {
- Services.prefs.setBoolPref(PREF, true)
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- // Add a new tab with a nice icon.
- let tab = gBrowser.addTab("about:robots");
- yield whenBrowserLoaded(tab.linkedBrowser);
-
- // Check that the tab has an 'image' attribute.
- ok(tab.hasAttribute("image"), "tab.image exists");
-
- // Make sure we do not persist 'image' attributes.
- ss.persistTabAttribute("image");
- let {attributes} = JSON.parse(ss.getTabState(tab));
- ok(!("image" in attributes), "'image' attribute not saved");
- ok(!("custom" in attributes), "'custom' attribute not saved");
-
- // Test persisting a custom attribute.
- tab.setAttribute("custom", "foobar");
- ss.persistTabAttribute("custom");
-
- let {attributes} = JSON.parse(ss.getTabState(tab));
- is(attributes.custom, "foobar", "'custom' attribute is correct");
-
- // Make sure we're backwards compatible and restore old 'image' attributes.
- let state = {
- entries: [{url: "about:mozilla"}],
- attributes: {custom: "foobaz", image: gBrowser.getIcon(tab)}
- };
-
- // Prepare a pending tab waiting to be restored.
- whenTabRestoring(tab);
- yield ss.setTabState(tab, JSON.stringify(state));
-
- ok(tab.hasAttribute("pending"), "tab is pending");
- is(gBrowser.getIcon(tab), state.attributes.image, "tab has correct icon");
-
- // Let the pending tab load.
- gBrowser.selectedTab = tab;
- yield whenBrowserLoaded(tab.linkedBrowser);
-
- // Ensure no 'image' or 'pending' attributes are stored.
- let {attributes} = JSON.parse(ss.getTabState(tab));
- ok(!("image" in attributes), "'image' attribute not saved");
- ok(!("pending" in attributes), "'pending' attribute not saved");
- is(attributes.custom, "foobaz", "'custom' attribute is correct");
-
- // Clean up.
- gBrowser.removeTab(tab);
-}
-
-function whenTabRestoring(tab) {
- tab.addEventListener("SSTabRestoring", function onRestoring() {
- tab.removeEventListener("SSTabRestoring", onRestoring);
- executeSoon(next);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_capabilities.js b/browser/components/sessionstore/test/browser_capabilities.js
deleted file mode 100644
index 349d4ecfa..000000000
--- a/browser/components/sessionstore/test/browser_capabilities.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test ensures that disabling features by flipping nsIDocShell.allow*
- * properties are (re)stored as disabled. Disallowed features must be
- * re-enabled when the tab is re-used by another tab restoration.
- */
-
-function runTests() {
- // Create a tab that we're going to use for our tests.
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:mozilla");
- let browser = tab.linkedBrowser;
- let docShell = browser.docShell;
- yield waitForLoad(browser);
-
- // Get the list of capabilities for docShells.
- let flags = Object.keys(docShell).filter(k => k.startsWith("allow"));
-
- // Check that everything is allowed by default for new tabs.
- let state = JSON.parse(ss.getTabState(tab));
- ok(!("disallow" in state), "everything allowed by default");
- ok(flags.every(f => docShell[f]), "all flags set to true");
-
- // Flip a couple of allow* flags.
- docShell.allowImages = false;
- docShell.allowMetaRedirects = false;
-
- // Check that we correctly save disallowed features.
- let disallowedState = JSON.parse(ss.getTabState(tab));
- let disallow = new Set(disallowedState.disallow.split(","));
- ok(disallow.has("Images"), "images not allowed");
- ok(disallow.has("MetaRedirects"), "meta redirects not allowed");
- is(disallow.size, 2, "two capabilities disallowed");
-
- // Reuse the tab to restore a new, clean state into it.
- ss.setTabState(tab, JSON.stringify({ entries: [{url: "about:robots"}] }));
- yield waitForLoad(browser);
-
- // After restoring disallowed features must be available again.
- state = JSON.parse(ss.getTabState(tab));
- ok(!("disallow" in state), "everything allowed again");
- ok(flags.every(f => docShell[f]), "all flags set to true");
-
- // Restore the state with disallowed features.
- ss.setTabState(tab, JSON.stringify(disallowedState));
- yield waitForLoad(browser);
-
- // Check that docShell flags are set.
- ok(!docShell.allowImages, "images not allowed");
- ok(!docShell.allowMetaRedirects, "meta redirects not allowed")
-
- // Check that we correctly restored features as disabled.
- state = JSON.parse(ss.getTabState(tab));
- disallow = new Set(state.disallow.split(","));
- ok(disallow.has("Images"), "images not allowed anymore");
- ok(disallow.has("MetaRedirects"), "meta redirects not allowed anymore");
- is(disallow.size, 2, "two capabilities disallowed");
-
- // Clean up after ourselves.
- gBrowser.removeTab(tab);
-}
-
-function waitForLoad(aElement) {
- aElement.addEventListener("load", function onLoad() {
- aElement.removeEventListener("load", onLoad, true);
- executeSoon(next);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_dying_cache.js b/browser/components/sessionstore/test/browser_dying_cache.js
deleted file mode 100644
index 41e22d864..000000000
--- a/browser/components/sessionstore/test/browser_dying_cache.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test ensures that after closing a window we keep its state data around
- * as long as something keeps a reference to it. It should only be possible to
- * read data after closing - writing should fail.
- */
-
-function runTests() {
- // Open a new window.
- let win = OpenBrowserWindow();
- yield whenWindowLoaded(win);
-
- // Load some URL in the current tab.
- win.gBrowser.selectedBrowser.loadURI("about:robots");
- yield whenBrowserLoaded(win.gBrowser.selectedBrowser);
-
- // Open a second tab and close the first one.
- let tab = win.gBrowser.addTab("about:mozilla");
- yield whenBrowserLoaded(tab.linkedBrowser);
- win.gBrowser.removeTab(win.gBrowser.tabs[0]);
-
- // Make sure our window is still tracked by sessionstore
- // and the window state is as expected.
- ok("__SSi" in win, "window is being tracked by sessionstore");
- ss.setWindowValue(win, "foo", "bar");
- checkWindowState(win);
-
- let state = ss.getWindowState(win);
- let closedTabData = ss.getClosedTabData(win);
-
- // Close our window and wait a tick.
- whenWindowClosed(win);
- yield win.close();
-
- // SessionStore should no longer track our window
- // but it should still report the same state.
- ok(!("__SSi" in win), "sessionstore does no longer track our window");
- checkWindowState(win);
-
- // Make sure we're not allowed to modify state data.
- ok(shouldThrow(() => ss.setWindowState(win, {})),
- "we're not allowed to modify state data anymore");
- ok(shouldThrow(() => ss.setWindowValue(win, "foo", "baz")),
- "we're not allowed to modify state data anymore");
-}
-
-function checkWindowState(window) {
- let {windows: [{tabs}]} = JSON.parse(ss.getWindowState(window));
- is(tabs.length, 1, "the window has a single tab");
- is(tabs[0].entries[0].url, "about:mozilla", "the tab is about:mozilla");
-
- is(ss.getClosedTabCount(window), 1, "the window has one closed tab");
- let [{state: {entries: [{url}]}}] = JSON.parse(ss.getClosedTabData(window));
- is(url, "about:robots", "the closed tab is about:robots");
-
- is(ss.getWindowValue(window, "foo"), "bar", "correct extData value");
-}
-
-function shouldThrow(f) {
- try {
- f();
- } catch (e) {
- return true;
- }
-}
-
-function whenWindowClosed(window) {
- window.addEventListener("SSWindowClosing", function onClosing() {
- window.removeEventListener("SSWindowClosing", onClosing);
- executeSoon(next);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_form_restore_events.js b/browser/components/sessionstore/test/browser_form_restore_events.js
deleted file mode 100644
index f673d85ec..000000000
--- a/browser/components/sessionstore/test/browser_form_restore_events.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Originally a test for Bug 476161, but then expanded to include all input types in bug 640136 **/
-
- waitForExplicitFinish();
-
- let file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
-
- let testURL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_form_restore_events_sample.html";
- let tab = gBrowser.addTab(testURL);
- tab.linkedBrowser.addEventListener("load", function(aEvent) {
- tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab.linkedBrowser.contentDocument;
-
- // text fields
- doc.getElementById("modify01").value += Math.random();
- doc.getElementById("modify02").value += " " + Date.now();
-
- // textareas
- doc.getElementById("modify03").value += Math.random();
- doc.getElementById("modify04").value += " " + Date.now();
-
- // file
- doc.getElementById("modify05").value = file.path;
-
- // select
- doc.getElementById("modify06").selectedIndex = 1;
- var multipleChange = doc.getElementById("modify07");
- Array.forEach(multipleChange.options, function(option) option.selected = true);
-
- // checkbox
- doc.getElementById("modify08").checked = true;
- doc.getElementById("modify09").checked = false;
-
- // radio
- // select one then another in the same group - only last one should get event on restore
- doc.getElementById("modify10").checked = true;
- doc.getElementById("modify11").checked = true;
-
-
- let tab2 = gBrowser.duplicateTab(tab);
- tab2.linkedBrowser.addEventListener("load", function(aEvent) {
- tab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- let doc = tab2.linkedBrowser.contentDocument;
- let inputFired = doc.getElementById("inputFired").textContent.trim().split();
- let changeFired = doc.getElementById("changeFired").textContent.trim().split();
-
- is(inputFired.sort().join(" "), "modify01 modify02 modify03 modify04 modify05",
- "input events were only dispatched for modified input, textarea fields");
-
- is(changeFired.sort().join(" "), "modify06 modify07 modify08 modify09 modify11",
- "change events were only dispatched for modified select, checkbox, radio fields");
-
- // clean up
- gBrowser.removeTab(tab2);
- gBrowser.removeTab(tab);
-
- finish();
- }, true);
- }, true);
-}
diff --git a/browser/components/sessionstore/test/browser_form_restore_events_sample.html b/browser/components/sessionstore/test/browser_form_restore_events_sample.html
deleted file mode 100644
index 1d46d4040..000000000
--- a/browser/components/sessionstore/test/browser_form_restore_events_sample.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>Test for form restore events (originally bug 476161)</title>
-
-<script>
-
-document.addEventListener("input", function(aEvent) {
- var inputEl = aEvent.originalTarget;
- var changedEl = document.getElementById("inputFired");
- changedEl.textContent += " " + inputEl.id;
-}, false);
-
-document.addEventListener("change", function(aEvent) {
- var inputEl = aEvent.originalTarget;
- var changedEl = document.getElementById("changeFired");
- changedEl.textContent += " " + inputEl.id;
-}, false);
-
-</script>
-
-<!-- input events -->
-<h3>Text fields with changed text</h3>
-<input type="text" id="modify1">
-<input type="text" id="modify2" value="preset value">
-<input type="text" id="modify01">
-<input type="text" id="modify02" value="preset value">
-
-<h3>Text fields with unchanged text</h3>
-<input type="text" id="unchanged1">
-<input type="text" id="unchanged2" value="preset value">
-<input type="text" id="unchanged01">
-<input type="text" id="unchanged02" value="preset value">
-
-<h3>Textarea with changed text</h3>
-<textarea id="modify03"></textarea>
-<textarea id="modify04">preset value</textarea>
-
-<h3>Textarea with unchanged text</h3>
-<textarea id="unchanged03"></textarea>
-<textarea id="unchanged04">preset value</textarea>
-
-<h3>file field with changed value</h3>
-<input type="file" id="modify05">
-
-<h3>file field with unchanged value</h3>
-<input type="file" id="unchanged05">
-
-<!-- change events -->
-
-<h3>Select menu with changed selection</h3>
-<select id="modify06">
- <option value="one">one</option>
- <option value="two">two</option>
- <option value="three">three</option>
-</select>
-
-<h3>Select menu with unchanged selection (change event still fires)</h3>
-<select id="unchanged06">
- <option value="one">one</option>
- <option value="two" selected>two</option>
- <option value="three">three</option>
-</select>
-
-<h3>Multiple Select menu with changed selection</h3>
-<select id="modify07" multiple>
- <option value="one">one</option>
- <option value="two" selected>two</option>
- <option value="three">three</option>
-</select>
-
-<h3>Select menu with unchanged selection</h3>
-<select id="unchanged07" multiple>
- <option value="one">one</option>
- <option value="two" selected>two</option>
- <option value="three" selected>three</option>
-</select>
-
-<h3>checkbox with changed value</h3>
-<input type="checkbox" id="modify08">
-<input type="checkbox" id="modify09" checked>
-
-<h3>checkbox with unchanged value</h3>
-<input type="checkbox" id="unchanged08">
-<input type="checkbox" id="unchanged09" checked>
-
-<h3>radio with changed value</h3>
-<input type="radio" id="modify10" name="group">Radio 1</input>
-<input type="radio" id="modify11" name="group">Radio 2</input>
-<input type="radio" id="modify12" name="group" checked>Radio 3</input>
-
-<h3>radio with unchanged value</h3>
-<input type="radio" id="unchanged10" name="group2">Radio 4</input>
-<input type="radio" id="unchanged11" name="group2">Radio 5</input>
-<input type="radio" id="unchanged12" name="group2" checked>Radio 6</input>
-
-<h3>Changed field IDs</h3>
-<div id="changed"></div>
-<div id="inputFired"></div>
-<div id="changeFired"></div>
diff --git a/browser/components/sessionstore/test/browser_formdata_format.js b/browser/components/sessionstore/test/browser_formdata_format.js
deleted file mode 100644
index 52d165a1c..000000000
--- a/browser/components/sessionstore/test/browser_formdata_format.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- /** Tests formdata format **/
- waitForExplicitFinish();
-
- let formData = [
- { },
- // old format
- { "#input1" : "value0" },
- { "#input1" : "value1", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value2" },
- { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value3" },
- // new format
- { id: { "input1" : "value4" } },
- { id: { "input1" : "value5" }, xpath: {} },
- { id: { "input1" : "value6" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value7" } },
- { id: {}, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value8" } },
- { xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value9" } },
- // combinations
- { "#input1" : "value10", id: { "input1" : "value11" } },
- { "#input1" : "value12", id: { "input1" : "value13" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value14" } },
- { "#input1" : "value15", xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value16" } },
- { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value17", id: { "input1" : "value18" } },
- { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value19", id: { "input1" : "value20" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value21" } },
- { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value22", xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value23" } },
- { "#input1" : "value24", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value25", id: { "input1" : "value26" } },
- { "#input1" : "value27", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value28", id: { "input1" : "value29" }, xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value30" } },
- { "#input1" : "value31", "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value32", xpath: { "/xhtml:html/xhtml:body/xhtml:input[@name='input2']" : "value33" } }
- ]
- let expectedValues = [
- [ "" , "" ],
- // old format
- [ "value0", "" ],
- [ "value1", "value2" ],
- [ "", "value3" ],
- // new format
- [ "value4", "" ],
- [ "value5", "" ],
- [ "value6", "value7" ],
- [ "", "value8" ],
- [ "", "value9" ],
- // combinations
- [ "value11", "" ],
- [ "value13", "value14" ],
- [ "", "value16" ],
- [ "value18", "" ],
- [ "value20", "value21" ],
- [ "", "value23" ],
- [ "value26", "" ],
- [ "value29", "value30" ],
- [ "", "value33" ]
- ];
- let testTabCount = 0;
- let callback = function() {
- testTabCount--;
- if (testTabCount == 0) {
- finish();
- }
- };
-
- for (let i = 0; i < formData.length; i++) {
- testTabCount++;
- testTabRestoreData(formData[i], expectedValues[i], callback);
- }
-}
-
-function testTabRestoreData(aFormData, aExpectedValue, aCallback) {
- let testURL =
- getRootDirectory(gTestPath) + "browser_formdata_format_sample.html";
- let tab = gBrowser.addTab(testURL);
- let tabState = { entries: [{ url: testURL, formdata: aFormData}] };
-
- let browserLoadedCallback = function(aEvent) {
- let tabStateCallback = function(aEvent) {
- let doc = tab.linkedBrowser.contentDocument;
- let input1 = doc.getElementById("input1");
- let input2 = doc.querySelector("input[name=input2]");
- let saveStateCallback = function(aEvent) {
- let restoredTabState = JSON.parse(ss.getTabState(tab));
- let restoredFormData = restoredTabState.entries[0].formdata;
-
- if (restoredFormData) {
- // test format
- ok("id" in restoredFormData && "xpath" in restoredFormData,
- "FormData format is valid: " + restoredFormData);
- // validate that there are no old keys
- is(Object.keys(restoredFormData).length, 2,
- "FormData key length is valid");
- // test id
- is(input1.value, aExpectedValue[0],
- "FormData by 'id' has been restored correctly");
- // test xpath
- is(input2.value, aExpectedValue[1],
- "FormData by 'xpath' has been restored correctly");
- }
-
- // clean up
- gBrowser.removeTab(tab);
- aCallback();
- };
-
- waitForSaveState(saveStateCallback);
-
- // force a change event to recollect the formdata
- let changeEvent = document.createEvent("Events");
- changeEvent.initEvent("change", true, true);
- input.dispatchEvent(changeEvent);
- };
-
- waitForTabState(tab, tabState, tabStateCallback);
- };
-
- whenBrowserLoaded(tab.linkedBrowser, browserLoadedCallback);
-}
diff --git a/browser/components/sessionstore/test/browser_formdata_format_sample.html b/browser/components/sessionstore/test/browser_formdata_format_sample.html
deleted file mode 100644
index f991e3657..000000000
--- a/browser/components/sessionstore/test/browser_formdata_format_sample.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE html>
-<title>Test formdata format</title>
-
-<!-- input events -->
-<h3>Input fields</h3>
-<input type="text" id="input1">
-<input type="text" name="input2"> \ No newline at end of file
diff --git a/browser/components/sessionstore/test/browser_input.js b/browser/components/sessionstore/test/browser_input.js
deleted file mode 100644
index 56681ca4f..000000000
--- a/browser/components/sessionstore/test/browser_input.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "http://mochi.test:8888/browser/" +
- "browser/components/sessionstore/test/browser_input_sample.html";
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test ensures that modifying form input fields on a web page marks the
- * window as dirty and causes the corresponding form data of the tab that
- * changed to be re-collected.
- */
-
-function runTests() {
- // Create a dummy window that is regarded as active. We need to do this
- // because we always collect data for tabs of active windows no matter if
- // the window is dirty or not.
- let win = OpenBrowserWindow();
- yield waitForLoad(win);
-
- // Create a tab with some form fields.
- let tab = gBrowser.selectedTab = gBrowser.addTab(URL);
- let browser = gBrowser.selectedBrowser;
- yield waitForLoad(browser);
-
- // All windows currently marked as dirty will be written to disk
- // and thus marked clean afterwards.
- yield forceWriteState();
-
- // Modify the checkbox field's state.
- let chk = browser.contentDocument.getElementById("chk");
- EventUtils.sendMouseEvent({type: "click"}, chk);
- yield waitForInput();
-
- // Check that we'll save the form data state correctly.
- let state = JSON.parse(ss.getBrowserState());
- let {formdata} = state.windows[0].tabs[1].entries[0];
- is(formdata.id.chk, true, "chk's value is correct");
-
- // Clear dirty state of all windows again.
- yield forceWriteState();
-
- // Modify the text input field's state.
- browser.contentDocument.getElementById("txt").focus();
- EventUtils.synthesizeKey("m", {});
- yield waitForInput();
-
- // Check that we'll save the form data state correctly.
- let state = JSON.parse(ss.getBrowserState());
- let {formdata} = state.windows[0].tabs[1].entries[0];
- is(formdata.id.chk, true, "chk's value is correct");
- is(formdata.id.txt, "m", "txt's value is correct");
-
- // Clear dirty state of all windows again.
- yield forceWriteState();
-
- // Modify the state of the checkbox contained in the iframe.
- let cdoc = browser.contentDocument.getElementById("ifr").contentDocument;
- EventUtils.sendMouseEvent({type: "click"}, cdoc.getElementById("chk"));
- yield waitForInput();
-
- // Modify the state of text field contained in the iframe.
- cdoc.getElementById("txt").focus();
- EventUtils.synthesizeKey("m", {});
- yield waitForInput();
-
- // Check that we'll save the iframe's form data correctly.
- let state = JSON.parse(ss.getBrowserState());
- let {formdata} = state.windows[0].tabs[1].entries[0].children[0];
- is(formdata.id.chk, true, "iframe chk's value is correct");
- is(formdata.id.txt, "m", "iframe txt's value is correct");
-
- // Clear dirty state of all windows again.
- yield forceWriteState();
-
- // Modify the content editable's state.
- browser.contentDocument.getElementById("ced").focus();
- EventUtils.synthesizeKey("m", {});
- yield waitForInput();
-
- // Check the we'll correctly save the content editable's state.
- let state = JSON.parse(ss.getBrowserState());
- let {innerHTML} = state.windows[0].tabs[1].entries[0].children[1];
- is(innerHTML, "m", "content editable's value is correct");
-
- // Clean up after ourselves.
- gBrowser.removeTab(tab);
- win.close();
-}
-
-function forceWriteState() {
- const PREF = "browser.sessionstore.interval";
- const TOPIC = "sessionstore-state-write";
-
- Services.obs.addObserver(function observe() {
- Services.obs.removeObserver(observe, TOPIC);
- Services.prefs.clearUserPref(PREF);
- executeSoon(next);
- }, TOPIC, false);
-
- Services.prefs.setIntPref(PREF, 0);
-}
-
-function waitForLoad(aElement) {
- aElement.addEventListener("load", function onLoad() {
- aElement.removeEventListener("load", onLoad, true);
- executeSoon(next);
- }, true);
-}
-
-function waitForInput() {
- let mm = gBrowser.selectedBrowser.messageManager;
-
- mm.addMessageListener("SessionStore:input", function onPageShow() {
- mm.removeMessageListener("SessionStore:input", onPageShow);
- executeSoon(next);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_input_sample.html b/browser/components/sessionstore/test/browser_input_sample.html
deleted file mode 100644
index bbcac79c0..000000000
--- a/browser/components/sessionstore/test/browser_input_sample.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>sessionstore input test</title>
- </head>
- <body>
- <input id="chk" type="checkbox" /><input id="txt" />
- <iframe id="ifr" src="data:text/html;charset=utf-8,<input id=chk type=checkbox /><input id=txt />"></iframe>
- <iframe id="ced"></iframe>
-
- <script type="text/javascript">
- addEventListener("load", () => {
- document.getElementById("ced").contentDocument.designMode = "on";
- });
- </script>
- </body>
-</html>
diff --git a/browser/components/sessionstore/test/browser_pageshow.js b/browser/components/sessionstore/test/browser_pageshow.js
deleted file mode 100644
index 0130288e3..000000000
--- a/browser/components/sessionstore/test/browser_pageshow.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- TestRunner.run();
-}
-
-/**
- * This test ensures that loading a page from bfcache (by going back or forward
- * in history) marks the window as dirty and causes data about the tab that
- * changed to be re-collected.
- *
- * We will do this by creating a tab with two history entries and going back
- * to the first. When we now request the current browser state from the
- * session store service the first history entry must be selected.
- */
-
-const URL = "data:text/html,<h1>first</h1>";
-const URL2 = "data:text/html,<h1>second</h1>";
-
-function runTests() {
- // Create a dummy window that is regarded as active. We need to do this
- // because we always collect data for tabs of active windows no matter if
- // the window is dirty or not.
- let win = OpenBrowserWindow();
- yield waitForLoad(win);
-
- // Create a tab with two history entries.
- let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
- yield loadURI(URL);
- yield loadURI(URL2);
-
- // All windows currently marked as dirty will be written to disk
- // and thus marked clean afterwards.
- yield forceWriteState();
-
- // Go back to 'about:robots' - which is loaded from the bfcache and thus
- // will not fire a 'load' event but a 'pageshow' event with persisted=true.
- waitForPageShow();
- yield gBrowser.selectedBrowser.goBack();
- is(tab.linkedBrowser.currentURI.spec, URL, "correct url after going back");
-
- // If by receiving the 'pageshow' event the first window has correctly
- // been marked as dirty, getBrowserState() should return the tab we created
- // with the right history entry (about:robots) selected.
- let state = JSON.parse(ss.getBrowserState());
- is(state.windows[0].tabs[1].index, 1, "first history entry is selected");
-
- // Clean up after ourselves.
- gBrowser.removeTab(tab);
- win.close();
-}
-
-function forceWriteState() {
- const PREF = "browser.sessionstore.interval";
- const TOPIC = "sessionstore-state-write";
-
- Services.obs.addObserver(function observe() {
- Services.obs.removeObserver(observe, TOPIC);
- Services.prefs.clearUserPref(PREF);
- executeSoon(next);
- }, TOPIC, false);
-
- Services.prefs.setIntPref(PREF, 0);
-}
-
-function loadURI(aURI) {
- let browser = gBrowser.selectedBrowser;
- waitForLoad(browser);
- browser.loadURI(aURI);
-}
-
-function waitForLoad(aElement) {
- aElement.addEventListener("load", function onLoad() {
- aElement.removeEventListener("load", onLoad, true);
- executeSoon(next);
- }, true);
-}
-
-function waitForPageShow() {
- let mm = gBrowser.selectedBrowser.messageManager;
-
- mm.addMessageListener("SessionStore:pageshow", function onPageShow() {
- mm.removeMessageListener("SessionStore:pageshow", onPageShow);
- executeSoon(next);
- });
-}
diff --git a/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js b/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
deleted file mode 100644
index 3ee345138..000000000
--- a/browser/components/sessionstore/test/browser_windowRestore_perwindowpb.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
-* License, v. 2.0. If a copy of the MPL was not distributed with this
-* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test checks that closed private windows can't be restored
-
-function test() {
- waitForExplicitFinish();
-
- // Purging the list of closed windows
- while(ss.getClosedWindowCount() > 0)
- ss.forgetClosedWindow(0);
-
- // Load a private window, then close it
- // and verify it doesn't get remembered for restoring
- var win = OpenBrowserWindow({private: true});
-
- whenWindowLoaded(win, function onload() {
- info("The private window got loaded");
- win.addEventListener("SSWindowClosing", function onclosing() {
- win.removeEventListener("SSWindowClosing", onclosing, false);
- executeSoon(function () {
- is (ss.getClosedWindowCount(), 0,
- "The private window should not have been stored");
- finish();
- });
- }, false);
- win.close();
- });
-}
diff --git a/browser/components/sessionstore/test/head.js b/browser/components/sessionstore/test/head.js
deleted file mode 100644
index 86d741d2d..000000000
--- a/browser/components/sessionstore/test/head.js
+++ /dev/null
@@ -1,342 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TAB_STATE_NEEDS_RESTORE = 1;
-const TAB_STATE_RESTORING = 2;
-
-let tmp = {};
-Cu.import("resource:///modules/sessionstore/SessionStore.jsm", tmp);
-let SessionStore = tmp.SessionStore;
-
-let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
-
-// Some tests here assume that all restored tabs are loaded without waiting for
-// the user to bring them to the foreground. We ensure this by resetting the
-// related preference (see the "firefox.js" defaults file for details).
-Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", false);
-registerCleanupFunction(function () {
- Services.prefs.clearUserPref("browser.sessionstore.restore_on_demand");
-});
-
-// This kicks off the search service used on about:home and allows the
-// session restore tests to be run standalone without triggering errors.
-Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler).defaultArgs;
-
-function provideWindow(aCallback, aURL, aFeatures) {
- function callbackSoon(aWindow) {
- executeSoon(function executeCallbackSoon() {
- aCallback(aWindow);
- });
- }
-
- let win = openDialog(getBrowserURL(), "", aFeatures || "chrome,all,dialog=no", aURL);
- whenWindowLoaded(win, function onWindowLoaded(aWin) {
- if (!aURL) {
- info("Loaded a blank window.");
- callbackSoon(aWin);
- return;
- }
-
- aWin.gBrowser.selectedBrowser.addEventListener("load", function selectedBrowserLoadListener() {
- aWin.gBrowser.selectedBrowser.removeEventListener("load", selectedBrowserLoadListener, true);
- callbackSoon(aWin);
- }, true);
- });
-}
-
-// This assumes that tests will at least have some state/entries
-function waitForBrowserState(aState, aSetStateCallback) {
- let windows = [window];
- let tabsRestored = 0;
- let expectedTabsRestored = 0;
- let expectedWindows = aState.windows.length;
- let windowsOpen = 1;
- let listening = false;
- let windowObserving = false;
- let restoreHiddenTabs = Services.prefs.getBoolPref(
- "browser.sessionstore.restore_hidden_tabs");
-
- aState.windows.forEach(function (winState) {
- winState.tabs.forEach(function (tabState) {
- if (restoreHiddenTabs || !tabState.hidden)
- expectedTabsRestored++;
- });
- });
-
- // There must be only hidden tabs and restoreHiddenTabs = false. We still
- // expect one of them to be restored because it gets shown automatically.
- if (!expectedTabsRestored)
- expectedTabsRestored = 1;
-
- function onSSTabRestored(aEvent) {
- if (++tabsRestored == expectedTabsRestored) {
- // Remove the event listener from each window
- windows.forEach(function(win) {
- win.gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, true);
- });
- listening = false;
- info("running " + aSetStateCallback.name);
- executeSoon(aSetStateCallback);
- }
- }
-
- // Used to add our listener to further windows so we can catch SSTabRestored
- // coming from them when creating a multi-window state.
- function windowObserver(aSubject, aTopic, aData) {
- if (aTopic == "domwindowopened") {
- let newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
- newWindow.addEventListener("load", function() {
- newWindow.removeEventListener("load", arguments.callee, false);
-
- if (++windowsOpen == expectedWindows) {
- Services.ww.unregisterNotification(windowObserver);
- windowObserving = false;
- }
-
- // Track this window so we can remove the progress listener later
- windows.push(newWindow);
- // Add the progress listener
- newWindow.gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, true);
- }, false);
- }
- }
-
- // We only want to register the notification if we expect more than 1 window
- if (expectedWindows > 1) {
- registerCleanupFunction(function() {
- if (windowObserving) {
- Services.ww.unregisterNotification(windowObserver);
- }
- });
- windowObserving = true;
- Services.ww.registerNotification(windowObserver);
- }
-
- registerCleanupFunction(function() {
- if (listening) {
- windows.forEach(function(win) {
- win.gBrowser.tabContainer.removeEventListener("SSTabRestored", onSSTabRestored, true);
- });
- }
- });
- // Add the event listener for this window as well.
- listening = true;
- gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, true);
-
- // Finally, call setBrowserState
- ss.setBrowserState(JSON.stringify(aState));
-}
-
-// Doesn't assume that the tab needs to be closed in a cleanup function.
-// If that's the case, the test author should handle that in the test.
-function waitForTabState(aTab, aState, aCallback) {
- let listening = true;
-
- function onSSTabRestored() {
- aTab.removeEventListener("SSTabRestored", onSSTabRestored, false);
- listening = false;
- aCallback();
- }
-
- aTab.addEventListener("SSTabRestored", onSSTabRestored, false);
-
- registerCleanupFunction(function() {
- if (listening) {
- aTab.removeEventListener("SSTabRestored", onSSTabRestored, false);
- }
- });
- ss.setTabState(aTab, JSON.stringify(aState));
-}
-
-// waitForSaveState waits for a state write but not necessarily for the state to
-// turn dirty.
-function waitForSaveState(aSaveStateCallback) {
- let observing = false;
- let topic = "sessionstore-state-write";
-
- let sessionSaveTimeout = 1000 +
- Services.prefs.getIntPref("browser.sessionstore.interval");
-
- function removeObserver() {
- if (!observing)
- return;
- Services.obs.removeObserver(observer, topic);
- observing = false;
- }
-
- let timeout = setTimeout(function () {
- removeObserver();
- aSaveStateCallback();
- }, sessionSaveTimeout);
-
- function observer(aSubject, aTopic, aData) {
- removeObserver();
- timeout = clearTimeout(timeout);
- executeSoon(aSaveStateCallback);
- }
-
- registerCleanupFunction(function() {
- removeObserver();
- if (timeout) {
- clearTimeout(timeout);
- }
- });
-
- observing = true;
- Services.obs.addObserver(observer, topic, false);
-};
-
-function whenBrowserLoaded(aBrowser, aCallback = next) {
- aBrowser.addEventListener("load", function onLoad() {
- aBrowser.removeEventListener("load", onLoad, true);
- executeSoon(aCallback);
- }, true);
-}
-
-function whenWindowLoaded(aWindow, aCallback = next) {
- aWindow.addEventListener("load", function windowLoadListener() {
- aWindow.removeEventListener("load", windowLoadListener, false);
- executeSoon(function executeWhenWindowLoaded() {
- aCallback(aWindow);
- });
- }, false);
-}
-
-var gUniqueCounter = 0;
-function r() {
- return Date.now() + "-" + (++gUniqueCounter);
-}
-
-function BrowserWindowIterator() {
- let windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while (windowsEnum.hasMoreElements()) {
- let currentWindow = windowsEnum.getNext();
- if (!currentWindow.closed) {
- yield currentWindow;
- }
- }
-}
-
-let gProgressListener = {
- _callback: null,
- _checkRestoreState: true,
-
- setCallback: function gProgressListener_setCallback(aCallback, aCheckRestoreState = true) {
- if (!this._callback) {
- window.gBrowser.addTabsProgressListener(this);
- }
- this._callback = aCallback;
- this._checkRestoreState = aCheckRestoreState;
- },
-
- unsetCallback: function gProgressListener_unsetCallback() {
- if (this._callback) {
- this._callback = null;
- window.gBrowser.removeTabsProgressListener(this);
- }
- },
-
- onStateChange:
- function gProgressListener_onStateChange(aBrowser, aWebProgress, aRequest,
- aStateFlags, aStatus) {
- if ((!this._checkRestoreState ||
- aBrowser.__SS_restoreState == TAB_STATE_RESTORING) &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
- let args = [aBrowser].concat(this._countTabs());
- this._callback.apply(this, args);
- }
- },
-
- _countTabs: function gProgressListener_countTabs() {
- let needsRestore = 0, isRestoring = 0, wasRestored = 0;
-
- for (let win in BrowserWindowIterator()) {
- for (let i = 0; i < win.gBrowser.tabs.length; i++) {
- let browser = win.gBrowser.tabs[i].linkedBrowser;
- if (browser.__SS_restoreState == TAB_STATE_RESTORING)
- isRestoring++;
- else if (browser.__SS_restoreState == TAB_STATE_NEEDS_RESTORE)
- needsRestore++;
- else
- wasRestored++;
- }
- }
- return [needsRestore, isRestoring, wasRestored];
- }
-};
-
-registerCleanupFunction(function () {
- gProgressListener.unsetCallback();
-});
-
-// Close everything but our primary window. We can't use waitForFocus()
-// because apparently it's buggy. See bug 599253.
-function closeAllButPrimaryWindow() {
- for (let win in BrowserWindowIterator()) {
- if (win != window) {
- win.close();
- }
- }
-}
-
-function whenNewWindowLoaded(aIsPrivate, aCallback) {
- let win = OpenBrowserWindow({private: aIsPrivate});
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- aCallback(win);
- }, false);
-}
-
-/**
- * The test runner that controls the execution flow of our tests.
- */
-let TestRunner = {
- _iter: null,
-
- /**
- * Holds the browser state from before we started so
- * that we can restore it after all tests ran.
- */
- backupState: {},
-
- /**
- * Starts the test runner.
- */
- run: function () {
- waitForExplicitFinish();
-
- SessionStore.promiseInitialized.then(function () {
- executeSoon(function () {
- this.backupState = JSON.parse(ss.getBrowserState());
- this._iter = runTests();
- this.next();
- }.bind(this));
- }.bind(this));
- },
-
- /**
- * Runs the next available test or finishes if there's no test left.
- */
- next: function () {
- try {
- TestRunner._iter.next();
- } catch (e if e instanceof StopIteration) {
- TestRunner.finish();
- }
- },
-
- /**
- * Finishes all tests and cleans up.
- */
- finish: function () {
- closeAllButPrimaryWindow();
- waitForBrowserState(this.backupState, finish);
- }
-};
-
-function next() {
- TestRunner.next();
-}
diff --git a/browser/components/sessionstore/test/moz.build b/browser/components/sessionstore/test/moz.build
deleted file mode 100644
index 191c90f0b..000000000
--- a/browser/components/sessionstore/test/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/sessionstore/test/unit/data/sessionstore_valid.js b/browser/components/sessionstore/test/unit/data/sessionstore_valid.js
deleted file mode 100644
index f9511f29f..000000000
--- a/browser/components/sessionstore/test/unit/data/sessionstore_valid.js
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "windows": []
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/head.js b/browser/components/sessionstore/test/unit/head.js
deleted file mode 100644
index ff599ec3b..000000000
--- a/browser/components/sessionstore/test/unit/head.js
+++ /dev/null
@@ -1,26 +0,0 @@
-let Cu = Components.utils;
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-// Call a function once initialization of SessionStartup is complete
-let afterSessionStartupInitialization =
- function afterSessionStartupInitialization(cb) {
- do_print("Waiting for session startup initialization");
- let observer = function() {
- try {
- do_print("Session startup initialization observed");
- Services.obs.removeObserver(observer, "sessionstore-state-finalized");
- cb();
- } catch (ex) {
- do_throw(ex);
- }
- };
- let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
- getService(Ci.nsIObserver);
- Services.obs.addObserver(startup, "final-ui-startup", false);
- Services.obs.addObserver(startup, "quit-application", false);
- Services.obs.notifyObservers(null, "final-ui-startup", "");
- Services.obs.addObserver(observer, "sessionstore-state-finalized", false);
-}; \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/test_startup_nosession_async.js b/browser/components/sessionstore/test/unit/test_startup_nosession_async.js
deleted file mode 100644
index 5185b02d6..000000000
--- a/browser/components/sessionstore/test/unit/test_startup_nosession_async.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// Test nsISessionStartup.sessionType in the following scenario:
-// - no sessionstore.js;
-// - the session store has been loaded, so no need to go
-// through the synchronous fallback
-
-function run_test() {
- do_get_profile();
- // Initialize the profile (the session startup uses it)
-
- do_test_pending();
- let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
- getService(Ci.nsISessionStartup);
-
- afterSessionStartupInitialization(function cb() {
- do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
- do_test_finished();
- });
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/test_startup_nosession_sync.js b/browser/components/sessionstore/test/unit/test_startup_nosession_sync.js
deleted file mode 100644
index a06770a39..000000000
--- a/browser/components/sessionstore/test/unit/test_startup_nosession_sync.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// Test nsISessionStartup.sessionType in the following scenario:
-// - no sessionstore.js;
-// - the session store has not been loaded yet, so we have to trigger
-// synchronous fallback
-
-function run_test() {
- do_get_profile();
- let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
- getService(Ci.nsISessionStartup);
- do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/test_startup_session_async.js b/browser/components/sessionstore/test/unit/test_startup_session_async.js
deleted file mode 100644
index ce8c6f90d..000000000
--- a/browser/components/sessionstore/test/unit/test_startup_session_async.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// Test nsISessionStartup.sessionType in the following scenario:
-// - valid sessionstore.js;
-// - the session store has been loaded, so no need to go
-// through the synchronous fallback
-
-function run_test() {
- let profd = do_get_profile();
- let source = do_get_file("data/sessionstore_valid.js");
- source.copyTo(profd, "sessionstore.js");
-
- do_test_pending();
- let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
- getService(Ci.nsISessionStartup);
-
- afterSessionStartupInitialization(function cb() {
- do_check_eq(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
- do_test_finished();
- });
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/test_startup_session_sync.js b/browser/components/sessionstore/test/unit/test_startup_session_sync.js
deleted file mode 100644
index f8e56d3e9..000000000
--- a/browser/components/sessionstore/test/unit/test_startup_session_sync.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// Test nsISessionStartup.sessionType in the following scenario:
-// - valid sessionstore.js;
-// - the session store has not been loaded yet, so we have to trigger
-// synchronous fallback
-
-function run_test() {
- let profd = do_get_profile();
- let source = do_get_file("data/sessionstore_valid.js");
- source.copyTo(profd, "sessionstore.js");
- let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
- getService(Ci.nsISessionStartup);
- do_check_eq(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
-} \ No newline at end of file
diff --git a/browser/components/sessionstore/test/unit/xpcshell.ini b/browser/components/sessionstore/test/unit/xpcshell.ini
deleted file mode 100644
index 661c5d705..000000000
--- a/browser/components/sessionstore/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[DEFAULT]
-head = head.js
-tail =
-firefox-appdir = browser
-
-[test_startup_nosession_sync.js]
-[test_startup_nosession_async.js]
-[test_startup_session_sync.js]
-[test_startup_session_async.js]
diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build
index 92950f537..76218104c 100644
--- a/browser/components/shell/moz.build
+++ b/browser/components/shell/moz.build
@@ -5,4 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']
-TEST_DIRS += ['test']
+
diff --git a/browser/components/shell/test/Makefile.in b/browser/components/shell/test/Makefile.in
deleted file mode 100644
index b9624ac6e..000000000
--- a/browser/components/shell/test/Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_420786.js \
- browser_633221.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/shell/test/browser_420786.js b/browser/components/shell/test/browser_420786.js
deleted file mode 100644
index 8824fd637..000000000
--- a/browser/components/shell/test/browser_420786.js
+++ /dev/null
@@ -1,95 +0,0 @@
-const DG_BACKGROUND = "/desktop/gnome/background"
-const DG_IMAGE_KEY = DG_BACKGROUND + "/picture_filename";
-const DG_OPTION_KEY = DG_BACKGROUND + "/picture_options";
-const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background";
-
-function onPageLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
-
- var bs = Cc["@mozilla.org/intl/stringbundle;1"].
- getService(Ci.nsIStringBundleService);
- var brandName = bs.createBundle("chrome://branding/locale/brand.properties").
- GetStringFromName("brandShortName");
-
- var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIDirectoryServiceProvider);
- var homeDir = dirSvc.getFile("Home", {});
-
- var wpFile = homeDir.clone();
- wpFile.append(brandName + "_wallpaper.png");
-
- // Backup the existing wallpaper so that this test doesn't change the user's
- // settings.
- var wpFileBackup = homeDir.clone()
- wpFileBackup.append(brandName + "_wallpaper.png.backup");
-
- if (wpFileBackup.exists())
- wpFileBackup.remove(false);
-
- if (wpFile.exists())
- wpFile.copyTo(null, wpFileBackup.leafName);
-
- var shell = Cc["@mozilla.org/browser/shell-service;1"].
- getService(Ci.nsIShellService);
- var gconf = Cc["@mozilla.org/gnome-gconf-service;1"].
- getService(Ci.nsIGConfService);
-
- var prevImageKey = gconf.getString(DG_IMAGE_KEY);
- var prevOptionKey = gconf.getString(DG_OPTION_KEY);
- var prevDrawBgKey = gconf.getBool(DG_DRAW_BG_KEY);
-
- var image = content.document.images[0];
-
- function checkWallpaper(position, expectedGConfPosition) {
- shell.setDesktopBackground(image, position);
- ok(wpFile.exists(), "Wallpaper was written to disk");
- is(gconf.getString(DG_IMAGE_KEY), wpFile.path,
- "Wallpaper file GConf key is correct");
- is(gconf.getString(DG_OPTION_KEY), expectedGConfPosition,
- "Wallpaper position GConf key is correct");
- }
-
- checkWallpaper(Ci.nsIShellService.BACKGROUND_TILE, "wallpaper");
- checkWallpaper(Ci.nsIShellService.BACKGROUND_STRETCH, "stretched");
- checkWallpaper(Ci.nsIShellService.BACKGROUND_CENTER, "centered");
- checkWallpaper(Ci.nsIShellService.BACKGROUND_FILL, "zoom");
- checkWallpaper(Ci.nsIShellService.BACKGROUND_FIT, "scaled");
-
- // Restore GConf and wallpaper
-
- gconf.setString(DG_IMAGE_KEY, prevImageKey);
- gconf.setString(DG_OPTION_KEY, prevOptionKey);
- gconf.setBool(DG_DRAW_BG_KEY, prevDrawBgKey);
-
- wpFile.remove(false);
- if (wpFileBackup.exists())
- wpFileBackup.moveTo(null, wpFile.leafName);
-
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test() {
- var osString = Cc["@mozilla.org/xre/app-info;1"].
- getService(Ci.nsIXULRuntime).OS;
- if (osString != "Linux") {
- todo(false, "This test is Linux specific for now.");
- return;
- }
-
- try {
- // If GSettings is available, then the GConf tests
- // will fail
- var gsettings = Cc["@mozilla.org/gsettings-service;1"].
- getService(Ci.nsIGSettingsService).
- getCollectionForSchema("org.gnome.desktop.background");
- todo(false, "This test doesn't work when GSettings is available");
- return;
- } catch(e) { }
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", onPageLoad, true);
- content.location = "about:logo";
-
- waitForExplicitFinish();
-}
diff --git a/browser/components/shell/test/browser_633221.js b/browser/components/shell/test/browser_633221.js
deleted file mode 100644
index 840394dea..000000000
--- a/browser/components/shell/test/browser_633221.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function test() {
- let osString = Cc["@mozilla.org/xre/app-info;1"].
- getService(Ci.nsIXULRuntime).OS;
-
- // this test is Linux-specific
- if (osString != "Linux")
- return;
-
- let shell = Cc["@mozilla.org/browser/shell-service;1"].
- getService(Ci.nsIShellService);
-
- shell.setDefaultBrowser(true, false);
- ok(shell.isDefaultBrowser(true, false), "we got here and are the default browser");
- ok(shell.isDefaultBrowser(true, true), "we got here and are the default browser");
-}
diff --git a/browser/components/shell/test/moz.build b/browser/components/shell/test/moz.build
deleted file mode 100644
index e68a73ba4..000000000
--- a/browser/components/shell/test/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MODULE = 'test_browser_shell'
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/components/shell/test/unit/test_421977.js b/browser/components/shell/test/unit/test_421977.js
deleted file mode 100644
index f787301d6..000000000
--- a/browser/components/shell/test/unit/test_421977.js
+++ /dev/null
@@ -1,123 +0,0 @@
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-const GCONF_BG_COLOR_KEY = "/desktop/gnome/background/primary_color";
-
-var gShell;
-var gGConf;
-
-/**
- * Converts from a rgb numerical color valule (r << 16 | g << 8 | b)
- * into a hex string in #RRGGBB format.
- */
-function colorToHex(aColor) {
- const rMask = 4294901760;
- const gMask = 65280;
- const bMask = 255;
-
- var r = (aColor & rMask) >> 16;
- var g = (aColor & gMask) >> 8;
- var b = (aColor & bMask);
-
- return "#" + [r, g, b].map(function(aInt)
- aInt.toString(16).replace(/^(.)$/, "0$1"))
- .join("").toUpperCase();
-}
-
-/**
- * Converts a color string in #RRGGBB format to a rgb numerical color value
- * (r << 16 | g << 8 | b).
- */
-function hexToColor(aString) {
- return parseInt(aString.substring(1,3), 16) << 16 |
- parseInt(aString.substring(3,5), 16) << 8 |
- parseInt(aString.substring(5,7), 16);
-}
-
-/**
- * Checks that setting the GConf background key to aGConfColor will
- * result in the Shell component returning a background color equals
- * to aExpectedShellColor in #RRGGBB format.
- */
-function checkGConfToShellColor(aGConfColor, aExpectedShellColor) {
-
- gGConf.setString(GCONF_BG_COLOR_KEY, aGConfColor);
- var shellColor = colorToHex(gShell.desktopBackgroundColor);
-
- do_check_eq(shellColor, aExpectedShellColor);
-}
-
-/**
- * Checks that setting the background color (in #RRGGBB format) using the Shell
- * component will result in having a GConf key for the background color set to
- * aExpectedGConfColor.
- */
-function checkShellToGConfColor(aShellColor, aExpectedGConfColor) {
-
- gShell.desktopBackgroundColor = hexToColor(aShellColor);
- var gconfColor = gGConf.getString(GCONF_BG_COLOR_KEY);
-
- do_check_eq(gconfColor, aExpectedGConfColor);
-}
-
-function run_test() {
-
- // This test is Linux specific for now
- if (!("@mozilla.org/gnome-gconf-service;1" in Cc))
- return;
-
- try {
- // If GSettings is available, then the GConf tests
- // will fail
- var gsettings = Cc["@mozilla.org/gsettings-service;1"].
- getService(Ci.nsIGSettingsService).
- getCollectionForSchema("org.gnome.desktop.background");
- return;
- } catch(e) { }
-
- gGConf = Cc["@mozilla.org/gnome-gconf-service;1"].
- getService(Ci.nsIGConfService);
-
- gShell = Cc["@mozilla.org/browser/shell-service;1"].
- getService(Ci.nsIShellService);
-
- // Save the original background color so that we can restore it
- // after the test.
- var origGConfColor = gGConf.getString(GCONF_BG_COLOR_KEY);
-
- try {
-
- checkGConfToShellColor("#000", "#000000");
- checkGConfToShellColor("#00f", "#0000FF");
- checkGConfToShellColor("#b2f", "#BB22FF");
- checkGConfToShellColor("#fff", "#FFFFFF");
-
- checkGConfToShellColor("#000000", "#000000");
- checkGConfToShellColor("#0000ff", "#0000FF");
- checkGConfToShellColor("#b002f0", "#B002F0");
- checkGConfToShellColor("#ffffff", "#FFFFFF");
-
- checkGConfToShellColor("#000000000", "#000000");
- checkGConfToShellColor("#00f00f00f", "#000000");
- checkGConfToShellColor("#aaabbbccc", "#AABBCC");
- checkGConfToShellColor("#fffffffff", "#FFFFFF");
-
- checkGConfToShellColor("#000000000000", "#000000");
- checkGConfToShellColor("#000f000f000f", "#000000");
- checkGConfToShellColor("#00ff00ff00ff", "#000000");
- checkGConfToShellColor("#aaaabbbbcccc", "#AABBCC");
- checkGConfToShellColor("#111122223333", "#112233");
- checkGConfToShellColor("#ffffffffffff", "#FFFFFF");
-
- checkShellToGConfColor("#000000", "#000000000000");
- checkShellToGConfColor("#0000FF", "#00000000ffff");
- checkShellToGConfColor("#FFFFFF", "#ffffffffffff");
- checkShellToGConfColor("#0A0B0C", "#0a0a0b0b0c0c");
- checkShellToGConfColor("#A0B0C0", "#a0a0b0b0c0c0");
- checkShellToGConfColor("#AABBCC", "#aaaabbbbcccc");
-
- } finally {
- gGConf.setString(GCONF_BG_COLOR_KEY, origGConfColor);
- }
-}
diff --git a/browser/components/shell/test/unit/xpcshell.ini b/browser/components/shell/test/unit/xpcshell.ini
deleted file mode 100644
index 33804fd42..000000000
--- a/browser/components/shell/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-head =
-tail =
-firefox-appdir = browser
-
-[test_421977.js]
diff --git a/browser/components/test/Makefile.in b/browser/components/test/Makefile.in
deleted file mode 100644
index b2e2e479d..000000000
--- a/browser/components/test/Makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_bug538331.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/components/test/browser_bug538331.js b/browser/components/test/browser_bug538331.js
deleted file mode 100644
index d559795db..000000000
--- a/browser/components/test/browser_bug538331.js
+++ /dev/null
@@ -1,427 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-const PREF_POSTUPDATE = "app.update.postupdate";
-const PREF_MSTONE = "browser.startup.homepage_override.mstone";
-const PREF_OVERRIDE_URL = "startup.homepage_override_url";
-
-const DEFAULT_PREF_URL = "http://pref.example.com/";
-const DEFAULT_UPDATE_URL = "http://example.com/";
-
-const XML_EMPTY = "<?xml version=\"1.0\"?><updates xmlns=" +
- "\"http://www.mozilla.org/2005/app-update\"></updates>";
-
-const XML_PREFIX = "<updates xmlns=\"http://www.mozilla.org/2005/app-update\"" +
- "><update appVersion=\"1.0\" buildID=\"20080811053724\" " +
- "channel=\"nightly\" displayVersion=\"Version 1.0\" " +
- "extensionVersion=\"1.0\" installDate=\"1238441400314\" " +
- "isCompleteUpdate=\"true\" name=\"Update Test 1.0\" " +
- "serviceURL=\"https://example.com/\" showNeverForVersion=" +
- "\"false\" showPrompt=\"false\" type=" +
- "\"minor\" version=\"version 1.0\" detailsURL=" +
- "\"http://example.com/\" previousAppVersion=\"1.0\" " +
- "statusText=\"The Update was successfully installed\" " +
- "foregroundDownload=\"true\"";
-
-const XML_SUFFIX = "><patch type=\"complete\" URL=\"http://example.com/\" " +
- "hashFunction=\"MD5\" hashValue=" +
- "\"6232cd43a1c77e30191c53a329a3f99d\" size=\"775\" " +
- "selected=\"true\" state=\"succeeded\"/></update></updates>";
-
-// nsBrowserContentHandler.js defaultArgs tests
-const BCH_TESTS = [
- {
- description: "no mstone change and no update",
- noPostUpdatePref: true,
- noMstoneChange: true
- }, {
- description: "mstone changed and no update",
- noPostUpdatePref: true,
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "no mstone change and update with 'showURL' for actions",
- actions: "showURL",
- noMstoneChange: true
- }, {
- description: "update without actions",
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "update with 'showURL' for actions",
- actions: "showURL",
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "update with 'showURL' for actions and openURL",
- actions: "showURL",
- openURL: DEFAULT_UPDATE_URL
- }, {
- description: "update with 'showURL showAlert' for actions",
- actions: "showAlert showURL",
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "update with 'showAlert showURL' for actions and openURL",
- actions: "showAlert showURL",
- openURL: DEFAULT_UPDATE_URL
- }, {
- description: "update with 'showURL showNotification' for actions",
- actions: "showURL showNotification",
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "update with 'showNotification showURL' for actions and " +
- "openURL",
- actions: "showNotification showURL",
- openURL: DEFAULT_UPDATE_URL
- }, {
- description: "update with 'showAlert showURL showNotification' for actions",
- actions: "showAlert showURL showNotification",
- prefURL: DEFAULT_PREF_URL
- }, {
- description: "update with 'showNotification showURL showAlert' for " +
- "actions and openURL",
- actions: "showNotification showURL showAlert",
- openURL: DEFAULT_UPDATE_URL
- }, {
- description: "update with 'showAlert' for actions",
- actions: "showAlert"
- }, {
- description: "update with 'showAlert showNotification' for actions",
- actions: "showAlert showNotification"
- }, {
- description: "update with 'showNotification' for actions",
- actions: "showNotification"
- }, {
- description: "update with 'showNotification showAlert' for actions",
- actions: "showNotification showAlert"
- }, {
- description: "update with 'silent' for actions",
- actions: "silent"
- }, {
- description: "update with 'silent showURL showAlert showNotification' " +
- "for actions and openURL",
- actions: "silent showURL showAlert showNotification"
- }
-];
-
-var gOriginalMStone;
-var gOriginalOverrideURL;
-
-this.__defineGetter__("gBG", function() {
- delete this.gBG;
- return this.gBG = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIBrowserGlue).
- QueryInterface(Ci.nsIObserver);
-});
-
-function test()
-{
- waitForExplicitFinish();
-
- if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
- gOriginalMStone = gPrefService.getCharPref(PREF_MSTONE);
- }
-
- if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
- gOriginalOverrideURL = gPrefService.getCharPref(PREF_OVERRIDE_URL);
- }
-
- testDefaultArgs();
-}
-
-var gWindowCatcher = {
- windowsOpen: 0,
- finishCalled: false,
- start: function() {
- Services.ww.registerNotification(this);
- },
-
- finish: function(aFunc) {
- Services.ww.unregisterNotification(this);
- this.finishFunc = aFunc;
- if (this.windowsOpen > 0)
- return;
-
- this.finishFunc();
- },
-
- closeWindow: function (win) {
- info("window catcher closing window: " + win.document.documentURI);
- win.close();
- this.windowsOpen--;
- if (this.finishFunc) {
- this.finish(this.finishFunc);
- }
- },
-
- windowLoad: function (win) {
- executeSoon(this.closeWindow.bind(this, win));
- },
-
- observe: function(subject, topic, data) {
- if (topic != "domwindowopened")
- return;
-
- this.windowsOpen++;
- let win = subject.QueryInterface(Ci.nsIDOMWindow);
- info("window catcher caught window opening: " + win.document.documentURI);
- win.addEventListener("load", function () {
- win.removeEventListener("load", arguments.callee, false);
- gWindowCatcher.windowLoad(win);
- }, false);
- }
-};
-
-function finish_test()
-{
- // Reset browser.startup.homepage_override.mstone to the original value or
- // clear it if it didn't exist.
- if (gOriginalMStone) {
- gPrefService.setCharPref(PREF_MSTONE, gOriginalMStone);
- } else if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
- gPrefService.clearUserPref(PREF_MSTONE);
- }
-
- // Reset startup.homepage_override_url to the original value or clear it if
- // it didn't exist.
- if (gOriginalOverrideURL) {
- gPrefService.setCharPref(PREF_OVERRIDE_URL, gOriginalOverrideURL);
- } else if (gPrefService.prefHasUserValue(PREF_OVERRIDE_URL)) {
- gPrefService.clearUserPref(PREF_OVERRIDE_URL);
- }
-
- writeUpdatesToXMLFile(XML_EMPTY);
- reloadUpdateManagerData();
-
- finish();
-}
-
-// Test the defaultArgs returned by nsBrowserContentHandler after an update
-function testDefaultArgs()
-{
- // Clear any pre-existing override in defaultArgs that are hanging around.
- // This will also set the browser.startup.homepage_override.mstone preference
- // if it isn't already set.
- Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler).defaultArgs;
-
- let originalMstone = gPrefService.getCharPref(PREF_MSTONE);
-
- gPrefService.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
-
- writeUpdatesToXMLFile(XML_EMPTY);
- reloadUpdateManagerData();
-
- for (let i = 0; i < BCH_TESTS.length; i++) {
- let test = BCH_TESTS[i];
- ok(true, "Test nsBrowserContentHandler " + (i + 1) + ": " + test.description);
-
- if (test.actions) {
- let actionsXML = " actions=\"" + test.actions + "\"";
- if (test.openURL) {
- actionsXML += " openURL=\"" + test.openURL + "\"";
- }
- writeUpdatesToXMLFile(XML_PREFIX + actionsXML + XML_SUFFIX);
- } else {
- writeUpdatesToXMLFile(XML_EMPTY);
- }
-
- reloadUpdateManagerData();
-
- let noOverrideArgs = Cc["@mozilla.org/browser/clh;1"].
- getService(Ci.nsIBrowserHandler).defaultArgs;
-
- let overrideArgs = "";
- if (test.prefURL) {
- overrideArgs = test.prefURL;
- } else if (test.openURL) {
- overrideArgs = test.openURL;
- }
-
- if (overrideArgs == "" && noOverrideArgs) {
- overrideArgs = noOverrideArgs;
- } else if (noOverrideArgs) {
- overrideArgs += "|" + noOverrideArgs;
- }
-
- if (test.noMstoneChange === undefined) {
- gPrefService.setCharPref(PREF_MSTONE, "PreviousMilestone");
- }
-
- if (test.noPostUpdatePref == undefined) {
- gPrefService.setBoolPref(PREF_POSTUPDATE, true);
- }
-
- let defaultArgs = Cc["@mozilla.org/browser/clh;1"].
- getService(Ci.nsIBrowserHandler).defaultArgs;
- is(defaultArgs, overrideArgs, "correct value returned by defaultArgs");
-
- if (test.noMstoneChange === undefined || test.noMstoneChange != true) {
- let newMstone = gPrefService.getCharPref(PREF_MSTONE);
- is(originalMstone, newMstone, "preference " + PREF_MSTONE +
- " should have been updated");
- }
-
- if (gPrefService.prefHasUserValue(PREF_POSTUPDATE)) {
- gPrefService.clearUserPref(PREF_POSTUPDATE);
- }
- }
-
- testShowNotification();
-}
-
-// nsBrowserGlue.js _showUpdateNotification notification tests
-const BG_NOTIFY_TESTS = [
- {
- description: "'silent showNotification' actions should not display a notification",
- actions: "silent showNotification"
- }, {
- description: "'showNotification' for actions should display a notification",
- actions: "showNotification"
- }, {
- description: "no actions and empty updates.xml",
- }, {
- description: "'showAlert' for actions should not display a notification",
- actions: "showAlert"
- }, {
- // This test MUST be the last test in the array to test opening the url
- // provided by the updates.xml.
- description: "'showNotification' for actions with custom notification " +
- "attributes should display a notification",
- actions: "showNotification",
- notificationText: "notification text",
- notificationURL: DEFAULT_UPDATE_URL,
- notificationButtonLabel: "button label",
- notificationButtonAccessKey: "b"
- }
-];
-
-// Test showing a notification after an update
-// _showUpdateNotification in nsBrowserGlue.js
-function testShowNotification()
-{
- let gTestBrowser = gBrowser.selectedBrowser;
- let notifyBox = gBrowser.getNotificationBox(gTestBrowser);
-
- // Catches any windows opened by these tests (e.g. alert windows) and closes
- // them
- gWindowCatcher.start();
-
- for (let i = 0; i < BG_NOTIFY_TESTS.length; i++) {
- let test = BG_NOTIFY_TESTS[i];
- ok(true, "Test showNotification " + (i + 1) + ": " + test.description);
-
- if (test.actions) {
- let actionsXML = " actions=\"" + test.actions + "\"";
- if (test.notificationText) {
- actionsXML += " notificationText=\"" + test.notificationText + "\"";
- }
- if (test.notificationURL) {
- actionsXML += " notificationURL=\"" + test.notificationURL + "\"";
- }
- if (test.notificationButtonLabel) {
- actionsXML += " notificationButtonLabel=\"" + test.notificationButtonLabel + "\"";
- }
- if (test.notificationButtonAccessKey) {
- actionsXML += " notificationButtonAccessKey=\"" + test.notificationButtonAccessKey + "\"";
- }
- writeUpdatesToXMLFile(XML_PREFIX + actionsXML + XML_SUFFIX);
- } else {
- writeUpdatesToXMLFile(XML_EMPTY);
- }
-
- reloadUpdateManagerData();
- gPrefService.setBoolPref(PREF_POSTUPDATE, true);
-
- gBG.observe(null, "browser-glue-test", "post-update-notification");
-
- let updateBox = notifyBox.getNotificationWithValue("post-update-notification");
- if (test.actions && test.actions.indexOf("showNotification") != -1 &&
- test.actions.indexOf("silent") == -1) {
- ok(updateBox, "Update notification box should have been displayed");
- if (updateBox) {
- if (test.notificationText) {
- is(updateBox.label, test.notificationText, "Update notification box " +
- "should have the label provided by the update");
- }
- if (test.notificationButtonLabel) {
- var button = updateBox.getElementsByTagName("button").item(0);
- is(button.label, test.notificationButtonLabel, "Update notification " +
- "box button should have the label provided by the update");
- if (test.notificationButtonAccessKey) {
- let accessKey = button.getAttribute("accesskey");
- is(accessKey, test.notificationButtonAccessKey, "Update " +
- "notification box button should have the accesskey " +
- "provided by the update");
- }
- }
- // The last test opens an url and verifies the url from the updates.xml
- // is correct.
- if (i == (BG_NOTIFY_TESTS.length - 1)) {
- // Wait for any windows caught by the windowcatcher to close
- gWindowCatcher.finish(function () {
- button.click();
- gBrowser.selectedBrowser.addEventListener("load", function () {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- testNotificationURL();
- }, true);
- });
- } else {
- notifyBox.removeAllNotifications(true);
- }
- } else if (i == (BG_NOTIFY_TESTS.length - 1)) {
- // If updateBox is null the test has already reported errors so bail
- finish_test();
- }
- } else {
- ok(!updateBox, "Update notification box should not have been displayed");
- }
-
- let prefHasUserValue = gPrefService.prefHasUserValue(PREF_POSTUPDATE);
- is(prefHasUserValue, false, "preference " + PREF_POSTUPDATE +
- " shouldn't have a user value");
- }
-}
-
-// Test opening the url provided by the updates.xml in the last test
-function testNotificationURL()
-{
- ok(true, "Test testNotificationURL: clicking the notification button " +
- "opened the url specified by the update");
- let href = gBrowser.selectedBrowser.contentWindow.location.href;
- let expectedURL = BG_NOTIFY_TESTS[BG_NOTIFY_TESTS.length - 1].notificationURL;
- is(href, expectedURL, "The url opened from the notification should be the " +
- "url provided by the update");
- gBrowser.removeCurrentTab();
- window.focus();
- finish_test();
-}
-
-/* Reloads the update metadata from disk */
-function reloadUpdateManagerData()
-{
- Cc["@mozilla.org/updates/update-manager;1"].getService(Ci.nsIUpdateManager).
- QueryInterface(Ci.nsIObserver).observe(null, "um-reload-update-data", "");
-}
-
-
-function writeUpdatesToXMLFile(aText)
-{
- const PERMS_FILE = 0644;
-
- const MODE_WRONLY = 0x02;
- const MODE_CREATE = 0x08;
- const MODE_TRUNCATE = 0x20;
-
- let file = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties).
- get("UpdRootD", Ci.nsIFile);
- file.append("updates.xml");
- let fos = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- if (!file.exists()) {
- file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
- }
- fos.init(file, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
- fos.write(aText, aText.length);
- fos.close();
-}
diff --git a/browser/components/test/moz.build b/browser/components/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/components/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/commandline/moz.build b/browser/devtools/commandline/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/commandline/moz.build
+++ b/browser/devtools/commandline/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/commandline/test/Makefile.in b/browser/devtools/commandline/test/Makefile.in
deleted file mode 100644
index b4c944914..000000000
--- a/browser/devtools/commandline/test/Makefile.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_cmd_addon.js \
- $(browser_cmd_calllog.js disabled until bug 845831 is fixed) \
- $(browser_cmd_calllog_chrome.js disabled until bug 845831 is fixed) \
- browser_cmd_appcache_invalid.js \
- browser_cmd_appcache_invalid_appcache.appcache \
- browser_cmd_appcache_invalid_appcache.appcache^headers^ \
- browser_cmd_appcache_invalid_index.html \
- browser_cmd_appcache_invalid_page1.html \
- browser_cmd_appcache_invalid_page2.html \
- browser_cmd_appcache_invalid_page3.html \
- browser_cmd_appcache_invalid_page3.html^headers^ \
- browser_cmd_appcache_valid.js \
- browser_cmd_appcache_valid_appcache.appcache \
- browser_cmd_appcache_valid_appcache.appcache^headers^ \
- browser_cmd_appcache_valid_index.html \
- browser_cmd_appcache_valid_page1.html \
- browser_cmd_appcache_valid_page2.html \
- browser_cmd_appcache_valid_page3.html \
- browser_cmd_commands.js \
- browser_cmd_cookie.html \
- browser_cmd_cookie.js \
- browser_cmd_jsb.js \
- browser_cmd_jsb_script.jsi \
- browser_cmd_pagemod_export.html \
- browser_cmd_pagemod_export.js \
- browser_cmd_pref.js \
- browser_cmd_restart.js \
- browser_cmd_screenshot.html \
- browser_cmd_screenshot.js \
- browser_cmd_settings.js \
- browser_gcli_canon.js \
- browser_gcli_cli.js \
- browser_gcli_completion.js \
- browser_gcli_exec.js \
- browser_gcli_focus.js \
- browser_gcli_history.js \
- browser_gcli_incomplete.js \
- browser_gcli_inputter.js \
- browser_gcli_intro.js \
- browser_gcli_js.js \
- browser_gcli_keyboard1.js \
- browser_gcli_keyboard2.js \
- browser_gcli_keyboard3.js \
- browser_gcli_menu.js \
- browser_gcli_node.js \
- browser_gcli_remote.js \
- browser_gcli_resource.js \
- browser_gcli_scratchpad.js \
- browser_gcli_spell.js \
- browser_gcli_split.js \
- browser_gcli_tokenize.js \
- browser_gcli_tooltip.js \
- browser_gcli_types.js \
- browser_gcli_util.js \
- head.js \
- helpers.js \
- mockCommands.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/commandline/test/browser_cmd_addon.js b/browser/devtools/commandline/test/browser_cmd_addon.js
deleted file mode 100644
index 1ea8fc4d0..000000000
--- a/browser/devtools/commandline/test/browser_cmd_addon.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the addon commands works as they should
-
-let CmdAddonFlags = (Cu.import("resource:///modules/devtools/BuiltinCommands.jsm", {})).CmdAddonFlags;
-
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar("about:blank", function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
-
-tests.gatTest = function(options) {
- let deferred = Promise.defer();
-
- let onGatReady = function() {
- Services.obs.removeObserver(onGatReady, "gcli_addon_commands_ready");
- info("gcli_addon_commands_ready notification received, running tests");
-
- let auditDone = helpers.audit(options, [
- {
- setup: 'addon list dictionary',
- check: {
- input: 'addon list dictionary',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: 'There are no add-ons of that type installed.'
- }
- },
- {
- setup: 'addon list extension',
- check: {
- input: 'addon list extension',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [/The following/, /Mochitest/, /Special Powers/]
- }
- },
- {
- setup: 'addon list locale',
- check: {
- input: 'addon list locale',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: 'There are no add-ons of that type installed.'
- }
- },
- {
- setup: 'addon list plugin',
- check: {
- input: 'addon list plugin',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [/Test Plug-in/, /Second Test Plug-in/]
- }
- },
- {
- setup: 'addon list theme',
- check: {
- input: 'addon list theme',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [/following themes/, /Default/]
- }
- },
- {
- setup: 'addon list all',
- check: {
- input: 'addon list all',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [/The following/, /Default/, /Mochitest/, /Test Plug-in/,
- /Second Test Plug-in/, /Special Powers/]
- }
- },
- {
- setup: 'addon disable Test_Plug-in_1.0.0.0',
- check: {
- input: 'addon disable Test_Plug-in_1.0.0.0',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: 'Test Plug-in 1.0.0.0 disabled.'
- }
- },
- {
- setup: 'addon disable WRONG',
- check: {
- input: 'addon disable WRONG',
- hints: '',
- markup: 'VVVVVVVVVVVVVVEEEEE',
- status: 'ERROR'
- }
- },
- {
- setup: 'addon enable Test_Plug-in_1.0.0.0',
- check: {
- input: 'addon enable Test_Plug-in_1.0.0.0',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- command: { name: 'addon enable' },
- name: { value: 'Test Plug-in', status: 'VALID' },
- }
- },
- exec: {
- output: 'Test Plug-in 1.0.0.0 enabled.'
- }
- }
- ]);
-
- auditDone.then(function() {
- deferred.resolve();
- });
- };
-
- Services.obs.addObserver(onGatReady, "gcli_addon_commands_ready", false);
-
- if (CmdAddonFlags.addonsLoaded) {
- info("The call to AddonManager.getAllAddons in BuiltinCommands.jsm is done.");
- info("Send the gcli_addon_commands_ready notification ourselves.");
-
- Services.obs.notifyObservers(null, "gcli_addon_commands_ready", null);
- } else {
- info("Waiting for gcli_addon_commands_ready notification.");
- }
-
- return deferred.promise;
-};
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js b/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js
deleted file mode 100644
index 28f8ce80d..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the appcache validate works as they should with an invalid
-// manifest.
-
-const TEST_URI = "http://sub1.test1.example.com/browser/browser/devtools/commandline/" +
- "test/browser_cmd_appcache_invalid_index.html";
-
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- let deferred = Promise.defer();
-
- // Wait for site to be cached.
- gBrowser.contentWindow.applicationCache.addEventListener('error', function BCAI_error() {
- gBrowser.contentWindow.applicationCache.removeEventListener('error', BCAI_error);
-
- info("Site now cached, running tests.");
-
- deferred.resolve(helpers.audit(options, [
- {
- setup: 'appcache validate',
- check: {
- input: 'appcache validate',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {}
- },
- exec: {
- completed: false,
- output: [
- /Manifest has a character encoding of ISO-8859-1\. Manifests must have the utf-8 character encoding\./,
- /The first line of the manifest must be "CACHE MANIFEST" at line 1\./,
- /"CACHE MANIFEST" is only valid on the first line but was found at line 3\./,
- /images\/sound-icon\.png points to a resource that is not available at line 9\./,
- /images\/background\.png points to a resource that is not available at line 10\./,
- /NETWORK section line 13 \(\/checking\.cgi\) prevents caching of line 13 \(\/checking\.cgi\) in the NETWORK section\./,
- /\/checking\.cgi points to a resource that is not available at line 13\./,
- /Asterisk \(\*\) incorrectly used in the NETWORK section at line 14\. If a line in the NETWORK section contains only a single asterisk character, then any URI not listed in the manifest will be treated as if the URI was listed in the NETWORK section\. Otherwise such URIs will be treated as unavailable\. Other uses of the \* character are prohibited/,
- /\.\.\/rel\.html points to a resource that is not available at line 17\./,
- /\.\.\/\.\.\/rel\.html points to a resource that is not available at line 18\./,
- /\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 19\./,
- /\.\.\/\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 20\./,
- /\.\.\/\.\.\/\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 21\./,
- /\/\.\.\/ is not a valid URI prefix at line 22\./,
- /\/test\.css points to a resource that is not available at line 23\./,
- /\/test\.js points to a resource that is not available at line 24\./,
- /test\.png points to a resource that is not available at line 25\./,
- /\/main\/features\.js points to a resource that is not available at line 27\./,
- /\/main\/settings\/index\.css points to a resource that is not available at line 28\./,
- /http:\/\/example\.com\/scene\.jpg points to a resource that is not available at line 29\./,
- /\/section1\/blockedbyfallback\.html points to a resource that is not available at line 30\./,
- /http:\/\/example\.com\/images\/world\.jpg points to a resource that is not available at line 31\./,
- /\/section2\/blockedbyfallback\.html points to a resource that is not available at line 32\./,
- /\/main\/home points to a resource that is not available at line 34\./,
- /main\/app\.js points to a resource that is not available at line 35\./,
- /\/settings\/home points to a resource that is not available at line 37\./,
- /\/settings\/app\.js points to a resource that is not available at line 38\./,
- /The file http:\/\/sub1\.test1\.example\.com\/browser\/browser\/devtools\/commandline\/test\/browser_cmd_appcache_invalid_page3\.html was modified after http:\/\/sub1\.test1\.example\.com\/browser\/browser\/devtools\/commandline\/test\/browser_cmd_appcache_invalid_appcache\.appcache\. Unless the text in the manifest file is changed the cached version will be used instead at line 39\./,
- /browser_cmd_appcache_invalid_page3\.html has cache-control set to no-store\. This will prevent the application cache from storing the file at line 39\./,
- /http:\/\/example\.com\/logo\.png points to a resource that is not available at line 40\./,
- /http:\/\/example\.com\/check\.png points to a resource that is not available at line 41\./,
- /Spaces in URIs need to be replaced with % at line 42\./,
- /http:\/\/example\.com\/cr oss\.png points to a resource that is not available at line 42\./,
- /Asterisk \(\*\) incorrectly used in the CACHE section at line 43\. If a line in the NETWORK section contains only a single asterisk character, then any URI not listed in the manifest will be treated as if the URI was listed in the NETWORK section\. Otherwise such URIs will be treated as unavailable\. Other uses of the \* character are prohibited/,
- /The SETTINGS section may only contain a single value, "prefer-online" or "fast" at line 47\./,
- /FALLBACK section line 50 \(\/section1\/ \/offline1\.html\) prevents caching of line 30 \(\/section1\/blockedbyfallback\.html\) in the CACHE section\./,
- /\/offline1\.html points to a resource that is not available at line 50\./,
- /FALLBACK section line 51 \(\/section2\/ offline2\.html\) prevents caching of line 32 \(\/section2\/blockedbyfallback\.html\) in the CACHE section\./,
- /offline2\.html points to a resource that is not available at line 51\./,
- /Only two URIs separated by spaces are allowed in the FALLBACK section at line 52\./,
- /Asterisk \(\*\) incorrectly used in the FALLBACK section at line 53\. URIs in the FALLBACK section simply need to match a prefix of the request URI\./,
- /offline3\.html points to a resource that is not available at line 53\./,
- /Invalid section name \(BLAH\) at line 55\./,
- /Only two URIs separated by spaces are allowed in the FALLBACK section at line 55\./
- ]
- },
- },
- ]));
- });
-
- acceptOfflineCachePrompt();
-
- return deferred.promise;
- }).then(finish);
-
- function acceptOfflineCachePrompt() {
- // Pages containing an appcache the notification bar gives options to allow
- // or deny permission for the app to save data offline. Let's click Allow.
- let notificationID = "offline-app-requested-sub1.test1.example.com";
- let notification = PopupNotifications.getNotification(notificationID, gBrowser.selectedBrowser);
-
- if (notification) {
- info("Authorizing offline storage.");
- notification.mainAction.callback();
- } else {
- info("No notification box is available.");
- }
- }
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache
deleted file mode 100644
index 75b5d7bad..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache
+++ /dev/null
@@ -1,55 +0,0 @@
-# some comment
-
-CACHE MANIFEST
-# the above is a required line
-# this is a comment
-# spaces are ignored
-# blank lines are ignored
-
-images/sound-icon.png
-images/background.png
-
-NETWORK:
-/checking.cgi
-/checking.*
-
-CACHE:
-../rel.html
-../../rel.html
-../../../rel.html
-../../../../rel.html
-../../../../../rel.html
-/../invalid.html
-/test.css
-/test.js
-test.png
-browser_cmd_appcache_invalid_index.html
-/main/features.js
-/main/settings/index.css
-http://example.com/scene.jpg
-/section1/blockedbyfallback.html
-http://example.com/images/world.jpg
-/section2/blockedbyfallback.html
-browser_cmd_appcache_invalid_page1.html
-/main/home
-main/app.js
-browser_cmd_appcache_invalid_page2.html
-/settings/home
-/settings/app.js
-browser_cmd_appcache_invalid_page3.html
-http://example.com/logo.png
-http://example.com/check.png
-http://example.com/cr oss.png
-/checking*.png
-
-SETTINGS:
-prefer-online
-fast
-
-FALLBACK:
-/section1/ /offline1.html
-/section2/ offline2.html
-dadsdsd
-* offline3.html
-
-BLAH:
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache^headers^ b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache^headers^
deleted file mode 100644
index af95ed1f5..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_appcache.appcache^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Type: text/cache-manifest; charset=ISO-8859-1
-Last-Modified: Tue, 23 Apr 9998 11:41:13 GMT
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_index.html b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_index.html
deleted file mode 100644
index 67f9aa675..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page1.html b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page1.html
deleted file mode 100644
index 5ff36f102..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page1.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page1.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page2.html b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page2.html
deleted file mode 100644
index 7d4a0c44d..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page2.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page2.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html
deleted file mode 100644
index 6777e59f8..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_invalid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page3.html</h1>
- <br />
- <a href="browser_cmd_appcache_invalid_index.html">Home</a> |
- <a href="browser_cmd_appcache_invalid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_invalid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_invalid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html^headers^ b/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html^headers^
deleted file mode 100644
index 177130b43..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_invalid_page3.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Cache-Control: no-store, no-cache
-Last-Modified: Tue, 23 Apr 9999 11:41:13 GMT
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid.js b/browser/devtools/commandline/test/browser_cmd_appcache_valid.js
deleted file mode 100644
index d52b5a3c9..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the appcache commands works as they should
-
-const TEST_URI = "http://sub1.test2.example.com/browser/browser/devtools/" +
- "commandline/test/browser_cmd_appcache_valid_index.html";
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- let deferred = Promise.defer();
-
- info("adding cache listener.");
-
- // Wait for site to be cached.
- gBrowser.contentWindow.applicationCache.addEventListener('cached', function BCAV_cached() {
- gBrowser.contentWindow.applicationCache.removeEventListener('cached', BCAV_cached);
-
- info("Site now cached, running tests.");
-
- deferred.resolve(helpers.audit(options, [
- {
- setup: 'appcache',
- check: {
- input: 'appcache',
- markup: 'IIIIIIII',
- status: 'ERROR',
- args: {}
- },
- },
-
- {
- setup: function() {
- Services.prefs.setBoolPref("browser.cache.disk.enable", false);
- helpers.setInput(options, 'appcache list', 13);
- },
- check: {
- input: 'appcache list',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID',
- args: {},
- },
- exec: {
- output: [ /cache is disabled/ ]
- },
- post: function(output) {
- Services.prefs.setBoolPref("browser.cache.disk.enable", true);
- }
- },
-
- {
- setup: 'appcache list',
- check: {
- input: 'appcache list',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID',
- args: {},
- },
- exec: {
- output: [ /index/, /page1/, /page2/, /page3/ ]
- },
- },
-
- {
- setup: 'appcache list page',
- check: {
- input: 'appcache list page',
- markup: 'VVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- search: { value: 'page' },
- }
- },
- exec: {
- output: [ /page1/, /page2/, /page3/ ]
- },
- post: function(output, text) {
- ok(!text.contains("index"), "index is not contained in output");
- }
- },
-
- {
- setup: 'appcache validate',
- check: {
- input: 'appcache validate',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {}
- },
- exec: {
- completed: false,
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: 'appcache validate ' + TEST_URI,
- check: {
- input: 'appcache validate ' + TEST_URI,
- // appcache validate http://sub1.test2.example.com/browser/browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- uri: {
- value: TEST_URI
- },
- }
- },
- exec: {
- completed: false,
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: 'appcache clear',
- check: {
- input: 'appcache clear',
- markup: 'VVVVVVVVVVVVVV',
- status: 'VALID',
- args: {},
- },
- exec: {
- output: [ /successfully/ ]
- },
- },
-
- {
- setup: 'appcache list',
- check: {
- input: 'appcache list',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID',
- args: {},
- },
- exec: {
- output: [ /no results/ ]
- },
- post: function(output, text) {
- ok(!text.contains("index"), "index is not contained in output");
- ok(!text.contains("page1"), "page1 is not contained in output");
- ok(!text.contains("page2"), "page1 is not contained in output");
- ok(!text.contains("page3"), "page1 is not contained in output");
- }
- },
-
- {
- setup: 'appcache viewentry --key ' + TEST_URI,
- check: {
- input: 'appcache viewentry --key ' + TEST_URI,
- // appcache viewentry --key http://sub1.test2.example.com/browser/browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {}
- },
- },
- ]));
- });
-
- acceptOfflineCachePrompt();
-
- return deferred.promise;
- }).then(finish);
-
- function acceptOfflineCachePrompt() {
- // Pages containing an appcache the notification bar gives options to allow
- // or deny permission for the app to save data offline. Let's click Allow.
- let notificationID = "offline-app-requested-sub1.test2.example.com";
- let notification = PopupNotifications.getNotification(notificationID, gBrowser.selectedBrowser);
-
- if (notification) {
- info("Authorizing offline storage.");
- notification.mainAction.callback();
- } else {
- info("No notification box is available.");
- }
- }
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache b/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache
deleted file mode 100644
index 4f62825e9..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache
+++ /dev/null
@@ -1,5 +0,0 @@
-CACHE MANIFEST
-browser_cmd_appcache_valid_index.html
-browser_cmd_appcache_valid_page1.html
-browser_cmd_appcache_valid_page2.html
-browser_cmd_appcache_valid_page3.html
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache^headers^ b/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache^headers^
deleted file mode 100644
index d1a0abd3f..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_appcache.appcache^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-Content-Type: text/cache-manifest
-Last-Modified: Tue, 23 Apr 9998 11:41:13 GMT
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html b/browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html
deleted file mode 100644
index 1ab3f3e31..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_index.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example index.html</h1>
- <a href="browser_cmd_appcache_valid_index.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page1.html b/browser/devtools/commandline/test/browser_cmd_appcache_valid_page1.html
deleted file mode 100644
index e0bb429e7..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page1.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page1.html</h1>
- <a href="browser_cmd_appcache_valid_index.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page2.html b/browser/devtools/commandline/test/browser_cmd_appcache_valid_page2.html
deleted file mode 100644
index 1ce36b319..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page2.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page2.html</h1>
- <a href="browser_cmd_appcache_valid_index.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page3.html b/browser/devtools/commandline/test/browser_cmd_appcache_valid_page3.html
deleted file mode 100644
index 074ff7d41..000000000
--- a/browser/devtools/commandline/test/browser_cmd_appcache_valid_page3.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html manifest="browser_cmd_appcache_valid_appcache.appcache">
- <head>
- <meta charset="UTF-8">
- <head>
- <body>
- <h1>Example page3.html</h1>
- <a href="browser_cmd_appcache_valid_index.html">Home</a> |
- <a href="browser_cmd_appcache_valid_page1.html">Page 1</a> |
- <a href="browser_cmd_appcache_valid_page2.html">Page 2</a> |
- <a href="browser_cmd_appcache_valid_page3.html">Page 3</a>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_calllog.js b/browser/devtools/commandline/test/browser_cmd_calllog.js
deleted file mode 100644
index baf32c629..000000000
--- a/browser/devtools/commandline/test/browser_cmd_calllog.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the calllog commands works as they should
-
-let HUDService = (Cu.import("resource:///modules/HUDService.jsm", {})).HUDService;
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-calllog";
-
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
-
-tests.testCallLogStatus = function(options) {
- return helpers.audit(options, [
- {
- setup: "calllog",
- check: {
- input: 'calllog',
- hints: '',
- markup: 'IIIIIII',
- status: 'ERROR'
- }
- },
- {
- setup: "calllog start",
- check: {
- input: 'calllog start',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID'
- }
- },
- {
- setup: "calllog stop",
- check: {
- input: 'calllog stop',
- hints: '',
- markup: 'VVVVVVVVVVVV',
- status: 'VALID'
- }
- },
- ]);
-};
-
-tests.testCallLogExec = function(options) {
- var deferred = Promise.defer();
-
- var onWebConsoleOpen = function(subject) {
- Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
-
- subject.QueryInterface(Ci.nsISupportsString);
- let hud = HUDService.getHudReferenceById(subject.data);
- ok(hud.hudId in HUDService.hudReferences, "console open");
-
- helpers.audit(options, [
- {
- setup: "calllog stop",
- exec: {
- output: /Stopped call logging/,
- }
- },
- {
- setup: "console clear",
- exec: {
- output: "",
- },
- post: function() {
- let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
- is(labels.length, 0, "no output in console");
- }
- },
- {
- setup: "console close",
- exec: {
- output: "",
- }
- },
- ]).then(function() {
- deferred.resolve();
- });
- };
- Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
-
- helpers.audit(options, [
- {
- setup: "calllog stop",
- exec: {
- output: /No call logging/,
- }
- },
- {
- name: "calllog start",
- setup: function() {
- // This test wants to be in a different event
- var deferred = Promise.defer();
- executeSoon(function() {
- helpers.setInput(options, "calllog start");
- deferred.resolve();
- });
- return deferred.promise;
- },
- exec: {
- output: /Call logging started/,
- },
- },
- ]);
-
- return deferred.promise;
-};
diff --git a/browser/devtools/commandline/test/browser_cmd_calllog_chrome.js b/browser/devtools/commandline/test/browser_cmd_calllog_chrome.js
deleted file mode 100644
index 66569b38c..000000000
--- a/browser/devtools/commandline/test/browser_cmd_calllog_chrome.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the calllog commands works as they should
-
-let HUDService = (Cu.import("resource:///modules/HUDService.jsm", {})).HUDService;
-
-const TEST_URI = "data:text/html;charset=utf-8,cmd-calllog-chrome";
-
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
-
-tests.testCallLogStatus = function(options) {
- return helpers.audit(options, [
- {
- setup: "calllog",
- check: {
- status: "ERROR",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestop",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestart content-variable window",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- {
- setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
- check: {
- status: "VALID",
- emptyParameters: [ " " ]
- }
- },
- ]);
-};
-
-tests.testCallLogExec = function(options) {
- let deferred = Promise.defer();
-
- function onWebConsoleOpen(subject) {
- Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
-
- subject.QueryInterface(Ci.nsISupportsString);
- let hud = HUDService.getHudReferenceById(subject.data);
- ok(hud.hudId in HUDService.hudReferences, "console open");
-
- helpers.audit(options, [
- {
- setup: "calllog chromestop",
- exec: {
- output: /Stopped call logging/,
- }
- },
- {
- setup: "calllog chromestart javascript XXX",
- exec: {
- output: /following exception/,
- }
- },
- {
- setup: "console clear",
- exec: {
- output: '',
- },
- post: function() {
- let labels = hud.jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
- is(labels.length, 0, "no output in console");
- }
- },
- {
- setup: "console close",
- exec: {
- output: '',
- completed: false,
- },
- },
- ]).then(function() {
- deferred.resolve();
- });
- }
- Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
-
- helpers.audit(options, [
- {
- setup: "calllog chromestop",
- exec: {
- output: /No call logging/
- }
- },
- {
- setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
- exec: {
- output: /Call logging started/,
- }
- },
- ]);
-
- return deferred.promise;
-};
diff --git a/browser/devtools/commandline/test/browser_cmd_commands.js b/browser/devtools/commandline/test/browser_cmd_commands.js
deleted file mode 100644
index 4b8bc8203..000000000
--- a/browser/devtools/commandline/test/browser_cmd_commands.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test various GCLI commands
-
-let HUDService = (Cu.import("resource:///modules/HUDService.jsm", {})).HUDService;
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
-
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
-
-tests.testConsole = function(options) {
- let deferred = Promise.defer();
- let hud = null;
-
- let onWebConsoleOpen = function(subject) {
- Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
-
- subject.QueryInterface(Ci.nsISupportsString);
- hud = HUDService.getHudReferenceById(subject.data);
- ok(hud.hudId in HUDService.hudReferences, "console open");
-
- hud.jsterm.execute("pprint(window)", onExecute);
- }
- Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
-
- let onExecute = function() {
- let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
- ok(labels.length > 0, "output for pprint(window)");
-
- helpers.audit(options, [
- {
- setup: "console clear",
- exec: {
- output: ""
- },
- post: function() {
- let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output");
- // Bug 845827 - The GCLI "console clear" command doesn't always work
- // is(labels.length, 0, "no output in console");
- }
- },
- {
- setup: "console close",
- exec: {
- output: ""
- },
- post: function() {
- ok(!(hud.hudId in HUDService.hudReferences), "console closed");
- }
- }
- ]).then(function() {
- deferred.resolve();
- });
- };
-
- helpers.audit(options, [
- {
- setup: "console open",
- exec: { }
- }
- ]);
-
- return deferred.promise;
-};
diff --git a/browser/devtools/commandline/test/browser_cmd_cookie.html b/browser/devtools/commandline/test/browser_cmd_cookie.html
deleted file mode 100644
index e9b385a35..000000000
--- a/browser/devtools/commandline/test/browser_cmd_cookie.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>GCLI cookie command test</title>
-</head>
-<body>
-
- <p>Cookie test</p>
- <p id=result></p>
- <script type="text/javascript">
- document.cookie = "zap=zep";
- document.cookie = "zip=zop";
- document.getElementById("result").innerHTML = document.cookie;
- </script>
-
-</body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_cookie.js b/browser/devtools/commandline/test/browser_cmd_cookie.js
deleted file mode 100644
index 520cbf064..000000000
--- a/browser/devtools/commandline/test/browser_cmd_cookie.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-* http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the cookie commands works as they should
-
-const TEST_URI = "http://example.com/browser/browser/devtools/commandline/"+
- "test/browser_cmd_cookie.html";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.audit(options, [
- {
- setup: 'cookie',
- check: {
- input: 'cookie',
- hints: '',
- markup: 'IIIIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'cookie lis',
- check: {
- input: 'cookie lis',
- hints: 't',
- markup: 'IIIIIIVIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'cookie list',
- check: {
- input: 'cookie list',
- hints: '',
- markup: 'VVVVVVVVVVV',
- status: 'VALID'
- },
- },
- {
- setup: 'cookie remove',
- check: {
- input: 'cookie remove',
- hints: ' <name>',
- markup: 'VVVVVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- setup: 'cookie set',
- check: {
- input: 'cookie set',
- hints: ' <name> <value> [options]',
- markup: 'VVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- setup: 'cookie set fruit',
- check: {
- input: 'cookie set fruit',
- hints: ' <value> [options]',
- markup: 'VVVVVVVVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- setup: 'cookie set fruit ban',
- check: {
- input: 'cookie set fruit ban',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- name: { value: 'fruit' },
- value: { value: 'ban' },
- secure: { value: false },
- }
- },
- },
- {
- setup: 'cookie set fruit ban --path ""',
- check: {
- input: 'cookie set fruit ban --path ""',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- name: { value: 'fruit' },
- value: { value: 'ban' },
- path: { value: '' },
- secure: { value: false },
- }
- },
- },
- {
- setup: "cookie list",
- exec: {
- output: [ /zap=zep/, /zip=zop/, /Edit/ ]
- }
- },
- {
- setup: "cookie set zup banana",
- check: {
- args: {
- name: { value: 'zup' },
- value: { value: 'banana' },
- }
- },
- exec: {
- output: ""
- }
- },
- {
- setup: "cookie list",
- exec: {
- output: [ /zap=zep/, /zip=zop/, /zup=banana/, /Edit/ ]
- }
- },
- {
- setup: "cookie remove zip",
- exec: { },
- },
- {
- setup: "cookie list",
- exec: {
- output: [ /zap=zep/, /zup=banana/, /Edit/ ]
- },
- post: function(output, text) {
- ok(!text.contains("zip"), "");
- ok(!text.contains("zop"), "");
- }
- },
- {
- setup: "cookie remove zap",
- exec: { },
- },
- {
- setup: "cookie list",
- exec: {
- output: [ /zup=banana/, /Edit/ ]
- },
- post: function(output, text) {
- ok(!text.contains("zap"), "");
- ok(!text.contains("zep"), "");
- ok(!text.contains("zip"), "");
- ok(!text.contains("zop"), "");
- }
- },
- {
- setup: "cookie remove zup",
- exec: { }
- },
- {
- setup: "cookie list",
- exec: {
- output: 'No cookies found for host example.com'
- },
- post: function(output, text) {
- ok(!text.contains("zap"), "");
- ok(!text.contains("zep"), "");
- ok(!text.contains("zip"), "");
- ok(!text.contains("zop"), "");
- ok(!text.contains("zup"), "");
- ok(!text.contains("banana"), "");
- ok(!text.contains("Edit"), "");
- }
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_jsb.js b/browser/devtools/commandline/test/browser_cmd_jsb.js
deleted file mode 100644
index 4ec09906a..000000000
--- a/browser/devtools/commandline/test/browser_cmd_jsb.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the jsb command works as it should
-
-const TEST_URI = "http://example.com/browser/browser/devtools/commandline/" +
- "test/browser_cmd_jsb_script.jsi";
-
-let scratchpadWin = null;
-let scratchpad = null;
-let tests = {};
-
-function test() {
- helpers.addTabWithToolbar("about:blank", function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
-
-tests.jsbTest = function(options) {
- let deferred = Promise.defer();
-
- let observer = {
- onReady: function() {
- scratchpad.removeObserver(observer);
-
- let result = scratchpad.getText();
- result = result.replace(/[\r\n]]*/g, "\n");
- let correct = "function somefunc() {\n" +
- " if (true) // Some comment\n" +
- " doSomething();\n" +
- " for (let n = 0; n < 500; n++) {\n" +
- " if (n % 2 == 1) {\n" +
- " console.log(n);\n" +
- " console.log(n + 1);\n" +
- " }\n" +
- " }\n" +
- "}";
- is(result, correct, "JS has been correctly prettified");
-
- if (scratchpadWin) {
- scratchpadWin.close();
- scratchpadWin = null;
- }
- deferred.resolve();
- },
- };
-
- let onLoad = function GDT_onLoad() {
- scratchpadWin.removeEventListener("load", onLoad, false);
- scratchpad = scratchpadWin.Scratchpad;
-
- scratchpad.addObserver(observer);
- };
-
- let onNotify = function(subject, topic, data) {
- if (topic == "domwindowopened") {
- Services.ww.unregisterNotification(onNotify);
-
- scratchpadWin = subject.QueryInterface(Ci.nsIDOMWindow);
- scratchpadWin.addEventListener("load", onLoad, false);
- }
- };
-
- Services.ww.registerNotification(onNotify);
-
- helpers.audit(options, [
- {
- setup: 'jsb',
- check: {
- input: 'jsb',
- hints: ' <url> [options]',
- markup: 'VVV',
- status: 'ERROR'
- }
- },
- {
- setup: 'jsb ' + TEST_URI,
- // Should result in a new window, which should fire onReady (eventually)
- exec: {
- completed: false
- }
- }
- ]);
-
- return deferred.promise;
-};
diff --git a/browser/devtools/commandline/test/browser_cmd_jsb_script.jsi b/browser/devtools/commandline/test/browser_cmd_jsb_script.jsi
deleted file mode 100644
index dcaac807c..000000000
--- a/browser/devtools/commandline/test/browser_cmd_jsb_script.jsi
+++ /dev/null
@@ -1,2 +0,0 @@
-function somefunc(){if (true) // Some comment
-doSomething();for(let n=0;n<500;n++){if(n%2==1){console.log(n);console.log(n+1);}}}
diff --git a/browser/devtools/commandline/test/browser_cmd_pagemod_export.html b/browser/devtools/commandline/test/browser_cmd_pagemod_export.html
deleted file mode 100644
index a7d28828c..000000000
--- a/browser/devtools/commandline/test/browser_cmd_pagemod_export.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>GCLI inspect command test</title>
-</head>
-<body>
-
- <!-- This is a list of 0 h1 elements -->
-
- <!-- This is a list of 1 div elements -->
- <div>Hello, I'm a div</div>
-
- <!-- This is a list of 2 span elements -->
- <span>Hello, I'm a span</span>
- <span>And me</span>
-
- <!-- This is a collection of various things that match only once -->
- <p class="someclass">.someclass</p>
- <p id="someid">#someid</p>
- <button disabled>button[disabled]</button>
- <p><strong>p&gt;strong</strong></p>
-
-</body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_pagemod_export.js b/browser/devtools/commandline/test/browser_cmd_pagemod_export.js
deleted file mode 100644
index 374479abd..000000000
--- a/browser/devtools/commandline/test/browser_cmd_pagemod_export.js
+++ /dev/null
@@ -1,376 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the inspect command works as it should
-
-const TEST_URI = "http://example.com/browser/browser/devtools/commandline/"+
- "test/browser_cmd_pagemod_export.html";
-
-function test() {
- let initialHtml = "";
-
- var tests = {};
-
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- initialHtml = content.document.documentElement.innerHTML;
-
- return helpers.runTests(options, tests);
- }).then(finish);
-
- function getContent(options) {
- return options.document.documentElement.innerHTML;
- }
-
- function resetContent(options) {
- options.document.documentElement.innerHTML = initialHtml;
- }
-
- tests.testExportHtml = function(options) {
- let oldOpen = options.window.open;
- let openURL = "";
- options.window.open = function(url) {
- // The URL is a data: URL that contains the document source
- openURL = decodeURIComponent(url);
- };
-
- return helpers.audit(options, [
- {
- setup: 'export html',
- check: {
- input: 'export html',
- hints: '',
- markup: 'VVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ''
- },
- post: function() {
- isnot(openURL.indexOf('<html lang="en">'), -1, "export html works: <html>");
- isnot(openURL.indexOf("<title>GCLI"), -1, "export html works: <title>");
- isnot(openURL.indexOf('<p id="someid">#'), -1, "export html works: <p>");
-
- options.window.open = oldOpen;
- }
- }
- ]);
- };
-
- tests.testPageModReplace = function(options) {
- return helpers.audit(options, [
- {
- setup: 'pagemod replace',
- check: {
- input: 'pagemod replace',
- hints: ' <search> <replace> [ignoreCase] [selector] [root] [attrOnly] [contentOnly] [attributes]',
- markup: 'VVVVVVVVVVVVVVV',
- status: 'ERROR'
- }
- },
- {
- setup: 'pagemod replace some foo',
- check: {
- input: 'pagemod replace some foo',
- hints: ' [ignoreCase] [selector] [root] [attrOnly] [contentOnly] [attributes]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- }
- },
- {
- setup: 'pagemod replace some foo true',
- check: {
- input: 'pagemod replace some foo true',
- hints: ' [selector] [root] [attrOnly] [contentOnly] [attributes]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- }
- },
- {
- setup: 'pagemod replace some foo true --attrOnly',
- check: {
- input: 'pagemod replace some foo true --attrOnly',
- hints: ' [selector] [root] [contentOnly] [attributes]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- }
- },
- {
- setup: 'pagemod replace sOme foOBar',
- exec: {
- output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "no change in the page");
- }
- },
- {
- setup: 'pagemod replace sOme foOBar true',
- exec: {
- output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 2\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- isnot(html.indexOf('<p class="foOBarclass">.foOBarclass'), -1,
- ".someclass changed to .foOBarclass");
- isnot(html.indexOf('<p id="foOBarid">#foOBarid'), -1,
- "#someid changed to #foOBarid");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod replace some foobar --contentOnly',
- exec: {
- output: /^[^:]+: 13\. [^:]+: 2\. [^:]+: 0\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- isnot(html.indexOf('<p class="someclass">.foobarclass'), -1,
- ".someclass changed to .foobarclass (content only)");
- isnot(html.indexOf('<p id="someid">#foobarid'), -1,
- "#someid changed to #foobarid (content only)");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod replace some foobar --attrOnly',
- exec: {
- output: /^[^:]+: 13\. [^:]+: 0\. [^:]+: 2\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- isnot(html.indexOf('<p class="foobarclass">.someclass'), -1,
- ".someclass changed to .foobarclass (attr only)");
- isnot(html.indexOf('<p id="foobarid">#someid'), -1,
- "#someid changed to #foobarid (attr only)");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod replace some foobar --root head',
- exec: {
- output: /^[^:]+: 2\. [^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed");
- }
- },
- {
- setup: 'pagemod replace some foobar --selector .someclass,div,span',
- exec: {
- output: /^[^:]+: 4\. [^:]+: 1\. [^:]+: 1\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- isnot(html.indexOf('<p class="foobarclass">.foobarclass'), -1,
- ".someclass changed to .foobarclass");
- isnot(html.indexOf('<p id="someid">#someid'), -1,
- "#someid did not change");
-
- resetContent(options);
- }
- },
- ]);
- };
-
- tests.testPageModRemoveElement = function(options) {
- return helpers.audit(options, [
- {
- setup: 'pagemod remove',
- check: {
- input: 'pagemod remove',
- hints: '',
- markup: 'IIIIIIIVIIIIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'pagemod remove element',
- check: {
- input: 'pagemod remove element',
- hints: ' <search> [root] [stripOnly] [ifEmptyOnly]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- setup: 'pagemod remove element foo',
- check: {
- input: 'pagemod remove element foo',
- hints: ' [root] [stripOnly] [ifEmptyOnly]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- },
- {
- setup: 'pagemod remove element p',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
- is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
- is(html.indexOf("<p><strong>"), -1, "<p> wrapping <strong> removed");
- isnot(html.indexOf("<span>"), -1, "<span> not removed");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod remove element p head',
- exec: {
- output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed in the page");
- }
- },
- {
- setup: 'pagemod remove element p --ifEmptyOnly',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed in the page");
- }
- },
- {
- setup: 'pagemod remove element meta,title --ifEmptyOnly',
- exec: {
- output: /^[^:]+: 2\. [^:]+: 1\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- is(html.indexOf("<meta charset="), -1, "<meta> removed");
- isnot(html.indexOf("<title>"), -1, "<title> not removed");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod remove element p --stripOnly',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 3\.\s*$/
- },
- post: function() {
- let html = getContent(options);
-
- is(html.indexOf('<p class="someclass">'), -1, "p.someclass removed");
- is(html.indexOf('<p id="someid">'), -1, "p#someid removed");
- is(html.indexOf("<p><strong>"), -1, "<p> wrapping <strong> removed");
- isnot(html.indexOf(".someclass"), -1, ".someclass still exists");
- isnot(html.indexOf("#someid"), -1, "#someid still exists");
- isnot(html.indexOf("<strong>p"), -1, "<strong> still exists");
-
- resetContent(options);
- }
- },
- ]);
- };
-
- tests.testPageModRemoveAttribute = function(options) {
- return helpers.audit(options, [
- {
- setup: 'pagemod remove attribute',
- check: {
- input: 'pagemod remove attribute',
- hints: ' <searchAttributes> <searchElements> [root] [ignoreCase]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'ERROR',
- args: {
- searchAttributes: { value: undefined, status: 'INCOMPLETE' },
- searchElements: { value: undefined, status: 'INCOMPLETE' },
- root: { value: undefined },
- ignoreCase: { value: false },
- }
- },
- },
- {
- setup: 'pagemod remove attribute foo bar',
- check: {
- input: 'pagemod remove attribute foo bar',
- hints: ' [root] [ignoreCase]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- searchAttributes: { value: 'foo' },
- searchElements: { value: 'bar' },
- root: { value: undefined },
- ignoreCase: { value: false },
- }
- },
- post: function() {
- let deferred = Promise.defer();
- executeSoon(function() {
- deferred.resolve();
- });
- return deferred.promise;
- }
- },
- {
- setup: 'pagemod remove attribute foo bar',
- exec: {
- output: /^[^:]+: 0\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed in the page");
- }
- },
- {
- setup: 'pagemod remove attribute foo p',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed in the page");
- }
- },
- {
- setup: 'pagemod remove attribute id p,span',
- exec: {
- output: /^[^:]+: 5\. [^:]+: 1\.\s*$/
- },
- post: function() {
- is(getContent(options).indexOf('<p id="someid">#someid'), -1,
- "p#someid attribute removed");
- isnot(getContent(options).indexOf("<p>#someid"), -1,
- "p with someid content still exists");
-
- resetContent(options);
- }
- },
- {
- setup: 'pagemod remove attribute Class p',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 0\.\s*$/
- },
- post: function() {
- is(getContent(options), initialHtml, "nothing changed in the page");
- }
- },
- {
- setup: 'pagemod remove attribute Class p --ignoreCase',
- exec: {
- output: /^[^:]+: 3\. [^:]+: 1\.\s*$/
- },
- post: function() {
- is(getContent(options).indexOf('<p class="someclass">.someclass'), -1,
- "p.someclass attribute removed");
- isnot(getContent(options).indexOf("<p>.someclass"), -1,
- "p with someclass content still exists");
-
- resetContent(options);
- }
- },
- ]);
- };
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_pref.js b/browser/devtools/commandline/test/browser_cmd_pref.js
deleted file mode 100644
index 9aa6237fa..000000000
--- a/browser/devtools/commandline/test/browser_cmd_pref.js
+++ /dev/null
@@ -1,502 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the pref commands work
-
-let prefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(null)
- .QueryInterface(Ci.nsIPrefBranch2);
-
-let supportsString = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString)
-
-let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).require;
-
-let settings = require("gcli/settings");
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-pref";
-
-let tiltEnabledOrig;
-let tabSizeOrig;
-let remoteHostOrig;
-
-let tests = {
- setup: function(options) {
- tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled");
- tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize");
- remoteHostOrig = prefBranch.getComplexValue("devtools.debugger.remote-host",
- Ci.nsISupportsString).data;
-
- info("originally: devtools.tilt.enabled = " + tiltEnabledOrig);
- info("originally: devtools.editor.tabsize = " + tabSizeOrig);
- info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
- },
-
- shutdown: function(options) {
- prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig);
- prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig);
- supportsString.data = remoteHostOrig;
- prefBranch.setComplexValue("devtools.debugger.remote-host",
- Ci.nsISupportsString, supportsString);
- },
-
- testPrefStatus: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref',
- check: {
- input: 'pref',
- hints: '',
- markup: 'IIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref s',
- check: {
- input: 'pref s',
- hints: 'et',
- markup: 'IIIIVI',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref sh',
- check: {
- input: 'pref sh',
- hints: 'ow',
- markup: 'IIIIVII',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref show ',
- check: {
- input: 'pref show ',
- markup: 'VVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref show usetexttospeech',
- check: {
- input: 'pref show usetexttospeech',
- hints: ' -> accessibility.usetexttospeech',
- markup: 'VVVVVVVVVVIIIIIIIIIIIIIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref show devtools.til',
- check: {
- input: 'pref show devtools.til',
- hints: 't.enabled',
- markup: 'VVVVVVVVVVIIIIIIIIIIII',
- status: 'ERROR',
- tooltipState: 'true:importantFieldFlag',
- args: {
- setting: { value: undefined, status: 'INCOMPLETE' },
- }
- },
- },
- {
- setup: 'pref reset devtools.tilt.enabled',
- check: {
- input: 'pref reset devtools.tilt.enabled',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID'
- },
- },
- {
- setup: 'pref show devtools.tilt.enabled 4',
- check: {
- input: 'pref show devtools.tilt.enabled 4',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE',
- status: 'ERROR'
- },
- },
- {
- setup: 'pref set devtools.tilt.enabled 4',
- check: {
- input: 'pref set devtools.tilt.enabled 4',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE',
- status: 'ERROR',
- args: {
- setting: { arg: ' devtools.tilt.enabled' },
- value: { status: 'ERROR', message: 'Can\'t use \'4\'.' },
- }
- },
- },
- {
- setup: 'pref set devtools.editor.tabsize 4',
- check: {
- input: 'pref set devtools.editor.tabsize 4',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- setting: { arg: ' devtools.editor.tabsize' },
- value: { value: 4 },
- }
- },
- },
- {
- setup: 'pref list',
- check: {
- input: 'pref list',
- hints: ' -> pref set',
- markup: 'IIIIVIIII',
- status: 'ERROR'
- },
- },
- ]);
- },
-
- testPrefSetEnable: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref set devtools.editor.tabsize 9',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 9 }
- },
- },
- exec: {
- completed: true,
- output: [ /void your warranty/, /I promise/ ],
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"),
- tabSizeOrig,
- "devtools.editor.tabsize is unchanged");
- }
- },
- {
- setup: 'pref set devtools.gcli.allowSet true',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.gcli.allowSet") },
- value: { value: true }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- post: function() {
- is(prefBranch.getBoolPref("devtools.gcli.allowSet"), true,
- "devtools.gcli.allowSet is true");
- }
- },
- {
- setup: 'pref set devtools.editor.tabsize 10',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 10 }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 10,
- "devtools.editor.tabsize is 10");
- }
- },
- ]);
- },
-
- testPrefBoolExec: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref show devtools.tilt.enabled',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.tilt.enabled") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.tilt\.enabled: " + tiltEnabledOrig + "$"),
- },
- },
- {
- setup: 'pref set devtools.tilt.enabled true',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.tilt.enabled") },
- value: { value: true }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- post: function() {
- is(prefBranch.getBoolPref("devtools.tilt.enabled"), true,
- "devtools.tilt.enabled is true");
- }
- },
- {
- setup: 'pref show devtools.tilt.enabled',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.tilt.enabled") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.tilt\.enabled: true$"),
- },
- },
- {
- setup: 'pref set devtools.tilt.enabled false',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.tilt.enabled") },
- value: { value: false }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- },
- {
- setup: 'pref show devtools.tilt.enabled',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.tilt.enabled") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.tilt\.enabled: false$"),
- },
- post: function() {
- is(prefBranch.getBoolPref("devtools.tilt.enabled"), false,
- "devtools.tilt.enabled is false");
- }
- },
- ]);
- },
-
- testPrefNumberExec: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref show devtools.editor.tabsize',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.editor\.tabsize: 10$"),
- },
- },
- {
- setup: 'pref set devtools.editor.tabsize 20',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 20 }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- },
- {
- setup: 'pref show devtools.editor.tabsize',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.editor\.tabsize: 20$"),
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 20,
- "devtools.editor.tabsize is 20");
- }
- },
- {
- setup: 'pref set devtools.editor.tabsize 1',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 1 }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- },
- {
- setup: 'pref show devtools.editor.tabsize',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.editor\.tabsize: 1$"),
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 1,
- "devtools.editor.tabsize is 1");
- }
- },
- ]);
- },
-
- testPrefStringExec: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref show devtools.debugger.remote-host',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.debugger.remote-host") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.debugger\.remote-host: " + remoteHostOrig + "$"),
- },
- },
- {
- setup: 'pref set devtools.debugger.remote-host e.com',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.debugger.remote-host") },
- value: { value: "e.com" }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- },
- {
- setup: 'pref show devtools.debugger.remote-host',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.debugger.remote-host") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.debugger\.remote-host: e.com$"),
- },
- post: function() {
- var ecom = prefBranch.getComplexValue("devtools.debugger.remote-host",
- Ci.nsISupportsString).data;
- is(ecom, "e.com", "devtools.debugger.remote-host is e.com");
- }
- },
- {
- setup: 'pref set devtools.debugger.remote-host moz.foo',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.debugger.remote-host") },
- value: { value: "moz.foo" }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- },
- {
- setup: 'pref show devtools.debugger.remote-host',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.debugger.remote-host") }
- },
- },
- exec: {
- completed: true,
- output: new RegExp("^devtools\.debugger\.remote-host: moz.foo$"),
- },
- post: function() {
- var mozfoo = prefBranch.getComplexValue("devtools.debugger.remote-host",
- Ci.nsISupportsString).data;
- is(mozfoo, "moz.foo", "devtools.debugger.remote-host is moz.foo");
- }
- },
- ]);
- },
-
- testPrefSetDisable: function(options) {
- return helpers.audit(options, [
- {
- setup: 'pref set devtools.editor.tabsize 32',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 32 }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 32,
- "devtools.editor.tabsize is 32");
- }
- },
- {
- setup: 'pref reset devtools.gcli.allowSet',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.gcli.allowSet") }
- },
- },
- exec: {
- completed: true,
- output: '',
- },
- post: function() {
- is(prefBranch.getBoolPref("devtools.gcli.allowSet"), false,
- "devtools.gcli.allowSet is false");
- }
- },
- {
- setup: 'pref set devtools.editor.tabsize 33',
- check: {
- args: {
- setting: { value: settings.getSetting("devtools.editor.tabsize") },
- value: { value: 33 }
- },
- },
- exec: {
- completed: true,
- output: [ /void your warranty/, /I promise/ ],
- },
- post: function() {
- is(prefBranch.getIntPref("devtools.editor.tabsize"), 32,
- "devtools.editor.tabsize is still 32");
- }
- },
- ]);
- },
-};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_restart.js b/browser/devtools/commandline/test/browser_cmd_restart.js
deleted file mode 100644
index a08ae3e37..000000000
--- a/browser/devtools/commandline/test/browser_cmd_restart.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that restart command works properly (input wise)
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-command-restart";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.audit(options, [
- {
- setup: 'restart',
- check: {
- input: 'restart',
- markup: 'VVVVVVV',
- status: 'VALID',
- args: {
- nocache: { value: false },
- }
- },
- },
- {
- setup: 'restart --nocache',
- check: {
- input: 'restart --nocache',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- nocache: { value: true },
- }
- },
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_screenshot.html b/browser/devtools/commandline/test/browser_cmd_screenshot.html
deleted file mode 100644
index 8e30016f1..000000000
--- a/browser/devtools/commandline/test/browser_cmd_screenshot.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html>
- <head></head>
- <body>
- <img id="testImage" ></img>
- </body>
-</html>
diff --git a/browser/devtools/commandline/test/browser_cmd_screenshot.js b/browser/devtools/commandline/test/browser_cmd_screenshot.js
deleted file mode 100644
index a44aa0731..000000000
--- a/browser/devtools/commandline/test/browser_cmd_screenshot.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that screenshot command works properly
-const TEST_URI = "http://example.com/browser/browser/devtools/commandline/" +
- "test/browser_cmd_screenshot.html";
-
-let FileUtils = (Cu.import("resource://gre/modules/FileUtils.jsm", {})).FileUtils;
-
-let tests = {
- testInput: function(options) {
- return helpers.audit(options, [
- {
- setup: 'screenshot',
- check: {
- input: 'screenshot',
- markup: 'VVVVVVVVVV',
- status: 'VALID',
- args: {
- }
- },
- },
- {
- setup: 'screenshot abc.png',
- check: {
- input: 'screenshot abc.png',
- markup: 'VVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- filename: { value: "abc.png"},
- }
- },
- },
- {
- setup: 'screenshot --fullpage',
- check: {
- input: 'screenshot --fullpage',
- markup: 'VVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- fullpage: { value: true},
- }
- },
- },
- {
- setup: 'screenshot abc --delay 5',
- check: {
- input: 'screenshot abc --delay 5',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- filename: { value: "abc"},
- delay: { value: 5 },
- }
- },
- },
- {
- setup: 'screenshot --selector img#testImage',
- check: {
- input: 'screenshot --selector img#testImage',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: {
- value: options.window.document.getElementById("testImage")
- },
- }
- },
- },
- ]);
- },
-
- testCaptureFile: function(options) {
- let file = FileUtils.getFile("TmpD", [ "TestScreenshotFile.png" ]);
-
- return helpers.audit(options, [
- {
- setup: 'screenshot ' + file.path,
- check: {
- args: {
- filename: { value: "" + file.path },
- fullpage: { value: false },
- clipboard: { value: false },
- chrome: { value: false },
- },
- },
- exec: {
- output: new RegExp("^Saved to "),
- },
- post: function() {
- // Bug 849168: screenshot command tests fail in try but not locally
- // ok(file.exists(), "Screenshot file exists");
-
- if (file.exists()) {
- file.remove(false);
- }
- }
- },
- ]);
- },
-
- testCaptureClipboard: function(options) {
- let clipid = Ci.nsIClipboard;
- let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
- let trans = Cc["@mozilla.org/widget/transferable;1"]
- .createInstance(Ci.nsITransferable);
- trans.init(null);
- trans.addDataFlavor("image/png");
-
- return helpers.audit(options, [
- {
- setup: 'screenshot --fullpage --clipboard',
- check: {
- args: {
- fullpage: { value: true },
- clipboard: { value: true },
- chrome: { value: false },
- },
- },
- exec: {
- output: new RegExp("^Copied to clipboard.$"),
- },
- post: function() {
- try {
- clip.getData(trans, clipid.kGlobalClipboard);
- let str = new Object();
- let strLength = new Object();
- trans.getTransferData("image/png", str, strLength);
-
- ok(str.value, "screenshot exists");
- ok(strLength.value > 0, "screenshot has length");
- }
- finally {
- Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
-
- // Recent PB changes to the test I'm modifying removed the 'pb'
- // variable, but left this line in tact. This seems so obviously
- // wrong that I'm leaving this in in case the analysis is wrong
- // pb.privateBrowsingEnabled = true;
- }
- }
- },
- ]);
- },
-};
-
-function test() {
- info("RUN TEST: non-private window");
- let nonPrivDone = addWindow({ private: false }, addTabWithToolbarRunTests);
-
- let privDone = nonPrivDone.then(function() {
- info("RUN TEST: private window");
- return addWindow({ private: true }, addTabWithToolbarRunTests);
- });
-
- privDone.then(finish, function(error) {
- ok(false, 'Promise fail: ' + error);
- });
-}
-
-function addTabWithToolbarRunTests(win) {
- return helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }, { chromeWindow: win });
-}
-
-function addWindow(windowOptions, callback) {
- waitForExplicitFinish();
- let deferred = Promise.defer();
-
- let win = OpenBrowserWindow(windowOptions);
-
- let onLoad = function() {
- win.removeEventListener("load", onLoad, false);
-
- // Would like to get rid of this executeSoon, but without it the url
- // (TEST_URI) provided in addTabWithToolbarRunTests hasn't loaded
- executeSoon(function() {
- try {
- let reply = callback(win);
- Promise.resolve(reply).then(function() {
- win.close();
- deferred.resolve();
- });
- }
- catch (ex) {
- deferred.reject(ex);
- }
- });
- };
-
- win.addEventListener("load", onLoad, false);
-
- return deferred.promise;
-}
diff --git a/browser/devtools/commandline/test/browser_cmd_settings.js b/browser/devtools/commandline/test/browser_cmd_settings.js
deleted file mode 100644
index 165102b8d..000000000
--- a/browser/devtools/commandline/test/browser_cmd_settings.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the pref commands work
-
-let prefBranch = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefService).getBranch(null)
- .QueryInterface(Ci.nsIPrefBranch2);
-
-let supportsString = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString)
-
-let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).require;
-
-let settings = require("gcli/settings");
-
-const TEST_URI = "data:text/html;charset=utf-8,gcli-settings";
-
-let tiltEnabled = undefined;
-let tabSize = undefined;
-let remoteHost = undefined;
-
-let tiltEnabledOrig = undefined;
-let tabSizeOrig = undefined;
-let remoteHostOrig = undefined;
-
-let tests = {};
-
-tests.setup = function() {
- tiltEnabled = settings.getSetting("devtools.tilt.enabled");
- tabSize = settings.getSetting("devtools.editor.tabsize");
- remoteHost = settings.getSetting("devtools.debugger.remote-host");
-
- tiltEnabledOrig = prefBranch.getBoolPref("devtools.tilt.enabled");
- tabSizeOrig = prefBranch.getIntPref("devtools.editor.tabsize");
- remoteHostOrig = prefBranch.getComplexValue(
- "devtools.debugger.remote-host",
- Components.interfaces.nsISupportsString).data;
-
- info("originally: devtools.tilt.enabled = " + tiltEnabledOrig);
- info("originally: devtools.editor.tabsize = " + tabSizeOrig);
- info("originally: devtools.debugger.remote-host = " + remoteHostOrig);
-};
-
-tests.shutdown = function() {
- prefBranch.setBoolPref("devtools.tilt.enabled", tiltEnabledOrig);
- prefBranch.setIntPref("devtools.editor.tabsize", tabSizeOrig);
- supportsString.data = remoteHostOrig;
- prefBranch.setComplexValue("devtools.debugger.remote-host",
- Components.interfaces.nsISupportsString,
- supportsString);
-
- tiltEnabled = undefined;
- tabSize = undefined;
- remoteHost = undefined;
-
- tiltEnabledOrig = undefined;
- tabSizeOrig = undefined;
- remoteHostOrig = undefined;
-};
-
-tests.testSettings = function() {
- is(tiltEnabled.value, tiltEnabledOrig, "tiltEnabled default");
- is(tabSize.value, tabSizeOrig, "tabSize default");
- is(remoteHost.value, remoteHostOrig, "remoteHost default");
-
- tiltEnabled.setDefault();
- tabSize.setDefault();
- remoteHost.setDefault();
-
- let tiltEnabledDefault = tiltEnabled.value;
- let tabSizeDefault = tabSize.value;
- let remoteHostDefault = remoteHost.value;
-
- tiltEnabled.value = false;
- tabSize.value = 42;
- remoteHost.value = "example.com"
-
- is(tiltEnabled.value, false, "tiltEnabled basic");
- is(tabSize.value, 42, "tabSize basic");
- is(remoteHost.value, "example.com", "remoteHost basic");
-
- function tiltEnabledCheck(ev) {
- is(ev.setting, tiltEnabled, "tiltEnabled event setting");
- is(ev.value, true, "tiltEnabled event value");
- is(ev.setting.value, true, "tiltEnabled event setting value");
- }
- tiltEnabled.onChange.add(tiltEnabledCheck);
- tiltEnabled.value = true;
- is(tiltEnabled.value, true, "tiltEnabled change");
-
- function tabSizeCheck(ev) {
- is(ev.setting, tabSize, "tabSize event setting");
- is(ev.value, 1, "tabSize event value");
- is(ev.setting.value, 1, "tabSize event setting value");
- }
- tabSize.onChange.add(tabSizeCheck);
- tabSize.value = 1;
- is(tabSize.value, 1, "tabSize change");
-
- function remoteHostCheck(ev) {
- is(ev.setting, remoteHost, "remoteHost event setting");
- is(ev.value, "y.com", "remoteHost event value");
- is(ev.setting.value, "y.com", "remoteHost event setting value");
- }
- remoteHost.onChange.add(remoteHostCheck);
- remoteHost.value = "y.com";
- is(remoteHost.value, "y.com", "remoteHost change");
-
- tiltEnabled.onChange.remove(tiltEnabledCheck);
- tabSize.onChange.remove(tabSizeCheck);
- remoteHost.onChange.remove(remoteHostCheck);
-
- function remoteHostReCheck(ev) {
- is(ev.setting, remoteHost, "remoteHost event reset");
- is(ev.value, null, "remoteHost event revalue");
- is(ev.setting.value, null, "remoteHost event setting revalue");
- }
- remoteHost.onChange.add(remoteHostReCheck);
-
- tiltEnabled.setDefault();
- tabSize.setDefault();
- remoteHost.setDefault();
-
- remoteHost.onChange.remove(remoteHostReCheck);
-
- is(tiltEnabled.value, tiltEnabledDefault, "tiltEnabled reset");
- is(tabSize.value, tabSizeDefault, "tabSize reset");
- is(remoteHost.value, remoteHostDefault, "remoteHost reset");
-};
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, tests);
- }).then(finish);
-}
diff --git a/browser/devtools/commandline/test/browser_gcli_async.js b/browser/devtools/commandline/test/browser_gcli_async.js
deleted file mode 100644
index 172f0bf00..000000000
--- a/browser/devtools/commandline/test/browser_gcli_async.js
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testAsync.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-var canon = require('gcli/canon');
-var Promise = require('util/promise');
-
-exports.testBasic = function(options) {
- var getData = function() {
- var deferred = Promise.defer();
-
- var resolve = function() {
- deferred.resolve([
- 'Shalom', 'Namasté', 'Hallo', 'Dydd-da',
- 'Chào', 'Hej', 'Saluton', 'Sawubona'
- ]);
- };
-
- setTimeout(resolve, 10);
- return deferred.promise;
- };
-
- var tsslow = {
- name: 'tsslow',
- params: [
- {
- name: 'hello',
- type: {
- name: 'selection',
- data: getData
- }
- }
- ],
- exec: function(args, context) {
- return 'Test completed';
- }
- };
-
- canon.addCommand(tsslow);
-
- return helpers.audit(options, [
- {
- setup: 'tsslo',
- check: {
- input: 'tsslo',
- hints: 'w',
- markup: 'IIIII',
- cursor: 5,
- current: '__command',
- status: 'ERROR',
- predictions: ['tsslow'],
- unassigned: [ ]
- }
- },
- {
- setup: 'tsslo<TAB>',
- check: {
- input: 'tsslow ',
- hints: 'Shalom',
- markup: 'VVVVVVV',
- cursor: 7,
- current: 'hello',
- status: 'ERROR',
- predictions: [
- 'Shalom', 'Namasté', 'Hallo', 'Dydd-da', 'Chào', 'Hej',
- 'Saluton', 'Sawubona'
- ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsslow' },
- hello: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- },
- }
- }
- },
- {
- setup: 'tsslow S',
- check: {
- input: 'tsslow S',
- hints: 'halom',
- markup: 'VVVVVVVI',
- cursor: 8,
- current: 'hello',
- status: 'ERROR',
- predictions: [ 'Shalom', 'Saluton', 'Sawubona', 'Namasté' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsslow' },
- hello: {
- value: undefined,
- arg: ' S',
- status: 'INCOMPLETE',
- message: ''
- },
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tsslow S<TAB>',
- check: {
- input: 'tsslow Shalom ',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'hello',
- status: 'VALID',
- predictions: [ 'Shalom' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsslow' },
- hello: {
- value: 'Shalom',
- arg: ' Shalom ',
- status: 'VALID',
- message: ''
- },
- }
- },
- post: function() {
- canon.removeCommand(tsslow);
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tsslow ',
- check: {
- input: 'tsslow ',
- markup: 'EEEEEEV',
- cursor: 7,
- status: 'ERROR'
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_canon.js b/browser/devtools/commandline/test/browser_gcli_canon.js
deleted file mode 100644
index 296cf1907..000000000
--- a/browser/devtools/commandline/test/browser_gcli_canon.js
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCanon.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-var canon = require('gcli/canon');
-// var assert = require('test/assert');
-var Canon = canon.Canon;
-
-var startCount = undefined;
-var events = undefined;
-
-var canonChange = function(ev) {
- events++;
-};
-
-exports.setup = function(options) {
- startCount = canon.getCommands().length;
- events = 0;
-};
-
-exports.shutdown = function(options) {
- startCount = undefined;
- events = undefined;
-};
-
-exports.testAddRemove1 = function(options) {
- return helpers.audit(options, [
- {
- name: 'testadd add',
- setup: function() {
- canon.onCanonChange.add(canonChange);
-
- canon.addCommand({
- name: 'testadd',
- exec: function() {
- return 1;
- }
- });
-
- assert.is(canon.getCommands().length,
- startCount + 1,
- 'add command success');
- assert.is(events, 1, 'add event');
-
- return helpers.setInput(options, 'testadd');
- },
- check: {
- input: 'testadd',
- hints: '',
- markup: 'VVVVVVV',
- cursor: 7,
- current: '__command',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: { }
- },
- exec: {
- output: /^1$/
- }
- },
- {
- name: 'testadd alter',
- setup: function() {
- canon.addCommand({
- name: 'testadd',
- exec: function() {
- return 2;
- }
- });
-
- assert.is(canon.getCommands().length,
- startCount + 1,
- 'read command success');
- assert.is(events, 2, 'read event');
-
- return helpers.setInput(options, 'testadd');
- },
- check: {
- input: 'testadd',
- hints: '',
- markup: 'VVVVVVV',
- },
- exec: {
- output: '2'
- }
- },
- {
- name: 'testadd remove',
- setup: function() {
- canon.removeCommand('testadd');
-
- assert.is(canon.getCommands().length,
- startCount,
- 'remove command success');
- assert.is(events, 3, 'remove event');
-
- return helpers.setInput(options, 'testadd');
- },
- check: {
- typed: 'testadd',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- unassigned: [ ],
- }
- }
- ]);
-};
-
-exports.testAddRemove2 = function(options) {
- canon.addCommand({
- name: 'testadd',
- exec: function() {
- return 3;
- }
- });
-
- assert.is(canon.getCommands().length,
- startCount + 1,
- 'rereadd command success');
- assert.is(events, 4, 'rereadd event');
-
- return helpers.audit(options, [
- {
- setup: 'testadd',
- exec: {
- output: /^3$/
- },
- post: function() {
- canon.removeCommand({
- name: 'testadd'
- });
-
- assert.is(canon.getCommands().length,
- startCount,
- 'reremove command success');
- assert.is(events, 5, 'reremove event');
- }
- },
- {
- setup: 'testadd',
- check: {
- typed: 'testadd',
- status: 'ERROR'
- }
- }
- ]);
-};
-
-exports.testAddRemove3 = function(options) {
- canon.removeCommand({ name: 'nonexistant' });
- assert.is(canon.getCommands().length,
- startCount,
- 'nonexistant1 command success');
- assert.is(events, 5, 'nonexistant1 event');
-
- canon.removeCommand('nonexistant');
- assert.is(canon.getCommands().length,
- startCount,
- 'nonexistant2 command success');
- assert.is(events, 5, 'nonexistant2 event');
-
- canon.onCanonChange.remove(canonChange);
-};
-
-exports.testAltCanon = function(options) {
- var altCanon = new Canon();
-
- var tss = {
- name: 'tss',
- params: [
- { name: 'str', type: 'string' },
- { name: 'num', type: 'number' },
- { name: 'opt', type: { name: 'selection', data: [ '1', '2', '3' ] } },
- ],
- exec: function(args, context) {
- return context.commandName + ':' +
- args.str + ':' + args.num + ':' + args.opt;
- }
- };
- altCanon.addCommand(tss);
-
- var commandSpecs = altCanon.getCommandSpecs();
- assert.is(JSON.stringify(commandSpecs),
- '{"tss":{"name":"tss","params":[' +
- '{"name":"str","type":"string"},' +
- '{"name":"num","type":"number"},' +
- '{"name":"opt","type":{"name":"selection","data":["1","2","3"]}}]}}',
- 'JSON.stringify(commandSpecs)');
-
- var remoter = function(args, context) {
- assert.is(context.commandName, 'tss', 'commandName is tss');
-
- var cmd = altCanon.getCommand(context.commandName);
- return cmd.exec(args, context);
- };
-
- canon.addProxyCommands('proxy', commandSpecs, remoter, 'test');
-
- var parent = canon.getCommand('proxy');
- assert.is(parent.name, 'proxy', 'Parent command called proxy');
-
- var child = canon.getCommand('proxy tss');
- assert.is(child.name, 'proxy tss', 'child command called proxy tss');
-
- return helpers.audit(options, [
- {
- setup: 'proxy tss foo 6 3',
- check: {
- input: 'proxy tss foo 6 3',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- cursor: 17,
- status: 'VALID',
- args: {
- str: { value: 'foo', status: 'VALID' },
- num: { value: 6, status: 'VALID' },
- opt: { value: '3', status: 'VALID' }
- }
- },
- exec: {
- output: 'tss:foo:6:3'
- },
- post: function() {
- canon.removeCommand('proxy');
- canon.removeCommand('proxy tss');
-
- assert.is(canon.getCommand('proxy'), undefined, 'remove proxy');
- assert.is(canon.getCommand('proxy tss'), undefined, 'remove proxy tss');
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_cli.js b/browser/devtools/commandline/test/browser_gcli_cli.js
deleted file mode 100644
index 4001e3332..000000000
--- a/browser/devtools/commandline/test/browser_gcli_cli.js
+++ /dev/null
@@ -1,1322 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCli.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-// var assert = require('test/assert');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testBlank = function(options) {
- var requisition = options.display.requisition;
-
- return helpers.audit(options, [
- {
- setup: '',
- check: {
- input: '',
- hints: '',
- markup: '',
- cursor: 0,
- current: '__command',
- status: 'ERROR'
- },
- post: function() {
- assert.is(requisition.commandAssignment.value, undefined);
- }
- },
- {
- setup: ' ',
- check: {
- input: ' ',
- hints: '',
- markup: 'V',
- cursor: 1,
- current: '__command',
- status: 'ERROR'
- },
- post: function() {
- assert.is(requisition.commandAssignment.value, undefined);
- }
- },
- {
- name: '| ',
- setup: function() {
- helpers.setInput(options, ' ', 0);
- },
- check: {
- input: ' ',
- hints: '',
- markup: 'V',
- cursor: 0,
- current: '__command',
- status: 'ERROR'
- },
- post: function() {
- assert.is(requisition.commandAssignment.value, undefined);
- }
- }
- ]);
-};
-
-exports.testIncompleteMultiMatch = function(options) {
- return helpers.audit(options, [
- {
- setup: 't',
- skipIf: options.isFirefox, // 't' hints at 'tilt' in firefox
- check: {
- input: 't',
- hints: 'est',
- markup: 'I',
- cursor: 1,
- current: '__command',
- status: 'ERROR',
- predictionsContains: [ 'tsb' ]
- }
- },
- {
- setup: 'tsn ex',
- check: {
- input: 'tsn ex',
- hints: 't',
- markup: 'IIIVII',
- cursor: 6,
- current: '__command',
- status: 'ERROR',
- predictionsContains: [
- 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend'
- ]
- }
- }
- ]);
-};
-
-exports.testIncompleteSingleMatch = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tselar',
- check: {
- input: 'tselar',
- hints: 'r',
- markup: 'IIIIII',
- cursor: 6,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tselarr' ],
- unassigned: [ ]
- }
- }
- ]);
-};
-
-exports.testTsv = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsv',
- check: {
- input: 'tsv',
- hints: ' <optionType> <optionValue>',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: { arg: '', status: 'INCOMPLETE', message: '' },
- optionValue: { arg: '', status: 'INCOMPLETE', message: '' }
- }
- }
- },
- {
- setup: 'tsv ',
- check: {
- input: 'tsv ',
- hints: 'option1 <optionValue>',
- markup: 'VVVV',
- cursor: 4,
- current: 'optionType',
- status: 'ERROR',
- predictions: [ 'option1', 'option2', 'option3' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsv' },
- optionType: { arg: '', status: 'INCOMPLETE', message: '' },
- optionValue: { arg: '', status: 'INCOMPLETE', message: '' }
- }
- }
- },
- {
- name: 'ts|v',
- setup: function() {
- helpers.setInput(options, 'tsv ', 2);
- },
- check: {
- input: 'tsv ',
- hints: '<optionType> <optionValue>',
- markup: 'VVVV',
- cursor: 2,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: { arg: '', status: 'INCOMPLETE', message: '' },
- optionValue: { arg: '', status: 'INCOMPLETE', message: '' }
- }
- }
- },
- {
- setup: 'tsv o',
- check: {
- input: 'tsv o',
- hints: 'ption1 <optionValue>',
- markup: 'VVVVI',
- cursor: 5,
- current: 'optionType',
- status: 'ERROR',
- predictions: [ 'option1', 'option2', 'option3' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: undefined,
- arg: ' o',
- status: 'INCOMPLETE',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option',
- check: {
- input: 'tsv option',
- hints: '1 <optionValue>',
- markup: 'VVVVIIIIII',
- cursor: 10,
- current: 'optionType',
- status: 'ERROR',
- predictions: [ 'option1', 'option2', 'option3' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: undefined,
- arg: ' option',
- status: 'INCOMPLETE',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- name: '|tsv option',
- setup: function() {
- return helpers.setInput(options, 'tsv option', 0);
- },
- check: {
- input: 'tsv option',
- hints: ' <optionValue>',
- markup: 'VVVVEEEEEE',
- cursor: 0,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: undefined,
- arg: ' option',
- status: 'INCOMPLETE',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option ',
- check: {
- input: 'tsv option ',
- hints: '<optionValue>',
- markup: 'VVVVEEEEEEV',
- cursor: 11,
- current: 'optionValue',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'false:default',
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: undefined,
- arg: ' option ',
- status: 'ERROR',
- message: 'Can\'t use \'option\'.'
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option1',
- check: {
- input: 'tsv option1',
- hints: ' <optionValue>',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'optionType',
- status: 'ERROR',
- predictions: [ 'option1' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option1,
- arg: ' option1',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option1 ',
- check: {
- input: 'tsv option1 ',
- hints: '<optionValue>',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: 'optionValue',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option1,
- arg: ' option1 ',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option2',
- check: {
- input: 'tsv option2',
- hints: ' <optionValue>',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'optionType',
- status: 'ERROR',
- predictions: [ 'option2' ],
- unassigned: [ ],
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option2,
- arg: ' option2',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option1 6',
- check: {
- input: 'tsv option1 6',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- cursor: 13,
- current: 'optionValue',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option1,
- arg: ' option1',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: '6',
- arg: ' 6',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsv option2 6',
- check: {
- input: 'tsv option2 6',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- cursor: 13,
- current: 'optionValue',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option2,
- arg: ' option2',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: 6,
- arg: ' 6',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testInvalid = function(options) {
- return helpers.audit(options, [
- {
- setup: 'zxjq',
- check: {
- input: 'zxjq',
- hints: '',
- markup: 'EEEE',
- cursor: 4,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError'
- }
- },
- {
- setup: 'zxjq ',
- check: {
- input: 'zxjq ',
- hints: '',
- markup: 'EEEEV',
- cursor: 5,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError'
- }
- },
- {
- setup: 'zxjq one',
- check: {
- input: 'zxjq one',
- hints: '',
- markup: 'EEEEVEEE',
- cursor: 8,
- current: '__unassigned',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ' one' ],
- tooltipState: 'true:isError'
- }
- }
- ]);
-};
-
-exports.testSingleString = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsr',
- check: {
- input: 'tsr',
- hints: ' <text>',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsr ',
- check: {
- input: 'tsr ',
- hints: '<text>',
- markup: 'VVVV',
- cursor: 4,
- current: 'text',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsr h',
- check: {
- input: 'tsr h',
- hints: '',
- markup: 'VVVVV',
- cursor: 5,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'h',
- arg: ' h',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsr "h h"',
- check: {
- input: 'tsr "h h"',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'h h',
- arg: ' "h h"',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsr h h h',
- check: {
- input: 'tsr h h h',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'h h h',
- arg: ' h h h',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testSingleNumber = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsu',
- check: {
- input: 'tsu',
- hints: ' <num>',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsu ',
- check: {
- input: 'tsu ',
- hints: '<num>',
- markup: 'VVVV',
- cursor: 4,
- current: 'num',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsu 1',
- check: {
- input: 'tsu 1',
- hints: '',
- markup: 'VVVVV',
- cursor: 5,
- current: 'num',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: { value: 1, arg: ' 1', status: 'VALID', message: '' }
- }
- }
- },
- {
- setup: 'tsu x',
- check: {
- input: 'tsu x',
- hints: '',
- markup: 'VVVVE',
- cursor: 5,
- current: 'num',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tsu' },
- num: {
- value: undefined,
- arg: ' x',
- status: 'ERROR',
- message: 'Can\'t convert "x" to a number.'
- }
- }
- }
- },
- {
- setup: 'tsu 1.5',
- check: {
- input: 'tsu 1.5',
- hints: '',
- markup: 'VVVVEEE',
- cursor: 7,
- current: 'num',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: {
- value: undefined,
- arg: ' 1.5',
- status: 'ERROR',
- message: 'Can\'t convert "1.5" to an integer.'
- }
- }
- }
- }
- ]);
-};
-
-exports.testSingleFloat = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsf',
- check: {
- input: 'tsf',
- hints: ' <num>',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- error: '',
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsf 1',
- check: {
- input: 'tsf 1',
- hints: '',
- markup: 'VVVVV',
- cursor: 5,
- current: 'num',
- status: 'VALID',
- error: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: { value: 1, arg: ' 1', status: 'VALID', message: '' }
- }
- }
- },
- {
- setup: 'tsf 1.',
- check: {
- input: 'tsf 1.',
- hints: '',
- markup: 'VVVVVV',
- cursor: 6,
- current: 'num',
- status: 'VALID',
- error: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: { value: 1, arg: ' 1.', status: 'VALID', message: '' }
- }
- }
- },
- {
- setup: 'tsf 1.5',
- check: {
- input: 'tsf 1.5',
- hints: '',
- markup: 'VVVVVVV',
- cursor: 7,
- current: 'num',
- status: 'VALID',
- error: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: { value: 1.5, arg: ' 1.5', status: 'VALID', message: '' }
- }
- }
- },
- {
- setup: 'tsf 1.5x',
- check: {
- input: 'tsf 1.5x',
- hints: '',
- markup: 'VVVVVVVV',
- cursor: 8,
- current: 'num',
- status: 'VALID',
- error: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: { value: 1.5, arg: ' 1.5x', status: 'VALID', message: '' }
- }
- }
- },
- {
- name: 'tsf x (cursor=4)',
- setup: function() {
- return helpers.setInput(options, 'tsf x', 4);
- },
- check: {
- input: 'tsf x',
- hints: '',
- markup: 'VVVVE',
- cursor: 4,
- current: 'num',
- status: 'ERROR',
- error: 'Can\'t convert "x" to a number.',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsf' },
- num: {
- value: undefined,
- arg: ' x',
- status: 'ERROR',
- message: 'Can\'t convert "x" to a number.'
- }
- }
- }
- }
- ]);
-};
-
-exports.testElementDom = function(options) {
- return helpers.audit(options, [
- {
- skipIf: options.isJsdom,
- setup: 'tse :root',
- check: {
- input: 'tse :root',
- hints: ' [options]',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'node',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tse' },
- node: {
- value: options.window.document.documentElement,
- arg: ' :root',
- status: 'VALID',
- message: ''
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- }
- ]);
-};
-
-exports.testElementWeb = function(options) {
- var inputElement = options.window.document.getElementById('gcli-input');
-
- return helpers.audit(options, [
- {
- skipIf: function gcliInputElementExists() {
- return inputElement == null || options.isJsdom;
- },
- setup: 'tse #gcli-input',
- check: {
- input: 'tse #gcli-input',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVV',
- cursor: 15,
- current: 'node',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tse' },
- node: {
- value: inputElement,
- arg: ' #gcli-input',
- status: 'VALID',
- message: ''
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- }
- ]);
-};
-
-exports.testElement = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tse',
- check: {
- input: 'tse',
- hints: ' <node> [options]',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tse', 'tselarr' ],
- unassigned: [ ],
- args: {
- command: { name: 'tse' },
- node: { value: undefined, arg: '', status: 'INCOMPLETE', message: '' },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse #gcli-nomatch',
- check: {
- input: 'tse #gcli-nomatch',
- hints: ' [options]',
- markup: 'VVVVIIIIIIIIIIIII',
- cursor: 17,
- current: 'node',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' #gcli-nomatch',
- // This is somewhat debatable because this input can't be corrected
- // simply by typing so it's and error rather than incomplete,
- // however without digging into the CSS engine we can't tell that
- // so we default to incomplete
- status: 'INCOMPLETE',
- message: 'No matches'
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- },
- {
- setup: 'tse #',
- check: {
- input: 'tse #',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' #',
- status: 'ERROR',
- message: 'Syntax error in CSS query'
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- },
- {
- setup: 'tse .',
- check: {
- input: 'tse .',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' .',
- status: 'ERROR',
- message: 'Syntax error in CSS query'
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse *',
- check: {
- input: 'tse *',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' *',
- status: 'ERROR',
- message: /^Too many matches \([0-9]*\)/
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- }
- }
- ]);
-};
-
-exports.testNestedCommand = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsn',
- check: {
- input: 'tsn',
- hints: '',
- markup: 'III',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictionsInclude: [
- 'tsn deep', 'tsn deep down', 'tsn deep down nested',
- 'tsn deep down nested cmd', 'tsn dif'
- ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn' }
- }
- }
- },
- {
- setup: 'tsn ',
- check: {
- input: 'tsn ',
- hints: '',
- markup: 'IIIV',
- cursor: 4,
- current: '__command',
- status: 'ERROR',
- unassigned: [ ]
- }
- },
- {
- skipIf: options.isPhantomjs,
- setup: 'tsn x',
- check: {
- input: 'tsn x',
- hints: ' -> tsn ext',
- markup: 'IIIVI',
- cursor: 5,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tsn ext' ],
- unassigned: [ ]
- }
- },
- {
- setup: 'tsn dif',
- check: {
- input: 'tsn dif',
- hints: ' <text>',
- markup: 'VVVVVVV',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn dif' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsn dif ',
- check: {
- input: 'tsn dif ',
- hints: '<text>',
- markup: 'VVVVVVVV',
- cursor: 8,
- current: 'text',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn dif' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsn dif x',
- check: {
- input: 'tsn dif x',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn dif' },
- text: { value: 'x', arg: ' x', status: 'VALID', message: '' }
- }
- }
- },
- {
- setup: 'tsn ext',
- check: {
- input: 'tsn ext',
- hints: ' <text>',
- markup: 'VVVVVVV',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn ext' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsn exte',
- check: {
- input: 'tsn exte',
- hints: ' <text>',
- markup: 'VVVVVVVV',
- cursor: 8,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tsn exte', 'tsn exten', 'tsn extend' ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn exte' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsn exten',
- check: {
- input: 'tsn exten',
- hints: ' <text>',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tsn exten', 'tsn extend' ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn exten' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsn extend',
- check: {
- input: 'tsn extend',
- hints: ' <text>',
- markup: 'VVVVVVVVVV',
- cursor: 10,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn extend' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'ts ',
- check: {
- input: 'ts ',
- hints: '',
- markup: 'EEV',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- tooltipState: 'true:isError'
- }
- },
- ]);
-};
-
-// From Bug 664203
-exports.testDeeplyNested = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsn deep down nested',
- check: {
- input: 'tsn deep down nested',
- hints: '',
- markup: 'IIIVIIIIVIIIIVIIIIII',
- cursor: 20,
- current: '__command',
- status: 'ERROR',
- predictions: [ 'tsn deep down nested', 'tsn deep down nested cmd' ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'false:default',
- args: {
- command: { name: 'tsn deep down nested' },
- }
- }
- },
- {
- setup: 'tsn deep down nested cmd',
- check: {
- input: 'tsn deep down nested cmd',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
- cursor: 24,
- current: '__command',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn deep down nested cmd' },
- }
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_completion.js b/browser/devtools/commandline/test/browser_gcli_completion.js
deleted file mode 100644
index 224babe0e..000000000
--- a/browser/devtools/commandline/test/browser_gcli_completion.js
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCompletion.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testActivate = function(options) {
- return helpers.audit(options, [
- {
- setup: '',
- check: {
- hints: ''
- }
- },
- {
- setup: ' ',
- check: {
- hints: ''
- }
- },
- {
- setup: 'tsr',
- check: {
- hints: ' <text>'
- }
- },
- {
- setup: 'tsr ',
- check: {
- hints: '<text>'
- }
- },
- {
- setup: 'tsr b',
- check: {
- hints: ''
- }
- },
- {
- setup: 'tsb',
- check: {
- hints: ' [toggle]'
- }
- },
- {
- setup: 'tsm',
- check: {
- hints: ' <abc> <txt> <num>'
- }
- },
- {
- setup: 'tsm ',
- check: {
- hints: 'a <txt> <num>'
- }
- },
- {
- setup: 'tsm a',
- check: {
- hints: ' <txt> <num>'
- }
- },
- {
- setup: 'tsm a ',
- check: {
- hints: '<txt> <num>'
- }
- },
- {
- setup: 'tsm a ',
- check: {
- hints: '<txt> <num>'
- }
- },
- {
- setup: 'tsm a d',
- check: {
- hints: ' <num>'
- }
- },
- {
- setup: 'tsm a "d d"',
- check: {
- hints: ' <num>'
- }
- },
- {
- setup: 'tsm a "d ',
- check: {
- hints: ' <num>'
- }
- },
- {
- setup: 'tsm a "d d" ',
- check: {
- hints: '<num>'
- }
- },
- {
- setup: 'tsm a "d d ',
- check: {
- hints: ' <num>'
- }
- },
- {
- setup: 'tsm d r',
- check: {
- hints: ' <num>'
- }
- },
- {
- setup: 'tsm a d ',
- check: {
- hints: '<num>'
- }
- },
- {
- setup: 'tsm a d 4',
- check: {
- hints: ''
- }
- },
- {
- setup: 'tsg',
- check: {
- hints: ' <solo> [options]'
- }
- },
- {
- setup: 'tsg ',
- check: {
- hints: 'aaa [options]'
- }
- },
- {
- setup: 'tsg a',
- check: {
- hints: 'aa [options]'
- }
- },
- {
- setup: 'tsg b',
- check: {
- hints: 'bb [options]'
- }
- },
- {
- skipIf: options.isPhantomjs,
- setup: 'tsg d',
- check: {
- hints: ' [options] -> ccc'
- }
- },
- {
- setup: 'tsg aa',
- check: {
- hints: 'a [options]'
- }
- },
- {
- setup: 'tsg aaa',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsg aaa ',
- check: {
- hints: '[options]'
- }
- },
- {
- setup: 'tsg aaa d',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsg aaa dddddd',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsg aaa dddddd ',
- check: {
- hints: '[options]'
- }
- },
- {
- setup: 'tsg aaa "d',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsg aaa "d d',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsg aaa "d d"',
- check: {
- hints: ' [options]'
- }
- },
- {
- setup: 'tsn ex ',
- check: {
- hints: ''
- }
- },
- {
- setup: 'selarr',
- check: {
- hints: ' -> tselarr'
- }
- },
- {
- setup: 'tselar 1',
- check: {
- hints: ''
- }
- },
- {
- name: 'tselar |1',
- setup: function() {
- helpers.setInput(options, 'tselar 1', 7);
- },
- check: {
- hints: ''
- }
- },
- {
- name: 'tselar| 1',
- setup: function() {
- helpers.setInput(options, 'tselar 1', 6);
- },
- check: {
- hints: ' -> tselarr'
- }
- },
- {
- name: 'tsela|r 1',
- setup: function() {
- helpers.setInput(options, 'tselar 1', 5);
- },
- check: {
- hints: ' -> tselarr'
- }
- },
- ]);
-};
-
-exports.testLong = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tslong --sel',
- check: {
- input: 'tslong --sel',
- hints: ' <selection> <msg> [options]',
- markup: 'VVVVVVVIIIII'
- }
- },
- {
- setup: 'tslong --sel<TAB>',
- check: {
- input: 'tslong --sel ',
- hints: 'space <msg> [options]',
- markup: 'VVVVVVVIIIIIV'
- }
- },
- {
- setup: 'tslong --sel ',
- check: {
- input: 'tslong --sel ',
- hints: 'space <msg> [options]',
- markup: 'VVVVVVVIIIIIV'
- }
- },
- {
- setup: 'tslong --sel s',
- check: {
- input: 'tslong --sel s',
- hints: 'pace <msg> [options]',
- markup: 'VVVVVVVIIIIIVI'
- }
- },
- {
- setup: 'tslong --num ',
- check: {
- input: 'tslong --num ',
- hints: '<number> <msg> [options]',
- markup: 'VVVVVVVIIIIIV'
- }
- },
- {
- setup: 'tslong --num 42',
- check: {
- input: 'tslong --num 42',
- hints: ' <msg> [options]',
- markup: 'VVVVVVVVVVVVVVV'
- }
- },
- {
- setup: 'tslong --num 42 ',
- check: {
- input: 'tslong --num 42 ',
- hints: '<msg> [options]',
- markup: 'VVVVVVVVVVVVVVVV'
- }
- },
- {
- setup: 'tslong --num 42 --se',
- check: {
- input: 'tslong --num 42 --se',
- hints: 'l <msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVIIII'
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tslong --num 42 --se<TAB>',
- check: {
- input: 'tslong --num 42 --sel ',
- hints: 'space <msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVIIIIIV'
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tslong --num 42 --se<TAB><TAB>',
- check: {
- input: 'tslong --num 42 --sel space ',
- hints: '<msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV'
- }
- },
- {
- setup: 'tslong --num 42 --sel ',
- check: {
- input: 'tslong --num 42 --sel ',
- hints: 'space <msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVIIIIIV'
- }
- },
- {
- setup: 'tslong --num 42 --sel space ',
- check: {
- input: 'tslong --num 42 --sel space ',
- hints: '<msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV'
- }
- }
- ]);
-};
-
-exports.testNoTab = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tss<TAB>',
- check: {
- input: 'tss ',
- markup: 'VVVV',
- hints: ''
- }
- },
- {
- setup: 'tss<TAB><TAB>',
- check: {
- input: 'tss ',
- markup: 'VVVV',
- hints: ''
- }
- },
- {
- setup: 'xxxx',
- check: {
- input: 'xxxx',
- markup: 'EEEE',
- hints: ''
- }
- },
- {
- name: '<TAB>',
- setup: function() {
- // Doing it this way avoids clearing the input buffer
- return helpers.pressTab(options);
- },
- check: {
- input: 'xxxx',
- markup: 'EEEE',
- hints: ''
- }
- }
- ]);
-};
-
-exports.testOutstanding = function(options) {
- // See bug 779800
- /*
- return helpers.audit(options, [
- {
- setup: 'tsg --txt1 ddd ',
- check: {
- input: 'tsg --txt1 ddd ',
- hints: 'aaa [options]',
- markup: 'VVVVVVVVVVVVVVV'
- }
- },
- ]);
- */
-};
-
-exports.testCompleteIntoOptional = function(options) {
- // From bug 779816
- return helpers.audit(options, [
- {
- setup: 'tso ',
- check: {
- typed: 'tso ',
- hints: '[text]',
- markup: 'VVVV',
- status: 'VALID'
- }
- },
- {
- setup: 'tso<TAB>',
- check: {
- typed: 'tso ',
- hints: '[text]',
- markup: 'VVVV',
- status: 'VALID'
- }
- }
- ]);
-};
-
-exports.testSpaceComplete = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tslong --sel2 wit',
- check: {
- input: 'tslong --sel2 wit',
- hints: 'h space <msg> [options]',
- markup: 'VVVVVVVIIIIIIVIII',
- cursor: 17,
- current: 'sel2',
- status: 'ERROR',
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tslong' },
- msg: { status: 'INCOMPLETE', message: '' },
- num: { status: 'VALID' },
- sel: { status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- num2: { status: 'VALID' },
- bool2: { value: false, status: 'VALID' },
- sel2: { arg: ' --sel2 wit', status: 'INCOMPLETE' }
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tslong --sel2 wit<TAB>',
- check: {
- input: 'tslong --sel2 \'with space\' ',
- hints: '<msg> [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVV',
- cursor: 27,
- current: 'sel2',
- status: 'ERROR',
- tooltipState: 'true:importantFieldFlag',
- args: {
- command: { name: 'tslong' },
- msg: { status: 'INCOMPLETE', message: '' },
- num: { status: 'VALID' },
- sel: { status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- num2: { status: 'VALID' },
- bool2: { value: false, status: 'VALID' },
- sel2: {
- value: 'with space',
- arg: ' --sel2 \'with space\' ',
- status: 'VALID'
- }
- }
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_context.js b/browser/devtools/commandline/test/browser_gcli_context.js
deleted file mode 100644
index e3c55ec4b..000000000
--- a/browser/devtools/commandline/test/browser_gcli_context.js
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testContext.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-var cli = require('gcli/cli');
-
-var origLogErrors = undefined;
-
-exports.setup = function(options) {
- mockCommands.setup();
-
- origLogErrors = cli.logErrors;
- cli.logErrors = false;
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-
- cli.logErrors = origLogErrors;
- origLogErrors = undefined;
-};
-
-exports.testBaseline = function(options) {
- helpers.audit(options, [
- // These 3 establish a baseline for comparison when we have used the
- // context command
- {
- setup: 'ext',
- check: {
- input: 'ext',
- hints: ' -> context',
- markup: 'III',
- message: '',
- predictions: [ 'context', 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ],
- unassigned: [ ],
- }
- },
- {
- setup: 'ext test',
- check: {
- input: 'ext test',
- hints: '',
- markup: 'IIIVEEEE',
- status: 'ERROR',
- message: 'Too many arguments',
- unassigned: [ ' test' ],
- }
- },
- {
- setup: 'tsn',
- check: {
- input: 'tsn',
- hints: '',
- markup: 'III',
- cursor: 3,
- current: '__command',
- status: 'ERROR',
- predictionsContains: [ 'tsn', 'tsn deep', 'tsn ext', 'tsn exte' ],
- args: {
- command: { name: 'tsn' },
- }
- }
- }
- ]);
-};
-
-exports.testContext = function(options) {
- helpers.audit(options, [
- // Use the 'tsn' context
- {
- setup: 'context tsn',
- check: {
- input: 'context tsn',
- hints: '',
- markup: 'VVVVVVVVVVV',
- message: '',
- predictionsContains: [ 'tsn', 'tsn deep', 'tsn ext', 'tsn exte' ],
- args: {
- command: { name: 'context' },
- prefix: {
- value: mockCommands.commands.tsn,
- status: 'VALID',
- message: ''
- },
- }
- },
- exec: {
- output: 'Using tsn as a command prefix',
- completed: true,
- }
- },
- // For comparison with earlier
- {
- setup: 'ext',
- check: {
- input: 'ext',
- hints: ' <text>',
- markup: 'VVV',
- predictions: [ 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ],
- args: {
- command: { name: 'tsn ext' },
- text: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- },
- }
- }
- },
- {
- setup: 'ext test',
- check: {
- input: 'ext test',
- hints: '',
- markup: 'VVVVVVVV',
- args: {
- command: { name: 'tsn ext' },
- text: {
- value: 'test',
- arg: ' test',
- status: 'VALID',
- message: ''
- },
- }
- },
- exec: {
- output: 'Exec: tsnExt text=test',
- completed: true,
- }
- },
- {
- setup: 'tsn',
- check: {
- input: 'tsn',
- hints: '',
- markup: 'III',
- message: '',
- predictionsContains: [ 'tsn', 'tsn deep', 'tsn ext', 'tsn exte' ],
- args: {
- command: { name: 'tsn' },
- }
- }
- },
- // Does it actually work?
- {
- setup: 'tsb true',
- check: {
- input: 'tsb true',
- hints: '',
- markup: 'VVVVVVVV',
- options: [ 'true' ],
- message: '',
- predictions: [ 'true' ],
- unassigned: [ ],
- args: {
- command: { name: 'tsb' },
- toggle: { value: true, arg: ' true', status: 'VALID', message: '' },
- }
- }
- },
- {
- // Bug 866710 - GCLI should allow argument merging for non-string parameters
- setup: 'context tsn ext',
- skip: true
- },
- {
- setup: 'context "tsn ext"',
- check: {
- input: 'context "tsn ext"',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: {
- value: mockCommands.commands.tsnExt,
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Error: Can\'t use \'tsn ext\' as a prefix because it is not a parent command.',
- completed: true,
- error: true
- }
- },
- /*
- {
- setup: 'context "tsn deep"',
- check: {
- input: 'context "tsn deep"',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVV',
- status: 'ERROR',
- message: '',
- predictions: [ 'tsn deep' ],
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: {
- value: mockCommands.commands.tsnDeep,
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: '',
- completed: true,
- }
- },
- */
- {
- setup: 'context',
- check: {
- input: 'context',
- hints: ' [prefix]',
- markup: 'VVVVVVV',
- status: 'VALID',
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: { value: undefined, arg: '', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Command prefix is unset',
- completed: true,
- type: 'string',
- error: false
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_date.js b/browser/devtools/commandline/test/browser_gcli_date.js
deleted file mode 100644
index 43359c202..000000000
--- a/browser/devtools/commandline/test/browser_gcli_date.js
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testDate.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-
-var types = require('gcli/types');
-var Argument = require('gcli/argument').Argument;
-var Status = require('gcli/types').Status;
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-
-exports.testParse = function(options) {
- var date = types.createType('date');
- return date.parse(new Argument('now')).then(function(conversion) {
- // Date comparison - these 2 dates may not be the same, but how close is
- // close enough? If this test takes more than 30secs to run the it will
- // probably time out, so we'll assume that these 2 values must be within
- // 1 min of each other
- var gap = new Date().getTime() - conversion.value.getTime();
- assert.ok(gap < 60000, 'now is less than a minute away');
-
- assert.is(conversion.getStatus(), Status.VALID, 'now parse');
- });
-};
-
-exports.testMaxMin = function(options) {
- var max = new Date();
- var min = new Date();
- var date = types.createType({ name: 'date', max: max, min: min });
- assert.is(date.getMax(), max, 'max setup');
-
- var incremented = date.increment(min);
- assert.is(incremented, max, 'incremented');
-};
-
-exports.testIncrement = function(options) {
- var date = types.createType('date');
- return date.parse(new Argument('now')).then(function(conversion) {
- var plusOne = date.increment(conversion.value);
- var minusOne = date.decrement(plusOne);
-
- // See comments in testParse
- var gap = new Date().getTime() - minusOne.getTime();
- assert.ok(gap < 60000, 'now is less than a minute away');
- });
-};
-
-exports.testInput = function(options) {
- helpers.audit(options, [
- {
- setup: 'tsdate 2001-01-01 1980-01-03',
- check: {
- input: 'tsdate 2001-01-01 1980-01-03',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- message: '',
- args: {
- command: { name: 'tsdate' },
- d1: {
- value: function(d1) {
- assert.is(d1.getFullYear(), 2001, 'd1 year');
- assert.is(d1.getMonth(), 0, 'd1 month');
- assert.is(d1.getDate(), 1, 'd1 date');
- assert.is(d1.getHours(), 0, 'd1 hours');
- assert.is(d1.getMinutes(), 0, 'd1 minutes');
- assert.is(d1.getSeconds(), 0, 'd1 seconds');
- assert.is(d1.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' 2001-01-01',
- status: 'VALID',
- message: ''
- },
- d2: {
- value: function(d2) {
- assert.is(d2.getFullYear(), 1980, 'd1 year');
- assert.is(d2.getMonth(), 0, 'd1 month');
- assert.is(d2.getDate(), 3, 'd1 date');
- assert.is(d2.getHours(), 0, 'd1 hours');
- assert.is(d2.getMinutes(), 0, 'd1 minutes');
- assert.is(d2.getSeconds(), 0, 'd1 seconds');
- assert.is(d2.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' 1980-01-03',
- status: 'VALID',
- message: ''
- },
- }
- },
- exec: {
- output: [ /^Exec: tsdate/, /2001/, /1980/ ],
- completed: true,
- type: 'string',
- error: false
- }
- }
- ]);
-};
-
-exports.testIncrDecr = function(options) {
- helpers.audit(options, [
- {
- setup: 'tsdate 2001-01-01<UP>',
- check: {
- input: 'tsdate 2001-01-02',
- hints: ' <d2>',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsdate' },
- d1: {
- value: function(d1) {
- assert.is(d1.getFullYear(), 2001, 'd1 year');
- assert.is(d1.getMonth(), 0, 'd1 month');
- assert.is(d1.getDate(), 2, 'd1 date');
- assert.is(d1.getHours(), 0, 'd1 hours');
- assert.is(d1.getMinutes(), 0, 'd1 minutes');
- assert.is(d1.getSeconds(), 0, 'd1 seconds');
- assert.is(d1.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' 2001-01-02',
- status: 'VALID',
- message: ''
- },
- d2: {
- value: undefined,
- status: 'INCOMPLETE',
- message: ''
- },
- }
- }
- },
- {
- // Check wrapping on decrement
- setup: 'tsdate 2001-02-01<DOWN>',
- check: {
- input: 'tsdate 2001-01-31',
- hints: ' <d2>',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsdate' },
- d1: {
- value: function(d1) {
- assert.is(d1.getFullYear(), 2001, 'd1 year');
- assert.is(d1.getMonth(), 0, 'd1 month');
- assert.is(d1.getDate(), 31, 'd1 date');
- assert.is(d1.getHours(), 0, 'd1 hours');
- assert.is(d1.getMinutes(), 0, 'd1 minutes');
- assert.is(d1.getSeconds(), 0, 'd1 seconds');
- assert.is(d1.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' 2001-01-31',
- status: 'VALID',
- message: ''
- },
- d2: {
- value: undefined,
- status: 'INCOMPLETE',
- message: ''
- },
- }
- }
- },
- {
- // Check 'max' value capping on increment
- setup: 'tsdate 2001-02-01 "27 feb 2000"<UP>',
- check: {
- input: 'tsdate 2001-02-01 "2000-02-28"',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- message: '',
- args: {
- command: { name: 'tsdate' },
- d1: {
- value: function(d1) {
- assert.is(d1.getFullYear(), 2001, 'd1 year');
- assert.is(d1.getMonth(), 1, 'd1 month');
- assert.is(d1.getDate(), 1, 'd1 date');
- assert.is(d1.getHours(), 0, 'd1 hours');
- assert.is(d1.getMinutes(), 0, 'd1 minutes');
- assert.is(d1.getSeconds(), 0, 'd1 seconds');
- assert.is(d1.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' 2001-02-01',
- status: 'VALID',
- message: ''
- },
- d2: {
- value: function(d1) {
- assert.is(d1.getFullYear(), 2000, 'd1 year');
- assert.is(d1.getMonth(), 1, 'd1 month');
- assert.is(d1.getDate(), 28, 'd1 date');
- assert.is(d1.getHours(), 0, 'd1 hours');
- assert.is(d1.getMinutes(), 0, 'd1 minutes');
- assert.is(d1.getSeconds(), 0, 'd1 seconds');
- assert.is(d1.getMilliseconds(), 0, 'd1 millis');
- },
- arg: ' "2000-02-28"',
- status: 'VALID',
- message: ''
- },
- }
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_exec.js b/browser/devtools/commandline/test/browser_gcli_exec.js
deleted file mode 100644
index 719442a0b..000000000
--- a/browser/devtools/commandline/test/browser_gcli_exec.js
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testExec.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-var nodetype = require('gcli/types/node');
-var canon = require('gcli/canon');
-// var assert = require('test/assert');
-// var mockCommands = require('gclitest/mockCommands');
-// var helpers = require('gclitest/helpers');
-
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-var mockBody = {
- style: {}
-};
-
-var mockDoc = {
- querySelectorAll: function(css) {
- if (css === ':root') {
- return {
- length: 1,
- item: function(i) {
- return mockBody;
- }
- };
- }
- else {
- return {
- length: 0,
- item: function() { return null; }
- };
- }
- }
-};
-
-exports.testParamGroup = function(options) {
- var tsg = canon.getCommand('tsg');
-
- assert.is(tsg.params[0].groupName, null, 'tsg param 0 group null');
- assert.is(tsg.params[1].groupName, 'First', 'tsg param 1 group First');
- assert.is(tsg.params[2].groupName, 'First', 'tsg param 2 group First');
- assert.is(tsg.params[3].groupName, 'Second', 'tsg param 3 group Second');
- assert.is(tsg.params[4].groupName, 'Second', 'tsg param 4 group Second');
-};
-
-exports.testWithHelpers = function(options) {
- return helpers.audit(options, [
- {
- skipIf: options.isJsdom,
- setup: 'tss',
- check: {
- input: 'tss',
- hints: '',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tss' },
- }
- },
- exec: {
- output: 'Exec: tss',
- completed: true,
- }
- },
- {
- setup: 'tsv option1 10',
- check: {
- input: 'tsv option1 10',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'optionValue',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option1,
- arg: ' option1',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: '10',
- arg: ' 10',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsv optionType=[object Object], optionValue=10',
- completed: true
- }
- },
- {
- setup: 'tsv option2 10',
- check: {
- input: 'tsv option2 10',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'optionValue',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsv' },
- optionType: {
- value: mockCommands.option2,
- arg: ' option2',
- status: 'VALID',
- message: ''
- },
- optionValue: {
- value: 10,
- arg: ' 10',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsv optionType=[object Object], optionValue=10',
- completed: true
- }
- }
- ]);
-};
-
-exports.testExecText = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsr fred',
- check: {
- input: 'tsr fred',
- hints: '',
- markup: 'VVVVVVVV',
- cursor: 8,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'fred',
- arg: ' fred',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsr text=fred',
- completed: true,
- }
- },
- {
- setup: 'tsr fred bloggs',
- check: {
- input: 'tsr fred bloggs',
- hints: '',
- markup: 'VVVVVVVVVVVVVVV',
- cursor: 15,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'fred bloggs',
- arg: ' fred bloggs',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsr text=fred bloggs',
- completed: true,
- }
- },
- {
- setup: 'tsr "fred bloggs"',
- check: {
- input: 'tsr "fred bloggs"',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- cursor: 17,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'fred bloggs',
- arg: ' "fred bloggs"',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsr text=fred bloggs',
- completed: true,
- }
- },
- {
- setup: 'tsr "fred bloggs',
- check: {
- input: 'tsr "fred bloggs',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVV',
- cursor: 16,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsr' },
- text: {
- value: 'fred bloggs',
- arg: ' "fred bloggs',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsr text=fred bloggs',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecBoolean = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsb',
- check: {
- input: 'tsb',
- hints: ' [toggle]',
- markup: 'VVV',
- cursor: 3,
- current: '__command',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsb' },
- toggle: {
- value: false,
- arg: '',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsb toggle=false',
- completed: true,
- }
- },
- {
- setup: 'tsb --toggle',
- check: {
- input: 'tsb --toggle',
- hints: '',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: 'toggle',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- outputState: 'false:default',
- args: {
- command: { name: 'tsb' },
- toggle: {
- value: true,
- arg: ' --toggle',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsb toggle=true',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecNumber = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsu 10',
- check: {
- input: 'tsu 10',
- hints: '',
- markup: 'VVVVVV',
- cursor: 6,
- current: 'num',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: { value: 10, arg: ' 10', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsu num=10',
- completed: true,
- }
- },
- {
- setup: 'tsu --num 10',
- check: {
- input: 'tsu --num 10',
- hints: '',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: 'num',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsu' },
- num: { value: 10, arg: ' --num 10', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsu num=10',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecScript = function(options) {
- return helpers.audit(options, [
- {
- // Bug 704829 - Enable GCLI Javascript parameters
- // The answer to this should be 2
- setup: 'tsj { 1 + 1 }',
- check: {
- input: 'tsj { 1 + 1 }',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- cursor: 13,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsj' },
- javascript: {
- value: '1 + 1',
- arg: ' { 1 + 1 }',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Exec: tsj javascript=1 + 1',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecNode = function(options) {
- var origDoc = nodetype.getDocument();
- nodetype.setDocument(mockDoc);
-
- return helpers.audit(options, [
- {
- setup: 'tse :root',
- check: {
- input: 'tse :root',
- hints: ' [options]',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'node',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tse' },
- node: { value: mockBody, arg: ' :root', status: 'VALID', message: '' },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: '', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tse node=[object Object], nodes=[object Object], nodes2=[object Object]',
- completed: true,
- },
- post: function() {
- nodetype.setDocument(origDoc);
- }
- }
- ]);
-};
-
-exports.testExecSubCommand = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsn dif fred',
- check: {
- input: 'tsn dif fred',
- hints: '',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn dif' },
- text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsnDif text=fred',
- completed: true,
- }
- },
- {
- setup: 'tsn exten fred',
- check: {
- input: 'tsn exten fred',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn exten' },
- text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsnExten text=fred',
- completed: true,
- }
- },
- {
- setup: 'tsn extend fred',
- check: {
- input: 'tsn extend fred',
- hints: '',
- markup: 'VVVVVVVVVVVVVVV',
- cursor: 15,
- current: 'text',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsn extend' },
- text: { value: 'fred', arg: ' fred', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsnExtend text=fred',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecArray = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tselarr 1',
- check: {
- input: 'tselarr 1',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'num',
- status: 'VALID',
- predictions: ['1'],
- unassigned: [ ],
- outputState: 'false:default',
- args: {
- command: { name: 'tselarr' },
- num: { value: '1', arg: ' 1', status: 'VALID', message: '' },
- arr: { /*value:,*/ arg: '{}', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tselarr num=1, arr=',
- completed: true,
- }
- },
- {
- setup: 'tselarr 1 a',
- check: {
- input: 'tselarr 1 a',
- hints: '',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'arr',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tselarr' },
- num: { value: '1', arg: ' 1', status: 'VALID', message: '' },
- arr: { /*value:a,*/ arg: '{ a}', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tselarr num=1, arr=a',
- completed: true,
- }
- },
- {
- setup: 'tselarr 1 a b',
- check: {
- input: 'tselarr 1 a b',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- cursor: 13,
- current: 'arr',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tselarr' },
- num: { value: '1', arg: ' 1', status: 'VALID', message: '' },
- arr: { /*value:a,b,*/ arg: '{ a, b}', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tselarr num=1, arr=a,b',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecMultiple = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsm a 10 10',
- check: {
- input: 'tsm a 10 10',
- hints: '',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'num',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'tsm' },
- abc: { value: 'a', arg: ' a', status: 'VALID', message: '' },
- txt: { value: '10', arg: ' 10', status: 'VALID', message: '' },
- num: { value: 10, arg: ' 10', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsm abc=a, txt=10, num=10',
- completed: true,
- }
- }
- ]);
-};
-
-exports.testExecDefaults = function(options) {
- return helpers.audit(options, [
- {
- // Bug 707009 - GCLI doesn't always fill in default parameters properly
- setup: 'tsg aaa',
- check: {
- input: 'tsg aaa',
- hints: ' [options]',
- markup: 'VVVVVVV',
- cursor: 7,
- current: 'solo',
- status: 'VALID',
- predictions: ['aaa'],
- unassigned: [ ],
- args: {
- command: { name: 'tsg' },
- solo: { value: 'aaa', arg: ' aaa', status: 'VALID', message: '' },
- txt1: { value: undefined, arg: '', status: 'VALID', message: '' },
- bool: { value: false, arg: '', status: 'VALID', message: '' },
- txt2: { value: undefined, arg: '', status: 'VALID', message: '' },
- num: { value: undefined, arg: '', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: 'Exec: tsg solo=aaa, txt1=null, bool=false, txt2=d, num=42',
- completed: true,
- }
- }
- ]);
-
-};
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_fail.js b/browser/devtools/commandline/test/browser_gcli_fail.js
deleted file mode 100644
index da7b7db91..000000000
--- a/browser/devtools/commandline/test/browser_gcli_fail.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testFail.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-var cli = require('gcli/cli');
-
-var origLogErrors = undefined;
-
-exports.setup = function(options) {
- mockCommands.setup();
-
- origLogErrors = cli.logErrors;
- cli.logErrors = false;
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-
- cli.logErrors = origLogErrors;
- origLogErrors = undefined;
-};
-
-exports.testBasic = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsfail reject',
- exec: {
- completed: false,
- output: 'rejected promise',
- type: 'error',
- error: true
- }
- },
- {
- setup: 'tsfail rejecttyped',
- exec: {
- completed: false,
- output: '54',
- type: 'number',
- error: true
- }
- },
- {
- setup: 'tsfail throwerror',
- exec: {
- completed: true,
- output: 'Error: thrown error',
- type: 'error',
- error: true
- }
- },
- {
- setup: 'tsfail throwstring',
- exec: {
- completed: true,
- output: 'thrown string',
- type: 'error',
- error: true
- }
- },
- {
- setup: 'tsfail noerror',
- exec: {
- completed: true,
- output: 'no error',
- type: 'string',
- error: false
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_focus.js b/browser/devtools/commandline/test/browser_gcli_focus.js
deleted file mode 100644
index 67e3e722b..000000000
--- a/browser/devtools/commandline/test/browser_gcli_focus.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testFocus.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testBasic = function(options) {
- return helpers.audit(options, [
- {
- skipRemainingIf: options.isJsdom,
- name: 'exec setup',
- setup: function() {
- // Just check that we've got focus, and everything is clear
- helpers.focusInput(options);
- return helpers.setInput(options, 'help');
- },
- check: { },
- exec: { }
- },
- {
- setup: 'tsn deep',
- check: {
- input: 'tsn deep',
- hints: '',
- markup: 'IIIVIIII',
- cursor: 8,
- status: 'ERROR',
- outputState: 'false:default',
- tooltipState: 'false:default'
- }
- },
- {
- setup: 'tsn deep<TAB><RETURN>',
- check: {
- input: 'tsn deep ',
- hints: '',
- markup: 'IIIIIIIIV',
- cursor: 9,
- status: 'ERROR',
- outputState: 'false:default',
- tooltipState: 'true:isError'
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_history.js b/browser/devtools/commandline/test/browser_gcli_history.js
deleted file mode 100644
index c333e2f8a..000000000
--- a/browser/devtools/commandline/test/browser_gcli_history.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testHistory.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var History = require('gcli/history').History;
-
-exports.testSimpleHistory = function (options) {
- var history = new History({});
- history.add('foo');
- history.add('bar');
- assert.is(history.backward(), 'bar');
- assert.is(history.backward(), 'foo');
-
- // Adding to the history again moves us back to the start of the history.
- history.add('quux');
- assert.is(history.backward(), 'quux');
- assert.is(history.backward(), 'bar');
- assert.is(history.backward(), 'foo');
-};
-
-exports.testBackwardsPastIndex = function (options) {
- var history = new History({});
- history.add('foo');
- history.add('bar');
- assert.is(history.backward(), 'bar');
- assert.is(history.backward(), 'foo');
-
- // Moving backwards past recorded history just keeps giving you the last
- // item.
- assert.is(history.backward(), 'foo');
-};
-
-exports.testForwardsPastIndex = function (options) {
- var history = new History({});
- history.add('foo');
- history.add('bar');
- assert.is(history.backward(), 'bar');
- assert.is(history.backward(), 'foo');
-
- // Going forward through the history again.
- assert.is(history.forward(), 'bar');
-
- // 'Present' time.
- assert.is(history.forward(), '');
-
- // Going to the 'future' just keeps giving us the empty string.
- assert.is(history.forward(), '');
-};
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_incomplete.js b/browser/devtools/commandline/test/browser_gcli_incomplete.js
deleted file mode 100644
index f0e986a46..000000000
--- a/browser/devtools/commandline/test/browser_gcli_incomplete.js
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testIncomplete.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testBasic = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsu 2 extra',
- check: {
- args: {
- num: { value: 2, type: 'Argument' }
- }
- },
- post: function() {
- var requisition = options.display.requisition;
-
- assert.is(requisition._unassigned.length,
- 1,
- 'single unassigned: tsu 2 extra');
- assert.is(requisition._unassigned[0].param.type.isIncompleteName,
- false,
- 'unassigned.isIncompleteName: tsu 2 extra');
- }
- },
- {
- setup: 'tsu',
- check: {
- args: {
- num: { value: undefined, type: 'BlankArgument' }
- }
- }
- },
- {
- setup: 'tsg',
- check: {
- args: {
- solo: { type: 'BlankArgument' },
- txt1: { type: 'BlankArgument' },
- bool: { type: 'BlankArgument' },
- txt2: { type: 'BlankArgument' },
- num: { type: 'BlankArgument' }
- }
- }
- },
- ]);
-};
-
-exports.testCompleted = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsela<TAB>',
- check: {
- args: {
- command: { name: 'tselarr', type: 'Argument' },
- num: { type: 'BlankArgument' },
- arr: { type: 'ArrayArgument' }
- }
- }
- },
- {
- setup: 'tsn dif ',
- check: {
- input: 'tsn dif ',
- hints: '<text>',
- markup: 'VVVVVVVV',
- cursor: 8,
- status: 'ERROR',
- args: {
- command: { name: 'tsn dif', type: 'MergedArgument' },
- text: { type: 'BlankArgument', status: 'INCOMPLETE' }
- }
- }
- },
- {
- setup: 'tsn di<TAB>',
- check: {
- input: 'tsn dif ',
- hints: '<text>',
- markup: 'VVVVVVVV',
- cursor: 8,
- status: 'ERROR',
- args: {
- command: { name: 'tsn dif', type: 'Argument' },
- text: { type: 'BlankArgument', status: 'INCOMPLETE' }
- }
- }
- },
- // The above 2 tests take different routes to 'tsn dif '.
- // The results should be similar. The difference is in args.command.type.
- {
- setup: 'tsg -',
- check: {
- input: 'tsg -',
- hints: '-txt1 <solo> [options]',
- markup: 'VVVVI',
- cursor: 5,
- status: 'ERROR',
- args: {
- solo: { value: undefined, status: 'INCOMPLETE' },
- txt1: { value: undefined, status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- txt2: { value: undefined, status: 'VALID' },
- num: { value: undefined, status: 'VALID' }
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tsg -<TAB>',
- check: {
- input: 'tsg --txt1 ',
- hints: '<string> <solo> [options]',
- markup: 'VVVVIIIIIIV',
- cursor: 11,
- status: 'ERROR',
- args: {
- solo: { value: undefined, status: 'INCOMPLETE' },
- txt1: { value: undefined, status: 'INCOMPLETE' },
- bool: { value: false, status: 'VALID' },
- txt2: { value: undefined, status: 'VALID' },
- num: { value: undefined, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tsg --txt1 fred',
- check: {
- input: 'tsg --txt1 fred',
- hints: ' <solo> [options]',
- markup: 'VVVVVVVVVVVVVVV',
- status: 'ERROR',
- args: {
- solo: { value: undefined, status: 'INCOMPLETE' },
- txt1: { value: 'fred', status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- txt2: { value: undefined, status: 'VALID' },
- num: { value: undefined, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tscook key value --path path --',
- check: {
- input: 'tscook key value --path path --',
- hints: 'domain [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVII',
- status: 'ERROR',
- args: {
- key: { value: 'key', status: 'VALID' },
- value: { value: 'value', status: 'VALID' },
- path: { value: 'path', status: 'VALID' },
- domain: { value: undefined, status: 'VALID' },
- secure: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tscook key value --path path --domain domain --',
- check: {
- input: 'tscook key value --path path --domain domain --',
- hints: 'secure [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVII',
- status: 'ERROR',
- args: {
- key: { value: 'key', status: 'VALID' },
- value: { value: 'value', status: 'VALID' },
- path: { value: 'path', status: 'VALID' },
- domain: { value: 'domain', status: 'VALID' },
- secure: { value: false, status: 'VALID' }
- }
- }
- }
- ]);
-
-};
-
-exports.testCase = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsg AA',
- check: {
- input: 'tsg AA',
- hints: ' [options] -> aaa',
- markup: 'VVVVII',
- status: 'ERROR',
- args: {
- solo: { value: undefined, text: 'AA', status: 'INCOMPLETE' },
- txt1: { value: undefined, status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- txt2: { value: undefined, status: 'VALID' },
- num: { value: undefined, status: 'VALID' }
- }
- }
- },
- ]);
-};
-
-exports.testIncomplete = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsm a a -',
- check: {
- args: {
- abc: { value: 'a', type: 'Argument' },
- txt: { value: 'a', type: 'Argument' },
- num: { value: undefined, arg: ' -', type: 'Argument', status: 'INCOMPLETE' }
- }
- }
- },
- {
- setup: 'tsg -',
- check: {
- args: {
- solo: { type: 'BlankArgument' },
- txt1: { type: 'BlankArgument' },
- bool: { type: 'BlankArgument' },
- txt2: { type: 'BlankArgument' },
- num: { type: 'BlankArgument' }
- }
- },
- post: function() {
- var requisition = options.display.requisition;
-
- assert.is(requisition._unassigned[0],
- requisition.getAssignmentAt(5),
- 'unassigned -');
- assert.is(requisition._unassigned.length,
- 1,
- 'single unassigned - tsg -');
- assert.is(requisition._unassigned[0].param.type.isIncompleteName,
- true,
- 'unassigned.isIncompleteName: tsg -');
- }
- },
- ]);
-};
-
-exports.testHidden = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tshidde',
- check: {
- input: 'tshidde',
- hints: ' -> tse',
- status: 'ERROR'
- }
- },
- {
- setup: 'tshidden',
- check: {
- input: 'tshidden',
- hints: ' [options]',
- markup: 'VVVVVVVV',
- status: 'VALID',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --vis',
- check: {
- input: 'tshidden --vis',
- hints: 'ible [options]',
- markup: 'VVVVVVVVVIIIII',
- status: 'ERROR',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --invisiblestrin',
- check: {
- input: 'tshidden --invisiblestrin',
- hints: ' [options]',
- markup: 'VVVVVVVVVEEEEEEEEEEEEEEEE',
- status: 'ERROR',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --invisiblestring',
- check: {
- input: 'tshidden --invisiblestring',
- hints: ' <string> [options]',
- markup: 'VVVVVVVVVIIIIIIIIIIIIIIIII',
- status: 'ERROR',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'INCOMPLETE' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --invisiblestring x',
- check: {
- input: 'tshidden --invisiblestring x',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: 'x', status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --invisibleboolea',
- check: {
- input: 'tshidden --invisibleboolea',
- hints: ' [options]',
- markup: 'VVVVVVVVVEEEEEEEEEEEEEEEEE',
- status: 'ERROR',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --invisibleboolean',
- check: {
- input: 'tshidden --invisibleboolean',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- visible: { value: undefined, status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: true, status: 'VALID' }
- }
- }
- },
- {
- setup: 'tshidden --visible xxx',
- check: {
- input: 'tshidden --visible xxx',
- markup: 'VVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- hints: '',
- args: {
- visible: { value: 'xxx', status: 'VALID' },
- invisiblestring: { value: undefined, status: 'VALID' },
- invisibleboolean: { value: false, status: 'VALID' }
- }
- }
- },
- ]);
-};
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_inputter.js b/browser/devtools/commandline/test/browser_gcli_inputter.js
deleted file mode 100644
index a065c4b74..000000000
--- a/browser/devtools/commandline/test/browser_gcli_inputter.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testInputter.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-var KeyEvent = require('util/util').KeyEvent;
-// var assert = require('test/assert');
-// var mockCommands = require('gclitest/mockCommands');
-
-var latestEvent = undefined;
-var latestData = undefined;
-
-var outputted = function(ev) {
- latestEvent = ev;
-
- ev.output.promise.then(function() {
- latestData = ev.output.data;
- ev.output.onClose();
- });
-};
-
-
-exports.setup = function(options) {
- mockCommands.setup();
- options.display.requisition.commandOutputManager.onOutput.add(outputted);
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
- options.display.requisition.commandOutputManager.onOutput.remove(outputted);
-};
-
-exports.testOutput = function(options) {
- latestEvent = undefined;
- latestData = undefined;
-
- var inputter = options.display.inputter;
- var focusManager = options.display.focusManager;
-
- inputter.setInput('tss');
-
- var ev0 = { keyCode: KeyEvent.DOM_VK_RETURN };
- inputter.onKeyDown(ev0);
-
- assert.is(inputter.element.value, 'tss', 'inputter should do nothing on RETURN keyDown');
- assert.is(latestEvent, undefined, 'no events this test');
- assert.is(latestData, undefined, 'no data this test');
-
- var ev1 = { keyCode: KeyEvent.DOM_VK_RETURN };
- return inputter.handleKeyUp(ev1).then(function() {
- assert.ok(latestEvent != null, 'events this test');
- assert.is(latestData, 'Exec: tss ', 'last command is tss');
-
- assert.is(inputter.element.value, '', 'inputter should exec on RETURN keyUp');
-
- assert.ok(focusManager._recentOutput, 'recent output happened');
-
- var ev2 = { keyCode: KeyEvent.DOM_VK_F1 };
- return inputter.handleKeyUp(ev2).then(function() {
- assert.ok(!focusManager._recentOutput, 'no recent output happened post F1');
- assert.ok(focusManager._helpRequested, 'F1 = help');
-
- var ev3 = { keyCode: KeyEvent.DOM_VK_ESCAPE };
- return inputter.handleKeyUp(ev3).then(function() {
- assert.ok(!focusManager._helpRequested, 'ESCAPE = anti help');
- });
- });
-
- });
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_intro.js b/browser/devtools/commandline/test/browser_gcli_intro.js
deleted file mode 100644
index 6d4e227de..000000000
--- a/browser/devtools/commandline/test/browser_gcli_intro.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testIntro.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-var canon = require('gcli/canon');
-
-exports.testIntroStatus = function(options) {
- return helpers.audit(options, [
- {
- skipRemainingIf: function commandIntroMissing() {
- return canon.getCommand('intro') == null;
- },
- setup: 'intro',
- check: {
- typed: 'intro',
- markup: 'VVVVV',
- status: 'VALID',
- hints: ''
- }
- },
- {
- setup: 'intro foo',
- check: {
- typed: 'intro foo',
- markup: 'VVVVVVEEE',
- status: 'ERROR',
- hints: ''
- }
- },
- {
- setup: 'intro',
- check: {
- typed: 'intro',
- markup: 'VVVVV',
- status: 'VALID',
- hints: ''
- },
- exec: {
- output: [
- /command\s*line/,
- /help/,
- /F1/,
- /Escape/
- ]
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_js.js b/browser/devtools/commandline/test/browser_gcli_js.js
deleted file mode 100644
index ef315d6fb..000000000
--- a/browser/devtools/commandline/test/browser_gcli_js.js
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testJs.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-// var helpers = require('gclitest/helpers');
-var javascript = require('gcli/types/javascript');
-var canon = require('gcli/canon');
-
-var tempWindow = undefined;
-
-exports.setup = function(options) {
- tempWindow = javascript.getGlobalObject();
- Object.defineProperty(options.window, 'donteval', {
- get: function() {
- assert.ok(false, 'donteval should not be used');
- return { cant: '', touch: '', 'this': '' };
- },
- enumerable: true,
- configurable : true
- });
- javascript.setGlobalObject(options.window);
-};
-
-exports.shutdown = function(options) {
- javascript.setGlobalObject(tempWindow);
- tempWindow = undefined;
- delete options.window.donteval;
-};
-
-exports.testBasic = function(options) {
- return helpers.audit(options, [
- {
- skipRemainingIf: function commandJsMissing() {
- return canon.getCommand('{') == null;
- },
- setup: '{',
- check: {
- input: '{',
- hints: '',
- markup: 'V',
- cursor: 1,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: undefined,
- arg: '{',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ ',
- check: {
- input: '{ ',
- hints: '',
- markup: 'VV',
- cursor: 2,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: undefined,
- arg: '{ ',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ w',
- check: {
- input: '{ w',
- hints: 'indow',
- markup: 'VVI',
- cursor: 3,
- current: 'javascript',
- status: 'ERROR',
- predictionsContains: [ 'window' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'w',
- arg: '{ w',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ windo',
- check: {
- input: '{ windo',
- hints: 'w',
- markup: 'VVIIIII',
- cursor: 7,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ 'window' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'windo',
- arg: '{ windo',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ window',
- check: {
- input: '{ window',
- hints: '',
- markup: 'VVVVVVVV',
- cursor: 8,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'window',
- arg: '{ window',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ window.do',
- check: {
- input: '{ window.do',
- hints: 'cument',
- markup: 'VVIIIIIIIII',
- cursor: 11,
- current: 'javascript',
- status: 'ERROR',
- predictionsContains: [ 'window.document' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'window.do',
- arg: '{ window.do',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ window.document.title',
- check: {
- input: '{ window.document.title',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVV',
- cursor: 23,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'window.document.title',
- arg: '{ window.document.title',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testDocument = function(options) {
- return helpers.audit(options, [
- {
- skipRemainingIf: function commandJsMissing() {
- return canon.getCommand('{') == null;
- },
- setup: '{ docu',
- check: {
- input: '{ docu',
- hints: 'ment',
- markup: 'VVIIII',
- cursor: 6,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ 'document' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'docu',
- arg: '{ docu',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ docu<TAB>',
- check: {
- input: '{ document',
- hints: '',
- markup: 'VVVVVVVVVV',
- cursor: 10,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'document',
- arg: '{ document',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ document.titl',
- check: {
- input: '{ document.titl',
- hints: 'e',
- markup: 'VVIIIIIIIIIIIII',
- cursor: 15,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ 'document.title' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'document.titl',
- arg: '{ document.titl',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: '{ document.titl<TAB>',
- check: {
- input: '{ document.title ',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- cursor: 17,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'document.title',
- arg: '{ document.title ',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ document.title',
- check: {
- input: '{ document.title',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVV',
- cursor: 16,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'document.title',
- arg: '{ document.title',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testDonteval = function(options) {
- if (!options.isJsdom) {
- // jsdom causes an eval here, maybe that's node/v8?
- assert.ok('donteval' in options.window, 'donteval exists');
- }
-
- return helpers.audit(options, [
- {
- skipRemainingIf: function commandJsMissing() {
- return canon.getCommand('{') == null;
- },
- setup: '{ don',
- check: {
- input: '{ don',
- hints: 'teval',
- markup: 'VVIII',
- cursor: 5,
- current: 'javascript',
- status: 'ERROR',
- predictions: [ 'donteval' ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'don',
- arg: '{ don',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ donteval',
- check: {
- input: '{ donteval',
- hints: '',
- markup: 'VVVVVVVVVV',
- cursor: 10,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'donteval',
- arg: '{ donteval',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- /*
- // 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
- {
- setup: '{ donteval.',
- check: {
- input: '{ donteval.',
- hints: '',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'donteval.',
- arg: '{ donteval.',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- */
- {
- setup: '{ donteval.cant',
- check: {
- input: '{ donteval.cant',
- hints: '',
- markup: 'VVVVVVVVVVVVVVV',
- cursor: 15,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'donteval.cant',
- arg: '{ donteval.cant',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: '{ donteval.xxx',
- check: {
- input: '{ donteval.xxx',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'javascript',
- status: 'VALID',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: '{' },
- javascript: {
- value: 'donteval.xxx',
- arg: '{ donteval.xxx',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_keyboard1.js b/browser/devtools/commandline/test/browser_gcli_keyboard1.js
deleted file mode 100644
index ea9ad4a73..000000000
--- a/browser/devtools/commandline/test/browser_gcli_keyboard1.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testKeyboard1.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testComplete = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsn e<DOWN><DOWN><DOWN><DOWN><DOWN><TAB>',
- check: { input: 'tsn exte ' }
- },
- {
- setup: 'tsn e<DOWN><DOWN><DOWN><DOWN><TAB>',
- check: { input: 'tsn ext ' }
- },
- {
- setup: 'tsn e<DOWN><DOWN><DOWN><TAB>',
- check: { input: 'tsn extend ' }
- },
- {
- setup: 'tsn e<DOWN><DOWN><TAB>',
- check: { input: 'tsn exten ' }
- },
- {
- setup: 'tsn e<DOWN><TAB>',
- check: { input: 'tsn exte ' }
- },
- {
- setup: 'tsn e<TAB>',
- check: { input: 'tsn ext ' }
- },
- {
- setup: 'tsn e<UP><TAB>',
- check: { input: 'tsn extend ' }
- },
- {
- setup: 'tsn e<UP><UP><TAB>',
- check: { input: 'tsn exten ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><TAB>',
- check: { input: 'tsn exte ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><UP><TAB>',
- check: { input: 'tsn ext ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><UP><UP><TAB>',
- check: { input: 'tsn extend ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><UP><UP><UP><TAB>',
- check: { input: 'tsn exten ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><UP><UP><UP><UP><TAB>',
- check: { input: 'tsn exte ' }
- },
- {
- setup: 'tsn e<UP><UP><UP><UP><UP><UP><UP><UP><TAB>',
- check: { input: 'tsn ext ' }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_keyboard2.js b/browser/devtools/commandline/test/browser_gcli_keyboard2.js
deleted file mode 100644
index e6ab441d9..000000000
--- a/browser/devtools/commandline/test/browser_gcli_keyboard2.js
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testKeyboard2.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-// Bug 664377: Add tests for internal completion. i.e. "tsela<TAB> 1"
-
-exports.testSimple = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tsela<TAB>',
- check: { input: 'tselarr ', cursor: 8 }
- },
- {
- setup: 'tsn di<TAB>',
- check: { input: 'tsn dif ', cursor: 8 }
- },
- {
- setup: 'tsg a<TAB>',
- check: { input: 'tsg aaa ', cursor: 8 }
- }
- ]);
-};
-
-exports.testIncr = function(options) {
- return helpers.audit(options, [
- /*
- // We currently refuse to increment/decrement things with a non-valid
- // status which makes sense for many cases, and is a decent default.
- // However in theory we could do better, these tests are there for then
- {
- setup: 'tsu -70<UP>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -7<UP>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -6<UP>',
- check: { input: 'tsu -5' }
- },
- */
- {
- setup: 'tsu -5<UP>',
- check: { input: 'tsu -3' }
- },
- {
- setup: 'tsu -4<UP>',
- check: { input: 'tsu -3' }
- },
- {
- setup: 'tsu -3<UP>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu -2<UP>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu -1<UP>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu 0<UP>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 1<UP>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 2<UP>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 3<UP>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 4<UP>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 5<UP>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 6<UP>',
- check: { input: 'tsu 9' }
- },
- {
- setup: 'tsu 7<UP>',
- check: { input: 'tsu 9' }
- },
- {
- setup: 'tsu 8<UP>',
- check: { input: 'tsu 9' }
- },
- {
- setup: 'tsu 9<UP>',
- check: { input: 'tsu 10' }
- },
- {
- setup: 'tsu 10<UP>',
- check: { input: 'tsu 10' }
- }
- /*
- // See notes above
- {
- setup: 'tsu 100<UP>',
- check: { input: 'tsu 10' }
- }
- */
- ]);
-};
-
-exports.testDecr = function(options) {
- return helpers.audit(options, [
- /*
- // See notes at top of testIncr
- {
- setup: 'tsu -70<DOWN>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -7<DOWN>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -6<DOWN>',
- check: { input: 'tsu -5' }
- },
- */
- {
- setup: 'tsu -5<DOWN>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -4<DOWN>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -3<DOWN>',
- check: { input: 'tsu -5' }
- },
- {
- setup: 'tsu -2<DOWN>',
- check: { input: 'tsu -3' }
- },
- {
- setup: 'tsu -1<DOWN>',
- check: { input: 'tsu -3' }
- },
- {
- setup: 'tsu 0<DOWN>',
- check: { input: 'tsu -3' }
- },
- {
- setup: 'tsu 1<DOWN>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu 2<DOWN>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu 3<DOWN>',
- check: { input: 'tsu 0' }
- },
- {
- setup: 'tsu 4<DOWN>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 5<DOWN>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 6<DOWN>',
- check: { input: 'tsu 3' }
- },
- {
- setup: 'tsu 7<DOWN>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 8<DOWN>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 9<DOWN>',
- check: { input: 'tsu 6' }
- },
- {
- setup: 'tsu 10<DOWN>',
- check: { input: 'tsu 9' }
- }
- /*
- // See notes at top of testIncr
- {
- setup: 'tsu 100<DOWN>',
- check: { input: 'tsu 9' }
- }
- */
- ]);
-};
-
-exports.testIncrFloat = function(options) {
- return helpers.audit(options, [
- /*
- // See notes at top of testIncr
- {
- setup: 'tsf -70<UP>',
- check: { input: 'tsf -6.5' }
- },
- */
- {
- setup: 'tsf -6.5<UP>',
- check: { input: 'tsf -6' }
- },
- {
- setup: 'tsf -6<UP>',
- check: { input: 'tsf -4.5' }
- },
- {
- setup: 'tsf -4.5<UP>',
- check: { input: 'tsf -3' }
- },
- {
- setup: 'tsf -4<UP>',
- check: { input: 'tsf -3' }
- },
- {
- setup: 'tsf -3<UP>',
- check: { input: 'tsf -1.5' }
- },
- {
- setup: 'tsf -1.5<UP>',
- check: { input: 'tsf 0' }
- },
- {
- setup: 'tsf 0<UP>',
- check: { input: 'tsf 1.5' }
- },
- {
- setup: 'tsf 1.5<UP>',
- check: { input: 'tsf 3' }
- },
- {
- setup: 'tsf 2<UP>',
- check: { input: 'tsf 3' }
- },
- {
- setup: 'tsf 3<UP>',
- check: { input: 'tsf 4.5' }
- },
- {
- setup: 'tsf 5<UP>',
- check: { input: 'tsf 6' }
- }
- /*
- // See notes at top of testIncr
- {
- setup: 'tsf 100<UP>',
- check: { input: 'tsf -6.5' }
- }
- */
- ]);
-};
-
-exports.testDecrFloat = function(options) {
- return helpers.audit(options, [
- /*
- // See notes at top of testIncr
- {
- setup: 'tsf -70<DOWN>',
- check: { input: 'tsf 11.5' }
- },
- */
- {
- setup: 'tsf -6.5<DOWN>',
- check: { input: 'tsf -6.5' }
- },
- {
- setup: 'tsf -6<DOWN>',
- check: { input: 'tsf -6.5' }
- },
- {
- setup: 'tsf -4.5<DOWN>',
- check: { input: 'tsf -6' }
- },
- {
- setup: 'tsf -4<DOWN>',
- check: { input: 'tsf -4.5' }
- },
- {
- setup: 'tsf -3<DOWN>',
- check: { input: 'tsf -4.5' }
- },
- {
- setup: 'tsf -1.5<DOWN>',
- check: { input: 'tsf -3' }
- },
- {
- setup: 'tsf 0<DOWN>',
- check: { input: 'tsf -1.5' }
- },
- {
- setup: 'tsf 1.5<DOWN>',
- check: { input: 'tsf 0' }
- },
- {
- setup: 'tsf 2<DOWN>',
- check: { input: 'tsf 1.5' }
- },
- {
- setup: 'tsf 3<DOWN>',
- check: { input: 'tsf 1.5' }
- },
- {
- setup: 'tsf 5<DOWN>',
- check: { input: 'tsf 4.5' }
- }
- /*
- // See notes at top of testIncr
- {
- setup: 'tsf 100<DOWN>',
- check: { input: 'tsf 11.5' }
- }
- */
- ]);
-};
-
-exports.testIncrSelection = function(options) {
- /*
- // Bug 829516: GCLI up/down navigation over selection is sometimes bizarre
- return helpers.audit(options, [
- {
- setup: 'tselarr <DOWN>',
- check: { hints: '2' },
- exec: {}
- },
- {
- setup: 'tselarr <DOWN><DOWN>',
- check: { hints: '3' },
- exec: {}
- },
- {
- setup: 'tselarr <DOWN><DOWN><DOWN>',
- check: { hints: '1' },
- exec: {}
- }
- ]);
- */
-};
-
-exports.testDecrSelection = function(options) {
- /*
- // Bug 829516: GCLI up/down navigation over selection is sometimes bizarre
- return helpers.audit(options, [
- {
- setup: 'tselarr <UP>',
- check: { hints: '3' }
- }
- ]);
- */
-};
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_keyboard3.js b/browser/devtools/commandline/test/browser_gcli_keyboard3.js
deleted file mode 100644
index 90d577dfb..000000000
--- a/browser/devtools/commandline/test/browser_gcli_keyboard3.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testKeyboard3.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-var javascript = require('gcli/types/javascript');
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-var canon = require('gcli/canon');
-
-var tempWindow = undefined;
-
-exports.setup = function(options) {
- mockCommands.setup();
-
- tempWindow = javascript.getGlobalObject();
- javascript.setGlobalObject(options.window);
-};
-
-exports.shutdown = function(options) {
- javascript.setGlobalObject(tempWindow);
- tempWindow = undefined;
-
- mockCommands.shutdown();
-};
-
-exports.testScript = function(options) {
- return helpers.audit(options, [
- {
- skipIf: function commandJsMissing() {
- return canon.getCommand('{') == null;
- },
- setup: '{ wind<TAB>',
- check: { input: '{ window' }
- },
- {
- skipIf: function commandJsMissing() {
- return canon.getCommand('{') == null;
- },
- setup: '{ window.docum<TAB>',
- check: { input: '{ window.document' }
- }
- ]);
-};
-
-exports.testJsdom = function(options) {
- return helpers.audit(options, [
- {
- skipIf: function jsDomOrCommandJsMissing() {
- return options.isJsdom || canon.getCommand('{') == null;
- },
- setup: '{ window.document.titl<TAB>',
- check: { input: '{ window.document.title ' }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_menu.js b/browser/devtools/commandline/test/browser_gcli_menu.js
deleted file mode 100644
index 5ab3d8a34..000000000
--- a/browser/devtools/commandline/test/browser_gcli_menu.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testMenu.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testOptions = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tslong',
- check: {
- input: 'tslong',
- markup: 'VVVVVV',
- status: 'ERROR',
- hints: ' <msg> [options]',
- args: {
- msg: { value: undefined, status: 'INCOMPLETE' },
- num: { value: undefined, status: 'VALID' },
- sel: { value: undefined, status: 'VALID' },
- bool: { value: false, status: 'VALID' },
- bool2: { value: false, status: 'VALID' },
- sel2: { value: undefined, status: 'VALID' },
- num2: { value: undefined, status: 'VALID' }
- }
- }
- }
- ]);
-};
-
-
-// });
-
diff --git a/browser/devtools/commandline/test/browser_gcli_node.js b/browser/devtools/commandline/test/browser_gcli_node.js
deleted file mode 100644
index abddd94b4..000000000
--- a/browser/devtools/commandline/test/browser_gcli_node.js
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * 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(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testNode.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testNode = function(options) {
- return helpers.audit(options, [
- {
- setup: 'tse ',
- check: {
- input: 'tse ',
- hints: '<node> [options]',
- markup: 'VVVV',
- cursor: 4,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: { status: 'INCOMPLETE', message: '' },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- },
- {
- setup: 'tse :',
- check: {
- input: 'tse :',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: {
- arg: ' :',
- status: 'ERROR',
- message: 'Syntax error in CSS query'
- },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- },
- {
- setup: 'tse #',
- check: {
- input: 'tse #',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' #',
- status: 'ERROR',
- message: 'Syntax error in CSS query'
- },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- },
- {
- setup: 'tse .',
- check: {
- input: 'tse .',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' .',
- status: 'ERROR',
- message: 'Syntax error in CSS query'
- },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse *',
- check: {
- input: 'tse *',
- hints: ' [options]',
- markup: 'VVVVE',
- cursor: 5,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' *',
- status: 'ERROR'
- // message: 'Too many matches (128)'
- },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- }
- ]);
-};
-
-exports.testNodeDom = function(options) {
- var requisition = options.display.requisition;
-
- return helpers.audit(options, [
- {
- skipIf: options.isJsdom,
- setup: 'tse :root',
- check: {
- input: 'tse :root',
- hints: ' [options]',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'node',
- status: 'VALID',
- args: {
- command: { name: 'tse' },
- node: { arg: ' :root', status: 'VALID' },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse :root ',
- check: {
- input: 'tse :root ',
- hints: '[options]',
- markup: 'VVVVVVVVVV',
- cursor: 10,
- current: 'node',
- status: 'VALID',
- args: {
- command: { name: 'tse' },
- node: { arg: ' :root ', status: 'VALID' },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- },
- post: function() {
- assert.is(requisition.getAssignment('node').value.tagName,
- 'HTML',
- 'root id');
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse #gcli-nomatch',
- check: {
- input: 'tse #gcli-nomatch',
- hints: ' [options]',
- markup: 'VVVVIIIIIIIIIIIII',
- cursor: 17,
- current: 'node',
- status: 'ERROR',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: ' #gcli-nomatch',
- status: 'INCOMPLETE',
- message: 'No matches'
- },
- nodes: { status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- }
- }
- ]);
-};
-
-exports.testNodes = function(options) {
- var requisition = options.display.requisition;
-
- return helpers.audit(options, [
- {
- skipIf: options.isJsdom,
- setup: 'tse :root --nodes *',
- check: {
- input: 'tse :root --nodes *',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVV',
- current: 'nodes',
- status: 'VALID',
- args: {
- command: { name: 'tse' },
- node: { arg: ' :root', status: 'VALID' },
- nodes: { arg: ' --nodes *', status: 'VALID' },
- nodes2: { status: 'VALID' }
- }
- },
- post: function() {
- assert.is(requisition.getAssignment('node').value.tagName,
- 'HTML',
- '#gcli-input id');
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse :root --nodes2 div',
- check: {
- input: 'tse :root --nodes2 div',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVVVVVVVVVV',
- cursor: 22,
- current: 'nodes2',
- status: 'VALID',
- args: {
- command: { name: 'tse' },
- node: { arg: ' :root', status: 'VALID' },
- nodes: { status: 'VALID' },
- nodes2: { arg: ' --nodes2 div', status: 'VALID' }
- }
- },
- post: function() {
- assert.is(requisition.getAssignment('node').value.tagName,
- 'HTML',
- 'root id');
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse --nodes ffff',
- check: {
- input: 'tse --nodes ffff',
- hints: ' <node> [options]',
- markup: 'VVVVIIIIIIIVIIII',
- cursor: 16,
- current: 'nodes',
- status: 'ERROR',
- outputState: 'false:default',
- tooltipState: 'true:isError',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- },
- nodes: {
- value: undefined,
- arg: ' --nodes ffff',
- status: 'INCOMPLETE',
- message: 'No matches'
- },
- nodes2: { arg: '', status: 'VALID', message: '' }
- }
- },
- post: function() {
- /*
- assert.is(requisition.getAssignment('nodes2').value.constructor.name,
- 'NodeList',
- '#gcli-input id');
- */
- }
- },
- {
- skipIf: options.isJsdom,
- setup: 'tse --nodes2 ffff',
- check: {
- input: 'tse --nodes2 ffff',
- hints: ' <node> [options]',
- markup: 'VVVVVVVVVVVVVVVVV',
- cursor: 17,
- current: 'nodes2',
- status: 'ERROR',
- outputState: 'false:default',
- tooltipState: 'false:default',
- args: {
- command: { name: 'tse' },
- node: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- },
- nodes: { arg: '', status: 'VALID', message: '' },
- nodes2: { arg: ' --nodes2 ffff', status: 'VALID', message: '' }
- }
- },
- post: function() {
- /*
- assert.is(requisition.getAssignment('nodes').value.constructor.name,
- 'NodeList',
- '#gcli-input id');
- assert.is(requisition.getAssignment('nodes2').value.constructor.name,
- 'NodeList',
- '#gcli-input id');
- */
- }
- },
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_remote.js b/browser/devtools/commandline/test/browser_gcli_remote.js
deleted file mode 100644
index 4e5765d28..000000000
--- a/browser/devtools/commandline/test/browser_gcli_remote.js
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testRemote.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testRemote = function(options) {
- return helpers.audit(options, [
- {
- skipRemainingIf: !options.isHttp,
- setup: 'remote ',
- check: {
- input: 'remote ',
- hints: '',
- markup: 'EEEEEEV',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- options: [ ],
- message: 'Can\'t use \'remote\'.',
- predictions: [ ],
- unassigned: [ ],
- }
- },
- {
- setup: 'connect remote',
- check: {
- input: 'connect remote',
- hints: ' [options]',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'prefix',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'connect' },
- prefix: { value: 'remote', arg: ' remote', status: 'VALID', message: '' },
- host: { value: undefined, arg: '', status: 'VALID', message: '' },
- port: { value: undefined, arg: '', status: 'VALID', message: '' },
- }
- },
- exec: {
- output: /^Added [0-9]* commands.$/,
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote ',
- check: {
- input: 'remote ',
- hints: '',
- markup: 'IIIIIIV',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- optionsIncludes: [
- 'remote', 'remote cd', 'remote context', 'remote echo',
- 'remote exec', 'remote exit', 'remote firefox', 'remote help',
- 'remote intro', 'remote make'
- ],
- message: '',
- predictions: [ 'remote' ],
- unassigned: [ ],
- }
- },
- {
- setup: 'remote echo hello world',
- check: {
- input: 'remote echo hello world',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVV',
- cursor: 23,
- current: 'message',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote echo' },
- message: {
- value: 'hello world',
- arg: ' hello world',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'hello world',
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote exec ls',
- check: {
- input: 'remote exec ls',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'command',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: {
- value: 'ls',
- arg: ' ls',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- // output: '', We can't rely on the contents of the FS
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote sleep mistake',
- check: {
- input: 'remote sleep mistake',
- hints: '',
- markup: 'VVVVVVVVVVVVVEEEEEEE',
- cursor: 20,
- current: 'length',
- status: 'ERROR',
- options: [ ],
- message: 'Can\'t convert "mistake" to a number.',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote sleep' },
- length: {
- value: undefined,
- arg: ' mistake',
- status: 'ERROR',
- message: 'Can\'t convert "mistake" to a number.'
- }
- }
- }
- },
- {
- setup: 'remote sleep 1',
- check: {
- input: 'remote sleep 1',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'length',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote sleep' },
- length: { value: 1, arg: ' 1', status: 'VALID', message: '' }
- }
- },
- exec: {
- output: 'Done',
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote help ',
- skipIf: true, // The help command is not remotable
- check: {
- input: 'remote help ',
- hints: '[search]',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: 'search',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote help' },
- search: {
- value: undefined,
- arg: '',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: '',
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote intro',
- check: {
- input: 'remote intro',
- hints: '',
- markup: 'VVVVVVVVVVVV',
- cursor: 12,
- current: '__command',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote intro' }
- }
- },
- exec: {
- output: [
- /^This command line/,
- /F1\/Escape/
- ],
- completed: false,
- type: 'intro',
- error: false
- }
- },
- {
- setup: 'context remote',
- check: {
- input: 'context remote',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'prefix',
- status: 'VALID',
- optionsContains: [ 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', 'remote firefox', 'remote help', 'remote intro', 'remote make' ],
- message: '',
- predictionsContains: [ 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', 'remote firefox', 'remote help', 'remote intro', 'remote make', 'remote pref' ],
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: {
- /*value:[object Object],*/
- arg: ' remote',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: 'Using remote as a command prefix',
- completed: true,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'exec ls',
- check: {
- input: 'exec ls',
- hints: '',
- markup: 'VVVVVVV',
- cursor: 7,
- current: 'command',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { value: 'ls', arg: ' ls', status: 'VALID', message: '' },
- }
- },
- exec: {
- // output: '', We can't rely on the contents of the filesystem
- completed: false,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'echo hello world',
- check: {
- input: 'echo hello world',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVV',
- cursor: 16,
- current: 'message',
- status: 'VALID',
- options: [ ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'remote echo' },
- message: {
- value: 'hello world',
- arg: ' hello world',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: /^hello world$/,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'context',
- check: {
- input: 'context',
- hints: ' [prefix]',
- markup: 'VVVVVVV',
- cursor: 7,
- current: '__command',
- status: 'VALID',
- optionsContains: [ 'remote', 'remote cd', 'remote echo', 'remote exec', 'remote exit', 'remote firefox', 'remote help', 'remote intro', 'remote make' ],
- message: '',
- predictions: [ ],
- unassigned: [ ],
- args: {
- command: { name: 'context' },
- prefix: { value: undefined, arg: '', status: 'VALID', message: '' }
- }
- },
- exec: {
- output: 'Command prefix is unset',
- completed: true,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'disconnect ',
- check: {
- input: 'disconnect ',
- hints: 'remote',
- markup: 'VVVVVVVVVVV',
- cursor: 11,
- current: 'prefix',
- status: 'ERROR',
- options: [ 'remote' ],
- message: '',
- predictions: [ 'remote' ],
- unassigned: [ ],
- args: {
- command: { name: 'disconnect' },
- prefix: {
- value: undefined,
- arg: '',
- status: 'INCOMPLETE',
- message: ''
- }
- }
- }
- },
- {
- setup: 'disconnect remote --force',
- check: {
- input: 'disconnect remote --force',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVV',
- cursor: 25,
- current: 'force',
- status: 'VALID',
- message: '',
- unassigned: [ ],
- args: {
- command: { name: 'disconnect' },
- prefix: {
- value: function(connection) {
- assert.is(connection.prefix, 'remote', 'disconnecting remote');
- },
- arg: ' remote',
- status: 'VALID',
- message: ''
- }
- }
- },
- exec: {
- output: /^Removed [0-9]* commands.$/,
- completed: true,
- type: 'string',
- error: false
- }
- },
- {
- setup: 'remote ',
- check: {
- input: 'remote ',
- hints: '',
- markup: 'EEEEEEV',
- cursor: 7,
- current: '__command',
- status: 'ERROR',
- options: [ ],
- message: 'Can\'t use \'remote\'.',
- predictions: [ ],
- unassigned: [ ],
- }
- }
- ]);
-};
-
-
-// });
-
diff --git a/browser/devtools/commandline/test/browser_gcli_resource.js b/browser/devtools/commandline/test/browser_gcli_resource.js
deleted file mode 100644
index 672bb2fd7..000000000
--- a/browser/devtools/commandline/test/browser_gcli_resource.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testResource.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var util = require('util/util');
-
-var resource = require('gcli/types/resource');
-var types = require('gcli/types');
-var Status = require('gcli/types').Status;
-
-
-var tempDocument = undefined;
-
-exports.setup = function(options) {
- tempDocument = resource.getDocument();
- resource.setDocument(options.window.document);
-};
-
-exports.shutdown = function(options) {
- resource.setDocument(tempDocument);
- tempDocument = undefined;
-};
-
-exports.testAllPredictions1 = function(options) {
- if (options.isFirefox || options.isJsdom) {
- assert.log('Skipping checks due to jsdom/firefox document.stylsheets support.');
- return;
- }
-
- var resource = types.createType('resource');
- return resource.getLookup().then(function(opts) {
- assert.ok(opts.length > 1, 'have all resources');
-
- return util.promiseEach(opts, function(prediction) {
- return checkPrediction(resource, prediction);
- });
- });
-};
-
-exports.testScriptPredictions = function(options) {
- if (options.isFirefox || options.isJsdom) {
- assert.log('Skipping checks due to jsdom/firefox document.stylsheets support.');
- return;
- }
-
- var resource = types.createType({ name: 'resource', include: 'text/javascript' });
- return resource.getLookup().then(function(opts) {
- assert.ok(opts.length > 1, 'have js resources');
-
- return util.promiseEach(opts, function(prediction) {
- return checkPrediction(resource, prediction);
- });
- });
-};
-
-exports.testStylePredictions = function(options) {
- if (options.isFirefox || options.isJsdom) {
- assert.log('Skipping checks due to jsdom/firefox document.stylsheets support.');
- return;
- }
-
- var resource = types.createType({ name: 'resource', include: 'text/css' });
- return resource.getLookup().then(function(opts) {
- assert.ok(opts.length >= 1, 'have css resources');
-
- return util.promiseEach(opts, function(prediction) {
- return checkPrediction(resource, prediction);
- });
- });
-};
-
-exports.testAllPredictions2 = function(options) {
- if (options.isJsdom) {
- assert.log('Skipping checks due to jsdom document.stylsheets support.');
- return;
- }
-
- var scriptRes = types.createType({ name: 'resource', include: 'text/javascript' });
- return scriptRes.getLookup().then(function(scriptOptions) {
- var styleRes = types.createType({ name: 'resource', include: 'text/css' });
- return styleRes.getLookup().then(function(styleOptions) {
- var allRes = types.createType({ name: 'resource' });
- return allRes.getLookup().then(function(allOptions) {
- assert.is(scriptOptions.length + styleOptions.length,
- allOptions.length,
- 'split');
- });
- });
- });
-};
-
-exports.testAllPredictions3 = function(options) {
- if (options.isJsdom) {
- assert.log('Skipping checks due to jsdom document.stylsheets support.');
- return;
- }
-
- var res1 = types.createType({ name: 'resource' });
- return res1.getLookup().then(function(options1) {
- var res2 = types.createType('resource');
- return res2.getLookup().then(function(options2) {
- assert.is(options1.length, options2.length, 'type spec');
- });
- });
-};
-
-function checkPrediction(res, prediction) {
- var name = prediction.name;
- var value = prediction.value;
-
- // resources don't need context so cheat and pass in null
- var context = null;
- return res.parseString(name, context).then(function(conversion) {
- assert.is(conversion.getStatus(), Status.VALID, 'status VALID for ' + name);
- assert.is(conversion.value, value, 'value for ' + name);
-
- var strung = res.stringify(value, context);
- assert.is(strung, name, 'stringify for ' + name);
-
- assert.is(typeof value.loadContents, 'function', 'resource for ' + name);
- assert.is(typeof value.element, 'object', 'resource for ' + name);
- });
-}
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_scratchpad.js b/browser/devtools/commandline/test/browser_gcli_scratchpad.js
deleted file mode 100644
index 2e1189c4b..000000000
--- a/browser/devtools/commandline/test/browser_gcli_scratchpad.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testScratchpad.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-
-var origScratchpad = undefined;
-
-exports.setup = function(options) {
- origScratchpad = options.display.inputter.scratchpad;
- options.display.inputter.scratchpad = stubScratchpad;
-};
-
-exports.shutdown = function(options) {
- options.display.inputter.scratchpad = origScratchpad;
-};
-
-var stubScratchpad = {
- shouldActivate: function(ev) {
- return true;
- },
- activatedCount: 0,
- linkText: 'scratchpad.linkText'
-};
-stubScratchpad.activate = function(value) {
- stubScratchpad.activatedCount++;
- return true;
-};
-
-
-exports.testActivate = function(options) {
- var ev = {};
- stubScratchpad.activatedCount = 0;
- options.display.inputter.handleKeyUp(ev);
- assert.is(stubScratchpad.activatedCount, 1, 'scratchpad is activated');
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_spell.js b/browser/devtools/commandline/test/browser_gcli_spell.js
deleted file mode 100644
index f6670ed55..000000000
--- a/browser/devtools/commandline/test/browser_gcli_spell.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2009 Panagiotis Astithas
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testSpell.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var spell = require('gcli/types/spell');
-
-exports.testSpellerSimple = function(options) {
- var alternatives = Object.keys(options.window);
-
- assert.is(spell.correct('document', alternatives), 'document');
- assert.is(spell.correct('documen', alternatives), 'document');
-
- if (options.isJsdom) {
- assert.log('jsdom is weird, skipping some tests');
- }
- else {
- assert.is(spell.correct('ocument', alternatives), 'document');
- }
- assert.is(spell.correct('odcument', alternatives), 'document');
-
- assert.is(spell.correct('=========', alternatives), undefined);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_split.js b/browser/devtools/commandline/test/browser_gcli_split.js
deleted file mode 100644
index 743256b93..000000000
--- a/browser/devtools/commandline/test/browser_gcli_split.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testSplit.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var cli = require('gcli/cli');
-var Requisition = require('gcli/cli').Requisition;
-var canon = require('gcli/canon');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-
-exports.testSplitSimple = function(options) {
- var args;
- var requisition = new Requisition();
-
- args = cli.tokenize('s');
- requisition._split(args);
- assert.is(args.length, 0);
- assert.is(requisition.commandAssignment.arg.text, 's');
-};
-
-exports.testFlatCommand = function(options) {
- var args;
- var requisition = new Requisition();
-
- args = cli.tokenize('tsv');
- requisition._split(args);
- assert.is(args.length, 0);
- assert.is(requisition.commandAssignment.value.name, 'tsv');
-
- args = cli.tokenize('tsv a b');
- requisition._split(args);
- assert.is(requisition.commandAssignment.value.name, 'tsv');
- assert.is(args.length, 2);
- assert.is(args[0].text, 'a');
- assert.is(args[1].text, 'b');
-};
-
-exports.testJavascript = function(options) {
- if (!canon.getCommand('{')) {
- assert.log('Skipping testJavascript because { is not registered');
- return;
- }
-
- var args;
- var requisition = new Requisition();
-
- args = cli.tokenize('{');
- requisition._split(args);
- assert.is(args.length, 1);
- assert.is(args[0].text, '');
- assert.is(requisition.commandAssignment.arg.text, '');
- assert.is(requisition.commandAssignment.value.name, '{');
-};
-
-// BUG 663081 - add tests for sub commands
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_string.js b/browser/devtools/commandline/test/browser_gcli_string.js
deleted file mode 100644
index cd06360e7..000000000
--- a/browser/devtools/commandline/test/browser_gcli_string.js
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testString.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testNewLine = function(options) {
- helpers.audit(options, [
- {
- setup: 'echo a\\nb',
- check: {
- input: 'echo a\\nb',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'message',
- status: 'VALID',
- args: {
- command: { name: 'echo' },
- message: {
- value: 'a\nb',
- arg: ' a\\nb',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testTab = function(options) {
- helpers.audit(options, [
- {
- setup: 'echo a\\tb',
- check: {
- input: 'echo a\\tb',
- hints: '',
- markup: 'VVVVVVVVV',
- cursor: 9,
- current: 'message',
- status: 'VALID',
- args: {
- command: { name: 'echo' },
- message: {
- value: 'a\tb',
- arg: ' a\\tb',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testEscape = function(options) {
- helpers.audit(options, [
- {
- // What's typed is actually:
- // tsrsrsr a\\ b c
- setup: 'tsrsrsr a\\\\ b c',
- check: {
- input: 'tsrsrsr a\\\\ b c',
- hints: '',
- markup: 'VVVVVVVVVVVVVVV',
- status: 'VALID',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: { value: 'a\\', arg: ' a\\\\', status: 'VALID', message: '' },
- p2: { value: 'b', arg: ' b', status: 'VALID', message: '' },
- p3: { value: 'c', arg: ' c', status: 'VALID', message: '' },
- }
- }
- },
- {
- // What's typed is actually:
- // tsrsrsr abc\\ndef asd asd
- setup: 'tsrsrsr abc\\\\ndef asd asd',
- check: {
- input: 'tsrsrsr abc\\\\ndef asd asd',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: {
- value: 'abc\\ndef',
- arg: ' abc\\\\ndef',
- status: 'VALID',
- message: ''
- },
- p2: { value: 'asd', arg: ' asd', status: 'VALID', message: '' },
- p3: { value: 'asd', arg: ' asd', status: 'VALID', message: '' },
- }
- }
- }
- ]);
-};
-
-exports.testBlank = function(options) {
- helpers.audit(options, [
- {
- setup: 'tsrsrsr a "" c',
- check: {
- input: 'tsrsrsr a "" c',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'p3',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: {
- value: 'a',
- arg: ' a',
- status: 'VALID',
- message: ''
- },
- p2: {
- value: undefined,
- arg: ' ""',
- status: 'INCOMPLETE',
- message: ''
- },
- p3: {
- value: 'c',
- arg: ' c',
- status: 'VALID',
- message: ''
- }
- }
- }
- },
- {
- setup: 'tsrsrsr a b ""',
- check: {
- input: 'tsrsrsr a b ""',
- hints: '',
- markup: 'VVVVVVVVVVVVVV',
- cursor: 14,
- current: 'p3',
- status: 'VALID',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: {
- value: 'a',
- arg: ' a',
- status:'VALID',
- message: '' },
- p2: {
- value: 'b',
- arg: ' b',
- status: 'VALID',
- message: ''
- },
- p3: {
- value: '',
- arg: ' ""',
- status: 'VALID',
- message: ''
- }
- }
- }
- }
- ]);
-};
-
-exports.testBlankWithParam = function(options) {
- helpers.audit(options, [
- {
- setup: 'tsrsrsr a --p3',
- check: {
- input: 'tsrsrsr a --p3',
- hints: ' <string> <p2>',
- markup: 'VVVVVVVVVVVVVVV',
- cursor: 15,
- current: 'p3',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
- p2: { value: undefined, arg: '', status: 'INCOMPLETE', message: '' },
- p3: { value: '', arg: ' --p3', status: 'VALID', message: '' },
- }
- }
- },
- {
- setup: 'tsrsrsr a --p3 ',
- check: {
- input: 'tsrsrsr a --p3 ',
- hints: '<string> <p2>',
- markup: 'VVVVVVVVVVVVVVVV',
- cursor: 16,
- current: 'p3',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
- p2: { value: undefined, arg: '', status: 'INCOMPLETE', message: '' },
- p3: { value: '', arg: ' --p3 ', status: 'VALID', message: '' },
- }
- }
- },
- {
- setup: 'tsrsrsr a --p3 "',
- check: {
- input: 'tsrsrsr a --p3 "',
- hints: ' <p2>',
- markup: 'VVVVVVVVVVVVVVVVV',
- cursor: 17,
- current: 'p3',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
- p2: { value: undefined, arg: '', status: 'INCOMPLETE', message: '' },
- p3: { value: '', arg: ' --p3 "', status: 'VALID', message: '' },
- }
- }
- },
- {
- setup: 'tsrsrsr a --p3 ""',
- check: {
- input: 'tsrsrsr a --p3 ""',
- hints: ' <p2>',
- markup: 'VVVVVVVVVVVVVVVVVV',
- cursor: 18,
- current: 'p3',
- status: 'ERROR',
- message: '',
- args: {
- command: { name: 'tsrsrsr' },
- p1: { value: 'a', arg: ' a', status: 'VALID', message: '' },
- p2: { value: undefined, arg: '', status: 'INCOMPLETE', message: '' },
- p3: { value: '', arg: ' --p3 ""', status: 'VALID', message: '' },
- }
- }
- }
- ]);
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_tokenize.js b/browser/devtools/commandline/test/browser_gcli_tokenize.js
deleted file mode 100644
index 7bdc7ef05..000000000
--- a/browser/devtools/commandline/test/browser_gcli_tokenize.js
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testTokenize.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var cli = require('gcli/cli');
-
-exports.testBlanks = function(options) {
- var args;
-
- args = cli.tokenize('');
- assert.is(args.length, 1);
- assert.is(args[0].text, '');
- assert.is(args[0].prefix, '');
- assert.is(args[0].suffix, '');
-
- args = cli.tokenize(' ');
- assert.is(args.length, 1);
- assert.is(args[0].text, '');
- assert.is(args[0].prefix, ' ');
- assert.is(args[0].suffix, '');
-};
-
-exports.testTokSimple = function(options) {
- var args;
-
- args = cli.tokenize('s');
- assert.is(args.length, 1);
- assert.is(args[0].text, 's');
- assert.is(args[0].prefix, '');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'Argument');
-
- args = cli.tokenize('s s');
- assert.is(args.length, 2);
- assert.is(args[0].text, 's');
- assert.is(args[0].prefix, '');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'Argument');
- assert.is(args[1].text, 's');
- assert.is(args[1].prefix, ' ');
- assert.is(args[1].suffix, '');
- assert.is(args[1].type, 'Argument');
-};
-
-exports.testJavascript = function(options) {
- var args;
-
- args = cli.tokenize('{x}');
- assert.is(args.length, 1);
- assert.is(args[0].text, 'x');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{ x }');
- assert.is(args.length, 1);
- assert.is(args[0].text, 'x');
- assert.is(args[0].prefix, '{ ');
- assert.is(args[0].suffix, ' }');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{x} {y}');
- assert.is(args.length, 2);
- assert.is(args[0].text, 'x');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
- assert.is(args[1].text, 'y');
- assert.is(args[1].prefix, ' {');
- assert.is(args[1].suffix, '}');
- assert.is(args[1].type, 'ScriptArgument');
-
- args = cli.tokenize('{x}{y}');
- assert.is(args.length, 2);
- assert.is(args[0].text, 'x');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
- assert.is(args[1].text, 'y');
- assert.is(args[1].prefix, '{');
- assert.is(args[1].suffix, '}');
- assert.is(args[1].type, 'ScriptArgument');
-
- args = cli.tokenize('{');
- assert.is(args.length, 1);
- assert.is(args[0].text, '');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{ ');
- assert.is(args.length, 1);
- assert.is(args[0].text, '');
- assert.is(args[0].prefix, '{ ');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{x');
- assert.is(args.length, 1);
- assert.is(args[0].text, 'x');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'ScriptArgument');
-};
-
-exports.testRegularNesting = function(options) {
- var args;
-
- args = cli.tokenize('{"x"}');
- assert.is(args.length, 1);
- assert.is(args[0].text, '"x"');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{\'x\'}');
- assert.is(args.length, 1);
- assert.is(args[0].text, '\'x\'');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('"{x}"');
- assert.is(args.length, 1);
- assert.is(args[0].text, '{x}');
- assert.is(args[0].prefix, '"');
- assert.is(args[0].suffix, '"');
- assert.is(args[0].type, 'Argument');
-
- args = cli.tokenize('\'{x}\'');
- assert.is(args.length, 1);
- assert.is(args[0].text, '{x}');
- assert.is(args[0].prefix, '\'');
- assert.is(args[0].suffix, '\'');
- assert.is(args[0].type, 'Argument');
-};
-
-exports.testDeepNesting = function(options) {
- var args;
-
- args = cli.tokenize('{{}}');
- assert.is(args.length, 1);
- assert.is(args[0].text, '{}');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{{x} {y}}');
- assert.is(args.length, 1);
- assert.is(args[0].text, '{x} {y}');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- args = cli.tokenize('{{w} {{{x}}}} {y} {{{z}}}');
-
- assert.is(args.length, 3);
-
- assert.is(args[0].text, '{w} {{{x}}}');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- assert.is(args[1].text, 'y');
- assert.is(args[1].prefix, ' {');
- assert.is(args[1].suffix, '}');
- assert.is(args[1].type, 'ScriptArgument');
-
- assert.is(args[2].text, '{{z}}');
- assert.is(args[2].prefix, ' {');
- assert.is(args[2].suffix, '}');
- assert.is(args[2].type, 'ScriptArgument');
-
- args = cli.tokenize('{{w} {{{x}}} {y} {{{z}}}');
-
- assert.is(args.length, 1);
-
- assert.is(args[0].text, '{w} {{{x}}} {y} {{{z}}}');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'ScriptArgument');
-};
-
-exports.testStrangeNesting = function(options) {
- var args;
-
- // Note: When we get real JS parsing this should break
- args = cli.tokenize('{"x}"}');
-
- assert.is(args.length, 2);
-
- assert.is(args[0].text, '"x');
- assert.is(args[0].prefix, '{');
- assert.is(args[0].suffix, '}');
- assert.is(args[0].type, 'ScriptArgument');
-
- assert.is(args[1].text, '}');
- assert.is(args[1].prefix, '"');
- assert.is(args[1].suffix, '');
- assert.is(args[1].type, 'Argument');
-};
-
-exports.testComplex = function(options) {
- var args;
-
- args = cli.tokenize(' 1234 \'12 34\'');
-
- assert.is(args.length, 2);
-
- assert.is(args[0].text, '1234');
- assert.is(args[0].prefix, ' ');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'Argument');
-
- assert.is(args[1].text, '12 34');
- assert.is(args[1].prefix, ' \'');
- assert.is(args[1].suffix, '\'');
- assert.is(args[1].type, 'Argument');
-
- args = cli.tokenize('12\'34 "12 34" \\'); // 12'34 "12 34" \
-
- assert.is(args.length, 3);
-
- assert.is(args[0].text, '12\'34');
- assert.is(args[0].prefix, '');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'Argument');
-
- assert.is(args[1].text, '12 34');
- assert.is(args[1].prefix, ' "');
- assert.is(args[1].suffix, '"');
- assert.is(args[1].type, 'Argument');
-
- assert.is(args[2].text, '\\');
- assert.is(args[2].prefix, ' ');
- assert.is(args[2].suffix, '');
- assert.is(args[2].type, 'Argument');
-};
-
-exports.testPathological = function(options) {
- var args;
-
- args = cli.tokenize('a\\ b \\t\\n\\r \\\'x\\\" \'d'); // a_b \t\n\r \'x\" 'd
-
- assert.is(args.length, 4);
-
- assert.is(args[0].text, 'a\\ b');
- assert.is(args[0].prefix, '');
- assert.is(args[0].suffix, '');
- assert.is(args[0].type, 'Argument');
-
- assert.is(args[1].text, '\\t\\n\\r');
- assert.is(args[1].prefix, ' ');
- assert.is(args[1].suffix, '');
- assert.is(args[1].type, 'Argument');
-
- assert.is(args[2].text, '\\\'x\\"');
- assert.is(args[2].prefix, ' ');
- assert.is(args[2].suffix, '');
- assert.is(args[2].type, 'Argument');
-
- assert.is(args[3].text, 'd');
- assert.is(args[3].prefix, ' \'');
- assert.is(args[3].suffix, '');
- assert.is(args[3].type, 'Argument');
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_tooltip.js b/browser/devtools/commandline/test/browser_gcli_tooltip.js
deleted file mode 100644
index e6b659101..000000000
--- a/browser/devtools/commandline/test/browser_gcli_tooltip.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testTooltip.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-// var helpers = require('gclitest/helpers');
-// var mockCommands = require('gclitest/mockCommands');
-
-exports.setup = function(options) {
- mockCommands.setup();
-};
-
-exports.shutdown = function(options) {
- mockCommands.shutdown();
-};
-
-exports.testActivate = function(options) {
- if (!options.display) {
- assert.log('No display. Skipping activate tests');
- return;
- }
-
- if (options.isJsdom) {
- assert.log('Reduced checks due to JSDom.textContent');
- }
-
- return helpers.audit(options, [
- {
- setup: ' ',
- check: {
- input: ' ',
- hints: '',
- markup: 'V',
- cursor: 1,
- current: '__command',
- status: 'ERROR',
- message: '',
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'false:default'
- }
- },
- {
- setup: 'tsb ',
- check: {
- input: 'tsb ',
- hints: 'false',
- markup: 'VVVV',
- cursor: 4,
- current: 'toggle',
- status: 'VALID',
- options: [ 'false', 'true' ],
- message: '',
- predictions: [ 'false', 'true' ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'true:importantFieldFlag'
- }
- },
- {
- setup: 'tsb t',
- check: {
- input: 'tsb t',
- hints: 'rue',
- markup: 'VVVVI',
- cursor: 5,
- current: 'toggle',
- status: 'ERROR',
- options: [ 'true' ],
- message: '',
- predictions: [ 'true' ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'true:importantFieldFlag'
- }
- },
- {
- setup: 'tsb tt',
- check: {
- input: 'tsb tt',
- hints: ' -> true',
- markup: 'VVVVII',
- cursor: 6,
- current: 'toggle',
- status: 'ERROR',
- options: [ 'true' ],
- message: '',
- predictions: [ 'true' ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'true:importantFieldFlag'
- }
- },
- {
- setup: 'wxqy',
- check: {
- input: 'wxqy',
- hints: '',
- markup: 'EEEE',
- cursor: 4,
- current: '__command',
- status: 'ERROR',
- options: [ ],
- message: 'Can\'t use \'wxqy\'.',
- predictions: [ ],
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'true:isError'
- }
- },
- {
- setup: '',
- check: {
- input: '',
- hints: '',
- markup: '',
- cursor: 0,
- current: '__command',
- status: 'ERROR',
- message: '',
- unassigned: [ ],
- outputState: 'false:default',
- tooltipState: 'false:default'
- }
- }
- ]);
-};
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_types.js b/browser/devtools/commandline/test/browser_gcli_types.js
deleted file mode 100644
index d8bc19313..000000000
--- a/browser/devtools/commandline/test/browser_gcli_types.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testTypes.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-// var assert = require('test/assert');
-var types = require('gcli/types');
-
-function forEachType(options, typeSpec, callback) {
- types.getTypeNames().forEach(function(name) {
- typeSpec.name = name;
- typeSpec.requisition = options.display.requisition;
-
- // Provide some basic defaults to help selection/delegate/array work
- if (name === 'selection') {
- typeSpec.data = [ 'a', 'b' ];
- }
- else if (name === 'delegate') {
- typeSpec.delegateType = function() {
- return types.createType('string');
- };
- }
- else if (name === 'array') {
- typeSpec.subtype = 'string';
- }
-
- var type = types.createType(typeSpec);
- callback(type);
-
- // Clean up
- delete typeSpec.name;
- delete typeSpec.requisition;
- delete typeSpec.data;
- delete typeSpec.delegateType;
- delete typeSpec.subtype;
- });
-}
-
-exports.testDefault = function(options) {
- if (options.isJsdom) {
- assert.log('Skipping tests due to issues with resource type.');
- return;
- }
-
- forEachType(options, {}, function(type) {
- var context = options.display.requisition.executionContext;
- var blank = type.getBlank(context).value;
-
- // boolean and array types are exempt from needing undefined blank values
- if (type.name === 'boolean') {
- assert.is(blank, false, 'blank boolean is false');
- }
- else if (type.name === 'array') {
- assert.ok(Array.isArray(blank), 'blank array is array');
- assert.is(blank.length, 0, 'blank array is empty');
- }
- else if (type.name === 'nodelist') {
- assert.ok(typeof blank.item, 'function', 'blank.item is function');
- assert.is(blank.length, 0, 'blank nodelist is empty');
- }
- else {
- assert.is(blank, undefined, 'default defined for ' + type.name);
- }
- });
-};
-
-exports.testNullDefault = function(options) {
- forEachType(options, { defaultValue: null }, function(type) {
- assert.is(type.stringify(null, null), '', 'stringify(null) for ' + type.name);
- });
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/browser_gcli_util.js b/browser/devtools/commandline/test/browser_gcli_util.js
deleted file mode 100644
index b1d531869..000000000
--- a/browser/devtools/commandline/test/browser_gcli_util.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-var exports = {};
-
-const TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testUtil.js</p>";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.runTests(options, exports);
- }).then(finish);
-}
-
-// <INJECTED SOURCE:END>
-
-'use strict';
-
-var util = require('util/util');
-// var assert = require('test/assert');
-
-exports.testFindCssSelector = function(options) {
- var nodes = options.window.document.querySelectorAll('*');
- for (var i = 0; i < nodes.length; i++) {
- var selector = util.findCssSelector(nodes[i]);
- var matches = options.window.document.querySelectorAll(selector);
-
- assert.is(matches.length, 1, 'multiple matches for ' + selector);
- assert.is(matches[0], nodes[i], 'non-matching selector: ' + selector);
- }
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/head.js b/browser/devtools/commandline/test/head.js
deleted file mode 100644
index c7e71fea3..000000000
--- a/browser/devtools/commandline/test/head.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/commandline/test/";
-const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/commandline/test/";
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "/helpers.js", this);
-Services.scriptloader.loadSubScript(testDir + "/mockCommands.js", this);
-
-/**
- * Force GC on shutdown, because it seems that GCLI can outrun the garbage
- * collector in some situations, which causes test failures in later tests
- * Bug 774619 is an example.
- */
-registerCleanupFunction(function tearDown() {
- window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils)
- .garbageCollect();
-});
diff --git a/browser/devtools/commandline/test/helpers.js b/browser/devtools/commandline/test/helpers.js
deleted file mode 100644
index b7b9bd490..000000000
--- a/browser/devtools/commandline/test/helpers.js
+++ /dev/null
@@ -1,1038 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-// Use as a JSM
-// ------------
-// helpers._createDebugCheck() can be useful at runtime. To use as a JSM, copy
-// commandline/test/helpers.js to shared/helpers.jsm, and then import to
-// DeveloperToolbar.jsm with:
-// XPCOMUtils.defineLazyModuleGetter(this, "helpers",
-// "resource:///modules/devtools/helpers.jsm");
-// At the bottom of DeveloperToolbar.prototype._onload add this:
-// var options = { display: this.display };
-// this._input.onkeypress = function(ev) {
-// helpers.setup(options);
-// dump(helpers._createDebugCheck() + '\n\n');
-// };
-// Now GCLI will emit output on every keypress that both explains the state
-// of GCLI and can be run as a test case.
-
-this.EXPORTED_SYMBOLS = [ 'helpers' ];
-var helpers = {};
-this.helpers = helpers;
-let require = (Cu.import("resource://gre/modules/devtools/Require.jsm", {})).require;
-Components.utils.import("resource://gre/modules/devtools/gcli.jsm", {});
-
-let console = (Cu.import("resource://gre/modules/devtools/Console.jsm", {})).console;
-let TargetFactory = (Cu.import("resource://gre/modules/devtools/Loader.jsm", {})).devtools.TargetFactory;
-
-let Promise = (Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {})).Promise;
-let assert = { ok: ok, is: is, log: info };
-
-var util = require('util/util');
-
-var converters = require('gcli/converters');
-
-/**
- * Warning: For use with Firefox Mochitests only.
- *
- * Open a new tab at a URL and call a callback on load, and then tidy up when
- * the callback finishes.
- * The function will be passed a set of test options, and will usually return a
- * promise to indicate that the tab can be cleared up. (To be formal, we call
- * Promise.resolve() on the return value of the callback function)
- *
- * The options used by addTab include:
- * - chromeWindow: XUL window parent of created tab. a.k.a 'window' in mochitest
- * - tab: The new XUL tab element, as returned by gBrowser.addTab()
- * - target: The debug target as defined by the devtools framework
- * - browser: The XUL browser element for the given tab
- * - window: Content window for the created tab. a.k.a 'content' in mochitest
- * - isFirefox: Always true. Allows test sharing with GCLI
- *
- * Normally addTab will create an options object containing the values as
- * described above. However these options can be customized by the third
- * 'options' parameter. This has the ability to customize the value of
- * chromeWindow or isFirefox, and to add new properties.
- *
- * @param url The URL for the new tab
- * @param callback The function to call on page load
- * @param options An optional set of options to customize the way the tests run
- */
-helpers.addTab = function(url, callback, options) {
- var deferred = Promise.defer();
-
- waitForExplicitFinish();
-
- options = options || {};
- options.chromeWindow = options.chromeWindow || window;
- options.isFirefox = true;
-
- var tabbrowser = options.chromeWindow.gBrowser;
- options.tab = tabbrowser.addTab();
- tabbrowser.selectedTab = options.tab;
- options.browser = tabbrowser.getBrowserForTab(options.tab);
- options.target = TargetFactory.forTab(options.tab);
-
- var onPageLoad = function() {
- options.browser.removeEventListener("load", onPageLoad, true);
- options.document = options.browser.contentDocument;
- options.window = options.document.defaultView;
-
- var cleanUp = function() {
- tabbrowser.removeTab(options.tab);
-
- delete options.window;
- delete options.document;
-
- delete options.target;
- delete options.browser;
- delete options.tab;
-
- delete options.chromeWindow;
- delete options.isFirefox;
-
- deferred.resolve();
- };
-
- var reply = callback(options);
- Promise.resolve(reply).then(cleanUp, function(error) {
- ok(false, error);
- cleanUp();
- });
- };
-
- options.browser.contentWindow.location = url;
- options.browser.addEventListener("load", onPageLoad, true);
-
- return deferred.promise;
-};
-
-/**
- * Warning: For use with Firefox Mochitests only.
- *
- * As addTab, but that also opens the developer toolbar. In addition a new
- * 'display' property is added to the options object with the display from GCLI
- * in the developer toolbar
- */
-helpers.addTabWithToolbar = function(url, callback, options) {
- return helpers.addTab(url, function(innerOptions) {
- var win = innerOptions.chromeWindow;
- var deferred = Promise.defer();
-
- win.DeveloperToolbar.show(true, function() {
- innerOptions.display = win.DeveloperToolbar.display;
-
- var cleanUp = function() {
- win.DeveloperToolbar.hide();
- delete innerOptions.display;
- deferred.resolve();
- };
-
- var reply = callback(innerOptions);
- Promise.resolve(reply).then(cleanUp, function(error) {
- ok(false, error);
- cleanUp();
- });
- });
- return deferred.promise;
- }, options);
-};
-
-/**
- * Warning: For use with Firefox Mochitests only.
- *
- * Run a set of test functions stored in the values of the 'exports' object
- * functions stored under setup/shutdown will be run at the start/end of the
- * sequence of tests.
- * A test will be considered finished when its return value is resolved.
- * @param options An object to be passed to the test functions
- * @param tests An object containing named test functions
- * @return a promise which will be resolved when all tests have been run and
- * their return values resolved
- */
-helpers.runTests = function(options, tests) {
- var testNames = Object.keys(tests).filter(function(test) {
- return test != "setup" && test != "shutdown";
- });
-
- var recover = function(error) {
- ok(false, error);
- console.error(error);
- };
-
- info("SETUP");
- var setupDone = (tests.setup != null) ?
- Promise.resolve(tests.setup(options)) :
- Promise.resolve();
-
- var testDone = setupDone.then(function() {
- return util.promiseEach(testNames, function(testName) {
- info(testName);
- var action = tests[testName];
-
- if (typeof action === "function") {
- var reply = action.call(tests, options);
- return Promise.resolve(reply);
- }
- else if (Array.isArray(action)) {
- return helpers.audit(options, action);
- }
-
- return Promise.reject("test action '" + testName +
- "' is not a function or helpers.audit() object");
- });
- }, recover);
-
- return testDone.then(function() {
- info("SHUTDOWN");
- return (tests.shutdown != null) ?
- Promise.resolve(tests.shutdown(options)) :
- Promise.resolve();
- }, recover);
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-function checkOptions(options) {
- if (options == null) {
- console.trace();
- throw new Error('Missing options object');
- }
- if (options.display == null) {
- console.trace();
- throw new Error('options object does not contain a display property');
- }
- if (options.display.requisition == null) {
- console.trace();
- throw new Error('display object does not contain a requisition');
- }
-}
-
-/**
- * Various functions to return the actual state of the command line
- */
-helpers._actual = {
- input: function(options) {
- return options.display.inputter.element.value;
- },
-
- hints: function(options) {
- var templateData = options.display.completer._getCompleterTemplateData();
- var join = function(directTabText, emptyParameters, arrowTabText) {
- return (directTabText + emptyParameters.join('') + arrowTabText)
- .replace(/\u00a0/g, ' ')
- .replace(/\u21E5/, '->')
- .replace(/ $/, '');
- };
-
- var promisedJoin = Promise.promised(join);
- return promisedJoin(templateData.directTabText,
- templateData.emptyParameters,
- templateData.arrowTabText);
- },
-
- markup: function(options) {
- var cursor = options.display.inputter.element.selectionStart;
- var statusMarkup = options.display.requisition.getInputStatusMarkup(cursor);
- return statusMarkup.map(function(s) {
- return Array(s.string.length + 1).join(s.status.toString()[0]);
- }).join('');
- },
-
- cursor: function(options) {
- return options.display.inputter.element.selectionStart;
- },
-
- current: function(options) {
- return options.display.requisition.getAssignmentAt(helpers._actual.cursor(options)).param.name;
- },
-
- status: function(options) {
- return options.display.requisition.getStatus().toString();
- },
-
- predictions: function(options) {
- var cursor = options.display.inputter.element.selectionStart;
- var assignment = options.display.requisition.getAssignmentAt(cursor);
- return assignment.getPredictions().then(function(predictions) {
- return predictions.map(function(prediction) {
- return prediction.name;
- });
- });
- },
-
- unassigned: function(options) {
- return options.display.requisition._unassigned.map(function(assignment) {
- return assignment.arg.toString();
- }.bind(this));
- },
-
- outputState: function(options) {
- var outputData = options.display.focusManager._shouldShowOutput();
- return outputData.visible + ':' + outputData.reason;
- },
-
- tooltipState: function(options) {
- var tooltipData = options.display.focusManager._shouldShowTooltip();
- return tooltipData.visible + ':' + tooltipData.reason;
- },
-
- options: function(options) {
- if (options.display.tooltip.field.menu == null) {
- return [];
- }
- return options.display.tooltip.field.menu.items.map(function(item) {
- return item.name.textContent ? item.name.textContent : item.name;
- });
- },
-
- message: function(options) {
- return options.display.tooltip.errorEle.textContent;
- }
-};
-
-function shouldOutputUnquoted(value) {
- var type = typeof value;
- return value == null || type === 'boolean' || type === 'number';
-}
-
-function outputArray(array) {
- return (array.length === 0) ?
- '[ ]' :
- '[ \'' + array.join('\', \'') + '\' ]';
-}
-
-helpers._createDebugCheck = function(options) {
- checkOptions(options);
- var requisition = options.display.requisition;
- var command = requisition.commandAssignment.value;
- var cursor = helpers._actual.cursor(options);
- var input = helpers._actual.input(options);
- var padding = Array(input.length + 1).join(' ');
-
- var hintsPromise = helpers._actual.hints(options);
- var predictionsPromise = helpers._actual.predictions(options);
-
- return Promise.all(hintsPromise, predictionsPromise).then(function(values) {
- var hints = values[0];
- var predictions = values[1];
- var output = '';
-
- output += 'return helpers.audit(options, [\n';
- output += ' {\n';
-
- if (cursor === input.length) {
- output += ' setup: \'' + input + '\',\n';
- }
- else {
- output += ' name: \'' + input + ' (cursor=' + cursor + ')\',\n';
- output += ' setup: function() {\n';
- output += ' return helpers.setInput(options, \'' + input + '\', ' + cursor + ');\n';
- output += ' },\n';
- }
-
- output += ' check: {\n';
-
- output += ' input: \'' + input + '\',\n';
- output += ' hints: ' + padding + '\'' + hints + '\',\n';
- output += ' markup: \'' + helpers._actual.markup(options) + '\',\n';
- output += ' cursor: ' + cursor + ',\n';
- output += ' current: \'' + helpers._actual.current(options) + '\',\n';
- output += ' status: \'' + helpers._actual.status(options) + '\',\n';
- output += ' options: ' + outputArray(helpers._actual.options(options)) + ',\n';
- output += ' message: \'' + helpers._actual.message(options) + '\',\n';
- output += ' predictions: ' + outputArray(predictions) + ',\n';
- output += ' unassigned: ' + outputArray(requisition._unassigned) + ',\n';
- output += ' outputState: \'' + helpers._actual.outputState(options) + '\',\n';
- output += ' tooltipState: \'' + helpers._actual.tooltipState(options) + '\'' +
- (command ? ',' : '') +'\n';
-
- if (command) {
- output += ' args: {\n';
- output += ' command: { name: \'' + command.name + '\' },\n';
-
- requisition.getAssignments().forEach(function(assignment) {
- output += ' ' + assignment.param.name + ': { ';
-
- if (typeof assignment.value === 'string') {
- output += 'value: \'' + assignment.value + '\', ';
- }
- else if (shouldOutputUnquoted(assignment.value)) {
- output += 'value: ' + assignment.value + ', ';
- }
- else {
- output += '/*value:' + assignment.value + ',*/ ';
- }
-
- output += 'arg: \'' + assignment.arg + '\', ';
- output += 'status: \'' + assignment.getStatus().toString() + '\', ';
- output += 'message: \'' + assignment.getMessage() + '\'';
- output += ' },\n';
- });
-
- output += ' }\n';
- }
-
- output += ' },\n';
- output += ' exec: {\n';
- output += ' output: \'\',\n';
- output += ' completed: true,\n';
- output += ' type: \'string\',\n';
- output += ' error: false\n';
- output += ' }\n';
- output += ' }\n';
- output += ']);';
-
- return output;
- }.bind(this), util.errorHandler);
-};
-
-/**
- * Simulate focusing the input field
- */
-helpers.focusInput = function(options) {
- checkOptions(options);
- options.display.inputter.focus();
-};
-
-/**
- * Simulate pressing TAB in the input field
- */
-helpers.pressTab = function(options) {
- checkOptions(options);
- return helpers.pressKey(options, 9 /*KeyEvent.DOM_VK_TAB*/);
-};
-
-/**
- * Simulate pressing RETURN in the input field
- */
-helpers.pressReturn = function(options) {
- checkOptions(options);
- return helpers.pressKey(options, 13 /*KeyEvent.DOM_VK_RETURN*/);
-};
-
-/**
- * Simulate pressing a key by keyCode in the input field
- */
-helpers.pressKey = function(options, keyCode) {
- checkOptions(options);
- var fakeEvent = {
- keyCode: keyCode,
- preventDefault: function() { },
- timeStamp: new Date().getTime()
- };
- options.display.inputter.onKeyDown(fakeEvent);
- return options.display.inputter.handleKeyUp(fakeEvent);
-};
-
-/**
- * A list of special key presses and how to to them, for the benefit of
- * helpers.setInput
- */
-var ACTIONS = {
- '<TAB>': function(options) {
- return helpers.pressTab(options);
- },
- '<RETURN>': function(options) {
- return helpers.pressReturn(options);
- },
- '<UP>': function(options) {
- return helpers.pressKey(options, 38 /*KeyEvent.DOM_VK_UP*/);
- },
- '<DOWN>': function(options) {
- return helpers.pressKey(options, 40 /*KeyEvent.DOM_VK_DOWN*/);
- }
-};
-
-/**
- * Used in helpers.setInput to cut an input string like "blah<TAB>foo<UP>" into
- * an array like [ "blah", "<TAB>", "foo", "<UP>" ].
- * When using this RegExp, you also need to filter out the blank strings.
- */
-var CHUNKER = /([^<]*)(<[A-Z]+>)/;
-
-/**
- * Alter the input to <code>typed</code> optionally leaving the cursor at
- * <code>cursor</code>.
- * @return A promise of the number of key-presses to respond
- */
-helpers.setInput = function(options, typed, cursor) {
- checkOptions(options);
- var promise = undefined;
- var inputter = options.display.inputter;
- // We try to measure average keypress time, but setInput can simulate
- // several, so we try to keep track of how many
- var chunkLen = 1;
-
- // The easy case is a simple string without things like <TAB>
- if (typed.indexOf('<') === -1) {
- promise = inputter.setInput(typed);
- }
- else {
- // Cut the input up into input strings separated by '<KEY>' tokens. The
- // CHUNKS RegExp leaves blanks so we filter them out.
- var chunks = typed.split(CHUNKER).filter(function(s) {
- return s != '';
- });
- chunkLen = chunks.length + 1;
-
- // We're working on this in chunks so first clear the input
- promise = inputter.setInput('').then(function() {
- return util.promiseEach(chunks, function(chunk) {
- if (chunk.charAt(0) === '<') {
- var action = ACTIONS[chunk];
- if (typeof action !== 'function') {
- console.error('Known actions: ' + Object.keys(ACTIONS).join());
- throw new Error('Key action not found "' + chunk + '"');
- }
- return action(options);
- }
- else {
- return inputter.setInput(inputter.element.value + chunk);
- }
- });
- });
- }
-
- return promise.then(function() {
- if (cursor != null) {
- options.display.inputter.setCursor({ start: cursor, end: cursor });
- }
- else {
- // This is a hack because jsdom appears to not handle cursor updates
- // in the same way as most browsers.
- if (options.isJsdom) {
- options.display.inputter.setCursor({
- start: typed.length,
- end: typed.length
- });
- }
- }
-
- options.display.focusManager.onInputChange();
-
- // Firefox testing is noisy and distant, so logging helps
- if (options.isFirefox) {
- var cursorStr = (cursor == null ? '' : ', ' + cursor);
- log('setInput("' + typed + '"' + cursorStr + ')');
- }
-
- return chunkLen;
- });
-};
-
-/**
- * Helper for helpers.audit() to ensure that all the 'check' properties match.
- * See helpers.audit for more information.
- * @param name The name to use in error messages
- * @param checks See helpers.audit for a list of available checks
- * @return A promise which resolves to undefined when the checks are complete
- */
-helpers._check = function(options, name, checks) {
- if (checks == null) {
- return Promise.resolve();
- }
-
- var outstanding = [];
- var suffix = name ? ' (for \'' + name + '\')' : '';
-
- if ('input' in checks) {
- assert.is(helpers._actual.input(options), checks.input, 'input' + suffix);
- }
-
- if ('cursor' in checks) {
- assert.is(helpers._actual.cursor(options), checks.cursor, 'cursor' + suffix);
- }
-
- if ('current' in checks) {
- assert.is(helpers._actual.current(options), checks.current, 'current' + suffix);
- }
-
- if ('status' in checks) {
- assert.is(helpers._actual.status(options), checks.status, 'status' + suffix);
- }
-
- if ('markup' in checks) {
- assert.is(helpers._actual.markup(options), checks.markup, 'markup' + suffix);
- }
-
- if ('hints' in checks) {
- var hintCheck = function(actualHints) {
- assert.is(actualHints, checks.hints, 'hints' + suffix);
- };
- outstanding.push(helpers._actual.hints(options).then(hintCheck));
- }
-
- if ('predictions' in checks) {
- var predictionsCheck = function(actualPredictions) {
- helpers._arrayIs(actualPredictions,
- checks.predictions,
- 'predictions' + suffix);
- };
- outstanding.push(helpers._actual.predictions(options).then(predictionsCheck));
- }
-
- if ('predictionsContains' in checks) {
- var containsCheck = function(actualPredictions) {
- checks.predictionsContains.forEach(function(prediction) {
- var index = actualPredictions.indexOf(prediction);
- assert.ok(index !== -1,
- 'predictionsContains:' + prediction + suffix);
- });
- };
- outstanding.push(helpers._actual.predictions(options).then(containsCheck));
- }
-
- if ('unassigned' in checks) {
- helpers._arrayIs(helpers._actual.unassigned(options),
- checks.unassigned,
- 'unassigned' + suffix);
- }
-
- if ('tooltipState' in checks) {
- if (options.isJsdom) {
- assert.log('Skipped ' + name + '/tooltipState due to jsdom');
- }
- else {
- assert.is(helpers._actual.tooltipState(options),
- checks.tooltipState,
- 'tooltipState' + suffix);
- }
- }
-
- if ('outputState' in checks) {
- if (options.isJsdom) {
- assert.log('Skipped ' + name + '/outputState due to jsdom');
- }
- else {
- assert.is(helpers._actual.outputState(options),
- checks.outputState,
- 'outputState' + suffix);
- }
- }
-
- if ('options' in checks) {
- helpers._arrayIs(helpers._actual.options(options),
- checks.options,
- 'options' + suffix);
- }
-
- if ('error' in checks) {
- assert.is(helpers._actual.message(options), checks.error, 'error' + suffix);
- }
-
- if (checks.args != null) {
- var requisition = options.display.requisition;
- Object.keys(checks.args).forEach(function(paramName) {
- var check = checks.args[paramName];
-
- // We allow an 'argument' called 'command' to be the command itself, but
- // what if the command has a parameter called 'command' (for example, an
- // 'exec' command)? We default to using the parameter because checking
- // the command value is less useful
- var assignment = requisition.getAssignment(paramName);
- if (assignment == null && paramName === 'command') {
- assignment = requisition.commandAssignment;
- }
-
- if (assignment == null) {
- assert.ok(false, 'Unknown arg: ' + paramName + suffix);
- return;
- }
-
- if ('value' in check) {
- if (typeof check.value === 'function') {
- try {
- check.value(assignment.value);
- }
- catch (ex) {
- assert.ok(false, '' + ex);
- }
- }
- else {
- assert.is(assignment.value,
- check.value,
- 'arg.' + paramName + '.value' + suffix);
- }
- }
-
- if ('name' in check) {
- if (options.isJsdom) {
- assert.log('Skipped arg.' + paramName + '.name due to jsdom');
- }
- else {
- assert.is(assignment.value.name,
- check.name,
- 'arg.' + paramName + '.name' + suffix);
- }
- }
-
- if ('type' in check) {
- assert.is(assignment.arg.type,
- check.type,
- 'arg.' + paramName + '.type' + suffix);
- }
-
- if ('arg' in check) {
- assert.is(assignment.arg.toString(),
- check.arg,
- 'arg.' + paramName + '.arg' + suffix);
- }
-
- if ('status' in check) {
- assert.is(assignment.getStatus().toString(),
- check.status,
- 'arg.' + paramName + '.status' + suffix);
- }
-
- if ('message' in check) {
- if (typeof check.message.test === 'function') {
- assert.ok(check.message.test(assignment.getMessage()),
- 'arg.' + paramName + '.message' + suffix);
- }
- else {
- assert.is(assignment.getMessage(),
- check.message,
- 'arg.' + paramName + '.message' + suffix);
- }
- }
- });
- }
-
- return Promise.all(outstanding).then(function() {
- // Ensure the promise resolves to nothing
- return undefined;
- });
-};
-
-/**
- * Helper for helpers.audit() to ensure that all the 'exec' properties work.
- * See helpers.audit for more information.
- * @param name The name to use in error messages
- * @param expected See helpers.audit for a list of available exec checks
- * @return A promise which resolves to undefined when the checks are complete
- */
-helpers._exec = function(options, name, expected) {
- if (expected == null) {
- return Promise.resolve({});
- }
-
- var output;
- try {
- output = options.display.requisition.exec({ hidden: true });
- }
- catch (ex) {
- assert.ok(false, 'Failure executing \'' + name + '\': ' + ex);
- util.errorHandler(ex);
-
- return Promise.resolve({});
- }
-
- if ('completed' in expected) {
- assert.is(output.completed,
- expected.completed,
- 'output.completed false for: ' + name);
- }
-
- if (!options.window.document.createElement) {
- assert.log('skipping output tests (missing doc.createElement) for ' + name);
- return Promise.resolve({ output: output });
- }
-
- if (!('output' in expected)) {
- return Promise.resolve({ output: output });
- }
-
- var checkOutput = function() {
- if ('type' in expected) {
- assert.is(output.type,
- expected.type,
- 'output.type for: ' + name);
- }
-
- if ('error' in expected) {
- assert.is(output.error,
- expected.error,
- 'output.error for: ' + name);
- }
-
- var conversionContext = options.display.requisition.conversionContext;
- var convertPromise = converters.convert(output.data, output.type, 'dom',
- conversionContext);
- return convertPromise.then(function(node) {
- var actualOutput = node.textContent.trim();
-
- var doTest = function(match, against) {
- if (match.test(against)) {
- assert.ok(true, 'html output for ' + name + ' should match /' +
- match.source + '/');
- } else {
- assert.ok(false, 'html output for ' + name + ' should match /' +
- match.source +
- '/. Actual textContent: "' + against + '"');
- }
- };
-
- if (typeof expected.output === 'string') {
- assert.is(actualOutput,
- expected.output,
- 'html output for ' + name);
- }
- else if (Array.isArray(expected.output)) {
- expected.output.forEach(function(match) {
- doTest(match, actualOutput);
- });
- }
- else {
- doTest(expected.output, actualOutput);
- }
-
- return { output: output, text: actualOutput };
- });
- };
-
- return output.promise.then(checkOutput, checkOutput);
-};
-
-/**
- * Helper to setup the test
- */
-helpers._setup = function(options, name, action) {
- if (typeof action === 'string') {
- return helpers.setInput(options, action);
- }
-
- if (typeof action === 'function') {
- return Promise.resolve(action());
- }
-
- return Promise.reject('\'setup\' property must be a string or a function. Is ' + action);
-};
-
-/**
- * Helper to shutdown the test
- */
-helpers._post = function(name, action, data) {
- if (typeof action === 'function') {
- return Promise.resolve(action(data.output, data.text));
- }
- return Promise.resolve(action);
-};
-
-/*
- * We do some basic response time stats so we can see if we're getting slow
- */
-var totalResponseTime = 0;
-var averageOver = 0;
-var maxResponseTime = 0;
-var maxResponseCulprit = undefined;
-var start = undefined;
-
-/**
- * Restart the stats collection process
- */
-helpers.resetResponseTimes = function() {
- start = new Date().getTime();
- totalResponseTime = 0;
- averageOver = 0;
- maxResponseTime = 0;
- maxResponseCulprit = undefined;
-};
-
-/**
- * Expose an average response time in milliseconds
- */
-Object.defineProperty(helpers, 'averageResponseTime', {
- get: function() {
- return averageOver === 0 ?
- undefined :
- Math.round(100 * totalResponseTime / averageOver) / 100;
- },
- enumerable: true
-});
-
-/**
- * Expose a maximum response time in milliseconds
- */
-Object.defineProperty(helpers, 'maxResponseTime', {
- get: function() { return Math.round(maxResponseTime * 100) / 100; },
- enumerable: true
-});
-
-/**
- * Expose the name of the test that provided the maximum response time
- */
-Object.defineProperty(helpers, 'maxResponseCulprit', {
- get: function() { return maxResponseCulprit; },
- enumerable: true
-});
-
-/**
- * Quick summary of the times
- */
-Object.defineProperty(helpers, 'timingSummary', {
- get: function() {
- var elapsed = (new Date().getTime() - start) / 1000;
- return 'Total ' + elapsed + 's, ' +
- 'ave response ' + helpers.averageResponseTime + 'ms, ' +
- 'max response ' + helpers.maxResponseTime + 'ms ' +
- 'from \'' + helpers.maxResponseCulprit + '\'';
- },
- enumerable: true
-});
-
-/**
- * A way of turning a set of tests into something more declarative, this helps
- * to allow tests to be asynchronous.
- * @param audits An array of objects each of which contains:
- * - setup: string/function to be called to set the test up.
- * If audit is a string then it is passed to helpers.setInput().
- * If audit is a function then it is executed. The tests will wait while
- * tests that return promises complete.
- * - name: For debugging purposes. If name is undefined, and 'setup'
- * is a string then the setup value will be used automatically
- * - skipIf: A function to define if the test should be skipped. Useful for
- * excluding tests from certain environments (e.g. jsdom, firefox, etc).
- * The name of the test will be used in log messages noting the skip
- * See helpers.reason for pre-defined skip functions. The skip function must
- * be synchronous, and will be passed the test options object.
- * - skipRemainingIf: A function to skip all the remaining audits in this set.
- * See skipIf for details of how skip functions work.
- * - check: Check data. Available checks:
- * - input: The text displayed in the input field
- * - cursor: The position of the start of the cursor
- * - status: One of "VALID", "ERROR", "INCOMPLETE"
- * - hints: The hint text, i.e. a concatenation of the directTabText, the
- * emptyParameters and the arrowTabText. The text as inserted into the UI
- * will include NBSP and Unicode RARR characters, these should be
- * represented using normal space and '->' for the arrow
- * - markup: What state should the error markup be in. e.g. "VVVIIIEEE"
- * - args: Maps of checks to make against the arguments:
- * - value: i.e. assignment.value (which ignores defaultValue)
- * - type: Argument/BlankArgument/MergedArgument/etc i.e. what's assigned
- * Care should be taken with this since it's something of an
- * implementation detail
- * - arg: The toString value of the argument
- * - status: i.e. assignment.getStatus
- * - message: i.e. assignment.getMessage
- * - name: For commands - checks assignment.value.name
- * - exec: Object to indicate we should execute the command and check the
- * results. Available checks:
- * - output: A string, RegExp or array of RegExps to compare with the output
- * If typeof output is a string then the output should be exactly equal
- * to the given string. If the type of output is a RegExp or array of
- * RegExps then the output should match all RegExps
- * - completed: A boolean which declares that we should check to see if the
- * command completed synchronously
- * - post: Function to be called after the checks have been run
- */
-helpers.audit = function(options, audits) {
- checkOptions(options);
- var skipReason = null;
- return util.promiseEach(audits, function(audit) {
- var name = audit.name;
- if (name == null && typeof audit.setup === 'string') {
- name = audit.setup;
- }
-
- if (assert.testLogging) {
- log('- START \'' + name + '\' in ' + assert.currentTest);
- }
-
- if (audit.skipIf) {
- var skip = (typeof audit.skipIf === 'function') ?
- audit.skipIf(options) :
- !!audit.skipIf;
- if (skip) {
- var reason = audit.skipIf.name ? 'due to ' + audit.skipIf.name : '';
- assert.log('Skipped ' + name + ' ' + reason);
- return Promise.resolve(undefined);
- }
- }
-
- if (audit.skipRemainingIf) {
- var skipRemainingIf = (typeof audit.skipRemainingIf === 'function') ?
- audit.skipRemainingIf(options) :
- !!audit.skipRemainingIf;
- if (skipRemainingIf) {
- skipReason = audit.skipRemainingIf.name ?
- 'due to ' + audit.skipRemainingIf.name :
- '';
- assert.log('Skipped ' + name + ' ' + skipReason);
- return Promise.resolve(undefined);
- }
- }
-
- if (skipReason != null) {
- assert.log('Skipped ' + name + ' ' + skipReason);
- return Promise.resolve(undefined);
- }
-
- var start = new Date().getTime();
-
- var setupDone = helpers._setup(options, name, audit.setup);
- return setupDone.then(function(chunkLen) {
-
- if (typeof chunkLen !== 'number') {
- chunkLen = 1;
- }
-
- if (assert.currentTest) {
- var responseTime = (new Date().getTime() - start) / chunkLen;
- totalResponseTime += responseTime;
- if (responseTime > maxResponseTime) {
- maxResponseTime = responseTime;
- maxResponseCulprit = assert.currentTest + '/' + name;
- }
- averageOver++;
- }
-
- var checkDone = helpers._check(options, name, audit.check);
- return checkDone.then(function() {
- var execDone = helpers._exec(options, name, audit.exec);
- return execDone.then(function(data) {
- return helpers._post(name, audit.post, data).then(function() {
- if (assert.testLogging) {
- log('- END \'' + name + '\' in ' + assert.currentTest);
- }
- });
- });
- });
- });
- }).then(function() {
- return options.display.inputter.setInput('');
- });
-};
-
-/**
- * Compare 2 arrays.
- */
-helpers._arrayIs = function(actual, expected, message) {
- assert.ok(Array.isArray(actual), 'actual is not an array: ' + message);
- assert.ok(Array.isArray(expected), 'expected is not an array: ' + message);
-
- if (!Array.isArray(actual) || !Array.isArray(expected)) {
- return;
- }
-
- assert.is(actual.length, expected.length, 'array length: ' + message);
-
- for (var i = 0; i < actual.length && i < expected.length; i++) {
- assert.is(actual[i], expected[i], 'member[' + i + ']: ' + message);
- }
-};
-
-/**
- * A quick helper to log to the correct place
- */
-function log(message) {
- if (typeof info === 'function') {
- info(message);
- }
- else {
- console.log(message);
- }
-}
-
-//});
diff --git a/browser/devtools/commandline/test/mockCommands.js b/browser/devtools/commandline/test/mockCommands.js
deleted file mode 100644
index 4d4beb5bb..000000000
--- a/browser/devtools/commandline/test/mockCommands.js
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// define(function(require, exports, module) {
-
-// <INJECTED SOURCE:START>
-
-// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
-// DO NOT EDIT IT DIRECTLY
-
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-let { require: require, define: define } = Cu.import("resource://gre/modules/devtools/Require.jsm", {});
-Cu.import("resource://gre/modules/devtools/gcli.jsm", {});
-
-// <INJECTED SOURCE:END>
-
-var mockCommands = {};
-
-// We use an alias for exports here because this module is used in Firefox
-// mochitests where we don't have define/require
-
-'use strict';
-
-var util = require('util/util');
-var canon = require('gcli/canon');
-var types = require('gcli/types');
-
-mockCommands.option1 = { };
-mockCommands.option2 = { };
-mockCommands.option3 = { };
-
-mockCommands.optionType = {
- name: 'optionType',
- parent: 'selection',
- lookup: [
- { name: 'option1', value: mockCommands.option1 },
- { name: 'option2', value: mockCommands.option2 },
- { name: 'option3', value: mockCommands.option3 }
- ]
-};
-
-mockCommands.optionValue = {
- name: 'optionValue',
- parent: 'delegate',
- delegateType: function(executionContext) {
- if (executionContext != null) {
- var option = executionContext.getArgsObject().optionType;
- if (option != null) {
- return option.type;
- }
- }
- return types.createType('blank');
- }
-};
-
-mockCommands.onCommandExec = util.createEvent('commands.onCommandExec');
-
-function createExec(name) {
- return function(args, executionContext) {
- var data = {
- args: args,
- context: executionContext
- };
- mockCommands.onCommandExec(data);
- var argsOut = Object.keys(args).map(function(key) {
- return key + '=' + args[key];
- }).join(', ');
- return 'Exec: ' + name + ' ' + argsOut;
- };
-}
-
-var tsv = {
- name: 'tsv',
- params: [
- { name: 'optionType', type: 'optionType' },
- { name: 'optionValue', type: 'optionValue' }
- ],
- exec: createExec('tsv')
-};
-
-var tsr = {
- name: 'tsr',
- params: [ { name: 'text', type: 'string' } ],
- exec: createExec('tsr')
-};
-
-var tsrsrsr = {
- name: 'tsrsrsr',
- params: [
- { name: 'p1', type: 'string' },
- { name: 'p2', type: 'string' },
- { name: 'p3', type: { name: 'string', allowBlank: true} },
- ],
- exec: createExec('tsrsrsr')
-};
-
-var tso = {
- name: 'tso',
- params: [ { name: 'text', type: 'string', defaultValue: null } ],
- exec: createExec('tso')
-};
-
-var tse = {
- name: 'tse',
- params: [
- { name: 'node', type: 'node' },
- {
- group: 'options',
- params: [
- { name: 'nodes', type: { name: 'nodelist' } },
- { name: 'nodes2', type: { name: 'nodelist', allowEmpty: true } }
- ]
- }
- ],
- exec: createExec('tse')
-};
-
-var tsj = {
- name: 'tsj',
- params: [ { name: 'javascript', type: 'javascript' } ],
- exec: createExec('tsj')
-};
-
-var tsb = {
- name: 'tsb',
- params: [ { name: 'toggle', type: 'boolean' } ],
- exec: createExec('tsb')
-};
-
-var tss = {
- name: 'tss',
- exec: createExec('tss')
-};
-
-var tsu = {
- name: 'tsu',
- params: [ { name: 'num', type: { name: 'number', max: 10, min: -5, step: 3 } } ],
- exec: createExec('tsu')
-};
-
-var tsf = {
- name: 'tsf',
- params: [ { name: 'num', type: { name: 'number', allowFloat: true, max: 11.5, min: -6.5, step: 1.5 } } ],
- exec: createExec('tsf')
-};
-
-var tsn = {
- name: 'tsn'
-};
-
-var tsnDif = {
- name: 'tsn dif',
- description: 'tsn dif',
- params: [ { name: 'text', type: 'string', description: 'tsn dif text' } ],
- exec: createExec('tsnDif')
-};
-
-var tsnExt = {
- name: 'tsn ext',
- params: [ { name: 'text', type: 'string' } ],
- exec: createExec('tsnExt')
-};
-
-var tsnExte = {
- name: 'tsn exte',
- params: [ { name: 'text', type: 'string' } ],
- exec: createExec('tsnExte')
-};
-
-var tsnExten = {
- name: 'tsn exten',
- params: [ { name: 'text', type: 'string' } ],
- exec: createExec('tsnExten')
-};
-
-var tsnExtend = {
- name: 'tsn extend',
- params: [ { name: 'text', type: 'string' } ],
- exec: createExec('tsnExtend')
-};
-
-var tsnDeep = {
- name: 'tsn deep'
-};
-
-var tsnDeepDown = {
- name: 'tsn deep down'
-};
-
-var tsnDeepDownNested = {
- name: 'tsn deep down nested'
-};
-
-var tsnDeepDownNestedCmd = {
- name: 'tsn deep down nested cmd',
- exec: createExec('tsnDeepDownNestedCmd')
-};
-
-var tshidden = {
- name: 'tshidden',
- hidden: true,
- params: [
- {
- group: 'Options',
- params: [
- {
- name: 'visible',
- type: 'string',
- defaultValue: null,
- description: 'visible'
- },
- {
- name: 'invisiblestring',
- type: 'string',
- description: 'invisiblestring',
- defaultValue: null,
- hidden: true
- },
- {
- name: 'invisibleboolean',
- type: 'boolean',
- description: 'invisibleboolean',
- hidden: true
- }
- ]
- }
- ],
- exec: createExec('tshidden')
-};
-
-var tselarr = {
- name: 'tselarr',
- params: [
- { name: 'num', type: { name: 'selection', data: [ '1', '2', '3' ] } },
- { name: 'arr', type: { name: 'array', subtype: 'string' } }
- ],
- exec: createExec('tselarr')
-};
-
-var tsm = {
- name: 'tsm',
- 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')
-};
-
-var tsg = {
- name: 'tsg',
- description: 'a param group test',
- params: [
- {
- name: 'solo',
- type: { name: 'selection', data: [ 'aaa', 'bbb', 'ccc' ] },
- description: 'solo param'
- },
- {
- group: 'First',
- params: [
- {
- name: 'txt1',
- type: 'string',
- defaultValue: null,
- description: 'txt1 param'
- },
- {
- name: 'bool',
- type: 'boolean',
- description: 'bool param'
- }
- ]
- },
- {
- name: 'txt2',
- type: 'string',
- defaultValue: 'd',
- description: 'txt2 param',
- option: 'Second'
- },
- {
- name: 'num',
- type: { name: 'number', min: 40 },
- defaultValue: 42,
- description: 'num param',
- option: 'Second'
- }
- ],
- exec: createExec('tsg')
-};
-
-var tscook = {
- name: 'tscook',
- description: 'param group test to catch problems with cookie command',
- params: [
- {
- name: 'key',
- type: 'string',
- description: 'tscookKeyDesc'
- },
- {
- name: 'value',
- type: 'string',
- description: 'tscookValueDesc'
- },
- {
- group: 'tscookOptionsDesc',
- params: [
- {
- name: 'path',
- type: 'string',
- defaultValue: '/',
- description: 'tscookPathDesc'
- },
- {
- name: 'domain',
- type: 'string',
- defaultValue: null,
- description: 'tscookDomainDesc'
- },
- {
- name: 'secure',
- type: 'boolean',
- description: 'tscookSecureDesc'
- }
- ]
- }
- ],
- exec: createExec('tscook')
-};
-
-var tslong = {
- name: 'tslong',
- description: 'long param tests to catch problems with the jsb command',
- params: [
- {
- name: 'msg',
- type: 'string',
- description: 'msg Desc'
- },
- {
- group: "Options Desc",
- params: [
- {
- name: 'num',
- type: 'number',
- description: 'num Desc',
- defaultValue: 2
- },
- {
- name: 'sel',
- type: {
- name: 'selection',
- lookup: [
- { name: "space", value: " " },
- { name: "tab", value: "\t" }
- ]
- },
- description: 'sel Desc',
- defaultValue: ' '
- },
- {
- name: 'bool',
- type: 'boolean',
- description: 'bool Desc'
- },
- {
- name: 'num2',
- type: 'number',
- description: 'num2 Desc',
- defaultValue: -1
- },
- {
- name: 'bool2',
- type: 'boolean',
- description: 'bool2 Desc'
- },
- {
- name: 'sel2',
- type: {
- name: 'selection',
- data: [ 'collapse', 'basic', 'with space', 'with two spaces' ]
- },
- description: 'sel2 Desc',
- defaultValue: "collapse"
- }
- ]
- }
- ],
- exec: createExec('tslong')
-};
-
-var tsdate = {
- name: 'tsdate',
- description: 'long param tests to catch problems with the jsb command',
- params: [
- {
- name: 'd1',
- type: 'date',
- },
- {
- name: 'd2',
- type: {
- name: 'date',
- min: '1 jan 2000',
- max: '28 feb 2000',
- step: 2
- }
- },
- ],
- exec: createExec('tsdate')
-};
-
-var tsfail = {
- name: 'tsfail',
- description: 'test errors',
- params: [
- {
- name: 'method',
- type: {
- name: 'selection',
- data: [
- 'reject', 'rejecttyped',
- 'throwerror', 'throwstring', 'throwinpromise',
- 'noerror'
- ]
- }
- }
- ],
- exec: function(args, context) {
- if (args.method === 'reject') {
- var deferred = context.defer();
- setTimeout(function() {
- deferred.reject('rejected promise');
- }, 10);
- return deferred.promise;
- }
-
- if (args.method === 'rejecttyped') {
- var deferred = context.defer();
- setTimeout(function() {
- deferred.reject(context.typedData('number', 54));
- }, 10);
- return deferred.promise;
- }
-
- if (args.method === 'throwinpromise') {
- var deferred = context.defer();
- setTimeout(function() {
- deferred.resolve('should be lost');
- }, 10);
- return deferred.promise.then(function() {
- var t = null;
- return t.foo;
- });
- }
-
- if (args.method === 'throwerror') {
- throw new Error('thrown error');
- }
-
- if (args.method === 'throwstring') {
- throw 'thrown string';
- }
-
- return 'no error';
- }
-};
-
-mockCommands.commands = {};
-
-/**
- * Registration and de-registration.
- */
-mockCommands.setup = function(opts) {
- // setup/shutdown needs to register/unregister types, however that means we
- // need to re-initialize mockCommands.option1 and mockCommands.option2 with
- // the actual types
- mockCommands.option1.type = types.createType('string');
- mockCommands.option2.type = types.createType('number');
- mockCommands.option3.type = types.createType({
- name: 'selection',
- lookup: [
- { name: 'one', value: 1 },
- { name: 'two', value: 2 },
- { name: 'three', value: 3 }
- ]
- });
-
- types.addType(mockCommands.optionType);
- types.addType(mockCommands.optionValue);
-
- mockCommands.commands.tsv = canon.addCommand(tsv);
- mockCommands.commands.tsr = canon.addCommand(tsr);
- mockCommands.commands.tsrsrsr = canon.addCommand(tsrsrsr);
- mockCommands.commands.tso = canon.addCommand(tso);
- mockCommands.commands.tse = canon.addCommand(tse);
- mockCommands.commands.tsj = canon.addCommand(tsj);
- mockCommands.commands.tsb = canon.addCommand(tsb);
- mockCommands.commands.tss = canon.addCommand(tss);
- mockCommands.commands.tsu = canon.addCommand(tsu);
- mockCommands.commands.tsf = canon.addCommand(tsf);
- mockCommands.commands.tsn = canon.addCommand(tsn);
- mockCommands.commands.tsnDif = canon.addCommand(tsnDif);
- mockCommands.commands.tsnExt = canon.addCommand(tsnExt);
- mockCommands.commands.tsnExte = canon.addCommand(tsnExte);
- mockCommands.commands.tsnExten = canon.addCommand(tsnExten);
- mockCommands.commands.tsnExtend = canon.addCommand(tsnExtend);
- mockCommands.commands.tsnDeep = canon.addCommand(tsnDeep);
- mockCommands.commands.tsnDeepDown = canon.addCommand(tsnDeepDown);
- mockCommands.commands.tsnDeepDownNested = canon.addCommand(tsnDeepDownNested);
- mockCommands.commands.tsnDeepDownNestedCmd = canon.addCommand(tsnDeepDownNestedCmd);
- mockCommands.commands.tselarr = canon.addCommand(tselarr);
- mockCommands.commands.tsm = canon.addCommand(tsm);
- mockCommands.commands.tsg = canon.addCommand(tsg);
- mockCommands.commands.tshidden = canon.addCommand(tshidden);
- mockCommands.commands.tscook = canon.addCommand(tscook);
- mockCommands.commands.tslong = canon.addCommand(tslong);
- mockCommands.commands.tsdate = canon.addCommand(tsdate);
- mockCommands.commands.tsfail = canon.addCommand(tsfail);
-};
-
-mockCommands.shutdown = function(opts) {
- canon.removeCommand(tsv);
- canon.removeCommand(tsr);
- canon.removeCommand(tsrsrsr);
- canon.removeCommand(tso);
- canon.removeCommand(tse);
- canon.removeCommand(tsj);
- canon.removeCommand(tsb);
- canon.removeCommand(tss);
- canon.removeCommand(tsu);
- canon.removeCommand(tsf);
- canon.removeCommand(tsn);
- canon.removeCommand(tsnDif);
- canon.removeCommand(tsnExt);
- canon.removeCommand(tsnExte);
- canon.removeCommand(tsnExten);
- canon.removeCommand(tsnExtend);
- canon.removeCommand(tsnDeep);
- canon.removeCommand(tsnDeepDown);
- canon.removeCommand(tsnDeepDownNested);
- canon.removeCommand(tsnDeepDownNestedCmd);
- canon.removeCommand(tselarr);
- canon.removeCommand(tsm);
- canon.removeCommand(tsg);
- canon.removeCommand(tshidden);
- canon.removeCommand(tscook);
- canon.removeCommand(tslong);
- canon.removeCommand(tsdate);
- canon.removeCommand(tsfail);
-
- types.removeType(mockCommands.optionType);
- types.removeType(mockCommands.optionValue);
-
- mockCommands.commands = {};
-};
-
-
-// });
diff --git a/browser/devtools/commandline/test/moz.build b/browser/devtools/commandline/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/commandline/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/debugger/moz.build b/browser/devtools/debugger/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/debugger/moz.build
+++ b/browser/devtools/debugger/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/debugger/test/Makefile.in b/browser/devtools/debugger/test/Makefile.in
deleted file mode 100644
index a912a546c..000000000
--- a/browser/devtools/debugger/test/Makefile.in
+++ /dev/null
@@ -1,164 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_TESTS = \
- browser_dbg_aaa_run_first_leaktest.js \
- browser_dbg_clean-exit.js \
- browser_dbg_cmd.js \
- browser_dbg_cmd_break.js \
- browser_dbg_debuggerstatement.js \
- browser_dbg_listtabs-01.js \
- browser_dbg_listtabs-02.js \
- browser_dbg_tabactor-01.js \
- browser_dbg_tabactor-02.js \
- browser_dbg_globalactor-01.js \
- browser_dbg_nav-01.js \
- browser_dbg_propertyview-01.js \
- browser_dbg_propertyview-02.js \
- browser_dbg_propertyview-03.js \
- browser_dbg_propertyview-04.js \
- browser_dbg_propertyview-05.js \
- browser_dbg_propertyview-06.js \
- browser_dbg_propertyview-07.js \
- browser_dbg_propertyview-08.js \
- browser_dbg_propertyview-09.js \
- browser_dbg_propertyview-10.js \
- browser_dbg_propertyview-11.js \
- browser_dbg_propertyview-12.js \
- browser_dbg_propertyview-edit-value.js \
- browser_dbg_propertyview-edit-watch.js \
- browser_dbg_propertyview-data-big.js \
- browser_dbg_propertyview-data-getset-01.js \
- browser_dbg_propertyview-data-getset-02.js \
- browser_dbg_propertyview-data.js \
- browser_dbg_propertyview-filter-04.js \
- browser_dbg_propertyview-filter-05.js \
- browser_dbg_propertyview-filter-06.js \
- browser_dbg_propertyview-filter-07.js \
- browser_dbg_propertyview-filter-08.js \
- $(filter disabled-temporarily--bug-782179, browser_dbg_reload-same-script.js) \
- browser_dbg_reload-preferred-script.js \
- browser_dbg_pane-collapse.js \
- browser_dbg_panesize-inner.js \
- browser_dbg_breadcrumbs-access.js \
- browser_dbg_stack-01.js \
- browser_dbg_stack-02.js \
- browser_dbg_stack-03.js \
- browser_dbg_stack-04.js \
- browser_dbg_stack-05.js \
- browser_dbg_location-changes.js \
- browser_dbg_location-changes-new.js \
- browser_dbg_location-changes-blank.js \
- browser_dbg_location-changes-bp.js \
- browser_dbg_sources-cache.js \
- browser_dbg_scripts-switching.js \
- browser_dbg_scripts-switching-02.js \
- browser_dbg_scripts-sorting.js \
- browser_dbg_scripts-searching-01.js \
- browser_dbg_scripts-searching-02.js \
- browser_dbg_scripts-searching-03.js \
- browser_dbg_scripts-searching-04.js \
- browser_dbg_scripts-searching-05.js \
- browser_dbg_scripts-searching-06.js \
- browser_dbg_scripts-searching-07.js \
- browser_dbg_scripts-searching-08.js \
- browser_dbg_scripts-searching-files_ui.js \
- browser_dbg_scripts-searching-popup.js \
- browser_dbg_function-search.js \
- browser_dbg_pause-resume.js \
- browser_dbg_pause-warning.js \
- browser_dbg_update-editor-mode.js \
- browser_dbg_select-line.js \
- browser_dbg_breakpoint-new-script.js \
- browser_dbg_bug723069_editor-breakpoints.js \
- browser_dbg_bug723071_editor-breakpoints-pane.js \
- browser_dbg_bug723071_editor-breakpoints-highlight.js \
- browser_dbg_bug723071_editor-breakpoints-contextmenu.js \
- browser_dbg_bug740825_conditional-breakpoints-01.js \
- browser_dbg_bug740825_conditional-breakpoints-02.js \
- browser_dbg_bug727429_watch-expressions-01.js \
- browser_dbg_bug727429_watch-expressions-02.js \
- browser_dbg_bug731394_editor-contextmenu.js \
- browser_dbg_bug737803_editor_actual_location.js \
- browser_dbg_bug786070_hide_nonenums.js \
- browser_dbg_bug868163_highight_on_pause.js \
- browser_dbg_displayName.js \
- browser_dbg_pause-exceptions.js \
- browser_dbg_multiple-windows.js \
- browser_dbg_iframes.js \
- browser_dbg_bfcache.js \
- browser_dbg_progress-listener-bug.js \
- browser_dbg_chrome-debugging.js \
- browser_dbg_source_maps-01.js \
- browser_dbg_source_maps-02.js \
- browser_dbg_step-out.js \
- head.js \
- $(NULL)
-
-MOCHITEST_BROWSER_PAGES = \
- browser_dbg_cmd_break.html \
- browser_dbg_cmd.html \
- testactors.js \
- browser_dbg_tab1.html \
- browser_dbg_tab2.html \
- browser_dbg_debuggerstatement.html \
- browser_dbg_stack.html \
- browser_dbg_script-switching.html \
- browser_dbg_script-switching-02.html \
- test-script-switching-01.js \
- test-script-switching-02.js \
- browser_dbg_big-data.html \
- browser_dbg_frame-parameters.html \
- browser_dbg_update-editor-mode.html \
- test-editor-mode \
- browser_dbg_displayName.html \
- browser_dbg_iframes.html \
- browser_dbg_with-frame.html \
- browser_dbg_pause-exceptions.html \
- browser_dbg_breakpoint-new-script.html \
- browser_dbg_conditional-breakpoints.html \
- browser_dbg_watch-expressions.html \
- browser_dbg_function-search-01.html \
- browser_dbg_function-search-02.html \
- test-function-search-01.js \
- test-function-search-02.js \
- test-function-search-03.js \
- binary_search.html \
- binary_search.coffee \
- binary_search.js \
- binary_search.map \
- test-location-changes-bp.js \
- test-location-changes-bp.html \
- test-step-out.html \
- $(NULL)
-
-# Bug 903750 - Disabled on OSX for intermittent failures
-ifneq ($(OS_ARCH), Darwin)
-MOCHITEST_BROWSER_TESTS += \
- browser_dbg_propertyview-filter-01.js \
- $(NULL)
-endif
-
-# Bug 847588, bug 860349, bug 871713
-# Disabled on OSX and Linux for intermittent failures
-ifeq (,$(filter Darwin Linux,$(OS_ARCH)))
-MOCHITEST_BROWSER_TESTS += \
- browser_dbg_createChrome.js \
- browser_dbg_propertyview-filter-02.js \
- browser_dbg_propertyview-filter-03.js \
- browser_dbg_propertyview-reexpand.js \
- $(NULL)
-endif
-
-MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/debugger/test/binary_search.coffee b/browser/devtools/debugger/test/binary_search.coffee
deleted file mode 100644
index e3dacdaaa..000000000
--- a/browser/devtools/debugger/test/binary_search.coffee
+++ /dev/null
@@ -1,18 +0,0 @@
-# Uses a binary search algorithm to locate a value in the specified array.
-window.binary_search = (items, value) ->
-
- start = 0
- stop = items.length - 1
- pivot = Math.floor (start + stop) / 2
-
- while items[pivot] isnt value and start < stop
-
- # Adjust the search area.
- stop = pivot - 1 if value < items[pivot]
- start = pivot + 1 if value > items[pivot]
-
- # Recalculate the pivot.
- pivot = Math.floor (stop + start) / 2
-
- # Make sure we've found the correct value.
- if items[pivot] is value then pivot else -1 \ No newline at end of file
diff --git a/browser/devtools/debugger/test/binary_search.html b/browser/devtools/debugger/test/binary_search.html
deleted file mode 100644
index f9615da7c..000000000
--- a/browser/devtools/debugger/test/binary_search.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Source Map Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript" src="binary_search.js"></script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/binary_search.js b/browser/devtools/debugger/test/binary_search.js
deleted file mode 100644
index ab5a77df1..000000000
--- a/browser/devtools/debugger/test/binary_search.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// Generated by CoffeeScript 1.6.1
-(function() {
-
- window.binary_search = function(items, value) {
- var pivot, start, stop;
- start = 0;
- stop = items.length - 1;
- pivot = Math.floor((start + stop) / 2);
- while (items[pivot] !== value && start < stop) {
- if (value < items[pivot]) {
- stop = pivot - 1;
- }
- if (value > items[pivot]) {
- start = pivot + 1;
- }
- pivot = Math.floor((stop + start) / 2);
- }
- if (items[pivot] === value) {
- return pivot;
- } else {
- return -1;
- }
- };
-
-}).call(this);
-
-/*
-//# sourceMappingURL=binary_search.map
-*/
diff --git a/browser/devtools/debugger/test/binary_search.map b/browser/devtools/debugger/test/binary_search.map
deleted file mode 100644
index c5aaeab2f..000000000
--- a/browser/devtools/debugger/test/binary_search.map
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "version": 3,
- "file": "binary_search.js",
- "sourceRoot": "",
- "sources": [
- "binary_search.coffee"
- ],
- "names": [],
- "mappings": ";AACA;CAAA;CAAA,CAAA,CAAuB,EAAA,CAAjB,GAAkB,IAAxB;CAEE,OAAA,UAAA;CAAA,EAAQ,CAAR,CAAA;CAAA,EACQ,CAAR,CAAa,CAAL;CADR,EAEQ,CAAR,CAAA;CAEA,EAA0C,CAAR,CAAtB,MAAN;CAGJ,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,CAAR,CAAQ,GAAR;QAAA;CACA,EAA6B,CAAR,CAAA,CAArB;CAAA,EAAQ,EAAR,GAAA;QADA;CAAA,EAIQ,CAAI,CAAZ,CAAA;CAXF,IAIA;CAUA,GAAA,CAAS;CAAT,YAA8B;MAA9B;AAA0C,CAAD,YAAA;MAhBpB;CAAvB,EAAuB;CAAvB"
-} \ No newline at end of file
diff --git a/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js b/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js
deleted file mode 100644
index a179a2d0a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_aaa_run_first_leaktest.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * This tests if the debugger leaks.
- * If leaks happen here, there's something very, very fishy going on.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- // Wait longer for this very simple test that comes first, to make sure that
- // GC from previous tests does not interfere with the debugger suite.
- requestLongerTimeout(2);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest()
- {
- closeDebuggerAndFinish();
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bfcache.js b/browser/devtools/debugger/test/browser_dbg_bfcache.js
deleted file mode 100644
index 0b2b4c1ea..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bfcache.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the debugger is updated with the correct scripts when moving
- * back and forward in the tab.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSources = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testInitialLoad();
- });
-}
-
-function testInitialLoad() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- executeSoon(function() {
- validateFirstPage();
- testLocationChange();
- });
- });
-
- gDebuggee.firstCall();
-}
-
-function testLocationChange()
-{
- gDebugger.DebuggerController.activeThread.resume(function() {
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
-
- gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- validateSecondPage();
- testBack();
- });
- });
- });
- content.location = STACK_URL;
- });
-}
-
-function testBack()
-{
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired after going back.");
- info("Still attached to the tab.");
-
- gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- validateFirstPage();
- testForward();
- });
- });
- });
-
- info("Going back.");
- content.history.back();
-}
-
-function testForward()
-{
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired after going forward.");
- info("Still attached to the tab.");
-
- gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- validateSecondPage();
- closeDebuggerAndFinish();
- });
- });
- });
-
- info("Going forward.");
- content.history.forward();
-}
-
-function validateFirstPage() {
- gSources = gDebugger.DebuggerView.Sources;
-
- is(gSources.itemCount, 2,
- "Found the expected number of scripts.");
-
- ok(gDebugger.DebuggerView.Sources.containsLabel("test-script-switching-01.js"),
- "Found the first script label.");
- ok(gDebugger.DebuggerView.Sources.containsLabel("test-script-switching-02.js"),
- "Found the second script label.");
-}
-
-function validateSecondPage() {
- gSources = gDebugger.DebuggerView.Sources;
-
- is(gSources.itemCount, 1,
- "Found the expected number of scripts.");
-
- ok(gDebugger.DebuggerView.Sources.containsLabel("browser_dbg_stack.html"),
- "Found the single script label.");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_big-data.html b/browser/devtools/debugger/test/browser_dbg_big-data.html
deleted file mode 100644
index bbdacd6a6..000000000
--- a/browser/devtools/debugger/test/browser_dbg_big-data.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Debugger Big Data Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- window.addEventListener("load", function() {
- function test(aNumber) {
- var buffer = new ArrayBuffer(aNumber);
- var z = new Int8Array(buffer);
- debugger;
- };
- function load() {
- test(10000);
- }
- var button = document.querySelector("button");
- button.addEventListener("click", load, false);
- });
- </script>
-
- </head>
- <body>
- <button>Click me!</button>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js b/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js
deleted file mode 100644
index a16b8264f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_breadcrumbs-access.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest()
- {
- let editor = gDebugger.DebuggerView.editor;
- let sources = gDebugger.DebuggerView.Sources;
- let stackframes = gDebugger.DebuggerView.StackFrames;
-
- is(editor.getCaretPosition().line, 5,
- "The source editor caret position was incorrect (1).");
- is(sources.selectedLabel, "test-script-switching-02.js",
- "The currently selected source is incorrect (1).");
- is(stackframes.selectedIndex, 3,
- "The currently selected stackframe is incorrect (1).");
-
- EventUtils.sendKey("DOWN", gDebugger);
- is(editor.getCaretPosition().line, 6,
- "The source editor caret position was incorrect (2).");
- is(sources.selectedLabel, "test-script-switching-02.js",
- "The currently selected source is incorrect (2).");
- is(stackframes.selectedIndex, 3,
- "The currently selected stackframe is incorrect (2).");
-
- EventUtils.sendKey("UP", gDebugger);
- is(editor.getCaretPosition().line, 5,
- "The source editor caret position was incorrect (3).");
- is(sources.selectedLabel, "test-script-switching-02.js",
- "The currently selected source is incorrect (3).");
- is(stackframes.selectedIndex, 3,
- "The currently selected stackframe is incorrect (3).");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- stackframes.selectedItem.target,
- gDebugger);
-
-
- EventUtils.sendKey("UP", gDebugger);
- is(editor.getCaretPosition().line, 5,
- "The source editor caret position was incorrect (4).");
- is(sources.selectedLabel, "test-script-switching-02.js",
- "The currently selected source is incorrect (4).");
- is(stackframes.selectedIndex, 2,
- "The currently selected stackframe is incorrect (4).");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- is(editor.getCaretPosition().line, 4,
- "The source editor caret position was incorrect (5).");
- is(sources.selectedLabel, "test-script-switching-01.js",
- "The currently selected source is incorrect (5).");
- is(stackframes.selectedIndex, 1,
- "The currently selected stackframe is incorrect (5).");
-
- EventUtils.sendKey("UP", gDebugger);
-
- is(editor.getCaretPosition().line, 4,
- "The source editor caret position was incorrect (6).");
- is(sources.selectedLabel, "test-script-switching-01.js",
- "The currently selected source is incorrect (6).");
- is(stackframes.selectedIndex, 0,
- "The currently selected stackframe is incorrect (6).");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- is(editor.getCaretPosition().line, 5,
- "The source editor caret position was incorrect (7).");
- is(sources.selectedLabel, "test-script-switching-02.js",
- "The currently selected source is incorrect (7).");
- is(stackframes.selectedIndex, 3,
- "The currently selected stackframe is incorrect (7).");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- is(editor.getCaretPosition().line, 4,
- "The source editor caret position was incorrect (8).");
- is(sources.selectedLabel, "test-script-switching-01.js",
- "The currently selected source is incorrect (8).");
- is(stackframes.selectedIndex, 0,
- "The currently selected stackframe is incorrect (8).");
-
- closeDebuggerAndFinish();
- });
-
- EventUtils.sendKey("HOME", gDebugger);
- });
-
- EventUtils.sendKey("END", gDebugger);
- });
-
- EventUtils.sendKey("UP", gDebugger);
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html b/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html
deleted file mode 100644
index 547afd9d8..000000000
--- a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset='utf-8'/>
-<script type="text/javascript">
-function runDebuggerStatement() {
- debugger;
-}
-function myFunction() {
- var a = 1;
- debugger;
-}
-</script>
-</head>
-<body>
-
-<button type="button" onclick="myFunction()">Run</button>
-
-</body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js b/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js
deleted file mode 100644
index 59ebc49ee..000000000
--- a/browser/devtools/debugger/test/browser_dbg_breakpoint-new-script.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Bug 771452: make sure that setting a breakpoint in an inline script doesn't
-// add it twice.
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_breakpoint-new-script.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- testAddBreakpoint();
- });
-}
-
-function testAddBreakpoint()
-{
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The debugger statement was reached.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have one frame.");
-
- gPane.addBreakpoint({ url: TAB_URL, line: 9 }, function (aResponse, bpClient) {
- testResume();
- });
- }}, 0);
- });
-
- gDebuggee.runDebuggerStatement();
-}
-
-function testResume()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint wasn't hit yet.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("resumed", function() {
- thread.addOneTimeListener("paused", function() {
- executeSoon(testBreakpointHit);
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"));
- });
-
- thread.resume();
-}
-
-function testBreakpointHit()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint was hit.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("paused", function test(aEvent, aPacket) {
- thread.addOneTimeListener("resumed", function() {
- executeSoon(closeDebuggerAndFinish);
- });
-
- is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line.");
- isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit.");
- thread.resume();
- });
-
- thread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js b/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js
deleted file mode 100644
index 642ffd50c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug723069_editor-breakpoints.js
+++ /dev/null
@@ -1,308 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 723069: test the debugger breakpoint API and connection to the source
- * editor.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gBreakpoints = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onSourceShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onSourceShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest()
- {
- gSources = gDebugger.DebuggerView.Sources;
- gEditor = gDebugger.editor;
- gBreakpoints = gPane.getAllBreakpoints();
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 2,
- "Found the expected number of scripts.");
-
- isnot(gEditor.getText().indexOf("debugger"), -1,
- "The correct script was loaded initially.");
-
- isnot(gSources.selectedValue, gSources.values[0],
- "The correct script is selected");
-
- is(Object.keys(gBreakpoints), 0, "no breakpoints");
- ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey");
- is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor");
-
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddFirst);
- executeSoon(function() {
- gPane.addBreakpoint({url: gSources.selectedValue, line: 6}, onBreakpointAddFirst);
- });
- }
-
- let breakpointsAdded = 0;
- let breakpointsRemoved = 0;
- let editorBreakpointChanges = 0;
-
- function onEditorBreakpointAddFirst(aEvent)
- {
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddFirst);
- editorBreakpointChanges++;
-
- ok(aEvent, "breakpoint1 added to the editor");
- is(aEvent.added.length, 1, "one breakpoint added to the editor");
- is(aEvent.removed.length, 0, "no breakpoint was removed from the editor");
- is(aEvent.added[0].line, 5, "editor breakpoint line is correct");
-
- is(gEditor.getBreakpoints().length, 1,
- "editor.getBreakpoints().length is correct");
- }
-
- function onBreakpointAddFirst(aBreakpointClient, aResponseError)
- {
- breakpointsAdded++;
-
- ok(aBreakpointClient, "breakpoint1 added, client received");
- ok(!aResponseError, "breakpoint1 added without errors");
- is(aBreakpointClient.location.url, gSources.selectedValue,
- "breakpoint1 client url is correct");
- is(aBreakpointClient.location.line, 6,
- "breakpoint1 client line is correct");
-
- executeSoon(function() {
- ok(aBreakpointClient.actor in gBreakpoints,
- "breakpoint1 client found in the list of debugger breakpoints");
- is(Object.keys(gBreakpoints).length, 1,
- "the list of debugger breakpoints holds only one breakpoint");
- is(gPane.getBreakpoint(gSources.selectedValue, 6), aBreakpointClient,
- "getBreakpoint returns the correct breakpoint");
-
- info("remove the first breakpoint");
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveFirst);
- gPane.removeBreakpoint(aBreakpointClient, onBreakpointRemoveFirst);
- });
- }
-
- function onBreakpointRemoveFirst(aLocation)
- {
- breakpointsRemoved++;
-
- ok(aLocation, "breakpoint1 removed");
- is(aLocation.url, gSources.selectedValue, "breakpoint1 remove: url is correct");
- is(aLocation.line, 6, "breakpoint1 remove: line is correct");
-
- executeSoon(testBreakpointAddBackground);
- }
-
- function onEditorBreakpointRemoveFirst(aEvent)
- {
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveFirst);
- editorBreakpointChanges++;
-
- ok(aEvent, "breakpoint1 removed from the editor");
- is(aEvent.added.length, 0, "no breakpoint was added to the editor");
- is(aEvent.removed.length, 1, "one breakpoint was removed from the editor");
- is(aEvent.removed[0].line, 5, "editor breakpoint line is correct");
-
- is(gEditor.getBreakpoints().length, 0,
- "editor.getBreakpoints().length is correct");
- }
-
- function testBreakpointAddBackground()
- {
- info("add a breakpoint to the second script which is not selected");
-
- is(Object.keys(gBreakpoints).length, 0,
- "no breakpoints in the debugger");
- ok(!gPane.getBreakpoint(gSources.selectedValue, 6),
- "getBreakpoint(selectedScript, 6) returns no breakpoint");
- isnot(gSources.values[0], gSources.selectedValue,
- "first script location is not the currently selected script");
-
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap);
- gPane.addBreakpoint({url: gSources.values[0], line: 5}, onBreakpointAddBackground);
- }
-
- function onEditorBreakpointAddBackgroundTrap(aEvent)
- {
- // Trap listener: no breakpoint must be added to the editor when a
- // breakpoint is added to a script that is not currently selected.
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap);
- editorBreakpointChanges++;
- ok(false, "breakpoint2 must not be added to the editor");
- }
-
- function onBreakpointAddBackground(aBreakpointClient, aResponseError)
- {
- breakpointsAdded++;
-
- ok(aBreakpointClient, "breakpoint2 added, client received");
- ok(!aResponseError, "breakpoint2 added without errors");
- is(aBreakpointClient.location.url, gSources.values[0],
- "breakpoint2 client url is correct");
- is(aBreakpointClient.location.line, 5,
- "breakpoint2 client line is correct");
-
- executeSoon(function() {
- ok(aBreakpointClient.actor in gBreakpoints,
- "breakpoint2 client found in the list of debugger breakpoints");
-
- is(Object.keys(gBreakpoints).length, 1,
- "one breakpoint in the debugger");
- is(gPane.getBreakpoint(gSources.values[0], 5), aBreakpointClient,
- "getBreakpoint(locations[0], 5) returns the correct breakpoint");
-
- // remove the trap listener
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddBackgroundTrap);
-
- info("switch to the second script");
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddSwitch);
- gEditor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onEditorTextChanged);
- gSources.selectedIndex = 0;
- });
- }
-
- function onEditorBreakpointAddSwitch(aEvent)
- {
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointAddSwitch);
- editorBreakpointChanges++;
-
- ok(aEvent, "breakpoint2 added to the editor");
- is(aEvent.added.length, 1, "one breakpoint added to the editor");
- is(aEvent.removed.length, 0, "no breakpoint was removed from the editor");
- is(aEvent.added[0].line, 4, "editor breakpoint line is correct");
-
- is(gEditor.getBreakpoints().length, 1,
- "editor.getBreakpoints().length is correct");
- }
-
- function onEditorTextChanged()
- {
- // Wait for the actual text to be shown.
- if (gDebugger.editor.getText() == gDebugger.L10N.getStr("loadingText")) {
- return;
- }
- // The requested source text has been shown, remove the event listener.
- gEditor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onEditorTextChanged);
-
- is(gEditor.getText().indexOf("debugger"), -1,
- "The second script is no longer displayed.");
-
- isnot(gEditor.getText().indexOf("firstCall"), -1,
- "The first script is displayed.");
-
- let window = gEditor.editorElement.contentWindow;
- executeSoon(() => window.mozRequestAnimationFrame(onReadyForClick));
- }
-
- function onReadyForClick()
- {
- info("remove the second breakpoint using the mouse");
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveSecond);
-
- let iframe = gEditor.editorElement;
- let testWin = iframe.ownerDocument.defaultView;
-
- // flush the layout for the iframe
- info("rect " + iframe.contentDocument.documentElement.getBoundingClientRect());
-
- let utils = testWin.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils);
-
- let lineOffset = gEditor.getLineStart(4);
- let coords = gEditor.getLocationAtOffset(lineOffset);
-
- let rect = iframe.getBoundingClientRect();
- let left = rect.left + 10;
- let top = rect.top + coords.y + 4;
- utils.sendMouseEventToWindow("mousedown", left, top, 0, 1, 0, false, 0, 0);
- utils.sendMouseEventToWindow("mouseup", left, top, 0, 1, 0, false, 0, 0);
- }
-
- function onEditorBreakpointRemoveSecond(aEvent)
- {
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, onEditorBreakpointRemoveSecond);
- editorBreakpointChanges++;
-
- ok(aEvent, "breakpoint2 removed from the editor");
- is(aEvent.added.length, 0, "no breakpoint was added to the editor");
- is(aEvent.removed.length, 1, "one breakpoint was removed from the editor");
- is(aEvent.removed[0].line, 4, "editor breakpoint line is correct");
-
- is(gEditor.getBreakpoints().length, 0,
- "editor.getBreakpoints().length is correct");
-
- executeSoon(function() {
- gDebugger.gClient.addOneTimeListener("resumed", function() {
- finalCheck();
- closeDebuggerAndFinish();
- });
- gDebugger.DebuggerController.activeThread.resume();
- });
- }
-
- function finalCheck() {
- is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger");
- ok(!gPane.getBreakpoint(gSources.values[0], 5),
- "getBreakpoint(locations[0], 5) returns no breakpoint");
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- is(breakpointsAdded, 2, "correct number of breakpoints have been added");
- is(breakpointsRemoved, 1, "correct number of breakpoints have been removed");
- is(editorBreakpointChanges, 4, "correct number of editor breakpoint changes");
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gBreakpoints = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js
deleted file mode 100644
index 20bfb39a1..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-contextmenu.js
+++ /dev/null
@@ -1,466 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if the context menu associated with each breakpoint does what it should.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSources.preferredSource = EXAMPLE_URL + "test-script-switching-02.js";
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let { url, loaded, text } = aEvent.detail;
- info("Shown source: " + url + ", loaded: " + loaded + ", text:\n" + text);
- info("Shown label: " + gSources.selectedLabel);
- info("All labels:" + gSources.labels);
- if (url.indexOf("-02") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- performTestWhileNotPaused();
- }
- });
- });
-
- function addBreakpoints(callback) {
- gPane.addBreakpoint({url: gSources.orderedItems[0].value, line: 5}, function(cl, err) {
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 6}, function(cl, err) {
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 7}, function(cl, err) {
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 8}, function(cl, err) {
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 9}, function(cl, err) {
- callback();
- });
- });
- });
- });
- });
- }
-
- function performTestWhileNotPaused()
- {
- info("Performing test while not paused...");
-
- addBreakpoints(function() {
- initialChecks();
-
- checkBreakpointToggleSelf(0, function() {
- checkBreakpointToggleOthers(0, function() {
- checkBreakpointToggleSelf(1, function() {
- checkBreakpointToggleOthers(1, function() {
- checkBreakpointToggleSelf(2, function() {
- checkBreakpointToggleOthers(2, function() {
- checkBreakpointToggleSelf(3, function() {
- checkBreakpointToggleOthers(3, function() {
- checkBreakpointToggleSelf(4, function() {
- checkBreakpointToggleOthers(4, function() {
- testDeleteAll(function() {
- performTestWhilePaused();
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- });
- }
-
- function performTestWhilePaused()
- {
- info("Performing test while paused...");
-
- addBreakpoints(function() {
- initialChecks();
-
- pauseAndCheck(function() {
- checkBreakpointToggleSelf(0, function() {
- checkBreakpointToggleOthers(0, function() {
- checkBreakpointToggleSelf(1, function() {
- checkBreakpointToggleOthers(1, function() {
- checkBreakpointToggleSelf(2, function() {
- checkBreakpointToggleOthers(2, function() {
- checkBreakpointToggleSelf(3, function() {
- checkBreakpointToggleOthers(3, function() {
- checkBreakpointToggleSelf(4, function() {
- checkBreakpointToggleOthers(4, function() {
- testDeleteAll(function() {
- closeDebuggerAndFinish();
- });
- }, true);
- });
- }, true);
- });
- }, true);
- });
- }, true);
- });
- }, true);
- });
- });
- });
- }
-
- function pauseAndCheck(callback) {
- gDebugger.gThreadClient.addOneTimeListener("resumed", function() {
- pauseAndCallback(function() {
- is(gSources.selectedLabel, "test-script-switching-01.js",
- "The currently selected source is incorrect (1).");
- is(gSources.selectedIndex, 1,
- "The currently selected source is incorrect (2).");
-
- waitForCaretPos(4, function() {
- ok(true, "The editor location is correct after pausing.");
- callback();
- });
- });
- });
- }
-
- function pauseAndCallback(callback) {
- let scriptShown = false;
- let framesadded = false;
- let testContinued = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-01") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- scriptShown = true;
- executeSoon(continueTest);
- }
- });
-
- gDebugger.gThreadClient.addOneTimeListener("framesadded", function() {
- framesadded = true;
- executeSoon(continueTest);
- });
-
- function continueTest() {
- if (scriptShown && framesadded && !testContinued) {
- testContinued = true;
- callback();
- }
- }
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
- }
-
- function initialChecks() {
- for (let source in gSources) {
- for (let breakpoint in source) {
- let { sourceLocation: url, lineNumber: line, actor } = breakpoint.attachment;
-
- ok(gPane.getBreakpoint(url, line),
- "All breakpoint items should have corresponding clients (1).");
- ok(breakpoint.attachment.actor,
- "All breakpoint items should have corresponding clients (2).");
- is(!!breakpoint.attachment.disabled, false,
- "All breakpoints should initially be enabled.");
-
- let prefix = "bp-cMenu-"; // "breakpoints context menu"
- let enableSelfId = prefix + "enableSelf-" + actor + "-menuitem";
- let disableSelfId = prefix + "disableSelf-" + actor + "-menuitem";
-
- is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true",
- "The 'Enable breakpoint' context menu item should initially be hidden'.");
- ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"),
- "The 'Disable breakpoint' context menu item should initially not be hidden'.");
- is(breakpoint.attachment.view.checkbox.getAttribute("checked"), "true",
- "All breakpoints should initially have a checked checkbox.");
- }
- }
- }
-
- function checkBreakpointToggleSelf(index, callback) {
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[index],
- gDebugger);
-
- let selectedBreakpoint = gSources.selectedBreakpointItem;
- let { sourceLocation: url, lineNumber: line, actor } = selectedBreakpoint.attachment;
-
- ok(gPane.getBreakpoint(url, line),
- "There should be a breakpoint client available (1).");
- ok(gSources.selectedBreakpointClient,
- "There should be a breakpoint client available (2).");
- is(!!selectedBreakpoint.attachment.disabled, false,
- "The breakpoint should not be disabled yet.");
-
- let prefix = "bp-cMenu-"; // "breakpoints context menu"
- let enableSelfId = prefix + "enableSelf-" + actor + "-menuitem";
- let disableSelfId = prefix + "disableSelf-" + actor + "-menuitem";
-
- is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true",
- "The 'Enable breakpoint' context menu item should be hidden'.");
- ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"),
- "The 'Disable breakpoint' context menu item should not be hidden'.");
-
- waitForCaretPos(selectedBreakpoint.attachment.lineNumber - 1, function() {
- ok(true, "The editor location is correct (" + index + ").");
-
- gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- ok(!gPane.getBreakpoint(url, line),
- "There should be no breakpoint client available (2).");
- ok(!gSources.selectedBreakpointClient,
- "There should be no breakpoint client available (3).");
-
- gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- ok(gPane.getBreakpoint(url, line),
- "There should be a breakpoint client available (4).");
- ok(gSources.selectedBreakpointClient,
- "There should be a breakpoint client available (5).");
-
- callback();
- });
-
- // Test re-disabling this breakpoint.
- executeSoon(function() {
- gSources._onEnableSelf(selectedBreakpoint.attachment.actor);
- is(selectedBreakpoint.attachment.disabled, false,
- "The current breakpoint should now be enabled.")
-
- is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true",
- "The 'Enable breakpoint' context menu item should be hidden'.");
- ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"),
- "The 'Disable breakpoint' context menu item should not be hidden'.");
- ok(selectedBreakpoint.attachment.view.checkbox.hasAttribute("checked"),
- "The breakpoint should now be checked.");
- });
- });
-
- // Test disabling this breakpoint.
- executeSoon(function() {
- gSources._onDisableSelf(selectedBreakpoint.attachment.actor);
- is(selectedBreakpoint.attachment.disabled, true,
- "The current breakpoint should now be disabled.")
-
- ok(!gDebugger.document.getElementById(enableSelfId).hasAttribute("hidden"),
- "The 'Enable breakpoint' context menu item should not be hidden'.");
- is(gDebugger.document.getElementById(disableSelfId).getAttribute("hidden"), "true",
- "The 'Disable breakpoint' context menu item should be hidden'.");
- ok(!selectedBreakpoint.attachment.view.checkbox.hasAttribute("checked"),
- "The breakpoint should now be unchecked.");
- });
- });
- }
-
- function checkBreakpointToggleOthers(index, callback, whilePaused) {
- let count = 4
- gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) {
- info(count + " breakpoints remain to be hidden...");
- if (!(--count)) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- ok(true, "All breakpoints except one were hidden.");
-
- let selectedBreakpoint = gSources.selectedBreakpointItem;
- let { sourceLocation: url, lineNumber: line, actor } = selectedBreakpoint.attachment;
-
- ok(gPane.getBreakpoint(url, line),
- "There should be a breakpoint client available (6).");
- ok(gSources.selectedBreakpointClient,
- "There should be a breakpoint client available (7).");
- is(!!selectedBreakpoint.attachment.disabled, false,
- "The targetted breakpoint should not have been disabled.");
-
- for (let source in gSources) {
- for (let otherBreakpoint in source) {
- if (otherBreakpoint != selectedBreakpoint) {
- ok(!gPane.getBreakpoint(
- otherBreakpoint.attachment.sourceLocation,
- otherBreakpoint.attachment.lineNumber),
- "There should be no breakpoint client for a disabled breakpoint (8).");
- is(otherBreakpoint.attachment.disabled, true,
- "Non-targetted breakpoints should have been disabled (9).");
- }
- }
- }
-
- count = 4;
- gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) {
- info(count + " breakpoints remain to be reshown...");
- if (!(--count)) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- ok(true, "All breakpoints are now reshown.");
-
- for (let source in gSources) {
- for (let someBreakpoint in source) {
- ok(gPane.getBreakpoint(
- someBreakpoint.attachment.sourceLocation,
- someBreakpoint.attachment.lineNumber),
- "There should be a breakpoint client for all enabled breakpoints (10).");
- is(someBreakpoint.attachment.disabled, false,
- "All breakpoints should now have been enabled (11).");
- }
- }
-
- count = 5;
- gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) {
- info(count + " breakpoints remain to be rehidden...");
- if (!(--count)) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- ok(true, "All breakpoints are now rehidden.");
-
- for (let source in gSources) {
- for (let someBreakpoint in source) {
- ok(!gPane.getBreakpoint(
- someBreakpoint.attachment.sourceLocation,
- someBreakpoint.attachment.lineNumber),
- "There should be no breakpoint client for a disabled breakpoint (12).");
- is(someBreakpoint.attachment.disabled, true,
- "All breakpoints should now have been disabled (13).");
- }
- }
-
- count = 5;
- gDebugger.addEventListener("Debugger:BreakpointShown", function _onEvent(aEvent) {
- info(count + " breakpoints remain to be reshown...");
- if (!(--count)) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- ok(true, "All breakpoints are now rehidden.");
-
- for (let source in gSources) {
- for (let someBreakpoint in source) {
- ok(gPane.getBreakpoint(
- someBreakpoint.attachment.sourceLocation,
- someBreakpoint.attachment.lineNumber),
- "There should be a breakpoint client for all enabled breakpoints (14).");
- is(someBreakpoint.attachment.disabled, false,
- "All breakpoints should now have been enabled (15).");
- }
- }
-
- // Done.
- if (!whilePaused) {
- gDebugger.gThreadClient.addOneTimeListener("resumed", callback);
- } else {
- callback();
- }
- }
- });
-
- // Test re-enabling all breakpoints.
- enableAll();
- }
- });
-
- // Test disabling all breakpoints.
- if (!whilePaused) {
- gDebugger.gThreadClient.addOneTimeListener("resumed", disableAll);
- } else {
- disableAll();
- }
- }
- });
-
- // Test re-enabling other breakpoints.
- enableOthers();
- }
- });
-
- // Test disabling other breakpoints.
- if (!whilePaused) {
- gDebugger.gThreadClient.addOneTimeListener("resumed", disableOthers);
- } else {
- disableOthers();
- }
- }
-
- function testDeleteAll(callback) {
- let count = 5
- gDebugger.addEventListener("Debugger:BreakpointHidden", function _onEvent(aEvent) {
- info(count + " breakpoints remain to be hidden...");
- if (!(--count)) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- ok(true, "All breakpoints were hidden.");
-
- ok(!gSources.selectedBreakpointItem,
- "There should be no breakpoint item available (16).");
- ok(!gSources.selectedBreakpointClient,
- "There should be no breakpoint client available (17).");
-
- for (let source in gSources) {
- for (let otherBreakpoint in source) {
- ok(false, "It's a trap!");
- }
- }
-
- // Done.
- callback();
- }
- });
-
- // Test deleting all breakpoints.
- deleteAll();
- }
-
- function disableOthers() {
- gSources._onDisableOthers(gSources.selectedBreakpointItem.attachment.actor);
- }
- function enableOthers() {
- gSources._onEnableOthers(gSources.selectedBreakpointItem.attachment.actor);
- }
- function disableAll() {
- gSources._onDisableAll(gSources.selectedBreakpointItem.attachment.actor);
- }
- function enableAll() {
- gSources._onEnableAll(gSources.selectedBreakpointItem.attachment.actor);
- }
- function deleteAll() {
- gSources._onDeleteAll(gSources.selectedBreakpointItem.attachment.actor);
- }
-
- function waitForCaretPos(number, callback)
- {
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gEditor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js
deleted file mode 100644
index 1440cf268..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-highlight.js
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if breakpoints are highlighted when they should.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSources.preferredSource = EXAMPLE_URL + "test-script-switching-02.js";
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let { url, loaded, text } = aEvent.detail;
- info("Shown source: " + url + ", loaded: " + loaded + ", text:\n" + text);
- info("Shown label: " + gSources.selectedLabel);
- info("All labels:" + gSources.labels);
- if (url.indexOf("-02") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- performTest();
- }
- });
- });
-
- function performTest()
- {
- initialChecks();
- gPane.addBreakpoint({url: gSources.orderedItems[0].value, line: 5}, function(cl, err) {
- initialChecks();
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 6}, function(cl, err) {
- initialChecks();
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 7}, function(cl, err) {
- initialChecks();
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 8}, function(cl, err) {
- initialChecks();
- gPane.addBreakpoint({url: gSources.orderedItems[1].value, line: 9}, function(cl, err) {
- initialChecks();
- testHighlight1();
- });
- });
- });
- });
- });
- }
-
- function initialChecks() {
- is(gSources.selectedValue, gSources.orderedItems[1].value,
- "The currently selected source is incorrect (0).");
- is(gEditor.getCaretPosition().line, 0,
- "The editor caret line was incorrect (0).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (0).");
- }
-
- function testHighlight1() {
- gSources.highlightBreakpoint(gSources.orderedItems[0].value, 5);
- checkHighlight(gSources.orderedItems[0].value, 5);
-
- is(gSources.selectedValue, gSources.orderedItems[1].value,
- "The currently selected source is incorrect (1).");
-
- is(gEditor.getCaretPosition().line, 0,
- "The editor caret line was incorrect (1).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (1).");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[0],
- gDebugger);
-
- waitForCaretPos(4, function() {
- ok(true, "The editor location is correct (1).");
- testHighlight2();
- });
- }
-
- function testHighlight2() {
- gSources.highlightBreakpoint(gSources.orderedItems[1].value, 6);
- checkHighlight(gSources.orderedItems[1].value, 6);
-
- is(gSources.selectedValue, gSources.orderedItems[0].value,
- "The currently selected source is incorrect (2).");
-
- is(gEditor.getCaretPosition().line, 4,
- "The editor caret line was incorrect (2).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (2).");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[1],
- gDebugger);
-
- waitForCaretPos(5, function() {
- ok(true, "The editor location is correct (2).");
- testHighlight3();
- });
- }
-
- function testHighlight3() {
- gSources.highlightBreakpoint(gSources.orderedItems[1].value, 7);
- checkHighlight(gSources.orderedItems[1].value, 7);
-
- is(gSources.selectedValue, gSources.orderedItems[1].value,
- "The currently selected source is incorrect (3).");
-
- is(gEditor.getCaretPosition().line, 5,
- "The editor caret line was incorrect (3).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (3).");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[2],
- gDebugger);
-
- waitForCaretPos(6, function() {
- ok(true, "The editor location is correct (3).");
- testHighlight4();
- });
- }
-
- function testHighlight4() {
- gSources.highlightBreakpoint(gSources.orderedItems[1].value, 8);
- checkHighlight(gSources.orderedItems[1].value, 8);
-
- is(gSources.selectedValue, gSources.orderedItems[1].value,
- "The currently selected source is incorrect (4).");
-
- is(gEditor.getCaretPosition().line, 6,
- "The editor caret line was incorrect (4).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (4).");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[3],
- gDebugger);
-
- waitForCaretPos(7, function() {
- ok(true, "The editor location is correct (4).");
- testHighlight5();
- });
- }
-
- function testHighlight5() {
- gSources.highlightBreakpoint(gSources.orderedItems[1].value, 9);
- checkHighlight(gSources.orderedItems[1].value, 9);
-
- is(gSources.selectedValue, gSources.orderedItems[1].value,
- "The currently selected source is incorrect (5).");
-
- is(gEditor.getCaretPosition().line, 7,
- "The editor caret line was incorrect (5).");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret column was incorrect (5).");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebugger.document.querySelectorAll(".dbg-breakpoint")[4],
- gDebugger);
-
- waitForCaretPos(8, function() {
- ok(true, "The editor location is correct (5).");
- closeDebuggerAndFinish();
- });
- }
-
- function checkHighlight(aUrl, aLine) {
- is(gSources.selectedBreakpointItem, gSources.getBreakpoint(aUrl, aLine),
- "The currently selected breakpoint item is incorrect.");
- is(gSources.selectedBreakpointClient, gPane.getBreakpoint(aUrl, aLine),
- "The currently selected breakpoint client is incorrect.");
-
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, aUrl,
- "The selected breakpoint item's source location attachment is incorrect.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, aLine,
- "The selected breakpoint item's source line number is incorrect.");
-
- ok(gSources.selectedBreakpointItem.target.classList.contains("selected"),
- "The selected breakpoint item's target should have a selected class.");
- }
-
- function waitForCaretPos(number, callback)
- {
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gEditor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js b/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js
deleted file mode 100644
index edce10c27..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug723071_editor-breakpoints-pane.js
+++ /dev/null
@@ -1,301 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 723071: test adding a pane to display the list of breakpoints across
- * all scripts in the debuggee.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gBreakpoints = null;
-let gBreakpointsParent = null;
-let gBreakpointsList = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- let breakpointsAdded = 0;
- let breakpointsDisabled = 0;
- let breakpointsRemoved = 0;
-
- function performTest()
- {
- gEditor = gDebugger.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gBreakpoints = gPane.getAllBreakpoints();
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 2,
- "Found the expected number of scripts.");
-
- isnot(gEditor.getText().indexOf("debugger"), -1,
- "The correct script was loaded initially.");
-
- isnot(gSources.selectedValue, gSources.values[0],
- "The correct script is selected");
-
- is(Object.keys(gBreakpoints).length, 0, "no breakpoints");
- ok(!gPane.getBreakpoint("chocolate", 3), "getBreakpoint('chocolate', 3) returns falsey");
- is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor");
-
- gBreakpointsParent = gSources.widget._parent;
- gBreakpointsList = gSources.widget._list;
-
- is(gBreakpointsParent.childNodes.length, 1, // one sources list
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.childNodes.length, 1, // one sources group
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 0,
- "No breakpoints should be visible at this point.");
-
- addBreakpoints(function() {
- is(breakpointsAdded, 3,
- "Should have added 3 breakpoints so far.");
- is(breakpointsDisabled, 0,
- "Shouldn't have disabled anything so far.");
- is(breakpointsRemoved, 0,
- "Shouldn't have removed anything so far.");
-
- is(gBreakpointsParent.childNodes.length, 1, // one sources list
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.childNodes.length, 1, // one sources group
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 3,
- "3 breakpoints should be visible at this point.");
-
- disableBreakpoints(function() {
- is(breakpointsAdded, 3,
- "Should still have 3 breakpoints added so far.");
- is(breakpointsDisabled, 3,
- "Should have 3 disabled breakpoints.");
- is(breakpointsRemoved, 0,
- "Shouldn't have removed anything so far.");
-
- is(gBreakpointsParent.childNodes.length, 1, // one sources list
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.childNodes.length, 1, // one sources group
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded,
- "Should have the same number of breakpoints in the pane.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsDisabled,
- "Should have the same number of disabled breakpoints.");
-
- addBreakpoints(function() {
- is(breakpointsAdded, 3,
- "Should still have only 3 breakpoints added so far.");
- is(breakpointsDisabled, 3,
- "Should still have 3 disabled breakpoints.");
- is(breakpointsRemoved, 0,
- "Shouldn't have removed anything so far.");
-
- is(gBreakpointsParent.childNodes.length, 1, // one sources list
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.childNodes.length, 1, // one sources group
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded,
- "Since half of the breakpoints already existed, but disabled, " +
- "only half of the added breakpoints are actually in the pane.");
-
- removeBreakpoints(function() {
- is(breakpointsRemoved, 3,
- "Should have 3 removed breakpoints.");
-
- is(gBreakpointsParent.childNodes.length, 1, // one sources list
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.childNodes.length, 1, // one sources group
- "Found junk in the breakpoints container.");
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, 0,
- "No breakpoints should be visible at this point.");
-
- executeSoon(function() {
- gDebugger.gClient.addOneTimeListener("resumed", function() {
- finalCheck();
- closeDebuggerAndFinish();
- });
- gDebugger.DebuggerController.activeThread.resume();
- });
- });
- });
- });
- }, true);
-
- function addBreakpoints(callback, increment)
- {
- let line;
-
- executeSoon(function()
- {
- line = 6;
- gPane.addBreakpoint({url: gSources.selectedValue, line: line},
- function(cl, err) {
- onBreakpointAdd.call({ increment: increment, line: line }, cl, err);
-
- line = 7;
- gPane.addBreakpoint({url: gSources.selectedValue, line: line},
- function(cl, err) {
- onBreakpointAdd.call({ increment: increment, line: line }, cl, err);
-
- line = 9;
- gPane.addBreakpoint({url: gSources.selectedValue, line: line},
- function(cl, err) {
- onBreakpointAdd.call({ increment: increment, line: line }, cl, err);
-
- executeSoon(function() {
- callback();
- });
- });
- });
- });
- });
- }
-
- function disableBreakpoints(callback)
- {
- let nodes = Array.slice(gBreakpointsList.querySelectorAll(".dbg-breakpoint"));
- info("Nodes to disable: " + breakpointsAdded);
-
- is(nodes.length, breakpointsAdded,
- "The number of nodes to disable is incorrect.");
-
- Array.forEach(nodes, function(bkp) {
- info("Disabling breakpoint: " + bkp.id);
-
- let sourceItem = gSources.getItemForElement(bkp);
- let breakpointItem = gSources.getItemForElement.call(sourceItem, bkp);
- let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment;
- info("Found data: " + breakpointItem.attachment.toSource());
-
- gSources.disableBreakpoint(url, line, { callback: function() {
- if (++breakpointsDisabled !== breakpointsAdded) {
- return;
- }
- executeSoon(function() {
- callback();
- });
- }});
- });
- }
-
- function removeBreakpoints(callback)
- {
- let nodes = Array.slice(gBreakpointsList.querySelectorAll(".dbg-breakpoint"));
- info("Nodes to remove: " + breakpointsAdded);
-
- is(nodes.length, breakpointsAdded,
- "The number of nodes to remove is incorrect.");
-
- Array.forEach(nodes, function(bkp) {
- info("Removing breakpoint: " + bkp.id);
-
- let sourceItem = gSources.getItemForElement(bkp);
- let breakpointItem = gSources.getItemForElement.call(sourceItem, bkp);
- let { sourceLocation: url, lineNumber: line } = breakpointItem.attachment;
- info("Found data: " + breakpointItem.attachment.toSource());
-
- gPane.removeBreakpoint(gPane.getBreakpoint(url, line), function() {
- if (++breakpointsRemoved !== breakpointsAdded) {
- return;
- }
- executeSoon(function() {
- callback();
- });
- });
- });
- }
-
- function onBreakpointAdd(aBreakpointClient, aResponseError)
- {
- if (this.increment) {
- breakpointsAdded++;
- }
-
- is(gBreakpointsList.querySelectorAll(".dbg-breakpoint").length, breakpointsAdded,
- this.increment ? "Should have added a breakpoint in the pane."
- : "Should have the same number of breakpoints in the pane.");
-
- let id = "breakpoint-" + aBreakpointClient.actor;
- let bkp = gDebugger.document.getElementById(id);
- let line = bkp.getElementsByClassName("dbg-breakpoint-line")[0];
- let text = bkp.getElementsByClassName("dbg-breakpoint-text")[0];
- let check = bkp.querySelector("checkbox");
-
- is(bkp.id, id,
- "Breakpoint element " + id + " found successfully.");
- is(line.getAttribute("value"), this.line,
- "The expected information wasn't found in the breakpoint element.");
- is(text.getAttribute("value"), gDebugger.DebuggerView.getEditorLineText(this.line - 1).trim(),
- "The expected line text wasn't found in the breakpoint element.");
- is(check.getAttribute("checked"), "true",
- "The breakpoint enable checkbox is checked as expected.");
- }
- }
-
- function finalCheck() {
- is(Object.keys(gBreakpoints).length, 0, "no breakpoint in the debugger");
- ok(!gPane.getBreakpoint(gSources.values[0], 5),
- "getBreakpoint(locations[0], 5) returns no breakpoint");
- }
-
- registerCleanupFunction(function() {
- is(breakpointsAdded, 3, "correct number of breakpoints have been added");
- is(breakpointsDisabled, 3, "correct number of breakpoints have been disabled");
- is(breakpointsRemoved, 3, "correct number of breakpoints have been removed");
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gBreakpoints = null;
- gBreakpointsParent = null;
- gBreakpointsList = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js b/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js
deleted file mode 100644
index c4d7fd46f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-01.js
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 727429: test the debugger watch expressions.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gWatch = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gWatch = gDebugger.DebuggerView.WatchExpressions;
-
- gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
- performTest();
- });
-
- function performTest()
- {
- is(gWatch.getAllStrings().length, 0,
- "There should initially be no watch expressions");
-
- addAndCheckExpressions(1, 0, "a");
- addAndCheckExpressions(2, 0, "b");
- addAndCheckExpressions(3, 0, "c");
-
- removeAndCheckExpression(2, 1, "a");
- removeAndCheckExpression(1, 0, "a");
-
-
- addAndCheckExpressions(2, 0, "", true);
- gDebugger.editor.focus();
- is(gWatch.getAllStrings().length, 1,
- "Empty watch expressions are automatically removed");
-
-
- addAndCheckExpressions(2, 0, "a", true);
- gDebugger.editor.focus();
- is(gWatch.getAllStrings().length, 1,
- "Duplicate watch expressions are automatically removed");
-
- addAndCheckExpressions(2, 0, "a\t", true);
- addAndCheckExpressions(2, 0, "a\r", true);
- addAndCheckExpressions(2, 0, "a\n", true);
- gDebugger.editor.focus();
- is(gWatch.getAllStrings().length, 1,
- "Duplicate watch expressions are automatically removed");
-
- addAndCheckExpressions(2, 0, "\ta", true);
- addAndCheckExpressions(2, 0, "\ra", true);
- addAndCheckExpressions(2, 0, "\na", true);
- gDebugger.editor.focus();
- is(gWatch.getAllStrings().length, 1,
- "Duplicate watch expressions are automatically removed");
-
-
- addAndCheckCustomExpression(2, 0, "bazΩΩka");
- addAndCheckCustomExpression(3, 0, "bambøøcha");
-
-
- EventUtils.sendMouseEvent({ type: "click" },
- gWatch.getItemAtIndex(0).attachment.closeNode,
- gDebugger);
-
- is(gWatch.getAllStrings().length, 2,
- "Watch expressions are removed when the close button is pressed");
- is(gWatch.getAllStrings()[0], "bazΩΩka",
- "The expression at index " + 0 + " should be correct (1)");
- is(gWatch.getAllStrings()[1], "a",
- "The expression at index " + 1 + " should be correct (2)");
-
-
- EventUtils.sendMouseEvent({ type: "click" },
- gWatch.getItemAtIndex(0).attachment.closeNode,
- gDebugger);
-
- is(gWatch.getAllStrings().length, 1,
- "Watch expressions are removed when the close button is pressed");
- is(gWatch.getAllStrings()[0], "a",
- "The expression at index " + 0 + " should be correct (3)");
-
-
- EventUtils.sendMouseEvent({ type: "click" },
- gWatch.getItemAtIndex(0).attachment.closeNode,
- gDebugger);
-
- is(gWatch.getAllStrings().length, 0,
- "Watch expressions are removed when the close button is pressed");
-
-
- EventUtils.sendMouseEvent({ type: "click" },
- gWatch.widget._parent,
- gDebugger);
-
- is(gWatch.getAllStrings().length, 1,
- "Watch expressions are added when the view container is pressed");
-
-
- closeDebuggerAndFinish();
- }
-
- function addAndCheckCustomExpression(total, index, string, noBlur) {
- addAndCheckExpressions(total, index, "", true);
-
- for (let i = 0; i < string.length; i++) {
- EventUtils.sendChar(string[i], gDebugger);
- }
-
- gDebugger.editor.focus();
-
- let element = gWatch.getItemAtIndex(index).target;
-
- is(gWatch.getItemAtIndex(index).attachment.initialExpression, "",
- "The initial expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.initialExpression, "",
- "The initial expression at index " + index + " should be correct (2)");
-
- is(gWatch.getItemAtIndex(index).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (2)");
-
- is(gWatch.getString(index), string,
- "The expression at index " + index + " should be correct (3)");
- is(gWatch.getAllStrings()[index], string,
- "The expression at index " + index + " should be correct (4)");
- }
-
- function addAndCheckExpressions(total, index, string, noBlur) {
- gWatch.addExpression(string);
-
- is(gWatch.getAllStrings().length, total,
- "There should be " + total + " watch expressions available (1)");
- is(gWatch.itemCount, total,
- "There should be " + total + " watch expressions available (2)");
-
- ok(gWatch.getItemAtIndex(index),
- "The expression at index " + index + " should be available");
- is(gWatch.getItemAtIndex(index).attachment.initialExpression, string,
- "The expression at index " + index + " should have an initial expression");
-
- let element = gWatch.getItemAtIndex(index).target;
-
- ok(element,
- "There should be a new expression item in the view");
- ok(gWatch.getItemForElement(element),
- "The watch expression item should be accessible");
- is(gWatch.getItemForElement(element), gWatch.getItemAtIndex(index),
- "The correct watch expression item was accessed");
-
- ok(gWatch.widget.getItemAtIndex(index) instanceof XULElement,
- "The correct watch expression element was accessed (1)");
- is(element, gWatch.widget.getItemAtIndex(index),
- "The correct watch expression element was accessed (2)");
-
- is(gWatch.getItemForElement(element).attachment.arrowNode.hidden, false,
- "The arrow node should be visible");
- is(gWatch.getItemForElement(element).attachment.closeNode.hidden, false,
- "The close button should be visible");
- is(gWatch.getItemForElement(element).attachment.inputNode.getAttribute("focused"), "true",
- "The textbox input should be focused");
-
- is(gDebugger.DebuggerView.Variables.parentNode.scrollTop, 0,
- "The variables view should be scrolled to top");
-
- is(gWatch.orderedItems[0], gWatch.getItemAtIndex(index),
- "The correct watch expression was added to the cache (1)");
- is(gWatch.orderedItems[0], gWatch.getItemForElement(element),
- "The correct watch expression was added to the cache (2)");
-
- if (!noBlur) {
- gDebugger.editor.focus();
-
- is(gWatch.getItemAtIndex(index).attachment.initialExpression, string,
- "The initial expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.initialExpression, string,
- "The initial expression at index " + index + " should be correct (2)");
-
- is(gWatch.getItemAtIndex(index).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (2)");
-
- is(gWatch.getString(index), string,
- "The expression at index " + index + " should be correct (3)");
- is(gWatch.getAllStrings()[index], string,
- "The expression at index " + index + " should be correct (4)");
- }
- }
-
- function removeAndCheckExpression(total, index, string) {
- gWatch.removeAt(index);
-
- is(gWatch.getAllStrings().length, total,
- "There should be " + total + " watch expressions available (1)");
- is(gWatch.itemCount, total,
- "There should be " + total + " watch expressions available (2)");
-
- ok(gWatch.getItemAtIndex(index),
- "The expression at index " + index + " should still be available");
- is(gWatch.getItemAtIndex(index).attachment.initialExpression, string,
- "The expression at index " + index + " should still have an initial expression");
-
- let element = gWatch.getItemAtIndex(index).target;
-
- is(gWatch.getItemAtIndex(index).attachment.initialExpression, string,
- "The initial expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.initialExpression, string,
- "The initial expression at index " + index + " should be correct (2)");
-
- is(gWatch.getItemAtIndex(index).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (1)");
- is(gWatch.getItemForElement(element).attachment.currentExpression, string,
- "The expression at index " + index + " should be correct (2)");
-
- is(gWatch.getString(index), string,
- "The expression at index " + index + " should be correct (3)");
- is(gWatch.getAllStrings()[index], string,
- "The expression at index " + index + " should be correct (4)");
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gWatch = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js b/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js
deleted file mode 100644
index df24c4d91..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug727429_watch-expressions-02.js
+++ /dev/null
@@ -1,394 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 727429: test the debugger watch expressions.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gWatch = null;
-let gVars = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gWatch = gDebugger.DebuggerView.WatchExpressions;
- gVars = gDebugger.DebuggerView.Variables;
-
- gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
- addExpressions();
- performTest();
- });
-
- function addExpressions()
- {
- gWatch.addExpression("'a'");
- gWatch.addExpression("\"a\"");
- gWatch.addExpression("'a\"\"'");
- gWatch.addExpression("\"a''\"");
- gWatch.addExpression("?");
- gWatch.addExpression("a");
- gWatch.addExpression("this");
- gWatch.addExpression("this.canada");
- gWatch.addExpression("[1, 2, 3]");
- gWatch.addExpression("x = [1, 2, 3]");
- gWatch.addExpression("y = [1, 2, 3]; y.test = 4");
- gWatch.addExpression("z = [1, 2, 3]; z.test = 4; z");
- gWatch.addExpression("t = [1, 2, 3]; t.test = 4; !t");
- gWatch.addExpression("arguments[0]");
- gWatch.addExpression("encodeURI(\"\\\")");
- gWatch.addExpression("decodeURI(\"\\\")");
- gWatch.addExpression("decodeURIComponent(\"%\")");
- gWatch.addExpression("//");
- gWatch.addExpression("// 42");
- gWatch.addExpression("{}.foo");
- gWatch.addExpression("{}.foo()");
- gWatch.addExpression("({}).foo()");
- gWatch.addExpression("new Array(-1)");
- gWatch.addExpression("4.2.toExponential(-4.2)");
- gWatch.addExpression("throw new Error(\"bazinga\")");
- gWatch.addExpression("({ get error() { throw new Error(\"bazinga\") } }).error");
- gWatch.addExpression("throw { get name() { throw \"bazinga\" } }");
- }
-
- function performTest()
- {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
- "There should be 0 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
- "There should be 27 visible nodes in the watch expressions container");
-
- test1(function() {
- test2(function() {
- test3(function() {
- test4(function() {
- test5(function() {
- test6(function() {
- test7(function() {
- test8(function() {
- test9(function() {
- finishTest();
- });
- });
- });
- });
- });
- });
- });
- });
- });
- }
-
- function finishTest()
- {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
- "There should be 0 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 27,
- "There should be 27 visible nodes in the watch expressions container");
-
- closeDebuggerAndFinish();
- }
-
- function test1(callback) {
- waitForWatchExpressions(function() {
- info("Performing test1");
- checkWatchExpressions("ReferenceError: a is not defined",
- { type: "object", class: "Object" },
- { type: "object", class: "String" },
- { type: "undefined" },
- 26);
- callback();
- });
- executeSoon(function() {
- gDebuggee.test(); // ermahgerd!!
- });
- }
-
- function test2(callback) {
- waitForWatchExpressions(function() {
- info("Performing test2");
- checkWatchExpressions({ type: "undefined" },
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 26);
- callback();
- });
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }
-
- function test3(callback) {
- waitForWatchExpressions(function() {
- info("Performing test3");
- checkWatchExpressions({ type: "object", class: "Object" },
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 26);
- callback();
- });
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }
-
- function test4(callback) {
- waitForWatchExpressions(function() {
- info("Performing test4");
- checkWatchExpressions(5,
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 27);
- callback();
- });
- executeSoon(function() {
- gWatch.addExpression("a = 5");
- EventUtils.sendKey("RETURN", gDebugger);
- });
- }
-
- function test5(callback) {
- waitForWatchExpressions(function() {
- info("Performing test5");
- checkWatchExpressions(5,
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 27);
- callback();
- });
- executeSoon(function() {
- gWatch.addExpression("encodeURI(\"\\\")");
- EventUtils.sendKey("RETURN", gDebugger);
- });
- }
-
- function test6(callback) {
- waitForWatchExpressions(function() {
- info("Performing test6");
- checkWatchExpressions(5,
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 27);
- callback();
- })
- executeSoon(function() {
- gWatch.addExpression("decodeURI(\"\\\")");
- EventUtils.sendKey("RETURN", gDebugger);
- });
- }
-
- function test7(callback) {
- waitForWatchExpressions(function() {
- info("Performing test7");
- checkWatchExpressions(5,
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 27);
- callback();
- });
- executeSoon(function() {
- gWatch.addExpression("?");
- EventUtils.sendKey("RETURN", gDebugger);
- });
- }
-
- function test8(callback) {
- waitForWatchExpressions(function() {
- info("Performing test8");
- checkWatchExpressions(5,
- { type: "object", class: "Window" },
- { type: "undefined" },
- "sensational",
- 27);
- callback();
- });
- executeSoon(function() {
- gWatch.addExpression("a");
- EventUtils.sendKey("RETURN", gDebugger);
- });
- }
-
- function test9(callback) {
- waitForAfterFramesCleared(function() {
- info("Performing test9");
- callback();
- });
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }
-
- function waitForAfterFramesCleared(callback) {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function onClear() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", onClear, false);
- executeSoon(callback);
- }, false);
- }
-
- function waitForWatchExpressions(callback) {
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() {
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false);
- executeSoon(callback);
- }, false);
- }
-
- function checkWatchExpressions(expected_a,
- expected_this,
- expected_prop,
- expected_arguments,
- total)
- {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, total,
- "There should be " + total + " hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, total, "There should be " + total + " evaluations availalble");
-
- let w1 = scope.get("'a'");
- let w2 = scope.get("\"a\"");
- let w3 = scope.get("'a\"\"'");
- let w4 = scope.get("\"a''\"");
- let w5 = scope.get("?");
- let w6 = scope.get("a");
- let w7 = scope.get("this");
- let w8 = scope.get("this.canada");
- let w9 = scope.get("[1, 2, 3]");
- let w10 = scope.get("x = [1, 2, 3]");
- let w11 = scope.get("y = [1, 2, 3]; y.test = 4");
- let w12 = scope.get("z = [1, 2, 3]; z.test = 4; z");
- let w13 = scope.get("t = [1, 2, 3]; t.test = 4; !t");
- let w14 = scope.get("arguments[0]");
- let w15 = scope.get("encodeURI(\"\\\")");
- let w16 = scope.get("decodeURI(\"\\\")");
- let w17 = scope.get("decodeURIComponent(\"%\")");
- let w18 = scope.get("//");
- let w19 = scope.get("// 42");
- let w20 = scope.get("{}.foo");
- let w21 = scope.get("{}.foo()");
- let w22 = scope.get("({}).foo()");
- let w23 = scope.get("new Array(-1)");
- let w24 = scope.get("4.2.toExponential(-4.2)");
- let w25 = scope.get("throw new Error(\"bazinga\")");
- let w26 = scope.get("({ get error() { throw new Error(\"bazinga\") } }).error");
- let w27 = scope.get("throw { get name() { throw \"bazinga\" } }");
-
- ok(w1, "The first watch expression should be present in the scope");
- ok(w2, "The second watch expression should be present in the scope");
- ok(w3, "The third watch expression should be present in the scope");
- ok(w4, "The fourth watch expression should be present in the scope");
- ok(w5, "The fifth watch expression should be present in the scope");
- ok(w6, "The sixth watch expression should be present in the scope");
- ok(w7, "The seventh watch expression should be present in the scope");
- ok(w8, "The eight watch expression should be present in the scope");
- ok(w9, "The ninth watch expression should be present in the scope");
- ok(w10, "The tenth watch expression should be present in the scope");
- ok(w11, "The eleventh watch expression should be present in the scope");
- ok(w12, "The twelfth watch expression should be present in the scope");
- ok(w13, "The 13th watch expression should be present in the scope");
- ok(w14, "The 14th watch expression should be present in the scope");
- ok(w15, "The 15th watch expression should be present in the scope");
- ok(w16, "The 16th watch expression should be present in the scope");
- ok(w17, "The 17th watch expression should be present in the scope");
- ok(w18, "The 18th watch expression should be present in the scope");
- ok(w19, "The 19th watch expression should be present in the scope");
- ok(w20, "The 20th watch expression should be present in the scope");
- ok(w21, "The 21st watch expression should be present in the scope");
- ok(w22, "The 22nd watch expression should be present in the scope");
- ok(w23, "The 23nd watch expression should be present in the scope");
- ok(w24, "The 24th watch expression should be present in the scope");
- ok(w25, "The 25th watch expression should be present in the scope");
- ok(w26, "The 26th watch expression should be present in the scope");
- ok(!w27, "The 27th watch expression should not be present in the scope");
-
- is(w1.value, "a", "The first value is correct");
- is(w2.value, "a", "The second value is correct");
- is(w3.value, "a\"\"", "The third value is correct");
- is(w4.value, "a''", "The fourth value is correct");
- is(w5.value, "SyntaxError: syntax error", "The fifth value is correct");
-
- if (typeof expected_a == "object") {
- is(w6.value.type, expected_a.type, "The sixth value type is correct");
- is(w6.value.class, expected_a.class, "The sixth value class is correct");
- } else {
- is(w6.value, expected_a, "The sixth value is correct");
- }
-
- if (typeof expected_this == "object") {
- is(w7.value.type, expected_this.type, "The seventh value type is correct");
- is(w7.value.class, expected_this.class, "The seventh value class is correct");
- } else {
- is(w7.value, expected_this, "The seventh value is correct");
- }
-
- if (typeof expected_prop == "object") {
- is(w8.value.type, expected_prop.type, "The eighth value type is correct");
- is(w8.value.class, expected_prop.class, "The eighth value class is correct");
- } else {
- is(w8.value, expected_prop, "The eighth value is correct");
- }
-
- is(w9.value.type, "object", "The ninth value type is correct");
- is(w9.value.class, "Array", "The ninth value class is correct");
- is(w10.value.type, "object", "The tenth value type is correct");
- is(w10.value.class, "Array", "The tenth value class is correct");
- is(w11.value, "4", "The eleventh value is correct");
- is(w12.value.type, "object", "The eleventh value type is correct");
- is(w12.value.class, "Array", "The twelfth value class is correct");
- is(w13.value, false, "The 13th value is correct");
-
- if (typeof expected_arguments == "object") {
- is(w14.value.type, expected_arguments.type, "The 14th value type is correct");
- is(w14.value.class, expected_arguments.class, "The 14th value class is correct");
- } else {
- is(w14.value, expected_arguments, "The 14th value is correct");
- }
-
- is(w15.value, "SyntaxError: unterminated string literal", "The 15th value is correct");
- is(w16.value, "SyntaxError: unterminated string literal", "The 16th value is correct");
- is(w17.value, "URIError: malformed URI sequence", "The 17th value is correct");
-
- is(w18.value.type, "undefined", "The 18th value type is correct");
- is(w18.value.class, undefined, "The 18th value class is correct");
-
- is(w19.value.type, "undefined", "The 19th value type is correct");
- is(w19.value.class, undefined, "The 19th value class is correct");
-
- is(w20.value, "SyntaxError: syntax error", "The 20th value is correct");
- is(w21.value, "SyntaxError: syntax error", "The 21th value is correct");
- is(w22.value, "TypeError: (intermediate value).foo is not a function", "The 22th value is correct");
- is(w23.value, "RangeError: invalid array length", "The 23th value is correct");
- is(w24.value, "RangeError: precision -4 out of range", "The 24st value is correct");
- is(w25.value, "Error: bazinga", "The 25nd value is correct");
- is(w26.value, "Error: bazinga", "The 26rd value is correct");
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gWatch = null;
- gVars = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js
deleted file mode 100644
index fc3b2efb5..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug731394_editor-contextmenu.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 731394: test the debugger source editor default context menu.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-
-function test()
-{
- let contextMenu = null;
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onSourceShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded",
- onFramesAdded);
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onFramesAdded(aEvent) {
- framesAdded = true;
- executeSoon(startTest);
- }
-
- function onSourceShown(aEvent) {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- testStarted = true;
- gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown);
- executeSoon(performTest);
- }
- }
-
- function performTest()
- {
- let scripts = gDebugger.DebuggerView.Sources;
- let editor = gDebugger.editor;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(scripts.itemCount, 2,
- "Found the expected number of scripts.");
-
- isnot(editor.getText().indexOf("debugger"), -1,
- "The correct script was loaded initially.");
-
- isnot(editor.getText().indexOf("\u263a"), -1,
- "Unicode characters are converted correctly.");
-
- contextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
- ok(contextMenu, "source editor context menupopup");
- ok(editor.readOnly, "editor is read only");
-
- editor.focus();
- editor.setSelection(0, 10);
-
- contextMenu.addEventListener("popupshown", function onPopupShown() {
- contextMenu.removeEventListener("popupshown", onPopupShown, false);
- executeSoon(testContextMenu);
- }, false);
- contextMenu.openPopup(editor.editorElement, "overlap", 0, 0, true, false);
- }
-
- function testContextMenu()
- {
- let document = gDebugger.document;
-
- ok(document.getElementById("editMenuCommands"),
- "#editMenuCommands found");
- ok(!document.getElementById("editMenuKeys"),
- "#editMenuKeys not found");
- ok(document.getElementById("sourceEditorCommands"),
- "#sourceEditorCommands found");
-
- // Map command ids to their expected disabled state.
- let commands = {"se-cmd-undo": true, "se-cmd-redo": true,
- "se-cmd-cut": true, "se-cmd-paste": true,
- "se-cmd-delete": true, "cmd_findAgain": true,
- "cmd_findPrevious": true, "cmd_find": false,
- "cmd_gotoLine": false, "cmd_copy": false,
- "se-cmd-selectAll": false};
-
- for (let id in commands) {
- is(document.getElementById(id).hasAttribute("disabled"), commands[id],
- id + " hasAttribute('disabled') check");
- }
-
- executeSoon(function() {
- contextMenu.hidePopup();
- closeDebuggerAndFinish();
- });
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js b/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js
deleted file mode 100644
index 79ed9cb32..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug737803_editor_actual_location.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 737803: Setting a breakpoint in a line without code should move
- * the icon to the actual location.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gSources = null;
-let gEditor = null;
-let gBreakpoints = null;
-
-function test() {
- let scriptShown = false;
- let framesAdded = false;
- let testStarted = false;
- let resumed = false;
-
- debug_tab_pane(TAB_URL, function (aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebuggee = aDebuggee;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onSourceShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function () {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function () {
- gDebuggee.firstCall();
- });
- });
-
- function onSourceShown(aEvent) {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest() {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onSourceShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest() {
- gSources = gDebugger.DebuggerView.Sources;
- gEditor = gDebugger.editor;
- gBreakpoints = gPane.getAllBreakpoints();
- is(Object.keys(gBreakpoints), 0, "There are no breakpoints");
-
- gEditor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE,
- onEditorBreakpointAdd);
-
- let location = { url: gSources.selectedValue, line: 4 };
- executeSoon(function () {
- gPane.addBreakpoint(location, onBreakpointAdd);
- });
- }
-
- let onBpDebuggerAdd = false;
- let onBpEditorAdd = false;
-
- function onBreakpointAdd(aBpClient) {
- is(aBpClient.location.url, gSources.selectedValue, "URL is the same");
- is(aBpClient.location.line, 6, "Line number is new");
- is(aBpClient.requestedLocation.line, 4, "Requested location is correct");
-
- onBpDebuggerAdd = true;
- tryFinish();
- }
-
- function onEditorBreakpointAdd(aEvent) {
- gEditor.removeEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE,
- onEditorBreakpointAdd);
-
- is(gEditor.getBreakpoints().length, 1,
- "There is only one breakpoint in the editor");
-
- ok(!gPane.getBreakpoint(gSources.selectedValue, 4),
- "There are no breakpoints on an invalid line");
-
- let br = gPane.getBreakpoint(gSources.selectedValue, 6);
- is(br.location.url, gSources.selectedValue, "URL is correct");
- is(br.location.line, 6, "Line number is correct");
-
- onBpEditorAdd = true;
- tryFinish();
- }
-
- function tryFinish() {
- info("onBpDebuggerAdd: " + onBpDebuggerAdd);
- info("onBpEditorAdd: " + onBpEditorAdd);
-
- if (onBpDebuggerAdd && onBpEditorAdd) {
- closeDebuggerAndFinish();
- }
- }
-
- registerCleanupFunction(function () {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
- gEditor = null;
- gBreakpoints = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js b/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js
deleted file mode 100644
index ed5e9c85c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-01.js
+++ /dev/null
@@ -1,393 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 740825: test the debugger conditional breakpoints.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_conditional-breakpoints.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gBreakpoints = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.ermahgerd(); // ermahgerd!!
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("conditional-breakpoints") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: addBreakpoints }, 0);
- }
- }
-
- function performTest()
- {
- gEditor = gDebugger.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gBreakpoints = gPane.getAllBreakpoints();
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 1,
- "Found the expected number of scripts.");
-
- isnot(gEditor.getText().indexOf("ermahgerd"), -1,
- "The correct script was loaded initially.");
-
- is(gSources.selectedValue, gSources.values[0],
- "The correct script is selected");
-
- is(Object.keys(gBreakpoints).length, 13, "thirteen breakpoints");
- ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey");
- is(gEditor.getBreakpoints().length, 13, "thirteen breakpoints in the editor");
-
- executeSoon(test1);
- }
-
- function test1(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 14, test2);
- }
-
- function test2(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 15, test3);
- }
-
- function test3(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 16, test4);
- }
-
- function test4(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 17, test5);
- }
-
- function test5(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 18, test6);
- }
-
- function test6(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 19, test7);
- }
-
- function test7(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 21, test8);
- }
-
- function test8(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 22, test9);
- }
-
- function test9(callback)
- {
- resumeAndTestBreakpoint(gSources.selectedValue, 23, test10);
- }
-
- function test10(callback)
- {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
-
- isnot(gSources.selectedItem, null,
- "There should be a selected script in the scripts pane.")
- is(gSources.selectedBreakpointItem, null,
- "There should be no selected breakpoint in the scripts pane.")
- is(gSources.selectedBreakpointClient, null,
- "There should be no selected client in the scripts pane.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- is(gDebugger.DebuggerView.StackFrames.widget._list.querySelectorAll(".dbg-stackframe").length, 0,
- "There should be no visible stackframes.");
- is(gDebugger.DebuggerView.Sources.widget._list.querySelectorAll(".dbg-breakpoint").length, 13,
- "There should be thirteen visible breakpoints.");
-
- testReload();
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
- }
-
- function resumeAndTestBreakpoint(url, line, callback)
- {
- resume(line, function() {
- waitForCaretPos(line - 1, function() {
- testBreakpoint(gSources.selectedBreakpointItem, gSources.selectedBreakpointClient, url, line, true);
- callback();
- });
- });
- }
-
- function testBreakpoint(aBreakpointItem, aBreakpointClient, url, line, editor)
- {
- is(aBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The breakpoint on line " + line + " wasn't added on the correct source.");
- is(aBreakpointItem.attachment.lineNumber, line,
- "The breakpoint on line " + line + " wasn't found.");
- is(!!aBreakpointItem.attachment.disabled, false,
- "The breakpoint on line " + line + " should be enabled.");
- is(!!aBreakpointItem.attachment.openPopupFlag, false,
- "The breakpoint on line " + line + " should not open a popup.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- is(aBreakpointClient.location.url, url,
- "The breakpoint's client url is correct");
- is(aBreakpointClient.location.line, line,
- "The breakpoint's client line is correct");
- isnot(aBreakpointClient.conditionalExpression, undefined,
- "The breakpoint on line " + line + " should have a conditional expression.");
-
- if (editor) {
- is(gEditor.getCaretPosition().line + 1, line,
- "The editor caret position is not situated on the proper line.");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret position is not situated on the proper column.");
- }
- }
-
- function addBreakpoints(callback)
- {
- let currentUrl = gDebugger.DebuggerView.Sources.selectedValue;
-
- gPane.addBreakpoint({ url: currentUrl, line: 12 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 13 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 14 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 15 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 16 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 17 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 18 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 19 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 20 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 21 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 22 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 23 }, function() {
- gPane.addBreakpoint({ url: currentUrl, line: 24 }, function() {
- performTest();
- }, {
- conditionalExpression: "b"
- });
- }, {
- conditionalExpression: "a !== null"
- });
- }, {
- conditionalExpression: "a !== undefined"
- });
- }, {
- conditionalExpression: "a"
- });
- }, {
- conditionalExpression: "(function() { return false; })()"
- });
- }, {
- conditionalExpression: "(function() {})"
- });
- }, {
- conditionalExpression: "({})"
- });
- }, {
- conditionalExpression: "/regexp/"
- });
- }, {
- conditionalExpression: "'nasu'"
- });
- }, {
- conditionalExpression: "true"
- });
- }, {
- conditionalExpression: "42"
- });
- }, {
- conditionalExpression: "null"
- });
- }, {
- conditionalExpression: "undefined"
- });
- }
-
- function testReload()
- {
- info("Testing reload...");
-
- function _get(url, line) {
- return [
- gDebugger.DebuggerView.Sources.getBreakpoint(url, line),
- gDebugger.DebuggerController.Breakpoints.getBreakpoint(url, line),
- url,
- line,
- ];
- }
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown() {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
-
- waitForBreakpoints(13, function() {
- testBreakpoint.apply(this, _get(gSources.selectedValue, 14));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 15));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 16));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 17));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 18));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 19));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 21));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 22));
- testBreakpoint.apply(this, _get(gSources.selectedValue, 23));
-
- isnot(gSources.selectedItem, null,
- "There should be a selected script in the scripts pane.")
- is(gSources.selectedBreakpointItem, null,
- "There should be no selected breakpoint in the scripts pane.")
- is(gSources.selectedBreakpointClient, null,
- "There should be no selected client in the scripts pane.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- closeDebuggerAndFinish();
- });
- });
-
- finalCheck();
- gDebuggee.location.reload();
- }
-
- function finalCheck() {
- isnot(gEditor.getText().indexOf("ermahgerd"), -1,
- "The correct script is still loaded.");
- is(gSources.selectedValue, gSources.values[0],
- "The correct script is still selected");
- }
-
- function resume(expected, callback) {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
- waitForBreakpoint(expected, callback);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }
-
- let bogusClient = {
- location: {
- url: null,
- line: null
- }
- };
-
- function waitForBreakpoint(expected, callback) {
- // Poll every few milliseconds until expected breakpoint is hit.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the breakpoint.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if ((gSources.selectedBreakpointClient !== expected) &&
- (gSources.selectedBreakpointClient || bogusClient).location.line !== expected) {
- return;
- }
- // We arrived at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- function waitForBreakpoints(total, callback)
- {
- // Poll every few milliseconds until the breakpoints are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the breakpoints.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gSources.widget._list.querySelectorAll(".dbg-breakpoint").length != total) {
- return;
- }
- // We got all the breakpoints, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- function waitForCaretPos(number, callback)
- {
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gEditor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gBreakpoints = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js b/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js
deleted file mode 100644
index 460d8879e..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug740825_conditional-breakpoints-02.js
+++ /dev/null
@@ -1,583 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 740825: test the debugger conditional breakpoints.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_conditional-breakpoints.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gBreakpoints = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
- resumed = true;
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.ermahgerd(); // ermahgerd!!
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("conditional-breakpoints") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest()
- {
- gEditor = gDebugger.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gBreakpoints = gPane.getAllBreakpoints();
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 1,
- "Found the expected number of scripts.");
-
- isnot(gEditor.getText().indexOf("ermahgerd"), -1,
- "The correct script was loaded initially.");
-
- is(gSources.selectedValue, gSources.values[0],
- "The correct script is selected");
-
- is(Object.keys(gBreakpoints), 0, "no breakpoints");
- ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey");
- is(gEditor.getBreakpoints().length, 0, "no breakpoints in the editor");
-
- executeSoon(addBreakpoint1);
- }
-
- function addBreakpoint1()
- {
- gPane.addBreakpoint({ url: gSources.selectedValue, line: 12 });
-
- waitForBreakpoint(12, function() {
- waitForCaretPos(10, function() {
- waitForPopup(false, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 12, false, false, false);
-
- executeSoon(addBreakpoint2);
- });
- });
- });
- }
-
- function addBreakpoint2()
- {
- gSources._editorContextMenuLineNumber = 12;
- gSources._onCmdAddBreakpoint();
-
- waitForBreakpoint(13, function() {
- waitForCaretPos(12, function() {
- waitForPopup(false, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 13, false, false, true);
-
- executeSoon(modBreakpoint2);
- });
- });
- });
- }
-
- function modBreakpoint2()
- {
- gSources._editorContextMenuLineNumber = 12;
- gSources._onCmdAddConditionalBreakpoint();
-
- waitForBreakpoint(13, function() {
- waitForCaretPos(12, function() {
- waitForPopup(true, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 13, true, true, true);
-
- executeSoon(addBreakpoint3);
- });
- });
- });
- }
-
- function addBreakpoint3()
- {
- gSources._editorContextMenuLineNumber = 13;
- gSources._onCmdAddConditionalBreakpoint();
-
- waitForBreakpoint(14, function() {
- waitForCaretPos(13, function() {
- waitForPopup(true, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 14, true, true, true);
-
- executeSoon(modBreakpoint3);
- });
- });
- });
- }
-
- function modBreakpoint3()
- {
- write("bamboocha");
- EventUtils.sendKey("RETURN", gDebugger);
-
- waitForBreakpoint(14, function() {
- waitForCaretPos(13, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointClient.conditionalExpression, "bamboocha",
- "The bamboocha expression wasn't fonud on the conditional breakpoint");
-
- executeSoon(setContextMenu);
- });
- });
- });
- }
-
- function setContextMenu()
- {
- let contextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
- info("Testing source editor popup...");
-
- contextMenu.addEventListener("popupshown", function onPopupShown() {
- contextMenu.removeEventListener("popupshown", onPopupShown, false);
- info("Source editor popup shown...");
-
- contextMenu.addEventListener("popuphidden", function onPopupHidden() {
- contextMenu.removeEventListener("popuphidden", onPopupHidden, false);
- info("Source editor popup hidden...");
-
- is(gSources._editorContextMenuLineNumber, 14,
- "The context menu line number is incorrect after the popup was hidden.");
- executeSoon(addBreakpoint4);
- }, false);
-
- is(gSources._editorContextMenuLineNumber, 14,
- "The context menu line number is incorrect after the popup was shown.");
- contextMenu.hidePopup();
- }, false);
-
- is(gSources._editorContextMenuLineNumber, -1,
- "The context menu line number was incorrect before the popup was shown.");
- gSources._editorContextMenuLineNumber = 14;
- contextMenu.openPopup(gEditor.editorElement, "overlap", 0, 0, true, false);
- }
-
- function addBreakpoint4()
- {
- gEditor.setCaretPosition(14);
- gSources._onCmdAddBreakpoint();
-
- waitForBreakpoint(15, function() {
- waitForCaretPos(14, function() {
- waitForPopup(false, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 15, false, false, true);
-
- executeSoon(delBreakpoint4);
- });
- });
- });
- }
-
- function delBreakpoint4()
- {
- gEditor.setCaretPosition(14);
- gSources._onCmdAddBreakpoint();
-
- waitForBreakpoint(null, function() {
- waitForCaretPos(14, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointItem, null,
- "There should be no selected breakpoint in the breakpoints pane.")
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- executeSoon(moveHighlight1);
- });
- });
- });
- }
-
- function moveHighlight1()
- {
- gEditor.setCaretPosition(13);
-
- waitForBreakpoint(14, function() {
- waitForCaretPos(13, function() {
- waitForPopup(false, function() {
- testBreakpoint(gSources.selectedBreakpointItem,
- gSources.selectedBreakpointClient,
- gSources.selectedValue, 14, false, true, true);
-
- executeSoon(testHighlights1);
- });
- });
- });
- }
-
- function testHighlights1()
- {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 14,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
- is(gEditor.getCaretPosition().line, 13,
- "The source editor caret position should be at line 13");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- gEditor.setCaretPosition(12);
-
- waitForCaretPos(12, function() {
- waitForPopup(false, function() {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 13,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
- is(gEditor.getCaretPosition().line, 12,
- "The source editor caret position should be at line 12");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- gEditor.setCaretPosition(11);
-
- waitForCaretPos(11, function() {
- waitForPopup(false, function() {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 12,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
- is(gEditor.getCaretPosition().line, 11,
- "The source editor caret position should be at line 11");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- gEditor.setCaretPosition(10);
-
- waitForCaretPos(10, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointItem, null,
- "There should not be a selected breakpoint in the breakpoints pane.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
- is(gEditor.getCaretPosition().line, 10,
- "The source editor caret position should be at line 10");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- gEditor.setCaretPosition(14);
-
- waitForCaretPos(14, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointItem, null,
- "There should not be a selected breakpoint in the breakpoints pane.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
- is(gEditor.getCaretPosition().line, 14,
- "The source editor caret position should be at line 14");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- executeSoon(testHighlights2);
- });
- });
- });
- });
- });
- });
- });
- });
- }
-
- function testHighlights2()
- {
- EventUtils.sendMouseEvent({ type: "click" },
- gSources.widget._list.querySelectorAll(".dbg-breakpoint")[2],
- gDebugger);
-
- waitForCaretPos(13, function() {
- waitForPopup(true, function() {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 14,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, true,
- "The breakpoint conditional expression popup should be shown.");
- is(gEditor.getCaretPosition().line, 13,
- "The source editor caret position should be at line 13");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gSources.widget._list.querySelectorAll(".dbg-breakpoint")[1],
- gDebugger);
-
- waitForCaretPos(12, function() {
- waitForPopup(true, function() {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 13,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, true,
- "The breakpoint conditional expression popup should be shown.");
- is(gEditor.getCaretPosition().line, 12,
- "The source editor caret position should be at line 12");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gSources.widget._list.querySelectorAll(".dbg-breakpoint")[0],
- gDebugger);
-
- waitForCaretPos(11, function() {
- waitForPopup(false, function() {
- isnot(gSources.selectedBreakpointItem, null,
- "There should be a selected breakpoint in the breakpoints pane.");
- is(gSources.selectedBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The selected breakpoint should have the correct location.");
- is(gSources.selectedBreakpointItem.attachment.lineNumber, 12,
- "The selected breakpoint should have the correct line number.");
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should be shown.");
- is(gEditor.getCaretPosition().line, 11,
- "The source editor caret position should be at line 11");
- is(gEditor.getCaretPosition().col, 0,
- "The source editor caret position should be at column 0");
-
- executeSoon(delBreakpoint2);
- });
- });
- });
- });
- });
- });
- }
-
- function delBreakpoint2()
- {
- gSources._editorContextMenuLineNumber = 12;
- gSources._onCmdAddBreakpoint();
-
- waitForBreakpoint(null, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointItem, null,
- "There should be no selected breakpoint in the breakpoints pane.")
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- executeSoon(delBreakpoint3);
- });
- });
- }
-
- function delBreakpoint3()
- {
- gSources._editorContextMenuLineNumber = 13;
- gSources._onCmdAddBreakpoint();
-
- waitForBreakpoint(null, function() {
- waitForPopup(false, function() {
- is(gSources.selectedBreakpointItem, null,
- "There should be no selected breakpoint in the breakpoints pane.")
- is(gSources._conditionalPopupVisible, false,
- "The breakpoint conditional expression popup should not be shown.");
-
- executeSoon(testBreakpoints);
- });
- });
- }
-
- function testBreakpoints()
- {
- is(Object.keys(gBreakpoints).length, 1, "one breakpoint");
- ok(!gPane.getBreakpoint("foo", 3), "getBreakpoint('foo', 3) returns falsey");
- is(gEditor.getBreakpoints().length, 1, "one breakpoint in the editor");
-
- closeDebuggerAndFinish();
- }
-
- function testBreakpoint(aBreakpointItem, aBreakpointClient, url, line, popup, conditional, editor)
- {
- is(aBreakpointItem.attachment.sourceLocation, gSources.selectedValue,
- "The breakpoint on line " + line + " wasn't added on the correct source.");
- is(aBreakpointItem.attachment.lineNumber, line,
- "The breakpoint on line " + line + " wasn't found.");
- is(!aBreakpointItem.attachment.disabled, true,
- "The breakpoint on line " + line + " should be enabled.");
- is(gSources._conditionalPopupVisible, popup,
- "The breakpoint conditional expression popup should " + (popup ? "" : "not ") + "be shown.");
-
- is(aBreakpointClient.location.url, url,
- "The breakpoint's client url is correct");
- is(aBreakpointClient.location.line, line,
- "The breakpoint's client line is correct");
-
- if (conditional) {
- isnot(aBreakpointClient.conditionalExpression, undefined,
- "The breakpoint on line " + line + " should have a conditional expression.");
- } else {
- is(aBreakpointClient.conditionalExpression, undefined,
- "The breakpoint on line " + line + " should not have a conditional expression.");
- }
-
- if (editor) {
- is(gEditor.getCaretPosition().line + 1, line,
- "The editor caret position is not situated on the proper line.");
- is(gEditor.getCaretPosition().col, 0,
- "The editor caret position is not situated on the proper column.");
- }
- }
-
- let bogusClient = {
- location: {
- url: null,
- line: null
- }
- };
-
- function waitForBreakpoint(expected, callback) {
- // Poll every few milliseconds until expected breakpoint is hit.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the breakpoint.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if ((gSources.selectedBreakpointClient !== expected) &&
- (gSources.selectedBreakpointClient || bogusClient).location.line !== expected) {
- return;
- }
- // We arrived at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- function waitForCaretPos(number, callback)
- {
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gEditor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- function waitForPopup(state, callback)
- {
- // Poll every few milliseconds until the expression popup is shown.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the popup.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gSources._conditionalPopupVisible != state) {
- return;
- }
- // We got the expression popup at the expected state, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
- }
-
- function clear() {
- gSources._cbTextbox.focus();
- gSources._cbTextbox.value = "";
- }
-
- function write(text) {
- clear();
- append(text);
- }
-
- function append(text) {
- gSources._cbTextbox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gBreakpoints = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js b/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js
deleted file mode 100644
index 9749073d1..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testNonEnumProperties();
- });
-}
-
-function testNonEnumProperties() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let testScope = gDebugger.DebuggerView.Variables.addScope("test-scope");
- let testVar = testScope.addItem("foo");
-
- testVar.addItems({
- foo: {
- value: "bar",
- enumerable: true
- },
- bar: {
- value: "foo",
- enumerable: false
- }
- });
-
- // Expand the variable.
- testScope.expand();
- testVar.expand();
-
- executeSoon(function() {
- let details = testVar._enum;
- let nonenum = testVar._nonenum;
-
- is(details.childNodes.length, 1,
- "There should be just one property in the .details container.");
-
- ok(details.hasAttribute("open"),
- ".details container should be visible.");
-
- ok(nonenum.hasAttribute("open"),
- ".nonenum container should be visible.");
-
- is(nonenum.childNodes.length, 1,
- "There should be just one property in the .nonenum container.");
-
- // Uncheck 'show hidden properties'.
- gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "true");
- gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum();
-
- executeSoon(function() {
- ok(details.hasAttribute("open"),
- ".details container should stay visible.");
-
- ok(!nonenum.hasAttribute("open"),
- ".nonenum container should become hidden.");
-
- // Check 'show hidden properties'.
- gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum();
-
- executeSoon(function() {
- ok(details.hasAttribute("open"),
- ".details container should stay visible.");
-
- ok(nonenum.hasAttribute("open"),
- ".nonenum container should become visible.");
-
- // Collapse the variable.
- testVar.collapse();
-
- executeSoon(function() {
- ok(!details.hasAttribute("open"),
- ".details container should be hidden.");
-
- ok(!nonenum.hasAttribute("open"),
- ".nonenum container should be hidden.");
-
- // Uncheck 'show hidden properties'.
- gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "true");
- gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum();
-
- executeSoon(function() {
- ok(!details.hasAttribute("open"),
- ".details container should stay hidden.");
-
- ok(!nonenum.hasAttribute("open"),
- ".nonenum container should stay hidden.");
-
- // Check 'show hidden properties'.
- gDebugger.DebuggerView.Options._showVariablesOnlyEnumItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._toggleShowVariablesOnlyEnum();
-
- executeSoon(function() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- });
- });
- });
- });
- });
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js b/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js
deleted file mode 100644
index d8222a3ff..000000000
--- a/browser/devtools/debugger/test/browser_dbg_bug868163_highight_on_pause.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that debugger's tab is highlighted when it is paused and not the
-// currently selected tool.
-
-var gTab = null;
-var gDebugger = null;
-var gToolbox = null;
-var gToolboxTab = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebugger = aPane.panelWin;
- gToolbox = aPane._toolbox;
- gToolboxTab = gToolbox.doc.getElementById("toolbox-tab-jsdebugger");
- testPause();
- });
-}
-
-function testPause() {
- is(gDebugger.DebuggerController.activeThread.paused, false,
- "Should be running after debug_tab_pane.");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- gToolbox.selectTool("webconsole").then(() => {
- ok(gToolboxTab.classList.contains("highlighted"),
- "The highlighted class is present");
- ok(!gToolboxTab.hasAttribute("selected") ||
- gToolboxTab.getAttribute("selected") != "true",
- "The tab is not selected");
- }).then(() => gToolbox.selectTool("jsdebugger")).then(() => {
- ok(gToolboxTab.classList.contains("highlighted"),
- "The highlighted class is present");
- ok(gToolboxTab.hasAttribute("selected") &&
- gToolboxTab.getAttribute("selected") == "true",
- "and the tab is selected, so the orange glow will not be present.");
- }).then(testResume);
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-function testResume() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- gToolbox.selectTool("webconsole").then(() => {
- ok(!gToolboxTab.classList.contains("highlighted"),
- "The highlighted class is not present now after the resume");
- ok(!gToolboxTab.hasAttribute("selected") ||
- gToolboxTab.getAttribute("selected") != "true",
- "The tab is not selected");
- }).then(closeDebuggerAndFinish);
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gTab = null;
- gDebugger = null;
- gToolbox = null;
- gToolboxTab = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js b/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js
deleted file mode 100644
index 78e726e66..000000000
--- a/browser/devtools/debugger/test/browser_dbg_chrome-debugging.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that chrome debugging works.
-
-var gClient = null;
-var gTab = null;
-var gMozillaTab = null;
-var gThreadClient = null;
-var gNewGlobal = false;
-var gAttached = false;
-var gChromeSource = false;
-
-const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html";
-
-function test()
-{
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- gTab = addTab(DEBUGGER_TAB_URL, function() {
- gClient.listTabs(function(aResponse) {
- let dbg = aResponse.chromeDebugger;
- ok(dbg, "Found a chrome debugging actor.");
-
- gClient.addOneTimeListener("newGlobal", function() gNewGlobal = true);
- gClient.addListener("newSource", onNewSource);
-
- gClient.attachThread(dbg, function(aResponse, aThreadClient) {
- gThreadClient = aThreadClient;
- ok(!aResponse.error, "Attached to the chrome debugger.");
- gAttached = true;
-
- // Ensure that a new global will be created.
- gMozillaTab = gBrowser.addTab("about:mozilla");
-
- finish_test();
- });
- });
- });
- });
-}
-
-function onNewSource(aEvent, aPacket)
-{
- gChromeSource = aPacket.source.url.startsWith("chrome:");
- finish_test();
-}
-
-function finish_test()
-{
- if (!gAttached || !gChromeSource) {
- return;
- }
- gClient.removeListener("newSource", onNewSource);
- gThreadClient.resume(function(aResponse) {
- removeTab(gMozillaTab);
- removeTab(gTab);
- gClient.close(function() {
- ok(gNewGlobal, "Received newGlobal event.");
- ok(gChromeSource, "Received newSource event for a chrome: script.");
- finish();
- });
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_clean-exit.js b/browser/devtools/debugger/test/browser_dbg_clean-exit.js
deleted file mode 100644
index e80f75a2e..000000000
--- a/browser/devtools/debugger/test/browser_dbg_clean-exit.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that closing a tab with the debugger in a paused state exits cleanly.
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html";
-
-function test() {
- debug_tab_pane(DEBUGGER_TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testCleanExit();
- });
-}
-
-function testCleanExit() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(gDebugger.DebuggerController.activeThread.paused, true,
- "Should be paused after the debugger statement.");
-
- closeDebuggerAndFinish();
- }}, 0);
- });
-
- gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_cmd.html b/browser/devtools/debugger/test/browser_dbg_cmd.html
deleted file mode 100644
index 30779660a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_cmd.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset='utf-8'/>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="application/javascript;version=1.7"/>
- let output;
-
- function init() {
- output = document.querySelector("input");
- output.value = "";
- }
-
- function doit() {
- debugger;
- stepIntoMe(); // step in
-
- output.value = "dbg continue";
- debugger;
- }
-
- function stepIntoMe() {
- output.value = "step in"; // step in
- stepOverMe(); // step over
- let x = 0; // step out
- output.value = "step out";
- }
-
- function stepOverMe() {
- output.value = "step over";
- }
- </script>
-</head>
-<body onload="init()">
- <input type="text" value=""/>
- <input type="button" value="DOIT" onclick="doit()"/>
- <br />
- Use this file to test the following commands:
- <ul>
- <li>dbg interrupt</li>
- <li>dbg continue</li>
- <li>dbg step over</li>
- <li>dbg step in</li>
- <li>dbg step out</li>
- </ul>
-</body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_cmd.js b/browser/devtools/debugger/test/browser_dbg_cmd.js
deleted file mode 100644
index 544eddbaa..000000000
--- a/browser/devtools/debugger/test/browser_dbg_cmd.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- const TEST_URI = "http://example.com/browser/browser/devtools/debugger/" +
- "test/browser_dbg_cmd.html";
-
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- let deferred = Promise.defer();
-
- let openDone = helpers.audit(options, [{
- setup: "dbg open",
- exec: { output: "", completed: false }
- }]);
-
- openDone.then(function() {
- gDevTools.showToolbox(options.target, "jsdebugger").then(function(toolbox) {
- let dbg = toolbox.getCurrentPanel();
- ok(dbg, "DebuggerPanel exists");
-
- function cmd(typed, callback) {
- dbg._controller.activeThread.addOneTimeListener("paused", callback);
- helpers.audit(options, [{
- setup: typed,
- exec: { output: "" }
- }]);
- }
-
- // Wait for the initial resume...
- dbg.panelWin.gClient.addOneTimeListener("resumed", function() {
- info("Starting tests");
-
- let contentDoc = content.window.document;
- let output = contentDoc.querySelector("input[type=text]");
- let btnDoit = contentDoc.querySelector("input[type=button]");
-
- helpers.audit(options, [{
- setup: "dbg list",
- exec: { output: /browser_dbg_cmd.html/ }
- }]);
-
- cmd("dbg interrupt", function() {
- ok(true, "debugger is paused");
- dbg._controller.activeThread.addOneTimeListener("resumed", function() {
- ok(true, "debugger continued");
- dbg._controller.activeThread.addOneTimeListener("paused", function() {
- cmd("dbg step in", function() {
- cmd("dbg step in", function() {
- cmd("dbg step in", function() {
- is(output.value, "step in", "debugger stepped in");
- cmd("dbg step over", function() {
- is(output.value, "step over", "debugger stepped over");
- cmd("dbg step out", function() {
- is(output.value, "step out", "debugger stepped out");
- cmd("dbg continue", function() {
- cmd("dbg continue", function() {
- is(output.value, "dbg continue", "debugger continued");
-
- function closeDebugger(cb) {
- helpers.audit(options, [{
- setup: "dbg close",
- completed: false,
- exec: { output: "" }
- }]);
-
- let toolbox = gDevTools.getToolbox(options.target);
- if (!toolbox) {
- ok(true, "Debugger was closed.");
- cb();
- } else {
- toolbox.on("destroyed", function () {
- ok(true, "Debugger was closed.");
- cb();
- });
- }
- }
-
- // We're closing the debugger twice to make sure
- // 'dbg close' doesn't error when toolbox is already
- // closed. See bug 884638 for more info.
-
- closeDebugger(() => {
- closeDebugger(() => deferred.resolve());
- });
- });
- });
- });
- });
- });
- });
- });
- });
- EventUtils.sendMouseEvent({type:"click"}, btnDoit);
- });
-
- helpers.audit(options, [{
- setup: "dbg continue",
- exec: { output: "" }
- }]);
- });
- });
- });
- });
-
- return deferred.promise;
- }).then(finish);
-} \ No newline at end of file
diff --git a/browser/devtools/debugger/test/browser_dbg_cmd_break.html b/browser/devtools/debugger/test/browser_dbg_cmd_break.html
deleted file mode 100644
index 88e19d4ed..000000000
--- a/browser/devtools/debugger/test/browser_dbg_cmd_break.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset="utf-8">
- <title>Browser GCLI break command test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- function firstCall() {
- eval("window.line0 = Error().lineNumber; secondCall();");
- }
- function secondCall() {
- eval("debugger;");
- }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_cmd_break.js b/browser/devtools/debugger/test/browser_dbg_cmd_break.js
deleted file mode 100644
index 93e45b615..000000000
--- a/browser/devtools/debugger/test/browser_dbg_cmd_break.js
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the break command works as it should
-
-const TEST_URI = "http://example.com/browser/browser/devtools/debugger/" +
- "test/browser_dbg_cmd_break.html";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- // To help us run later commands, and clear up after ourselves
- let client, line0;
-
- return helpers.audit(options, [
- {
- setup: 'break',
- check: {
- input: 'break',
- hints: '',
- markup: 'IIIII',
- status: 'ERROR',
- },
- },
- {
- setup: 'break add',
- check: {
- input: 'break add',
- hints: '',
- markup: 'IIIIIVIII',
- status: 'ERROR'
- },
- },
- {
- setup: 'break add line',
- check: {
- input: 'break add line',
- hints: ' <file> <line>',
- markup: 'VVVVVVVVVVVVVV',
- status: 'ERROR'
- },
- },
- {
- name: 'open toolbox',
- setup: function() {
- var deferred = Promise.defer();
-
- var openDone = gDevTools.showToolbox(options.target, "jsdebugger");
- openDone.then(function(toolbox) {
- let dbg = toolbox.getCurrentPanel();
- ok(dbg, "DebuggerPanel exists");
-
- // Wait for the initial resume...
- dbg.panelWin.gClient.addOneTimeListener("resumed", function() {
- info("Starting tests");
-
- client = dbg.panelWin.gClient;
- client.activeThread.addOneTimeListener("framesadded", function() {
- line0 = '' + options.window.wrappedJSObject.line0;
- deferred.resolve();
- });
-
- // Trigger newScript notifications using eval.
- content.wrappedJSObject.firstCall();
- });
- });
-
- return deferred.promise;
- },
- post: function() {
- ok(client, "Debugger client exists");
- is(line0, 10, "line0 is 10");
- },
- },
- {
- name: 'break add line .../browser_dbg_cmd_break.html 10',
- setup: function() {
- // We have to setup in a function to allow line0 to be initialized
- let line = 'break add line ' + TEST_URI + ' ' + line0;
- return helpers.setInput(options, line);
- },
- check: {
- hints: '',
- status: 'VALID',
- message: '',
- args: {
- file: { value: TEST_URI, message: '' },
- line: { value: 10 }
- }
- },
- exec: {
- output: 'Added breakpoint',
- completed: false
- },
- },
- {
- setup: 'break add line http://example.com/browser/browser/devtools/debugger/test/browser_dbg_cmd_break.html 13',
- check: {
- hints: '',
- status: 'VALID',
- message: '',
- args: {
- file: { value: TEST_URI, message: '' },
- line: { value: 13 }
- }
- },
- exec: {
- output: 'Added breakpoint',
- completed: false
- },
- },
- {
- setup: 'break list',
- check: {
- input: 'break list',
- hints: '',
- markup: 'VVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [
- /Source/, /Remove/,
- /cmd_break\.html:10/,
- /cmd_break\.html:13/
- ]
- },
- },
- {
- name: 'cleanup',
- setup: function() {
- // a.k.a "return client.activeThread.resume();"
- var deferred = Promise.defer();
- client.activeThread.resume(function() {
- deferred.resolve();
- });
- return deferred.promise;
- },
- },
- {
- setup: 'break del 0',
- check: {
- input: 'break del 0',
- hints: ' -> browser_dbg_cmd_break.html:10',
- markup: 'VVVVVVVVVVI',
- status: 'ERROR',
- args: {
- breakpoint: {
- status: 'INCOMPLETE',
- message: ''
- },
- }
- },
- },
- {
- setup: 'break del browser_dbg_cmd_break.html:10',
- check: {
- input: 'break del browser_dbg_cmd_break.html:10',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- breakpoint: { arg: ' browser_dbg_cmd_break.html:10' },
- }
- },
- exec: {
- output: 'Breakpoint removed',
- completed: false
- },
- },
- {
- setup: 'break list',
- check: {
- input: 'break list',
- hints: '',
- markup: 'VVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: [
- /Source/, /Remove/,
- /browser_dbg_cmd_break\.html:13/
- ]
- },
- },
- {
- setup: 'break del browser_dbg_cmd_break.html:13',
- check: {
- input: 'break del browser_dbg_cmd_break.html:13',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- breakpoint: { arg: ' browser_dbg_cmd_break.html:13' },
- }
- },
- exec: {
- output: 'Breakpoint removed',
- completed: false
- },
- },
- {
- setup: 'break list',
- check: {
- input: 'break list',
- hints: '',
- markup: 'VVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: 'No breakpoints set'
- },
- post: function() {
- client = undefined;
-
- let toolbox = gDevTools.getToolbox(options.target);
- return toolbox.destroy();
- }
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html b/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html
deleted file mode 100644
index 19a71432e..000000000
--- a/browser/devtools/debugger/test/browser_dbg_conditional-breakpoints.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Conditional Breakpoints Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- function ermahgerd() {
- var a = {};
- debugger;
- a = "undefined";
- a = "null";
- a = "42";
- a = "true";
- a = "'nasu'";
- a = "/regexp/";
- a = "{}";
- a = "function() {}";
- a = "(function { return false; })()";
- a = "a";
- a = "a !== undefined";
- a = "a !== null";
- a = "b";
- }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_createChrome.js b/browser/devtools/debugger/test/browser_dbg_createChrome.js
deleted file mode 100644
index a55a152e6..000000000
--- a/browser/devtools/debugger/test/browser_dbg_createChrome.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that a chrome debugger can be created in a new process.
-
-var gProcess = null;
-var gTab = null;
-var gDebuggee = null;
-
-function test() {
- // Windows XP test slaves are terribly slow at this test.
- requestLongerTimeout(4);
-
- debug_chrome(STACK_URL, aOnClosing, function(aTab, aDebuggee, aProcess) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gProcess = aProcess;
-
- info("Starting test");
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- ok(gProcess._dbgProcess,
- "The remote debugger process wasn't created properly!");
- ok(gProcess._dbgProcess.isRunning,
- "The remote debugger process isn't running!");
- is(typeof gProcess._dbgProcess.pid, "number",
- "The remote debugger process doesn't have a pid (?!)");
-
- info("process location: " + gProcess._dbgProcess.location);
- info("process pid: " + gProcess._dbgProcess.pid);
- info("process name: " + gProcess._dbgProcess.processName);
- info("process sig: " + gProcess._dbgProcess.processSignature);
-
- ok(gProcess._dbgProfile,
- "The remote debugger profile wasn't created properly!");
- ok(gProcess._dbgProfile.localDir,
- "The remote debugger profile doesn't have a localDir...");
- ok(gProcess._dbgProfile.rootDir,
- "The remote debugger profile doesn't have a rootDir...");
- ok(gProcess._dbgProfile.name,
- "The remote debugger profile doesn't have a name...");
-
- info("profile localDir: " + gProcess._dbgProfile.localDir.path);
- info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
- info("profile name: " + gProcess._dbgProfile.name);
-
- let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
- .createInstance(Ci.nsIToolkitProfileService);
-
- let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
-
- ok(profile,
- "The remote debugger profile wasn't *actually* created properly!");
- is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
- "The remote debugger profile doesn't have the correct localDir!");
- is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
- "The remote debugger profile doesn't have the correct rootDir!");
-
- gProcess.close();
- }}, 0);
-}
-
-function aOnClosing() {
- ok(!gProcess._dbgProcess.isRunning,
- "The remote debugger process isn't closed as it should be!");
- is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256),
- "The remote debugger process didn't die cleanly.");
-
- info("process exit value: " + gProcess._dbgProcess.exitValue);
-
- info("profile localDir: " + gProcess._dbgProfile.localDir.path);
- info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
- info("profile name: " + gProcess._dbgProfile.name);
-
- executeSoon(function() {
- finish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gProcess = null;
- gTab = null;
- gDebuggee = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html b/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html
deleted file mode 100644
index a4bd8443b..000000000
--- a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="text/javascript">
-
-function runDebuggerStatement()
-{
- debugger;
-}
-
-</script>
-</head>
-
-<body></body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js b/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js
deleted file mode 100644
index de18429f0..000000000
--- a/browser/devtools/debugger/test/browser_dbg_debuggerstatement.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests the behavior of the debugger statement.
-
-var gClient = null;
-var gTab = null;
-const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html";
-
-function test()
-{
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- gTab = addTab(DEBUGGER_TAB_URL, function() {
- attach_tab_actor_for_url(gClient, DEBUGGER_TAB_URL, function(actor, response) {
- test_early_debugger_statement(response);
- });
- });
- });
-}
-
-function test_early_debugger_statement(aActor)
-{
- let paused = function(aEvent, aPacket) {
- ok(false, "Pause shouldn't be called before we've attached!\n");
- finish_test();
- };
- gClient.addListener("paused", paused);
- // This should continue without nesting an event loop and calling
- // the onPaused hook, because we haven't attached yet.
- gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement();
-
- gClient.removeListener("paused", paused);
-
- // Now attach and resume...
- gClient.request({ to: aActor.threadActor, type: "attach" }, function(aResponse) {
- gClient.request({ to: aActor.threadActor, type: "resume" }, function(aResponse) {
- test_debugger_statement(aActor);
- });
- });
-}
-
-function test_debugger_statement(aActor)
-{
- var stopped = false;
- gClient.addListener("paused", function(aEvent, aPacket) {
- stopped = true;
-
- gClient.request({ to: aActor.threadActor, type: "resume" }, function() {
- finish_test();
- });
- });
-
- // Reach around the debugging protocol and execute the debugger
- // statement.
- gTab.linkedBrowser.contentWindow.wrappedJSObject.runDebuggerStatement();
- ok(stopped, "Should trigger the pause handler on a debugger statement.");
-}
-
-function finish_test()
-{
- removeTab(gTab);
- gClient.close(function() {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_displayName.html b/browser/devtools/debugger/test/browser_dbg_displayName.html
deleted file mode 100644
index 3311a5ad1..000000000
--- a/browser/devtools/debugger/test/browser_dbg_displayName.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="text/javascript">
-
-var a = function() {
- return function() {
- debugger;
- }
-}
-
-var anon = a();
-anon.displayName = "anonFunc";
-
-var inferred = a();
-
-function evalCall() {
- eval("anon();");
- eval("inferred();");
-}
-
-</script>
-</head>
-
-<body></body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_displayName.js b/browser/devtools/debugger/test/browser_dbg_displayName.js
deleted file mode 100644
index 40f07a255..000000000
--- a/browser/devtools/debugger/test/browser_dbg_displayName.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that anonymous functions appear in the stack frame list with either
-// their displayName property or a SpiderMonkey-inferred name.
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_displayName.html";
-
-function test() {
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testAnonCall();
- });
-}
-
-function testAnonCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 3,
- "Should have three frames.");
-
- is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
- "anonFunc", "Frame name should be anonFunc");
-
- testInferredName();
- }}, 0);
- });
-
- gDebuggee.evalCall();
-}
-
-function testInferredName() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 3,
- "Should have three frames.");
-
- is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
- "a/<", "Frame name should be a/<");
-
- resumeAndFinish();
- }}, 0);
- });
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-function resumeAndFinish() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- removeTab(gTab);
- gPane = null;
- gDebuggee = null;
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_frame-parameters.html b/browser/devtools/debugger/test/browser_dbg_frame-parameters.html
deleted file mode 100644
index ed82aaad4..000000000
--- a/browser/devtools/debugger/test/browser_dbg_frame-parameters.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Debugger Function Call Parameter Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- window.addEventListener("load", function() {
- function test(aArg, bArg, cArg, dArg, eArg, fArg) {
- var a = 1;
- var b = { a: a };
- var c = { a: 1, b: "beta", c: true, d: b };
- var myVar = {
- _prop: 42,
- get prop() { return this._prop; },
- set prop(val) { this._prop = val; }
- };
-
- debugger;
- }
- function load() {
- var a = { a: 1, b: "beta", c: true };
- var e = eval("test(a, 'beta', 3, false, null)");
- }
- var button = document.querySelector("button");
- button.addEventListener("click", load, false);
- var buttonAsProto = Object.create(button);
- });
- </script>
-
- </head>
- <body>
- <button>Click me!</button>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_function-search-01.html b/browser/devtools/debugger/test/browser_dbg_function-search-01.html
deleted file mode 100644
index 9d970a633..000000000
--- a/browser/devtools/debugger/test/browser_dbg_function-search-01.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Function Search</title>
- <script type="text/javascript" src="test-function-search-01.js"></script>
- <script type="text/javascript" src="test-function-search-02.js"></script>
- <script type="text/javascript" src="test-function-search-03.js"></script>
- </head>
-
- <body>
- <p>Peanut butter jelly time!</p>
- </body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_function-search-02.html b/browser/devtools/debugger/test/browser_dbg_function-search-02.html
deleted file mode 100644
index f06b19f1a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_function-search-02.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Function Search</title>
- <script type="text/javascript" src="test-function-search-01.js"></script>
- <script type="text/javascript" src="test-function-search-02.js"></script>
- <script type="text/javascript" src="test-function-search-03.js"></script>
- </head>
-
- <body>
- <p>Peanut butter jelly time!</p>
-
- <script type="text/javascript;version=1.8">
- function inline() {}
- let arrow = () => {}
-
- let foo = bar => {}
- let foo2 = bar2 = baz2 => 42;
-
- setTimeout((foo, bar, baz) => {});
- setTimeout((foo, bar, baz) => 42);
- </script>
-
- </body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_function-search.js b/browser/devtools/debugger/test/browser_dbg_function-search.js
deleted file mode 100644
index 4fbac5d81..000000000
--- a/browser/devtools/debugger/test/browser_dbg_function-search.js
+++ /dev/null
@@ -1,499 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_function-search-02.html";
-
-/**
- * Tests if the function searching works properly.
- */
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gSearchBox = null;
-let gFilteredFunctions = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- Services.tm.currentThread.dispatch({ run: testFunctionsFilter }, 0);
- });
- });
-}
-
-function testFunctionsFilter()
-{
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
- gFilteredFunctions = gDebugger.DebuggerView.FilteredFunctions;
-
- htmlSearch(function() {
- showSource("test-function-search-01.js", function() {
- firstSearch(function() {
- showSource("test-function-search-02.js", function() {
- secondSearch(function() {
- showSource("test-function-search-03.js", function() {
- thirdSearch(function() {
- saveSearch(function() {
- filterSearch(function() {
- bogusSearch(function() {
- anotherSearch(function() {
- emptySearch(function() {
- closeDebuggerAndFinish();
- });
- })
- })
- });
- });
- });
- });
- });
- });
- });
- });
- });
-}
-
-function htmlSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- ok(gFilteredFunctions.selectedValue,
- "An item should be selected in the filtered functions view");
- ok(gFilteredFunctions.selectedLabel,
- "An item should be selected in the filtered functions view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.html") != -1) {
-
- executeSoon(function() {
- let expectedResults = [
- ["inline", "-02.html", "", 16, 15],
- ["arrow", "-02.html", "", 17, 10],
- ["foo", "-02.html", "", 19, 10],
- ["foo2", "-02.html", "", 20, 10],
- ["bar2", "-02.html", "", 20, 17]
- ];
-
- for (let [label, value, description, line, col] of expectedResults) {
- is(gFilteredFunctions.selectedItem.label,
- gDebugger.SourceUtils.trimUrlLength(label + "()"),
- "The corect label (" + label + ") is currently selected.");
- ok(gFilteredFunctions.selectedItem.value.contains(value),
- "The corect value (" + value + ") is attached.");
- is(gFilteredFunctions.selectedItem.description, description,
- "The corect description (" + description + ") is currently shown.");
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource());
- ok(gEditor.getCaretPosition().line == line &&
- gEditor.getCaretPosition().col == col,
- "The editor didn't jump to the correct line.");
-
- ok(gSources.selectedLabel, label,
- "The current source isn't the correct one, according to the label.");
- ok(gSources.selectedValue, value,
- "The current source isn't the correct one, according to the value.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- }
-
- ok(gEditor.getCaretPosition().line == expectedResults[0][3] &&
- gEditor.getCaretPosition().col == expectedResults[0][4],
- "The editor didn't jump to the correct line again.");
-
- executeSoon(callback);
- });
- } else {
- ok(false, "How did you get here? Go away, you.");
- }
- });
-
- write("@");
-}
-
-function firstSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- ok(gFilteredFunctions.selectedValue,
- "An item should be selected in the filtered functions view");
- ok(gFilteredFunctions.selectedLabel,
- "An item should be selected in the filtered functions view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-01.js") != -1) {
-
- executeSoon(function() {
- let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " ";
- let expectedResults = [
- ["test", "-01.js", "", 3, 9],
- ["anonymousExpression", "-01.js", "test.prototype", 8, 2],
- ["namedExpression" + s + "NAME", "-01.js", "test.prototype", 10, 2],
- ["a_test", "-01.js", "foo", 21, 2],
- ["n_test" + s + "x", "-01.js", "foo", 23, 2],
- ["a_test", "-01.js", "foo.sub", 26, 4],
- ["n_test" + s + "y", "-01.js", "foo.sub", 28, 4],
- ["a_test", "-01.js", "foo.sub.sub", 31, 6],
- ["n_test" + s + "z", "-01.js", "foo.sub.sub", 33, 6],
- ["test_SAME_NAME", "-01.js", "foo.sub.sub.sub", 36, 8]
- ];
-
- for (let [label, value, description, line, col] of expectedResults) {
- is(gFilteredFunctions.selectedItem.label,
- gDebugger.SourceUtils.trimUrlLength(label + "()"),
- "The corect label (" + label + ") is currently selected.");
- ok(gFilteredFunctions.selectedItem.value.contains(value),
- "The corect value (" + value + ") is attached.");
- is(gFilteredFunctions.selectedItem.description, description,
- "The corect description (" + description + ") is currently shown.");
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource());
- ok(gEditor.getCaretPosition().line == line &&
- gEditor.getCaretPosition().col == col,
- "The editor didn't jump to the correct line.");
-
- ok(gSources.selectedLabel, label,
- "The current source isn't the correct one, according to the label.");
- ok(gSources.selectedValue, value,
- "The current source isn't the correct one, according to the value.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- }
-
- ok(gEditor.getCaretPosition().line == expectedResults[0][3] &&
- gEditor.getCaretPosition().col == expectedResults[0][4],
- "The editor didn't jump to the correct line again.");
-
- executeSoon(callback);
- });
- } else {
- ok(false, "How did you get here? Go away, you.");
- }
- });
-
- write("@");
-}
-
-function secondSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- ok(gFilteredFunctions.selectedValue,
- "An item should be selected in the filtered functions view");
- ok(gFilteredFunctions.selectedLabel,
- "An item should be selected in the filtered functions view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
-
- executeSoon(function() {
- let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " ";
- let expectedResults = [
- ["test2", "-02.js", "", 3, 4],
- ["test3" + s + "test3_NAME", "-02.js", "", 7, 4],
- ["test4_SAME_NAME", "-02.js", "", 10, 4],
- ["x" + s + "X", "-02.js", "test.prototype", 13, 0],
- ["y" + s + "Y", "-02.js", "test.prototype.sub", 15, 0],
- ["z" + s + "Z", "-02.js", "test.prototype.sub.sub", 17, 0],
- ["t", "-02.js", "test.prototype.sub.sub.sub", 19, 0],
- ["x", "-02.js", "", 19, 31],
- ["y", "-02.js", "", 19, 40],
- ["z", "-02.js", "", 19, 49]
- ];
-
- for (let [label, value, description, line, col] of expectedResults) {
- is(gFilteredFunctions.selectedItem.label,
- gDebugger.SourceUtils.trimUrlLength(label + "()"),
- "The corect label (" + label + ") is currently selected.");
- ok(gFilteredFunctions.selectedItem.value.contains(value),
- "The corect value (" + value + ") is attached.");
- is(gFilteredFunctions.selectedItem.description, description,
- "The corect description (" + description + ") is currently shown.");
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource());
- ok(gEditor.getCaretPosition().line == line &&
- gEditor.getCaretPosition().col == col,
- "The editor didn't jump to the correct line.");
-
- ok(gSources.selectedLabel, label,
- "The current source isn't the correct one, according to the label.");
- ok(gSources.selectedValue, value,
- "The current source isn't the correct one, according to the value.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- }
-
- ok(gEditor.getCaretPosition().line == expectedResults[0][3] &&
- gEditor.getCaretPosition().col == expectedResults[0][4],
- "The editor didn't jump to the correct line again.");
-
- executeSoon(callback);
- });
- } else {
- ok(false, "How did you get here? Go away, you.");
- }
- });
-
- write("@");
-}
-
-function thirdSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- ok(gFilteredFunctions.selectedValue,
- "An item should be selected in the filtered functions view");
- ok(gFilteredFunctions.selectedLabel,
- "An item should be selected in the filtered functions view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-03.js") != -1) {
-
- executeSoon(function() {
- let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " ";
- let expectedResults = [
- ["namedEventListener", "-03.js", "", 3, 42],
- ["a" + s + "A", "-03.js", "bar", 9, 4],
- ["b" + s + "B", "-03.js", "bar.alpha", 14, 4],
- ["c" + s + "C", "-03.js", "bar.alpha.beta", 19, 4],
- ["d" + s + "D", "-03.js", "theta", 24, 4],
- ["fun", "-03.js", "", 28, 6],
- ["foo", "-03.js", "", 28, 12],
- ["bar", "-03.js", "", 28, 18],
- ["t_foo", "-03.js", "", 28, 24],
- ["w_bar" + s + "baz", "-03.js", "window", 28, 37]
- ];
-
- for (let [label, value, description, line, col] of expectedResults) {
- is(gFilteredFunctions.selectedItem.label,
- gDebugger.SourceUtils.trimUrlLength(label + "()"),
- "The corect label (" + label + ") is currently selected.");
- ok(gFilteredFunctions.selectedItem.value.contains(value),
- "The corect value (" + value + ") is attached.");
- is(gFilteredFunctions.selectedItem.description, description,
- "The corect description (" + description + ") is currently shown.");
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource());
- ok(gEditor.getCaretPosition().line == line &&
- gEditor.getCaretPosition().col == col,
- "The editor didn't jump to the correct line.");
-
- ok(gSources.selectedLabel, label,
- "The current source isn't the correct one, according to the label.");
- ok(gSources.selectedValue, value,
- "The current source isn't the correct one, according to the value.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- }
-
- ok(gEditor.getCaretPosition().line == expectedResults[0][3] &&
- gEditor.getCaretPosition().col == expectedResults[0][4],
- "The editor didn't jump to the correct line again.");
-
- executeSoon(callback);
- });
- } else {
- ok(false, "How did you get here? Go away, you.");
- }
- });
-
- write("@");
-}
-
-function filterSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- ok(gFilteredFunctions.selectedValue,
- "An item should be selected in the filtered functions view");
- ok(gFilteredFunctions.selectedLabel,
- "An item should be selected in the filtered functions view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-03.js") != -1) {
-
- executeSoon(function() {
- let s = " " + gDebugger.L10N.getStr("functionSearchSeparatorLabel") + " ";
- let expectedResults = [
- ["namedEventListener", "-03.js", "", 3, 42],
- ["a" + s + "A", "-03.js", "bar", 9, 4],
- ["bar", "-03.js", "", 28, 18],
- ["w_bar" + s + "baz", "-03.js", "window", 28, 37],
- ["test3" + s + "test3_NAME", "-02.js", "", 7, 4],
- ["test4_SAME_NAME", "-02.js", "", 10, 4],
- ["anonymousExpression", "-01.js", "test.prototype", 8, 2],
- ["namedExpression" + s + "NAME", "-01.js", "test.prototype", 10, 2],
- ["a_test", "-01.js", "foo", 21, 2],
- ["a_test", "-01.js", "foo.sub", 26, 4]
- ];
-
- for (let [label, value, description, line, col] of expectedResults) {
- is(gFilteredFunctions.selectedItem.label,
- gDebugger.SourceUtils.trimUrlLength(label + "()"),
- "The corect label (" + label + ") is currently selected.");
- ok(gFilteredFunctions.selectedItem.value.contains(value),
- "The corect value (" + value + ") is attached.");
- is(gFilteredFunctions.selectedItem.description, description,
- "The corect description (" + description + ") is currently shown.");
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource());
- ok(gEditor.getCaretPosition().line == line &&
- gEditor.getCaretPosition().col == col,
- "The editor didn't jump to the correct line.");
-
- ok(gSources.selectedLabel, label,
- "The current source isn't the correct one, according to the label.");
- ok(gSources.selectedValue, value,
- "The current source isn't the correct one, according to the value.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- }
-
- ok(gEditor.getCaretPosition().line == expectedResults[0][3] &&
- gEditor.getCaretPosition().col == expectedResults[0][4],
- "The editor didn't jump to the correct line again.");
-
- executeSoon(callback);
- });
- } else {
- ok(false, "How did you get here? Go away, you.");
- }
- });
-
- write("@a");
-}
-
-function bogusSearch(callback) {
- gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- ok(true, "Popup was successfully hidden after no matches were found!");
- executeSoon(callback);
- });
-
- write("@bogus");
-}
-
-function anotherSearch(callback) {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- ok(true, "Popup was successfully shown after some matches were found!");
- executeSoon(callback);
- });
-
- write("@NAME");
-}
-
-function emptySearch(callback) {
- gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- ok(true, "Popup was successfully hidden when nothing was searched!");
- executeSoon(callback);
- });
-
- clear();
-}
-
-function showSource(label, callback) {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- executeSoon(callback);
- });
- gSources.selectedLabel = label;
-}
-
-function saveSearch(callback) {
- gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- executeSoon(callback);
- });
- if (Math.random() >= 0.5) {
- EventUtils.sendKey("RETURN", gDebugger);
- } else {
- EventUtils.sendMouseEvent({ type: "click" },
- gFilteredFunctions.selectedItem.target,
- gDebugger);
- }
-}
-
-function waitForCaretPos(number, callback)
-{
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- info("caret: " + gEditor.getCaretPosition().line);
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gEditor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchBox = null;
- gFilteredFunctions = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_globalactor-01.js b/browser/devtools/debugger/test/browser_dbg_globalactor-01.js
deleted file mode 100644
index ab18c4562..000000000
--- a/browser/devtools/debugger/test/browser_dbg_globalactor-01.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Check extension-added global actor API.
- */
-
-var gClient = null;
-
-function test()
-{
- DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js");
-
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- gClient.listTabs(function(aResponse) {
- let globalActor = aResponse.testGlobalActor1;
- ok(globalActor, "Found the test tab actor.")
- ok(globalActor.indexOf("testone") >= 0,
- "testTabActor's actorPrefix should be used.");
- gClient.request({ to: globalActor, type: "ping" }, function(aResponse) {
- is(aResponse.pong, "pong", "Actor should respond to requests.");
- // Send another ping to see if the same actor is used.
- gClient.request({ to: globalActor, type: "ping" }, function(aResponse) {
- is(aResponse.pong, "pong", "Actor should respond to requests.");
-
- // Make sure that lazily-created actors are created only once.
- let conn = transport._serverConnection;
- // First we look for the pool of global actors.
- let extraPools = conn._extraPools;
-
- let globalPool;
- for (let pool of extraPools) {
- if (Object.keys(pool._actors).some(function(elem) {
- // Tab actors are in the global pool.
- let re = new RegExp(conn._prefix + "tab", "g");
- return elem.match(re) !== null;
- })) {
- globalPool = pool;
- break;
- }
- }
- // Then we look if the global pool contains only one test actor.
- let actorPrefix = conn._prefix + "testone";
- let actors = Object.keys(globalPool._actors).join();
- info("Global actors: " + actors);
- isnot(actors.indexOf(actorPrefix), -1, "The test actor exists in the pool.");
- is(actors.indexOf(actorPrefix), actors.lastIndexOf(actorPrefix),
- "Only one actor exists in the pool.");
-
- finish_test();
- });
- });
- });
- });
-}
-
-function finish_test()
-{
- gClient.close(function() {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_iframes.html b/browser/devtools/debugger/test/browser_dbg_iframes.html
deleted file mode 100644
index e94dd2f65..000000000
--- a/browser/devtools/debugger/test/browser_dbg_iframes.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head><meta charset='utf-8'/><title>Browser Debugger IFrame Test Tab</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-</head>
-
-<body>
- <iframe src="browser_dbg_debuggerstatement.html"></iframe>
-</body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_iframes.js b/browser/devtools/debugger/test/browser_dbg_iframes.js
deleted file mode 100644
index 7f344c38a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_iframes.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that iframes can be added as debuggees.
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-const TEST_URL = EXAMPLE_URL + "browser_dbg_iframes.html";
-
-function test() {
- debug_tab_pane(TEST_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- is(gDebugger.DebuggerController.activeThread.paused, false,
- "Should be running after debug_tab_pane.");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.paused, true,
- "Should be paused after an interrupt request.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have one frame in the stack.");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: function() {
- closeDebuggerAndFinish();
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }}, 0);
- });
-
- let iframe = gTab.linkedBrowser.contentWindow.wrappedJSObject.frames[0];
- is(iframe.document.title, "Browser Debugger Test Tab", "Found the iframe");
-
- function handler() {
- if (iframe.document.readyState != "complete") {
- return;
- }
- iframe.window.removeEventListener("load", handler, false);
- executeSoon(iframe.runDebuggerStatement);
- };
- iframe.window.addEventListener("load", handler, false);
- handler();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_listtabs-01.js b/browser/devtools/debugger/test/browser_dbg_listtabs-01.js
deleted file mode 100644
index 12b0ce77c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_listtabs-01.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Make sure the listTabs request works as specified.
-
-var gTab1 = null;
-var gTab1Actor = null;
-
-var gTab2 = null;
-var gTab2Actor = null;
-
-var gClient = null;
-
-function test()
-{
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- test_first_tab();
- });
-}
-
-/**
- * Verify that a new tab shows up in a listTabs call.
- */
-function test_first_tab()
-{
- gTab1 = addTab(TAB1_URL, function() {
- gClient.listTabs(function(aResponse) {
- for each (let tab in aResponse.tabs) {
- if (tab.url == TAB1_URL) {
- gTab1Actor = tab.actor;
- }
- }
- ok(gTab1Actor, "Should find a tab actor for tab1.");
- test_second_tab();
- });
- });
-}
-
-function test_second_tab()
-{
- gTab2 = addTab(TAB2_URL, function() {
- gClient.listTabs(function(aResponse) {
- // Verify that tab1 has the same actor it used to.
- let foundTab1 = false;
- for each (let tab in aResponse.tabs) {
- if (tab.url == TAB1_URL) {
- is(tab.actor, gTab1Actor, "Tab1's actor shouldn't have changed.");
- foundTab1 = true;
- }
- if (tab.url == TAB2_URL) {
- gTab2Actor = tab.actor;
- }
- }
- ok(foundTab1, "Should have found an actor for tab 1.");
- ok(gTab2Actor != null, "Should find an actor for tab2.");
-
- test_remove_tab();
- });
- });
-}
-
-function test_remove_tab()
-{
- removeTab(gTab1);
- gTab1 = null;
- gClient.listTabs(function(aResponse) {
- // Verify that tab1 is no longer included in listTabs.
- let foundTab1 = false;
- for each (let tab in aResponse.tabs) {
- if (tab.url == TAB1_URL) {
- ok(false, "Tab1 should be gone.");
- }
- }
- ok(!foundTab1, "Tab1 should be gone.");
- test_attach_removed_tab();
- });
-}
-
-function test_attach_removed_tab()
-{
- removeTab(gTab2);
- gTab2 = null;
- gClient.addListener("paused", function(aEvent, aPacket) {
- ok(false, "Attaching to an exited tab actor shouldn't generate a pause.");
- finish_test();
- });
-
- gClient.request({ to: gTab2Actor, type: "attach" }, function(aResponse) {
- is(aResponse.type, "exited", "Tab should consider itself exited.");
- finish_test();
- });
-}
-
-function finish_test()
-{
- gClient.close(function() {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_listtabs-02.js b/browser/devtools/debugger/test/browser_dbg_listtabs-02.js
deleted file mode 100644
index c48d374ca..000000000
--- a/browser/devtools/debugger/test/browser_dbg_listtabs-02.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Make sure the root actor's live tab list implementation works as specified.
-
-let testPage = ("data:text/html;charset=utf-8,"
- + encodeURIComponent("<title>JS Debugger BrowserTabList test page</title>" +
- "<body>Yo.</body>"));
-// The tablist object whose behavior we observe.
-let tabList;
-let firstActor, actorA;
-let tabA, tabB, tabC;
-let newWin;
-// Stock onListChanged handler.
-let onListChangedCount = 0;
-function onListChangedHandler() {
- onListChangedCount++;
-}
-
-function test() {
- tabList = new DebuggerServer.BrowserTabList("fake DebuggerServerConnection");
- tabList._testing = true;
- tabList.onListChanged = onListChangedHandler;
-
- checkSingleTab();
- // Open a new tab. We should be notified.
- is(onListChangedCount, 0, "onListChanged handler call count");
- tabA = addTab(testPage, onTabA);
-}
-
-function checkSingleTab() {
- var tabActors = [t for (t of tabList)];
- is(tabActors.length, 1, "initial tab list: contains initial tab");
- firstActor = tabActors[0];
- is(firstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'");
- is(firstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'");
-}
-
-function onTabA() {
- is(onListChangedCount, 1, "onListChanged handler call count");
-
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 2, "tabA opened: two tabs in list");
- ok(tabActors.has(firstActor), "tabA opened: initial tab present");
-
- info("actors: " + [a.url for (a of tabActors)]);
- actorA = [a for (a of tabActors) if (a !== firstActor)][0];
- ok(actorA.url.match(/^data:text\/html;/), "tabA opened: new tab URL");
- is(actorA.title, "JS Debugger BrowserTabList test page", "tabA opened: new tab title");
-
- tabB = addTab(testPage, onTabB);
-}
-
-function onTabB() {
- is(onListChangedCount, 2, "onListChanged handler call count");
-
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 3, "tabB opened: three tabs in list");
-
- // Test normal close.
- gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
- ok(!aEvent.detail, "This was a normal tab close");
- // Let the actor's TabClose handler finish first.
- executeSoon(testTabClose);
- }, false);
- gBrowser.removeTab(tabA);
-}
-
-function testTabClose() {
- is(onListChangedCount, 3, "onListChanged handler call count");
-
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 2, "tabA closed: two tabs in list");
- ok(tabActors.has(firstActor), "tabA closed: initial tab present");
-
- info("actors: " + [a.url for (a of tabActors)]);
- actorA = [a for (a of tabActors) if (a !== firstActor)][0];
- ok(actorA.url.match(/^data:text\/html;/), "tabA closed: new tab URL");
- is(actorA.title, "JS Debugger BrowserTabList test page", "tabA closed: new tab title");
-
- // Test tab close by moving tab to a window.
- tabC = addTab(testPage, onTabC);
-}
-
-function onTabC() {
- is(onListChangedCount, 4, "onListChanged handler call count");
-
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 3, "tabC opened: three tabs in list");
-
- gBrowser.tabContainer.addEventListener("TabClose", function onClose2(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", onClose2, false);
- ok(aEvent.detail, "This was a tab closed by moving");
- // Let the actor's TabClose handler finish first.
- executeSoon(testWindowClose);
- }, false);
- newWin = gBrowser.replaceTabWithWindow(tabC);
-}
-
-function testWindowClose() {
- is(onListChangedCount, 5, "onListChanged handler call count");
-
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 3, "tabC closed: three tabs in list");
- ok(tabActors.has(firstActor), "tabC closed: initial tab present");
-
- info("actors: " + [a.url for (a of tabActors)]);
- actorA = [a for (a of tabActors) if (a !== firstActor)][0];
- ok(actorA.url.match(/^data:text\/html;/), "tabC closed: new tab URL");
- is(actorA.title, "JS Debugger BrowserTabList test page", "tabC closed: new tab title");
-
- // Cleanup.
- newWin.addEventListener("unload", function onUnload(aEvent) {
- newWin.removeEventListener("unload", onUnload, false);
- ok(!aEvent.detail, "This was a normal window close");
- // Let the actor's TabClose handler finish first.
- executeSoon(checkWindowClose);
- }, false);
- newWin.close();
-}
-
-function checkWindowClose() {
- is(onListChangedCount, 6, "onListChanged handler call count");
-
- // Check that closing a XUL window leaves the other actors intact.
- var tabActors = new Set([t for (t of tabList)]);
- is(tabActors.size, 2, "newWin closed: two tabs in list");
- ok(tabActors.has(firstActor), "newWin closed: initial tab present");
-
- info("actors: " + [a.url for (a of tabActors)]);
- actorA = [a for (a of tabActors) if (a !== firstActor)][0];
- ok(actorA.url.match(/^data:text\/html;/), "newWin closed: new tab URL");
- is(actorA.title, "JS Debugger BrowserTabList test page", "newWin closed: new tab title");
-
- // Test normal close.
- gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
- ok(!aEvent.detail, "This was a normal tab close");
- // Let the actor's TabClose handler finish first.
- executeSoon(finishTest);
- }, false);
- gBrowser.removeTab(tabB);
-}
-
-function finishTest() {
- checkSingleTab();
- finish();
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js b/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js
deleted file mode 100644
index 478a7677b..000000000
--- a/browser/devtools/debugger/test/browser_dbg_location-changes-blank.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that changing the tab location URL to a page with no scripts works.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("browser_dbg_stack") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.simpleCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0);
- }
- }
-}
-
-function testSimpleCall() {
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have only one frame.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
- "There should be a selected script.");
- isnot(gDebugger.editor.getText().length, 0,
- "The source editor should have some text displayed.");
- isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"),
- "The source editor text should not be 'Loading...'");
-
- testLocationChange();
-}
-
-function testLocationChange()
-{
- gDebugger.DebuggerController.activeThread.resume(function() {
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
-
- gDebugger.addEventListener("Debugger:AfterSourcesAdded", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- is(gDebugger.DebuggerView.Sources.selectedValue, "",
- "There should be no selected script.");
- is(gDebugger.editor.getText().length, 0,
- "The source editor not have any text displayed.");
-
- let menulist = gDebugger.DebuggerView.Sources.widget;
- let noScripts = gDebugger.L10N.getStr("noSourcesText");
- is(menulist.getAttribute("label"), noScripts,
- "The menulist should display a notice that there are no scripts availalble.");
- is(menulist.getAttribute("tooltiptext"), "",
- "The menulist shouldn't have any tooltip text attributed when there are no scripts available.");
-
- closeDebuggerAndFinish();
- });
- });
- content.location = "about:blank";
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js b/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js
deleted file mode 100644
index 569171fd7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_location-changes-bp.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that reloading a page with a breakpoint set does not cause it to
- * fire more than once.
- */
-
-const TAB_URL = EXAMPLE_URL + "test-location-changes-bp.html";
-const SCRIPT_URL = EXAMPLE_URL + "test-location-changes-bp.js";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var sourcesShown = false;
-var tabNavigated = false;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testAddBreakpoint();
- });
-}
-
-function testAddBreakpoint()
-{
- let controller = gDebugger.DebuggerController;
- controller.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(controller.activeThread.state, "paused",
- "The debugger statement was reached.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have one frame.");
-
- gPane.addBreakpoint({ url: SCRIPT_URL, line: 5 }, testResume);
- }}, 0);
- });
-
- gDebuggee.runDebuggerStatement();
-}
-
-function testResume()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint wasn't hit yet.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("resumed", function() {
- thread.addOneTimeListener("paused", function() {
- executeSoon(testBreakpointHit);
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"));
- });
-
- thread.resume();
-}
-
-function testBreakpointHit()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint was hit.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("paused", function test(aEvent, aPacket) {
- thread.addOneTimeListener("resumed", function() {
- executeSoon(testReloadPage);
- });
-
- is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line.");
- isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit.");
- thread.resume();
- });
-
- thread.resume();
-}
-
-function testReloadPage()
-{
- let controller = gDebugger.DebuggerController;
- controller._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- tabNavigated = true;
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
- clickAgain();
- });
-
- gDebugger.addEventListener("Debugger:SourceShown", function onSourcesShown() {
- sourcesShown = true;
- gDebugger.removeEventListener("Debugger:SourceShown", onSourcesShown);
- clickAgain();
- });
-
- content.location.reload();
-}
-
-function clickAgain()
-{
- if (!sourcesShown || !tabNavigated) {
- return;
- }
-
- let controller = gDebugger.DebuggerController;
- controller.activeThread.addOneTimeListener("framesadded", function() {
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint was hit.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("paused", function test(aEvent, aPacket) {
- thread.addOneTimeListener("resumed", function() {
- executeSoon(closeDebuggerAndFinish);
- });
-
- is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line.");
- isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit.");
- thread.resume();
- });
-
- thread.resume();
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"));
-}
-
-function testBreakpointHitAfterReload()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "The breakpoint was hit.");
-
- let thread = gDebugger.DebuggerController.activeThread;
- thread.addOneTimeListener("paused", function test(aEvent, aPacket) {
- thread.addOneTimeListener("resumed", function() {
- executeSoon(closeDebuggerAndFinish);
- });
-
- is(aPacket.why.type, "debuggerStatement", "Execution has advanced to the next line.");
- isnot(aPacket.why.type, "breakpoint", "No ghost breakpoint was hit.");
- thread.resume();
- });
-
- thread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes-new.js b/browser/devtools/debugger/test/browser_dbg_location-changes-new.js
deleted file mode 100644
index e2b1d8e2c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_location-changes-new.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that changing the tab location URL to a page with other scripts works.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("browser_dbg_stack") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.simpleCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testSimpleCall }, 0);
- }
- }
-}
-
-function testSimpleCall() {
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have only one frame.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
- "There should be a selected script.");
- isnot(gDebugger.editor.getText().length, 0,
- "The source editor should have some text displayed.");
- isnot(gDebugger.editor.getText(), gDebugger.L10N.getStr("loadingText"),
- "The source editor text should not be 'Loading...'");
-
- testLocationChange();
-}
-
-function testLocationChange()
-{
- gDebugger.DebuggerController.activeThread.resume(function() {
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- isnot(gDebugger.DebuggerView.Sources.selectedValue, null,
- "There should be a selected script.");
- isnot(gDebugger.editor.getText().length, 0,
- "The source editor should have some text displayed.");
-
- let menulist = gDebugger.DebuggerView.Sources.widget;
- let noScripts = gDebugger.L10N.getStr("noSourcesText");
- isnot(menulist.getAttribute("label"), noScripts,
- "The menulist should not display a notice that there are no scripts availalble.");
- isnot(menulist.getAttribute("tooltiptext"), "",
- "The menulist should have a tooltip text attributed.");
-
- closeDebuggerAndFinish();
- });
- });
- content.location = EXAMPLE_URL + "browser_dbg_iframes.html";
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_location-changes.js b/browser/devtools/debugger/test/browser_dbg_location-changes.js
deleted file mode 100644
index 5f1122e63..000000000
--- a/browser/devtools/debugger/test/browser_dbg_location-changes.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that changing the tab location URL works.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test()
-{
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({
- run: function() {
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have only one frame.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- testLocationChange();
- }
- }, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-function testLocationChange()
-{
- gDebugger.DebuggerController.activeThread.resume(function() {
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
-
- closeDebuggerAndFinish();
- });
- content.location = TAB1_URL;
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_menustatus.js b/browser/devtools/debugger/test/browser_dbg_menustatus.js
deleted file mode 100644
index 07472654f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_menustatus.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// We make sure the menuitems in the application menubar
-// are checked.
-
-function test() {
- var tab1 = addTab("about:blank", function() {
- var tab2 = addTab("about:blank", function() {
- gBrowser.selectedTab = tab2;
-
- let pane = DebuggerUI.toggleDebugger();
- ok(pane, "toggleDebugger() should return a pane.");
- let frame = pane._frame;
-
- wait_for_connect_and_resume(function() {
- let cmd = document.getElementById("Tools:Debugger");
- is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked.");
-
- gBrowser.selectedTab = tab1;
-
- is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked after tab switch.");
-
- gBrowser.selectedTab = tab2;
-
- is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked.");
-
- let pane = DebuggerUI.toggleDebugger();
-
- is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked once closed.");
- });
-
- window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
- window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
- removeTab(tab1);
- removeTab(tab2);
-
- finish();
- }, true);
- });
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_multiple-windows.js b/browser/devtools/debugger/test/browser_dbg_multiple-windows.js
deleted file mode 100644
index aab2d046c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_multiple-windows.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Make sure that the debugger attaches to the right tab when multiple windows
-// are open.
-
-var gTab1 = null;
-var gTab1Actor = null;
-
-var gSecondWindow = null;
-
-var gClient = null;
-var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]
- .getService(Ci.nsIWindowMediator);
-
-function test()
-{
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- test_first_tab();
- });
-}
-
-function test_first_tab()
-{
- gTab1 = addTab(TAB1_URL, function() {
- gClient.listTabs(function(aResponse) {
- for each (let tab in aResponse.tabs) {
- if (tab.url == TAB1_URL) {
- gTab1Actor = tab.actor;
- }
- }
- ok(gTab1Actor, "Should find a tab actor for tab1.");
- is(aResponse.selected, 1, "Tab1 is selected.");
- test_open_window();
- });
- });
-}
-
-function test_open_window()
-{
- gSecondWindow = window.open(TAB2_URL, "secondWindow");
- ok(!!gSecondWindow, "Second window created.");
- gSecondWindow.focus();
- let top = windowMediator.getMostRecentWindow("navigator:browser");
- var main2 = gSecondWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
- .rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
- is(top, main2, "The second window is on top.");
- executeSoon(function() {
- gClient.listTabs(function(aResponse) {
- is(aResponse.selected, 2, "Tab2 is selected.");
-
- test_focus_first();
- });
- });
-}
-
-function test_focus_first()
-{
- window.content.addEventListener("focus", function onFocus() {
- window.content.removeEventListener("focus", onFocus, false);
- let top = windowMediator.getMostRecentWindow("navigator:browser");
- var main1 = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
- .rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
- is(top, main1, "The first window is on top.");
-
- gClient.listTabs(function(aResponse) {
- is(aResponse.selected, 1, "Tab1 is selected after focusing on it.");
-
- test_remove_tab();
- });
- }, false);
- window.content.focus();
-}
-
-function test_remove_tab()
-{
- gSecondWindow.close();
- gSecondWindow = null;
- removeTab(gTab1);
- gTab1 = null;
- gClient.listTabs(function(aResponse) {
- // Verify that tabs are no longer included in listTabs.
- let foundTab1 = false;
- let foundTab2 = false;
- for (let tab of aResponse.tabs) {
- if (tab.url == TAB1_URL) {
- foundTab1 = true;
- } else if (tab.url == TAB2_URL) {
- foundTab2 = true;
- }
- }
- ok(!foundTab1, "Tab1 should be gone.");
- ok(!foundTab2, "Tab2 should be gone.");
- is(aResponse.selected, 0, "The original tab is selected.");
- finish_test();
- });
-}
-
-function finish_test()
-{
- gClient.close(function() {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_nav-01.js b/browser/devtools/debugger/test/browser_dbg_nav-01.js
deleted file mode 100644
index 3e3d4f432..000000000
--- a/browser/devtools/debugger/test/browser_dbg_nav-01.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Check tab attach/navigation.
- */
-
-var gTab1 = null;
-var gTab1Actor = null;
-
-var gClient = null;
-
-function test()
-{
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function(aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- get_tab();
- });
-}
-
-function get_tab()
-{
- gTab1 = addTab(TAB1_URL, function() {
- get_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) {
- gTab1Actor = aGrip.actor;
- gClient.request({ to: aGrip.actor, type: "attach" }, function(aResponse) {
- gClient.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
- dump("onTabNavigated state " + aPacket.state + "\n");
- if (aPacket.state == "start") {
- return;
- }
- gClient.removeListener("tabNavigated", onTabNavigated);
-
- is(aPacket.url, TAB2_URL, "Got a tab navigation notification.");
- gClient.addOneTimeListener("tabDetached", function (aEvent, aPacket) {
- ok(true, "Got a tab detach notification.");
- finish_test();
- });
- removeTab(gTab1);
- });
- gTab1.linkedBrowser.loadURI(TAB2_URL);
- });
- });
- });
-}
-
-function finish_test()
-{
- gClient.close(function() {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_pane-collapse.js b/browser/devtools/debugger/test/browser_dbg_pane-collapse.js
deleted file mode 100644
index b53b74fed..000000000
--- a/browser/devtools/debugger/test/browser_dbg_pane-collapse.js
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that the debugger panes collapse properly.
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gView = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gView = gDebugger.DebuggerView;
-
- testPanesState();
-
- gView.toggleInstrumentsPane({ visible: true, animated: false });
- testInstrumentsPaneCollapse();
- testPanesStartupPref();
- });
-}
-
-function testPanesState() {
- let instrumentsPane =
- gDebugger.document.getElementById("instruments-pane");
- let instrumentsPaneToggleButton =
- gDebugger.document.getElementById("instruments-pane-toggle");
-
- ok(instrumentsPane.hasAttribute("pane-collapsed") &&
- instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The debugger view instruments pane should initially be hidden.");
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view instruments pane should initially be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should not be checked.");
-}
-
-function testInstrumentsPaneCollapse() {
- let instrumentsPane =
- gDebugger.document.getElementById("instruments-pane");
- let instrumentsPaneToggleButton =
- gDebugger.document.getElementById("instruments-pane-toggle");
-
- let width = parseInt(instrumentsPane.getAttribute("width"));
- is(width, gDebugger.Prefs.instrumentsWidth,
- "The instruments pane has an incorrect width.");
- is(instrumentsPane.style.marginLeft, "0px",
- "The instruments pane has an incorrect left margin.");
- is(instrumentsPane.style.marginRight, "0px",
- "The instruments pane has an incorrect right margin.");
- ok(!instrumentsPane.hasAttribute("animated"),
- "The instruments pane has an incorrect animated attribute.");
- ok(!instrumentsPane.hasAttribute("pane-collapsed") &&
- !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The instruments pane should at this point be visible.");
-
- gView.toggleInstrumentsPane({ visible: false, animated: true });
-
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view panes should still initially be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should still not be checked.");
-
- let margin = -(width + 1) + "px";
- is(width, gDebugger.Prefs.instrumentsWidth,
- "The instruments pane has an incorrect width after collapsing.");
- is(instrumentsPane.style.marginLeft, margin,
- "The instruments pane has an incorrect left margin after collapsing.");
- is(instrumentsPane.style.marginRight, margin,
- "The instruments pane has an incorrect right margin after collapsing.");
- ok(instrumentsPane.hasAttribute("animated"),
- "The instruments pane has an incorrect attribute after an animated collapsing.");
- ok(instrumentsPane.hasAttribute("pane-collapsed") &&
- instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The instruments pane should not be visible after collapsing.");
-
- gView.toggleInstrumentsPane({ visible: true, animated: false });
-
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view panes should still initially be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should still not be checked.");
-
- is(width, gDebugger.Prefs.instrumentsWidth,
- "The instruments pane has an incorrect width after uncollapsing.");
- is(instrumentsPane.style.marginLeft, "0px",
- "The instruments pane has an incorrect left margin after uncollapsing.");
- is(instrumentsPane.style.marginRight, "0px",
- "The instruments pane has an incorrect right margin after uncollapsing.");
- ok(!instrumentsPane.hasAttribute("animated"),
- "The instruments pane has an incorrect attribute after an unanimated uncollapsing.");
- ok(!instrumentsPane.hasAttribute("pane-collapsed") &&
- !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The instruments pane should be visible again after uncollapsing.");
-}
-
-function testPanesStartupPref() {
- let instrumentsPane =
- gDebugger.document.getElementById("instruments-pane");
- let instrumentsPaneToggleButton =
- gDebugger.document.getElementById("instruments-pane-toggle");
-
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view panes should still initially be preffed as hidden.");
-
- ok(!instrumentsPane.hasAttribute("pane-collapsed") &&
- !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The debugger instruments pane should at this point be visible.");
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view panes should initially be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should still not be checked.");
-
- gDebugger.DebuggerView.Options._showPanesOnStartupItem.setAttribute("checked", "true");
- gDebugger.DebuggerView.Options._toggleShowPanesOnStartup();
-
- executeSoon(function() {
- ok(!instrumentsPane.hasAttribute("pane-collapsed") &&
- !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The debugger instruments pane should at this point be visible.");
- is(gDebugger.Prefs.panesVisibleOnStartup, true,
- "The debugger view panes should now be preffed as visible.");
- is(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should now be checked.");
-
- gDebugger.DebuggerView.Options._showPanesOnStartupItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._toggleShowPanesOnStartup();
-
- executeSoon(function() {
- ok(!instrumentsPane.hasAttribute("pane-collapsed") &&
- !instrumentsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The debugger instruments pane should at this point be visible.");
- is(gDebugger.Prefs.panesVisibleOnStartup, false,
- "The debugger view panes should now be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showPanesOnStartupItem.getAttribute("checked"), "true",
- "The options menu item should now be unchecked.");
-
- executeSoon(function() {
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gView = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_panesize-inner.js b/browser/devtools/debugger/test/browser_dbg_panesize-inner.js
deleted file mode 100644
index ead34bec9..000000000
--- a/browser/devtools/debugger/test/browser_dbg_panesize-inner.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function test() {
- var tab1 = addTab(TAB1_URL, function() {
- gBrowser.selectedTab = tab1;
- let target1 = TargetFactory.forTab(tab1);
-
- ok(!gDevTools.getToolbox(target1),
- "Shouldn't have a debugger panel for this tab yet.");
-
- gDevTools.showToolbox(target1, "jsdebugger").then(function(toolbox) {
- let dbg = toolbox.getCurrentPanel();
- ok(dbg, "We should have a debugger panel.");
-
- let preferredSw = Services.prefs.getIntPref("devtools.debugger.ui.panes-sources-width");
- let preferredIw = Services.prefs.getIntPref("devtools.debugger.ui.panes-instruments-width");
- let someWidth1, someWidth2;
-
- do {
- someWidth1 = parseInt(Math.random() * 200) + 100;
- someWidth2 = parseInt(Math.random() * 200) + 100;
- } while (someWidth1 == preferredSw ||
- someWidth2 == preferredIw)
-
- let someWidth1 = parseInt(Math.random() * 200) + 100;
- let someWidth2 = parseInt(Math.random() * 200) + 100;
-
- info("Preferred sources width: " + preferredSw);
- info("Preferred instruments width: " + preferredIw);
- info("Generated sources width: " + someWidth1);
- info("Generated instruments width: " + someWidth2);
-
- let content = dbg.panelWin;
- let sources;
- let instruments;
-
- wait_for_connect_and_resume(function() {
- ok(content.Prefs.sourcesWidth,
- "The debugger preferences should have a saved sourcesWidth value.");
- ok(content.Prefs.instrumentsWidth,
- "The debugger preferences should have a saved instrumentsWidth value.");
-
- sources = content.document.getElementById("sources-pane");
- instruments = content.document.getElementById("instruments-pane");
-
- is(content.Prefs.sourcesWidth, sources.getAttribute("width"),
- "The sources pane width should be the same as the preferred value.");
- is(content.Prefs.instrumentsWidth, instruments.getAttribute("width"),
- "The instruments pane width should be the same as the preferred value.");
-
- sources.setAttribute("width", someWidth1);
- instruments.setAttribute("width", someWidth2);
-
- removeTab(tab1);
- }, tab1);
-
- window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
- window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
-
- is(content.Prefs.sourcesWidth, sources.getAttribute("width"),
- "The sources pane width should have been saved by now.");
- is(content.Prefs.instrumentsWidth, instruments.getAttribute("width"),
- "The instruments pane width should have been saved by now.");
-
- // Cleanup after ourselves!
- Services.prefs.setIntPref("devtools.debugger.ui.panes-sources-width", preferredSw);
- Services.prefs.setIntPref("devtools.debugger.ui.panes-instruments-width", preferredIw);
-
- finish();
- }, true);
- });
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html b/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html
deleted file mode 100644
index 31bcfa922..000000000
--- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Debugger Pause on Exceptions Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <button>Click me!</button>
- <ul></ul>
- </body>
- <script type="text/javascript">
- window.addEventListener("load", function() {
- function load() {
- try {
- debugger;
- throw new Error("boom");
- } catch (e) {
- var list = document.querySelector("ul");
- var item = document.createElement("li");
- item.innerHTML = e.message;
- list.appendChild(item);
- }
- }
- var button = document.querySelector("button");
- button.addEventListener("click", load, false);
- });
- </script>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js b/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js
deleted file mode 100644
index 7aac1b7d0..000000000
--- a/browser/devtools/debugger/test/browser_dbg_pause-exceptions.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the pause-on-exceptions toggle works.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_pause-exceptions.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gPrevPref = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- gPrevPref = Services.prefs.getBoolPref(
- "devtools.debugger.pause-on-exceptions");
- Services.prefs.setBoolPref(
- "devtools.debugger.pause-on-exceptions", true);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- testWithFrame();
- });
-}
-
-function testWithFrame()
-{
- let count = 0;
- gPane.panelWin.gClient.addOneTimeListener("paused", function() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function testA() {
- // We expect 2 Debugger:FetchedVariables events, one from the global object
- // scope and the regular one.
- if (++count < 2) {
- is(count, 1, "A. First Debugger:FetchedVariables event received.");
- return;
- }
- is(count, 2, "A. Second Debugger:FetchedVariables event received.");
- gDebugger.removeEventListener("Debugger:FetchedVariables", testA, false);
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should be paused now.");
-
- // Pause on exceptions should be already enabled.
- is(gPrevPref, false,
- "The pause-on-exceptions functionality should be disabled by default.");
- is(gDebugger.Prefs.pauseOnExceptions, true,
- "The pause-on-exceptions pref should be true from startup.");
- is(gDebugger.DebuggerView.Options._pauseOnExceptionsItem.getAttribute("checked"), "true",
- "Pause on exceptions should be enabled from startup. ")
-
- count = 0;
- gPane.panelWin.gClient.addOneTimeListener("resumed", function() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function testB() {
- // We expect 2 Debugger:FetchedVariables events, one from the global object
- // scope and the regular one.
- if (++count < 2) {
- is(count, 1, "B. First Debugger:FetchedVariables event received.");
- return;
- }
- is(count, 2, "B. Second Debugger:FetchedVariables event received.");
- gDebugger.removeEventListener("Debugger:FetchedVariables", testB, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.firstChild,
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have one frame.");
-
- is(scopes.children.length, 3, "Should have 3 variable scopes.");
-
- is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>",
- "Should have the right property name for the exception.");
-
- is(innerNodes[0].querySelector(".value").getAttribute("value"), "[object Error]",
- "Should have the right property value for the exception.");
-
- // Disable pause on exceptions.
- gDebugger.DebuggerView.Options._pauseOnExceptionsItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._togglePauseOnExceptions();
-
- is(gDebugger.Prefs.pauseOnExceptions, false,
- "The pause-on-exceptions pref should have been set to false.");
-
- resumeAndFinish();
-
- }}, 0);
- }, false);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
- }, false);
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gPane.panelWin.gClient.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- closeDebuggerAndFinish();
-
- }}, 0);
- });
-
- // Resume to let the exception reach it's catch clause.
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_pause-resume.js b/browser/devtools/debugger/test/browser_dbg_pause-resume.js
deleted file mode 100644
index 1f886cd17..000000000
--- a/browser/devtools/debugger/test/browser_dbg_pause-resume.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gView = null;
-var gLH = null;
-var gL10N = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gView = gDebugger.DebuggerView;
- gLH = gDebugger.LayoutHelpers;
- gL10N = gDebugger.L10N;
-
- testPause();
- });
-}
-
-function testPause() {
- is(gDebugger.DebuggerController.activeThread.paused, false,
- "Should be running after debug_tab_pane.");
-
- let button = gDebugger.document.getElementById("resume");
- is(button.getAttribute("tooltiptext"),
- gL10N.getFormatStr("pauseButtonTooltip",
- gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))),
- "Button tooltip should be pause when running.");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.paused, true,
- "Should be paused after an interrupt request.");
-
- is(button.getAttribute("tooltiptext"),
- gL10N.getFormatStr("resumeButtonTooltip",
- gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))),
- "Button tooltip should be resume when paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames when paused in the main loop.");
-
- testResume();
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-function testResume() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(gDebugger.DebuggerController.activeThread.paused, false,
- "Should be paused after an interrupt request.");
-
- let button = gDebugger.document.getElementById("resume");
- is(button.getAttribute("tooltiptext"),
- gL10N.getFormatStr("pauseButtonTooltip",
- gLH.prettyKey(gDebugger.document.getElementById("resumeKey"))),
- "Button tooltip should be pause when running.");
-
- closeDebuggerAndFinish();
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gView = null;
- gLH = null;
- gL10N = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_pause-warning.js b/browser/devtools/debugger/test/browser_dbg_pause-warning.js
deleted file mode 100644
index c72363343..000000000
--- a/browser/devtools/debugger/test/browser_dbg_pause-warning.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gView = null;
-var gToolbox = null;
-var gTarget = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gView = gDebugger.DebuggerView;
-
- gTarget = TargetFactory.forTab(gBrowser.selectedTab);
- gToolbox = gDevTools.getToolbox(gTarget);
-
- testPause();
- });
-}
-
-function testPause() {
- let button = gDebugger.document.getElementById("resume");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("paused", function() {
- Services.tm.currentThread.dispatch({ run: function() {
- is(gDebugger.DebuggerController.activeThread.paused, true,
- "Debugger is paused.");
-
- ok(gTarget.isThreadPaused, "target.isThreadPaused has been updated");
-
- gToolbox.once("inspector-selected", testNotificationIsUp1);
- gToolbox.selectTool("inspector");
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-function testNotificationIsUp1() {
- let notificationBox = gToolbox.getNotificationBox();
- let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
- ok(notification, "Notification is present");
- gToolbox.once("jsdebugger-selected", testNotificationIsHidden);
- gToolbox.selectTool("jsdebugger");
-}
-
-function testNotificationIsHidden() {
- let notificationBox = gToolbox.getNotificationBox();
- let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
- ok(!notification, "Notification is hidden");
- gToolbox.once("inspector-selected", testNotificationIsUp2);
- gToolbox.selectTool("inspector");
-}
-
-function testNotificationIsUp2() {
- let notificationBox = gToolbox.getNotificationBox();
- let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
- ok(notification, "Notification is present");
- testResume();
-}
-
-function testResume() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- ok(!gTarget.isThreadPaused, "target.isThreadPaused has been updated");
- let notificationBox = gToolbox.getNotificationBox();
- let notification = notificationBox.getNotificationWithValue("inspector-script-paused");
- ok(!notification, "No notification once debugger resumed");
-
- closeDebuggerAndFinish();
- }}, 0);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("resume"),
- gDebugger);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gView = null;
- gToolbox = null;
- gTarget = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js b/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js
deleted file mode 100644
index 76f934df7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_progress-listener-bug.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that the debugger does show up even if a progress listener reads the
-// WebProgress argument's DOMWindow property in onStateChange() (bug 771655).
-
-var gPane = null;
-var gTab = null;
-var gOldListener = null;
-
-const TEST_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-function test() {
- installListener();
-
- debug_tab_pane(TEST_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- let gDebugger = gPane.panelWin;
-
- is(gDebugger.DebuggerController._isInitialized, true,
- "Controller should be initialized after debug_tab_pane.");
- is(gDebugger.DebuggerView._isInitialized, true,
- "View should be initialized after debug_tab_pane.");
-
- closeDebuggerAndFinish();
- });
-}
-
-// This is taken almost verbatim from bug 771655.
-function installListener() {
- if ("_testPL" in window) {
- gOldListener = _testPL;
- Cc['@mozilla.org/docloaderservice;1'].getService(Ci.nsIWebProgress)
- .removeProgressListener(_testPL);
- }
-
- window._testPL = {
- START_DOC: Ci.nsIWebProgressListener.STATE_START |
- Ci.nsIWebProgressListener.STATE_IS_DOCUMENT,
- onStateChange: function(wp, req, stateFlags, status) {
- if ((stateFlags & this.START_DOC) === this.START_DOC) {
- // This DOMWindow access triggers the unload event.
- wp.DOMWindow;
- }
- },
- QueryInterface: function(iid) {
- if (iid.equals(Ci.nsISupportsWeakReference) ||
- iid.equals(Ci.nsIWebProgressListener))
- return this;
- throw Cr.NS_ERROR_NO_INTERFACE;
- }
- }
-
- Cc['@mozilla.org/docloaderservice;1'].getService(Ci.nsIWebProgress)
- .addProgressListener(_testPL, Ci.nsIWebProgress.NOTIFY_STATE_REQUEST);
-}
-
-registerCleanupFunction(function() {
- if (gOldListener) {
- window._testPL = gOldListener;
- } else {
- delete window._testPL;
- }
- removeTab(gTab);
- gPane = null;
- gTab = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-01.js
deleted file mode 100644
index 8a018fbf9..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js
+++ /dev/null
@@ -1,165 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- testlabelshortening();
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-function testlabelshortening() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- let sv = gDebugger.SourceUtils;
- let vs = gDebugger.DebuggerView.Sources;
- let ss = gDebugger.DebuggerController.SourceScripts;
- vs.empty();
- vs.widget.removeEventListener("select", vs._onScriptsChange, false);
-
- is(sv.trimUrlQuery("a/b/c.d?test=1&random=4#reference"), "a/b/c.d",
- "Trimming the url query isn't done properly.");
-
- let ellipsis = Services.prefs.getComplexValue("intl.ellipsis", Ci.nsIPrefLocalizedString);
- let nanana = new Array(20).join(NaN);
-
- let superLargeLabel = new Array(100).join("Beer can in Jamaican sounds like Bacon!");
- let trimmedLargeLabel = sv.trimUrlLength(superLargeLabel, 1234);
- is(trimmedLargeLabel.length, 1235,
- "Trimming large labels isn't done properly.");
- ok(trimmedLargeLabel.endsWith(ellipsis),
- "Trimming large labels should add an ellipsis at the end.");
-
- let urls = [
- { href: "http://some.address.com/random/", leaf: "subrandom/" },
- { href: "http://some.address.com/random/", leaf: "suprandom/?a=1" },
- { href: "http://some.address.com/random/", leaf: "?a=1" },
- { href: "https://another.address.org/random/subrandom/", leaf: "page.html" },
-
- { href: "ftp://interesting.address.org/random/", leaf: "script.js" },
- { href: "ftp://interesting.address.com/random/", leaf: "script.js" },
- { href: "ftp://interesting.address.com/random/", leaf: "x/script.js" },
- { href: "ftp://interesting.address.com/random/", leaf: "x/y/script.js?a=1" },
- { href: "ftp://interesting.address.com/random/x/", leaf: "y/script.js?a=1&b=2" },
- { href: "ftp://interesting.address.com/random/x/y/", leaf: "script.js?a=1&b=2&c=3" },
- { href: "ftp://interesting.address.com/random/", leaf: "x/y/script.js?a=2" },
- { href: "ftp://interesting.address.com/random/x/", leaf: "y/script.js?a=2&b=3" },
- { href: "ftp://interesting.address.com/random/x/y/", leaf: "script.js?a=2&b=3&c=4" },
-
- { href: "file://random/", leaf: "script_t1.js&a=1&b=2&c=3" },
- { href: "file://random/", leaf: "script_t2_1.js#id" },
- { href: "file://random/", leaf: "script_t2_2.js?a" },
- { href: "file://random/", leaf: "script_t2_3.js&b" },
- { href: "resource://random/", leaf: "script_t3_1.js#id?a=1&b=2" },
- { href: "resource://random/", leaf: "script_t3_2.js?a=1&b=2#id" },
- { href: "resource://random/", leaf: "script_t3_3.js&a=1&b=2#id" },
-
- { href: nanana, leaf: "Batman!" + "{trim me, now and forevermore}" }
- ];
-
- urls.forEach(function(url) {
- executeSoon(function() {
- let loc = url.href + url.leaf;
- vs.push([sv.trimUrlLength(sv.getSourceLabel(loc)), loc], { forced: true });
- });
- });
-
- executeSoon(function() {
- info("Script labels:");
- info(vs.labels.toSource());
-
- info("Script locations:");
- info(vs.values.toSource());
-
- urls.forEach(function(url) {
- let loc = url.href + url.leaf;
- if (url.dupe) {
- ok(!vs.containsValue(loc), "Shouldn't contain script: " + loc);
- } else {
- ok(vs.containsValue(loc), "Should contain script: " + loc);
- }
- });
-
- ok(vs.containsLabel("random/subrandom/"),
- "Script (0) label is incorrect.");
- ok(vs.containsLabel("random/suprandom/?a=1"),
- "Script (1) label is incorrect.");
- ok(vs.containsLabel("random/?a=1"),
- "Script (2) label is incorrect.");
- ok(vs.containsLabel("page.html"),
- "Script (3) label is incorrect.");
-
- ok(vs.containsLabel("script.js"),
- "Script (4) label is incorrect.");
- ok(vs.containsLabel("random/script.js"),
- "Script (5) label is incorrect.");
- ok(vs.containsLabel("random/x/script.js"),
- "Script (6) label is incorrect.");
- ok(vs.containsLabel("script.js?a=1"),
- "Script (7) label is incorrect.");
-
- ok(vs.containsLabel("script_t1.js"),
- "Script (8) label is incorrect.");
- ok(vs.containsLabel("script_t2_1.js"),
- "Script (9) label is incorrect.");
- ok(vs.containsLabel("script_t2_2.js"),
- "Script (10) label is incorrect.");
- ok(vs.containsLabel("script_t2_3.js"),
- "Script (11) label is incorrect.");
- ok(vs.containsLabel("script_t3_1.js"),
- "Script (12) label is incorrect.");
- ok(vs.containsLabel("script_t3_2.js"),
- "Script (13) label is incorrect.");
- ok(vs.containsLabel("script_t3_3.js"),
- "Script (14) label is incorrect.");
-
- ok(vs.containsLabel(nanana + "Batman!" + ellipsis),
- "Script (15) label is incorrect.");
-
- is(vs.itemCount, urls.filter(function(url) !url.dupe).length,
- "Didn't get the correct number of scripts in the list.");
-
- is(vs.getItemByValue("http://some.address.com/random/subrandom/").label, "random/subrandom/",
- "Scripts.getItemByValue isn't functioning properly (0).");
- is(vs.getItemByValue("http://some.address.com/random/suprandom/?a=1").label, "random/suprandom/?a=1",
- "Scripts.getItemByValue isn't functioning properly (1).");
-
- is(vs.getItemByLabel("random/subrandom/").value, "http://some.address.com/random/subrandom/",
- "Scripts.getItemByLabel isn't functioning properly (0).");
- is(vs.getItemByLabel("random/suprandom/?a=1").value, "http://some.address.com/random/suprandom/?a=1",
- "Scripts.getItemByLabel isn't functioning properly (1).");
-
-
- closeDebuggerAndFinish();
- });
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-02.js
deleted file mode 100644
index e2a6bdd08..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-02.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let testScope = gDebugger.DebuggerView.Variables.addScope("test");
-
- ok(testScope,
- "Should have created a scope.");
-
- is(testScope.id.substring(0, 4), "test",
- "The newly created scope should have the default id set.");
-
- is(testScope.target.querySelector(".name").getAttribute("value"), "test",
- "Any new scope should have the designated title.");
-
- is(testScope.target.querySelector(".variables-view-element-details").childNodes.length, 0,
- "Any new scope should have a container with no child nodes.");
-
- is(gDebugger.DebuggerView.Variables._list.childNodes.length, 3,
- "Should have 3 scopes created.");
-
-
- ok(!testScope.expanded,
- "Any new created scope should be initially collapsed.");
-
- ok(testScope.visible,
- "Any new created scope should be initially visible.");
-
- let expandCallbackSender = null;
- let collapseCallbackSender = null;
- let toggleCallbackSender = null;
- let hideCallbackSender = null;
- let showCallbackSender = null;
-
- testScope.onexpand = function(sender) { expandCallbackSender = sender; };
- testScope.oncollapse = function(sender) { collapseCallbackSender = sender; };
- testScope.ontoggle = function(sender) { toggleCallbackSender = sender; };
- testScope.onhide = function(sender) { hideCallbackSender = sender; };
- testScope.onshow = function(sender) { showCallbackSender = sender; };
-
- testScope.expand();
- ok(testScope.expanded,
- "The testScope shouldn't be collapsed anymore.");
- is(expandCallbackSender, testScope,
- "The expandCallback wasn't called as it should.");
-
- testScope.collapse();
- ok(!testScope.expanded,
- "The testScope should be collapsed again.");
- is(collapseCallbackSender, testScope,
- "The collapseCallback wasn't called as it should.");
-
- testScope.expanded = true;
- ok(testScope.expanded,
- "The testScope shouldn't be collapsed anymore.");
-
- testScope.toggle();
- ok(!testScope.expanded,
- "The testScope should be collapsed again.");
- is(toggleCallbackSender, testScope,
- "The toggleCallback wasn't called as it should.");
-
-
- testScope.hide();
- ok(!testScope.visible,
- "The testScope should be invisible after hiding.");
- is(hideCallbackSender, testScope,
- "The hideCallback wasn't called as it should.");
-
- testScope.show();
- ok(testScope.visible,
- "The testScope should be visible again.");
- is(showCallbackSender, testScope,
- "The showCallback wasn't called as it should.");
-
- testScope.visible = false;
- ok(!testScope.visible,
- "The testScope should be invisible after hiding.");
-
-
- ok(!testScope.expanded,
- "The testScope should remember it is collapsed even if it is hidden.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testScope.target.querySelector(".title"),
- gDebugger);
-
- ok(testScope.expanded,
- "Clicking the testScope tilte should expand it.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testScope.target.querySelector(".title"),
- gDebugger);
-
- ok(!testScope.expanded,
- "Clicking again the testScope tilte should collapse it.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-03.js b/browser/devtools/debugger/test/browser_dbg_propertyview-03.js
deleted file mode 100644
index 684af5fb7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-03.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let testScope = gDebugger.DebuggerView.Variables.addScope("test-scope");
- let testVar = testScope.addItem("something");
- let duplVar = testScope.addItem("something");
-
- info("Scope id: " + testScope.target.id);
- info("Scope name: " + testScope.target.name);
- info("Variable id: " + testVar.target.id);
- info("Variable name: " + testVar.target.name);
-
- ok(testScope,
- "Should have created a scope.");
- ok(testVar,
- "Should have created a variable.");
-
- ok(testScope.id.contains("test-scope"),
- "Should have the correct scope id.");
- ok(testScope.target.id.contains("test-scope"),
- "Should have the correct scope id on the element.");
- is(testScope.name, "test-scope",
- "Should have the correct scope name.");
-
- ok(testVar.id.contains("something"),
- "Should have the correct variable id.");
- ok(testVar.target.id.contains("something"),
- "Should have the correct variable id on the element.");
- is(testVar.name, "something",
- "Should have the correct variable name.");
-
- is(duplVar, null,
- "Shouldn't be able to duplicate variables in the same scope.");
-
- is(testVar.target.querySelector(".name").getAttribute("value"), "something",
- "Any new variable should have the designated title.");
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0,
- "Any new variable should have a details container with no child nodes.");
-
-
- let properties = testVar.addItems({ "child": { "value": { "type": "object",
- "class": "Object" } } });
-
-
- ok(!testVar.expanded,
- "Any new created variable should be initially collapsed.");
-
- ok(testVar.visible,
- "Any new created variable should be initially visible.");
-
-
- testVar.expand();
- ok(testVar.expanded,
- "The testVar shouldn't be collapsed anymore.");
-
- testVar.collapse();
- ok(!testVar.expanded,
- "The testVar should be collapsed again.");
-
- testVar.expanded = true;
- ok(testVar.expanded,
- "The testVar shouldn't be collapsed anymore.");
-
- testVar.toggle();
- ok(!testVar.expanded,
- "The testVar should be collapsed again.");
-
-
- testVar.hide();
- ok(!testVar.visible,
- "The testVar should be invisible after hiding.");
-
- testVar.show();
- ok(testVar.visible,
- "The testVar should be visible again.");
-
- testVar.visible = false;
- ok(!testVar.visible,
- "The testVar should be invisible after hiding.");
-
-
- ok(!testVar.expanded,
- "The testVar should remember it is collapsed even if it is hidden.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.target.querySelector(".name"),
- gDebugger);
-
- ok(testVar.expanded,
- "Clicking the testVar name should expand it.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.target.querySelector(".name"),
- gDebugger);
-
- ok(!testVar.expanded,
- "Clicking again the testVar name should collapse it.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.target.querySelector(".arrow"),
- gDebugger);
-
- ok(testVar.expanded,
- "Clicking the testVar arrow should expand it.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.target.querySelector(".arrow"),
- gDebugger);
-
- ok(!testVar.expanded,
- "Clicking again the testVar arrow should collapse it.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.target.querySelector(".title"),
- gDebugger);
-
- ok(testVar.expanded,
- "Clicking the testVar title div should expand it again.");
-
-
- testScope.show();
- testScope.expand();
- testVar.show();
- testVar.expand();
-
- ok(!testVar.get("child").expanded,
- "The testVar child property should remember it is collapsed even if it is hidden.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.get("child").target.querySelector(".name"),
- gDebugger);
-
- ok(testVar.get("child").expanded,
- "Clicking the testVar child property name should expand it.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.get("child").target.querySelector(".name"),
- gDebugger);
-
- ok(!testVar.get("child").expanded,
- "Clicking again the testVar child property name should collapse it.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.get("child").target.querySelector(".arrow"),
- gDebugger);
-
- ok(testVar.get("child").expanded,
- "Clicking the testVar child property arrow should expand it.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.get("child").target.querySelector(".arrow"),
- gDebugger);
-
- ok(!testVar.get("child").expanded,
- "Clicking again the testVar child property arrow should collapse it.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- testVar.get("child").target.querySelector(".title"),
- gDebugger);
-
- ok(testVar.get("child").expanded,
- "Clicking the testVar child property title div should expand it again.");
-
-
- gDebugger.DebuggerView.Variables.empty();
- is(gDebugger.DebuggerView.Variables._list.childNodes.length, 0,
- "The scopes should have been removed from the parent container tree.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-04.js b/browser/devtools/debugger/test/browser_dbg_propertyview-04.js
deleted file mode 100644
index 47ab452c7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-04.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let testScope = gDebugger.DebuggerView.Variables.addScope("test");
- let testVar = testScope.addItem("something");
-
- let properties = testVar.addItems({
- "child": {
- "value": {
- "type": "object",
- "class": "Object"
- },
- "enumerable": true
- }
- });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
- "A new detail node should have been added in the variable tree.");
-
- ok(testVar.get("child"),
- "The added detail property should be accessible from the variable.");
-
-
- let properties2 = testVar.get("child").addItems({
- "grandchild": {
- "value": {
- "type": "object",
- "class": "Object"
- },
- "enumerable": true
- }
- });
-
- is(testVar.get("child").target.querySelector(".variables-view-element-details").childNodes.length, 1,
- "A new detail node should have been added in the variable tree.");
-
- ok(testVar.get("child").get("grandchild"),
- "The added detail property should be accessible from the variable.");
-
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-05.js b/browser/devtools/debugger/test/browser_dbg_propertyview-05.js
deleted file mode 100644
index 74e172ef7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-05.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- requestLongerTimeout(3);
-
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let testScope = gDebugger.DebuggerView.Variables.addScope("test");
- let testVar = testScope.addItem("something");
-
- testVar.setGrip(1.618);
-
- is(testVar.target.querySelector(".value").getAttribute("value"), "1.618",
- "The grip information for the variable wasn't set correctly.");
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0,
- "Adding a value property shouldn't add any new tree nodes.");
-
-
- testVar.setGrip({ "type": "object", "class": "Window" });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0,
- "Adding type and class properties shouldn't add any new tree nodes.");
-
- is(testVar.target.querySelector(".value").getAttribute("value"), "[object Window]",
- "The information for the variable wasn't set correctly.");
-
-
- testVar.addItems({ "helloWorld": { "value": "hello world", "enumerable": true } });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
- "A new detail node should have been added in the variable tree.");
-
-
- testVar.addItems({ "helloWorld": { "value": "hello jupiter", "enumerable": true } });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
- "Shouldn't be able to duplicate nodes added in the variable tree.");
-
-
- testVar.addItems({ "someProp0": { "value": "random string", "enumerable": true },
- "someProp1": { "value": "another string", "enumerable": true } });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 3,
- "Two new detail nodes should have been added in the variable tree.");
-
-
- testVar.addItems({ "someProp2": { "value": { "type": "null" }, "enumerable": true },
- "someProp3": { "value": { "type": "undefined" }, "enumerable": true },
- "someProp4": {
- "value": { "type": "object", "class": "Object" },
- "enumerable": true
- }
- });
-
- is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 6,
- "Three new detail nodes should have been added in the variable tree.");
-
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-06.js b/browser/devtools/debugger/test/browser_dbg_propertyview-06.js
deleted file mode 100644
index a36eee392..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-06.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let globalScope = gDebugger.DebuggerView.Variables.addScope("Test-Global");
- let localScope = gDebugger.DebuggerView.Variables.addScope("Test-Local");
-
- let windowVar = globalScope.addItem("window");
- let documentVar = globalScope.addItem("document");
- let localVar0 = localScope.addItem("localVariable");
-
- let localVar1 = localScope.addItem("localVar1");
- let localVar2 = localScope.addItem("localVar2");
- let localVar3 = localScope.addItem("localVar3");
- let localVar4 = localScope.addItem("localVar4");
- let localVar5 = localScope.addItem("localVar5");
-
- localVar0.setGrip(42);
- localVar1.setGrip(true);
- localVar2.setGrip("nasu");
-
- localVar3.setGrip({ "type": "undefined" });
- localVar4.setGrip({ "type": "null" });
- localVar5.setGrip({ "type": "object", "class": "Object" });
-
- localVar5.addItems({
- "someProp0": { "value": 42, "enumerable": true },
- "someProp1": { "value": true , "enumerable": true},
- "someProp2": { "value": "nasu", "enumerable": true},
- "someProp3": { "value": { "type": "undefined" }, "enumerable": true},
- "someProp4": { "value": { "type": "null" }, "enumerable": true },
- "someProp5": {
- "value": { "type": "object", "class": "Object" },
- "enumerable": true
- },
- "someUndefined": {
- "value": { "type": "undefined" },
- "enumerable": true
- },
- "someAccessor": {
- "get": { "type": "object", "class": "Function" },
- "set": { "type": "undefined" },
- "enumerable": true
- }
- });
-
- localVar5.get("someProp5").addItems({
- "someProp0": { "value": 42, "enumerable": true },
- "someProp1": { "value": true, "enumerable": true },
- "someProp2": { "value": "nasu", "enumerable": true },
- "someProp3": { "value": { "type": "undefined" }, "enumerable": true },
- "someProp4": { "value": { "type": "null" }, "enumerable": true },
- "someProp5": {
- "value": { "type": "object", "class": "Object" },
- "enumerable": true
- },
- "someUndefined": {
- "value": { "type": "undefined" },
- "enumerable": true
- },
- "someAccessor": {
- "get": { "type": "object", "class": "Function" },
- "set": { "type": "undefined" },
- "enumerable": true
- }
- });
-
- windowVar.setGrip({ "type": "object", "class": "Window" });
- windowVar.addItems({
- "helloWorld": { "value": "hello world" }
- });
-
- documentVar.setGrip({ "type": "object", "class": "HTMLDocument" });
- documentVar.addItems({
- "onload": { "value": { "type": "null" } },
- "onunload": { "value": { "type": "null" } },
- "onfocus": { "value": { "type": "null" } },
- "onblur": { "value": { "type": "null" } },
- "onclick": { "value": { "type": "null" } },
- "onkeypress": { "value": { "type": "null" } }
- });
-
-
- ok(windowVar, "The windowVar hasn't been created correctly.");
- ok(documentVar, "The documentVar hasn't been created correctly.");
- ok(localVar0, "The localVar0 hasn't been created correctly.");
- ok(localVar1, "The localVar1 hasn't been created correctly.");
- ok(localVar2, "The localVar2 hasn't been created correctly.");
- ok(localVar3, "The localVar3 hasn't been created correctly.");
- ok(localVar4, "The localVar4 hasn't been created correctly.");
- ok(localVar5, "The localVar5 hasn't been created correctly.");
-
- for each (let elt in globalScope.target.querySelector(".nonenum").childNodes) {
- info("globalScope :: " + { id: elt.id, className: elt.className }.toSource());
- }
- is(globalScope.target.querySelector(".nonenum").childNodes.length, 2,
- "The globalScope doesn't contain all the created variable elements.");
-
- for each (let elt in localScope.target.querySelector(".nonenum").childNodes) {
- info("localScope :: " + { id: elt.id, className: elt.className }.toSource());
- }
- is(localScope.target.querySelector(".nonenum").childNodes.length, 6,
- "The localScope doesn't contain all the created variable elements.");
-
- is(localVar5.target.querySelector(".variables-view-element-details").childNodes.length, 8,
- "The localVar5 doesn't contain all the created properties.");
- is(localVar5.get("someProp5").target.querySelector(".variables-view-element-details").childNodes.length, 8,
- "The localVar5.someProp5 doesn't contain all the created properties.");
-
- is(windowVar.target.querySelector(".value").getAttribute("value"), "[object Window]",
- "The grip information for the windowVar wasn't set correctly.");
- is(documentVar.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
- "The grip information for the documentVar wasn't set correctly.");
-
- is(localVar0.target.querySelector(".value").getAttribute("value"), "42",
- "The grip information for the localVar0 wasn't set correctly.");
- is(localVar1.target.querySelector(".value").getAttribute("value"), "true",
- "The grip information for the localVar1 wasn't set correctly.");
- is(localVar2.target.querySelector(".value").getAttribute("value"), "\"nasu\"",
- "The grip information for the localVar2 wasn't set correctly.");
- is(localVar3.target.querySelector(".value").getAttribute("value"), "undefined",
- "The grip information for the localVar3 wasn't set correctly.");
- is(localVar4.target.querySelector(".value").getAttribute("value"), "null",
- "The grip information for the localVar4 wasn't set correctly.");
- is(localVar5.target.querySelector(".value").getAttribute("value"), "[object Object]",
- "The grip information for the localVar5 wasn't set correctly.");
-
- is(localVar5.get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
- "The grip information for the localVar0 wasn't set correctly.");
- is(localVar5.get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
- "The grip information for the localVar1 wasn't set correctly.");
- is(localVar5.get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
- "The grip information for the localVar2 wasn't set correctly.");
- is(localVar5.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
- "The grip information for the localVar3 wasn't set correctly.");
- is(localVar5.get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
- "The grip information for the localVar4 wasn't set correctly.");
- is(localVar5.get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]",
- "The grip information for the localVar5 wasn't set correctly.");
- is(localVar5.get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined",
- "The grip information for the someUndefined wasn't set correctly.");
- is(localVar5.get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
- "The grip information for the someAccessor wasn't set correctly.");
-
- is(localVar5.get("someProp5").get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
- "The grip information for the sub-localVar0 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
- "The grip information for the sub-localVar1 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
- "The grip information for the sub-localVar2 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
- "The grip information for the sub-localVar3 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
- "The grip information for the sub-localVar4 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someProp5").target.querySelector(".value").getAttribute("value"), "[object Object]",
- "The grip information for the sub-localVar5 wasn't set correctly.");
- is(localVar5.get("someProp5").get("someUndefined").target.querySelector(".value").getAttribute("value"), "undefined",
- "The grip information for the sub-someUndefined wasn't set correctly.");
- is(localVar5.get("someProp5").get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
- "The grip information for the sub-someAccessor wasn't set correctly.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-07.js b/browser/devtools/debugger/test/browser_dbg_propertyview-07.js
deleted file mode 100644
index b8dfce0af..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-07.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view displays function parameters.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testFrameParameters();
- });
-}
-
-function testFrameParameters()
-{
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"),
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 3,
- "Should have three frames.");
-
- is(localNodes.length, 12,
- "The localScope should contain all the created variable elements.");
-
- is(localNodes[0].querySelector(".value").getAttribute("value"), "[object Window]",
- "Should have the right property value for 'this'.");
-
- is(localNodes[1].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for 'aArg'.");
-
- is(localNodes[2].querySelector(".value").getAttribute("value"), '"beta"',
- "Should have the right property value for 'bArg'.");
-
- is(localNodes[3].querySelector(".value").getAttribute("value"), "3",
- "Should have the right property value for 'cArg'.");
-
- is(localNodes[4].querySelector(".value").getAttribute("value"), "false",
- "Should have the right property value for 'dArg'.");
-
- is(localNodes[5].querySelector(".value").getAttribute("value"), "null",
- "Should have the right property value for 'eArg'.");
-
- is(localNodes[6].querySelector(".value").getAttribute("value"), "undefined",
- "Should have the right property value for 'fArg'.");
-
- is(localNodes[7].querySelector(".value").getAttribute("value"), "1",
- "Should have the right property value for 'a'.");
-
- is(localNodes[8].querySelector(".value").getAttribute("value"), "[object Arguments]",
- "Should have the right property value for 'arguments'.");
-
- is(localNodes[9].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for 'b'.");
-
- is(localNodes[10].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for 'c'.");
-
- resumeAndFinish();
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames.");
-
- closeDebuggerAndFinish();
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-08.js b/browser/devtools/debugger/test/browser_dbg_propertyview-08.js
deleted file mode 100644
index c050676ab..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-08.js
+++ /dev/null
@@ -1,244 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view displays the properties of objects.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testFrameParameters();
- });
-}
-
-function testFrameParameters()
-{
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[0],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- localNonEnums = localScope.querySelector(".nonenum").childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 3,
- "Should have three frames.");
-
- is(localNodes.length + localNonEnums.length, 12,
- "The localScope and localNonEnums should contain all the created variable elements.");
-
- is(localNodes[0].querySelector(".value").getAttribute("value"), "[object Window]",
- "Should have the right property value for 'this'.");
- is(localNodes[8].querySelector(".value").getAttribute("value"), "[object Arguments]",
- "Should have the right property value for 'arguments'.");
- is(localNodes[10].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for 'c'.");
-
-
- let gVars = gDebugger.DebuggerView.Variables;
-
- is(gVars.getScopeForNode(
- gVars._list.querySelectorAll(".variables-view-scope")[0]).target,
- gVars._list.querySelectorAll(".variables-view-scope")[0],
- "getScopeForNode([0]) didn't return the expected scope.");
- is(gVars.getScopeForNode(
- gVars._list.querySelectorAll(".variables-view-scope")[1]).target,
- gVars._list.querySelectorAll(".variables-view-scope")[1],
- "getScopeForNode([1]) didn't return the expected scope.");
- is(gVars.getScopeForNode(
- gVars._list.querySelectorAll(".variables-view-scope")[2]).target,
- gVars._list.querySelectorAll(".variables-view-scope")[2],
- "getScopeForNode([2]) didn't return the expected scope.");
-
- is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[0]).expanded, true,
- "The local scope should be expanded by default.");
- is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[1]).expanded, false,
- "The block scope should be collapsed by default.");
- is(gVars.getScopeForNode(gVars._list.querySelectorAll(".variables-view-scope")[2]).expanded, false,
- "The global scope should be collapsed by default.");
-
-
- let thisNode = gVars.getItemForNode(localNodes[0]);
- let argumentsNode = gVars.getItemForNode(localNodes[8]);
- let cNode = gVars.getItemForNode(localNodes[10]);
-
- is(thisNode.expanded, false,
- "The thisNode should not be expanded at this point.");
- is(argumentsNode.expanded, false,
- "The argumentsNode should not be expanded at this point.");
- is(cNode.expanded, false,
- "The cNode should not be expanded at this point.");
-
- // Expand the 'this', 'arguments' and 'c' tree nodes. This causes
- // their properties to be retrieved and displayed.
- thisNode.expand();
- argumentsNode.expand();
- cNode.expand();
-
- is(thisNode.expanded, true,
- "The thisNode should be expanded at this point.");
- is(argumentsNode.expanded, true,
- "The argumentsNode should be expanded at this point.");
- is(cNode.expanded, true,
- "The cNode should be expanded at this point.");
-
- // Poll every few milliseconds until the properties are retrieved.
- // It's important to set the timer in the chrome window, because the
- // content window timers are disabled while the debuggee is paused.
- let count = 0;
- let intervalID = window.setInterval(function(){
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the properties.");
- window.clearInterval(intervalID);
- return resumeAndFinish();
- }
- if (!thisNode._retrieved ||
- !argumentsNode._retrieved ||
- !cNode._retrieved) {
- return;
- }
- window.clearInterval(intervalID);
-
- is(thisNode.target.querySelector(".value")
- .getAttribute("value"), "[object Window]",
- "Should have the right property value for 'this'.");
-
- is(thisNode.get("window").target.querySelector(".name")
- .getAttribute("value"), "window",
- "Should have the right property name for 'window'.");
- ok(thisNode.get("window").target.querySelector(".value")
- .getAttribute("value").search(/object/) != -1,
- "'window' should be an object.");
-
- is(thisNode.get("document").target.querySelector(".name")
- .getAttribute("value"), "document",
- "Should have the right property name for 'document'.");
- ok(thisNode.get("document").target.querySelector(".value")
- .getAttribute("value").search(/object/) != -1,
- "'document' should be an object.");
-
-
- is(argumentsNode.target.querySelector(".value")
- .getAttribute("value"), "[object Arguments]",
- "Should have the right property value for 'arguments'.");
-
- is(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .name")[0]
- .getAttribute("value"), "0",
- "Should have the right property name for 'arguments[0]'.");
- ok(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .value")[0]
- .getAttribute("value").search(/object/) != -1,
- "'arguments[0]' should be an object.");
-
- is(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .name")[7]
- .getAttribute("value"), "__proto__",
- "Should have the right property name for '__proto__'.");
- ok(argumentsNode.target.querySelectorAll(".variables-view-property > .title > .value")[7]
- .getAttribute("value").search(/object/) != -1,
- "'__proto__' should be an object.");
-
-
- is(cNode.target.querySelector(".value")
- .getAttribute("value"), "[object Object]",
- "Should have the right property value for 'c'.");
-
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[0]
- .getAttribute("value"), "a",
- "Should have the right property name for 'c.a'.");
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[0]
- .getAttribute("value"), "1",
- "Should have the right value for 'c.a'.");
-
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[1]
- .getAttribute("value"), "b",
- "Should have the right property name for 'c.b'.");
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[1]
- .getAttribute("value"), "\"beta\"",
- "Should have the right value for 'c.b'.");
-
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .name")[2]
- .getAttribute("value"), "c",
- "Should have the right property name for 'c.c'.");
- is(cNode.target.querySelectorAll(".variables-view-property > .title > .value")[2]
- .getAttribute("value"), "true",
- "Should have the right value for 'c.c'.");
-
-
- is(gVars.getItemForNode(
- cNode.target.querySelectorAll(".variables-view-property")[0]).target,
- cNode.target.querySelectorAll(".variables-view-property")[0],
- "getItemForNode([0]) didn't return the expected property.");
-
- is(gVars.getItemForNode(
- cNode.target.querySelectorAll(".variables-view-property")[1]).target,
- cNode.target.querySelectorAll(".variables-view-property")[1],
- "getItemForNode([1]) didn't return the expected property.");
-
- is(gVars.getItemForNode(
- cNode.target.querySelectorAll(".variables-view-property")[2]).target,
- cNode.target.querySelectorAll(".variables-view-property")[2],
- "getItemForNode([2]) didn't return the expected property.");
-
-
- is(cNode.find(
- cNode.target.querySelectorAll(".variables-view-property")[0]).target,
- cNode.target.querySelectorAll(".variables-view-property")[0],
- "find([0]) didn't return the expected property.");
-
- is(cNode.find(
- cNode.target.querySelectorAll(".variables-view-property")[1]).target,
- cNode.target.querySelectorAll(".variables-view-property")[1],
- "find([1]) didn't return the expected property.");
-
- is(cNode.find(
- cNode.target.querySelectorAll(".variables-view-property")[2]).target,
- cNode.target.querySelectorAll(".variables-view-property")[2],
- "find([2]) didn't return the expected property.");
-
-
- resumeAndFinish();
- }, 100);
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames.");
-
- closeDebuggerAndFinish();
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-09.js b/browser/devtools/debugger/test/browser_dbg_propertyview-09.js
deleted file mode 100644
index c0f486d36..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-09.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view populates the global scope pane.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- testFrameParameters();
- });
-}
-
-function testFrameParameters()
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the global object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2],
- globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 3,
- "Should have three frames.");
-
- is(globalNodes[1].querySelector(".name").getAttribute("value"), "SpecialPowers",
- "Should have the right property name for |SpecialPowers|.");
-
- is(globalNodes[1].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for |SpecialPowers|.");
-
- let globalScopeObject = gDebugger.DebuggerView.Variables.getScopeForNode(globalScope);
- let documentNode = globalScopeObject.get("document");
-
- is(documentNode.target.querySelector(".name").getAttribute("value"), "document",
- "Should have the right property name for |document|.");
-
- is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
- "Should have the right property value for |document|.");
-
- let len = globalNodes.length - 1;
- is(globalNodes[len].querySelector(".name").getAttribute("value"), "window",
- "Should have the right property name for |window|.");
-
- is(globalNodes[len].querySelector(".value").getAttribute("value"), "[object Window]",
- "Should have the right property value for |window|.");
-
- resumeAndFinish();
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
- Services.tm.currentThread.dispatch({ run: function() {
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames.");
-
- closeDebuggerAndFinish();
- }}, 0);
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-10.js b/browser/devtools/debugger/test/browser_dbg_propertyview-10.js
deleted file mode 100644
index d62a09c4f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-10.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view is correctly populated in |with| frames.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- testWithFrame();
- });
-}
-
-function testWithFrame()
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 4 Debugger:FetchedVariables events, one from the global object
- // scope, two from the |with| scopes and the regular one.
- if (++count < 4) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4],
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes,
- globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 2,
- "Should have three frames.");
-
- is(scopes.childNodes.length, 5, "Should have 5 variable scopes.");
-
- is(innerNodes[1].querySelector(".name").getAttribute("value"), "one",
- "Should have the right property name for |one|.");
-
- is(innerNodes[1].querySelector(".value").getAttribute("value"), "1",
- "Should have the right property value for |one|.");
-
- let globalScopeObject = gDebugger.DebuggerView.Variables.getScopeForNode(globalScope);
- let documentNode = globalScopeObject.get("document");
-
- is(documentNode.target.querySelector(".name").getAttribute("value"), "document",
- "Should have the right property name for |document|.");
-
- is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
- "Should have the right property value for |document|.");
-
- let len = globalNodes.length - 1;
- is(globalNodes[len].querySelector(".name").getAttribute("value"), "window",
- "Should have the right property name for |window|.");
-
- is(globalNodes[len].querySelector(".value").getAttribute("value"), "[object Window]",
- "Should have the right property value for |window|.");
-
- resumeAndFinish();
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
- Services.tm.currentThread.dispatch({ run: function() {
- var frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames.");
-
- closeDebuggerAndFinish();
- }}, 0);
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-11.js b/browser/devtools/debugger/test/browser_dbg_propertyview-11.js
deleted file mode 100644
index 219a98096..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-11.js
+++ /dev/null
@@ -1,241 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly displays WebIDL attributes in DOM
- * objects.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-let gPane = null;
-let gTab = null;
-let gDebugger = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = true;
- testFrameParameters();
- });
-}
-
-function testFrameParameters()
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the global object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let anonymousScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1],
- globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2],
- anonymousNodes = anonymousScope.querySelector(".variables-view-element-details").childNodes,
- globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes,
- gVars = gDebugger.DebuggerView.Variables;
-
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(anonymousNodes[1].querySelector(".name").getAttribute("value"), "button",
- "Should have the right property name for |button|.");
-
- is(anonymousNodes[1].querySelector(".value").getAttribute("value"), "[object HTMLButtonElement]",
- "Should have the right property value for |button|.");
-
- is(anonymousNodes[2].querySelector(".name").getAttribute("value"), "buttonAsProto",
- "Should have the right property name for |buttonAsProto|.");
-
- is(anonymousNodes[2].querySelector(".value").getAttribute("value"), "[object Object]",
- "Should have the right property value for |buttonAsProto|.");
-
- let globalScopeObject = gVars.getScopeForNode(globalScope);
- let documentNode = globalScopeObject.get("document");
-
- is(documentNode.target.querySelector(".name").getAttribute("value"), "document",
- "Should have the right property name for |document|.");
-
- is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
- "Should have the right property value for |document|.");
-
- let buttonNode = gVars.getItemForNode(anonymousNodes[1]);
- let buttonAsProtoNode = gVars.getItemForNode(anonymousNodes[2]);
-
- is(buttonNode.expanded, false,
- "The buttonNode should not be expanded at this point.");
- is(buttonAsProtoNode.expanded, false,
- "The buttonAsProtoNode should not be expanded at this point.");
- is(documentNode.expanded, false,
- "The documentNode should not be expanded at this point.");
-
- // Expand the 'button', 'buttonAsProto' and 'document' tree nodes. This
- // causes their properties to be retrieved and displayed.
- buttonNode.expand();
- buttonAsProtoNode.expand();
- documentNode.expand();
-
- is(buttonNode.expanded, true,
- "The buttonNode should be expanded at this point.");
- is(buttonAsProtoNode.expanded, true,
- "The buttonAsProtoNode should be expanded at this point.");
- is(documentNode.expanded, true,
- "The documentNode should be expanded at this point.");
-
- // Poll every few milliseconds until the properties are retrieved.
- // It's important to set the timer in the chrome window, because the
- // content window timers are disabled while the debuggee is paused.
- let count1 = 0;
- let intervalID = window.setInterval(function(){
- info("count1: " + count1);
- if (++count1 > 50) {
- ok(false, "Timed out while polling for the properties.");
- window.clearInterval(intervalID);
- return resumeAndFinish();
- }
- if (!buttonNode._retrieved ||
- !buttonAsProtoNode._retrieved ||
- !documentNode._retrieved) {
- return;
- }
- window.clearInterval(intervalID);
-
- // Test the prototypes of these objects.
- is(buttonNode.get("__proto__").target.querySelector(".name")
- .getAttribute("value"), "__proto__",
- "Should have the right property name for '__proto__' in buttonNode.");
- ok(buttonNode.get("__proto__").target.querySelector(".value")
- .getAttribute("value").search(/object/) != -1,
- "'__proto__' in buttonNode should be an object.");
-
- is(buttonAsProtoNode.get("__proto__").target.querySelector(".name")
- .getAttribute("value"), "__proto__",
- "Should have the right property name for '__proto__' in buttonAsProtoNode.");
- ok(buttonAsProtoNode.get("__proto__").target.querySelector(".value")
- .getAttribute("value").search(/object/) != -1,
- "'__proto__' in buttonAsProtoNode should be an object.");
-
- is(documentNode.get("__proto__").target.querySelector(".name")
- .getAttribute("value"), "__proto__",
- "Should have the right property name for '__proto__' in documentNode.");
- ok(documentNode.get("__proto__").target.querySelector(".value")
- .getAttribute("value").search(/object/) != -1,
- "'__proto__' in documentNode should be an object.");
-
- // Now the main course: make sure that the native getters for WebIDL
- // attributes have been called and a value has been returned.
- is(buttonNode.get("type").target.querySelector(".name")
- .getAttribute("value"), "type",
- "Should have the right property name for 'type' in buttonProtoNode.");
- is(buttonNode.get("type").target.querySelector(".value")
- .getAttribute("value"), '"submit"',
- "'type' in buttonProtoNode should have the right value.");
- is(buttonNode.get("formMethod").target.querySelector(".name")
- .getAttribute("value"), "formMethod",
- "Should have the right property name for 'formMethod' in buttonProtoNode.");
- is(buttonNode.get("formMethod").target.querySelector(".value")
- .getAttribute("value"), '""',
- "'formMethod' in buttonProtoNode should have the right value.");
-
- is(documentNode.get("domain").target.querySelector(".name")
- .getAttribute("value"), "domain",
- "Should have the right property name for 'domain' in documentProtoNode.");
- is(documentNode.get("domain").target.querySelector(".value")
- .getAttribute("value"), '"example.com"',
- "'domain' in documentProtoNode should have the right value.");
- is(documentNode.get("cookie").target.querySelector(".name")
- .getAttribute("value"), "cookie",
- "Should have the right property name for 'cookie' in documentProtoNode.");
- is(documentNode.get("cookie").target.querySelector(".value")
- .getAttribute("value"), '""',
- "'cookie' in documentProtoNode should have the right value.");
-
- let buttonAsProtoProtoNode = buttonAsProtoNode.get("__proto__");
-
- is(buttonAsProtoProtoNode.expanded, false,
- "The buttonAsProtoProtoNode should not be expanded at this point.");
-
- // Expand the prototypes of 'button', 'buttonAsProto' and 'document'
- // tree nodes. This causes their properties to be retrieved and
- // displayed.
- buttonAsProtoProtoNode.expand();
-
- is(buttonAsProtoProtoNode.expanded, true,
- "The buttonAsProtoProtoNode should be expanded at this point.");
-
-
- // Poll every few milliseconds until the properties are retrieved.
- // It's important to set the timer in the chrome window, because the
- // content window timers are disabled while the debuggee is paused.
- let count2 = 0;
- let intervalID1 = window.setInterval(function(){
- info("count2: " + count2);
- if (++count2 > 50) {
- ok(false, "Timed out while polling for the properties.");
- window.clearInterval(intervalID1);
- return resumeAndFinish();
- }
- if (!buttonAsProtoProtoNode._retrieved) {
- return;
- }
- window.clearInterval(intervalID1);
-
- // Test this more involved case that reuses an object that is
- // present in another cache line.
- is(buttonAsProtoProtoNode.get("type").target.querySelector(".name")
- .getAttribute("value"), "type",
- "Should have the right property name for 'type' in buttonAsProtoProtoProtoNode.");
- is(buttonAsProtoProtoNode.get("type").target.querySelector(".value")
- .getAttribute("value"), '"submit"',
- "'type' in buttonAsProtoProtoProtoNode should have the right value.");
- is(buttonAsProtoProtoNode.get("formMethod").target.querySelector(".name")
- .getAttribute("value"), "formMethod",
- "Should have the right property name for 'formMethod' in buttonAsProtoProtoProtoNode.");
- is(buttonAsProtoProtoNode.get("formMethod").target.querySelector(".value")
- .getAttribute("value"), '""',
- "'formMethod' in buttonAsProtoProtoProtoNode should have the right value.");
-
- resumeAndFinish();
- }, 100);
- }, 100);
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function resumeAndFinish() {
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
- Services.tm.currentThread.dispatch({ run: function() {
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames.");
-
- closeDebuggerAndFinish();
- }}, 0);
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-12.js b/browser/devtools/debugger/test/browser_dbg_propertyview-12.js
deleted file mode 100644
index 192bcfcc9..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-12.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// This test checks that we properly set the frozen, sealed, and non-extensbile
-// attributes on variables so that the F/S/N is shown in the variables view.
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testFSN();
- });
-}
-
-function testFSN() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function _onFetchedVariables() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", _onFetchedVariables, false);
- runTest();
- }, false);
-
- gDebuggee.eval("(" + function () {
- var frozen = Object.freeze({});
- var sealed = Object.seal({});
- var nonExtensible = Object.preventExtensions({});
- var extensible = {};
- var string = "foo bar baz";
-
- debugger;
- } + "())");
-}
-
-function runTest() {
- let hasNoneTester = function (aVariable) {
- ok(!aVariable.hasAttribute("frozen"),
- "The variable should not be frozen");
- ok(!aVariable.hasAttribute("sealed"),
- "The variable should not be sealed");
- ok(!aVariable.hasAttribute("non-extensible"),
- "The variable should be extensible");
- };
-
- let testers = {
- frozen: function (aVariable) {
- ok(aVariable.hasAttribute("frozen"),
- "The variable should be frozen")
- },
- sealed: function (aVariable) {
- ok(aVariable.hasAttribute("sealed"),
- "The variable should be sealed")
- },
- nonExtensible: function (aVariable) {
- ok(aVariable.hasAttribute("non-extensible"),
- "The variable should be non-extensible")
- },
- extensible: hasNoneTester,
- string: hasNoneTester,
- arguments: hasNoneTester,
- this: hasNoneTester
- };
-
- let variables = gDebugger.DebuggerView.Variables._parent
- .querySelectorAll(".variable-or-property");
-
- for (let v of variables) {
- let name = v.querySelector(".name").getAttribute("value");
- let tester = testers[name];
- delete testers[name];
- ok(tester, "We should have a tester for the '" + name + "' variable.");
- tester(v);
- }
-
- is(Object.keys(testers).length, 0,
- "We should have run and removed all the testers.");
-
- closeDebuggerAndFinish();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js
deleted file mode 100644
index 5a4ce4a62..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view remains responsive when faced with
- * huge ammounts of data.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_big-data.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-requestLongerTimeout(10);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- gDebugger.DebuggerView.Variables.lazyAppend = true;
- testWithFrame();
- });
-}
-
-function testWithFrame()
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test1() {
- // We expect 2 Debugger:FetchedVariables events, one from the global object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test1, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[1],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[2],
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes,
- arrayNodes = innerNodes[4].querySelector(".variables-view-element-details").childNodes;
-
- is(innerNodes[3].querySelector(".name").getAttribute("value"), "buffer",
- "Should have the right property name for |buffer|.");
-
- is(innerNodes[3].querySelector(".value").getAttribute("value"), "[object ArrayBuffer]",
- "Should have the right property value for |buffer|.");
-
- is(innerNodes[4].querySelector(".name").getAttribute("value"), "z",
- "Should have the right property name for |z|.");
-
- is(innerNodes[4].querySelector(".value").getAttribute("value"), "[object Int8Array]",
- "Should have the right property value for |z|.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, innerNodes[3].querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, innerNodes[4].querySelector(".arrow"), gDebugger);
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test2() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let total = 10000;
- let loaded = 0;
- let paints = 0;
-
- waitForProperties(total, {
- onLoading: function(count) {
- ok(count >= loaded, "Should have loaded more properties.");
- info("Displayed " + count + " properties, not finished yet.");
- info("Remaining " + (total - count) + " properties to display.");
- loaded = count;
- paints++;
-
- loadScope.hidden = true;
- globalScope.hidden = true;
- scopes.parentNode.scrollTop = scopes.parentNode.scrollHeight;
- },
- onFinished: function(count) {
- ok(count == total, "Displayed all the properties.");
- isnot(paints, 0, "Debugger was unresponsive, sad panda.");
-
- for (let i = 0; i < arrayNodes.length; i++) {
- let node = arrayNodes[i];
- let name = node.querySelector(".name").getAttribute("value");
- // Don't make the test runner dump to the console for every test
- // unless something goes wrong.
- if (name !== i + "") {
- ok(false, "The array items aren't in the correct order.");
- }
- }
-
- closeDebuggerAndFinish();
- }
- });
- }}, 0);
- }, false);
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function waitForProperties(total, callbacks)
-{
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes,
- arrayNodes = innerNodes[4].querySelector(".variables-view-element-details").childNodes;
-
- // Poll every few milliseconds until the properties are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > total) {
- ok(false, "Timed out while polling for the properties.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- // Still need to wait for a few more properties to be fetched.
- if (arrayNodes.length < total) {
- callbacks.onLoading(arrayNodes.length);
- return;
- }
- // We got all the properties, it's safe to callback.
- window.clearInterval(intervalID);
- callbacks.onFinished(arrayNodes.length);
- }, 100);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js
deleted file mode 100644
index b50df0930..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js
+++ /dev/null
@@ -1,352 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view knows how to edit getters and setters.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gVars = null;
-var gWatch = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gVars = gDebugger.DebuggerView.Variables;
- gWatch = gDebugger.DebuggerView.WatchExpressions;
-
- gVars.switch = function() {};
- gVars.delete = function() {};
-
- prepareVariablesView();
- });
-}
-
-function prepareVariablesView() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- testVariablesView();
-
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function testVariablesView()
-{
- executeSoon(function() {
- addWatchExpressions(function() {
- testEdit("set", "this._prop = value + ' BEER CAN'", function() {
- testEdit("set", "{ this._prop = value + ' BEACON' }", function() {
- testEdit("set", "{ this._prop = value + ' BEACON;'; }", function() {
- testEdit("set", "{ return this._prop = value + ' BEACON;;'; }", function() {
- testEdit("set", "function(value) { this._prop = value + ' BACON' }", function() {
- testEdit("get", "'brelx BEER CAN'", function() {
- testEdit("get", "{ 'brelx BEACON' }", function() {
- testEdit("get", "{ 'brelx BEACON;'; }", function() {
- testEdit("get", "{ return 'brelx BEACON;;'; }", function() {
- testEdit("get", "function() { return 'brelx BACON'; }", function() {
- testEdit("get", "bogus", function() {
- testEdit("set", "sugob", function() {
- testEdit("get", "", function() {
- testEdit("set", "", function() {
- waitForWatchExpressions(function() {
- testEdit("self", "2507", function() {
- closeDebuggerAndFinish();
- }, {
- "myVar.prop": 2507,
- "myVar.prop + 42": "250742"
- });
- })
- gWatch.deleteExpression({ name: "myVar.prop = 'xlerb'" });
- }, {
- "myVar.prop": "xlerb",
- "myVar.prop + 42": NaN,
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": undefined,
- "myVar.prop + 42": NaN,
- "myVar.prop = 'xlerb'": "ReferenceError: sugob is not defined"
- });
- }, {
- "myVar.prop": "ReferenceError: bogus is not defined",
- "myVar.prop + 42": "ReferenceError: bogus is not defined",
- "myVar.prop = 'xlerb'": "ReferenceError: sugob is not defined"
- });
- }, {
- "myVar.prop": "ReferenceError: bogus is not defined",
- "myVar.prop + 42": "ReferenceError: bogus is not defined",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "brelx BACON",
- "myVar.prop + 42": "brelx BACON42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "brelx BEACON;;",
- "myVar.prop + 42": "brelx BEACON;;42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": undefined,
- "myVar.prop + 42": NaN,
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": undefined,
- "myVar.prop + 42": NaN,
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "brelx BEER CAN",
- "myVar.prop + 42": "brelx BEER CAN42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "xlerb BACON",
- "myVar.prop + 42": "xlerb BACON42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "xlerb BEACON;;",
- "myVar.prop + 42": "xlerb BEACON;;42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "xlerb BEACON;",
- "myVar.prop + 42": "xlerb BEACON;42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "xlerb BEACON",
- "myVar.prop + 42": "xlerb BEACON42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- }, {
- "myVar.prop": "xlerb BEER CAN",
- "myVar.prop + 42": "xlerb BEER CAN42",
- "myVar.prop = 'xlerb'": "xlerb"
- });
- });
- });
-}
-
-function addWatchExpressions(callback)
-{
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 1, "There should be 1 evaluation availalble");
-
- let w1 = scope.get("myVar.prop");
- let w2 = scope.get("myVar.prop + 42");
- let w3 = scope.get("myVar.prop = 'xlerb'");
-
- ok(w1, "The first watch expression should be present in the scope");
- ok(!w2, "The second watch expression should not be present in the scope");
- ok(!w3, "The third watch expression should not be present in the scope");
-
- is(w1.value, 42, "The first value is correct.");
-
-
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 2, "There should be 2 evaluations availalble");
-
- let w1 = scope.get("myVar.prop");
- let w2 = scope.get("myVar.prop + 42");
- let w3 = scope.get("myVar.prop = 'xlerb'");
-
- ok(w1, "The first watch expression should be present in the scope");
- ok(w2, "The second watch expression should be present in the scope");
- ok(!w3, "The third watch expression should not be present in the scope");
-
- is(w1.value, "42", "The first expression value is correct.");
- is(w2.value, "84", "The second expression value is correct.");
-
-
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 3, "There should be 3 evaluations availalble");
-
- let w1 = scope.get("myVar.prop");
- let w2 = scope.get("myVar.prop + 42");
- let w3 = scope.get("myVar.prop = 'xlerb'");
-
- ok(w1, "The first watch expression should be present in the scope");
- ok(w2, "The second watch expression should be present in the scope");
- ok(w3, "The third watch expression should be present in the scope");
-
- is(w1.value, "xlerb", "The first expression value is correct.");
- is(w2.value, "xlerb42", "The second expression value is correct.");
- is(w3.value, "xlerb", "The third expression value is correct.");
-
- callback();
- });
-
- gWatch.addExpression("myVar.prop = 'xlerb'");
- gDebugger.editor.focus();
- });
-
- gWatch.addExpression("myVar.prop + 42");
- gDebugger.editor.focus();
- });
-
- gWatch.addExpression("myVar.prop");
- gDebugger.editor.focus();
-}
-
-function testEdit(what, string, callback, expected)
-{
- let localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- myVar = gVars.getItemForNode(localNodes[11]);
-
- waitForProperties(function() {
- let prop = myVar.get("prop");
- let getterOrSetter = (what != "self" ? prop.get(what) : prop);
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- getterOrSetter._target.querySelector(".title > .value"),
- gDebugger);
-
- waitForElement(".element-value-input", true, function() {
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- let w1 = scope.get(Object.keys(expected)[0]);
- let w2 = scope.get(Object.keys(expected)[1]);
- let w3 = scope.get(Object.keys(expected)[2]);
-
- if (w1) {
- if (isNaN(expected[w1.name]) && typeof expected[w1.name] == "number") {
- ok(isNaN(w1.value),
- "The first expression value is correct after the edit (NaN).");
- } else if (expected[w1.name] === undefined) {
- is(w1.value.type, "undefined",
- "The first expression value is correct after the edit (undefined).");
- } else {
- is(w1.value, expected[w1.name],
- "The first expression value is correct after the edit.");
- }
- info(w1.value + " is equal to " + expected[w1.name]);
- }
- if (w2) {
- if (isNaN(expected[w2.name]) && typeof expected[w2.name] == "number") {
- ok(isNaN(w2.value),
- "The second expression value is correct after the edit (NaN).");
- } else if (expected[w2.name] === undefined) {
- is(w2.value.type, "undefined",
- "The second expression value is correct after the edit (undefined).");
- } else {
- is(w2.value, expected[w2.name],
- "The second expression value is correct after the edit.");
- }
- info(w2.value + " is equal to " + expected[w2.name]);
- }
- if (w3) {
- if (isNaN(expected[w3.name]) && typeof expected[w3.name] == "number") {
- ok(isNaN(w3.value),
- "The third expression value is correct after the edit (NaN).");
- } else if (expected[w3.name] === undefined) {
- is(w3.value.type, "undefined",
- "The third expression value is correct after the edit (undefined).");
- } else {
- is(w3.value, expected[w3.name],
- "The third expression value is correct after the edit.");
- }
- info(w3.value + " is equal to " + expected[w3.name]);
- }
-
- callback();
- });
-
- info("Changing the " + what + "ter with '" + string + "'.");
-
- write(string);
- EventUtils.sendKey("RETURN", gDebugger);
- });
- });
-
- myVar.expand();
- gVars.clearHierarchy();
-}
-
-function waitForWatchExpressions(callback) {
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() {
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false);
- executeSoon(callback);
- }, false);
-}
-
-function waitForProperties(callback) {
- gDebugger.addEventListener("Debugger:FetchedProperties", function onFetch() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", onFetch, false);
- executeSoon(callback);
- }, false);
-}
-
-function waitForElement(selector, exists, callback)
-{
- // Poll every few milliseconds until the element are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the element.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (!!gVars._list.querySelector(selector) != exists) {
- return;
- }
- // We got the element, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-function write(text) {
- if (!text) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- return;
- }
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gVars = null;
- gWatch = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js
deleted file mode 100644
index 81b0d3b75..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view is able to override getter properties
- * to plain value properties.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gVars = null;
-var gWatch = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gVars = gDebugger.DebuggerView.Variables;
- gWatch = gDebugger.DebuggerView.WatchExpressions;
-
- gVars.switch = function() {};
- gVars.delete = function() {};
-
- prepareVariablesView();
- });
-}
-
-function prepareVariablesView() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- testVariablesView();
-
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function testVariablesView()
-{
- executeSoon(function() {
- addWatchExpressions(function() {
- testEdit("\"xlerb\"", "xlerb", function() {
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-function addWatchExpressions(callback)
-{
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 1, "There should be 1 evaluation availalble");
-
- let expr = scope.get("myVar.prop");
- ok(expr, "The watch expression should be present in the scope");
- is(expr.value, 42, "The value is correct.");
-
- callback();
- });
-
- gWatch.addExpression("myVar.prop");
- gDebugger.editor.focus();
-}
-
-function testEdit(string, expected, callback)
-{
- let localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- myVar = gVars.getItemForNode(localNodes[11]);
-
- waitForProperties(function() {
- let prop = myVar.get("prop");
-
- is(prop.ownerView.name, "myVar",
- "The right owner property name wasn't found.");
- is(prop.name, "prop",
- "The right property name wasn't found.");
-
- is(prop.ownerView.value.type, "object",
- "The right owner property value type wasn't found.");
- is(prop.ownerView.value.class, "Object",
- "The right owner property value class wasn't found.");
-
- is(prop.name, "prop",
- "The right property name wasn't found.");
- is(prop.value, undefined,
- "The right property value wasn't found.");
- ok(prop.getter,
- "The right property getter wasn't found.");
- ok(prop.setter,
- "The right property setter wasn't found.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- prop._target.querySelector(".variables-view-edit"),
- gDebugger);
-
- waitForElement(".element-value-input", true, function() {
- waitForWatchExpressions(function() {
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- let expr = scope.get("myVar.prop");
- is(expr.value, expected, "The value is correct.");
-
- callback();
- });
-
- write(string);
- EventUtils.sendKey("RETURN", gDebugger);
- });
- });
-
- myVar.expand();
- gVars.clearHierarchy();
-}
-
-function waitForWatchExpressions(callback) {
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function onFetch() {
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", onFetch, false);
- executeSoon(callback);
- }, false);
-}
-
-function waitForProperties(callback) {
- gDebugger.addEventListener("Debugger:FetchedProperties", function onFetch() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", onFetch, false);
- executeSoon(callback);
- }, false);
-}
-
-function waitForElement(selector, exists, callback)
-{
- // Poll every few milliseconds until the element are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the element.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (!!gVars._list.querySelector(selector) != exists) {
- return;
- }
- // We got the element, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-function write(text) {
- if (!text) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- return;
- }
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gVars = null;
- gWatch = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-data.js b/browser/devtools/debugger/test/browser_dbg_propertyview-data.js
deleted file mode 100644
index 6cf2c0560..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-data.js
+++ /dev/null
@@ -1,888 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly populates itself.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gVariablesView = null;
-var gScope = null;
-var gVariable = null;
-
-function test()
-{
- debug_tab_pane(TAB1_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gVariablesView = gDebugger.DebuggerView.Variables;
-
- gDebugger.DebuggerView.toggleInstrumentsPane({ visible: true, animated: false });
- testVariablesView();
- });
-}
-
-function testVariablesView()
-{
- let arr = [
- 42,
- true,
- "nasu",
- undefined,
- null,
- [0, 1, 2],
- { prop1: 9, prop2: 8 }
- ];
-
- let obj = {
- "p0": 42,
- "p1": true,
- "p2": "nasu",
- "p3": undefined,
- "p4": null,
- "p5": [3, 4, 5],
- "p6": { prop1: 7, prop2: 6 },
- get p7() { return arr; },
- set p8(value) { arr[0] = value }
- };
-
- let test = {
- someProp0: 42,
- someProp1: true,
- someProp2: "nasu",
- someProp3: undefined,
- someProp4: null,
- someProp5: arr,
- someProp6: obj,
- get someProp7() { return arr; },
- set someProp7(value) { arr[0] = value }
- };
-
- gVariablesView.eval = function() {};
- gVariablesView.switch = function() {};
- gVariablesView.delete = function() {};
- gVariablesView.rawObject = test;
-
- testHierarchy();
- testHeader();
- testFirstLevelContents();
- testSecondLevelContents();
- testThirdLevelContents();
- testIntegrity(arr, obj);
-
- let fooScope = gVariablesView.addScope("foo");
- let anonymousVar = fooScope.addItem();
-
- let anonymousScope = gVariablesView.addScope();
- let barVar = anonymousScope.addItem("bar");
- let bazProperty = barVar.addItem("baz");
-
- testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty);
- testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty);
-
- executeSoon(function() {
- testKeyboardAccessibility(function() {
- testClearHierarchy();
-
- closeDebuggerAndFinish();
- });
- });
-}
-
-function testHierarchy() {
- is(gVariablesView._currHierarchy.size, 13,
- "There should be 1 scope, 1 var, 1 proto, 8 props, 1 getter and 1 setter.");
-
- gScope = gVariablesView._currHierarchy.get("");
- gVariable = gVariablesView._currHierarchy.get("[\"\"]");
-
- is(gVariablesView._store.length, 1,
- "There should be only one scope in the view");
- is(gScope._store.size, 1,
- "There should be only one variable in the scope");
- is(gVariable._store.size, 9,
- "There should be 1 __proto__ and 8 properties in the variable");
-}
-
-function testHeader() {
- is(gScope.header, false,
- "The scope title header should be hidden");
- is(gVariable.header, false,
- "The variable title header should be hidden");
-
- gScope.showHeader();
- gVariable.showHeader();
-
- is(gScope.header, false,
- "The scope title header should still not be visible");
- is(gVariable.header, false,
- "The variable title header should still not be visible");
-
- gScope.hideHeader();
- gVariable.hideHeader();
-
- is(gScope.header, false,
- "The scope title header should now still be hidden");
- is(gVariable.header, false,
- "The variable title header should now still be hidden");
-}
-
-function testFirstLevelContents() {
- let someProp0 = gVariable.get("someProp0");
- let someProp1 = gVariable.get("someProp1");
- let someProp2 = gVariable.get("someProp2");
- let someProp3 = gVariable.get("someProp3");
- let someProp4 = gVariable.get("someProp4");
- let someProp5 = gVariable.get("someProp5");
- let someProp6 = gVariable.get("someProp6");
- let someProp7 = gVariable.get("someProp7");
- let __proto__ = gVariable.get("__proto__");
-
- is(someProp0.visible, true, "The first property visible state is correct.");
- is(someProp1.visible, true, "The second property visible state is correct.");
- is(someProp2.visible, true, "The third property visible state is correct.");
- is(someProp3.visible, true, "The fourth property visible state is correct.");
- is(someProp4.visible, true, "The fifth property visible state is correct.");
- is(someProp5.visible, true, "The sixth property visible state is correct.");
- is(someProp6.visible, true, "The seventh property visible state is correct.");
- is(someProp7.visible, true, "The eight property visible state is correct.");
- is(__proto__.visible, true, "The __proto__ property visible state is correct.");
-
- is(someProp0.expanded, false, "The first property expanded state is correct.");
- is(someProp1.expanded, false, "The second property expanded state is correct.");
- is(someProp2.expanded, false, "The third property expanded state is correct.");
- is(someProp3.expanded, false, "The fourth property expanded state is correct.");
- is(someProp4.expanded, false, "The fifth property expanded state is correct.");
- is(someProp5.expanded, false, "The sixth property expanded state is correct.");
- is(someProp6.expanded, false, "The seventh property expanded state is correct.");
- is(someProp7.expanded, true, "The eight property expanded state is correct.");
- is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
-
- is(someProp0.header, true, "The first property header state is correct.");
- is(someProp1.header, true, "The second property header state is correct.");
- is(someProp2.header, true, "The third property header state is correct.");
- is(someProp3.header, true, "The fourth property header state is correct.");
- is(someProp4.header, true, "The fifth property header state is correct.");
- is(someProp5.header, true, "The sixth property header state is correct.");
- is(someProp6.header, true, "The seventh property header state is correct.");
- is(someProp7.header, true, "The eight property header state is correct.");
- is(__proto__.header, true, "The __proto__ property header state is correct.");
-
- is(someProp0.twisty, false, "The first property twisty state is correct.");
- is(someProp1.twisty, false, "The second property twisty state is correct.");
- is(someProp2.twisty, false, "The third property twisty state is correct.");
- is(someProp3.twisty, false, "The fourth property twisty state is correct.");
- is(someProp4.twisty, false, "The fifth property twisty state is correct.");
- is(someProp5.twisty, true, "The sixth property twisty state is correct.");
- is(someProp6.twisty, true, "The seventh property twisty state is correct.");
- is(someProp7.twisty, true, "The eight property twisty state is correct.");
- is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
-
- is(someProp0.name, "someProp0", "The first property name is correct.");
- is(someProp1.name, "someProp1", "The second property name is correct.");
- is(someProp2.name, "someProp2", "The third property name is correct.");
- is(someProp3.name, "someProp3", "The fourth property name is correct.");
- is(someProp4.name, "someProp4", "The fifth property name is correct.");
- is(someProp5.name, "someProp5", "The sixth property name is correct.");
- is(someProp6.name, "someProp6", "The seventh property name is correct.");
- is(someProp7.name, "someProp7", "The eight property name is correct.");
- is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
-
- is(someProp0.value, 42, "The first property value is correct.");
- is(someProp1.value, true, "The second property value is correct.");
- is(someProp2.value, "nasu", "The third property value is correct.");
- is(someProp3.value.type, "undefined", "The fourth property value is correct.");
- is(someProp4.value.type, "null", "The fifth property value is correct.");
- is(someProp5.value.type, "object", "The sixth property value type is correct.");
- is(someProp5.value.class, "Array", "The sixth property value class is correct.");
- is(someProp6.value.type, "object", "The seventh property value type is correct.");
- is(someProp6.value.class, "Object", "The seventh property value class is correct.");
- is(someProp7.value, null, "The eight property value is correct.");
- isnot(someProp7.getter, null, "The eight property getter is correct.");
- isnot(someProp7.setter, null, "The eight property setter is correct.");
- is(someProp7.getter.type, "object", "The eight property getter type is correct.");
- is(someProp7.getter.class, "Function", "The eight property getter class is correct.");
- is(someProp7.setter.type, "object", "The eight property setter type is correct.");
- is(someProp7.setter.class, "Function", "The eight property setter class is correct.");
- is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
- is(__proto__.value.class, "Object", "The __proto__ property value class is correct.");
-
-
- someProp0.expand();
- someProp1.expand();
- someProp2.expand();
- someProp3.expand();
- someProp4.expand();
- someProp7.expand();
-
- ok(!someProp0.get("__proto__"), "Number primitives should not have a prototype");
- ok(!someProp1.get("__proto__"), "Boolean primitives should not have a prototype");
- ok(!someProp2.get("__proto__"), "String literals should not have a prototype");
- ok(!someProp3.get("__proto__"), "Undefined values should not have a prototype");
- ok(!someProp4.get("__proto__"), "Null values should not have a prototype");
- ok(!someProp7.get("__proto__"), "Getter properties should not have a prototype");
-}
-
-function testSecondLevelContents() {
- let someProp5 = gVariable.get("someProp5");
-
- is(someProp5._store.size, 0, "No properties should be in someProp5 before expanding");
- someProp5.expand();
- is(someProp5._store.size, 9, "Some properties should be in someProp5 before expanding");
-
- let arrayItem0 = someProp5.get("0");
- let arrayItem1 = someProp5.get("1");
- let arrayItem2 = someProp5.get("2");
- let arrayItem3 = someProp5.get("3");
- let arrayItem4 = someProp5.get("4");
- let arrayItem5 = someProp5.get("5");
- let arrayItem6 = someProp5.get("6");
- let __proto__ = someProp5.get("__proto__");
-
- is(arrayItem0.visible, true, "The first array item visible state is correct.");
- is(arrayItem1.visible, true, "The second array item visible state is correct.");
- is(arrayItem2.visible, true, "The third array item visible state is correct.");
- is(arrayItem3.visible, true, "The fourth array item visible state is correct.");
- is(arrayItem4.visible, true, "The fifth array item visible state is correct.");
- is(arrayItem5.visible, true, "The sixth array item visible state is correct.");
- is(arrayItem6.visible, true, "The seventh array item visible state is correct.");
- is(__proto__.visible, true, "The __proto__ property visible state is correct.");
-
- is(arrayItem0.expanded, false, "The first array item expanded state is correct.");
- is(arrayItem1.expanded, false, "The second array item expanded state is correct.");
- is(arrayItem2.expanded, false, "The third array item expanded state is correct.");
- is(arrayItem3.expanded, false, "The fourth array item expanded state is correct.");
- is(arrayItem4.expanded, false, "The fifth array item expanded state is correct.");
- is(arrayItem5.expanded, false, "The sixth array item expanded state is correct.");
- is(arrayItem6.expanded, false, "The seventh array item expanded state is correct.");
- is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
-
- is(arrayItem0.header, true, "The first array item header state is correct.");
- is(arrayItem1.header, true, "The second array item header state is correct.");
- is(arrayItem2.header, true, "The third array item header state is correct.");
- is(arrayItem3.header, true, "The fourth array item header state is correct.");
- is(arrayItem4.header, true, "The fifth array item header state is correct.");
- is(arrayItem5.header, true, "The sixth array item header state is correct.");
- is(arrayItem6.header, true, "The seventh array item header state is correct.");
- is(__proto__.header, true, "The __proto__ property header state is correct.");
-
- is(arrayItem0.twisty, false, "The first array item twisty state is correct.");
- is(arrayItem1.twisty, false, "The second array item twisty state is correct.");
- is(arrayItem2.twisty, false, "The third array item twisty state is correct.");
- is(arrayItem3.twisty, false, "The fourth array item twisty state is correct.");
- is(arrayItem4.twisty, false, "The fifth array item twisty state is correct.");
- is(arrayItem5.twisty, true, "The sixth array item twisty state is correct.");
- is(arrayItem6.twisty, true, "The seventh array item twisty state is correct.");
- is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
-
- is(arrayItem0.name, "0", "The first array item name is correct.");
- is(arrayItem1.name, "1", "The second array item name is correct.");
- is(arrayItem2.name, "2", "The third array item name is correct.");
- is(arrayItem3.name, "3", "The fourth array item name is correct.");
- is(arrayItem4.name, "4", "The fifth array item name is correct.");
- is(arrayItem5.name, "5", "The sixth array item name is correct.");
- is(arrayItem6.name, "6", "The seventh array item name is correct.");
- is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
-
- is(arrayItem0.value, 42, "The first array item value is correct.");
- is(arrayItem1.value, true, "The second array item value is correct.");
- is(arrayItem2.value, "nasu", "The third array item value is correct.");
- is(arrayItem3.value.type, "undefined", "The fourth array item value is correct.");
- is(arrayItem4.value.type, "null", "The fifth array item value is correct.");
- is(arrayItem5.value.type, "object", "The sixth array item value type is correct.");
- is(arrayItem5.value.class, "Array", "The sixth array item value class is correct.");
- is(arrayItem6.value.type, "object", "The seventh array item value type is correct.");
- is(arrayItem6.value.class, "Object", "The seventh array item value class is correct.");
- is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
- is(__proto__.value.class, "Array", "The __proto__ property value class is correct.");
-
-
- let someProp6 = gVariable.get("someProp6");
-
- is(someProp6._store.size, 0, "No properties should be in someProp6 before expanding");
- someProp6.expand();
- is(someProp6._store.size, 10, "Some properties should be in someProp6 before expanding");
-
- let objectItem0 = someProp6.get("p0");
- let objectItem1 = someProp6.get("p1");
- let objectItem2 = someProp6.get("p2");
- let objectItem3 = someProp6.get("p3");
- let objectItem4 = someProp6.get("p4");
- let objectItem5 = someProp6.get("p5");
- let objectItem6 = someProp6.get("p6");
- let objectItem7 = someProp6.get("p7");
- let objectItem8 = someProp6.get("p8");
- let __proto__ = someProp6.get("__proto__");
-
- is(objectItem0.visible, true, "The first object item visible state is correct.");
- is(objectItem1.visible, true, "The second object item visible state is correct.");
- is(objectItem2.visible, true, "The third object item visible state is correct.");
- is(objectItem3.visible, true, "The fourth object item visible state is correct.");
- is(objectItem4.visible, true, "The fifth object item visible state is correct.");
- is(objectItem5.visible, true, "The sixth object item visible state is correct.");
- is(objectItem6.visible, true, "The seventh object item visible state is correct.");
- is(objectItem7.visible, true, "The eight object item visible state is correct.");
- is(objectItem8.visible, true, "The ninth object item visible state is correct.");
- is(__proto__.visible, true, "The __proto__ property visible state is correct.");
-
- is(objectItem0.expanded, false, "The first object item expanded state is correct.");
- is(objectItem1.expanded, false, "The second object item expanded state is correct.");
- is(objectItem2.expanded, false, "The third object item expanded state is correct.");
- is(objectItem3.expanded, false, "The fourth object item expanded state is correct.");
- is(objectItem4.expanded, false, "The fifth object item expanded state is correct.");
- is(objectItem5.expanded, false, "The sixth object item expanded state is correct.");
- is(objectItem6.expanded, false, "The seventh object item expanded state is correct.");
- is(objectItem7.expanded, true, "The eight object item expanded state is correct.");
- is(objectItem8.expanded, true, "The ninth object item expanded state is correct.");
- is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
-
- is(objectItem0.header, true, "The first object item header state is correct.");
- is(objectItem1.header, true, "The second object item header state is correct.");
- is(objectItem2.header, true, "The third object item header state is correct.");
- is(objectItem3.header, true, "The fourth object item header state is correct.");
- is(objectItem4.header, true, "The fifth object item header state is correct.");
- is(objectItem5.header, true, "The sixth object item header state is correct.");
- is(objectItem6.header, true, "The seventh object item header state is correct.");
- is(objectItem7.header, true, "The eight object item header state is correct.");
- is(objectItem8.header, true, "The ninth object item header state is correct.");
- is(__proto__.header, true, "The __proto__ property header state is correct.");
-
- is(objectItem0.twisty, false, "The first object item twisty state is correct.");
- is(objectItem1.twisty, false, "The second object item twisty state is correct.");
- is(objectItem2.twisty, false, "The third object item twisty state is correct.");
- is(objectItem3.twisty, false, "The fourth object item twisty state is correct.");
- is(objectItem4.twisty, false, "The fifth object item twisty state is correct.");
- is(objectItem5.twisty, true, "The sixth object item twisty state is correct.");
- is(objectItem6.twisty, true, "The seventh object item twisty state is correct.");
- is(objectItem7.twisty, true, "The eight object item twisty state is correct.");
- is(objectItem8.twisty, true, "The ninth object item twisty state is correct.");
- is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
-
- is(objectItem0.name, "p0", "The first object item name is correct.");
- is(objectItem1.name, "p1", "The second object item name is correct.");
- is(objectItem2.name, "p2", "The third object item name is correct.");
- is(objectItem3.name, "p3", "The fourth object item name is correct.");
- is(objectItem4.name, "p4", "The fifth object item name is correct.");
- is(objectItem5.name, "p5", "The sixth object item name is correct.");
- is(objectItem6.name, "p6", "The seventh object item name is correct.");
- is(objectItem7.name, "p7", "The eight seventh object item name is correct.");
- is(objectItem8.name, "p8", "The ninth seventh object item name is correct.");
- is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
-
- is(objectItem0.value, 42, "The first object item value is correct.");
- is(objectItem1.value, true, "The second object item value is correct.");
- is(objectItem2.value, "nasu", "The third object item value is correct.");
- is(objectItem3.value.type, "undefined", "The fourth object item value is correct.");
- is(objectItem4.value.type, "null", "The fifth object item value is correct.");
- is(objectItem5.value.type, "object", "The sixth object item value type is correct.");
- is(objectItem5.value.class, "Array", "The sixth object item value class is correct.");
- is(objectItem6.value.type, "object", "The seventh object item value type is correct.");
- is(objectItem6.value.class, "Object", "The seventh object item value class is correct.");
- is(objectItem7.value, null, "The eight object item value is correct.");
- isnot(objectItem7.getter, null, "The eight object item getter is correct.");
- isnot(objectItem7.setter, null, "The eight object item setter is correct.");
- is(objectItem7.setter.type, "undefined", "The eight object item setter type is correct.");
- is(objectItem7.getter.type, "object", "The eight object item getter type is correct.");
- is(objectItem7.getter.class, "Function", "The eight object item getter class is correct.");
- is(objectItem8.value, null, "The ninth object item value is correct.");
- isnot(objectItem8.getter, null, "The ninth object item getter is correct.");
- isnot(objectItem8.setter, null, "The ninth object item setter is correct.");
- is(objectItem8.getter.type, "undefined", "The eight object item getter type is correct.");
- is(objectItem8.setter.type, "object", "The ninth object item setter type is correct.");
- is(objectItem8.setter.class, "Function", "The ninth object item setter class is correct.");
- is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
- is(__proto__.value.class, "Object", "The __proto__ property value class is correct.");
-}
-
-function testThirdLevelContents() {
- (function() {
- let someProp5 = gVariable.get("someProp5");
- let arrayItem5 = someProp5.get("5");
- let arrayItem6 = someProp5.get("6");
-
- is(arrayItem5._store.size, 0, "No properties should be in arrayItem5 before expanding");
- arrayItem5.expand();
- is(arrayItem5._store.size, 5, "Some properties should be in arrayItem5 before expanding");
-
- is(arrayItem6._store.size, 0, "No properties should be in arrayItem6 before expanding");
- arrayItem6.expand();
- is(arrayItem6._store.size, 3, "Some properties should be in arrayItem6 before expanding");
-
- let arraySubItem0 = arrayItem5.get("0");
- let arraySubItem1 = arrayItem5.get("1");
- let arraySubItem2 = arrayItem5.get("2");
- let objectSubItem0 = arrayItem6.get("prop1");
- let objectSubItem1 = arrayItem6.get("prop2");
-
- is(arraySubItem0.value, 0, "The first array sub-item value is correct.");
- is(arraySubItem1.value, 1, "The second array sub-item value is correct.");
- is(arraySubItem2.value, 2, "The third array sub-item value is correct.");
-
- is(objectSubItem0.value, 9, "The first object sub-item value is correct.");
- is(objectSubItem1.value, 8, "The second object sub-item value is correct.");
-
- let array__proto__ = arrayItem5.get("__proto__");
- let object__proto__ = arrayItem6.get("__proto__");
-
- ok(array__proto__, "The array should have a __proto__ property");
- ok(object__proto__, "The object should have a __proto__ property");
- })();
-
- (function() {
- let someProp6 = gVariable.get("someProp6");
- let objectItem5 = someProp6.get("p5");
- let objectItem6 = someProp6.get("p6");
-
- is(objectItem5._store.size, 0, "No properties should be in objectItem5 before expanding");
- objectItem5.expand();
- is(objectItem5._store.size, 5, "Some properties should be in objectItem5 before expanding");
-
- is(objectItem6._store.size, 0, "No properties should be in objectItem6 before expanding");
- objectItem6.expand();
- is(objectItem6._store.size, 3, "Some properties should be in objectItem6 before expanding");
-
- let arraySubItem0 = objectItem5.get("0");
- let arraySubItem1 = objectItem5.get("1");
- let arraySubItem2 = objectItem5.get("2");
- let objectSubItem0 = objectItem6.get("prop1");
- let objectSubItem1 = objectItem6.get("prop2");
-
- is(arraySubItem0.value, 3, "The first array sub-item value is correct.");
- is(arraySubItem1.value, 4, "The second array sub-item value is correct.");
- is(arraySubItem2.value, 5, "The third array sub-item value is correct.");
-
- is(objectSubItem0.value, 7, "The first object sub-item value is correct.");
- is(objectSubItem1.value, 6, "The second object sub-item value is correct.");
-
- let array__proto__ = objectItem5.get("__proto__");
- let object__proto__ = objectItem6.get("__proto__");
-
- ok(array__proto__, "The array should have a __proto__ property");
- ok(object__proto__, "The object should have a __proto__ property");
- })();
-}
-
-function testIntegrity(arr, obj) {
- is(arr[0], 42, "The first array item should not have changed");
- is(arr[1], true, "The second array item should not have changed");
- is(arr[2], "nasu", "The third array item should not have changed");
- is(arr[3], undefined, "The fourth array item should not have changed");
- is(arr[4], null, "The fifth array item should not have changed");
- ok(arr[5] instanceof Array, "The sixth array item should be an Array");
- is(arr[5][0], 0, "The sixth array item should not have changed");
- is(arr[5][1], 1, "The sixth array item should not have changed");
- is(arr[5][2], 2, "The sixth array item should not have changed");
- ok(arr[6] instanceof Object, "The seventh array item should be an Object");
- is(arr[6].prop1, 9, "The seventh array item should not have changed");
- is(arr[6].prop2, 8, "The seventh array item should not have changed");
-
- is(obj.p0, 42, "The first object property should not have changed");
- is(obj.p1, true, "The first object property should not have changed");
- is(obj.p2, "nasu", "The first object property should not have changed");
- is(obj.p3, undefined, "The first object property should not have changed");
- is(obj.p4, null, "The first object property should not have changed");
- ok(obj.p5 instanceof Array, "The sixth object property should be an Array");
- is(obj.p5[0], 3, "The sixth object property should not have changed");
- is(obj.p5[1], 4, "The sixth object property should not have changed");
- is(obj.p5[2], 5, "The sixth object property should not have changed");
- ok(obj.p6 instanceof Object, "The seventh object property should be an Object");
- is(obj.p6.prop1, 7, "The seventh object property should not have changed");
- is(obj.p6.prop2, 6, "The seventh object property should not have changed");
-}
-
-function testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) {
- is(fooScope.header, true,
- "A named scope should have a header visible.");
- is(fooScope.target.hasAttribute("non-header"), false,
- "The non-header attribute should not be applied to scopes with headers.");
-
- is(anonymousScope.header, false,
- "An anonymous scope should have a header visible.");
- is(anonymousScope.target.hasAttribute("non-header"), true,
- "The non-header attribute should not be applied to scopes without headers.");
-
- is(barVar.header, true,
- "A named variable should have a header visible.");
- is(barVar.target.hasAttribute("non-header"), false,
- "The non-header attribute should not be applied to variables with headers.");
-
- is(anonymousVar.header, false,
- "An anonymous variable should have a header visible.");
- is(anonymousVar.target.hasAttribute("non-header"), true,
- "The non-header attribute should not be applied to variables without headers.");
-}
-
-function testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) {
- is(fooScope.editableValueTooltip, gVariablesView.editableValueTooltip,
- "The editableValueTooltip property should persist from the view to all scopes.");
- is(fooScope.editableNameTooltip, gVariablesView.editableNameTooltip,
- "The editableNameTooltip property should persist from the view to all scopes.");
- is(fooScope.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
- "The deleteButtonTooltip property should persist from the view to all scopes.");
- is(fooScope.descriptorTooltip, gVariablesView.descriptorTooltip,
- "The descriptorTooltip property should persist from the view to all scopes.");
- is(fooScope.contextMenuId, gVariablesView.contextMenuId,
- "The contextMenuId property should persist from the view to all scopes.");
- is(fooScope.separatorStr, gVariablesView.separatorStr,
- "The separatorStr property should persist from the view to all scopes.");
- is(fooScope.eval, gVariablesView.eval,
- "The eval property should persist from the view to all scopes.");
- is(fooScope.switch, gVariablesView.switch,
- "The switch property should persist from the view to all scopes.");
- is(fooScope.delete, gVariablesView.delete,
- "The delete property should persist from the view to all scopes.");
- isnot(fooScope.eval, fooScope.switch,
- "The eval and switch functions got mixed up in the scope.");
- isnot(fooScope.switch, fooScope.delete,
- "The eval and switch functions got mixed up in the scope.");
-
- is(barVar.editableValueTooltip, gVariablesView.editableValueTooltip,
- "The editableValueTooltip property should persist from the view to all variables.");
- is(barVar.editableNameTooltip, gVariablesView.editableNameTooltip,
- "The editableNameTooltip property should persist from the view to all variables.");
- is(barVar.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
- "The deleteButtonTooltip property should persist from the view to all variables.");
- is(barVar.descriptorTooltip, gVariablesView.descriptorTooltip,
- "The descriptorTooltip property should persist from the view to all variables.");
- is(barVar.contextMenuId, gVariablesView.contextMenuId,
- "The contextMenuId property should persist from the view to all variables.");
- is(barVar.separatorStr, gVariablesView.separatorStr,
- "The separatorStr property should persist from the view to all variables.");
- is(barVar.eval, gVariablesView.eval,
- "The eval property should persist from the view to all variables.");
- is(barVar.switch, gVariablesView.switch,
- "The switch property should persist from the view to all variables.");
- is(barVar.delete, gVariablesView.delete,
- "The delete property should persist from the view to all variables.");
- isnot(barVar.eval, barVar.switch,
- "The eval and switch functions got mixed up in the variable.");
- isnot(barVar.switch, barVar.delete,
- "The eval and switch functions got mixed up in the variable.");
-
- is(bazProperty.editableValueTooltip, gVariablesView.editableValueTooltip,
- "The editableValueTooltip property should persist from the view to all properties.");
- is(bazProperty.editableNameTooltip, gVariablesView.editableNameTooltip,
- "The editableNameTooltip property should persist from the view to all properties.");
- is(bazProperty.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
- "The deleteButtonTooltip property should persist from the view to all properties.");
- is(bazProperty.descriptorTooltip, gVariablesView.descriptorTooltip,
- "The descriptorTooltip property should persist from the view to all properties.");
- is(bazProperty.contextMenuId, gVariablesView.contextMenuId,
- "The contextMenuId property should persist from the view to all properties.");
- is(bazProperty.separatorStr, gVariablesView.separatorStr,
- "The separatorStr property should persist from the view to all properties.");
- is(bazProperty.eval, gVariablesView.eval,
- "The eval property should persist from the view to all properties.");
- is(bazProperty.switch, gVariablesView.switch,
- "The switch property should persist from the view to all properties.");
- is(bazProperty.delete, gVariablesView.delete,
- "The delete property should persist from the view to all properties.");
- isnot(bazProperty.eval, bazProperty.switch,
- "The eval and switch functions got mixed up in the property.");
- isnot(bazProperty.switch, bazProperty.delete,
- "The eval and switch functions got mixed up in the property.");
-}
-
-function testKeyboardAccessibility(callback) {
- gDebugger.DebuggerView.Filtering._doVariablesFocus();
- gDebugger.DebuggerView.Variables.pageSize = 5;
-
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should be focused.");
-
- gVariablesView.focusNextItem();
- is(gVariablesView.getFocusedItem().name, "someProp1",
- "The someProp1 item should be focused.");
-
- gVariablesView.focusPrevItem();
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should be focused again.");
-
-
- ok(!gVariablesView._list.querySelector(".element-value-input"),
- "There shouldn't be a value input element created.");
-
- EventUtils.synthesizeKey("VK_ENTER", {}, gDebugger);
- waitForElement(".element-value-input", true, function() {
-
- ok(gVariablesView._list.querySelector(".element-value-input"),
- "There should be a value input element created.");
-
- EventUtils.sendKey("ESCAPE", gDebugger);
- waitForElement(".element-value-input", false, function() {
-
- ok(!gVariablesView._list.querySelector(".element-value-input"),
- "There shouldn't be a value input element anymore.");
-
- ok(!gVariablesView._list.querySelector(".element-name-input"),
- "There shouldn't be a name input element created.");
-
- EventUtils.synthesizeKey("VK_ENTER", { shiftKey: true }, gDebugger);
- waitForElement(".element-name-input", true, function() {
-
- ok(gVariablesView._list.querySelector(".element-name-input"),
- "There should be a name input element created.");
-
- EventUtils.sendKey("ESCAPE", gDebugger);
- waitForElement(".element-name-input", false, function() {
-
- ok(!gVariablesView._list.querySelector(".element-name-input"),
- "There shouldn't be a name input element anymore.");
-
-
- EventUtils.sendKey("DOWN", gDebugger);
- executeSoon(function() {
- is(gVariablesView._parent.scrollTop, 0,
- "The variables view shouldn't scroll when pressing the DOWN key.");
-
- EventUtils.sendKey("UP", gDebugger);
- executeSoon(function() {
- is(gVariablesView._parent.scrollTop, 0,
- "The variables view shouldn't scroll when pressing the UP key.");
-
- EventUtils.sendKey("PAGE_DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp5",
- "The someProp5 item should be focused now.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "0",
- "The 0 item should be focused now.");
-
- EventUtils.sendKey("END", gDebugger);
- is(gVariablesView.getFocusedItem().name, "bar",
- "The bar item should be focused now.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "bar",
- "The bar item should still be focused now.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo item should be focused now.");
-
- EventUtils.sendKey("RIGHT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo item should still be focused now.");
-
- EventUtils.sendKey("PAGE_DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "bar",
- "The bar item should be focused now.");
-
- EventUtils.sendKey("PAGE_UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp7",
- "The someProp7 item should be focused now.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The __proto__ item should be focused now.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "set",
- "The set item should be focused now.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "get",
- "The get item should be focused now.");
-
- EventUtils.sendKey("HOME", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should be focused now.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should still be focused now.");
-
- EventUtils.sendKey("LEFT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should still be focused now.");
-
- EventUtils.sendKey("PAGE_UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should still be focused now.");
-
- for (let i = 0; i < 16; i++) {
- // Advance to the first collapsed __proto__ property.
- EventUtils.sendKey("DOWN", gDebugger);
- }
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The __proto__ item should be focused now.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The __proto__ item shouldn't be expanded yet.");
-
- EventUtils.sendKey("RIGHT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The __proto__ item should still be focused.");
- is(gVariablesView.getFocusedItem().expanded, true,
- "The __proto__ item should be expanded now.");
-
- for (let i = 0; i < 3; i++) {
- // Advance to the fifth top-level someProp5 property.
- EventUtils.sendKey("LEFT", gDebugger);
- }
- is(gVariablesView.getFocusedItem().name, "5",
- "The fifth array item should be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The fifth array item should not be expanded now.");
-
- for (let i = 0; i < 6; i++) {
- // Advance to the fifth top-level someProp5 property.
- EventUtils.sendKey("UP", gDebugger);
- }
- is(gVariablesView.getFocusedItem().name, "someProp5",
- "The someProp5 item should be focused now.");
- is(gVariablesView.getFocusedItem().expanded, true,
- "The someProp5 item should already be expanded.");
-
- EventUtils.sendKey("LEFT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp5",
- "The someProp5 item should still be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The someProp5 item should not be expanded now.");
-
- EventUtils.sendKey("LEFT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp5",
- "The someProp5 item should still be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp4",
- "The someProp4 item should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp3",
- "The someProp3 item should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp2",
- "The someProp2 item should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp1",
- "The someProp1 item should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "someProp0",
- "The someProp0 item should still be focused.");
-
- for (let i = 0; i < 32; i++) {
- // Advance to the last property in this scope.
- EventUtils.sendKey("DOWN", gDebugger);
- }
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The top-level __proto__ item should be focused.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo scope should be focused now.");
- is(gVariablesView.getFocusedItem().expanded, true,
- "The foo scope should already be expanded.");
-
- EventUtils.sendKey("LEFT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo scope should be focused now.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The foo scope shouldn't be expanded now.");
-
- EventUtils.sendKey("DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "bar",
- "The bar variable should be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The bar variable shouldn't be expanded.");
- is(gVariablesView.getFocusedItem().visible, true,
- "The bar variable shouldn't be hidden.");
-
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- is(gVariablesView.getFocusedItem().name, "bar",
- "The bar variable should still be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The bar variable should still not be expanded.");
- is(gVariablesView.getFocusedItem().visible, false,
- "The bar variable should be hidden.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo scope should be focused.");
-
- EventUtils.sendKey("UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The top-level __proto__ item should be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The top-level __proto__ item should not be expanded.");
-
- EventUtils.sendKey("RIGHT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The top-level __proto__ item should still be focused.");
- is(gVariablesView.getFocusedItem().expanded, true,
- "The top-level __proto__ item should be expanded.");
-
- EventUtils.sendKey("LEFT", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The top-level __proto__ item should still be focused.");
- is(gVariablesView.getFocusedItem().expanded, false,
- "The top-level __proto__ item should not be expanded.");
-
- EventUtils.sendKey("END", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo scope should be focused.");
-
- EventUtils.sendKey("PAGE_UP", gDebugger);
- is(gVariablesView.getFocusedItem().name, "__proto__",
- "The __proto__ property should be focused.");
-
- EventUtils.sendKey("PAGE_DOWN", gDebugger);
- is(gVariablesView.getFocusedItem().name, "foo",
- "The foo scope should be focused.");
-
- executeSoon(callback);
- });
- });
- });
- });
- });
- });
-}
-
-function waitForElement(selector, exists, callback)
-{
- // Poll every few milliseconds until the element are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the element.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (!!gVariablesView._list.querySelector(selector) != exists) {
- return;
- }
- // We got the element, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-function testClearHierarchy() {
- gVariablesView.clearHierarchy();
- ok(!gVariablesView._prevHierarchy.size,
- "The previous hierarchy should have been cleared.");
- ok(!gVariablesView._currHierarchy.size,
- "The current hierarchy should have been cleared.");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gVariablesView = null;
- gScope = null;
- gVariable = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js b/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js
deleted file mode 100644
index 6dba43421..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * Make sure that the editing variables or properties values works properly.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-requestLongerTimeout(3);
-
-function test() {
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- testFrameEval();
- });
-}
-
-function testFrameEval() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"),
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- varA = localNodes[7];
-
- is(varA.querySelector(".name").getAttribute("value"), "a",
- "Should have the right name for 'a'.");
-
- is(varA.querySelector(".value").getAttribute("value"), 1,
- "Should have the right initial value for 'a'.");
-
- testModification(varA, function(aVar) {
- testModification(aVar, function(aVar) {
- testModification(aVar, function(aVar) {
- resumeAndFinish();
- }, "document.title", '"Debugger Function Call Parameter Test"');
- }, "b", "[object Object]");
- }, "{ a: 1 }", "[object Object]");
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.querySelector("button"),
- content.window);
-}
-
-function testModification(aVar, aCallback, aNewValue, aNewResult) {
- function makeChangesAndExitInputMode() {
- EventUtils.sendString(aNewValue, gDebugger);
- EventUtils.sendKey("RETURN", gDebugger);
- }
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- aVar.querySelector(".value"),
- gDebugger);
-
- executeSoon(function() {
- ok(aVar.querySelector(".element-value-input"),
- "There should be an input element created.");
-
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the global
- // object scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- // Get the variable reference anew, since the old ones were discarded when
- // we resumed.
- var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".variables-view-scope"),
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- varA = localNodes[7];
-
- is(varA.querySelector(".value").getAttribute("value"), aNewResult,
- "Should have the right value for 'a'.");
-
- executeSoon(function() {
- aCallback(varA);
- });
- }, false);
-
- makeChangesAndExitInputMode();
- });
-}
-
-function resumeAndFinish() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js b/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js
deleted file mode 100644
index 231b3a83a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js
+++ /dev/null
@@ -1,514 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * Make sure that the editing or removing watch expressions works properly.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_watch-expressions.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gWatch = null;
-var gVars = null;
-
-requestLongerTimeout(3);
-
-function test() {
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gWatch = gDebugger.DebuggerView.WatchExpressions;
- gVars = gDebugger.DebuggerView.Variables;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- testFrameEval();
- });
-}
-
-function testFrameEval() {
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function test() {
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[1],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- aArg = localNodes[1],
- varT = localNodes[3];
-
- is(aArg.querySelector(".name").getAttribute("value"), "aArg",
- "Should have the right name for 'aArg'.");
- is(varT.querySelector(".name").getAttribute("value"), "t",
- "Should have the right name for 't'.");
-
- is(aArg.querySelector(".value").getAttribute("value"), "undefined",
- "Should have the right initial value for 'aArg'.");
- is(varT.querySelector(".value").getAttribute("value"), "\"Browser Debugger Watch Expressions Test\"",
- "Should have the right initial value for 't'.");
-
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
- "There should be 5 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 5, "There should be 5 evaluations availalble");
-
- is(scope.get("this")._isContentVisible, true,
- "Should have the right visibility state for 'this'.");
- is(scope.get("this").target.querySelectorAll(".variables-view-delete").length, 1,
- "Should have the one close button visible for 'this'.");
- is(scope.get("this").name, "this",
- "Should have the right name for 'this'.");
- is(scope.get("this").value.type, "object",
- "Should have the right value type for 'this'.");
- is(scope.get("this").value.class, "Window",
- "Should have the right value type for 'this'.");
-
- is(scope.get("ermahgerd")._isContentVisible, true,
- "Should have the right visibility state for 'ermahgerd'.");
- is(scope.get("ermahgerd").target.querySelectorAll(".variables-view-delete").length, 1,
- "Should have the one close button visible for 'ermahgerd'.");
- is(scope.get("ermahgerd").name, "ermahgerd",
- "Should have the right name for 'ermahgerd'.");
- is(scope.get("ermahgerd").value.type, "object",
- "Should have the right value type for 'ermahgerd'.");
- is(scope.get("ermahgerd").value.class, "Function",
- "Should have the right value type for 'ermahgerd'.");
-
- is(scope.get("aArg")._isContentVisible, true,
- "Should have the right visibility state for 'aArg'.");
- is(scope.get("aArg").target.querySelectorAll(".variables-view-delete").length, 1,
- "Should have the one close button visible for 'aArg'.");
- is(scope.get("aArg").name, "aArg",
- "Should have the right name for 'aArg'.");
- is(scope.get("aArg").value.type, "undefined",
- "Should have the right value for 'aArg'.");
- is(scope.get("aArg").value.class, undefined,
- "Should have the right value for 'aArg'.");
-
- is(scope.get("document.title")._isContentVisible, true,
- "Should have the right visibility state for 'document.title'.");
- is(scope.get("document.title").target.querySelectorAll(".variables-view-delete").length, 1,
- "Should have the one close button visible for 'document.title'.");
- is(scope.get("document.title").name, "document.title",
- "Should have the right name for 'document.title'.");
- is(scope.get("document.title").value, "42",
- "Should have the right value for 'document.title'.");
- is(typeof scope.get("document.title").value, "string",
- "Should have the right value type for 'document.title'.");
-
- is(scope.get("document.title = 42")._isContentVisible, true,
- "Should have the right visibility state for 'document.title = 42'.");
- is(scope.get("document.title = 42").target.querySelectorAll(".variables-view-delete").length, 1,
- "Should have the one close button visible for 'document.title = 42'.");
- is(scope.get("document.title = 42").name, "document.title = 42",
- "Should have the right name for 'document.title = 42'.");
- is(scope.get("document.title = 42").value, 42,
- "Should have the right value for 'document.title = 42'.");
- is(typeof scope.get("document.title = 42").value, "number",
- "Should have the right value type for 'document.title = 42'.");
-
- testModification(scope.get("document.title = 42").target, test1, function(scope) {
- testModification(scope.get("aArg").target, test2, function(scope) {
- testModification(scope.get("aArg = 44").target, test3, function(scope) {
- testModification(scope.get("document.title = 43").target, test4, function(scope) {
- testModification(scope.get("document.title").target, test5, function(scope) {
- testExprDeletion(scope.get("this").target, test6, function(scope) {
- testExprDeletion(null, test7, function(scope) {
- resumeAndFinish();
- }, 44, 0, true, true);
- }, 44);
- }, " \t\r\n", "\"43\"", 44, 1, true);
- }, " \t\r\ndocument.title \t\r\n", "\"43\"", 44);
- }, " \t\r\ndocument.title \t\r\n", "\"43\"", 44);
- }, "aArg = 44", 44, 44);
- }, "document.title = 43", 43, "undefined");
- }}, 0);
- }, false);
-
- addWatchExpression("this");
- addWatchExpression("ermahgerd");
- addWatchExpression("aArg");
- addWatchExpression("document.title");
- addCmdWatchExpression("document.title = 42");
-
- executeSoon(function() {
- gDebuggee.ermahgerd(); // ermahgerd!!
- });
-}
-
-function testModification(aVar, aTest, aCallback, aNewValue, aNewResult, aArgResult,
- aLocalScopeIndex = 1, aDeletionFlag = null)
-{
- function makeChangesAndExitInputMode() {
- EventUtils.sendString(aNewValue, gDebugger);
- EventUtils.sendKey("RETURN", gDebugger);
- }
-
- EventUtils.sendMouseEvent({ type: "dblclick" },
- aVar.querySelector(".name"),
- gDebugger);
-
- executeSoon(function() {
- ok(aVar.querySelector(".element-name-input"),
- "There should be an input element created.");
-
- let testContinued = false;
- let fetchedVariables = false;
- let fetchedExpressions = false;
-
- let countV = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function testV() {
- // We expect 2 Debugger:FetchedVariables events, one from the global
- // object scope and the regular one.
- if (++countV < 2) {
- info("Number of received Debugger:FetchedVariables events: " + countV);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", testV, false);
- fetchedVariables = true;
- executeSoon(continueTest);
- }, false);
-
- let countE = 0;
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function testE() {
- // We expect only one Debugger:FetchedWatchExpressions event, since all
- // expressions are evaluated at the same time.
- if (++countE < 1) {
- info("Number of received Debugger:FetchedWatchExpressions events: " + countE);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", testE, false);
- fetchedExpressions = true;
- executeSoon(continueTest);
- }, false);
-
- function continueTest() {
- if (testContinued || !fetchedVariables || !fetchedExpressions) {
- return;
- }
- testContinued = true;
-
- // Get the variable reference anew, since the old ones were discarded when
- // we resumed.
- var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[aLocalScopeIndex],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- aArg = localNodes[1];
-
- is(aArg.querySelector(".value").getAttribute("value"), aArgResult,
- "Should have the right value for 'aArg'.");
-
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
- info("Found the watch expressions scope: " + scope);
-
- let aExp = scope.get(aVar.querySelector(".name").getAttribute("value"));
- info("Found the watch expression variable: " + aExp);
-
- if (aDeletionFlag) {
- ok(fetchedVariables, "The variables should have been fetched.");
- ok(fetchedExpressions, "The variables should have been fetched.");
- is(aExp, undefined, "The watch expression should not have been found.");
- performCallback(scope);
- return;
- }
-
- is(aExp.target.querySelector(".name").getAttribute("value"), aNewValue.trim(),
- "Should have the right name for '" + aNewValue + "'.");
- is(aExp.target.querySelector(".value").getAttribute("value"), aNewResult,
- "Should have the right value for '" + aNewValue + "'.");
-
- performCallback(scope);
- }
-
- makeChangesAndExitInputMode();
- });
-
- function performCallback(scope) {
- executeSoon(function() {
- aTest(scope);
- aCallback(scope);
- });
- }
-}
-
-function testExprDeletion(aVar, aTest, aCallback, aArgResult,
- aLocalScopeIndex = 1, aFinalFlag = null, aRemoveAllFlag = null)
-{
- let testContinued = false;
- let fetchedVariables = false;
- let fetchedExpressions = false;
-
- let countV = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function testV() {
- // We expect 2 Debugger:FetchedVariables events, one from the global
- // object scope and the regular one.
- if (++countV < 2) {
- info("Number of received Debugger:FetchedVariables events: " + countV);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", testV, false);
- fetchedVariables = true;
- executeSoon(continueTest);
- }, false);
-
- let countE = 0;
- gDebugger.addEventListener("Debugger:FetchedWatchExpressions", function testE() {
- // We expect only one Debugger:FetchedWatchExpressions event, since all
- // expressions are evaluated at the same time.
- if (++countE < 1) {
- info("Number of received Debugger:FetchedWatchExpressions events: " + countE);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedWatchExpressions", testE, false);
- fetchedExpressions = true;
- executeSoon(continueTest);
- }, false);
-
- function continueTest() {
- if ((testContinued || !fetchedVariables || !fetchedExpressions) && !aFinalFlag) {
- return;
- }
- testContinued = true;
-
- // Get the variable reference anew, since the old ones were discarded when
- // we resumed.
- var localScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[aLocalScopeIndex],
- localNodes = localScope.querySelector(".variables-view-element-details").childNodes,
- aArg = localNodes[1];
-
- is(aArg.querySelector(".value").getAttribute("value"), aArgResult,
- "Should have the right value for 'aArg'.");
-
- let label = gDebugger.L10N.getStr("watchExpressionsScopeLabel");
- let scope = gVars._currHierarchy.get(label);
- info("Found the watch expressions scope: " + scope);
-
- if (aFinalFlag) {
- ok(fetchedVariables, "The variables should have been fetched.");
- ok(!fetchedExpressions, "The variables should never have been fetched.");
- is(scope, undefined, "The watch expressions scope should not have been found.");
- performCallback(scope);
- return;
- }
-
- let aExp = scope.get(aVar.querySelector(".name").getAttribute("value"));
- info("Found the watch expression variable: " + aExp);
-
- is(aExp, undefined, "Should not have found the watch expression after deletion.");
- performCallback(scope);
- }
-
- function performCallback(scope) {
- executeSoon(function() {
- aTest(scope);
- aCallback(scope);
- });
- }
-
- if (aRemoveAllFlag) {
- gWatch._onCmdRemoveAllExpressions();
- return;
- }
-
- EventUtils.sendMouseEvent({ type: "click" },
- aVar.querySelector(".variables-view-delete"),
- gDebugger);
-}
-
-function test1(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
- "There should be 5 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 5, "There should be 5 evaluations availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "aArg",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "ermahgerd",
- "The fourth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd",
- "The fourth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(4).attachment.inputNode.value, "this",
- "The fifth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this",
- "The fifth textbox input value is not the correct one");
-}
-
-function test2(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 5,
- "There should be 5 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 5, "There should be 5 evaluations availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "aArg = 44",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.currentExpression, "aArg = 44",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "ermahgerd",
- "The fourth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.currentExpression, "ermahgerd",
- "The fourth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(4).attachment.inputNode.value, "this",
- "The fifth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(4).attachment.currentExpression, "this",
- "The fifth textbox input value is not the correct one");
-}
-
-function test3(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 4,
- "There should be 4 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 4, "There should be 4 evaluations availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title = 43",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.currentExpression, "document.title",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "ermahgerd",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.currentExpression, "ermahgerd",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.inputNode.value, "this",
- "The fourth textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(3).attachment.currentExpression, "this",
- "The fourth textbox input value is not the correct one");
-}
-
-function test4(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 3,
- "There should be 3 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 3, "There should be 3 evaluations availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "document.title",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "document.title",
- "The first textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "ermahgerd",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.currentExpression, "ermahgerd",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.inputNode.value, "this",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(2).attachment.currentExpression, "this",
- "The third textbox input value is not the correct one");
-}
-
-function test5(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 2,
- "There should be 2 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 2, "There should be 2 evaluations availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "ermahgerd",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd",
- "The second textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.inputNode.value, "this",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(1).attachment.currentExpression, "this",
- "The third textbox input value is not the correct one");
-}
-
-function test6(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 1,
- "There should be 1 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- ok(scope, "There should be a wach expressions scope in the variables view");
- is(scope._store.size, 1, "There should be 1 evaluation availalble");
-
- is(gWatch.getItemAtIndex(0).attachment.inputNode.value, "ermahgerd",
- "The third textbox input value is not the correct one");
- is(gWatch.getItemAtIndex(0).attachment.currentExpression, "ermahgerd",
- "The third textbox input value is not the correct one");
-}
-
-function test7(scope) {
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression[hidden=true]").length, 0,
- "There should be 0 hidden nodes in the watch expressions container");
- is(gWatch.widget._parent.querySelectorAll(".dbg-expression:not([hidden=true])").length, 0,
- "There should be 0 visible nodes in the watch expressions container");
-
- is(scope, undefined, "There should be no watch expressions scope available.");
- is(gWatch.itemCount, 0, "The watch expressions container should be empty.");
-}
-
-function addWatchExpression(string) {
- gWatch.addExpression(string);
- gDebugger.editor.focus();
-}
-
-function addCmdWatchExpression(string) {
- gWatch._onCmdAddExpression(string);
- gDebugger.editor.focus();
-}
-
-function resumeAndFinish() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gWatch = null;
- gVars = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js
deleted file mode 100644
index 1763916d3..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js
+++ /dev/null
@@ -1,516 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes by name.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- testSearchbox();
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testSearchbox()
-{
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There should not initially be a searchbox available in the variables view.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should not be found.");
-
- gDebugger.DebuggerView.Variables._enableSearch();
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available after enabling.");
- ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should be hidden at this point.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should be found.");
-
-
- gDebugger.DebuggerView.Variables._disableSearch();
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There shouldn't be a searchbox available after disabling.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should not be found.");
-
- gDebugger.DebuggerView.Variables._enableSearch();
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available after enabling.");
- ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should be hidden at this point.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should be found.");
-
-
- let placeholder = "freshly squeezed mango juice";
-
- gDebugger.DebuggerView.Variables.searchPlaceholder = placeholder;
- is(gDebugger.DebuggerView.Variables.searchPlaceholder, placeholder,
- "The placeholder getter didn't return the expected string");
-
- ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"),
- placeholder, "There correct placeholder should be applied to the searchbox.");
-
-
- gDebugger.DebuggerView.Variables._disableSearch();
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There shouldn't be a searchbox available after disabling again.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should not be found.");
-
- gDebugger.DebuggerView.Variables._enableSearch();
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available after enabling again.");
- ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should be hidden at this point.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should be found.");
-
- ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"),
- placeholder, "There correct placeholder should be applied to the searchbox again.");
-
-
- gDebugger.DebuggerView.Variables.searchEnabled = false;
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There shouldn't be a searchbox available after disabling again.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should not be found.");
-
- gDebugger.DebuggerView.Variables.searchEnabled = true;
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available after enabling again.");
- ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should be hidden at this point.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should be found.");
-
- ok(gDebugger.DebuggerView.Variables._searchboxNode.getAttribute("placeholder"),
- placeholder, "There correct placeholder should be applied to the searchbox again.");
-}
-
-function testVariablesFiltering()
-{
- ok(!gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should not be hidden at this point.");
-
- function test1()
- {
- write("location");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- ignoreExtraMatchedProperties();
- locationItem.toggle();
- locationItem.toggle();
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 3,
- "There should be 3 variables displayed in the global scope");
-
- ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 6,
- "There should be more than 6 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "this", "The only inner variable displayed should be 'this'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "window", "The third inner property displayed should be 'window'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"),
- "document", "The fourth inner property displayed should be 'document'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[4].getAttribute("value"),
- "location", "The fifth inner property displayed should be 'location'");
-
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "location", "The first global variable displayed should be 'location'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "locationbar", "The second global variable displayed should be 'locationbar'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "Location", "The third global variable displayed should be 'Location'");
- }
-
- function test2()
- {
- innerScopeItem.collapse();
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
- thisItem.collapse();
- windowItem.collapse();
- documentItem.collapse();
- locationItem.collapse();
-
- is(innerScopeItem.expanded, false,
- "The innerScope expanded getter should return false");
- is(mathScopeItem.expanded, false,
- "The mathScope expanded getter should return false");
- is(testScopeItem.expanded, false,
- "The testScope expanded getter should return false");
- is(loadScopeItem.expanded, false,
- "The loadScope expanded getter should return false");
- is(globalScopeItem.expanded, false,
- "The globalScope expanded getter should return false");
-
- is(thisItem.expanded, false,
- "The local scope 'this' should not be expanded");
- is(windowItem.expanded, false,
- "The local scope 'this.window' should not be expanded");
- is(documentItem.expanded, false,
- "The local scope 'this.window.document' should not be expanded");
- is(locationItem.expanded, false,
- "The local scope 'this.window.document.location' should not be expanded");
-
- write("location");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- ignoreExtraMatchedProperties();
- locationItem.toggle();
- locationItem.toggle();
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 3,
- "There should be 3 variables displayed in the global scope");
-
- ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 6,
- "There should be more than 6 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "this", "The only inner variable displayed should be 'this'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "window", "The third inner property displayed should be 'window'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[3].getAttribute("value"),
- "document", "The fourth inner property displayed should be 'document'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[4].getAttribute("value"),
- "location", "The fifth inner property displayed should be 'location'");
-
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "location", "The first global variable displayed should be 'location'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "locationbar", "The second global variable displayed should be 'locationbar'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "Location", "The second global variable displayed should be 'Location'");
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- let thisItem = innerScopeItem.get("this");
- let windowItem = thisItem.get("window");
- let documentItem = windowItem.get("document");
- let locationItem = documentItem.get("location");
-
- gSearchBox = gDebugger.DebuggerView.Variables._searchboxNode;
-
- executeSoon(function() {
- test1();
- executeSoon(function() {
- test2();
- executeSoon(function() {
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 4 Debugger:FetchedVariables events, one from the global object
- // scope, two from the |with| scopes and the regular one.
- if (++count < 4) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, false,
- "The mathScope expanded getter should return false");
- is(testScopeItem.expanded, false,
- "The testScope expanded getter should return false");
- is(loadScopeItem.expanded, false,
- "The loadScope expanded getter should return false");
- is(globalScopeItem.expanded, false,
- "The globalScope expanded getter should return false");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
-
- let thisItem = innerScopeItem.get("this");
- is(thisItem.expanded, false,
- "The local scope 'this' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test2() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let windowItem = thisItem.get("window");
- is(windowItem.expanded, false,
- "The local scope 'this.window' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test3() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let documentItem = windowItem.get("document");
- is(documentItem.expanded, false,
- "The local scope 'this.window.document' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test4() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let locationItem = documentItem.get("location");
- is(locationItem.expanded, false,
- "The local scope 'this.window.document.location' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test5() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- locationItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- documentItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- windowItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- thisItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded now");
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function ignoreExtraMatchedProperties()
-{
- for (let [, item] of gDebugger.DebuggerView.Variables._currHierarchy) {
- let name = item.name.toLowerCase();
- let value = item._valueString || "";
-
- if ((name.contains("tracemallocdumpallocations")) ||
- (name.contains("geolocation")) ||
- (name.contains("webgl"))) {
- item.target.setAttribute("non-match", "");
- }
- }
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js
deleted file mode 100644
index ec5f8c07e..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js
+++ /dev/null
@@ -1,438 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes by value.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- testSearchbox();
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testSearchbox()
-{
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There should not initially be a searchbox available in the variables view.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should not be found.");
-
- gDebugger.DebuggerView.Variables._enableSearch();
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available after enabling.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "The searchbox element should be found.");
- ok(gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should be hidden at this point.");
-}
-
-function testVariablesFiltering()
-{
- ok(!gDebugger.DebuggerView.Variables._searchboxContainer.hidden,
- "The searchbox container should not be hidden at this point.");
-
- function test1()
- {
- write("htmldocument");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- locationItem.toggle();
- locationItem.toggle();
- documentItem.toggle();
- documentItem.toggle();
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 2,
- "There should be 2 variables displayed in the global scope");
-
- ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 3,
- "There should be more than 3 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "this", "The only inner variable displayed should be 'this'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "document", "The first inner property displayed should be 'document'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "window", "The second inner property displayed should be 'window'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "document", "The third inner property displayed should be 'document'");
-
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "document", "The first global variable displayed should be 'document'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "HTMLDocument", "The first global variable displayed should be 'HTMLDocument'");
- }
-
- function test2()
- {
- innerScopeItem.collapse();
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
- thisItem.collapse();
- windowItem.collapse();
- documentItem.collapse();
- locationItem.collapse();
-
- is(innerScopeItem.expanded, false,
- "The innerScope expanded getter should return false");
- is(mathScopeItem.expanded, false,
- "The mathScope expanded getter should return false");
- is(testScopeItem.expanded, false,
- "The testScope expanded getter should return false");
- is(loadScopeItem.expanded, false,
- "The loadScope expanded getter should return false");
- is(globalScopeItem.expanded, false,
- "The globalScope expanded getter should return false");
-
- is(thisItem.expanded, false,
- "The local scope 'this' should not be expanded");
- is(windowItem.expanded, false,
- "The local scope 'this.window' should not be expanded");
- is(documentItem.expanded, false,
- "The local scope 'this.window.document' should not be expanded");
- is(locationItem.expanded, false,
- "The local scope 'this.window.document.location' should not be expanded");
-
- write("htmldocument");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- documentItem.toggle();
- documentItem.toggle();
- locationItem.toggle();
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 2,
- "There should be 2 variables displayed in the global scope");
-
- ok(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length > 3,
- "There should be more than 3 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
- is(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "this", "The only inner variable displayed should be 'this'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "document", "The first inner property displayed should be 'document'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "window", "The second inner property displayed should be 'window'");
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match]) > .title > .name")[2].getAttribute("value"),
- "document", "The third inner property displayed should be 'document'");
-
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "document", "The first global variable displayed should be 'document'");
- is(globalScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[1].getAttribute("value"),
- "HTMLDocument", "The first global variable displayed should be 'HTMLDocument'");
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- let thisItem = innerScopeItem.get("this");
- let windowItem = thisItem.get("window");
- let documentItem = windowItem.get("document");
- let locationItem = documentItem.get("location");
-
- gSearchBox = gDebugger.DebuggerView.Variables._searchboxNode;
-
- executeSoon(function() {
- test1();
- executeSoon(function() {
- test2();
- executeSoon(function() {
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 4 Debugger:FetchedVariables events, one from the global object
- // scope, two from the |with| scopes and the regular one.
- if (++count < 4) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, false,
- "The mathScope expanded getter should return false");
- is(testScopeItem.expanded, false,
- "The testScope expanded getter should return false");
- is(loadScopeItem.expanded, false,
- "The loadScope expanded getter should return false");
- is(globalScopeItem.expanded, false,
- "The globalScope expanded getter should return false");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
-
- let thisItem = innerScopeItem.get("this");
- is(thisItem.expanded, false,
- "The local scope 'this' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test2() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let windowItem = thisItem.get("window");
- is(windowItem.expanded, false,
- "The local scope 'this.window' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test3() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let documentItem = windowItem.get("document");
- is(documentItem.expanded, false,
- "The local scope 'this.window.document' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test4() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let locationItem = documentItem.get("location");
- is(locationItem.expanded, false,
- "The local scope 'this.window.document.location' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test5() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded");
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- locationItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- documentItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- windowItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- thisItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded now");
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js
deleted file mode 100644
index 7f92b9325..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view filter prefs work properly.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gPrevPref = null;
-
-function test()
-{
- gPrevPref = Services.prefs.getBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible");
- Services.prefs.setBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible", false);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- testSearchbox();
- testPref();
- });
-}
-
-function testSearchbox()
-{
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There should not initially be a searchbox available in the variables view.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should not be found.");
-}
-
-function testPref()
-{
- is(gDebugger.Prefs.variablesSearchboxVisible, false,
- "The debugger searchbox should be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should not be checked.");
-
- gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "true");
- gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox();
-
- executeSoon(function() {
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available in the variables view.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should be found.");
- is(gDebugger.Prefs.variablesSearchboxVisible, true,
- "The debugger searchbox should now be preffed as visible.");
- is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should now be checked.");
-
- gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox();
-
- executeSoon(function() {
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There should not be a searchbox available in the variables view.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should not be found.");
- is(gDebugger.Prefs.variablesSearchboxVisible, false,
- "The debugger searchbox should now be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should now be unchecked.");
-
- executeSoon(function() {
- Services.prefs.setBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible", gPrevPref);
-
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gPrevPref = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js
deleted file mode 100644
index 89663783b..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-04.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view filter prefs work properly.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gPrevPref = null;
-
-function test()
-{
- gPrevPref = Services.prefs.getBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible");
- Services.prefs.setBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible", true);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- testSearchbox();
- testPref();
- });
-}
-
-function testSearchbox()
-{
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should initially be a searchbox available in the variables view.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should be found.");
-}
-
-function testPref()
-{
- is(gDebugger.Prefs.variablesSearchboxVisible, true,
- "The debugger searchbox should be preffed as visible.");
- is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should be checked.");
-
- gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "false");
- gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox();
-
- executeSoon(function() {
- ok(!gDebugger.DebuggerView.Variables._searchboxNode,
- "There should not be a searchbox available in the variables view.");
- ok(!gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should not be found.");
- is(gDebugger.Prefs.variablesSearchboxVisible, false,
- "The debugger searchbox should now be preffed as hidden.");
- isnot(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should now be unchecked.");
-
- gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.setAttribute("checked", "true");
- gDebugger.DebuggerView.Options._toggleShowVariablesFilterBox();
-
- executeSoon(function() {
- ok(gDebugger.DebuggerView.Variables._searchboxNode,
- "There should be a searchbox available in the variables view.");
- ok(gDebugger.DebuggerView.Variables._parent.parentNode.querySelector(".variables-view-searchinput"),
- "There searchbox element should be found.");
- is(gDebugger.Prefs.variablesSearchboxVisible, true,
- "The debugger searchbox should now be preffed as visible.");
- is(gDebugger.DebuggerView.Options._showVariablesFilterBoxItem.getAttribute("checked"), "true",
- "The options menu item should now be checked.");
-
- executeSoon(function() {
- Services.prefs.setBoolPref(
- "devtools.debugger.ui.variables-searchbox-visible", gPrevPref);
-
- closeDebuggerAndFinish();
- });
- });
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gPrevPref = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js
deleted file mode 100644
index af3c4b85d..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js
+++ /dev/null
@@ -1,284 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testVariablesFiltering()
-{
- function test1()
- {
- write("*one");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the load scope");
-
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "one", "The only inner variable displayed should be 'one'");
-
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "button", "The only load variable displayed should be 'button'");
-
- let oneItem = innerScopeItem.get("one");
- is(oneItem.expanded, false,
- "The one item in the inner scope should not be expanded");
-
- EventUtils.sendKey("RETURN", gDebugger);
- is(oneItem.expanded, true,
- "The one item in the inner scope should now be expanded");
- }
-
- function test2()
- {
- write("*two");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 1,
- "There should be 1 variable displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be 0 variables displayed in the load scope");
-
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- is(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the load scope");
-
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match]) > .title > .name")[0].getAttribute("value"),
- "two", "The only inner variable displayed should be 'two'");
-
- let twoItem = innerScopeItem.get("two");
- is(twoItem.expanded, false,
- "The two item in the inner scope should not be expanded");
-
- EventUtils.sendKey("RETURN", gDebugger);
- is(twoItem.expanded, true,
- "The two item in the inner scope should now be expanded");
- }
-
- function test3()
- {
- backspace(3);
-
- is(gSearchBox.value, "*",
- "Searchbox value is incorrect after 3 backspaces");
-
- // variable count includes `__proto__` for object scopes
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 4,
- "There should be 4 variables displayed in the inner scope");
- isnot(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the math scope");
- isnot(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the test scope");
- isnot(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the load scope");
- isnot(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- ok(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length > 1,
- "There should be more than one property displayed in the load scope");
- isnot(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be some properties displayed in the global scope");
- }
-
- function test4()
- {
- backspace(1);
-
- is(gSearchBox.value, "",
- "Searchbox value is incorrect after 1 backspace");
-
- // variable count includes `__proto__` for object scopes
- is(innerScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 4,
- "There should be 4 variables displayed in the inner scope");
- isnot(mathScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the math scope");
- isnot(testScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the test scope");
- isnot(loadScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the load scope");
- isnot(globalScope.querySelectorAll(".variables-view-variable:not([non-match])").length, 0,
- "There should be some variables displayed in the global scope");
-
- is(innerScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the inner scope");
- is(mathScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the math scope");
- is(testScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be 0 properties displayed in the test scope");
- ok(loadScope.querySelectorAll(".variables-view-property:not([non-match])").length > 1,
- "There should be more than one properties displayed in the load scope");
- isnot(globalScope.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "There should be some properties displayed in the global scope");
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- executeSoon(function() {
- test1();
- executeSoon(function() {
- test2();
- executeSoon(function() {
- test3();
- executeSoon(function() {
- test4();
- executeSoon(function() {
- closeDebuggerAndFinish();
- });
- });
- });
- });
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 4 Debugger:FetchedVariables events, one from the global object
- // scope, two from the |with| scopes and the regular one.
- if (++count < 4) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger)
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js
deleted file mode 100644
index 962f6542a..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = false;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testVariablesFiltering()
-{
- let f = {
- test1: function()
- {
- assertExpansion(1, [true, false, false, false, false]);
- clear();
- },
- test2: function()
- {
- assertExpansion(2, [true, false, false, false, false]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test3: function()
- {
- assertExpansion(3, [true, false, false, false, false]);
- gDebugger.editor.focus();
- },
- test4: function()
- {
- assertExpansion(4, [true, false, false, false, false]);
- write("*");
- },
- test5: function() {
- assertExpansion(5, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test6: function() {
- assertExpansion(6, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test7: function() {
- assertExpansion(7, [true, true, true, true, true]);
- backspace(1);
- },
- test8: function() {
- assertExpansion(8, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test9: function() {
- assertExpansion(9, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test10: function() {
- assertExpansion(10, [true, true, true, true, true]);
- innerScopeItem.collapse();
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
- },
- test11: function() {
- assertExpansion(11, [false, false, false, false, false]);
- clear();
- },
- test12: function() {
- assertExpansion(12, [false, false, false, false, false]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test13: function() {
- assertExpansion(13, [false, false, false, false, false]);
- gDebugger.editor.focus();
- },
- test14: function() {
- assertExpansion(14, [false, false, false, false, false]);
- write("*");
- },
- test15: function() {
- assertExpansion(15, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test16: function() {
- assertExpansion(16, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test17: function() {
- assertExpansion(17, [true, true, true, true, true]);
- backspace(1);
- },
- test18: function() {
- assertExpansion(18, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test19: function() {
- assertExpansion(19, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test20: function() {
- assertExpansion(20, [true, true, true, true, true]);
- }
- };
-
- function assertExpansion(n, array) {
- is(innerScopeItem.expanded, array[0],
- "The innerScope should " + (array[0] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(mathScopeItem.expanded, array[1],
- "The mathScope should " + (array[1] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(testScopeItem.expanded, array[2],
- "The testScope should " + (array[2] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(loadScopeItem.expanded, array[3],
- "The loadScope should " + (array[3] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(globalScopeItem.expanded, array[4],
- "The globalScope should " + (array[4] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- executeSoon(function() {
- for (let i = 1; i <= Object.keys(f).length; i++) {
- f["test" + i]();
- }
- closeDebuggerAndFinish();
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the inner object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger)
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js
deleted file mode 100644
index d18e0bbb2..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-07.js
+++ /dev/null
@@ -1,254 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testVariablesFiltering()
-{
- let f = {
- test1: function()
- {
- assertExpansion(1, [true, false, false, false, false]);
- clear();
- },
- test2: function()
- {
- assertExpansion(2, [true, false, false, false, false]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test3: function()
- {
- assertExpansion(3, [true, false, false, false, false]);
- gDebugger.editor.focus();
- },
- test4: function()
- {
- assertExpansion(4, [true, false, false, false, false]);
- write("*");
- },
- test5: function() {
- assertExpansion(5, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test6: function() {
- assertExpansion(6, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test7: function() {
- assertExpansion(7, [true, true, true, true, true]);
- backspace(1);
- },
- test8: function() {
- assertExpansion(8, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test9: function() {
- assertExpansion(9, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test10: function() {
- assertExpansion(10, [true, true, true, true, true]);
- innerScopeItem.collapse();
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
- },
- test11: function() {
- assertExpansion(11, [false, false, false, false, false]);
- clear();
- },
- test12: function() {
- assertExpansion(12, [false, false, false, false, false]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test13: function() {
- assertExpansion(13, [false, false, false, false, false]);
- gDebugger.editor.focus();
- },
- test14: function() {
- assertExpansion(14, [false, false, false, false, false]);
- write("*");
- },
- test15: function() {
- assertExpansion(15, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test16: function() {
- assertExpansion(16, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test17: function() {
- assertExpansion(17, [true, true, true, true, true]);
- backspace(1);
- },
- test18: function() {
- assertExpansion(18, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- },
- test19: function() {
- assertExpansion(19, [true, true, true, true, true]);
- gDebugger.editor.focus();
- },
- test20: function() {
- assertExpansion(20, [true, true, true, true, true]);
- }
- };
-
- function assertExpansion(n, array) {
- is(innerScopeItem.expanded, array[0],
- "The innerScope should " + (array[0] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(mathScopeItem.expanded, array[1],
- "The mathScope should " + (array[1] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(testScopeItem.expanded, array[2],
- "The testScope should " + (array[2] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(loadScopeItem.expanded, array[3],
- "The loadScope should " + (array[3] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(globalScopeItem.expanded, array[4],
- "The globalScope should " + (array[4] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- executeSoon(function() {
- for (let i = 1; i <= Object.keys(f).length; i++) {
- f["test" + i]();
- }
- closeDebuggerAndFinish();
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the inner object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js b/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js
deleted file mode 100644
index 7668512fd..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js
+++ /dev/null
@@ -1,324 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly filters nodes.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-var gSearchBox = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.delayedSearch = false;
- prepareVariables(testVariablesFiltering);
- });
-}
-
-function testVariablesFiltering()
-{
- let f = {
- test1: function(aCallback)
- {
- assertExpansion(1, [true, false, false, false, false]);
- write("*arguments");
- aCallback();
- },
- test2: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, false,
- "The arguments pseudoarray in the testScope should not be expanded");
- is(loadScopeItem.get("arguments").expanded, false,
- "The arguments pseudoarray in the testScope should not be expanded");
-
- assertExpansion(1, [true, true, true, true, true]);
- EventUtils.sendKey("RETURN", gDebugger);
- aCallback();
- },
- test3: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(2, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the testScope should have 4 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the loadScope should have 4 visible properties");
-
- assertExpansion(2, [true, true, true, true, true]);
- backspace(1);
- aCallback();
- });
- },
- test4: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(0, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the testScope should have 4 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the loadScope should have 4 visible properties");
-
- assertExpansion(3, [true, true, true, true, true]);
- backspace(8);
- aCallback();
- });
- },
- test5: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(0, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the testScope should have 4 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the loadScope should have 4 visible properties");
-
- assertExpansion(4, [true, true, true, true, true]);
- backspace(1);
- aCallback();
- });
- },
- test6: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(0, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the testScope should have 4 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the loadScope should have 4 visible properties");
-
- assertExpansion(5, [true, true, true, true, true]);
- write("*");
- aCallback();
- });
- },
- test7: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(0, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the testScope should have 4 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 4,
- "The arguments in the loadScope should have 4 visible properties");
-
- assertExpansion(5, [true, true, true, true, true]);
- append("arguments");
- aCallback();
- });
- },
- test8: function(aCallback)
- {
- is(testScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
- is(loadScopeItem.get("arguments").expanded, true,
- "The arguments pseudoarray in the testScope should now be expanded");
-
- waitForFetchedProperties(0, function() {
- is(testScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "The arguments in the testScope should have 0 visible properties");
- is(loadScopeItem.get("arguments").target.querySelectorAll(".variables-view-property:not([non-match])").length, 0,
- "The arguments in the loadScope should have 0 visible properties");
-
- assertExpansion(5, [true, true, true, true, true]);
- aCallback();
- });
- },
- };
-
- function assertExpansion(n, array) {
- is(innerScopeItem.expanded, array[0],
- "The innerScope should " + (array[0] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(mathScopeItem.expanded, array[1],
- "The mathScope should " + (array[1] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(testScopeItem.expanded, array[2],
- "The testScope should " + (array[2] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(loadScopeItem.expanded, array[3],
- "The loadScope should " + (array[3] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
-
- is(globalScopeItem.expanded, array[4],
- "The globalScope should " + (array[4] ? "" : "not ") +
- "be expanded at this point (" + n + ")");
- }
-
- function waitForFetchedProperties(n, aCallback) {
- if (n == 0) {
- aCallback();
- return;
- }
-
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedProperties", function test() {
- // We expect n Debugger:FetchedProperties events.
- if (++count < n) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedProperties", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
- executeSoon(aCallback);
- }}, 0);
- }, false);
- }
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- executeSoon(function() {
- f.test1(function() {
- f.test2(function() {
- f.test3(function() {
- f.test4(function() {
- f.test5(function() {
- f.test6(function() {
- f.test7(function() {
- f.test8(function() {
- closeDebuggerAndFinish();
- });
- });
- });
- });
- });
- });
- });
- });
- });
-}
-
-function prepareVariables(aCallback)
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 2 Debugger:FetchedVariables events, one from the inner object
- // scope and the regular one.
- if (++count < 2) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
- executeSoon(function() {
- aCallback();
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js b/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js
deleted file mode 100644
index 7cb9e10d4..000000000
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js
+++ /dev/null
@@ -1,394 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that the property view correctly re-expands nodes after pauses.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-var gDebuggee = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebuggee = aDebuggee;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown() {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
- addBreakpoint();
- });
- });
-}
-
-function addBreakpoint()
-{
- gDebugger.DebuggerController.Breakpoints.addBreakpoint({
- url: gDebugger.DebuggerView.Sources.selectedValue,
- line: 16
- }, function(aBreakpointClient, aResponseError) {
- ok(!aResponseError, "There shouldn't be an error.");
- // Wait for the resume...
- gDebugger.gClient.addOneTimeListener("resumed", function() {
- gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
- gDebugger.DebuggerView.Variables.nonEnumVisible = false;
- gDebugger.DebuggerView.Variables.commitHierarchyIgnoredItems = Object.create(null);
- testVariablesExpand();
- });
- });
-}
-
-function testVariablesExpand()
-{
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
- // We expect 4 Debugger:FetchedVariables events, one from the global object
- // scope, two from the |with| scopes and the regular one.
- if (++count < 4) {
- info("Number of received Debugger:FetchedVariables events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- var frames = gDebugger.DebuggerView.StackFrames.widget._list,
- scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.querySelectorAll(".variables-view-scope")[0],
- mathScope = scopes.querySelectorAll(".variables-view-scope")[1],
- testScope = scopes.querySelectorAll(".variables-view-scope")[2],
- loadScope = scopes.querySelectorAll(".variables-view-scope")[3],
- globalScope = scopes.querySelectorAll(".variables-view-scope")[4];
-
- let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- innerScope.querySelector(".name").getAttribute("value"));
- let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- mathScope.querySelector(".name").getAttribute("value"));
- let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- testScope.querySelector(".name").getAttribute("value"));
- let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- loadScope.querySelector(".name").getAttribute("value"));
- let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
- globalScope.querySelector(".name").getAttribute("value"));
-
- is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
- "The innerScope arrow should initially be expanded");
- is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
- "The mathScope arrow should initially be expanded");
- is(testScope.querySelector(".arrow").hasAttribute("open"), true,
- "The testScope arrow should initially be expanded");
- is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
- "The loadScope arrow should initially be expanded");
- is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
- "The globalScope arrow should initially be expanded");
-
- is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The innerScope enumerables should initially be expanded");
- is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The mathScope enumerables should initially be expanded");
- is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The testScope enumerables should initially be expanded");
- is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The loadScope enumerables should initially be expanded");
- is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The globalScope enumerables should initially be expanded");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- mathScopeItem.collapse();
- testScopeItem.collapse();
- loadScopeItem.collapse();
- globalScopeItem.collapse();
-
- is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
- "The innerScope arrow should initially be expanded");
- is(mathScope.querySelector(".arrow").hasAttribute("open"), false,
- "The mathScope arrow should initially not be expanded");
- is(testScope.querySelector(".arrow").hasAttribute("open"), false,
- "The testScope arrow should initially not be expanded");
- is(loadScope.querySelector(".arrow").hasAttribute("open"), false,
- "The loadScope arrow should initially not be expanded");
- is(globalScope.querySelector(".arrow").hasAttribute("open"), false,
- "The globalScope arrow should initially not be expanded");
-
- is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The innerScope enumerables should initially be expanded");
- is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), false,
- "The mathScope enumerables should initially not be expanded");
- is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), false,
- "The testScope enumerables should initially not be expanded");
- is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), false,
- "The loadScope enumerables should initially not be expanded");
- is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), false,
- "The globalScope enumerables should initially not be expanded");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, false,
- "The mathScope expanded getter should return false");
- is(testScopeItem.expanded, false,
- "The testScope expanded getter should return false");
- is(loadScopeItem.expanded, false,
- "The loadScope expanded getter should return false");
- is(globalScopeItem.expanded, false,
- "The globalScope expanded getter should return false");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
- EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
-
-
- is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
- "The innerScope arrow should now be expanded");
- is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
- "The mathScope arrow should now be expanded");
- is(testScope.querySelector(".arrow").hasAttribute("open"), true,
- "The testScope arrow should now be expanded");
- is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
- "The loadScope arrow should now be expanded");
- is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
- "The globalScope arrow should now be expanded");
-
- is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The innerScope enumerables should now be expanded");
- is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The mathScope enumerables should now be expanded");
- is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The testScope enumerables should now be expanded");
- is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The loadScope enumerables should now be expanded");
- is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The globalScope enumerables should now be expanded");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
-
- let thisItem = innerScopeItem.get("this");
- is(thisItem.expanded, false,
- "The local scope 'this' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test2() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let windowItem = thisItem.get("window");
- is(windowItem.expanded, false,
- "The local scope 'this.window' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test3() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let documentItem = windowItem.get("document");
- is(documentItem.expanded, false,
- "The local scope 'this.window.document' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test4() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- let locationItem = documentItem.get("location");
- is(locationItem.expanded, false,
- "The local scope 'this.window.document.location' should not be expanded yet");
-
- gDebugger.addEventListener("Debugger:FetchedProperties", function test5() {
- gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The thisItem arrow should still be expanded (1)");
- is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The windowItem arrow should still be expanded (1)");
- is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The documentItem arrow should still be expanded (1)");
- is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The locationItem arrow should still be expanded (1)");
-
- is(thisItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The thisItem enumerables should still be expanded (1)");
- is(windowItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The windowItem enumerables should still be expanded (1)");
- is(documentItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The documentItem enumerables should still be expanded (1)");
- is(locationItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The locationItem enumerables should still be expanded (1)");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should still be expanded (1)");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should still be expanded (1)");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should still be expanded (1)");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should still be expanded (1)");
-
-
- let count = 0;
- gDebugger.addEventListener("Debugger:FetchedProperties", function test6() {
- // We expect 4 Debugger:FetchedProperties events, one from the this
- // reference, one for window, one for document and one for location.
- if (++count < 4) {
- info("Number of received Debugger:FetchedProperties events: " + count);
- return;
- }
- gDebugger.removeEventListener("Debugger:FetchedProperties", test6, false);
- Services.tm.currentThread.dispatch({ run: function() {
-
- is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
- "The innerScope arrow should still be expanded");
- is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
- "The mathScope arrow should still be expanded");
- is(testScope.querySelector(".arrow").hasAttribute("open"), true,
- "The testScope arrow should still be expanded");
- is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
- "The loadScope arrow should still be expanded");
- is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
- "The globalScope arrow should still be expanded");
-
- is(innerScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The innerScope enumerables should still be expanded");
- is(mathScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The mathScope enumerables should still be expanded");
- is(testScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The testScope enumerables should still be expanded");
- is(loadScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The loadScope enumerables should still be expanded");
- is(globalScope.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The globalScope enumerables should still be expanded");
-
- is(innerScopeItem.expanded, true,
- "The innerScope expanded getter should return true");
- is(mathScopeItem.expanded, true,
- "The mathScope expanded getter should return true");
- is(testScopeItem.expanded, true,
- "The testScope expanded getter should return true");
- is(loadScopeItem.expanded, true,
- "The loadScope expanded getter should return true");
- is(globalScopeItem.expanded, true,
- "The globalScope expanded getter should return true");
-
- is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The thisItem arrow should still be expanded (2)");
- is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The windowItem arrow should still be expanded (2)");
- is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The documentItem arrow should still be expanded (2)");
- is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true,
- "The locationItem arrow should still be expanded (2)");
-
- is(thisItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The thisItem enumerables should still be expanded (2)");
- is(windowItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The windowItem enumerables should still be expanded (2)");
- is(documentItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The documentItem enumerables should still be expanded (2)");
- is(locationItem.target.querySelector(".variables-view-element-details").hasAttribute("open"), true,
- "The locationItem enumerables should still be expanded (2)");
-
- is(thisItem.expanded, true,
- "The local scope 'this' should still be expanded (2)");
- is(windowItem.expanded, true,
- "The local scope 'this.window' should still be expanded (2)");
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should still be expanded (2)");
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should still be expanded (2)");
-
- executeSoon(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.querySelector("#step-in"),
- gDebugger);
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- locationItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(locationItem.expanded, true,
- "The local scope 'this.window.document.location' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- documentItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(documentItem.expanded, true,
- "The local scope 'this.window.document' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- windowItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(windowItem.expanded, true,
- "The local scope 'this.window' should be expanded now");
- });
- }}, 0);
- }, false);
-
- executeSoon(function() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- thisItem.target.querySelector(".arrow"),
- gDebugger);
-
- is(thisItem.expanded, true,
- "The local scope 'this' should be expanded now");
- });
- }}, 0);
- }, false);
-
- EventUtils.sendMouseEvent({ type: "click" },
- gDebuggee.document.querySelector("button"),
- gDebuggee.window);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
- gDebuggee = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js b/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js
deleted file mode 100644
index 47846e46b..000000000
--- a/browser/devtools/debugger/test/browser_dbg_reload-preferred-script.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the preferred script is shown when a page is loaded.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gView = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- let expectedScript = "test-script-switching-02.js";
- let expectedScriptShown = false;
- let scriptShownUrl = null;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gView = gDebugger.DebuggerView;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gView.Sources.preferredSource = EXAMPLE_URL + expectedScript;
- startTest();
- });
-
- function onScriptShown(aEvent)
- {
- expectedScriptShown = aEvent.detail.url.indexOf(expectedScript) != -1;
- scriptShownUrl = aEvent.detail.url;
- startTest();
- }
-
- function startTest()
- {
- if (expectedScriptShown && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function performTest()
- {
- info("Currently preferred script: " + gView.Sources.preferredValue);
- info("Currently selected script: " + gView.Sources.selectedValue);
-
- isnot(gView.Sources.preferredValue.indexOf(expectedScript), -1,
- "The preferred script url wasn't set correctly.");
- isnot(gView.Sources.selectedValue.indexOf(expectedScript), -1,
- "The selected script isn't the correct one.");
- is(gView.Sources.selectedValue, scriptShownUrl,
- "The shown script is not the the correct one.");
-
- closeDebuggerAndFinish();
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gView = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js b/browser/devtools/debugger/test/browser_dbg_reload-same-script.js
deleted file mode 100644
index bee00530f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_reload-same-script.js
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the same script is shown after a page is reloaded.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gView = null;
-
-requestLongerTimeout(2);
-
-function test()
-{
- let step = 0;
- let expectedScript = "";
- let expectedScriptShown = false;
- let scriptShownUrl = null;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gView = gDebugger.DebuggerView;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- startTest();
- });
-
- function onScriptShown(aEvent)
- {
- expectedScriptShown = aEvent.detail.url.indexOf("-01.js") != -1;
- scriptShownUrl = aEvent.detail.url;
- startTest();
- }
-
- function onUlteriorScriptShown(aEvent)
- {
- ok(expectedScript,
- "The expected script to show up should have been specified.");
-
- info("The expected script for this ScriptShown event is: " + expectedScript);
- info("The current script for this ScriptShown event is: " + aEvent.detail.url);
-
- expectedScriptShown = aEvent.detail.url.indexOf(expectedScript) != -1;
- scriptShownUrl = aEvent.detail.url;
- testScriptShown();
- }
-
- function startTest()
- {
- if (expectedScriptShown && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- gDebugger.addEventListener("Debugger:SourceShown", onUlteriorScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: performTest }, 0);
- }
- }
-
- function finishTest()
- {
- if (expectedScriptShown && resumed && testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onUlteriorScriptShown);
- closeDebuggerAndFinish();
- }
- }
-
- function performTest()
- {
- testCurrentScript("-01.js", step);
- expectedScript = "-01.js";
- performAction(reloadPage);
- }
-
- function testScriptShown()
- {
- if (!expectedScriptShown) {
- return;
- }
- step++;
-
- if (step === 1) {
- testCurrentScript("-01.js", step, true);
- expectedScript = "-01.js";
- performAction(reloadPage);
- }
- else if (step === 2) {
- testCurrentScript("-01.js", step, true);
- expectedScript = "-02.js";
- performAction(switchScript, 1);
- }
- else if (step === 3) {
- testCurrentScript("-02.js", step);
- expectedScript = "-02.js";
- performAction(reloadPage);
- }
- else if (step === 4) {
- testCurrentScript("-02.js", step, true);
- expectedScript = "-01.js";
- performAction(switchScript, 0);
- }
- else if (step === 5) {
- testCurrentScript("-01.js", step);
- expectedScript = "-01.js";
- performAction(reloadPage);
- }
- else if (step === 6) {
- testCurrentScript("-01.js", step, true);
- expectedScript = "-01.js";
- performAction(reloadPage);
- }
- else if (step === 7) {
- testCurrentScript("-01.js", step, true);
- expectedScript = "-01.js";
- performAction(reloadPage);
- }
- else if (step === 8) {
- testCurrentScript("-01.js", step, true);
- expectedScript = "-02.js";
- performAction(switchScript, 1);
- }
- else if (step === 9) {
- testCurrentScript("-02.js", step);
- expectedScript = "-02.js";
- performAction(reloadPage);
- }
- else if (step === 10) {
- testCurrentScript("-02.js", step, true);
- expectedScript = "-02.js";
- performAction(reloadPage);
- }
- else if (step === 11) {
- testCurrentScript("-02.js", step, true);
- expectedScript = "-02.js";
- performAction(reloadPage);
- }
- else if (step === 12) {
- testCurrentScript("-02.js", step, true);
- expectedScript = "-01.js";
- performAction(switchScript, 0);
- }
- else if (step === 13) {
- testCurrentScript("-01.js", step);
- finishTest();
- }
- }
-
- function testCurrentScript(part, step, isAfterReload)
- {
- info("Currently preferred script: " + gView.Sources.preferredValue);
- info("Currently selected script: " + gView.Sources.selectedValue);
-
- if (step < 1) {
- is(gView.Sources.preferredValue, null,
- "The preferred script url should be initially null");
- }
- else if (isAfterReload) {
- isnot(gView.Sources.preferredValue.indexOf(part), -1,
- "The preferred script url wasn't set correctly. (" + step + ")");
- }
-
- isnot(gView.Sources.selectedValue.indexOf(part), -1,
- "The selected script isn't the correct one. (" + step + ")");
- is(gView.Sources.selectedValue, scriptShownUrl,
- "The shown script is not the the correct one. (" + step + ")");
- }
-
- function performAction(callback, data)
- {
- // Poll every few milliseconds until the scripts are retrieved.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the scripts.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gView.Sources.values.length !== 2) {
- return;
- }
- info("Available scripts: " + gView.Sources.values);
-
- // We got all the scripts, it's safe to callback.
- window.clearInterval(intervalID);
- callback(data);
- }, 100);
- }
-
- function switchScript(index)
- {
- gView.Sources.selectedValue = gView.Sources.values[index];
- }
-
- function reloadPage()
- {
- gDebuggee.location.reload();
- }
-
- registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gView = null;
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_script-switching-02.html b/browser/devtools/debugger/test/browser_dbg_script-switching-02.html
deleted file mode 100644
index 42d960a15..000000000
--- a/browser/devtools/debugger/test/browser_dbg_script-switching-02.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Script Switching Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript" src="test-script-switching-01.js"></script>
- <script type="text/javascript" src="test-script-switching-02.js?foo=bar,baz|lol"></script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_script-switching.html b/browser/devtools/debugger/test/browser_dbg_script-switching.html
deleted file mode 100644
index a09789d12..000000000
--- a/browser/devtools/debugger/test/browser_dbg_script-switching.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Script Switching Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript" src="test-script-switching-01.js"></script>
- <script type="text/javascript" src="test-script-switching-02.js"></script>
- </head>
- <body>
- <button onclick="firstCall()">Click me!</button>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js
deleted file mode 100644
index a057c5aa4..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js
+++ /dev/null
@@ -1,304 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests basic functionality of scripts filtering (token search and line jump).
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchBox = null;
-
-function test()
-{
- requestLongerTimeout(2);
-
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testScriptSearching();
- });
- });
-}
-
-function testScriptSearching() {
- let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText");
- let token = "";
-
- Services.tm.currentThread.dispatch({ run: function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- write(":12");
- ok(gEditor.getCaretPosition().line == 11 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
-
- EventUtils.synthesizeKey("g", { metaKey: true }, gDebugger);
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after Meta+G");
-
- EventUtils.synthesizeKey("n", { ctrlKey: true }, gDebugger);
- ok(gEditor.getCaretPosition().line == 13 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after Ctrl+N");
-
- EventUtils.synthesizeKey("G", { metaKey: true, shiftKey: true }, gDebugger);
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after Meta+Shift+G");
-
- EventUtils.synthesizeKey("p", { ctrlKey: true }, gDebugger);
- ok(gEditor.getCaretPosition().line == 11 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after Ctrl+P");
-
- for (let i = 0; i < 100; i++) {
- EventUtils.sendKey("DOWN", gDebugger);
- }
- ok(gEditor.getCaretPosition().line == 32 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after multiple DOWN keys");
-
- for (let i = 0; i < 100; i++) {
- EventUtils.sendKey("UP", gDebugger);
- }
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line after multiple UP keys");
-
-
- token = "debugger";
- write("#" + token);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor didn't jump to the correct token. (1)");
-
- EventUtils.sendKey("DOWN", gDebugger);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (2)");
-
- EventUtils.sendKey("DOWN", gDebugger);
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 8 + token.length,
- "The editor didn't jump to the correct token. (3)");
-
- EventUtils.sendKey("RETURN", gDebugger);
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4 + token.length,
- "The editor didn't jump to the correct token. (4)");
-
- EventUtils.sendKey("ENTER", gDebugger);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor didn't jump to the correct token. (5)");
-
- EventUtils.sendKey("UP", gDebugger);
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4 + token.length,
- "The editor didn't jump to the correct token. (5.1)");
-
-
- token = "debugger;";
- write(":bogus#" + token);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (6)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write(":13#" + token);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (7)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write(":#" + token);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (8)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("::#" + token);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (9)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write(":::#" + token);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (10)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
-
- write("#" + token + ":bogus");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (6)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("#" + token + ":13");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (7)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("#" + token + ":");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (8)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("#" + token + "::");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (9)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("#" + token + ":::");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (10)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
-
- write(":i am not a number");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't remain at the correct token. (11)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- write("#__i do not exist__");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't remain at the correct token. (12)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
-
- token = "debugger";
- write("#" + token);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor didn't jump to the correct token. (12.1)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- clear();
- EventUtils.sendKey("RETURN", gDebugger);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor shouldn't jump to another token. (12.2)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- EventUtils.sendKey("ENTER", gDebugger);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor shouldn't jump to another token. (12.3)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
-
- write(":1:2:3:a:b:c:::12");
- ok(gEditor.getCaretPosition().line == 11 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line. (13)");
-
- write("#don't#find#me#instead#find#" + token);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor didn't jump to the correct token. (14)");
-
- EventUtils.sendKey("DOWN", gDebugger);
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2 + token.length,
- "The editor didn't jump to the correct token. (15)");
-
- EventUtils.sendKey("DOWN", gDebugger);
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 8 + token.length,
- "The editor didn't jump to the correct token. (16)");
-
- EventUtils.sendKey("RETURN", gDebugger);
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4 + token.length,
- "The editor didn't jump to the correct token. (17)");
-
- EventUtils.sendKey("ENTER", gDebugger);
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44 + token.length,
- "The editor didn't jump to the correct token. (18)");
-
- EventUtils.sendKey("UP", gDebugger);
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4 + token.length,
- "The editor didn't jump to the correct token. (18.1)");
-
-
- clear();
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4 + token.length,
- "The editor didn't remain at the correct token. (19)");
- is(gSources.visibleItems.length, 1,
- "Not all the scripts are shown after the search. (20)");
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice that matches are found.");
-
- closeDebuggerAndFinish();
- }}, 0);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js
deleted file mode 100644
index c9b601334..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js
+++ /dev/null
@@ -1,267 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests basic functionality of scripts filtering (file search).
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- firstSearch();
- });
-}
-
-function firstSearch() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 4 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line. (1)");
- is(gSources.visibleItems.length, 1,
- "Not all the correct scripts are shown after the search. (1)");
-
- secondSearch();
- });
- } else {
- ok(false, "Get off my lawn.");
- }
- });
- write(".*-01\.js:5");
-}
-
-function secondSearch() {
- let token = "deb";
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- append("#" + token);
-
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length,
- "The editor didn't jump to the correct line. (2)");
- is(gSources.visibleItems.length, 1,
- "Not all the correct scripts are shown after the search. (2)");
-
- waitForFirstScript();
- });
- } else {
- ok(false, "Get off my lawn.");
- }
- });
- gSources.selectedIndex = 1;
-}
-
-function waitForFirstScript() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- thirdSearch();
- });
- }
- });
- gSources.selectedIndex = 0;
-}
-
-function thirdSearch() {
- let token = "deb";
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length,
- "The editor didn't jump to the correct line. (3)");
- is(gSources.visibleItems.length, 1,
- "Not all the correct scripts are shown after the search. (3)");
-
- fourthSearch(0, "ugger;", token);
- });
- } else {
- ok(false, "Get off my lawn.");
- }
- });
- write(".*-02\.js#" + token);
-}
-
-function fourthSearch(i, string, token) {
- info("Searchbox value: " + gSearchBox.value);
-
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length + i,
- "The editor didn't remain at the correct token. (4)");
-
- if (string[i]) {
- EventUtils.sendChar(string[i], gDebugger);
- fourthSearch(i + 1, string, token);
- return;
- }
-
- clear();
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length + i,
- "The editor didn't remain at the correct token. (5)");
-
- executeSoon(function() {
- let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText");
-
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the searchbox was emptied.");
- is(gSources.selectedIndex, 1,
- "The scripts container should have retained its selected index after the searchbox was emptied.");
-
- write("BOGUS");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length + i,
- "The editor didn't remain at the correct token. (6)");
-
- is(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should display a notice that no scripts match the searched token.");
- is(gSources.visibleItems.length, 0,
- "No scripts should be displayed in the scripts container after a bogus search.");
- is(gSources.selectedIndex, 1,
- "The scripts container should retain its selected index after a bogus search.");
-
- clear();
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length + i,
- "The editor didn't remain at the correct token. (7)");
-
- isnot(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should not display a notice after the searchbox was emptied.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the searchbox was emptied.");
- is(gSources.selectedIndex, 1,
- "The scripts container should have retained its selected index after the searchbox was emptied of a bogus search.");
-
- noMatchingSourcesSingleCharCheck(token, i);
- });
-}
-
-function noMatchingSourcesSingleCharCheck(token, i) {
- let noMatchingSources = gDebugger.L10N.getStr("noMatchingSourcesText");
-
- write("x");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8 + token.length + i,
- "The editor didn't remain at the correct token. (8)");
-
- is(gSources.widget.getAttribute("label"), noMatchingSources,
- "The scripts container should display a notice after no matches are found.");
- is(gSources.visibleItems.length, 0,
- "No scripts should be shown after no matches are found.");
- is(gSources.selectedIndex, 1,
- "The scripts container should have retained its selected index after no matches are found.");
-
- closeDebuggerAndFinish();
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js
deleted file mode 100644
index 6e7380ef5..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-03.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests basic functionality of global search (lowercase + upper case, expected
- * UI behavior, number of results found etc.)
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- firstSearch();
- });
-}
-
-function firstSearch() {
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes yet.");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible yet.");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible yet.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor shouldn't have jumped to a matching line yet.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the global search.");
-
- let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results");
- is(scriptResults.length, 2,
- "There should be matches found in two scripts.");
-
- let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]);
- let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]);
- is(item0.instance.expanded, true,
- "The first script results should automatically be expanded.")
- is(item1.instance.expanded, false,
- "The second script results should not be automatically expanded.")
-
- let searchResult0 = scriptResults[0].querySelectorAll(".dbg-search-result");
- let searchResult1 = scriptResults[1].querySelectorAll(".dbg-search-result");
- is(searchResult0.length, 1,
- "There should be one line result for the first url.");
- is(searchResult1.length, 2,
- "There should be two line results for the second url.");
-
- let firstLine0 = searchResult0[0];
- is(firstLine0.querySelector(".dbg-results-line-number").getAttribute("value"), "1",
- "The first result for the first script doesn't have the correct line attached.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents").length, 1,
- "The first result for the first script doesn't have the correct number of nodes for a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string").length, 3,
- "The first result for the first script doesn't have the correct number of strings in a line.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1,
- "The first result for the first script doesn't have the correct number of matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de",
- "The first result for the first script doesn't have the correct match in a line.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2,
- "The first result for the first script doesn't have the correct number of non-matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is ",
- "The first result for the first script doesn't have the correct non-matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "dicated to the Public Domain.",
- "The first result for the first script doesn't have the correct non-matches in a line.");
-
- let firstLine1 = searchResult1[0];
- is(firstLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "1",
- "The first result for the second script doesn't have the correct line attached.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents").length, 1,
- "The first result for the second script doesn't have the correct number of nodes for a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string").length, 3,
- "The first result for the second script doesn't have the correct number of strings in a line.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1,
- "The first result for the second script doesn't have the correct number of matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de",
- "The first result for the second script doesn't have the correct match in a line.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2,
- "The first result for the second script doesn't have the correct number of non-matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is ",
- "The first result for the second script doesn't have the correct non-matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "dicated to the Public Domain.",
- "The first result for the second script doesn't have the correct non-matches in a line.");
-
- let secondLine1 = searchResult1[1];
- is(secondLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "6",
- "The second result for the second script doesn't have the correct line attached.");
-
- is(secondLine1.querySelectorAll(".dbg-results-line-contents").length, 1,
- "The second result for the second script doesn't have the correct number of nodes for a line.");
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string").length, 3,
- "The second result for the second script doesn't have the correct number of strings in a line.");
-
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 1,
- "The second result for the second script doesn't have the correct number of matches in a line.");
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "de",
- "The second result for the second script doesn't have the correct match in a line.");
-
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 2,
- "The second result for the second script doesn't have the correct number of non-matches in a line.");
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), ' eval("',
- "The second result for the second script doesn't have the correct non-matches in a line.");
- is(secondLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), 'bugger;");',
- "The second result for the second script doesn't have the correct non-matches in a line.");
-
-
- secondSearch();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!de");
- });
-}
-
-function secondSearch() {
- isnot(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane should have some child nodes from the previous search.");
- is(gSearchView.widget._parent.hidden, false,
- "The global search pane should be visible from the previous search.");
- is(gSearchView._splitter.hidden, false,
- "The global search pane splitter should be visible from the previous search.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor shouldn't have jumped to a matching line yet.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the global search.");
-
- let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results");
- is(scriptResults.length, 2,
- "There should be matches found in two scripts.");
-
- let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]);
- let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]);
- is(item0.instance.expanded, true,
- "The first script results should automatically be expanded.")
- is(item1.instance.expanded, false,
- "The first script results should not be automatically expanded.")
-
- let searchResult0 = scriptResults[0].querySelectorAll(".dbg-search-result");
- let searchResult1 = scriptResults[1].querySelectorAll(".dbg-search-result");
- is(searchResult0.length, 1,
- "There should be one line result for the first url.");
- is(searchResult1.length, 1,
- "There should be one line result for the second url.");
-
- let firstLine0 = searchResult0[0];
- is(firstLine0.querySelector(".dbg-results-line-number").getAttribute("value"), "1",
- "The first result for the first script doesn't have the correct line attached.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents").length, 1,
- "The first result for the first script doesn't have the correct number of nodes for a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string").length, 5,
- "The first result for the first script doesn't have the correct number of strings in a line.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 2,
- "The first result for the first script doesn't have the correct number of matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "ed",
- "The first result for the first script doesn't have the correct matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=true]")[1].getAttribute("value"), "ed",
- "The first result for the first script doesn't have the correct matches in a line.");
-
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 3,
- "The first result for the first script doesn't have the correct number of non-matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is d",
- "The first result for the first script doesn't have the correct non-matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "icat",
- "The first result for the first script doesn't have the correct non-matches in a line.");
- is(firstLine0.querySelectorAll(".dbg-results-line-contents-string[match=false]")[2].getAttribute("value"), " to the Public Domain.",
- "The first result for the first script doesn't have the correct non-matches in a line.");
-
- let firstLine1 = searchResult1[0];
- is(firstLine1.querySelector(".dbg-results-line-number").getAttribute("value"), "1",
- "The first result for the second script doesn't have the correct line attached.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents").length, 1,
- "The first result for the second script doesn't have the correct number of nodes for a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string").length, 5,
- "The first result for the second script doesn't have the correct number of strings in a line.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]").length, 2,
- "The first result for the second script doesn't have the correct number of matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[0].getAttribute("value"), "ed",
- "The first result for the second script doesn't have the correct matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=true]")[1].getAttribute("value"), "ed",
- "The first result for the second script doesn't have the correct matches in a line.");
-
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]").length, 3,
- "The first result for the second script doesn't have the correct number of non-matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[0].getAttribute("value"), "/* Any copyright is d",
- "The first result for the second script doesn't have the correct non-matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[1].getAttribute("value"), "icat",
- "The first result for the second script doesn't have the correct non-matches in a line.");
- is(firstLine1.querySelectorAll(".dbg-results-line-contents-string[match=false]")[2].getAttribute("value"), " to the Public Domain.",
- "The first result for the second script doesn't have the correct non-matches in a line.");
-
-
- testClearView();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- backspace(2);
- append("ED");
- });
-}
-
-function testClearView() {
- gSearchView.clearView();
-
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes after clearView().");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible after clearView().");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible after clearView().");
-
- closeDebuggerAndFinish();
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js
deleted file mode 100644
index 55278f437..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-04.js
+++ /dev/null
@@ -1,285 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests if the global search results switch back and forth, and wrap around
- * when switching between them.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- doSearch();
- });
-}
-
-function doSearch() {
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes yet.");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible yet.");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible yet.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor shouldn't have jumped to a matching line yet.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the global search.");
-
- isnot(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane should be visible now.");
- isnot(gSearchView.widget._parent.hidden, true,
- "The global search pane should be visible now.");
- isnot(gSearchView._splitter.hidden, true,
- "The global search pane splitter should be visible now.");
-
- doFirstJump();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!eval");
- });
-}
-
-function doFirstJump() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 4 &&
- gEditor.getCaretPosition().col == 6,
- "The editor didn't jump to the correct line. (1)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (1)");
-
- doSecondJump();
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
- executeSoon(function() {
- EventUtils.sendKey("DOWN", gDebugger);
- });
-}
-
-function doSecondJump() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 6,
- "The editor didn't jump to the correct line. (2)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (2)");
-
- doWrapAroundJump();
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
- executeSoon(function() {
- EventUtils.sendKey("RETURN", gDebugger);
- });
-}
-
-function doWrapAroundJump() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 4 &&
- gEditor.getCaretPosition().col == 6,
- "The editor didn't jump to the correct line. (3)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (3)");
-
- doBackwardsWrapAroundJump();
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
- executeSoon(function() {
- EventUtils.sendKey("ENTER", gDebugger);
- });
-}
-
-function doBackwardsWrapAroundJump() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 6,
- "The editor didn't jump to the correct line. (4)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (4)");
-
- testSearchTokenEmpty();
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
- executeSoon(function() {
- EventUtils.sendKey("UP", gDebugger);
- });
-}
-
-function testSearchTokenEmpty() {
- gDebugger.addEventListener("Debugger:GlobalSearch:TokenEmpty", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 6,
- "The editor didn't remain at the correct line. (5)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (5)");
-
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes after clear().");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible after clear().");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible after clear().");
-
- closeDebuggerAndFinish();
- });
- } else {
- ok(false, "How did you get here? Go away!");
- }
- });
- backspace(4);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function backspace(times) {
- for (let i = 0; i < times; i++) {
- EventUtils.sendKey("BACK_SPACE", gDebugger);
- }
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js
deleted file mode 100644
index d8c33b425..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-05.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests if the global search results are cleared on location changes, and
- * the expected UI behaviors are triggered.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- requestLongerTimeout(3);
-
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- doSearch();
- });
-}
-
-function doSearch() {
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes yet.");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible yet.");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible yet.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor shouldn't have jumped to a matching line yet.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the global search.");
-
- isnot(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane should be visible now.");
- isnot(gSearchView.widget._parent.hidden, true,
- "The global search pane should be visible now.");
- isnot(gSearchView._splitter.hidden, true,
- "The global search pane splitter should be visible now.");
-
- testLocationChange();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!eval");
- });
-}
-
-function testLocationChange()
-{
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired after location change.");
- info("Still attached to the tab.");
-
- executeSoon(function() {
- is(gSearchView.widget._list.childNodes.length, 0,
- "The global search pane shouldn't have any child nodes after a page navigation.");
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible after a page navigation.");
- is(gSearchView._splitter.hidden, true,
- "The global search pane splitter shouldn't be visible after a page navigation.");
-
- closeDebuggerAndFinish();
- });
- });
-
- content.location = TAB1_URL;
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js
deleted file mode 100644
index 46422d1f0..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-06.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests if the global search results trigger MatchFound and NoMatchFound events
- * properly, and triggers the expected UI behavior.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- doSearch();
- });
-}
-
-function doSearch() {
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor shouldn't have jumped to a matching line yet.");
- is(gSources.visibleItems.length, 2,
- "Not all the scripts are shown after the global search.");
-
- testSearchMatchNotFound();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!eval");
- });
-}
-
-function testSearchMatchNotFound() {
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchNotFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't remain at the correct line.");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search.");
-
- closeDebuggerAndFinish();
- });
- } else {
- ok(false, "How did you get here? Go away!");
- }
- });
- append("/punch him/");
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js
deleted file mode 100644
index e393db433..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-07.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests if the global search results are expanded on scroll or click, and
- * clicking matches makes the source editor shows the correct script and
- * makes a selection based on the match.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- doSearch();
-}
-
-function doSearch() {
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- continueTest();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!a");
- });
-}
-
-function continueTest() {
- let scriptResults = gDebugger.document.querySelectorAll(".dbg-source-results");
- is(scriptResults.length, 2,
- "There should be matches found in two scripts.");
-
- testScrollToExpand(scriptResults);
- testExpandCollapse(scriptResults);
- testAdditionalScrollToExpand(scriptResults);
- testClickLineToJump(scriptResults, [testClickMatchToJump, closeDebuggerAndFinish]);
-}
-
-function testScrollToExpand(scriptResults) {
- let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]);
- let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]);
-
- is(item0.instance.expanded, true,
- "The first script results should automatically be expanded.");
- is(item1.instance.expanded, false,
- "The first script results should not be automatically expanded.");
-
- gSearchView._forceExpandResults = true;
- gSearchView._onScroll();
-
- is(item0.instance.expanded, true,
- "The first script results should be expanded after scrolling.");
- is(item1.instance.expanded, true,
- "The second script results should be expanded after scrolling.");
-}
-
-function testExpandCollapse(scriptResults) {
- let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]);
- let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]);
- let firstHeader = scriptResults[0].querySelector(".dbg-results-header");
- let secondHeader = scriptResults[1].querySelector(".dbg-results-header");
-
- EventUtils.sendMouseEvent({ type: "click" }, firstHeader);
- EventUtils.sendMouseEvent({ type: "click" }, secondHeader);
-
- is(item0.instance.expanded, false,
- "The first script results should be collapsed on click.")
- is(item1.instance.expanded, false,
- "The second script results should be collapsed on click.")
-
- EventUtils.sendMouseEvent({ type: "click" }, firstHeader);
- EventUtils.sendMouseEvent({ type: "click" }, secondHeader);
-
- is(item0.instance.expanded, true,
- "The first script results should be expanded on an additional click.");
- is(item1.instance.expanded, true,
- "The second script results should be expanded on an additional click.");
-}
-
-function testAdditionalScrollToExpand(scriptResults) {
- let item0 = gDebugger.SourceResults.getItemForElement(scriptResults[0]);
- let item1 = gDebugger.SourceResults.getItemForElement(scriptResults[1]);
- let firstHeader = scriptResults[0].querySelector(".dbg-results-header");
- let secondHeader = scriptResults[1].querySelector(".dbg-results-header");
-
- EventUtils.sendMouseEvent({ type: "click" }, firstHeader);
- EventUtils.sendMouseEvent({ type: "click" }, secondHeader);
-
- is(item0.instance.expanded, false,
- "The first script results should be recollapsed on click.")
- is(item1.instance.expanded, false,
- "The second script results should be recollapsed on click.")
-
- gSearchView._onScroll();
-
- is(item0.instance.expanded, false,
- "The first script results should not be automatically re-expanded on scroll after a user collapsed them.")
- is(item1.instance.expanded, false,
- "The second script results should not be automatically re-expanded on scroll after a user collapsed them.")
-}
-
-function testClickLineToJump(scriptResults, callbacks) {
- let targetResults = scriptResults[0];
- let firstHeader = targetResults.querySelector(".dbg-results-header");
- let firstHeaderItem = gDebugger.SourceResults.getItemForElement(firstHeader);
- firstHeaderItem.instance.expand()
-
- is(firstHeaderItem.instance.expanded, true,
- "The first script results should be expanded after direct function call.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 4,
- "The editor didn't jump to the correct line. (1)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (1)");
-
- callbacks[0](scriptResults, callbacks.slice(1));
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
-
- let firstLine = targetResults.querySelector(".dbg-results-line-contents");
- EventUtils.sendMouseEvent({ type: "click" }, firstLine);
-}
-
-function testClickMatchToJump(scriptResults, callbacks) {
- let targetResults = scriptResults[1];
- let secondHeader = targetResults.querySelector(".dbg-results-header");
- let secondHeaderItem = gDebugger.SourceResults.getItemForElement(secondHeader);
- secondHeaderItem.instance.expand()
-
- is(secondHeaderItem.instance.expanded, true,
- "The second script results should be expanded after direct function call.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + aEvent.detail.url + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 5,
- "The editor didn't jump to the correct line. (1)");
- is(gSources.visibleItems.length, 2,
- "Not all the correct scripts are shown after the search. (1)");
-
- callbacks[0]();
- });
- } else {
- ok(false, "We jumped in a bowl of hot lava (aka WRONG MATCH). That was bad for us.");
- }
- });
-
- let matches = targetResults.querySelectorAll(".dbg-results-line-contents-string[match=true]");
- let lastMatch = matches[matches.length - 1];
- EventUtils.sendMouseEvent({ type: "click" }, lastMatch);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js
deleted file mode 100644
index 70809fa69..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-08.js
+++ /dev/null
@@ -1,208 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-/**
- * Tests if the global search results are hidden when they're supposed to
- * (after a focus lost, or when ESCAPE is pressed).
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchView = null;
-var gSearchBox = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gDebugger.SourceResults.prototype.alwaysExpand = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchView = gDebugger.DebuggerView.GlobalSearch;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
-
- doSearch();
-}
-
-function doSearch() {
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible yet.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- testFocusLost();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global search.");
- }
- });
- executeSoon(function() {
- write("!a");
- });
-}
-
-function testFocusLost()
-{
- is(gSearchView.widget._parent.hidden, false,
- "The global search pane should be visible after a search.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- reshowSearch();
- });
- } else {
- ok(false, "The current script shouldn't have changed after the global search stopped.");
- }
- });
- executeSoon(function() {
- gDebugger.DebuggerView.editor.focus();
- });
-}
-
-function reshowSearch() {
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible after the search was stopped.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:MatchFound", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- testEscape();
- });
- } else {
- ok(false, "The current script shouldn't have changed after a global re-search.");
- }
- });
- executeSoon(function() {
- sendEnter();
- });
-}
-
-function testEscape()
-{
- is(gSearchView.widget._parent.hidden, false,
- "The global search pane should be visible after a re-search.");
-
- gDebugger.addEventListener("Debugger:GlobalSearch:ViewCleared", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("-02.js") != -1) {
- executeSoon(function() {
- finalCheck();
- });
- } else {
- ok(false, "The current script shouldn't have changed after the global search escaped.");
- }
- });
- executeSoon(function() {
- sendEscape();
- });
-}
-
-function finalCheck()
-{
- is(gSearchView.widget._parent.hidden, true,
- "The global search pane shouldn't be visible after the search was escaped.");
-
- closeDebuggerAndFinish();
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function sendEnter() {
- gSearchBox.focus();
- EventUtils.sendKey("ENTER", gDebugger);
-}
-
-function sendEscape() {
- gSearchBox.focus();
- EventUtils.sendKey("ESCAPE", gDebugger);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchView = null;
- gSearchBox = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js
deleted file mode 100644
index d688c6c1e..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-files_ui.js
+++ /dev/null
@@ -1,693 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html";
-
-/**
- * Tests basic functionality of scripts filtering (file search) helper UI.
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gSources = null;
-var gSearchBox = null;
-var gFilteredSources = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- });
- });
-}
-
-function testScriptSearching() {
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
- gFilteredSources = gDebugger.DebuggerView.FilteredSources;
-
- firstSearch();
-}
-
-function firstSearch() {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- for (let i = 0; i < gFilteredSources.itemCount; i++) {
- is(gFilteredSources.labels[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.labels[i]),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.values[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.values[i], 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].label,
- gDebugger.SourceUtils.trimUrlLength(gSources.labels[i]),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].value,
- gDebugger.SourceUtils.trimUrlLength(gSources.values[i], 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.labels[i],
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.values[i],
- "The filtered sources view should have the correct values.");
- }
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("update-editor-mode.html") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- secondSearch();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- write(".");
-}
-
-function secondSearch() {
- let sourceshown = false;
- let popupshown = false;
- let proceeded = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent1);
- sourceshown = true;
- executeSoon(proceed);
- });
- gDebugger.addEventListener("popupshown", function _onEvent2(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent2);
- popupshown = true;
- executeSoon(proceed);
- });
-
- function proceed() {
- if (!sourceshown || !popupshown || proceeded) {
- return;
- }
- proceeded = true;
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 1,
- "The filtered sources view should have 1 items available.");
- is(gFilteredSources.visibleItems.length, 1,
- "The filtered sources view should have 1 items visible.");
-
- for (let i = 0; i < gFilteredSources.itemCount; i++) {
- is(gFilteredSources.labels[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.values[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].label,
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].value,
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.visibleItems[i].label,
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.visibleItems[i].value,
- "The filtered sources view should have the correct values.");
- }
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 1,
- "Not all the correct scripts are shown after the search.");
-
- thirdSearch();
- });
- } else {
- ok(false, "How did you get here?");
- }
- }
- write(".-0");
-}
-
-function thirdSearch() {
- let sourceshown = false;
- let popupshown = false;
- let proceeded = false;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent1(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent1);
- sourceshown = true;
- executeSoon(proceed);
- });
- gDebugger.addEventListener("popupshown", function _onEvent2(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent2);
- popupshown = true;
- executeSoon(proceed);
- });
-
- function proceed() {
- if (!sourceshown || !popupshown || proceeded) {
- return;
- }
- proceeded = true;
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- for (let i = 0; i < gFilteredSources.itemCount; i++) {
- is(gFilteredSources.labels[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.values[i],
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].label,
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].label),
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].value,
- gDebugger.SourceUtils.trimUrlLength(gSources.visibleItems[i].value, 0, "start"),
- "The filtered sources view should have the correct values.");
-
- is(gFilteredSources.visibleItems[i].attachment.fullLabel, gSources.visibleItems[i].label,
- "The filtered sources view should have the correct labels.");
- is(gFilteredSources.visibleItems[i].attachment.fullValue, gSources.visibleItems[i].value,
- "The filtered sources view should have the correct values.");
- }
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("update-editor-mode.html") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- goDown();
- });
- } else {
- ok(false, "How did you get here?");
- }
- }
- write(".-");
-}
-
-function goDown() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-editor-mode") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- goDownAgain();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.sendKey("DOWN", gDebugger);
-}
-
-function goDownAgain() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- goDownAndWrap();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.synthesizeKey("g", { metaKey: true }, gDebugger);
-}
-
-function goDownAndWrap() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("update-editor-mode.html") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- goUpAndWrap();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.synthesizeKey("n", { ctrlKey: true }, gDebugger);
-}
-
-function goUpAndWrap() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- clickAndSwitch();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.sendKey("UP", gDebugger);
-}
-
-function clickAndSwitch() {
- let sourceshown = false;
- let popuphidden = false;
- let popupshown = false;
- let reopened = false;
- let proceeded = false;
-
- gDebugger.addEventListener("popuphidden", function _onEvent2(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent2);
- info("Popup was hidden...");
- popuphidden = true;
-
- gDebugger.addEventListener("popupshown", function _onEvent3(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent3);
- info("Popup was shown...");
- popupshown = true;
-
- proceed();
- });
-
- reopen();
- });
-
- function reopen() {
- if (!sourceshown || !popuphidden || reopened) {
- return;
- }
- info("Reopening popup...");
- reopened = true;
- append(".-");
- }
-
- function proceed() {
- if (!sourceshown || !popuphidden || !popupshown || proceeded) {
- return;
- }
- info("Proceeding with next test...");
- proceeded = true;
- executeSoon(clickAndSwitchAgain);
- }
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("update-editor-mode.html") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- info("Source was shown and verified");
- sourceshown = true;
- reopen();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
-
- ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0]
- .classList.contains("results-panel-item"),
- "The first visible item target isn't the correct one.");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[0],
- gDebugger);
-}
-
-function clickAndSwitchAgain() {
- let sourceshown = false;
- let popuphidden = false;
- let popupshown = false;
- let reopened = false;
- let proceeded = false;
-
- gDebugger.addEventListener("popuphidden", function _onEvent2(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent2);
- info("Popup was hidden...");
- popuphidden = true;
-
- gDebugger.addEventListener("popupshown", function _onEvent3(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent3);
- info("Popup was shown...");
- popupshown = true;
-
- proceed();
- });
-
- reopen();
- });
-
- function reopen() {
- if (!sourceshown || !popuphidden || reopened) {
- return;
- }
- info("Reopening popup...");
- reopened = true;
- append(".-");
- }
-
- function proceed() {
- if (!sourceshown || !popuphidden || !popupshown || proceeded) {
- return;
- }
- info("Proceeding with next test...");
- proceeded = true;
- executeSoon(switchFocusWithEscape);
- }
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- is(gFilteredSources.itemCount, 3,
- "The filtered sources view should have 3 items available.");
- is(gFilteredSources.visibleItems.length, 3,
- "The filtered sources view should have 3 items visible.");
-
- is(gFilteredSources.selectedValue,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedValue, 0, "start"),
- "The correct item should be selected in the filtered sources view");
- is(gFilteredSources.selectedLabel,
- gDebugger.SourceUtils.trimUrlLength(gSources.selectedLabel),
- "The correct item should be selected in the filtered sources view");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- info("Source was shown and verified");
- sourceshown = true;
- reopen();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
-
- ok(gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2]
- .classList.contains("results-panel-item"),
- "The first visible item target isn't the correct one.");
-
- EventUtils.sendMouseEvent({ type: "click" },
- gFilteredSources.widget._parent.querySelectorAll(".results-panel-item")[2],
- gDebugger);
-}
-
-function switchFocusWithEscape() {
- gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("update-editor-mode.html") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- focusAgainAfterEscape();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.sendKey("ESCAPE", gDebugger);
-}
-
-function focusAgainAfterEscape() {
- gDebugger.addEventListener("popupshown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 1,
- "Not all the correct scripts are shown after the search.");
-
- switchFocusWithReturn();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- append("0");
-}
-
-function switchFocusWithReturn() {
- gDebugger.addEventListener("popuphidden", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
-
- info("Current script url:\n" + gSources.selectedValue + "\n");
- info("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = gSources.selectedValue;
- if (url.indexOf("test-script-switching-01.js") != -1) {
-
- executeSoon(function() {
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 0 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
- is(gSources.visibleItems.length, 3,
- "Not all the correct scripts are shown after the search.");
-
- closeDebuggerAndFinish();
- });
- } else {
- ok(false, "How did you get here?");
- }
- });
- EventUtils.sendKey("RETURN", gDebugger);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
- append(text);
-}
-
-function append(text) {
- gSearchBox.focus();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i], gDebugger);
- }
- info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gSearchBox = null;
- gFilteredSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js b/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js
deleted file mode 100644
index 0eddd95fc..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-popup.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSearchBox = null;
-var gSearchBoxPanel = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- runTest();
- });
-}
-
-function runTest() {
- gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
- gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel;
-
- focusSearchbox();
-}
-
-function focusSearchbox() {
- is(gSearchBoxPanel.state, "closed",
- "The search box panel shouldn't be visible yet.");
-
- gSearchBoxPanel.addEventListener("popupshown", function _onEvent(aEvent) {
- gSearchBoxPanel.removeEventListener(aEvent.type, _onEvent);
-
- is(gSearchBoxPanel.state, "open",
- "The search box panel should be visible after searching started.");
-
- closeDebuggerAndFinish();
- });
-
- EventUtils.sendMouseEvent({ type: "click" }, gSearchBox);
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSearchBox = null;
- gSearchBoxPanel = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js b/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js
deleted file mode 100644
index 821d285cb..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
- resumeAndFinish();
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-function resumeAndFinish() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- checkScriptsOrder();
- addScriptAndCheckOrder(1, function() {
- addScriptAndCheckOrder(2, function() {
- addScriptAndCheckOrder(3, function() {
- closeDebuggerAndFinish();
- });
- });
- });
- });
-}
-
-function addScriptAndCheckOrder(method, callback) {
- let sv = gDebugger.SourceUtils;
- let vs = gDebugger.DebuggerView.Sources;
- vs.empty();
- vs.widget.removeEventListener("select", vs._onScriptsChange, false);
-
- let urls = [
- { href: "ici://some.address.com/random/", leaf: "subrandom/" },
- { href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
- { href: "san://interesting.address.gro/random/", leaf: "script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "x/script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
- { href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" },
- { href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }
- ];
-
- urls.sort(function(a, b) {
- return Math.random() - 0.5;
- });
-
- switch (method) {
- case 1:
- urls.forEach(function(url) {
- let loc = url.href + url.leaf;
- vs.push([sv.getSourceLabel(loc), { url: loc }], { staged: true });
- });
- vs.commit({ sorted: true });
- break;
-
- case 2:
- urls.forEach(function(url) {
- let loc = url.href + url.leaf;
- vs.push([sv.getSourceLabel(loc), { url: loc }]);
- });
- break;
-
- case 3:
- let i = 0
- for (; i < urls.length / 2; i++) {
- let url = urls[i];
- let loc = url.href + url.leaf;
- vs.push([sv.getSourceLabel(loc), { url: loc }], { staged: true });
- }
- vs.commit({ sorted: true });
-
- for (; i < urls.length; i++) {
- let url = urls[i];
- let loc = url.href + url.leaf;
- vs.push([sv.getSourceLabel(loc), { url: loc }]);
- }
- break;
- }
-
- executeSoon(function() {
- checkScriptsOrder(method);
- callback();
- });
-}
-
-function checkScriptsOrder(method) {
- let labels = gDebugger.DebuggerView.Sources.labels;
- let sorted = labels.reduce(function(prev, curr, index, array) {
- return array[index - 1] < array[index];
- });
-
- ok(sorted,
- "Using method " + method + ", " +
- "the scripts weren't in the correct order: " + labels.toSource());
-
- return sorted;
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js
deleted file mode 100644
index b444ae100..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching-02.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that switching the displayed script in the UI works as advertised
- * when urls are escaped.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching-02.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSources = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
- }
- }
-}
-
-function testScriptsDisplay() {
- gSources = gDebugger.DebuggerView.Sources;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 2,
- "Found the expected number of scripts.");
-
- for (let i = 0; i < gSources.itemCount; i++) {
- info("label: " + i + " " + gSources.getItemAtIndex(i).target.getAttribute("label"));
- }
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
- let params = "?foo=bar,baz|lol";
-
- ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL +
- label1), "First script url is incorrect.");
- ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL +
- label2 + params), "Second script url is incorrect.");
-
- ok(gDebugger.DebuggerView.Sources.containsLabel(
- label1), "First script label is incorrect.");
- ok(gDebugger.DebuggerView.Sources.containsLabel(
- label2), "Second script label is incorrect.");
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label2, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label2 + params, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The correct script was loaded initially.");
-
- is(gDebugger.editor.getDebugLocation(), 5,
- "Editor debugger location is correct.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitch1();
- }
- });
-
- gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label1;
-}
-
-function testSwitch1() {
- dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
- let params = "?foo=bar,baz|lol";
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label1, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label1, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) == -1,
- "The second script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) != -1,
- "The first script is displayed.");
-
- is(gDebugger.editor.getDebugLocation(), -1,
- "Editor debugger location has been cleared.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitch2();
- }
- });
-
- gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label2 + params;
-}
-
-function testSwitch2() {
- dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
- let params = "?foo=bar,baz|lol";
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label2, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label2 + params, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The correct script was loaded initially.");
-
- is(gDebugger.editor.getDebugLocation(), 5,
- "Editor debugger location is correct.");
-
- closeDebuggerAndFinish();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_scripts-switching.js b/browser/devtools/debugger/test/browser_dbg_scripts-switching.js
deleted file mode 100644
index e291bf7c9..000000000
--- a/browser/devtools/debugger/test/browser_dbg_scripts-switching.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that switching the displayed script in the UI works as advertised.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSources = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent)
- {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
- }
- }
-}
-
-function testScriptsDisplay() {
- gSources = gDebugger.DebuggerView.Sources;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 2,
- "Found the expected number of scripts.");
-
- for (let i = 0; i < gSources.itemCount; i++) {
- info("label: " + i + " " + gSources.getItemAtIndex(i).target.getAttribute("label"));
- }
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
-
- ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL +
- label1), "First script url is incorrect.");
- ok(gDebugger.DebuggerView.Sources.containsValue(EXAMPLE_URL +
- label2), "Second script url is incorrect.");
-
- ok(gDebugger.DebuggerView.Sources.containsLabel(
- label1), "First script label is incorrect.");
- ok(gDebugger.DebuggerView.Sources.containsLabel(
- label2), "Second script label is incorrect.");
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label2, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label2, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The correct script was loaded initially.");
-
- is(gDebugger.editor.getDebugLocation(), 5,
- "editor debugger location is correct.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitchPaused();
- }
- });
-
- gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label1;
-}
-
-function testSwitchPaused()
-{
- dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label1, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label1, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) == -1,
- "The second script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) != -1,
- "The first script is displayed.");
-
- is(gDebugger.editor.getDebugLocation(), -1,
- "Editor debugger location has been cleared.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitchRunning();
- }
- });
-
- gDebugger.DebuggerView.Sources.selectedValue = EXAMPLE_URL + label2;
- });
-}
-
-function testSwitchRunning()
-{
- dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
-
- let label1 = "test-script-switching-01.js";
- let label2 = "test-script-switching-02.js";
-
- ok(gDebugger.DebuggerView.Sources.selectedItem,
- "There should be a selected item in the sources pane.");
- is(gDebugger.DebuggerView.Sources.selectedLabel,
- label2, "The selected label is the sources pane is incorrect.");
- is(gDebugger.DebuggerView.Sources.selectedValue, EXAMPLE_URL +
- label2, "The selected value is the sources pane is incorrect.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The second script is displayed again.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) == -1,
- "The first script is no longer displayed.");
-
- is(gDebugger.editor.getDebugLocation(), -1,
- "Editor debugger location is still -1.");
-
- closeDebuggerAndFinish();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_select-line.js b/browser/devtools/debugger/test/browser_dbg_select-line.js
deleted file mode 100644
index bb18ea651..000000000
--- a/browser/devtools/debugger/test/browser_dbg_select-line.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that selecting a stack frame loads the right script in the editor
- * pane and highlights the proper line.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSources = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let testStarted = false;
- let resumed = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gSources = gDebugger.DebuggerView.Sources;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent) {
- scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: testSelectLine }, 0);
- }
- }
-}
-
-function testSelectLine() {
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 2, "Found the expected number of scripts.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The correct script was loaded initially.");
-
- // Yield control back to the event loop so that the debugger has a
- // chance to highlight the proper line.
- executeSoon(function() {
- // getCaretPosition is 0-based.
- is(gDebugger.editor.getCaretPosition().line, 5,
- "The correct line is selected.");
-
- gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, function onChange() {
- // Wait for the actual text to be shown.
- if (gDebugger.editor.getText() == gDebugger.L10N.getStr("loadingText")) {
- return;
- }
- // The requested source text has been shown, remove the event listener.
- gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onChange);
-
- ok(gDebugger.editor.getText().search(/debugger/) == -1,
- "The second script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) != -1,
- "The first script is displayed.");
-
- // Yield control back to the event loop so that the debugger has a
- // chance to highlight the proper line.
- executeSoon(function(){
- // getCaretPosition is 0-based.
- is(gDebugger.editor.getCaretPosition().line, 4,
- "The correct line is selected.");
-
- closeDebuggerAndFinish();
- });
- });
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 4,
- "Should have two frames.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- frames.querySelector("#stackframe-3"),
- gDebugger);
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_source_maps-01.js b/browser/devtools/debugger/test/browser_dbg_source_maps-01.js
deleted file mode 100644
index c8ff8aae9..000000000
--- a/browser/devtools/debugger/test/browser_dbg_source_maps-01.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test that we can set breakpoints and step through source mapped coffee
- * script.
- */
-
-const TAB_URL = EXAMPLE_URL + "binary_search.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", true);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- resumed = true;
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
- ok(aEvent.detail.url.indexOf(".coffee") != -1,
- "The debugger should show the source mapped coffee script file.");
- ok(gDebugger.editor.getText().search(/isnt/) != -1,
- "The debugger's editor should have the coffee script source displayed.");
-
- testSetBreakpoint();
- });
- });
-}
-
-function testSetBreakpoint() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.interrupt(function (aResponse) {
- activeThread.setBreakpoint({
- url: EXAMPLE_URL + "binary_search.coffee",
- line: 5
- }, function (aResponse, bpClient) {
- ok(!aResponse.error,
- "Should be able to set a breakpoint in a coffee script file.");
- testSetBreakpointBlankLine();
- });
- });
-}
-
-function testSetBreakpointBlankLine() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.setBreakpoint({
- url: EXAMPLE_URL + "binary_search.coffee",
- line: 3
- }, function (aResponse, bpClient) {
- ok(aResponse.actualLocation,
- "Because 3 is empty, we should have an actualLocation");
- is(aResponse.actualLocation.url, EXAMPLE_URL + "binary_search.coffee",
- "actualLocation.url should be source mapped to the coffee file");
- is(aResponse.actualLocation.line, 2,
- "actualLocation.line should be source mapped back to 2");
- testHitBreakpoint();
- });
-}
-
-function testHitBreakpoint() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.resume(function (aResponse) {
- ok(!aResponse.error, "Shouldn't get an error resuming");
- is(aResponse.type, "resumed", "Type should be 'resumed'");
-
- activeThread.addOneTimeListener("paused", function (aEvent, aPacket) {
- is(aPacket.type, "paused",
- "We should now be paused again");
- is(aPacket.why.type, "breakpoint",
- "and the reason we should be paused is because we hit a breakpoint");
-
- // Check that we stopped at the right place, by making sure that the
- // environment is in the state that we expect.
- is(aPacket.frame.environment.bindings.variables.start.value, 0,
- "'start' is 0");
- is(aPacket.frame.environment.bindings.variables.stop.value.type, "undefined",
- "'stop' hasn't been assigned to yet");
- is(aPacket.frame.environment.bindings.variables.pivot.value.type, "undefined",
- "'pivot' hasn't been assigned to yet");
-
- waitForCaretPos(4, testStepping);
- });
-
- // This will cause the breakpoint to be hit, and put us back in the paused
- // state.
- executeSoon(function() {
- gDebuggee.binary_search([0, 2, 3, 5, 7, 10], 5);
- });
- });
-}
-
-function testStepping() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.stepIn(function (aResponse) {
- ok(!aResponse.error, "Shouldn't get an error resuming");
- is(aResponse.type, "resumed", "Type should be 'resumed'");
-
- // After stepping, we will pause again, so listen for that.
- activeThread.addOneTimeListener("paused", function (aEvent, aPacket) {
-
- // Check that we stopped at the right place, by making sure that the
- // environment is in the state that we expect.
- is(aPacket.frame.environment.bindings.variables.start.value, 0,
- "'start' is 0");
- is(aPacket.frame.environment.bindings.variables.stop.value, 5,
- "'stop' hasn't been assigned to yet");
- is(aPacket.frame.environment.bindings.variables.pivot.value.type, "undefined",
- "'pivot' hasn't been assigned to yet");
-
- waitForCaretPos(5, closeDebuggerAndFinish);
- });
- });
-}
-
-function waitForCaretPos(number, callback)
-{
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gDebugger.DebuggerView.editor.getCaretPosition().line != number) {
- return;
- }
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-registerCleanupFunction(function() {
- Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false);
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_source_maps-02.js b/browser/devtools/debugger/test/browser_dbg_source_maps-02.js
deleted file mode 100644
index 40a5fa0bb..000000000
--- a/browser/devtools/debugger/test/browser_dbg_source_maps-02.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test that we can toggle between the original and generated sources.
- */
-
-const TAB_URL = EXAMPLE_URL + "binary_search.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gPrevPref = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let resumed = false;
- let testStarted = false;
-
- gPrevPref = Services.prefs.getBoolPref(
- "devtools.debugger.source-maps-enabled");
- Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", true);
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- resumed = true;
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
- // Show original sources should be already enabled.
- is(gPrevPref, false,
- "The source maps functionality should be disabled by default.");
- is(gDebugger.Prefs.sourceMapsEnabled, true,
- "The source maps pref should be true from startup.");
- is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"),
- "true", "Source maps should be enabled from startup. ")
-
- ok(aEvent.detail.url.indexOf(".coffee") != -1,
- "The debugger should show the source mapped coffee script file.");
- ok(aEvent.detail.url.indexOf(".js") == -1,
- "The debugger should not show the generated js script file.");
- ok(gDebugger.editor.getText().search(/isnt/) != -1,
- "The debugger's editor should have the coffee script source displayed.");
- ok(gDebugger.editor.getText().search(/function/) == -1,
- "The debugger's editor should not have the JS source displayed.");
-
- testToggleGeneratedSource();
- });
- });
-}
-
-function testToggleGeneratedSource() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
-
- is(gDebugger.Prefs.sourceMapsEnabled, false,
- "The source maps pref should have been set to false.");
- is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"),
- "false", "Source maps should be enabled from startup. ")
-
- ok(aEvent.detail.url.indexOf(".coffee") == -1,
- "The debugger should not show the source mapped coffee script file.");
- ok(aEvent.detail.url.indexOf(".js") != -1,
- "The debugger should show the generated js script file.");
- ok(gDebugger.editor.getText().search(/isnt/) == -1,
- "The debugger's editor should have the coffee script source displayed.");
- ok(gDebugger.editor.getText().search(/function/) != -1,
- "The debugger's editor should not have the JS source displayed.");
-
- testSetBreakpoint();
- });
-
- // Disable source maps.
- gDebugger.DebuggerView.Options._showOriginalSourceItem.setAttribute("checked",
- "false");
- gDebugger.DebuggerView.Options._toggleShowOriginalSource();
- gDebugger.DebuggerView.Options._onPopupHidden();
-}
-
-function testSetBreakpoint() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.setBreakpoint({
- url: EXAMPLE_URL + "binary_search.js",
- line: 7
- }, function (aResponse, bpClient) {
- ok(!aResponse.error,
- "Should be able to set a breakpoint in a JavaScript file.");
- testHitBreakpoint();
- });
-}
-
-function testHitBreakpoint() {
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.resume(function (aResponse) {
- ok(!aResponse.error, "Shouldn't get an error resuming");
- is(aResponse.type, "resumed", "Type should be 'resumed'");
-
- activeThread.addOneTimeListener("framesadded", function (aEvent, aPacket) {
- // Make sure that we have JavaScript stack frames.
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Correct number of frames.");
- ok(frames.querySelector("#stackframe-0 .dbg-stackframe-details")
- .getAttribute("value").search(/js/),
- "First frame should be a JS frame.");
-
- waitForCaretPos(6, testToggleOnPause);
- });
-
- // This will cause the breakpoint to be hit, and put us back in the paused
- // stated.
- executeSoon(function() {
- gDebuggee.binary_search([0, 2, 3, 5, 7, 10], 5);
- });
- });
-}
-
-function testToggleOnPause() {
- gDebugger.addEventListener("Debugger:SourceShown", function _onSourceShown(aEvent) {
- gDebugger.removeEventListener("Debugger:SourceShown", _onSourceShown);
-
- is(gDebugger.Prefs.sourceMapsEnabled, true,
- "The source maps pref should have been set to true.");
- is(gDebugger.DebuggerView.Options._showOriginalSourceItem.getAttribute("checked"),
- "true", "Source maps should be enabled. ")
-
- ok(aEvent.detail.url.indexOf(".coffee") != -1,
- "The debugger should show the source mapped coffee script file.");
- ok(aEvent.detail.url.indexOf(".js") == -1,
- "The debugger should not show the generated js script file.");
- ok(gDebugger.editor.getText().search(/isnt/) != -1,
- "The debugger's editor should not have the coffee script source displayed.");
- ok(gDebugger.editor.getText().search(/function/) == -1,
- "The debugger's editor should have the JS source displayed.");
-
- // Make sure that we have coffee script stack frames.
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Correct number of frames.");
- ok(frames.querySelector("#stackframe-0 .dbg-stackframe-details")
- .getAttribute("value").search(/coffee/),
- "First frame should be a coffee script frame.");
-
- waitForCaretPos(4, resumeAndFinish);
- });
-
- // Enable source maps.
- gDebugger.DebuggerView.Options._showOriginalSourceItem.setAttribute("checked",
- "true");
- gDebugger.DebuggerView.Options._toggleShowOriginalSource();
- gDebugger.DebuggerView.Options._onPopupHidden();
-}
-
-function resumeAndFinish()
-{
- let { activeThread } = gDebugger.DebuggerController;
- activeThread.resume(function (aResponse) {
- ok(!aResponse.error, "Shouldn't get an error resuming");
- is(aResponse.type, "resumed", "Type should be 'resumed'");
-
- closeDebuggerAndFinish();
- });
-}
-
-function waitForCaretPos(number, callback)
-{
- // Poll every few milliseconds until the source editor line is active.
- let count = 0;
- let intervalID = window.setInterval(function() {
- info("count: " + count + " ");
- if (++count > 50) {
- ok(false, "Timed out while polling for the line.");
- window.clearInterval(intervalID);
- return closeDebuggerAndFinish();
- }
- if (gDebugger.DebuggerView.editor.getCaretPosition().line != number) {
- return;
- }
- is(gDebugger.DebuggerView.editor.getCaretPosition().line, number,
- "The right line is focused.")
- // We got the source editor at the expected line, it's safe to callback.
- window.clearInterval(intervalID);
- callback();
- }, 100);
-}
-
-registerCleanupFunction(function() {
- Services.prefs.setBoolPref("devtools.debugger.source-maps-enabled", false);
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gPrevPref = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_sources-cache.js b/browser/devtools/debugger/test/browser_dbg_sources-cache.js
deleted file mode 100644
index b8533c25f..000000000
--- a/browser/devtools/debugger/test/browser_dbg_sources-cache.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_function-search-01.html";
-
-/**
- * Tests if the sources cache knows how to cache sources when prompted.
- */
-
-let gPane = null;
-let gTab = null;
-let gDebuggee = null;
-let gDebugger = null;
-let gEditor = null;
-let gSources = null;
-let gControllerSources = null;
-let gPrevLabelsCache = null;
-let gPrevGroupsCache = null;
-const TOTAL_SOURCES = 3;
-
-requestLongerTimeout(2);
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- Services.tm.currentThread.dispatch({ run: testSourcesCache }, 0);
- });
- });
-}
-
-function testSourcesCache()
-{
- gEditor = gDebugger.DebuggerView.editor;
- gSources = gDebugger.DebuggerView.Sources;
- gControllerSources = gDebugger.DebuggerController.SourceScripts;
-
- ok(gEditor.getText().contains("First source!"),
- "Editor text contents appears to be correct.");
- is(gSources.selectedLabel, "test-function-search-01.js",
- "The currently selected label in the sources container is correct.");
- ok(gSources.selectedValue.contains("test-function-search-01.js"),
- "The currently selected value in the sources container appears to be correct.");
-
- is(gSources.itemCount, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " sources present in the sources list.");
- is(gSources.visibleItems.length, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " sources visible in the sources list.");
- is(gSources.labels.length, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " labels stored in the sources container model.")
- is(gSources.values.length, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " values stored in the sources container model.")
-
- info("Source labels: " + gSources.labels.toSource());
- info("Source values: " + gSources.values.toSource());
-
- is(gSources.labels.sort()[0], "test-function-search-01.js",
- "The first source label is correct.");
- ok(gSources.values.sort()[0].contains("test-function-search-01.js"),
- "The first source value appears to be correct.");
-
- is(gSources.labels.sort()[1], "test-function-search-02.js",
- "The second source label is correct.");
- ok(gSources.values.sort()[1].contains("test-function-search-02.js"),
- "The second source value appears to be correct.");
-
- is(gSources.labels.sort()[2], "test-function-search-03.js",
- "The third source label is correct.");
- ok(gSources.values.sort()[2].contains("test-function-search-03.js"),
- "The third source value appears to be correct.");
-
- is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " labels cached");
- is(gDebugger.SourceUtils._groupsCache.size, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " groups cached");
-
- gPrevLabelsCache = gDebugger.SourceUtils._labelsCache;
- gPrevGroupsCache = gDebugger.SourceUtils._groupsCache;
-
- fetchSources(function() {
- performReload(function() {
- closeDebuggerAndFinish();
- });
- });
-}
-
-function fetchSources(callback) {
- gControllerSources.getTextForSources(gSources.values).then((aSources) => {
- testCacheIntegrity(aSources);
- callback();
- });
-}
-
-function performReload(callback) {
- gDebugger.DebuggerController._target.once("will-navigate", testStateBeforeReload);
- gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
- ok(true, "tabNavigated event was fired.");
- info("Still attached to the tab.");
-
- testStateAfterReload();
- callback();
- });
-
- gDebuggee.location.reload();
-}
-
-function testStateBeforeReload() {
- is(gSources.itemCount, 0,
- "There should be no sources present in the sources list during reload.");
- is(gControllerSources.getCache().length, 0,
- "The sources cache should be empty during reload.");
- is(gDebugger.SourceUtils._labelsCache, gPrevLabelsCache,
- "The labels cache has been refreshed during reload and no new objects were created.");
- is(gDebugger.SourceUtils._groupsCache, gPrevGroupsCache,
- "The groups cache has been refreshed during reload and no new objects were created.");
- is(gDebugger.SourceUtils._labelsCache.size, 0,
- "There should be no labels cached during reload");
- is(gDebugger.SourceUtils._groupsCache.size, 0,
- "There should be no groups cached during reload");
-}
-
-function testStateAfterReload() {
- is(gSources.itemCount, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " sources present in the sources list.");
- is(gDebugger.SourceUtils._labelsCache.size, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " labels cached after reload.");
- is(gDebugger.SourceUtils._groupsCache.size, TOTAL_SOURCES,
- "There should be " + TOTAL_SOURCES + " groups cached after reload.");
-}
-
-function testCacheIntegrity(aCache) {
- for (let source of aCache) {
- let [url, contents] = source;
-
- // Sources of a debugee don't always finish fetching consecutively. D'uh.
- let index = url.match(/test-function-search-0(\d)/).pop();
-
- ok(index >= 1 && index <= TOTAL_SOURCES,
- "Found a source url cached correctly (" + index + ")");
- ok(contents.contains(
- ["First source!", "Second source!", "Third source!"][index - 1]),
- "Found a source's text contents cached correctly (" + index + ")");
-
- info("Cached source url at " + index + ": " + url);
- info("Cached source text at " + index + ": " + contents);
- }
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gSources = null;
- gControllerSources = null;
- gPrevLabelsCache = null;
- gPrevGroupsCache = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack-01.js b/browser/devtools/debugger/test/browser_dbg_stack-01.js
deleted file mode 100644
index 36b6aeb03..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack-01.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 1,
- "Should have only one frame.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack-02.js b/browser/devtools/debugger/test/browser_dbg_stack-02.js
deleted file mode 100644
index 8bd6a2d0b..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack-02.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testEvalCall();
- });
-}
-
-function testEvalCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 2,
- "Should have two frames.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
- "(eval)", "Frame name should be (eval)");
-
- ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should be selected by default.");
-
- ok(!frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"),
- "Second frame should not be selected.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- frames.querySelector("#stackframe-1"),
- gDebugger);
-
- ok(!frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should not be selected after click.");
-
- ok(frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"),
- "Second frame should be selected after click.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- frames.querySelector("#stackframe-0 .dbg-stackframe-title"),
- gDebugger);
-
- ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should be selected after click inside the first frame.");
-
- ok(!frames.querySelector("#stackframe-1").parentNode.hasAttribute("checked"),
- "Second frame should not be selected after click inside the first frame.");
-
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
- }}, 0);
- });
-
- gDebuggee.evalCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack-03.js b/browser/devtools/debugger/test/browser_dbg_stack-03.js
deleted file mode 100644
index 1ef00d3a3..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack-03.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testRecurse();
- });
-}
-
-function testRecurse() {
- gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1;
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let pageSize = gDebugger.gCallStackPageSize;
- let recurseLimit = gDebuggee.gRecurseLimit;
- let childNodes = frames.childNodes;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, pageSize,
- "Should have the max limit of frames.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- is(frames.querySelectorAll(".dbg-stackframe").length, pageSize * 2,
- "Should now have twice the max limit of frames.");
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- is(frames.querySelectorAll(".dbg-stackframe").length, recurseLimit,
- "Should have reached the recurse limit.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- window.clearInterval(scrollingInterval);
- closeDebuggerAndFinish();
- });
- });
- });
-
- let scrollingInterval = window.setInterval(function() {
- frames.scrollByIndex(-1);
- }, 100);
- }}, 0);
- });
-
- gDebuggee.recurse();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack-04.js b/browser/devtools/debugger/test/browser_dbg_stack-04.js
deleted file mode 100644
index e68aaea8c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack-04.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testEvalCallResume();
- });
-}
-
-function testEvalCallResume() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 2,
- "Should have two frames.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
-
- gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
- gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 0,
- "Should have no frames after resume");
-
- is(childNodes.length, 0,
- "Should only have no children.");
-
- closeDebuggerAndFinish();
- }, true);
-
- gDebugger.DebuggerController.activeThread.resume();
- }}, 0);
- });
-
- gDebuggee.evalCall();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack-05.js b/browser/devtools/debugger/test/browser_dbg_stack-05.js
deleted file mode 100644
index 1fef044e0..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack-05.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that switching between stack frames properly sets the current debugger
-// location in the source editor.
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testRecurse }, 0);
- }
- }
-}
-
-function testRecurse()
-{
- let frames = gDebugger.DebuggerView.StackFrames.widget._list;
- let childNodes = frames.childNodes;
-
- is(frames.querySelectorAll(".dbg-stackframe").length, 4,
- "Correct number of frames.");
-
- is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
- "All children should be frames.");
-
- ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should be selected by default.");
-
- ok(!frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"),
- "Third frame should not be selected.");
-
- is(gDebugger.editor.getDebugLocation(), 5,
- "editor debugger location is correct.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- frames.querySelector("#stackframe-2"),
- gDebugger);
-
- ok(!frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should not be selected after click.");
-
- ok(frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"),
- "Third frame should be selected after click.");
-
- is(gDebugger.editor.getDebugLocation(), 4,
- "editor debugger location is correct after click.");
-
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- frames.querySelector("#stackframe-0 .dbg-stackframe-title"),
- gDebugger);
-
- ok(frames.querySelector("#stackframe-0").parentNode.hasAttribute("checked"),
- "First frame should be selected after click inside the first frame.");
-
- ok(!frames.querySelector("#stackframe-2").parentNode.hasAttribute("checked"),
- "Third frame should not be selected after click inside the first frame.");
-
- is(gDebugger.editor.getDebugLocation(), 5,
- "editor debugger location is correct (frame 0 again).");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- is(gDebugger.editor.getDebugLocation(), -1,
- "editor debugger location is correct after resume.");
-
- closeDebuggerAndFinish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_stack.html b/browser/devtools/debugger/test/browser_dbg_stack.html
deleted file mode 100644
index c3d083087..000000000
--- a/browser/devtools/debugger/test/browser_dbg_stack.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head><meta charset='utf-8'/><title>Browser Debugger Test Tab</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="text/javascript">
-
-function simpleCall() {
- debugger;
-}
-
-function evalCall() {
- eval("debugger;");
-}
-
-var gRecurseLimit = 100;
-var gRecurseDepth = 0;
-function recurse() {
- if (++gRecurseDepth == gRecurseLimit) {
- debugger;
- gRecurseDepth = 0;
- return;
- }
- recurse();
-}
-
-</script>
-</head>
-
-<body></body>
-
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_step-out.js b/browser/devtools/debugger/test/browser_dbg_step-out.js
deleted file mode 100644
index 37df052b5..000000000
--- a/browser/devtools/debugger/test/browser_dbg_step-out.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that stepping out of a function displays the right return value.
- */
-
-const TAB_URL = EXAMPLE_URL + "test-step-out.html";
-
-var gPane = null;
-var gTab = null;
-var gDebugger = null;
-
-function test()
-{
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gPane = aPane;
- gDebugger = gPane.panelWin;
-
- testNormalReturn();
- });
-}
-
-function testNormalReturn()
-{
- gPane.panelWin.gClient.addOneTimeListener("paused", function() {
- gDebugger.addEventListener("Debugger:SourceShown", function dbgstmt(aEvent) {
- gDebugger.removeEventListener(aEvent.type, dbgstmt);
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should be paused now.");
-
- let count = 0;
- gPane.panelWin.gClient.addOneTimeListener("paused", function() {
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should be paused again.");
-
- gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() {
- ok(true, "Debugger:FetchedVariables event received.");
- gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false);
-
- Services.tm.currentThread.dispatch({ run: function() {
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.firstChild,
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;
-
- is(innerNodes[0].querySelector(".name").getAttribute("value"), "<return>",
- "Should have the right property name for the return value.");
-
- is(innerNodes[0].querySelector(".value").getAttribute("value"), 10,
- "Should have the right property value for the return value.");
-
- testReturnWithException();
- }}, 0);
- }, false);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("step-out"),
- gDebugger);
- });
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.getElementById("return"),
- content.window);
-}
-
-function testReturnWithException()
-{
- gDebugger.DebuggerController.activeThread.resume(function() {
- gPane.panelWin.gClient.addOneTimeListener("paused", function() {
- gDebugger.addEventListener("Debugger:FetchedVariables", function dbgstmt(aEvent) {
- gDebugger.removeEventListener(aEvent.type, dbgstmt, false);
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should be paused now.");
-
- let count = 0;
- gPane.panelWin.gClient.addOneTimeListener("paused", function() {
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should be paused again.");
-
- gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() {
- ok(true, "Debugger:FetchedVariables event received.");
- gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false);
-
- Services.tm.currentThread.dispatch({ run: function() {
-
- var scopes = gDebugger.DebuggerView.Variables._list,
- innerScope = scopes.firstChild,
- innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;
-
- is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>",
- "Should have the right property name for the exception value.");
-
- is(innerNodes[0].querySelector(".value").getAttribute("value"), '"boom"',
- "Should have the right property value for the exception value.");
-
- resumeAndFinish();
-
- }}, 0);
- }, false);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- gDebugger.document.getElementById("step-out"),
- gDebugger);
- }, false);
- });
-
- EventUtils.sendMouseEvent({ type: "click" },
- content.document.getElementById("throw"),
- content.window);
- });
-}
-
-function resumeAndFinish() {
- gPane.panelWin.gClient.addOneTimeListener("resumed", function() {
- Services.tm.currentThread.dispatch({ run: closeDebuggerAndFinish }, 0);
- });
-
- gDebugger.DebuggerController.activeThread.resume();
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebugger = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_tab1.html b/browser/devtools/debugger/test/browser_dbg_tab1.html
deleted file mode 100644
index 67d81f915..000000000
--- a/browser/devtools/debugger/test/browser_dbg_tab1.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Test Tab</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_tab2.html b/browser/devtools/debugger/test/browser_dbg_tab2.html
deleted file mode 100644
index 30fcccf74..000000000
--- a/browser/devtools/debugger/test/browser_dbg_tab2.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Test Tab 2</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_tabactor-01.js b/browser/devtools/debugger/test/browser_dbg_tabactor-01.js
deleted file mode 100644
index 8175d364c..000000000
--- a/browser/devtools/debugger/test/browser_dbg_tabactor-01.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Check extension-added tab actor lifetimes.
- */
-
-var gTab1 = null;
-var gTab1Actor = null;
-
-var gClient = null;
-
-function test()
-{
- DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js");
-
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function (aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- get_tab();
- });
-}
-
-function get_tab()
-{
- gTab1 = addTab(TAB1_URL, function() {
- attach_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) {
- gTab1Actor = aGrip.actor;
- ok(aGrip.testTabActor1, "Found the test tab actor.")
- ok(aGrip.testTabActor1.indexOf("testone") >= 0,
- "testTabActor's actorPrefix should be used.");
- gClient.request({ to: aGrip.testTabActor1, type: "ping" }, function(aResponse) {
- is(aResponse.pong, "pong", "Actor should respond to requests.");
- finish_test();
- });
- });
- });
-}
-
-function finish_test()
-{
- gClient.close(function() {
- removeTab(gTab1);
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_tabactor-02.js b/browser/devtools/debugger/test/browser_dbg_tabactor-02.js
deleted file mode 100644
index 492f47395..000000000
--- a/browser/devtools/debugger/test/browser_dbg_tabactor-02.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Check extension-added tab actor lifetimes.
- */
-
-var gTab1 = null;
-var gTab1Actor = null;
-
-var gClient = null;
-
-function test()
-{
- DebuggerServer.addActors("chrome://mochitests/content/browser/browser/devtools/debugger/test/testactors.js");
-
- let transport = DebuggerServer.connectPipe();
- gClient = new DebuggerClient(transport);
- gClient.connect(function (aType, aTraits) {
- is(aType, "browser", "Root actor should identify itself as a browser.");
- get_tab();
- });
-}
-
-function get_tab()
-{
- gTab1 = addTab(TAB1_URL, function() {
- attach_tab_actor_for_url(gClient, TAB1_URL, function(aGrip) {
- gTab1Actor = aGrip.actor;
- ok(aGrip.testTabActor1, "Found the test tab actor.")
- ok(aGrip.testTabActor1.indexOf("testone") >= 0,
- "testTabActor's actorPrefix should be used.");
- gClient.request({ to: aGrip.testTabActor1, type: "ping" }, function(aResponse) {
- is(aResponse.pong, "pong", "Actor should respond to requests.");
- close_tab(aResponse.actor);
- });
- });
- });
-}
-
-function close_tab(aTestActor)
-{
- removeTab(gTab1);
- try {
- gClient.request({ to: aTestActor, type: "ping" }, function (aResponse) {
- is(aResponse, undefined, "testTabActor1 didn't go away with the tab.");
- finish_test();
- });
- } catch (e) {
- is(e.message, "'ping' request packet has no destination.",
- "testTabActor1 should have gone away with the tab.");
- finish_test();
- }
-}
-
-function finish_test()
-{
- gClient.close(function () {
- finish();
- });
-}
diff --git a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html b/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html
deleted file mode 100644
index 2cb5d3f50..000000000
--- a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Update Editor Mode Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript" src="test-script-switching-01.js?q=a"></script>
- <script type="text/javascript" src="test-editor-mode?a=b"></script>
- <script type="text/javascript">
- function banana() { }
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js b/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js
deleted file mode 100644
index 785994ee7..000000000
--- a/browser/devtools/debugger/test/browser_dbg_update-editor-mode.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Make sure that updating the editor mode sets the right highlighting engine,
- * and script URIs with extra query parameters also get the right engine.
- */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gSources = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
- let testStarted = false;
- let resumed = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.panelWin;
- gSources = gDebugger.DebuggerView.Sources;
- resumed = true;
-
- gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- executeSoon(startTest);
- });
-
- executeSoon(function() {
- gDebuggee.firstCall();
- });
- });
-
- function onScriptShown(aEvent) {
- scriptShown = aEvent.detail.url.indexOf("test-editor-mode") != -1;
- executeSoon(startTest);
- }
-
- function startTest()
- {
- if (scriptShown && framesAdded && resumed && !testStarted) {
- gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
- testStarted = true;
- Services.tm.currentThread.dispatch({ run: testScriptsDisplay }, 0);
- }
- }
-}
-
-function testScriptsDisplay() {
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 3,
- "Found the expected number of scripts.");
-
- is(gDebugger.editor.getMode(), SourceEditor.MODES.TEXT,
- "Found the expected editor mode.");
-
- ok(gDebugger.editor.getText().search(/debugger/) != -1,
- "The correct script was loaded initially.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("switching-01.js") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitchPaused1();
- }
- });
-
- let url = gDebuggee.document.querySelector("script").src;
- gDebugger.DebuggerView.Sources.selectedValue = url;
-}
-
-function testSwitchPaused1()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 3,
- "Found the expected number of scripts.");
-
- ok(gDebugger.editor.getText().search(/debugger/) == -1,
- "The second script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) != -1,
- "The first script is displayed.");
-
- is(gDebugger.editor.getMode(), SourceEditor.MODES.JAVASCRIPT,
- "Found the expected editor mode.");
-
- gDebugger.addEventListener("Debugger:SourceShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("update-editor-mode") != -1) {
- gDebugger.removeEventListener(aEvent.type, _onEvent);
- testSwitchPaused2();
- }
- });
-
- let label = "browser_dbg_update-editor-mode.html";
- gDebugger.DebuggerView.Sources.selectedLabel = label;
-}
-
-function testSwitchPaused2()
-{
- is(gDebugger.DebuggerController.activeThread.state, "paused",
- "Should only be getting stack frames while paused.");
-
- is(gSources.itemCount, 3,
- "Found the expected number of scripts.");
-
- ok(gDebugger.editor.getText().search(/firstCall/) == -1,
- "The first script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/debugger/) == -1,
- "The second script is no longer displayed.");
-
- ok(gDebugger.editor.getText().search(/banana/) != -1,
- "The third script is displayed.");
-
- is(gDebugger.editor.getMode(), SourceEditor.MODES.HTML,
- "Found the expected editor mode.");
-
- gDebugger.DebuggerController.activeThread.resume(function() {
- closeDebuggerAndFinish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gSources = null;
-});
diff --git a/browser/devtools/debugger/test/browser_dbg_watch-expressions.html b/browser/devtools/debugger/test/browser_dbg_watch-expressions.html
deleted file mode 100644
index 842ac7d48..000000000
--- a/browser/devtools/debugger/test/browser_dbg_watch-expressions.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Browser Debugger Watch Expressions Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- function test() {
- ermahgerd.call({ canada: new String("eh") });
- }
- function ermahgerd(aArg) {
- var t = document.title;
- debugger;
- (function() {
- var a = undefined;
- debugger;
- var a = {};
- debugger;
- }("sensational"));
- }
- </script>
-
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/browser_dbg_with-frame.html b/browser/devtools/debugger/test/browser_dbg_with-frame.html
deleted file mode 100644
index 59a2397c3..000000000
--- a/browser/devtools/debugger/test/browser_dbg_with-frame.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Debugger Function Call Parameter Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- window.addEventListener("load", function() {
- function test(aNumber) {
- var a, obj = { one: 1, two: 2 };
- var r = aNumber;
- with (Math) {
- a = PI * r * r;
- with (obj) {
- var foo = two * PI;
- debugger;
- }
- }
- };
- function load() {
- test(10);
- }
- var button = document.querySelector("button");
- button.addEventListener("click", load, false);
- });
- </script>
-
- </head>
- <body>
- <button>Click me!</button>
- </body>
-</html>
diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js
deleted file mode 100644
index 3c4cf47af..000000000
--- a/browser/devtools/debugger/test/head.js
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-let tempScope = {};
-Cu.import("resource://gre/modules/Services.jsm", tempScope);
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm", tempScope);
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
-Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
-let Services = tempScope.Services;
-let SourceEditor = tempScope.SourceEditor;
-let DebuggerServer = tempScope.DebuggerServer;
-let DebuggerTransport = tempScope.DebuggerTransport;
-let DebuggerClient = tempScope.DebuggerClient;
-let gDevTools = tempScope.gDevTools;
-let devtools = tempScope.devtools;
-let TargetFactory = devtools.TargetFactory;
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
-
-const EXAMPLE_URL = "http://example.com/browser/browser/devtools/debugger/test/";
-const TAB1_URL = EXAMPLE_URL + "browser_dbg_tab1.html";
-const TAB2_URL = EXAMPLE_URL + "browser_dbg_tab2.html";
-const STACK_URL = EXAMPLE_URL + "browser_dbg_stack.html";
-
-// Enable logging and remote debugging for the relevant tests.
-let gEnableRemote = Services.prefs.getBoolPref("devtools.debugger.remote-enabled");
-let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
-Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
-Services.prefs.setBoolPref("devtools.debugger.log", true);
-
-registerCleanupFunction(function() {
- Services.prefs.setBoolPref("devtools.debugger.remote-enabled", gEnableRemote);
- Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
-
- // Properly shut down the server to avoid memory leaks.
- DebuggerServer.destroy();
-});
-
-if (!DebuggerServer.initialized) {
- DebuggerServer.init(function() true);
- DebuggerServer.addBrowserActors();
-}
-
-waitForExplicitFinish();
-
-function addWindow() {
- let windowReference = window.open();
- let chromeWindow = windowReference
- .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsIDocShellTreeItem).rootTreeItem
- .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
-
- return chromeWindow;
-}
-
-function addTab(aURL, aOnload, aWindow) {
- let targetWindow = aWindow || window;
- let targetBrowser = targetWindow.gBrowser;
-
- targetWindow.focus();
- targetBrowser.selectedTab = targetBrowser.addTab(aURL);
-
- let tab = targetBrowser.selectedTab;
- let browser = tab.linkedBrowser;
- let win = browser.contentWindow;
- let expectedReadyState = aURL == "about:blank" ? ["interactive", "complete"] : ["complete"];
-
- if (aOnload) {
- let handler = function() {
- if (browser.currentURI.spec != aURL ||
- expectedReadyState.indexOf((win.document || {}).readyState) == -1) {
- return;
- }
- browser.removeEventListener("load", handler, true);
- executeSoon(aOnload);
- }
- browser.addEventListener("load", handler, true);
- }
-
- return tab;
-}
-
-function removeTab(aTab, aWindow) {
- let targetWindow = aWindow || window;
- let targetBrowser = targetWindow.gBrowser;
-
- targetBrowser.removeTab(aTab);
-}
-
-function closeDebuggerAndFinish(aRemoteFlag, aCallback, aWindow) {
- let debuggerClosed = false;
- let debuggerDisconnected = false;
-
- ok(gTab, "There is a gTab to use for getting a toolbox reference");
- let target = TargetFactory.forTab(gTab);
-
- window.addEventListener("Debugger:Shutdown", function cleanup() {
- window.removeEventListener("Debugger:Shutdown", cleanup, false);
- debuggerDisconnected = true;
- maybeFinish();
- }, false);
-
- let toolbox = gDevTools.getToolbox(target);
- toolbox.destroy().then(function() {
- debuggerClosed = true;
- maybeFinish();
- });
-
- function maybeFinish() {
- if (debuggerClosed && debuggerDisconnected) {
- (finish || aCallback)();
- }
- }
-}
-
-function get_tab_actor_for_url(aClient, aURL, aCallback) {
- aClient.listTabs(function(aResponse) {
- for each (let tab in aResponse.tabs) {
- if (tab.url == aURL) {
- aCallback(tab);
- return;
- }
- }
- });
-}
-
-function attach_tab_actor_for_url(aClient, aURL, aCallback) {
- get_tab_actor_for_url(aClient, aURL, function(actor) {
- aClient.attachTab(actor.actor, function(aResponse) {
- aCallback(actor, aResponse);
- });
- });
-}
-
-function attach_thread_actor_for_url(aClient, aURL, aCallback) {
- attach_tab_actor_for_url(aClient, aURL, function(aTabActor, aResponse) {
- aClient.attachThread(actor.threadActor, function(aResponse, aThreadClient) {
- // We don't care about the pause right now (use
- // get_actor_for_url() if you do), so resume it.
- aThreadClient.resume(function(aResponse) {
- aCallback(actor);
- });
- });
- });
-}
-
-function wait_for_connect_and_resume(aOnDebugging, aTab) {
- let target = TargetFactory.forTab(aTab);
-
- gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) {
- let dbg = toolbox.getCurrentPanel();
-
- // Wait for the initial resume...
- dbg.panelWin.gClient.addOneTimeListener("resumed", function() {
- aOnDebugging();
- });
- });
-}
-
-function debug_tab_pane(aURL, aOnDebugging, aBeforeTabAdded) {
- // Make any necessary preparations (start the debugger server etc.)
- if (aBeforeTabAdded) {
- aBeforeTabAdded();
- }
-
- let tab = addTab(aURL, function() {
- let debuggee = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- info("Opening Debugger");
- gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) {
- let dbg = toolbox.getCurrentPanel();
-
- // Wait for the initial resume...
- dbg.panelWin.gClient.addOneTimeListener("resumed", function() {
- info("Debugger has started");
- dbg._view.Variables.lazyEmpty = false;
- dbg._view.Variables.lazyAppend = false;
- dbg._view.Variables.lazyExpand = false;
- aOnDebugging(tab, debuggee, dbg);
- });
- });
- });
-}
-
-function debug_chrome(aURL, aOnClosing, aOnDebugging) {
- let tab = addTab(aURL, function() {
- let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject;
-
- info("Opening Browser Debugger");
- let win = BrowserDebuggerProcess.init(aOnClosing, function(process) {
-
- // The remote debugging process has started...
- info("Browser Debugger has started");
- aOnDebugging(tab, debuggee, process);
- });
- });
-}
diff --git a/browser/devtools/debugger/test/moz.build b/browser/devtools/debugger/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/debugger/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/debugger/test/test-editor-mode b/browser/devtools/debugger/test/test-editor-mode
deleted file mode 100644
index a86191c98..000000000
--- a/browser/devtools/debugger/test/test-editor-mode
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function secondCall() {
- eval("debugger;");
-}
diff --git a/browser/devtools/debugger/test/test-function-search-01.js b/browser/devtools/debugger/test/test-function-search-01.js
deleted file mode 100644
index b5d647cfe..000000000
--- a/browser/devtools/debugger/test/test-function-search-01.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- // Blah! First source!
-}
-
-test.prototype = {
- anonymousExpression: function() {
- },
- namedExpression: function NAME() {
- },
- sub: {
- sub: {
- sub: {
- }
- }
- }
-};
-
-var foo = {
- a_test: function() {
- },
- n_test: function x() {
- },
- sub: {
- a_test: function() {
- },
- n_test: function y() {
- },
- sub: {
- a_test: function() {
- },
- n_test: function z() {
- },
- sub: {
- test_SAME_NAME: function test_SAME_NAME() {
- }
- }
- }
- }
-};
diff --git a/browser/devtools/debugger/test/test-function-search-02.js b/browser/devtools/debugger/test/test-function-search-02.js
deleted file mode 100644
index 10b48518f..000000000
--- a/browser/devtools/debugger/test/test-function-search-02.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var test2 = function() {
- // Blah! Second source!
-}
-
-var test3 = function test3_NAME() {
-}
-
-var test4_SAME_NAME = function test4_SAME_NAME() {
-}
-
-test.prototype.x = function X() {
-};
-test.prototype.sub.y = function Y() {
-};
-test.prototype.sub.sub.z = function Z() {
-};
-test.prototype.sub.sub.sub.t = this.x = this.y = this.z = function() {
-};
diff --git a/browser/devtools/debugger/test/test-function-search-03.js b/browser/devtools/debugger/test/test-function-search-03.js
deleted file mode 100644
index e64292a92..000000000
--- a/browser/devtools/debugger/test/test-function-search-03.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-window.addEventListener("bogus", function namedEventListener() {
- // Blah! Third source!
-});
-
-try {
- var bar = foo.sub.sub.test({
- a: function A() {
- }
- });
-
- bar.alpha = foo.sub.sub.test({
- b: function B() {
- }
- });
-
- bar.alpha.beta = new X(Y(Z(foo.sub.sub.test({
- c: function C() {
- }
- }))));
-
- this.theta = new X(new Y(new Z(new foo.sub.sub.test({
- d: function D() {
- }
- }))));
-
- var fun = foo = bar = this.t_foo = window.w_bar = function baz() {};
-
-} catch (e) {
-}
diff --git a/browser/devtools/debugger/test/test-location-changes-bp.html b/browser/devtools/debugger/test/test-location-changes-bp.html
deleted file mode 100644
index 0e1831894..000000000
--- a/browser/devtools/debugger/test/test-location-changes-bp.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset='utf-8'/>
-<script type="text/javascript" src="test-location-changes-bp.js"></script>
-<script type="text/javascript">
-function runDebuggerStatement() {
- debugger;
-}
-</script>
-</head>
-<body>
-
-<button type="button" onclick="myFunction()">Run</button>
-
-</body>
-</html>
diff --git a/browser/devtools/debugger/test/test-location-changes-bp.js b/browser/devtools/debugger/test/test-location-changes-bp.js
deleted file mode 100644
index d164b8bdf..000000000
--- a/browser/devtools/debugger/test/test-location-changes-bp.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function myFunction() {
- var a = 1;
- debugger;
-}
diff --git a/browser/devtools/debugger/test/test-script-switching-01.js b/browser/devtools/debugger/test/test-script-switching-01.js
deleted file mode 100644
index a4c078032..000000000
--- a/browser/devtools/debugger/test/test-script-switching-01.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function firstCall() {
- eval("secondCall();");
-}
diff --git a/browser/devtools/debugger/test/test-script-switching-02.js b/browser/devtools/debugger/test/test-script-switching-02.js
deleted file mode 100644
index 6606bd366..000000000
--- a/browser/devtools/debugger/test/test-script-switching-02.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function secondCall() {
- // This comment is useful for browser_dbg_select-line.js. ☺
- eval("debugger;");
- function foo() {}
- if (true) {
- foo();
- }
-}
diff --git a/browser/devtools/debugger/test/test-step-out.html b/browser/devtools/debugger/test/test-step-out.html
deleted file mode 100644
index c19236772..000000000
--- a/browser/devtools/debugger/test/test-step-out.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Debugger Step Out Return Value Test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <button id="return">return</button>
- <button id="throw">throw</button>
- </body>
- <script type="text/javascript">
- window.addEventListener("load", function() {
- function normal(aArg) {
- debugger;
- var r = 10;
- return r;
- }
- function error(aArg) {
- function inner(aArg) {
- debugger;
- var r = 10;
- throw "boom";
- return r;
- }
- try {
- inner(aArg);
- } catch (e) {}
- }
- var button = document.getElementById("return");
- button.addEventListener("click", normal, false);
- button = document.getElementById("throw");
- button.addEventListener("click", error, false);
- });
- </script>
-</html>
diff --git a/browser/devtools/debugger/test/testactors.js b/browser/devtools/debugger/test/testactors.js
deleted file mode 100644
index 8c97b3e91..000000000
--- a/browser/devtools/debugger/test/testactors.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function TestActor1(aConnection, aTab)
-{
- this.conn = aConnection;
- this.tab = aTab;
-}
-
-TestActor1.prototype = {
- actorPrefix: "testone",
-
- grip: function TA1_grip() {
- return { actor: this.actorID,
- test: "TestActor1" };
- },
-
- onPing: function TA1_onPing() {
- return { pong: "pong" };
- }
-};
-
-TestActor1.prototype.requestTypes = {
- "ping": TestActor1.prototype.onPing
-};
-
-DebuggerServer.removeTabActor(TestActor1);
-DebuggerServer.removeGlobalActor(TestActor1);
-
-DebuggerServer.addTabActor(TestActor1, "testTabActor1");
-DebuggerServer.addGlobalActor(TestActor1, "testGlobalActor1");
diff --git a/browser/devtools/fontinspector/moz.build b/browser/devtools/fontinspector/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/fontinspector/moz.build
+++ b/browser/devtools/fontinspector/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/fontinspector/test/Makefile.in b/browser/devtools/fontinspector/test/Makefile.in
deleted file mode 100644
index 4e1e45775..000000000
--- a/browser/devtools/fontinspector/test/Makefile.in
+++ /dev/null
@@ -1,19 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_fontinspector.js \
- browser_fontinspector.html \
- browser_font.woff \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/fontinspector/test/browser_font.woff b/browser/devtools/fontinspector/test/browser_font.woff
deleted file mode 100644
index e8440843b..000000000
--- a/browser/devtools/fontinspector/test/browser_font.woff
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/fontinspector/test/browser_fontinspector.html b/browser/devtools/fontinspector/test/browser_fontinspector.html
deleted file mode 100644
index 13d7a2e4b..000000000
--- a/browser/devtools/fontinspector/test/browser_fontinspector.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-
-<style>
- @font-face {
- font-family: bar;
- src: url(bad/font/name.ttf), url(browser_font.woff) format("woff");
- }
- body{
- font-family:Arial;
- }
- div {
- font-family:Arial;
- font-family:bar;
- }
-</style>
-
-<body>
- BODY
- <div>DIV</div>
-</body>
diff --git a/browser/devtools/fontinspector/test/browser_fontinspector.js b/browser/devtools/fontinspector/test/browser_fontinspector.js
deleted file mode 100644
index e57fe6093..000000000
--- a/browser/devtools/fontinspector/test/browser_fontinspector.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
-let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
-
-function test() {
- waitForExplicitFinish();
-
- let doc;
- let node;
- let view;
- let inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/fontinspector/test/browser_fontinspector.html";
-
- function setupTest() {
- let rng = doc.createRange();
- rng.selectNode(doc.body);
- let fonts = DOMUtils.getUsedFontFaces(rng);
- if (fonts.length != 2) {
- // Fonts are not loaded yet.
- // Let try again in a couple of milliseconds (hacky, but
- // there's not better way to do it. See bug 835247).
- setTimeout(setupTest, 500);
- } else {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- openFontInspector(toolbox.getCurrentPanel());
- });
- }
- }
-
- function openFontInspector(aInspector) {
- inspector = aInspector;
-
- info("Inspector open");
-
- inspector.selection.setNode(doc.body);
- inspector.sidebar.select("fontinspector");
- inspector.sidebar.once("fontinspector-ready", viewReady);
- }
-
- function viewReady() {
- info("Font Inspector ready");
-
- view = inspector.sidebar.getWindowForTab("fontinspector");
-
- ok(!!view.fontInspector, "Font inspector document is alive.");
-
- let d = view.document;
-
- let s = d.querySelectorAll("#all-fonts > section");
- is(s.length, 2, "Found 2 fonts");
-
- is(s[0].querySelector(".font-name").textContent,
- "DeLarge Bold", "font 0: Right font name");
- ok(s[0].classList.contains("is-remote"),
- "font 0: is remote");
- is(s[0].querySelector(".font-url").value,
- "http://mochi.test:8888/browser/browser/devtools/fontinspector/test/browser_font.woff",
- "font 0: right url");
- is(s[0].querySelector(".font-format").textContent,
- "woff", "font 0: right font format");
- is(s[0].querySelector(".font-css-name").textContent,
- "bar", "font 0: right css name");
-
-
- let font1Name = s[1].querySelector(".font-name").textContent;
- let font1CssName = s[1].querySelector(".font-css-name").textContent;
-
- // On Linux test machines, the Arial font doesn't exist.
- // The fallback is "Liberation Sans"
-
- ok((font1Name == "Arial") || (font1Name == "Liberation Sans"),
- "font 1: Right font name");
- ok(s[1].classList.contains("is-local"), "font 1: is local");
- ok((font1CssName == "Arial") || (font1CssName == "Liberation Sans"),
- "Arial", "font 1: right css name");
-
- executeSoon(function() {
- gDevTools.once("toolbox-destroyed", finishUp);
- inspector._toolbox.destroy();
- });
- }
-
- function finishUp() {
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/fontinspector/test/moz.build b/browser/devtools/fontinspector/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/fontinspector/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/framework/moz.build b/browser/devtools/framework/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/framework/moz.build
+++ b/browser/devtools/framework/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/framework/test/Makefile.in b/browser/devtools/framework/test/Makefile.in
deleted file mode 100644
index 2fe8c2a52..000000000
--- a/browser/devtools/framework/test/Makefile.in
+++ /dev/null
@@ -1,33 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_devtools_api.js \
- browser_new_activation_workflow.js \
- browser_toolbox_dynamic_registration.js \
- browser_toolbox_hosts.js \
- browser_toolbox_ready.js \
- browser_toolbox_select_event.js \
- browser_target_events.js \
- browser_toolbox_tool_ready.js \
- browser_toolbox_sidebar.js \
- browser_toolbox_window_shortcuts.js \
- browser_toolbox_window_title_changes.js \
- browser_toolbox_options.js \
- browser_toolbox_options_disablejs.js \
- browser_toolbox_options_disablejs.html \
- browser_toolbox_options_disablejs_iframe.html \
- browser_toolbox_highlight.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/framework/test/browser_devtools_api.js b/browser/devtools/framework/test/browser_devtools_api.js
deleted file mode 100644
index 6a79d337d..000000000
--- a/browser/devtools/framework/test/browser_devtools_api.js
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests devtools API
-
-const Cu = Components.utils;
-const toolId = "test-tool";
-
-let tempScope = {};
-Cu.import("resource:///modules/devtools/shared/event-emitter.js", tempScope);
-let EventEmitter = tempScope.EventEmitter;
-
-function test() {
- addTab("about:blank", function(aBrowser, aTab) {
- runTests(aTab);
- });
-}
-
-function runTests(aTab) {
- let toolDefinition = {
- id: toolId,
- isTargetSupported: function() true,
- visibilityswitch: "devtools.test-tool.enabled",
- url: "about:blank",
- label: "someLabel",
- build: function(iframeWindow, toolbox) {
- let panel = new DevToolPanel(iframeWindow, toolbox);
- return panel.open();
- },
- };
-
- ok(gDevTools, "gDevTools exists");
- is(gDevTools.getToolDefinitionMap().has(toolId), false,
- "The tool is not registered");
-
- gDevTools.registerTool(toolDefinition);
- is(gDevTools.getToolDefinitionMap().has(toolId), true,
- "The tool is registered");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, toolId).then(function(toolbox) {
- is(toolbox.target, target, "toolbox target is correct");
- is(toolbox._host.hostTab, gBrowser.selectedTab, "toolbox host is correct");
- continueTests(toolbox);
- }).then(null, console.error);
-}
-
-function continueTests(toolbox, panel) {
- ok(toolbox.getCurrentPanel(), "panel value is correct");
- is(toolbox.currentToolId, toolId, "toolbox _currentToolId is correct");
-
- let toolDefinitions = gDevTools.getToolDefinitionMap();
- is(toolDefinitions.has(toolId), true, "The tool is in gDevTools");
-
- let toolDefinition = toolDefinitions.get(toolId);
- is(toolDefinition.id, toolId, "toolDefinition id is correct");
-
- gDevTools.unregisterTool(toolId);
- is(gDevTools.getToolDefinitionMap().has(toolId), false,
- "The tool is no longer registered");
-
- toolbox.destroy().then(function() {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- ok(gDevTools._toolboxes.get(target) == null, "gDevTools doesn't know about target");
- ok(toolbox._target == null, "toolbox doesn't know about target.");
-
- finishUp();
- }).then(null, console.error);
-}
-
-function finishUp() {
- tempScope = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-/**
-* When a Toolbox is started it creates a DevToolPanel for each of the tools
-* by calling toolDefinition.build(). The returned object should
-* at least implement these functions. They will be used by the ToolBox.
-*
-* There may be no benefit in doing this as an abstract type, but if nothing
-* else gives us a place to write documentation.
-*/
-function DevToolPanel(iframeWindow, toolbox) {
- EventEmitter.decorate(this);
-
- this._toolbox = toolbox;
-
- /*let doc = iframeWindow.document
- let label = doc.createElement("label");
- let textNode = doc.createTextNode("Some Tool");
-
- label.appendChild(textNode);
- doc.body.appendChild(label);*/
-}
-
-DevToolPanel.prototype = {
- open: function() {
- let deferred = Promise.defer();
-
- executeSoon(function() {
- this._isReady = true;
- this.emit("ready");
- deferred.resolve(this);
- }.bind(this));
-
- return deferred.promise;
- },
-
- get target() this._toolbox.target,
-
- get toolbox() this._toolbox,
-
- get isReady() this._isReady,
-
- _isReady: false,
-
- destroy: function DTI_destroy() {
- return Promise.defer(null);
- },
-};
diff --git a/browser/devtools/framework/test/browser_new_activation_workflow.js b/browser/devtools/framework/test/browser_new_activation_workflow.js
deleted file mode 100644
index 85b73e7c7..000000000
--- a/browser/devtools/framework/test/browser_new_activation_workflow.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests devtools API
-
-const Cu = Components.utils;
-
-let toolbox, target;
-
-let tempScope = {};
-
-function test() {
- addTab("about:blank", function(aBrowser, aTab) {
- target = TargetFactory.forTab(gBrowser.selectedTab);
- loadWebConsole(aTab).then(function() {
- console.log('loaded');
- }, console.error);
- });
-}
-
-function loadWebConsole(aTab) {
- ok(gDevTools, "gDevTools exists");
-
- return gDevTools.showToolbox(target, "webconsole").then(function(aToolbox) {
- toolbox = aToolbox;
- checkToolLoading();
- }, console.error);
-}
-
-function checkToolLoading() {
- is(toolbox.currentToolId, "webconsole", "The web console is selected");
- ok(toolbox.isReady, "toolbox is ready")
-
- selectAndCheckById("jsdebugger").then(function() {
- selectAndCheckById("styleeditor").then(function() {
- testToggle();
- });
- }, console.error);
-}
-
-function selectAndCheckById(id) {
- let doc = toolbox.frame.contentDocument;
-
- return toolbox.selectTool(id).then(function() {
- let tab = doc.getElementById("toolbox-tab-" + id);
- is(tab.selected, true, "The " + id + " tab is selected");
- });
-}
-
-function testToggle() {
- toolbox.once("destroyed", function() {
- // Cannot reuse a target after it's destroyed.
- target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "styleeditor").then(function(aToolbox) {
- toolbox = aToolbox;
- is(toolbox.currentToolId, "styleeditor", "The style editor is selected");
- finishUp();
- });
- }.bind(this));
-
- toolbox.destroy();
-}
-
-function finishUp() {
- toolbox.destroy().then(function() {
- toolbox = null;
- target = null;
- gBrowser.removeCurrentTab();
- finish();
- });
-}
diff --git a/browser/devtools/framework/test/browser_target_events.js b/browser/devtools/framework/test/browser_target_events.js
deleted file mode 100644
index a9e386f4b..000000000
--- a/browser/devtools/framework/test/browser_target_events.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var target;
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", onLoad, true);
-}
-
-function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
-
- target = TargetFactory.forTab(gBrowser.selectedTab);
-
- is(target.tab, gBrowser.selectedTab, "Target linked to the right tab.");
-
- target.once("hidden", onHidden);
- gBrowser.selectedTab = gBrowser.addTab();
-}
-
-function onHidden() {
- ok(true, "Hidden event received");
- target.once("visible", onVisible);
- gBrowser.removeCurrentTab();
-}
-
-function onVisible() {
- ok(true, "Visible event received");
- target.once("will-navigate", onWillNavigate);
- gBrowser.contentWindow.location = "data:text/html,test navigation";
-}
-
-function onWillNavigate(event, request) {
- ok(true, "will-navigate event received");
- // Wait for navigation handling to complete before removing the tab, in order
- // to avoid triggering assertions.
- target.once("navigate", executeSoon.bind(null, onNavigate));
-}
-
-function onNavigate() {
- ok(true, "navigate event received");
- target.once("close", onClose);
- gBrowser.removeCurrentTab();
-}
-
-function onClose() {
- ok(true, "close event received");
-
- target = null;
- finish();
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_dynamic_registration.js b/browser/devtools/framework/test/browser_toolbox_dynamic_registration.js
deleted file mode 100644
index ae30f036a..000000000
--- a/browser/devtools/framework/test/browser_toolbox_dynamic_registration.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let toolbox;
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- gDevTools.showToolbox(target).then(testRegister);
- }, true);
-
- content.location = "data:text/html,test for dynamically registering and unregistering tools";
-}
-
-function testRegister(aToolbox)
-{
- toolbox = aToolbox
- gDevTools.once("tool-registered", toolRegistered);
-
- gDevTools.registerTool({
- id: "test-tool",
- label: "Test Tool",
- isTargetSupported: function() true,
- build: function() {}
- });
-}
-
-function toolRegistered(event, toolId)
-{
- is(toolId, "test-tool", "tool-registered event handler sent tool id");
-
- ok(gDevTools.getToolDefinitionMap().has(toolId), "tool added to map");
-
- // test that it appeared in the UI
- let doc = toolbox.frame.contentDocument;
- let tab = doc.getElementById("toolbox-tab-" + toolId);
- ok(tab, "new tool's tab exists in toolbox UI");
-
- let panel = doc.getElementById("toolbox-panel-" + toolId);
- ok(panel, "new tool's panel exists in toolbox UI");
-
- for (let win of getAllBrowserWindows()) {
- let command = win.document.getElementById("Tools:" + toolId);
- ok(command, "command for new tool added to every browser window");
- let menuitem = win.document.getElementById("menuitem_" + toolId);
- ok(menuitem, "menu item of new tool added to every browser window");
- }
-
- // then unregister it
- testUnregister();
-}
-
-function getAllBrowserWindows() {
- let wins = [];
- let enumerator = Services.wm.getEnumerator("navigator:browser");
- while (enumerator.hasMoreElements()) {
- wins.push(enumerator.getNext());
- }
- return wins;
-}
-
-function testUnregister()
-{
- gDevTools.once("tool-unregistered", toolUnregistered);
-
- gDevTools.unregisterTool("test-tool");
-}
-
-function toolUnregistered(event, toolDefinition)
-{
- let toolId = toolDefinition.id;
- is(toolId, "test-tool", "tool-unregistered event handler sent tool id");
-
- ok(!gDevTools.getToolDefinitionMap().has(toolId), "tool removed from map");
-
- // test that it disappeared from the UI
- let doc = toolbox.frame.contentDocument;
- let tab = doc.getElementById("toolbox-tab-" + toolId);
- ok(!tab, "tool's tab was removed from the toolbox UI");
-
- let panel = doc.getElementById("toolbox-panel-" + toolId);
- ok(!panel, "tool's panel was removed from toolbox UI");
-
- for (let win of getAllBrowserWindows()) {
- let command = win.document.getElementById("Tools:" + toolId);
- ok(!command, "command removed from every browser window");
- let menuitem = win.document.getElementById("menuitem_" + toolId);
- ok(!menuitem, "menu item removed from every browser window");
- }
-
- cleanup();
-}
-
-function cleanup()
-{
- toolbox.destroy();
- toolbox = null;
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_highlight.js b/browser/devtools/framework/test/browser_toolbox_highlight.js
deleted file mode 100644
index 3ba74a4b7..000000000
--- a/browser/devtools/framework/test/browser_toolbox_highlight.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let Toolbox = devtools.Toolbox;
-let temp = {};
-Cu.import("resource://gre/modules/Services.jsm", temp);
-let Services = temp.Services;
-temp = null;
-let toolbox = null;
-
-function test() {
- waitForExplicitFinish();
-
- const URL = "data:text/plain;charset=UTF-8,Nothing to see here, move along";
-
- const TOOL_ID_1 = "jsdebugger";
- const TOOL_ID_2 = "webconsole";
-
- addTab(URL, () => {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, TOOL_ID_1, Toolbox.HostType.BOTTOM)
- .then(aToolbox => {
- toolbox = aToolbox;
- // select tool 2
- toolbox.selectTool(TOOL_ID_2)
- // and highlight the first one
- .then(highlightTab.bind(null, TOOL_ID_1))
- // to see if it has the proper class.
- .then(checkHighlighted.bind(null, TOOL_ID_1))
- // Now switch back to first tool
- .then(() => toolbox.selectTool(TOOL_ID_1))
- // to check again. But there is no easy way to test if
- // it is showing orange or not.
- .then(checkNoHighlightWhenSelected.bind(null, TOOL_ID_1))
- // Switch to tool 2 again
- .then(() => toolbox.selectTool(TOOL_ID_2))
- // and check again.
- .then(checkHighlighted.bind(null, TOOL_ID_1))
- // Now unhighlight the tool
- .then(unhighlightTab.bind(null, TOOL_ID_1))
- // to see the classes gone.
- .then(checkNoHighlight.bind(null, TOOL_ID_1))
- // Now close the toolbox and exit.
- .then(() => executeSoon(() => {
- toolbox.destroy()
- .then(() => {
- toolbox = null;
- gBrowser.removeCurrentTab();
- finish();
- });
- }));
- });
- });
-}
-
-function highlightTab(toolId) {
- info("Highlighting tool " + toolId + "'s tab.");
- toolbox.highlightTool(toolId);
-}
-
-function unhighlightTab(toolId) {
- info("Unhighlighting tool " + toolId + "'s tab.");
- toolbox.unhighlightTool(toolId);
-}
-
-function checkHighlighted(toolId) {
- let tab = toolbox.doc.getElementById("toolbox-tab-" + toolId);
- ok(tab.classList.contains("highlighted"), "The highlighted class is present");
- ok(!tab.hasAttribute("selected") || tab.getAttribute("selected") != "true",
- "The tab is not selected");
-}
-
-function checkNoHighlightWhenSelected(toolId) {
- let tab = toolbox.doc.getElementById("toolbox-tab-" + toolId);
- ok(tab.classList.contains("highlighted"), "The highlighted class is present");
- ok(tab.hasAttribute("selected") && tab.getAttribute("selected") == "true",
- "and the tab is selected, so the orange glow will not be present.");
-}
-
-function checkNoHighlight(toolId) {
- let tab = toolbox.doc.getElementById("toolbox-tab-" + toolId);
- ok(!tab.classList.contains("highlighted"),
- "The highlighted class is not present");
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_hosts.js b/browser/devtools/framework/test/browser_toolbox_hosts.js
deleted file mode 100644
index 5d451f01c..000000000
--- a/browser/devtools/framework/test/browser_toolbox_hosts.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let temp = {}
-Cu.import("resource:///modules/devtools/gDevTools.jsm", temp);
-let DevTools = temp.DevTools;
-
-Cu.import("resource://gre/modules/devtools/Loader.jsm", temp);
-let devtools = temp.devtools;
-
-let Toolbox = devtools.Toolbox;
-
-let toolbox, target;
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- gDevTools.showToolbox(target)
- .then(testBottomHost, console.error)
- .then(null, console.error);
- }, true);
-
- content.location = "data:text/html,test for opening toolbox in different hosts";
-}
-
-function testBottomHost(aToolbox)
-{
- toolbox = aToolbox;
-
- checkHostType(Toolbox.HostType.BOTTOM);
-
- // test UI presence
- let nbox = gBrowser.getNotificationBox();
- let iframe = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-bottom-iframe");
- ok(iframe, "toolbox bottom iframe exists");
-
- checkToolboxLoaded(iframe);
-
- toolbox.switchHost(Toolbox.HostType.SIDE).then(testSidebarHost);
-}
-
-function testSidebarHost()
-{
- checkHostType(Toolbox.HostType.SIDE);
-
- // test UI presence
- let nbox = gBrowser.getNotificationBox();
- let bottom = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-bottom-iframe");
- ok(!bottom, "toolbox bottom iframe doesn't exist");
-
- let iframe = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-side-iframe");
- ok(iframe, "toolbox side iframe exists");
-
- checkToolboxLoaded(iframe);
-
- toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost);
-}
-
-function testWindowHost()
-{
- checkHostType(Toolbox.HostType.WINDOW);
-
- let nbox = gBrowser.getNotificationBox();
- let sidebar = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-side-iframe");
- ok(!sidebar, "toolbox sidebar iframe doesn't exist");
-
- let win = Services.wm.getMostRecentWindow("devtools:toolbox");
- ok(win, "toolbox separate window exists");
-
- let iframe = win.document.getElementById("toolbox-iframe");
- checkToolboxLoaded(iframe);
-
- testToolSelect();
-}
-
-function testToolSelect()
-{
- // make sure we can load a tool after switching hosts
- toolbox.selectTool("inspector").then(testDestroy);
-}
-
-function testDestroy()
-{
- toolbox.destroy().then(function() {
- target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target).then(testRememberHost);
- });
-}
-
-function testRememberHost(aToolbox)
-{
- toolbox = aToolbox;
- // last host was the window - make sure it's the same when re-opening
- is(toolbox.hostType, Toolbox.HostType.WINDOW, "host remembered");
-
- let win = Services.wm.getMostRecentWindow("devtools:toolbox");
- ok(win, "toolbox separate window exists");
-
- cleanup();
-}
-
-function checkHostType(hostType)
-{
- is(toolbox.hostType, hostType, "host type is " + hostType);
-
- let pref = Services.prefs.getCharPref("devtools.toolbox.host");
- is(pref, hostType, "host pref is " + hostType);
-}
-
-function checkToolboxLoaded(iframe)
-{
- let tabs = iframe.contentDocument.getElementById("toolbox-tabs");
- ok(tabs, "toolbox UI has been loaded into iframe");
-}
-
-function cleanup()
-{
- Services.prefs.setCharPref("devtools.toolbox.host", Toolbox.HostType.BOTTOM);
-
- toolbox.destroy().then(function() {
- DevTools = Toolbox = toolbox = target = null;
- gBrowser.removeCurrentTab();
- finish();
- });
- }
diff --git a/browser/devtools/framework/test/browser_toolbox_options.js b/browser/devtools/framework/test/browser_toolbox_options.js
deleted file mode 100644
index f24e03353..000000000
--- a/browser/devtools/framework/test/browser_toolbox_options.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc = null, toolbox = null, panelWin = null, index = 0, prefValues = [], prefNodes = [];
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- gDevTools.showToolbox(target).then(testSelectTool);
- }, true);
-
- content.location = "data:text/html;charset=utf8,test for dynamically registering and unregistering tools";
-}
-
-function testSelectTool(aToolbox) {
- toolbox = aToolbox;
- doc = toolbox.doc;
- toolbox.once("options-selected", testOptionsShortcut);
- toolbox.selectTool("options");
-}
-
-function testOptionsShortcut() {
- ok(true, "Toolbox selected via selectTool method");
- toolbox.once("options-selected", testOptions);
- toolbox.selectTool("webconsole")
- .then(() => synthesizeKeyFromKeyTag("toolbox-options-key", doc));
-}
-
-function testOptions(event, tool) {
- ok(true, "Toolbox selected via button click");
- panelWin = tool.panelWin;
- // Testing pref changes
- let prefCheckboxes = tool.panelDoc.querySelectorAll("checkbox[data-pref]");
- for (let checkbox of prefCheckboxes) {
- prefNodes.push(checkbox);
- prefValues.push(Services.prefs.getBoolPref(checkbox.getAttribute("data-pref")));
- }
- // Do again with opposite values to reset prefs
- for (let checkbox of prefCheckboxes) {
- prefNodes.push(checkbox);
- prefValues.push(!Services.prefs.getBoolPref(checkbox.getAttribute("data-pref")));
- }
- testMouseClicks();
-}
-
-function testMouseClicks() {
- if (index == prefValues.length) {
- checkTools();
- return;
- }
- gDevTools.once("pref-changed", prefChanged);
- info("Click event synthesized for index " + index);
- prefNodes[index].scrollIntoView();
-
- // We use executeSoon here to ensure that the element is in view and
- // clickable.
- executeSoon(function() {
- EventUtils.synthesizeMouseAtCenter(prefNodes[index], {}, panelWin);
- });
-}
-
-function prefChanged(event, data) {
- if (data.pref == prefNodes[index].getAttribute("data-pref")) {
- ok(true, "Correct pref was changed");
- is(data.oldValue, prefValues[index], "Previous value is correct");
- is(data.newValue, !prefValues[index], "New value is correct");
- index++;
- testMouseClicks();
- return;
- }
- ok(false, "Pref was not changed correctly");
- cleanup();
-}
-
-function checkTools() {
- let toolsPref = panelWin.document.querySelectorAll("#default-tools-box > checkbox");
- prefNodes = [];
- index = 0;
- for (let tool of toolsPref) {
- prefNodes.push(tool);
- }
- // Randomize the order in which we remove the tool and then add them back so
- // that we get to know if the tabs are correctly placed as per their ordinals.
- prefNodes = prefNodes.sort(() => Math.random() > 0.5 ? 1: -1);
-
- // Wait for the next turn of the event loop to avoid stack overflow errors.
- executeSoon(toggleTools);
-}
-
-function toggleTools() {
- if (index < prefNodes.length) {
- gDevTools.once("tool-unregistered", checkUnregistered);
- let node = prefNodes[index];
- node.scrollIntoView();
- EventUtils.synthesizeMouseAtCenter(node, {}, panelWin);
- }
- else if (index < 2*prefNodes.length) {
- gDevTools.once("tool-registered", checkRegistered);
- let node = prefNodes[index - prefNodes.length];
- node.scrollIntoView();
- EventUtils.synthesizeMouseAtCenter(node, {}, panelWin);
- }
- else {
- cleanup();
- }
-}
-
-function checkUnregistered(event, data) {
- if (data.id == prefNodes[index].getAttribute("id")) {
- ok(true, "Correct tool removed");
- // checking tab on the toolbox
- ok(!doc.getElementById("toolbox-tab-" + data.id), "Tab removed for " +
- data.id);
- index++;
- // Wait for the next turn of the event loop to avoid stack overflow errors.
- executeSoon(toggleTools);
- return;
- }
- ok(false, "Something went wrong, " + data.id + " was not unregistered");
- cleanup();
-}
-
-function checkRegistered(event, data) {
- if (data == prefNodes[index - prefNodes.length].getAttribute("id")) {
- ok(true, "Correct tool added back");
- // checking tab on the toolbox
- let radio = doc.getElementById("toolbox-tab-" + data);
- ok(radio, "Tab added back for " + data);
- if (radio.previousSibling) {
- ok(+radio.getAttribute("ordinal") >=
- +radio.previousSibling.getAttribute("ordinal"),
- "Inserted tab's ordinal is greater than equal to its previous tab." +
- "Expected " + radio.getAttribute("ordinal") + " >= " +
- radio.previousSibling.getAttribute("ordinal"));
- }
- if (radio.nextSibling) {
- ok(+radio.getAttribute("ordinal") <
- +radio.nextSibling.getAttribute("ordinal"),
- "Inserted tab's ordinal is less than its next tab. Expected " +
- radio.getAttribute("ordinal") + " < " +
- radio.nextSibling.getAttribute("ordinal"));
- }
- index++;
- // Wait for the next turn of the event loop to avoid stack overflow errors.
- executeSoon(toggleTools);
- return;
- }
- ok(false, "Something went wrong, " + data + " was not registered back");
- cleanup();
-}
-
-function cleanup() {
- toolbox.destroy().then(function() {
- gBrowser.removeCurrentTab();
- toolbox = doc = prefNodes = prefValues = panelWin = null;
- finish();
- });
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_options_disablejs.html b/browser/devtools/framework/test/browser_toolbox_options_disablejs.html
deleted file mode 100644
index 4e9a65685..000000000
--- a/browser/devtools/framework/test/browser_toolbox_options_disablejs.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
- <head>
- <title>browser_toolbox_options_disablejs.html</title>
- <meta charset="UTF-8">
- <style>
- div {
- width: 260px;
- height: 24px;
- border: 1px solid #000;
- margin-top: 10px;
- }
-
- iframe {
- height: 90px;
- border: 1px solid #000;
- }
-
- h1 {
- font-size: 20px
- }
- </style>
- <script type="application/javascript;version=1.8">
- function log(msg) {
- let output = document.getElementById("output");
-
- output.innerHTML = msg;
- }
- </script>
- </head>
- <body>
- <h1>Test in page</h1>
- <input id="logJSEnabled"
- type="button"
- value="Log JS Enabled"
- onclick="log('JavaScript Enabled')"/>
- <input id="logJSDisabled"
- type="button"
- value="Log JS Disabled"
- onclick="log('JavaScript Disabled')"/>
- <br>
- <div id="output">No output</div>
- <h1>Test in iframe</h1>
- <iframe src="browser_toolbox_options_disablejs_iframe.html"></iframe>
- </body>
-</html>
diff --git a/browser/devtools/framework/test/browser_toolbox_options_disablejs.js b/browser/devtools/framework/test/browser_toolbox_options_disablejs.js
deleted file mode 100644
index 36c77f2ab..000000000
--- a/browser/devtools/framework/test/browser_toolbox_options_disablejs.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that disabling JavaScript for a tab works as it should.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/framework/" +
- "test/browser_toolbox_options_disablejs.html";
-
-let doc;
-let toolbox;
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- gDevTools.showToolbox(target).then(testSelectTool);
- }, true);
-
- content.location = TEST_URI;
-}
-
-function testSelectTool(aToolbox) {
- toolbox = aToolbox;
- toolbox.once("options-selected", testJSEnabled);
- toolbox.selectTool("options");
-}
-
-function testJSEnabled(event, tool, secondPass) {
- ok(true, "Toolbox selected via selectTool method");
- info("Testing that JS is enabled");
-
- let logJSEnabled = doc.getElementById("logJSEnabled");
- let output = doc.getElementById("output");
-
- // We use executeSoon here because switching docSehll.allowJavascript to true
- // takes a while to become live.
- executeSoon(function() {
- EventUtils.synthesizeMouseAtCenter(logJSEnabled, {}, doc.defaultView);
- is(output.textContent, "JavaScript Enabled", 'Output is "JavaScript Enabled"');
- testJSEnabledIframe(secondPass);
- });
-}
-
-function testJSEnabledIframe(secondPass) {
- info("Testing that JS is enabled in the iframe");
-
- let iframe = doc.querySelector("iframe");
- let iframeDoc = iframe.contentDocument;
- let logJSEnabled = iframeDoc.getElementById("logJSEnabled");
- let output = iframeDoc.getElementById("output");
-
- EventUtils.synthesizeMouseAtCenter(logJSEnabled, {}, iframe.contentWindow);
- is(output.textContent, "JavaScript Enabled",
- 'Output is "JavaScript Enabled" in iframe');
- if (secondPass) {
- finishUp();
- } else {
- toggleJS().then(testJSDisabled);
- }
-}
-
-function toggleJS() {
- let deferred = Promise.defer();
- let panel = toolbox.getCurrentPanel();
- let cbx = panel.panelDoc.getElementById("devtools-disable-javascript");
-
- cbx.scrollIntoView();
-
- if (cbx.checked) {
- info("Clearing checkbox to re-enable JS");
- } else {
- info("Checking checkbox to disable JS");
- }
-
- // After uising scrollIntoView() we need to use executeSoon() to wait for the
- // browser to scroll.
- executeSoon(function() {
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
-
- deferred.resolve();
- }, true);
-
- EventUtils.synthesizeMouseAtCenter(cbx, {}, panel.panelWin);
- });
-
- return deferred.promise;
-}
-
-function testJSDisabled() {
- info("Testing that JS is disabled");
-
- let logJSDisabled = doc.getElementById("logJSDisabled");
- let output = doc.getElementById("output");
-
- EventUtils.synthesizeMouseAtCenter(logJSDisabled, {}, doc.defaultView);
- ok(output.textContent !== "JavaScript Disabled",
- 'output is not "JavaScript Disabled"');
-
- testJSDisabledIframe();
-}
-
-function testJSDisabledIframe() {
- info("Testing that JS is disabled in the iframe");
-
- let iframe = doc.querySelector("iframe");
- let iframeDoc = iframe.contentDocument;
- let logJSDisabled = iframeDoc.getElementById("logJSDisabled");
- let output = iframeDoc.getElementById("output");
-
- EventUtils.synthesizeMouseAtCenter(logJSDisabled, {}, iframe.contentWindow);
- ok(output.textContent !== "JavaScript Disabled",
- 'output is not "JavaScript Disabled" in iframe');
- toggleJS().then(function() {
- testJSEnabled(null, null, true);
- });
-}
-
-function finishUp() {
- doc = toolbox = null;
- finish();
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_options_disablejs_iframe.html b/browser/devtools/framework/test/browser_toolbox_options_disablejs_iframe.html
deleted file mode 100644
index 777bf86bf..000000000
--- a/browser/devtools/framework/test/browser_toolbox_options_disablejs_iframe.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
- <head>
- <title>browser_toolbox_options_disablejs.html</title>
- <meta charset="UTF-8">
- <style>
- div {
- width: 260px;
- height: 24px;
- border: 1px solid #000;
- margin-top: 10px;
- }
- </style>
- <script type="application/javascript;version=1.8">
- function log(msg) {
- let output = document.getElementById("output");
-
- output.innerHTML = msg;
- }
- </script>
- </head>
- <body>
- <input id="logJSEnabled"
- type="button"
- value="Log JS Enabled"
- onclick="log('JavaScript Enabled')"/>
- <input id="logJSDisabled"
- type="button"
- value="Log JS Disabled"
- onclick="log('JavaScript Disabled')"/>
- <br>
- <div id="output">No output</div>
- </body>
-</html>
diff --git a/browser/devtools/framework/test/browser_toolbox_ready.js b/browser/devtools/framework/test/browser_toolbox_ready.js
deleted file mode 100644
index 29336406b..000000000
--- a/browser/devtools/framework/test/browser_toolbox_ready.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- gDevTools.showToolbox(target).then(testReady);
- }, true);
-
- content.location = "data:text/html,test for dynamically registering and unregistering tools";
-}
-
-function testReady(toolbox)
-{
- ok(toolbox.isReady, "toolbox isReady is set");
- testDouble(toolbox);
-}
-
-function testDouble(toolbox)
-{
- let target = toolbox.target;
- let toolId = toolbox.currentToolId;
-
- gDevTools.showToolbox(target, toolId).then(function(toolbox2) {
- is(toolbox2, toolbox, "same toolbox");
- cleanup(toolbox);
- });
-}
-
-function cleanup(toolbox)
-{
- toolbox.destroy().then(function() {
- gBrowser.removeCurrentTab();
- finish();
- });
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_select_event.js b/browser/devtools/framework/test/browser_toolbox_select_event.js
deleted file mode 100644
index 58465b94a..000000000
--- a/browser/devtools/framework/test/browser_toolbox_select_event.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let toolbox;
-
-function test() {
- addTab("about:blank", function() {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "webconsole").then(testSelect);
- });
-}
-
-let called = {
- inspector: false,
- webconsole: false,
- styleeditor: false,
- //jsdebugger: false,
-}
-
-function testSelect(aToolbox) {
- toolbox = aToolbox;
-
- info("Toolbox fired a `ready` event");
-
- toolbox.on("select", selectCB);
-
- toolbox.selectTool("inspector");
- toolbox.selectTool("webconsole");
- toolbox.selectTool("styleeditor");
- //toolbox.selectTool("jsdebugger");
-}
-
-function selectCB(event, id) {
- called[id] = true;
- info("toolbox-select event from " + id);
-
- for (let tool in called) {
- if (!called[tool]) {
- return;
- }
- }
-
- ok(true, "All the tools fired a 'select event'");
- toolbox.off("select", selectCB);
-
- reselect();
-}
-
-function reselect() {
- for (let tool in called) {
- called[tool] = false;
- }
-
- toolbox.once("inspector-selected", function() {
- tidyUpIfAllCalled("inspector");
- });
-
- toolbox.once("webconsole-selected", function() {
- tidyUpIfAllCalled("webconsole");
- });
-
- /*
- toolbox.once("jsdebugger-selected", function() {
- tidyUpIfAllCalled("jsdebugger");
- });
- */
-
- toolbox.once("styleeditor-selected", function() {
- tidyUpIfAllCalled("styleeditor");
- });
-
- toolbox.selectTool("inspector");
- toolbox.selectTool("webconsole");
- toolbox.selectTool("styleeditor");
- //toolbox.selectTool("jsdebugger");
-}
-
-function tidyUpIfAllCalled(id) {
- called[id] = true;
- info("select event from " + id);
-
- for (let tool in called) {
- if (!called[tool]) {
- return;
- }
- }
-
- ok(true, "All the tools fired a {id}-selected event");
- tidyUp();
-}
-
-function tidyUp() {
- toolbox.destroy();
- gBrowser.removeCurrentTab();
-
- toolbox = null;
- finish();
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_sidebar.js b/browser/devtools/framework/test/browser_toolbox_sidebar.js
deleted file mode 100644
index 63bc6ab0d..000000000
--- a/browser/devtools/framework/test/browser_toolbox_sidebar.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- const Cu = Components.utils;
- let {ToolSidebar} = devtools.require("devtools/framework/sidebar");
-
- const toolURL = "data:text/xml;charset=utf8,<?xml version='1.0'?>" +
- "<?xml-stylesheet href='chrome://browser/skin/devtools/common.css' type='text/css'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'>" +
- "<hbox flex='1'><description flex='1'>foo</description><splitter class='devtools-side-splitter'/>" +
- "<tabbox flex='1' id='sidebar' class='devtools-sidebar-tabs'><tabs/><tabpanels flex='1'/></tabbox>" +
- "</hbox>" +
- "</window>";
-
- const tab1URL = "data:text/html;charset=utf8,<title>1</title><p>1</p>";
- const tab2URL = "data:text/html;charset=utf8,<title>2</title><p>2</p>";
- const tab3URL = "data:text/html;charset=utf8,<title>3</title><p>3</p>";
-
- let panelDoc;
- let tab1Selected = false;
- let registeredTabs = {};
- let readyTabs = {};
-
- let toolDefinition = {
- id: "fakeTool4242",
- visibilityswitch: "devtools.fakeTool4242.enabled",
- url: toolURL,
- label: "FAKE TOOL!!!",
- isTargetSupported: function() true,
- build: function(iframeWindow, toolbox) {
- let deferred = Promise.defer();
- executeSoon(function() {
- deferred.resolve({
- target: toolbox.target,
- toolbox: toolbox,
- isReady: true,
- destroy: function(){},
- panelDoc: iframeWindow.document,
- });
- }.bind(this));
- return deferred.promise;
- },
- };
-
- gDevTools.registerTool(toolDefinition);
-
- addTab("about:blank", function(aBrowser, aTab) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, toolDefinition.id).then(function(toolbox) {
- let panel = toolbox.getPanel(toolDefinition.id);
- ok(true, "Tool open");
-
- let tabbox = panel.panelDoc.getElementById("sidebar");
- panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true);
-
- panel.sidebar.on("new-tab-registered", function(event, id) {
- registeredTabs[id] = true;
- });
-
- panel.sidebar.once("tab1-ready", function(event) {
- info(event);
- readyTabs.tab1 = true;
- allTabsReady(panel);
- });
-
- panel.sidebar.once("tab2-ready", function(event) {
- info(event);
- readyTabs.tab2 = true;
- allTabsReady(panel);
- });
-
- panel.sidebar.once("tab3-ready", function(event) {
- info(event);
- readyTabs.tab3 = true;
- allTabsReady(panel);
- });
-
- panel.sidebar.once("tab1-selected", function(event) {
- info(event);
- tab1Selected = true;
- allTabsReady(panel);
- });
-
- panel.sidebar.addTab("tab1", tab1URL, true);
- panel.sidebar.addTab("tab2", tab2URL);
- panel.sidebar.addTab("tab3", tab3URL);
-
- panel.sidebar.show();
- }).then(null, console.error);
- });
-
- function allTabsReady(panel) {
- if (!tab1Selected || !readyTabs.tab1 || !readyTabs.tab2 || !readyTabs.tab3) {
- return;
- }
-
- ok(registeredTabs.tab1, "tab1 registered");
- ok(registeredTabs.tab2, "tab2 registered");
- ok(registeredTabs.tab3, "tab3 registered");
- ok(readyTabs.tab1, "tab1 ready");
- ok(readyTabs.tab2, "tab2 ready");
- ok(readyTabs.tab3, "tab3 ready");
-
- let tabs = panel.sidebar._tabbox.querySelectorAll("tab");
- let panels = panel.sidebar._tabbox.querySelectorAll("tabpanel");
- let label = 1;
- for (let tab of tabs) {
- is(tab.getAttribute("label"), label++, "Tab has the right title");
- }
- is(label, 4, "Found the right amount of tabs.");
- is(panel.sidebar._tabbox.selectedPanel, panels[0], "First tab is selected");
- ok(panel.sidebar.getCurrentTabID(), "tab1", "getCurrentTabID() is correct");
-
- panel.sidebar.once("tab1-unselected", function() {
- ok(true, "received 'unselected' event");
- panel.sidebar.once("tab2-selected", function() {
- ok(true, "received 'selected' event");
- panel.sidebar.hide();
- is(panel.sidebar._tabbox.getAttribute("hidden"), "true", "Sidebar hidden");
- is(panel.sidebar.getWindowForTab("tab1").location.href, tab1URL, "Window is accessible");
- testWidth(panel);
- });
- });
-
- panel.sidebar.select("tab2");
- }
-
- function testWidth(panel) {
- let tabbox = panel.panelDoc.getElementById("sidebar");
- tabbox.width = 420;
- panel.sidebar.destroy().then(function() {
- tabbox.width = 0;
- panel.sidebar = new ToolSidebar(tabbox, panel, "testbug865688", true);
- panel.sidebar.show();
- is(panel.panelDoc.getElementById("sidebar").width, 420, "Width restored")
- finishUp(panel);
- });
- }
-
- function finishUp(panel) {
- panel.sidebar.destroy();
- gDevTools.unregisterTool(toolDefinition.id);
-
- executeSoon(function() {
- gBrowser.removeCurrentTab();
- finish();
- });
- }
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_tool_ready.js b/browser/devtools/framework/test/browser_toolbox_tool_ready.js
deleted file mode 100644
index 061815518..000000000
--- a/browser/devtools/framework/test/browser_toolbox_tool_ready.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- addTab().then(function(data) {
- let toolIds = gDevTools.getToolDefinitionArray().map((def) => def.id);
-
- let open = function(index) {
- let toolId = toolIds[index];
-
- info("About to open " + index + "/" + toolId);
- gDevTools.showToolbox(data.target, toolId).then(function(toolbox) {
- ok(toolbox, "toolbox exists for " + toolId);
- is(toolbox.currentToolId, toolId, "currentToolId should be " + toolId);
-
- let panel = toolbox.getCurrentPanel();
- ok(panel.isReady, toolId + " panel should be ready");
-
- let nextIndex = index + 1;
- if (nextIndex >= toolIds.length) {
- toolbox.destroy();
- finish();
- }
- else {
- open(nextIndex);
- }
- }, console.error);
- };
-
- open(0);
- }).then(null, console.error);
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_window_shortcuts.js b/browser/devtools/framework/test/browser_toolbox_window_shortcuts.js
deleted file mode 100644
index be40d5591..000000000
--- a/browser/devtools/framework/test/browser_toolbox_window_shortcuts.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let Toolbox = devtools.Toolbox;
-
-let toolbox, toolIDs, idIndex;
-
-function test() {
- waitForExplicitFinish();
-
- if (window.navigator.userAgent.indexOf("Mac OS X 10.8") != -1 ||
- window.navigator.userAgent.indexOf("Windows NT 5.1") != -1) {
- info("Skipping Mac OSX 10.8 and Windows xp, see bug 838069");
- finish();
- return;
- }
- addTab("about:blank", function() {
- toolIDs = [];
- for (let [id, definition] of gDevTools._tools) {
- // Skipping Profiler due to bug 838069. Re-enable when bug 845752 is fixed
- if (definition.key && id != "jsprofiler") {
- toolIDs.push(id);
- }
- }
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- idIndex = 0;
- gDevTools.showToolbox(target, toolIDs[0], Toolbox.HostType.WINDOW)
- .then(testShortcuts);
- });
-}
-
-function testShortcuts(aToolbox, aIndex) {
- if (aIndex == toolIDs.length) {
- tidyUp();
- return;
- }
-
- toolbox = aToolbox;
- info("Toolbox fired a `ready` event");
-
- toolbox.once("select", selectCB);
-
- if (aIndex != null) {
- // This if block is to allow the call of selectCB without shortcut press for
- // the first time. That happens because on opening of toolbox, one tool gets
- // selected atleast.
-
- let key = gDevTools._tools.get(toolIDs[aIndex]).key;
- let toolModifiers = gDevTools._tools.get(toolIDs[aIndex]).modifiers;
- let modifiers = {
- accelKey: toolModifiers.contains("accel"),
- altKey: toolModifiers.contains("alt"),
- shiftKey: toolModifiers.contains("shift"),
- };
- idIndex = aIndex;
- info("Testing shortcut for tool " + aIndex + ":" + toolIDs[aIndex] +
- " using key " + key);
- EventUtils.synthesizeKey(key, modifiers, toolbox.doc.defaultView.parent);
- }
-}
-
-function selectCB(event, id) {
- info("toolbox-select event from " + id);
-
- is(toolIDs.indexOf(id), idIndex,
- "Correct tool is selected on pressing the shortcut for " + id);
-
- testShortcuts(toolbox, idIndex + 1);
-}
-
-function tidyUp() {
- toolbox.destroy().then(function() {
- gBrowser.removeCurrentTab();
-
- toolbox = toolIDs = idIndex = Toolbox = null;
- finish();
- });
-}
diff --git a/browser/devtools/framework/test/browser_toolbox_window_title_changes.js b/browser/devtools/framework/test/browser_toolbox_window_title_changes.js
deleted file mode 100644
index 6cf238eeb..000000000
--- a/browser/devtools/framework/test/browser_toolbox_window_title_changes.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let Toolbox = devtools.Toolbox;
-let temp = {};
-Cu.import("resource://gre/modules/Services.jsm", temp);
-let Services = temp.Services;
-temp = null;
-
-function test() {
- waitForExplicitFinish();
-
- const URL_1 = "data:text/plain;charset=UTF-8,abcde";
- const URL_2 = "data:text/plain;charset=UTF-8,12345";
-
- const TOOL_ID_1 = "webconsole";
- const TOOL_ID_2 = "jsdebugger";
-
- const LABEL_1 = "Console";
- const LABEL_2 = "Debugger";
-
- let toolbox;
-
- addTab(URL_1, function () {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM)
- .then(function (aToolbox) { toolbox = aToolbox; })
- .then(function () toolbox.selectTool(TOOL_ID_1))
-
- // undock toolbox and check title
- .then(function () toolbox.switchHost(Toolbox.HostType.WINDOW))
- .then(checkTitle.bind(null, LABEL_1, URL_1, "toolbox undocked"))
-
- // switch to different tool and check title
- .then(function () toolbox.selectTool(TOOL_ID_2))
- .then(checkTitle.bind(null, LABEL_2, URL_1, "tool changed"))
-
- // navigate to different url and check title
- .then(function () {
- let deferred = Promise.defer();
- target.once("navigate", function () deferred.resolve());
- gBrowser.loadURI(URL_2);
- return deferred.promise;
- })
- .then(checkTitle.bind(null, LABEL_2, URL_2, "url changed"))
-
- // destroy toolbox, create new one hosted in a window (with a
- // different tool id), and check title
- .then(function () {
- // Give the tools a chance to handle the navigation event before
- // destroying the toolbox.
- executeSoon(function() {
- toolbox.destroy()
- .then(function () {
- // After destroying the toolbox, a fresh target is required.
- target = TargetFactory.forTab(gBrowser.selectedTab);
- return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW);
- })
- .then(function (aToolbox) { toolbox = aToolbox; })
- .then(function () toolbox.selectTool(TOOL_ID_1))
- .then(checkTitle.bind(null, LABEL_1, URL_2,
- "toolbox destroyed and recreated"))
-
- // clean up
- .then(function () toolbox.destroy())
- .then(function () {
- toolbox = null;
- gBrowser.removeCurrentTab();
- Services.prefs.clearUserPref("devtools.toolbox.host");
- Services.prefs.clearUserPref("devtools.toolbox.selectedTool");
- Services.prefs.clearUserPref("devtools.toolbox.sideEnabled");
- finish();
- });
- });
- });
- });
-}
-
-function checkTitle(toolLabel, url, context) {
- let win = Services.wm.getMostRecentWindow("devtools:toolbox");
- let definitions = gDevTools.getToolDefinitionMap();
- let expectedTitle = toolLabel + " - " + url;
- is(win.document.title, expectedTitle, context);
-}
diff --git a/browser/devtools/framework/test/head.js b/browser/devtools/framework/test/head.js
deleted file mode 100644
index 84a144a74..000000000
--- a/browser/devtools/framework/test/head.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let TargetFactory = gDevTools.TargetFactory;
-
-let tempScope = {};
-Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
-let console = tempScope.console;
-Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", tempScope);
-let Promise = tempScope.Promise;
-
-let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-/**
- * Open a new tab at a URL and call a callback on load
- */
-function addTab(aURL, aCallback)
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- if (aURL != null) {
- content.location = aURL;
- }
-
- let deferred = Promise.defer();
-
- let tab = gBrowser.selectedTab;
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let browser = gBrowser.getBrowserForTab(tab);
-
- function onTabLoad() {
- browser.removeEventListener("load", onTabLoad, true);
-
- if (aCallback != null) {
- aCallback(browser, tab, browser.contentDocument);
- }
-
- deferred.resolve({ browser: browser, tab: tab, target: target });
- }
-
- browser.addEventListener("load", onTabLoad, true);
- return deferred.promise;
-}
-
-registerCleanupFunction(function tearDown() {
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-});
-
-function synthesizeKeyFromKeyTag(aKeyId, document) {
- let key = document.getElementById(aKeyId);
- isnot(key, null, "Successfully retrieved the <key> node");
-
- let modifiersAttr = key.getAttribute("modifiers");
-
- let name = null;
-
- if (key.getAttribute("keycode"))
- name = key.getAttribute("keycode");
- else if (key.getAttribute("key"))
- name = key.getAttribute("key");
-
- isnot(name, null, "Successfully retrieved keycode/key");
-
- let modifiers = {
- shiftKey: modifiersAttr.match("shift"),
- ctrlKey: modifiersAttr.match("ctrl"),
- altKey: modifiersAttr.match("alt"),
- metaKey: modifiersAttr.match("meta"),
- accelKey: modifiersAttr.match("accel")
- }
-
- EventUtils.synthesizeKey(name, modifiers);
-}
diff --git a/browser/devtools/framework/test/moz.build b/browser/devtools/framework/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/framework/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/inspector/moz.build b/browser/devtools/inspector/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/inspector/moz.build
+++ b/browser/devtools/inspector/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/inspector/test/Makefile.in b/browser/devtools/inspector/test/Makefile.in
deleted file mode 100644
index fd8333f80..000000000
--- a/browser/devtools/inspector/test/Makefile.in
+++ /dev/null
@@ -1,49 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_inspector_iframeTest.js \
- browser_inspector_initialization.js \
- browser_inspector_highlighter.js \
- browser_inspector_scrolling.js \
- browser_inspector_bug_665880.js \
- browser_inspector_infobar.js \
- browser_inspector_breadcrumbs.html \
- browser_inspector_breadcrumbs.js \
- browser_inspector_invalidate.js \
- browser_inspector_menu.js \
- browser_inspector_menu.html \
- browser_inspector_pseudoClass_menu.js \
- browser_inspector_destroyselection.html \
- browser_inspector_destroyselection.js \
- browser_inspector_bug_699308_iframe_navigation.js \
- browser_inspector_bug_672902_keyboard_shortcuts.js \
- browser_inspector_sidebarstate.js \
- browser_inspector_pseudoclass_lock.js \
- browser_inspector_cmd_inspect.js \
- browser_inspector_cmd_inspect.html \
- browser_inspector_highlighter_autohide.js \
- browser_inspector_changes.js \
- browser_inspector_bug_674871.js \
- browser_inspector_bug_817558_delete_node.js \
- browser_inspector_bug_650804_search.js \
- browser_inspector_bug_650804_search.html \
- browser_inspector_bug_831693_input_suggestion.js \
- browser_inspector_bug_831693_searchbox_panel_navigation.js \
- browser_inspector_bug_831693_combinator_suggestions.js \
- browser_inspector_bug_831693_search_suggestions.html \
- browser_inspector_bug_835722_infobar_reappears.js \
- browser_inspector_bug_840156_destroy_after_navigation.js \
- head.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html b/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html
deleted file mode 100644
index bba7d21c1..000000000
--- a/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <style>
- div {
- min-height: 10px; min-width: 10px;
- border: 1px solid red;
- margin: 10px;
- }
- </style>
- </head>
- <body>
- <article id="i1">
- <div id="i11">
- <div id="i111">
- <div id="i1111">
- </div>
- </div>
- </div>
- </article>
- <article id="i2">
- <div id="i21">
- <div id="i211">
- <div id="i2111">
- </div>
- </div>
- </div>
- <div id="i22">
- <div id="i221">
- </div>
- <div id="i222">
- <div id="i2221">
- <div id="i22211">
- </div>
- </div>
- </div>
- </div>
- </article>
- </body>
-</html>
diff --git a/browser/devtools/inspector/test/browser_inspector_breadcrumbs.js b/browser/devtools/inspector/test/browser_inspector_breadcrumbs.js
deleted file mode 100644
index a6d1b2c31..000000000
--- a/browser/devtools/inspector/test/browser_inspector_breadcrumbs.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- let nodes = [
- {nodeId: "i1111", result: "i1 i11 i111 i1111"},
- {nodeId: "i22", result: "i2 i22 i221"},
- {nodeId: "i2111", result: "i2 i21 i211 i2111"},
- {nodeId: "i21", result: "i2 i21 i211 i2111"},
- {nodeId: "i22211", result: "i2 i22 i222 i2221 i22211"},
- {nodeId: "i22", result: "i2 i22 i222 i2221 i22211"},
- ];
-
- let doc;
- let nodes;
- let cursor;
- let inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html";
-
- function setupTest()
- {
- for (let i = 0; i < nodes.length; i++) {
- let node = doc.getElementById(nodes[i].nodeId);
- nodes[i].node = node;
- ok(nodes[i].node, "node " + nodes[i].nodeId + " found");
- }
-
- openInspector(runTests);
- }
-
- function runTests(aInspector)
- {
- inspector = aInspector;
- cursor = 0;
- inspector.selection.on("new-node", nodeSelected);
- executeSoon(function() {
- inspector.selection.setNode(nodes[0].node);
- });
- }
-
- function nodeSelected()
- {
- executeSoon(function() {
- performTest();
- cursor++;
- if (cursor >= nodes.length) {
- inspector.selection.off("new-node", nodeSelected);
- finishUp();
- } else {
- let node = nodes[cursor].node;
- inspector.selection.setNode(node);
- }
- });
- }
-
- function performTest()
- {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let panel = gDevTools.getToolbox(target).getPanel("inspector");
- let container = panel.panelDoc.getElementById("inspector-breadcrumbs");
- let buttonsLabelIds = nodes[cursor].result.split(" ");
-
- // html > body > …
- is(container.childNodes.length, buttonsLabelIds.length + 2, "Node " + cursor + ": Items count");
-
- for (let i = 2; i < container.childNodes.length; i++) {
- let expectedId = "#" + buttonsLabelIds[i - 2];
- let button = container.childNodes[i];
- let labelId = button.querySelector(".breadcrumbs-widget-item-id");
- is(labelId.textContent, expectedId, "Node " + cursor + ": button " + i + " matches");
- }
-
- let checkedButton = container.querySelector("button[checked]");
- let labelId = checkedButton.querySelector(".breadcrumbs-widget-item-id");
- let id = inspector.selection.node.id;
- is(labelId.textContent, "#" + id, "Node " + cursor + ": selection matches");
- }
-
- function finishUp() {
- doc = nodes = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_650804_search.html b/browser/devtools/inspector/test/browser_inspector_bug_650804_search.html
deleted file mode 100644
index 262eb0be6..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_650804_search.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Inspector Search Box Test</title>
-</head>
-<body>
-
- <!-- This is a list of 0 h1 elements -->
-
- <!-- This is a list of 2 div elements -->
- <div id="d1">Hello, I'm a div</div>
- <div id="d2" class="c1">Hello, I'm another div</div>
-
- <!-- This is a list of 2 span elements -->
- <span id="s1">Hello, I'm a span</span>
- <span class="c1" id="s2">And me</span>
-
- <!-- This is a collection of various things that match only once -->
- <p class="c1" id="p1">.someclass</p>
- <p id="p2">#someid</p>
- <button id="b1" disabled>button[disabled]</button>
- <p id="p3" class="c2"><strong>p&gt;strong</strong></p>
-
-</body>
-</html>
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_650804_search.js b/browser/devtools/inspector/test/browser_inspector_bug_650804_search.js
deleted file mode 100644
index 17d79ea7a..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_650804_search.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- let inspector, searchBox, state;
- let keypressStates = [3,4,8,18,19,20,21,22];
-
- // The various states of the inspector: [key, id, isValid]
- // [
- // what key to press,
- // what id should be selected after the keypress,
- // is the searched text valid selector
- // ]
- let keyStates = [
- ["d", "b1", false],
- ["i", "b1", false],
- ["v", "d1", true],
- ["VK_DOWN", "d2", true],
- ["VK_ENTER", "d1", true],
- [".", "d1", false],
- ["c", "d1", false],
- ["1", "d2", true],
- ["VK_DOWN", "d2", true],
- ["VK_BACK_SPACE", "d2", false],
- ["VK_BACK_SPACE", "d2", false],
- ["VK_BACK_SPACE", "d1", true],
- ["VK_BACK_SPACE", "d1", false],
- ["VK_BACK_SPACE", "d1", false],
- ["VK_BACK_SPACE", "d1", true],
- [".", "d1", false],
- ["c", "d1", false],
- ["1", "d2", true],
- ["VK_DOWN", "s2", true],
- ["VK_DOWN", "p1", true],
- ["VK_UP", "s2", true],
- ["VK_UP", "d2", true],
- ["VK_UP", "p1", true],
- ["VK_BACK_SPACE", "p1", false],
- ["2", "p3", true],
- ["VK_BACK_SPACE", "p3", false],
- ["VK_BACK_SPACE", "p3", false],
- ["VK_BACK_SPACE", "p3", true],
- ["r", "p3", false],
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_bug_650804_search.html";
-
- function $(id) {
- if (id == null) return null;
- return content.document.getElementById(id);
- }
-
- function setupTest()
- {
- openInspector(startTest);
- }
-
- function startTest(aInspector)
- {
- inspector = aInspector;
- inspector.selection.setNode($("b1"));
- searchBox =
- inspector.panelWin.document.getElementById("inspector-searchbox");
-
- focusSearchBoxUsingShortcut(inspector.panelWin, function() {
- searchBox.addEventListener("command", checkState, true);
- searchBox.addEventListener("keypress", checkState, true);
- checkStateAndMoveOn(0);
- });
- }
-
- function checkStateAndMoveOn(index) {
- if (index == keyStates.length) {
- finishUp();
- return;
- }
-
- let [key, id, isValid] = keyStates[index];
- state = index;
-
- info("pressing key " + key + " to get id " + id);
- EventUtils.synthesizeKey(key, {}, inspector.panelWin);
- }
-
- function checkState(event) {
- if (event.type == "keypress" && keypressStates.indexOf(state) == -1) {
- return;
- }
- executeSoon(function() {
- let [key, id, isValid] = keyStates[state];
- info(inspector.selection.node.id + " is selected with text " +
- inspector.searchBox.value);
- is(inspector.selection.node, $(id),
- "Correct node is selected for state " + state);
- is(!searchBox.classList.contains("devtools-no-search-result"), isValid,
- "Correct searchbox result state for state " + state);
- checkStateAndMoveOn(state + 1);
- });
- }
-
- function finishUp() {
- searchBox = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_665880.js b/browser/devtools/inspector/test/browser_inspector_bug_665880.js
deleted file mode 100644
index 6d990d5c8..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_665880.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-function test()
-{
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- let doc;
- let objectNode;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(setupObjectInspectionTest, content);
- }, true);
-
- content.location = "data:text/html,<object style='padding: 100px'><p>foobar</p></object>";
-
- function setupObjectInspectionTest()
- {
- objectNode = doc.querySelector("object");
- ok(objectNode, "we have the object node");
- openInspector(runObjectInspectionTest);
- }
-
- function runObjectInspectionTest(inspector)
- {
- inspector.highlighter.once("locked", performTestComparison);
- inspector.selection.setNode(objectNode, "");
- }
-
- function performTestComparison()
- {
- is(getActiveInspector().selection.node, objectNode, "selection matches node");
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- executeSoon(function() {
- gDevTools.closeToolbox(target);
- finishUp();
- });
- }
-
-
- function finishUp() {
- doc = objectNode = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_672902_keyboard_shortcuts.js b/browser/devtools/inspector/test/browser_inspector_bug_672902_keyboard_shortcuts.js
deleted file mode 100644
index 79ba64580..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_672902_keyboard_shortcuts.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-// Tests that the keybindings for highlighting different elements work as
-// intended.
-
-function test()
-{
- waitForExplicitFinish();
-
- let doc;
- let node;
- let inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupKeyBindingsTest, content);
- }, true);
-
- content.location = "data:text/html,<html><head><title>Test for the " +
- "highlighter keybindings</title></head><body><h1>Hello" +
- "</h1><p><strong>Greetings, earthlings!</strong> I come" +
- " in peace.</body></html>";
-
- function setupKeyBindingsTest()
- {
- openInspector(findAndHighlightNode);
- }
-
- function findAndHighlightNode(aInspector, aToolbox)
- {
- inspector = aInspector;
-
- executeSoon(function() {
- inspector.selection.once("new-node", highlightHeaderNode);
- // Test that navigating around without a selected node gets us to the
- // head element.
- node = doc.querySelector("h1");
- let bc = inspector.breadcrumbs;
- bc.nodeHierarchy[bc.currentIndex].button.focus();
- EventUtils.synthesizeKey("VK_RIGHT", { });
- });
- }
-
- function highlightHeaderNode()
- {
- is(inspector.selection.node, node, "selected h1 element");
-
- executeSoon(function() {
- inspector.selection.once("new-node", highlightParagraphNode);
- // Test that moving to the next sibling works.
- node = doc.querySelector("p");
- EventUtils.synthesizeKey("VK_DOWN", { });
- });
- }
-
- function highlightParagraphNode()
- {
- is(inspector.selection.node, node, "selected p element");
-
- executeSoon(function() {
- inspector.selection.once("new-node", highlightHeaderNodeAgain);
- // Test that moving to the previous sibling works.
- node = doc.querySelector("h1");
- EventUtils.synthesizeKey("VK_UP", { });
- });
- }
-
- function highlightHeaderNodeAgain()
- {
- is(inspector.selection.node, node, "selected h1 element");
-
- executeSoon(function() {
- inspector.selection.once("new-node", highlightParentNode);
- // Test that moving to the parent works.
- node = doc.querySelector("body");
- EventUtils.synthesizeKey("VK_LEFT", { });
- });
- }
-
- function highlightParentNode()
- {
- is(inspector.selection.node, node, "selected body element");
- finishUp();
- }
-
- function finishUp() {
- doc = node = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_674871.js b/browser/devtools/inspector/test/browser_inspector_bug_674871.js
deleted file mode 100644
index ed448d8f1..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_674871.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- let doc;
- let iframeNode, iframeBodyNode;
-
- let iframeSrc = "<style>" +
- "body {" +
- "margin:0;" +
- "height:100%;" +
- "background-color:red" +
- "}" +
- "</style>" +
- "<body></body>";
- let docSrc = "<style>" +
- "iframe {" +
- "height:200px;" +
- "border: 11px solid black;" +
- "padding: 13px;" +
- "}" +
- "body,iframe {" +
- "margin:0" +
- "}" +
- "</style>" +
- "<body>" +
- "<iframe src='data:text/html," + iframeSrc + "'></iframe>" +
- "</body>";
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "data:text/html," + docSrc;
-
- function setupTest()
- {
- iframeNode = doc.querySelector("iframe");
- iframeBodyNode = iframeNode.contentDocument.querySelector("body");
- ok(iframeNode, "we have the iframe node");
- ok(iframeBodyNode, "we have the body node");
- openInspector(runTests);
- }
-
- function runTests(inspector)
- {
- executeSoon(function() {
- inspector.highlighter.once("highlighting", isTheIframeSelected);
- moveMouseOver(iframeNode, 1, 1);
- });
- }
-
- function isTheIframeSelected()
- {
- let inspector = getActiveInspector();
-
- is(inspector.selection.node, iframeNode, "selection matches node");
- iframeNode.style.marginBottom = doc.defaultView.innerHeight + "px";
- doc.defaultView.scrollBy(0, 40);
-
- executeSoon(function() {
- inspector.selection.once("new-node", isTheIframeContentSelected);
- moveMouseOver(iframeNode, 40, 40);
- });
- }
-
- function isTheIframeContentSelected()
- {
- let inspector = getActiveInspector();
- is(inspector.selection.node, iframeBodyNode, "selection matches node");
- // 184 == 200 + 11(border) + 13(padding) - 40(scroll)
- is(inspector.highlighter._highlightRect.height, 184,
- "highlighter height");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- finishUp();
- }
-
- function finishUp() {
- doc = iframeNode = iframeBodyNode = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-
-
- function moveMouseOver(aElement, x, y)
- {
- EventUtils.synthesizeMouse(aElement, x, y, {type: "mousemove"},
- aElement.ownerDocument.defaultView);
- }
-
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_699308_iframe_navigation.js b/browser/devtools/inspector/test/browser_inspector_bug_699308_iframe_navigation.js
deleted file mode 100644
index 3f9355dd7..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_699308_iframe_navigation.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let iframe;
- let iframeLoads = 0;
- let checksAfterLoads = false;
- let inspector;
-
- function startTest() {
- openInspector(runInspectorTests);
- }
-
- function runInspectorTests(aInspector) {
- inspector = aInspector;
-
- iframe = content.document.querySelector("iframe");
- ok(iframe, "found the iframe element");
-
- ok(inspector.highlighter._highlighting, "Inspector is highlighting");
-
- iframe.addEventListener("load", onIframeLoad, false);
-
- executeSoon(function() {
- iframe.contentWindow.location = "javascript:location.reload()";
- });
- }
-
- function onIframeLoad() {
- if (++iframeLoads != 2) {
- executeSoon(function() {
- iframe.contentWindow.location = "javascript:location.reload()";
- });
- return;
- }
-
- iframe.removeEventListener("load", onIframeLoad, false);
-
- ok(inspector.highlighter._highlighting, "Inspector is highlighting after iframe nav");
-
- checksAfterLoads = true;
-
- finishTest();
- }
-
- function finishTest() {
- is(iframeLoads, 2, "iframe loads");
- ok(checksAfterLoads, "the Inspector tests got the chance to run after iframe reloads");
-
- iframe = null;
- gBrowser.removeCurrentTab();
- executeSoon(finish);
- }
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,<p>bug 699308 - test iframe navigation" +
- "<iframe src='data:text/html,hello world'></iframe>";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_817558_delete_node.js b/browser/devtools/inspector/test/browser_inspector_bug_817558_delete_node.js
deleted file mode 100644
index da286979b..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_817558_delete_node.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
- //ignoreAllUncaughtExceptions();
-
- let node, iframe, inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html";
-
- function setupTest()
- {
- iframe = content.document.querySelector("iframe");
- node = iframe.contentDocument.querySelector("span");
- openInspector(runTests);
- }
-
- function runTests(aInspector)
- {
- inspector = aInspector;
- inspector.selection.setNode(node);
-
- let parentNode = node.parentNode;
- parentNode.removeChild(node);
-
- let tmp = {};
- Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tmp);
- ok(!tmp.LayoutHelpers.isNodeConnected(node), "Node considered as disconnected.");
- executeSoon(function() {
- is(inspector.selection.node, parentNode, "parent of selection got selected");
-
- finishUp();
- });
- }
-
- function finishUp() {
- node = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js b/browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js
deleted file mode 100644
index 1d22bb55f..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_combinator_suggestions.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- let inspector, searchBox, state, popup;
-
- // The various states of the inspector: [key, suggestions array]
- // [
- // what key to press,
- // suggestions array with count [
- // [suggestion1, count1], [suggestion2] ...
- // ] count can be left to represent 1
- // ]
- let keyStates = [
- ["d", [["div", 4]]],
- ["i", [["div", 4]]],
- ["v", []],
- [" ", [["div div", 2], ["div span", 2]]],
- [">", [["div >div", 2], ["div >span", 2]]],
- ["VK_BACK_SPACE", [["div div", 2], ["div span", 2]]],
- ["+", [["div +span"]]],
- ["VK_BACK_SPACE", [["div div", 2], ["div span", 2]]],
- ["VK_BACK_SPACE", []],
- ["VK_BACK_SPACE", [["div", 4]]],
- ["VK_BACK_SPACE", [["div", 4]]],
- ["VK_BACK_SPACE", []],
- ["p", []],
- [" ", [["p strong"]]],
- ["+", [["p +button"], ["p +p"]]],
- ["b", [["p +button"]]],
- ["u", [["p +button"]]],
- ["t", [["p +button"]]],
- ["t", [["p +button"]]],
- ["o", [["p +button"]]],
- ["n", []],
- ["+", [["p +button+p"]]],
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html";
-
- function $(id) {
- if (id == null) return null;
- return content.document.getElementById(id);
- }
-
- function setupTest()
- {
- openInspector(startTest);
- }
-
- function startTest(aInspector)
- {
- inspector = aInspector;
- searchBox =
- inspector.panelWin.document.getElementById("inspector-searchbox");
- popup = inspector.searchSuggestions.searchPopup;
-
- focusSearchBoxUsingShortcut(inspector.panelWin, function() {
- searchBox.addEventListener("command", checkState, true);
- checkStateAndMoveOn(0);
- });
- }
-
- function checkStateAndMoveOn(index) {
- if (index == keyStates.length) {
- finishUp();
- return;
- }
-
- let [key, suggestions] = keyStates[index];
- state = index;
-
- info("pressing key " + key + " to get suggestions " +
- JSON.stringify(suggestions));
- EventUtils.synthesizeKey(key, {}, inspector.panelWin);
- }
-
- function checkState(event) {
- executeSoon(function() {
- let [key, suggestions] = keyStates[state];
- let actualSuggestions = popup.getItems();
- is(popup._panel.state == "open" || popup._panel.state == "showing"
- ? actualSuggestions.length: 0, suggestions.length,
- "There are expected number of suggestions at " + state + "th step.");
- actualSuggestions = actualSuggestions.reverse();
- for (let i = 0; i < suggestions.length; i++) {
- is(suggestions[i][0], actualSuggestions[i].label,
- "The suggestion at " + i + "th index for " + state +
- "th step is correct.")
- is(suggestions[i][1] || 1, actualSuggestions[i].count,
- "The count for suggestion at " + i + "th index for " + state +
- "th step is correct.")
- }
- checkStateAndMoveOn(state + 1);
- });
- }
-
- function finishUp() {
- searchBox = null;
- popup = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js b/browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js
deleted file mode 100644
index 03a5ec335..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_input_suggestion.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- let inspector, searchBox, state, popup;
-
- // The various states of the inspector: [key, suggestions array]
- // [
- // what key to press,
- // suggestions array with count [
- // [suggestion1, count1], [suggestion2] ...
- // ] count can be left to represent 1
- // ]
- let keyStates = [
- ["d", [["div", 2]]],
- ["i", [["div", 2]]],
- ["v", []],
- [".", [["div.c1"]]],
- ["VK_BACK_SPACE", []],
- ["#", [["div#d1"], ["div#d2"]]],
- ["VK_BACK_SPACE", []],
- ["VK_BACK_SPACE", [["div", 2]]],
- ["VK_BACK_SPACE", [["div", 2]]],
- ["VK_BACK_SPACE", []],
- [".", [[".c1", 3], [".c2"]]],
- ["c", [[".c1", 3], [".c2"]]],
- ["2", []],
- ["VK_BACK_SPACE", [[".c1", 3], [".c2"]]],
- ["1", []],
- ["#", [["#d2"], ["#p1"], ["#s2"]]],
- ["VK_BACK_SPACE", []],
- ["VK_BACK_SPACE", [[".c1", 3], [".c2"]]],
- ["VK_BACK_SPACE", [[".c1", 3], [".c2"]]],
- ["VK_BACK_SPACE", []],
- ["#", [["#b1"], ["#d1"], ["#d2"], ["#p1"], ["#p2"], ["#p3"], ["#s1"], ["#s2"]]],
- ["p", [["#p1"], ["#p2"], ["#p3"]]],
- ["VK_BACK_SPACE", [["#b1"], ["#d1"], ["#d2"], ["#p1"], ["#p2"], ["#p3"], ["#s1"], ["#s2"]]],
- ["VK_BACK_SPACE", []],
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_bug_650804_search.html";
-
- function $(id) {
- if (id == null) return null;
- return content.document.getElementById(id);
- }
-
- function setupTest()
- {
- openInspector(startTest);
- }
-
- function startTest(aInspector)
- {
- inspector = aInspector;
- searchBox =
- inspector.panelWin.document.getElementById("inspector-searchbox");
- popup = inspector.searchSuggestions.searchPopup;
-
- focusSearchBoxUsingShortcut(inspector.panelWin, function() {
- searchBox.addEventListener("command", checkState, true);
- checkStateAndMoveOn(0);
- });
- }
-
- function checkStateAndMoveOn(index) {
- if (index == keyStates.length) {
- finishUp();
- return;
- }
-
- let [key, suggestions] = keyStates[index];
- state = index;
-
- info("pressing key " + key + " to get suggestions " +
- JSON.stringify(suggestions));
- EventUtils.synthesizeKey(key, {}, inspector.panelWin);
- }
-
- function checkState(event) {
- executeSoon(function() {
- let [key, suggestions] = keyStates[state];
- let actualSuggestions = popup.getItems();
- is(popup._panel.state == "open" || popup._panel.state == "showing"
- ? actualSuggestions.length: 0, suggestions.length,
- "There are expected number of suggestions at " + state + "th step.");
- actualSuggestions = actualSuggestions.reverse();
- for (let i = 0; i < suggestions.length; i++) {
- is(suggestions[i][0], actualSuggestions[i].label,
- "The suggestion at " + i + "th index for " + state +
- "th step is correct.")
- is(suggestions[i][1] || 1, actualSuggestions[i].count,
- "The count for suggestion at " + i + "th index for " + state +
- "th step is correct.")
- }
- checkStateAndMoveOn(state + 1);
- });
- }
-
- function finishUp() {
- searchBox = null;
- popup = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html b/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html
deleted file mode 100644
index a84a2e3d4..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Inspector Search Box Test</title>
-</head>
-<body>
- <div id="d1">
- <div class="l1">
- <div id="d2" class="c1">Hello, I'm nested div</div>
- </div>
- </div>
- <span id="s1">Hello, I'm a span
- <div class="l1">
- <span>Hi I am a nested span</span>
- <span class="s4">Hi I am a nested classed span</span>
- </div>
- </span>
- <span class="c1" id="s2">And me</span>
-
- <p class="c1" id="p1">.someclass</p>
- <p id="p2">#someid</p>
- <button id="b1" disabled>button[disabled]</button>
- <p id="p3" class="c2"><strong>p&gt;strong</strong></p>
-
-</body>
-</html>
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_831693_searchbox_panel_navigation.js b/browser/devtools/inspector/test/browser_inspector_bug_831693_searchbox_panel_navigation.js
deleted file mode 100644
index 6ccafe5bd..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_831693_searchbox_panel_navigation.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
- requestLongerTimeout(2);
-
- let inspector, searchBox, state, panel;
- let panelOpeningStates = [0, 3, 9, 14, 17];
- let panelClosingStates = [2, 8, 13, 16];
-
- // The various states of the inspector: [key, query]
- // [
- // what key to press,
- // what should be the text in the searchbox
- // ]
- let keyStates = [
- ["d", "d"],
- ["i", "di"],
- ["v", "div"],
- [".", "div."],
- ["VK_UP", "div.c1"],
- ["VK_DOWN", "div.l1"],
- ["VK_DOWN", "div.l1"],
- ["VK_BACK_SPACE", "div.l"],
- ["VK_TAB", "div.l1"],
- [" ", "div.l1 "],
- ["VK_UP", "div.l1 DIV"],
- ["VK_UP", "div.l1 DIV"],
- [".", "div.l1 DIV."],
- ["VK_TAB", "div.l1 DIV.c1"],
- ["VK_BACK_SPACE", "div.l1 DIV.c"],
- ["VK_BACK_SPACE", "div.l1 DIV."],
- ["VK_BACK_SPACE", "div.l1 DIV"],
- ["VK_BACK_SPACE", "div.l1 DI"],
- ["VK_BACK_SPACE", "div.l1 D"],
- ["VK_BACK_SPACE", "div.l1 "],
- ["VK_UP", "div.l1 DIV"],
- ["VK_BACK_SPACE", "div.l1 DI"],
- ["VK_BACK_SPACE", "div.l1 D"],
- ["VK_BACK_SPACE", "div.l1 "],
- ["VK_UP", "div.l1 DIV"],
- ["VK_UP", "div.l1 DIV"],
- ["VK_TAB", "div.l1 DIV"],
- ["VK_BACK_SPACE", "div.l1 DI"],
- ["VK_BACK_SPACE", "div.l1 D"],
- ["VK_BACK_SPACE", "div.l1 "],
- ["VK_DOWN", "div.l1 DIV"],
- ["VK_DOWN", "div.l1 SPAN"],
- ["VK_DOWN", "div.l1 SPAN"],
- ["VK_BACK_SPACE", "div.l1 SPA"],
- ["VK_BACK_SPACE", "div.l1 SP"],
- ["VK_BACK_SPACE", "div.l1 S"],
- ["VK_BACK_SPACE", "div.l1 "],
- ["VK_BACK_SPACE", "div.l1"],
- ["VK_BACK_SPACE", "div.l"],
- ["VK_BACK_SPACE", "div."],
- ["VK_BACK_SPACE", "div"],
- ["VK_BACK_SPACE", "di"],
- ["VK_BACK_SPACE", "d"],
- ["VK_BACK_SPACE", ""],
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_bug_831693_search_suggestions.html";
-
- function $(id) {
- if (id == null) return null;
- return content.document.getElementById(id);
- }
-
- function setupTest()
- {
- openInspector(startTest);
- }
-
- function startTest(aInspector)
- {
- inspector = aInspector;
- searchBox =
- inspector.panelWin.document.getElementById("inspector-searchbox");
- panel = inspector.searchSuggestions.searchPopup._list;
-
- focusSearchBoxUsingShortcut(inspector.panelWin, function() {
- searchBox.addEventListener("keypress", checkState, true);
- panel.addEventListener("keypress", checkState, true);
- checkStateAndMoveOn(0);
- });
- }
-
- function checkStateAndMoveOn(index) {
- if (index == keyStates.length) {
- finishUp();
- return;
- }
-
- let [key, query] = keyStates[index];
- state = index;
-
- info("pressing key " + key + " to get searchbox value as " + query);
- EventUtils.synthesizeKey(key, {}, inspector.panelWin);
- }
-
- function checkState(event) {
- if (panelOpeningStates.indexOf(state) != -1 &&
- !inspector.searchSuggestions.searchPopup.isOpen) {
- info("Panel is not open, should wait before it shows up.");
- panel.parentNode.addEventListener("popupshown", function retry() {
- panel.parentNode.removeEventListener("popupshown", retry, false);
- info("Panel is visible now");
- executeSoon(checkState);
- }, false);
- return;
- }
- else if (panelClosingStates.indexOf(state) != -1 &&
- panel.parentNode.state != "closed") {
- info("Panel is open, should wait for it to close.");
- panel.parentNode.addEventListener("popuphidden", function retry() {
- panel.parentNode.removeEventListener("popuphidden", retry, false);
- info("Panel is hidden now");
- executeSoon(checkState);
- }, false);
- return;
- }
-
- // Using setTimout as the "command" event fires at delay after keypress
- window.setTimeout(function() {
- let [key, query] = keyStates[state];
-
- if (searchBox.value == query) {
- ok(true, "The suggestion at " + state + "th step on " +
- "pressing " + key + " key is correct.");
- }
- else {
- info("value is not correct, waiting longer for state " + state +
- " with panel " + panel.parentNode.state);
- checkState();
- return;
- }
- checkStateAndMoveOn(state + 1);
- }, 200);
- }
-
- function finishUp() {
- searchBox = null;
- panel = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_835722_infobar_reappears.js b/browser/devtools/inspector/test/browser_inspector_bug_835722_infobar_reappears.js
deleted file mode 100644
index 503d4a319..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_835722_infobar_reappears.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let inspector, utils;
-
- function startLocationTests() {
- openInspector(runInspectorTests);
- }
-
- function runInspectorTests(aInspector) {
- inspector = aInspector;
- utils = inspector.panelWin
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils);
- ok(utils, "utils is defined");
- executeSoon(function() {
- inspector.selection.once("new-node", onNewSelection);
- info("selecting the DOCTYPE node");
- inspector.selection.setNode(content.document.doctype, "test");
- });
- }
-
- function sendMouseEvent(node, type, x, y) {
- let rect = node.getBoundingClientRect();
- let left = rect.left + x;
- let top = rect.top + y;
- utils.sendMouseEventToWindow(type, left, top, 0, 1, 0, false, 0, 0);
- }
-
- function onNewSelection() {
- is(inspector.highlighter.isHidden(), true,
- "The infobar should be hidden now on selecting a non element node.");
- inspector.sidebar.select("ruleview");
- let ruleView = inspector.sidebar.getTab("ruleview");
- ruleView.addEventListener("mouseover", function onMouseOver() {
- ruleView.removeEventListener("mouseover", onMouseOver, false);
- is(inspector.highlighter.isHidden(), true,
- "The infobar was hidden so mouseover on the rules view did nothing");
- executeSoon(mouseOutAndContinue);
- }, false);
- sendMouseEvent(ruleView, "mouseover", 10, 10);
- }
-
- function mouseOutAndContinue() {
- let ruleView = inspector.sidebar.getTab("ruleview");
- info("adding mouseout listener");
- ruleView.addEventListener("mouseout", function onMouseOut() {
- info("mouseout happened");
- ruleView.removeEventListener("mouseout", onMouseOut, false);
- is(inspector.highlighter.isHidden(), true,
- "The infobar should not be visible after we mouseout of rules view");
- switchToWebConsole();
- }, false);
- info("Synthesizing mouseout on " + ruleView);
- sendMouseEvent(inspector._markupBox, "mousemove", 50, 50);
- info("mouseout synthesized");
- }
-
- function switchToWebConsole() {
- inspector.selection.once("new-node", function() {
- is(inspector.highlighter.isHidden(), false,
- "The infobar should be visible after we select a div.");
- gDevTools.showToolbox(inspector.target, "webconsole").then(function() {
- is(inspector.highlighter.isHidden(), true,
- "The infobar should not be visible after we switched to webconsole");
- reloadAndWait();
- });
- });
- inspector.selection.setNode(content.document.querySelector("div"), "test");
- }
-
- function reloadAndWait() {
- gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
- waitForFocus(testAfterReload, content);
- }, true);
- content.location.reload();
- }
-
- function testAfterReload() {
- is(inspector.highlighter.isHidden(), true,
- "The infobar should not be visible after we reload with webconsole shown");
- testEnd();
- }
-
- function testEnd() {
- gBrowser.removeCurrentTab();
- utils = null;
- executeSoon(finish);
- }
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onBrowserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onBrowserLoad, true);
- waitForFocus(startLocationTests, content);
- }, true);
-
- content.location = "data:text/html,<!DOCTYPE html><div>Infobar should not " +
- "reappear</div><p>init</p>";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_bug_840156_destroy_after_navigation.js b/browser/devtools/inspector/test/browser_inspector_bug_840156_destroy_after_navigation.js
deleted file mode 100644
index 17072c7a6..000000000
--- a/browser/devtools/inspector/test/browser_inspector_bug_840156_destroy_after_navigation.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let Promise = devtools.require("sdk/core/promise");
-let Toolbox = devtools.Toolbox;
-let TargetFactory = devtools.TargetFactory;
-
-function test() {
- waitForExplicitFinish();
-
- const URL_1 = "data:text/plain;charset=UTF-8,abcde";
- const URL_2 = "data:text/plain;charset=UTF-8,12345";
-
- let target, toolbox;
-
- // open tab, load URL_1, and wait for load to finish
- let tab = gBrowser.selectedTab = gBrowser.addTab();
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let deferred = Promise.defer();
- let browser = gBrowser.getBrowserForTab(tab);
- function onTabLoad() {
- browser.removeEventListener("load", onTabLoad, true);
- deferred.resolve(null);
- }
- browser.addEventListener("load", onTabLoad, true);
- browser.loadURI(URL_1);
-
- // open devtools panel
- deferred.promise
- .then(function () gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM))
- .then(function (aToolbox) { toolbox = aToolbox; })
-
- // select the inspector
- .then(function () toolbox.selectTool("inspector"))
-
- // navigate to URL_2
- .then(function () {
- let deferred = Promise.defer();
- target.once("navigate", function () deferred.resolve());
- browser.loadURI(URL_2);
- return deferred.promise;
- })
-
- // destroy the toolbox (and hence the inspector) before the load completes
- .then(function () toolbox.destroy())
-
- // this (or any other) exception should not occur:
- // [JavaScript Error: "TypeError: self.selection is null" {file: "resource:///modules/devtools/InspectorPanel.jsm" line: 250}]
-
- .then(function cleanUp() {
- gBrowser.removeCurrentTab();
- finish();
- });
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_changes.js b/browser/devtools/inspector/test/browser_inspector_changes.js
deleted file mode 100644
index a3088e51d..000000000
--- a/browser/devtools/inspector/test/browser_inspector_changes.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-let doc;
-let testDiv;
-
-function test() {
- let inspector;
-
- function createDocument()
- {
- doc.body.innerHTML = '<div id="testdiv">Test div!</div>';
- doc.title = "Inspector Change Test";
- openInspector(runInspectorTests);
- }
-
-
- function getInspectorProp(aName)
- {
- let computedview = inspector.sidebar.getWindowForTab("computedview").computedview.view;
- for each (let view in computedview.propertyViews) {
- if (view.name == aName) {
- return view;
- }
- }
- return null;
- }
-
- function runInspectorTests(aInspector)
- {
- inspector = aInspector;
- inspector.sidebar.once("computedview-ready", function() {
- info("Computed View ready");
- inspector.sidebar.select("computedview");
-
- testDiv = doc.getElementById("testdiv");
-
- testDiv.style.fontSize = "10px";
-
- // Start up the style inspector panel...
- Services.obs.addObserver(stylePanelTests, "StyleInspector-populated", false);
-
- inspector.selection.setNode(testDiv);
- });
- }
-
- function stylePanelTests()
- {
- Services.obs.removeObserver(stylePanelTests, "StyleInspector-populated");
-
- let computedview = inspector.sidebar.getWindowForTab("computedview").computedview;
- ok(computedview, "Style Panel has a cssHtmlTree");
-
- let propView = getInspectorProp("font-size");
- is(propView.value, "10px", "Style inspector should be showing the correct font size.");
-
- Services.obs.addObserver(stylePanelAfterChange, "StyleInspector-populated", false);
-
- testDiv.style.fontSize = "15px";
- inspector.emit("layout-change");
- }
-
- function stylePanelAfterChange()
- {
- Services.obs.removeObserver(stylePanelAfterChange, "StyleInspector-populated");
-
- let propView = getInspectorProp("font-size");
- is(propView.value, "15px", "Style inspector should be showing the new font size.");
-
- stylePanelNotActive();
- }
-
- function stylePanelNotActive()
- {
- // Tests changes made while the style panel is not active.
- inspector.sidebar.select("ruleview");
-
- executeSoon(function() {
- Services.obs.addObserver(stylePanelAfterSwitch, "StyleInspector-populated", false);
- testDiv.style.fontSize = "20px";
- inspector.sidebar.select("computedview");
- });
- }
-
- function stylePanelAfterSwitch()
- {
- Services.obs.removeObserver(stylePanelAfterSwitch, "StyleInspector-populated");
-
- let propView = getInspectorProp("font-size");
- is(propView.value, "20px", "Style inspector should be showing the newest font size.");
-
- finishTest();
- }
-
- function finishTest()
- {
- gBrowser.removeCurrentTab();
- finish();
- }
-
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_cmd_inspect.html b/browser/devtools/inspector/test/browser_inspector_cmd_inspect.html
deleted file mode 100644
index a7d28828c..000000000
--- a/browser/devtools/inspector/test/browser_inspector_cmd_inspect.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>GCLI inspect command test</title>
-</head>
-<body>
-
- <!-- This is a list of 0 h1 elements -->
-
- <!-- This is a list of 1 div elements -->
- <div>Hello, I'm a div</div>
-
- <!-- This is a list of 2 span elements -->
- <span>Hello, I'm a span</span>
- <span>And me</span>
-
- <!-- This is a collection of various things that match only once -->
- <p class="someclass">.someclass</p>
- <p id="someid">#someid</p>
- <button disabled>button[disabled]</button>
- <p><strong>p&gt;strong</strong></p>
-
-</body>
-</html>
diff --git a/browser/devtools/inspector/test/browser_inspector_cmd_inspect.js b/browser/devtools/inspector/test/browser_inspector_cmd_inspect.js
deleted file mode 100644
index f060e59be..000000000
--- a/browser/devtools/inspector/test/browser_inspector_cmd_inspect.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the inspect command works as it should
-
-const TEST_URI = "http://example.com/browser/browser/devtools/inspector/" +
- "test/browser_inspector_cmd_inspect.html";
-
-function test() {
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.audit(options, [
- {
- setup: "inspect",
- check: {
- input: 'inspect',
- hints: ' <selector>',
- markup: 'VVVVVVV',
- status: 'ERROR',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect h1",
- check: {
- input: 'inspect h1',
- hints: '',
- markup: 'VVVVVVVVII',
- status: 'ERROR',
- args: {
- selector: { message: 'No matches' },
- }
- },
- },
- {
- setup: "inspect span",
- check: {
- input: 'inspect span',
- hints: '',
- markup: 'VVVVVVVVEEEE',
- status: 'ERROR',
- args: {
- selector: { message: 'Too many matches (2)' },
- }
- },
- },
- {
- setup: "inspect div",
- check: {
- input: 'inspect div',
- hints: '',
- markup: 'VVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect .someclas",
- check: {
- input: 'inspect .someclas',
- hints: '',
- markup: 'VVVVVVVVIIIIIIIII',
- status: 'ERROR',
- args: {
- selector: { message: 'No matches' },
- }
- },
- },
- {
- setup: "inspect .someclass",
- check: {
- input: 'inspect .someclass',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect #someid",
- check: {
- input: 'inspect #someid',
- hints: '',
- markup: 'VVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect button[disabled]",
- check: {
- input: 'inspect button[disabled]',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect p>strong",
- check: {
- input: 'inspect p>strong',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- selector: { message: '' },
- }
- },
- },
- {
- setup: "inspect :root",
- check: {
- input: 'inspect :root',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID'
- },
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_destroyselection.html b/browser/devtools/inspector/test/browser_inspector_destroyselection.html
deleted file mode 100644
index 70edbd936..000000000
--- a/browser/devtools/inspector/test/browser_inspector_destroyselection.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<!DOCTYPE html>
-
-<h1>mop</h1>
-<iframe src="data:text/html;charset=utf-8,<!DOCTYPE HTML>%0D%0A<h1>kill me<span>.</span><%2Fh1>"></iframe>
diff --git a/browser/devtools/inspector/test/browser_inspector_destroyselection.js b/browser/devtools/inspector/test/browser_inspector_destroyselection.js
deleted file mode 100644
index bf24c5e34..000000000
--- a/browser/devtools/inspector/test/browser_inspector_destroyselection.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
- //ignoreAllUncaughtExceptions();
-
- let node, iframe, inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html";
-
- function setupTest()
- {
- iframe = content.document.querySelector("iframe");
- node = iframe.contentDocument.querySelector("span");
- openInspector(runTests);
- }
-
- function runTests(aInspector)
- {
- inspector = aInspector;
- inspector.selection.setNode(node);
-
- iframe.parentNode.removeChild(iframe);
- iframe = null;
-
- let tmp = {};
- Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tmp);
- ok(!tmp.LayoutHelpers.isNodeConnected(node), "Node considered as disconnected.");
- ok(!inspector.selection.isConnected(), "Selection considered as disconnected");
-
- finishUp();
- }
-
- function finishUp() {
- node = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_highlighter.js b/browser/devtools/inspector/test/browser_inspector_highlighter.js
deleted file mode 100644
index 8987ddddd..000000000
--- a/browser/devtools/inspector/test/browser_inspector_highlighter.js
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let doc;
-let h1;
-let div;
-
-function createDocument()
-{
- let div = doc.createElement("div");
- let h1 = doc.createElement("h1");
- let p1 = doc.createElement("p");
- let p2 = doc.createElement("p");
- let div2 = doc.createElement("div");
- let p3 = doc.createElement("p");
- doc.title = "Inspector Highlighter Meatballs";
- h1.textContent = "Inspector Tree Selection Test";
- p1.textContent = "This is some example text";
- p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
- "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
- "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
- "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
- "dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
- "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
- "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- p3.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
- "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
- "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
- "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
- "dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
- "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
- "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- let div3 = doc.createElement("div");
- div3.id = "checkOutThisWickedSpread";
- div3.setAttribute("style", "position: absolute; top: 20px; right: 20px; height: 20px; width: 20px; background-color: yellow; border: 1px dashed black;");
- let p4 = doc.createElement("p");
- p4.setAttribute("style", "font-weight: 200; font-size: 8px; text-align: center;");
- p4.textContent = "Smörgåsbord!";
- div.appendChild(h1);
- div.appendChild(p1);
- div.appendChild(p2);
- div2.appendChild(p3);
- div3.appendChild(p4);
- doc.body.appendChild(div);
- doc.body.appendChild(div2);
- doc.body.appendChild(div3);
-
- openInspector(setupHighlighterTests);
-}
-
-function setupHighlighterTests()
-{
- h1 = doc.querySelector("h1");
- ok(h1, "we have the header");
-
- let i = getActiveInspector();
- i.highlighter.unlockAndFocus();
- i.highlighter.outline.setAttribute("disable-transitions", "true");
-
- executeSoon(function() {
- i.selection.once("new-node", performTestComparisons);
- EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
- });
-}
-
-function performTestComparisons(evt)
-{
- let i = getActiveInspector();
- i.highlighter.lock();
- ok(isHighlighting(), "highlighter is highlighting");
- is(getHighlitNode(), h1, "highlighter matches selection")
- is(i.selection.node, h1, "selection matches node");
- is(i.selection.node, getHighlitNode(), "selection matches highlighter");
-
-
- div = doc.querySelector("div#checkOutThisWickedSpread");
-
- executeSoon(function() {
- i.selection.once("new-node", finishTestComparisons);
- i.selection.setNode(div);
- });
-}
-
-function finishTestComparisons()
-{
- let i = getActiveInspector();
-
- // get dimensions of div element
- let divDims = div.getBoundingClientRect();
- let divWidth = divDims.width;
- let divHeight = divDims.height;
-
- // get dimensions of the outline
- let outlineDims = i.highlighter.outline.getBoundingClientRect();
- let outlineWidth = outlineDims.width;
- let outlineHeight = outlineDims.height;
-
- // Disabled due to bug 716245
- //is(outlineWidth, divWidth, "outline width matches dimensions of element (no zoom)");
- //is(outlineHeight, divHeight, "outline height matches dimensions of element (no zoom)");
-
- // zoom the page by a factor of 2
- let contentViewer = gBrowser.selectedBrowser.docShell.contentViewer
- .QueryInterface(Ci.nsIMarkupDocumentViewer);
- contentViewer.fullZoom = 2;
-
- // We wait at least 500ms to make sure the highlighter is not "mutting" the
- // resize event
-
- window.setTimeout(function() {
- // check what zoom factor we're at, should be 2
- let zoom = i.highlighter.zoom;
- is(zoom, 2, "zoom is 2?");
-
- // simulate the zoomed dimensions of the div element
- let divDims = div.getBoundingClientRect();
- let divWidth = divDims.width * zoom;
- let divHeight = divDims.height * zoom;
-
- // now zoomed, get new dimensions the outline
- let outlineDims = i.highlighter.outline.getBoundingClientRect();
- let outlineWidth = outlineDims.width;
- let outlineHeight = outlineDims.height;
-
- // Disabled due to bug 716245
- //is(outlineWidth, divWidth, "outline width matches dimensions of element (no zoom)");
- //is(outlineHeight, divHeight, "outline height matches dimensions of element (no zoom)");
-
- doc = h1 = div = null;
- executeSoon(finishUp);
- }, 500);
-}
-
-function finishUp() {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_highlighter_autohide.js b/browser/devtools/inspector/test/browser_inspector_highlighter_autohide.js
deleted file mode 100644
index 8dfca604b..000000000
--- a/browser/devtools/inspector/test/browser_inspector_highlighter_autohide.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-function test()
-{
- let toolbox;
- let inspector;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(startInspector, content);
- }, true);
- content.location = "data:text/html,mop"
-
- function startInspector() {
- info("Tab loaded");
- openInspector(function(aInspector) {
- inspector = aInspector;
- ok(!inspector.highlighter.hidden, "Highlighter is visible");
- toolbox = inspector._toolbox;
- toolbox.once("webconsole-selected", onWebConsoleSelected);
- toolbox.selectTool("webconsole");
- });
- }
-
- function onWebConsoleSelected() {
- executeSoon(function() {
- ok(inspector.highlighter.hidden, "Highlighter is hidden");
- toolbox.once("inspector-selected", onInspectorSelected);
- toolbox.selectTool("inspector");
- });
- }
-
- function onInspectorSelected() {
- executeSoon(function() {
- ok(!inspector.highlighter.hidden, "Highlighter is visible once inspector reopen");
- gBrowser.removeCurrentTab();
- finish();
- });
- }
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_iframeTest.js b/browser/devtools/inspector/test/browser_inspector_iframeTest.js
deleted file mode 100644
index 8d23b0493..000000000
--- a/browser/devtools/inspector/test/browser_inspector_iframeTest.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let doc;
-let div1;
-let div2;
-let iframe1;
-let iframe2;
-
-function createDocument()
-{
- doc.title = "Inspector iframe Tests";
-
- iframe1 = doc.createElement('iframe');
-
- iframe1.addEventListener("load", function () {
- iframe1.removeEventListener("load", arguments.callee, false);
-
- div1 = iframe1.contentDocument.createElement('div');
- div1.textContent = 'little div';
- iframe1.contentDocument.body.appendChild(div1);
-
- iframe2 = iframe1.contentDocument.createElement('iframe');
-
- iframe2.addEventListener('load', function () {
- iframe2.removeEventListener("load", arguments.callee, false);
-
- div2 = iframe2.contentDocument.createElement('div');
- div2.textContent = 'nested div';
- iframe2.contentDocument.body.appendChild(div2);
-
- openInspector(runIframeTests);
- }, false);
-
- iframe2.src = 'data:text/html,nested iframe';
- iframe1.contentDocument.body.appendChild(iframe2);
- }, false);
-
- iframe1.src = 'data:text/html,little iframe';
- doc.body.appendChild(iframe1);
-}
-
-function moveMouseOver(aElement)
-{
- EventUtils.synthesizeMouse(aElement, 2, 2, {type: "mousemove"},
- aElement.ownerDocument.defaultView);
-}
-
-function runIframeTests()
-{
- getActiveInspector().selection.once("new-node", performTestComparisons1);
- moveMouseOver(div1)
-}
-
-function performTestComparisons1()
-{
- let i = getActiveInspector();
- is(i.selection.node, div1, "selection matches div1 node");
- is(getHighlitNode(), div1, "highlighter matches selection");
-
- i.selection.once("new-node", performTestComparisons2);
- executeSoon(function() {
- moveMouseOver(div2);
- });
-}
-
-function performTestComparisons2()
-{
- let i = getActiveInspector();
-
- is(i.selection.node, div2, "selection matches div2 node");
- is(getHighlitNode(), div2, "highlighter matches selection");
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- gBrowser.selectedBrowser.focus();
- createDocument();
- }, true);
-
- content.location = "data:text/html,iframe tests for inspector";
-
- registerCleanupFunction(function () {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- gBrowser.removeCurrentTab();
- });
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_infobar.js b/browser/devtools/inspector/test/browser_inspector_infobar.js
deleted file mode 100644
index 1e20539cd..000000000
--- a/browser/devtools/inspector/test/browser_inspector_infobar.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
-
- let doc;
- let nodes;
- let cursor;
- let inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupInfobarTest, content);
- }, true);
-
- let style = "body{width:100%;height: 100%} div {position: absolute;height: 100px;width: 500px}#bottom {bottom: 0px}#vertical {height: 100%}#farbottom{bottom: -200px}";
- let html = "<style>" + style + "</style><div id=vertical></div><div id=top class='class1 class2'></div><div id=bottom></div><div id=farbottom></div>"
-
- content.location = "data:text/html," + encodeURIComponent(html);
-
- function setupInfobarTest()
- {
- nodes = [
- {node: doc.querySelector("#top"), position: "bottom", tag: "DIV", id: "#top", classes: ".class1.class2"},
- {node: doc.querySelector("#vertical"), position: "overlap", tag: "DIV", id: "#vertical", classes: ""},
- {node: doc.querySelector("#bottom"), position: "top", tag: "DIV", id: "#bottom", classes: ""},
- {node: doc.querySelector("body"), position: "overlap", tag: "BODY", id: "", classes: ""},
- {node: doc.querySelector("#farbottom"), position: "top", tag: "DIV", id: "#farbottom", classes: ""},
- ]
-
- for (let i = 0; i < nodes.length; i++) {
- ok(nodes[i].node, "node " + i + " found");
- }
-
- openInspector(runTests);
- }
-
- function runTests(aInspector)
- {
- inspector = aInspector;
- cursor = 0;
- executeSoon(function() {
- inspector.selection.setNode(nodes[0].node, "");
- nodeSelected();
- });
- }
-
- function nodeSelected()
- {
- executeSoon(function() {
- performTest();
- cursor++;
- if (cursor >= nodes.length) {
- finishUp();
- } else {
- let node = nodes[cursor].node;
- inspector.selection.setNode(node, "");
- nodeSelected();
- }
- });
- }
-
- function performTest()
- {
- let browser = gBrowser.selectedBrowser;
- let stack = browser.parentNode;
-
- let container = stack.querySelector(".highlighter-nodeinfobar-container");
- is(container.getAttribute("position"), nodes[cursor].position, "node " + cursor + ": position matches.");
-
- let tagNameLabel = stack.querySelector(".highlighter-nodeinfobar-tagname");
- is(tagNameLabel.textContent, nodes[cursor].tag, "node " + cursor + ": tagName matches.");
-
- let idLabel = stack.querySelector(".highlighter-nodeinfobar-id");
- is(idLabel.textContent, nodes[cursor].id, "node " + cursor + ": id matches.");
-
- let classesBox = stack.querySelector(".highlighter-nodeinfobar-classes");
- is(classesBox.textContent, nodes[cursor].classes, "node " + cursor + ": classes match.");
- }
-
- function finishUp() {
- doc = nodes = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
-
diff --git a/browser/devtools/inspector/test/browser_inspector_initialization.js b/browser/devtools/inspector/test/browser_inspector_initialization.js
deleted file mode 100644
index 56e6ec493..000000000
--- a/browser/devtools/inspector/test/browser_inspector_initialization.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-let doc;
-let salutation;
-
-function createDocument()
-{
- doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
- '<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
- 'solely to provide some things to test the inspector initialization.</p>\n' +
- 'If you are reading this, you should go do something else instead. Maybe ' +
- 'read a book. Or better yet, write some test-cases for another bit of code. ' +
- '<span style="{font-style: italic}">Inspector\'s!</span></p>\n' +
- '<p id="closing">end transmission</p>\n' +
- '</div>';
- doc.title = "Inspector Initialization Test";
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- startInspectorTests(toolbox);
- }).then(null, console.error);
-}
-
-function startInspectorTests(toolbox)
-{
- let inspector = toolbox.getCurrentPanel();
- ok(true, "Inspector started, and notification received.");
-
- ok(inspector, "Inspector instance is accessible");
- ok(inspector.isReady, "Inspector instance is ready");
- is(inspector.target.tab, gBrowser.selectedTab, "Valid target");
- ok(inspector.highlighter, "Highlighter is up");
-
- let p = doc.querySelector("p");
-
- inspector.selection.setNode(p);
-
- testHighlighter(p);
- testMarkupView(p);
- testBreadcrumbs(p);
-
- let span = doc.querySelector("span");
- span.scrollIntoView();
-
- inspector.selection.setNode(span);
-
- testHighlighter(span);
- testMarkupView(span);
- testBreadcrumbs(span);
-
- toolbox.once("destroyed", function() {
- ok("true", "'destroyed' notification received.");
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- ok(!gDevTools.getToolbox(target), "Toolbox destroyed.");
- executeSoon(runContextMenuTest);
- });
- toolbox.destroy();
-}
-
-
-function testHighlighter(node)
-{
- ok(isHighlighting(), "Highlighter is highlighting");
- is(getHighlitNode(), node, "Right node is highlighted");
-}
-
-function testMarkupView(node)
-{
- let i = getActiveInspector();
- is(i.markup._selectedContainer.node, node, "Right node is selected in the markup view");
-}
-
-function testBreadcrumbs(node)
-{
- let b = getActiveInspector().breadcrumbs;
- let expectedText = b.prettyPrintNodeAsText(node);
- let button = b.container.querySelector("button[checked=true]");
- ok(button, "A crumbs is checked=true");
- is(button.getAttribute("tooltiptext"), expectedText, "Crumb refers to the right node");
-}
-
-function _clickOnInspectMenuItem(node) {
- document.popupNode = node;
- var contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
- var contextMenu = new nsContextMenu(contentAreaContextMenu);
- return contextMenu.inspectNode();
-}
-
-function runContextMenuTest()
-{
- salutation = doc.getElementById("salutation");
- _clickOnInspectMenuItem(salutation).then(testInitialNodeIsSelected);
-}
-
-function testInitialNodeIsSelected() {
- testHighlighter(salutation);
- testMarkupView(salutation);
- testBreadcrumbs(salutation);
- inspectNodesFromContextTestWhileOpen();
-}
-
-function inspectNodesFromContextTestWhileOpen()
-{
- let closing = doc.getElementById("closing");
- getActiveInspector().selection.once("new-node", function() {
- ok(true, "Get selection's 'new-node' selection");
- executeSoon(function() {
- testHighlighter(closing);
- testMarkupView(closing);
- testBreadcrumbs(closing);
- finishInspectorTests();
- }
- )});
- _clickOnInspectMenuItem(closing);
-}
-
-function finishInspectorTests(subject, topic, aWinIdString)
-{
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_invalidate.js b/browser/devtools/inspector/test/browser_inspector_invalidate.js
deleted file mode 100644
index 3fc9a2043..000000000
--- a/browser/devtools/inspector/test/browser_inspector_invalidate.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
-
- let doc;
- let div;
- let inspector;
-
- function createDocument()
- {
- div = doc.createElement("div");
- div.setAttribute("style", "width: 100px; height: 100px; background:yellow;");
- doc.body.appendChild(div);
-
- openInspector(runTest);
- }
-
- function runTest(inspector)
- {
- inspector.selection.setNode(div);
-
- executeSoon(function() {
- let outline = inspector.highlighter.outline;
- is(outline.style.width, "100px", "selection has the right width");
-
- div.style.width = "200px";
- function pollTest() {
- if (outline.style.width == "100px") {
- setTimeout(pollTest, 10);
- return;
- }
- is(outline.style.width, "200px", "selection updated");
- gBrowser.removeCurrentTab();
- finish();
- }
- setTimeout(pollTest, 10);
- });
- }
-
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_menu.html b/browser/devtools/inspector/test/browser_inspector_menu.html
deleted file mode 100644
index 52c94923b..000000000
--- a/browser/devtools/inspector/test/browser_inspector_menu.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<head>
- <title>Inspector Tree Menu Test</title>
-</head>
-<body>
- <div>
- <h1>Inspector Tree Menu Test</h1>
- <p>This is some example text</p>
- </div>
-</body>
diff --git a/browser/devtools/inspector/test/browser_inspector_menu.js b/browser/devtools/inspector/test/browser_inspector_menu.js
deleted file mode 100644
index 8e257b1b8..000000000
--- a/browser/devtools/inspector/test/browser_inspector_menu.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-function test() {
-
- waitForExplicitFinish();
-
- let doc;
- let inspector;
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/" +
- "inspector/test/browser_inspector_menu.html";
-
- function setupTest() {
- openInspector(runTests);
- }
-
- function runTests(aInspector) {
- inspector = aInspector;
- checkDocTypeMenuItems();
- }
-
- function checkDocTypeMenuItems() {
- info("Checking context menu entries for doctype node");
- inspector.selection.setNode(doc.doctype);
- let docTypeNode = getMarkupTagNodeContaining("<!DOCTYPE html>");
-
- // Right-click doctype tag
- contextMenuClick(docTypeNode);
-
- checkDisabled("node-menu-copyinner");
- checkDisabled("node-menu-copyouter");
- checkDisabled("node-menu-copyuniqueselector");
- checkDisabled("node-menu-delete");
-
- for (let name of ["hover", "active", "focus"]) {
- checkDisabled("node-menu-pseudo-" + name);
- }
-
- checkElementMenuItems();
- }
-
- function checkElementMenuItems() {
- info("Checking context menu entries for p tag");
- inspector.selection.setNode(doc.querySelector("p"));
- let tag = getMarkupTagNodeContaining("p");
-
- // Right-click p tag
- contextMenuClick(tag);
-
- checkEnabled("node-menu-copyinner");
- checkEnabled("node-menu-copyouter");
- checkEnabled("node-menu-copyuniqueselector");
- checkEnabled("node-menu-delete");
-
- for (let name of ["hover", "active", "focus"]) {
- checkEnabled("node-menu-pseudo-" + name);
- }
-
- testCopyInnerMenu();
- }
-
- function testCopyInnerMenu() {
- let copyInner = inspector.panelDoc.getElementById("node-menu-copyinner");
- ok(copyInner, "the popup menu has a copy inner html menu item");
-
- waitForClipboard("This is some example text",
- function() { copyInner.doCommand(); },
- testCopyOuterMenu, testCopyOuterMenu);
- }
-
- function testCopyOuterMenu() {
- let copyOuter = inspector.panelDoc.getElementById("node-menu-copyouter");
- ok(copyOuter, "the popup menu has a copy outer html menu item");
-
- waitForClipboard("<p>This is some example text</p>",
- function() { copyOuter.doCommand(); },
- testCopyUniqueSelectorMenu, testCopyUniqueSelectorMenu);
- }
-
- function testCopyUniqueSelectorMenu() {
- let copyUniqueSelector = inspector.panelDoc.getElementById("node-menu-copyuniqueselector");
- ok(copyUniqueSelector, "the popup menu has a copy unique selector menu item");
-
- waitForClipboard("body > div:nth-child(1) > p:nth-child(2)",
- function() { copyUniqueSelector.doCommand(); },
- testDeleteNode, testDeleteNode);
- }
-
- function testDeleteNode() {
- let deleteNode = inspector.panelDoc.getElementById("node-menu-delete");
- ok(deleteNode, "the popup menu has a delete menu item");
-
- inspector.selection.once("detached", deleteTest);
-
- let commandEvent = document.createEvent("XULCommandEvent");
- commandEvent.initCommandEvent("command", true, true, window, 0, false, false,
- false, false, null);
- deleteNode.dispatchEvent(commandEvent);
- }
-
- function deleteTest() {
- let p = doc.querySelector("P");
- is(p, null, "node deleted");
-
- deleteRootNode();
- }
-
- function deleteRootNode() {
- inspector.selection.setNode(doc.documentElement);
- let deleteNode = inspector.panelDoc.getElementById("node-menu-delete");
- let commandEvent = inspector.panelDoc.createEvent("XULCommandEvent");
- commandEvent.initCommandEvent("command", true, true, window, 0, false, false,
- false, false, null);
- deleteNode.dispatchEvent(commandEvent);
- executeSoon(isRootStillAlive);
- }
-
- function isRootStillAlive() {
- ok(doc.documentElement, "Document element still alive.");
- gBrowser.removeCurrentTab();
- finish();
- }
-
- function getMarkupTagNodeContaining(text) {
- let tags = inspector._markupFrame.contentDocument.querySelectorAll("span");
- for (let tag of tags) {
- if (tag.textContent == text) {
- return tag;
- }
- }
- }
-
- function checkEnabled(elementId) {
- let elt = inspector.panelDoc.getElementById(elementId);
- ok(!elt.hasAttribute("disabled"),
- '"' + elt.label + '" context menu option is not disabled');
- }
-
- function checkDisabled(elementId) {
- let elt = inspector.panelDoc.getElementById(elementId);
- ok(elt.hasAttribute("disabled"),
- '"' + elt.label + '" context menu option is disabled');
- }
-
- function contextMenuClick(element) {
- let evt = element.ownerDocument.createEvent('MouseEvents');
- let button = 2; // right click
-
- evt.initMouseEvent('contextmenu', true, true,
- element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
- false, false, false, button, null);
-
- element.dispatchEvent(evt);
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_pseudoClass_menu.js b/browser/devtools/inspector/test/browser_inspector_pseudoClass_menu.js
deleted file mode 100644
index f8e2baf1c..000000000
--- a/browser/devtools/inspector/test/browser_inspector_pseudoClass_menu.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
-
- let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
-
- let pseudos = ["hover", "active", "focus"];
-
- let doc;
- let div;
- let menu;
- let inspector;
-
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,pseudo-class lock node menu tests";
-
- function createDocument()
- {
- div = doc.createElement("div");
- div.textContent = "test div";
-
- doc.body.appendChild(div);
-
- openInspector(selectNode);
- }
-
- function selectNode(aInspector)
- {
- inspector = aInspector;
- inspector.selection.setNode(div);
- performTests();
- }
-
- function performTests()
- {
- menu = inspector.panelDoc.getElementById("inspector-node-popup");
- menu.addEventListener("popupshowing", testMenuItems, true);
- menu.openPopup();
- }
-
- function testMenuItems()
- {
- menu.removeEventListener("popupshowing", testMenuItems, true);
-
- for each (let pseudo in pseudos) {
- let menuitem = inspector.panelDoc.getElementById("node-menu-pseudo-" + pseudo);
- ok(menuitem, ":" + pseudo + " menuitem exists");
-
- menuitem.doCommand();
-
- is(DOMUtils.hasPseudoClassLock(div, ":" + pseudo), true,
- "pseudo-class lock has been applied");
- }
- finishUp();
- }
-
- function finishUp()
- {
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_pseudoclass_lock.js b/browser/devtools/inspector/test/browser_inspector_pseudoclass_lock.js
deleted file mode 100644
index b0d9e17fc..000000000
--- a/browser/devtools/inspector/test/browser_inspector_pseudoclass_lock.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
-
-let doc;
-let parentDiv, div, div2;
-let inspector;
-let ruleview;
-
-let pseudo = ":hover";
-
-function test()
-{
- waitForExplicitFinish();
- ignoreAllUncaughtExceptions();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,pseudo-class lock tests";
-}
-
-function createDocument()
-{
- parentDiv = doc.createElement("div");
- parentDiv.textContent = "parent div";
-
- div = doc.createElement("div");
- div.textContent = "test div";
-
- div2 = doc.createElement("div");
- div2.textContent = "test div2";
-
- let head = doc.getElementsByTagName('head')[0];
- let style = doc.createElement('style');
- let rules = doc.createTextNode('div { color: red; } div:hover { color: blue; }');
-
- style.appendChild(rules);
- head.appendChild(style);
- parentDiv.appendChild(div);
- parentDiv.appendChild(div2);
- doc.body.appendChild(parentDiv);
-
- openInspector(selectNode);
-}
-
-function selectNode(aInspector)
-{
- inspector = aInspector;
- inspector.selection.setNode(div);
- inspector.sidebar.once("ruleview-ready", function() {
- ruleview = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
- inspector.sidebar.select("ruleview");
- performTests();
- });
-}
-
-function performTests()
-{
- // toggle the class
- inspector.togglePseudoClass(pseudo);
-
- testAdded();
-
- // toggle the lock off
- inspector.togglePseudoClass(pseudo);
-
- testRemoved();
- testRemovedFromUI();
-
- // toggle it back on
- inspector.togglePseudoClass(pseudo);
-
- testNavigate();
-
- // close the inspector
- finishUp();
-}
-
-function testNavigate()
-{
- inspector.selection.setNode(parentDiv);
-
- // make sure it's still on after naving to parent
- is(DOMUtils.hasPseudoClassLock(div, pseudo), true,
- "pseudo-class lock is still applied after inspecting ancestor");
-
- inspector.selection.setNode(div2);
-
- // make sure it's removed after naving to a non-hierarchy node
- is(DOMUtils.hasPseudoClassLock(div, pseudo), false,
- "pseudo-class lock is removed after inspecting sibling node");
-
- // toggle it back on
- inspector.selection.setNode(div);
- inspector.togglePseudoClass(pseudo);
-}
-
-function testAdded()
-{
- // lock is applied to it and ancestors
- let node = div;
- do {
- is(DOMUtils.hasPseudoClassLock(node, pseudo), true,
- "pseudo-class lock has been applied");
- node = node.parentNode;
- } while (node.parentNode)
-
- // infobar selector contains pseudo-class
- let pseudoClassesBox = getActiveInspector().highlighter.nodeInfo.pseudoClassesBox;
- is(pseudoClassesBox.textContent, pseudo, "pseudo-class in infobar selector");
-
- // ruleview contains pseudo-class rule
- is(ruleview.element.children.length, 3,
- "rule view is showing 3 rules for pseudo-class locked div");
-
- is(ruleview.element.children[1]._ruleEditor.rule.selectorText,
- "div:hover", "rule view is showing " + pseudo + " rule");
-}
-
-function testRemoved()
-{
- // lock removed from node and ancestors
- let node = div;
- do {
- is(DOMUtils.hasPseudoClassLock(node, pseudo), false,
- "pseudo-class lock has been removed");
- node = node.parentNode;
- } while (node.parentNode)
-}
-
-function testRemovedFromUI()
-{
- // infobar selector doesn't contain pseudo-class
- let pseudoClassesBox = getActiveInspector().highlighter.nodeInfo.pseudoClassesBox;
- is(pseudoClassesBox.textContent, "", "pseudo-class removed from infobar selector");
-
- // ruleview no longer contains pseudo-class rule
- is(ruleview.element.children.length, 2,
- "rule view is showing 2 rules after removing lock");
-}
-
-function finishUp()
-{
- gDevTools.once("toolbox-destroyed", function() {
- testRemoved();
- inspector = ruleview = null;
- doc = div = null;
- gBrowser.removeCurrentTab();
- finish();
- });
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.getToolbox(target);
- toolbox.destroy();
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_scrolling.js b/browser/devtools/inspector/test/browser_inspector_scrolling.js
deleted file mode 100644
index 85db0080e..000000000
--- a/browser/devtools/inspector/test/browser_inspector_scrolling.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let doc;
-let div;
-let iframe;
-let inspector;
-
-function createDocument()
-{
- doc.title = "Inspector scrolling Tests";
-
- iframe = doc.createElement("iframe");
-
- iframe.addEventListener("load", function () {
- iframe.removeEventListener("load", arguments.callee, false);
-
- div = iframe.contentDocument.createElement("div");
- div.textContent = "big div";
- div.setAttribute("style", "height:500px; width:500px; border:1px solid gray;");
- iframe.contentDocument.body.appendChild(div);
- openInspector(inspectNode);
- }, false);
-
- iframe.src = "data:text/html,foo bar";
- doc.body.appendChild(iframe);
-}
-
-function inspectNode(aInspector)
-{
- inspector = aInspector;
-
- inspector.highlighter.once("locked", performScrollingTest);
- executeSoon(function() {
- inspector.selection.setNode(div, "");
- });
-}
-
-function performScrollingTest()
-{
- executeSoon(function() {
- EventUtils.synthesizeWheel(div, 10, 10,
- { deltaY: 50.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL },
- iframe.contentWindow);
- });
-
- gBrowser.selectedBrowser.addEventListener("scroll", function() {
- gBrowser.selectedBrowser.removeEventListener("scroll", arguments.callee,
- false);
-
- is(iframe.contentDocument.body.scrollTop, 50, "inspected iframe scrolled");
-
- inspector = div = iframe = doc = null;
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- gBrowser.removeCurrentTab();
- finish();
- }, false);
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,mouse scrolling test for inspector";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_sidebarstate.js b/browser/devtools/inspector/test/browser_inspector_sidebarstate.js
deleted file mode 100644
index ae4f2b561..000000000
--- a/browser/devtools/inspector/test/browser_inspector_sidebarstate.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let inspector;
-
-function createDocument()
-{
- doc.body.innerHTML = '<h1>Sidebar state test</h1>';
- doc.title = "Sidebar State Test";
-
- openInspector(function(panel) {
- inspector = panel;
- inspector.sidebar.select("ruleview");
- inspectorRuleViewOpened();
- });
-}
-
-function inspectorRuleViewOpened()
-{
- is(inspector.sidebar.getCurrentTabID(), "ruleview", "Rule View is selected by default");
-
- // Select the computed view and turn off the inspector.
- inspector.sidebar.select("computedview");
-
- gDevTools.once("toolbox-destroyed", inspectorClosed);
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.getToolbox(target);
- executeSoon(function() {
- toolbox.destroy();
- });
-}
-
-function inspectorClosed()
-{
- openInspector(function(panel) {
- inspector = panel;
- if (inspector.sidebar.getCurrentTabID()) {
- // Default sidebar already selected.
- testNewDefaultTab();
- } else {
- // Default sidebar still to be selected.
- inspector.sidebar.once("select", testNewDefaultTab);
- }
- });
-}
-
-function testNewDefaultTab()
-{
- is(inspector.sidebar.getCurrentTabID(), "computedview", "Computed view is selected by default.");
-
- finishTest();
-}
-
-
-function finishTest()
-{
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
diff --git a/browser/devtools/inspector/test/browser_inspector_tree_height.js b/browser/devtools/inspector/test/browser_inspector_tree_height.js
deleted file mode 100644
index ad15d8c2b..000000000
--- a/browser/devtools/inspector/test/browser_inspector_tree_height.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-let doc;
-let salutation;
-let closing;
-
-const NEWHEIGHT = 226;
-
-function createDocument()
-{
- doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
- '<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
- 'solely to provide some things to test the inspector initialization.</p>\n' +
- 'If you are reading this, you should go do something else instead. Maybe ' +
- 'read a book. Or better yet, write some test-cases for another bit of code. ' +
- '<span style="{font-style: italic}">Maybe more inspector test-cases!</span></p>\n' +
- '<p id="closing">end transmission</p>\n' +
- '</div>';
- doc.title = "Inspector Initialization Test";
- startInspectorTests();
-}
-
-function startInspectorTests()
-{
- ok(InspectorUI, "InspectorUI variable exists");
- Services.obs.addObserver(runInspectorTests,
- InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
- InspectorUI.toggleInspectorUI();
-}
-
-function runInspectorTests()
-{
- Services.obs.removeObserver(runInspectorTests,
- InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
-
- if (InspectorUI.treePanelEnabled) {
- Services.obs.addObserver(treePanelTests,
- InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
-
- InspectorUI.stopInspecting();
-
- InspectorUI.treePanel.open();
- } else
- finishInspectorTests();
-}
-
-function treePanelTests()
-{
- Services.obs.removeObserver(treePanelTests,
- InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
- Services.obs.addObserver(treePanelTests2,
- InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, false);
-
- ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
-
- let height = Services.prefs.getIntPref("devtools.inspector.htmlHeight");
-
- is(InspectorUI.treePanel.container.height, height,
- "Container height is " + height);
-
- InspectorUI.treePanel.container.height = NEWHEIGHT;
-
- executeSoon(function() {
- InspectorUI.treePanel.close();
- InspectorUI.treePanel.open();
- });
-}
-
-function treePanelTests2()
-{
- Services.obs.removeObserver(treePanelTests2,
- InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY);
-
- ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open");
-
- let height = Services.prefs.getIntPref("devtools.inspector.htmlHeight");
-
- is(InspectorUI.treePanel.container.height, NEWHEIGHT,
- "Container height is now " + height);
-
- InspectorUI.treePanel.close();
- executeSoon(function() {
- finishInspectorTests()
- });
-}
-
-function finishInspectorTests()
-{
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
-
diff --git a/browser/devtools/inspector/test/head.js b/browser/devtools/inspector/test/head.js
deleted file mode 100644
index e5b84ee0c..000000000
--- a/browser/devtools/inspector/test/head.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cu = Components.utils;
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-let tempScope = {};
-Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tempScope);
-let LayoutHelpers = tempScope.LayoutHelpers;
-
-let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
-let TargetFactory = devtools.TargetFactory;
-
-Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
-let console = tempScope.console;
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
-
-function openInspector(callback)
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- callback(toolbox.getCurrentPanel(), toolbox);
- }).then(null, console.error);
-}
-
-function getActiveInspector()
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- return gDevTools.getToolbox(target).getPanel("inspector");
-}
-
-function isHighlighting()
-{
- let outline = getActiveInspector().highlighter.outline;
- return !(outline.getAttribute("hidden") == "true");
-}
-
-function getHighlitNode()
-{
- let h = getActiveInspector().highlighter;
- if (!isHighlighting() || !h._contentRect)
- return null;
-
- let a = {
- x: h._contentRect.left,
- y: h._contentRect.top
- };
-
- let b = {
- x: a.x + h._contentRect.width,
- y: a.y + h._contentRect.height
- };
-
- // Get midpoint of diagonal line.
- let midpoint = midPoint(a, b);
-
- return LayoutHelpers.getElementFromPoint(h.win.document, midpoint.x,
- midpoint.y);
-}
-
-
-function midPoint(aPointA, aPointB)
-{
- let pointC = { };
- pointC.x = (aPointB.x - aPointA.x) / 2 + aPointA.x;
- pointC.y = (aPointB.y - aPointA.y) / 2 + aPointA.y;
- return pointC;
-}
-
-function computedView()
-{
- let sidebar = getActiveInspector().sidebar;
- let iframe = sidebar.tabbox.querySelector(".iframe-computedview");
- return iframe.contentWindow.computedView;
-}
-
-function computedViewTree()
-{
- return computedView().view;
-}
-
-function ruleView()
-{
- let sidebar = getActiveInspector().sidebar;
- let iframe = sidebar.tabbox.querySelector(".iframe-ruleview");
- return iframe.contentWindow.ruleView;
-}
-
-function synthesizeKeyFromKeyTag(aKeyId) {
- let key = document.getElementById(aKeyId);
- isnot(key, null, "Successfully retrieved the <key> node");
-
- let modifiersAttr = key.getAttribute("modifiers");
-
- let name = null;
-
- if (key.getAttribute("keycode"))
- name = key.getAttribute("keycode");
- else if (key.getAttribute("key"))
- name = key.getAttribute("key");
-
- isnot(name, null, "Successfully retrieved keycode/key");
-
- let modifiers = {
- shiftKey: modifiersAttr.match("shift"),
- ctrlKey: modifiersAttr.match("ctrl"),
- altKey: modifiersAttr.match("alt"),
- metaKey: modifiersAttr.match("meta"),
- accelKey: modifiersAttr.match("accel")
- }
-
- EventUtils.synthesizeKey(name, modifiers);
-}
-
-function focusSearchBoxUsingShortcut(panelWin, callback) {
- panelWin.focus();
- let key = panelWin.document.getElementById("nodeSearchKey");
- isnot(key, null, "Successfully retrieved the <key> node");
-
- let modifiersAttr = key.getAttribute("modifiers");
-
- let name = null;
-
- if (key.getAttribute("keycode")) {
- name = key.getAttribute("keycode");
- } else if (key.getAttribute("key")) {
- name = key.getAttribute("key");
- }
-
- isnot(name, null, "Successfully retrieved keycode/key");
-
- let modifiers = {
- shiftKey: modifiersAttr.match("shift"),
- ctrlKey: modifiersAttr.match("ctrl"),
- altKey: modifiersAttr.match("alt"),
- metaKey: modifiersAttr.match("meta"),
- accelKey: modifiersAttr.match("accel")
- }
-
- let searchBox = panelWin.document.getElementById("inspector-searchbox");
- searchBox.addEventListener("focus", function onFocus() {
- searchBox.removeEventListener("focus", onFocus, false);
- callback && callback();
- }, false);
- EventUtils.synthesizeKey(name, modifiers);
-}
-
diff --git a/browser/devtools/inspector/test/moz.build b/browser/devtools/inspector/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/inspector/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/layoutview/moz.build b/browser/devtools/layoutview/moz.build
index 5abe8b3be..6ecebe123 100644
--- a/browser/devtools/layoutview/moz.build
+++ b/browser/devtools/layoutview/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/layoutview/test/Makefile.in b/browser/devtools/layoutview/test/Makefile.in
deleted file mode 100644
index 34a62289b..000000000
--- a/browser/devtools/layoutview/test/Makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_layoutview.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/layoutview/test/browser_layoutview.js b/browser/devtools/layoutview/test/browser_layoutview.js
deleted file mode 100644
index ca88b551f..000000000
--- a/browser/devtools/layoutview/test/browser_layoutview.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-function test() {
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref("devtools.layoutview.enabled", true);
- Services.prefs.setBoolPref("devtools.inspector.sidebarOpen", true);
-
- let doc;
- let node;
- let view;
- let inspector;
-
- // Expected values:
- let res1 = [
- {selector: "#element-size", value: "160x160"},
- {selector: ".size > span", value: "100x100"},
- {selector: ".margin.top > span", value: 30},
- {selector: ".margin.left > span", value: "auto"},
- {selector: ".margin.bottom > span", value: 30},
- {selector: ".margin.right > span", value: "auto"},
- {selector: ".padding.top > span", value: 20},
- {selector: ".padding.left > span", value: 20},
- {selector: ".padding.bottom > span", value: 20},
- {selector: ".padding.right > span", value: 20},
- {selector: ".border.top > span", value: 10},
- {selector: ".border.left > span", value: 10},
- {selector: ".border.bottom > span", value: 10},
- {selector: ".border.right > span", value: 10},
- ];
-
- let res2 = [
- {selector: "#element-size", value: "190x210"},
- {selector: ".size > span", value: "100x150"},
- {selector: ".margin.top > span", value: 30},
- {selector: ".margin.left > span", value: "auto"},
- {selector: ".margin.bottom > span", value: 30},
- {selector: ".margin.right > span", value: "auto"},
- {selector: ".padding.top > span", value: 20},
- {selector: ".padding.left > span", value: 20},
- {selector: ".padding.bottom > span", value: 20},
- {selector: ".padding.right > span", value: 50},
- {selector: ".border.top > span", value: 10},
- {selector: ".border.left > span", value: 10},
- {selector: ".border.bottom > span", value: 10},
- {selector: ".border.right > span", value: 10},
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- let style = "div { position: absolute; top: 42px; left: 42px; height: 100px; width: 100px; border: 10px solid black; padding: 20px; margin: 30px auto;}";
- let html = "<style>" + style + "</style><div></div>"
- content.location = "data:text/html," + encodeURIComponent(html);
-
- function setupTest() {
- node = doc.querySelector("div");
- ok(node, "node found");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- openLayoutView(toolbox.getCurrentPanel());
- });
- }
-
- function openLayoutView(aInspector) {
- inspector = aInspector;
-
- info("Inspector open");
-
- inspector.selection.setNode(node);
- inspector.sidebar.select("layoutview");
- inspector.sidebar.once("layoutview-ready", viewReady);
- }
-
- function viewReady() {
- info("Layout view ready");
-
- view = inspector.sidebar.getWindowForTab("layoutview");
-
- ok(!!view.layoutview, "LayoutView document is alive.");
-
- test1();
- }
-
- function test1() {
- let viewdoc = view.document;
-
- for (let i = 0; i < res1.length; i++) {
- let elt = viewdoc.querySelector(res1[i].selector);
- is(elt.textContent, res1[i].value, res1[i].selector + " has the right value.");
- }
-
- gBrowser.selectedBrowser.addEventListener("MozAfterPaint", test2, false);
-
- inspector.selection.node.style.height = "150px";
- inspector.selection.node.style.paddingRight = "50px";
- }
-
- function test2() {
- gBrowser.selectedBrowser.removeEventListener("MozAfterPaint", test2, false);
-
- let viewdoc = view.document;
-
- for (let i = 0; i < res2.length; i++) {
- let elt = viewdoc.querySelector(res2[i].selector);
- is(elt.textContent, res2[i].value, res2[i].selector + " has the right value after style update.");
- }
-
- executeSoon(function() {
- gDevTools.once("toolbox-destroyed", finishUp);
- inspector._toolbox.destroy();
- });
- }
-
- function finishUp() {
- Services.prefs.clearUserPref("devtools.layoutview.enabled");
- Services.prefs.clearUserPref("devtools.inspector.sidebarOpen");
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/layoutview/test/moz.build b/browser/devtools/layoutview/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/layoutview/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/markupview/moz.build b/browser/devtools/markupview/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/markupview/moz.build
+++ b/browser/devtools/markupview/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/markupview/test/Makefile.in b/browser/devtools/markupview/test/Makefile.in
deleted file mode 100644
index 2c0218d80..000000000
--- a/browser/devtools/markupview/test/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_inspector_markup_navigation.html \
- browser_inspector_markup_navigation.js \
- browser_inspector_markup_mutation.html \
- browser_inspector_markup_mutation.js \
- browser_inspector_markup_edit.html \
- browser_inspector_markup_edit.js \
- browser_inspector_markup_subset.html \
- browser_inspector_markup_subset.js \
- head.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_edit.html b/browser/devtools/markupview/test/browser_inspector_markup_edit.html
deleted file mode 100644
index b48d3535c..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_edit.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-
-<html class="html">
-
- <body class="body">
- <div class="node0">
- <div id="node1" class="node1">line1</div>
- <div id="node2" class="node2">line2</div>
- <p class="node3">line3</p>
- <!-- A comment -->
- <p id="node4" class="node4">line4
- <span class="node5">line5</span>
- <span class="node6">line6</span>
- <!-- A comment -->
- <a class="node7">line7<span class="node8">line8</span></a>
- <span class="node9">line9</span>
- <span class="node10">line10</span>
- <span class="node11">line11</span>
- <a class="node12">line12<span class="node13">line13</span></a>
- </p>
- <p id="node14">line14</p>
- <p class="node15">line15</p>
- </div>
- <div id="node16">
- <p id="node17">line17</p>
- </div>
- <div id="node18">
- <div id="node19">
- <div id="node20">
- <div id="node21">
- line21
- </div>
- </div>
- </div>
- </div>
- <div id="node22" class="unchanged"></div>
- <div id="node23"></div>
- <div id="node24"></div>
- <div id="retag-me">
- <div id="retag-me-2"></div>
- </div>
- <div id="node25"></div>
- </body>
-</html>
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_edit.js b/browser/devtools/markupview/test/browser_inspector_markup_edit.js
deleted file mode 100644
index 89af69914..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_edit.js
+++ /dev/null
@@ -1,443 +0,0 @@
-/* Any copyright", " is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that various editors work as expected. Also checks
- * that the various changes are properly undoable and redoable.
- * For each step in the test, we:
- * - Run the setup for that test (if any)
- * - Check that the node we're editing is as we expect
- * - Make the change, check that the change was made as we expect
- * - Undo the change, check that the node is back in its original state
- * - Redo the change, check that the node change was made again correctly.
- *
- * This test mostly tries to verify that the editor makes changes to the
- * underlying DOM, not that the UI updates - UI updates are based on
- * underlying DOM changes, and the mutation tests should cover those cases.
- */
-
-function test() {
- let inspector;
- let {
- getInplaceEditorForSpan: inplaceEditor
- } = devtools.require("devtools/shared/inplace-editor");
-
- waitForExplicitFinish();
-
- // Will hold the doc we're viewing
- let doc;
-
- // Holds the MarkupTool object we're testing.
- let markup;
-
- /**
- * Edit a given editableField
- */
- function editField(aField, aValue)
- {
- aField.focus();
- EventUtils.sendKey("return", inspector.panelWin);
- let input = inplaceEditor(aField).input;
- input.value = aValue;
- EventUtils.sendKey("return", inspector.panelWin);
- }
-
- /**
- * Check that the appropriate attributes are assigned to a node.
- *
- * @param {HTMLNode} aElement
- * The node to check.
- * @param {Object} aAttributes
- * An object containing the arguments to check.
- * e.g. {id="id1",class="someclass"}
- *
- * NOTE: When checking attribute values bare in mind that node.getAttribute()
- * returns attribute values provided by the HTML parser. The parser only
- * provides unescaped entities so &amp; will return &.
- */
- function assertAttributes(aElement, aAttributes)
- {
- let attrs = Object.getOwnPropertyNames(aAttributes);
- is(aElement.attributes.length, attrs.length,
- "Node has the correct number of attributes");
- for (let attr of attrs) {
- is(aElement.getAttribute(attr), aAttributes[attr],
- "Node has the correct " + attr + " attribute.");
- }
- }
-
- // All the mutation types we want to test.
- let edits = [
- {
- desc: "Change an attribute",
- before: function() {
- assertAttributes(doc.querySelector("#node1"), {
- id: "node1",
- class: "node1"
- });
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let editor = markup.getContainer(doc.querySelector("#node1")).editor;
- let attr = editor.attrs["class"].querySelector(".editable");
- editField(attr, 'class="changednode1"');
- },
- after: function() {
- assertAttributes(doc.querySelector("#node1"), {
- id: "node1",
- class: "changednode1"
- });
- }
- },
-
- {
- desc: 'Try changing an attribute to a quote (") - this should result ' +
- 'in it being set to an empty string',
- before: function() {
- assertAttributes(doc.querySelector("#node22"), {
- id: "node22",
- class: "unchanged"
- });
- },
- execute: function(after) {
- let editor = markup.getContainer(doc.querySelector("#node22")).editor;
- let attr = editor.attrs["class"].querySelector(".editable");
- editField(attr, 'class="""');
- executeSoon(after);
- },
- after: function() {
- assertAttributes(doc.querySelector("#node22"), {
- id: "node22",
- class: ""
- });
- }
- },
-
- {
- desc: "Remove an attribute",
- before: function() {
- assertAttributes(doc.querySelector("#node4"), {
- id: "node4",
- class: "node4"
- });
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let editor = markup.getContainer(doc.querySelector("#node4")).editor;
- let attr = editor.attrs["class"].querySelector(".editable");
- editField(attr, '');
- },
- after: function() {
- assertAttributes(doc.querySelector("#node4"), {
- id: "node4",
- });
- }
- },
-
- {
- desc: "Add an attribute by clicking the empty space after a node",
- before: function() {
- assertAttributes(doc.querySelector("#node14"), {
- id: "node14",
- });
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let editor = markup.getContainer(doc.querySelector("#node14")).editor;
- let attr = editor.newAttr;
- editField(attr, 'class="newclass" style="color:green"');
- },
- after: function() {
- assertAttributes(doc.querySelector("#node14"), {
- id: "node14",
- class: "newclass",
- style: "color:green"
- });
- }
- },
-
- {
- desc: 'Try add an attribute containing a quote (") attribute by ' +
- 'clicking the empty space after a node - this should result ' +
- 'in it being set to an empty string',
- before: function() {
- assertAttributes(doc.querySelector("#node23"), {
- id: "node23",
- });
- },
- execute: function(after) {
- let editor = markup.getContainer(doc.querySelector("#node23")).editor;
- let attr = editor.newAttr;
- editField(attr, 'class="newclass" style="""');
- executeSoon(after);
- },
- after: function() {
- assertAttributes(doc.querySelector("#node23"), {
- id: "node23",
- class: "newclass",
- style: ""
- });
- }
- },
-
- {
- desc: "Try add attributes by adding to an existing attribute's entry",
- before: function() {
- assertAttributes(doc.querySelector("#node24"), {
- id: "node24",
- });
- },
- execute: function(after) {
- let editor = markup.getContainer(doc.querySelector("#node24")).editor;
- let attr = editor.attrs["id"].querySelector(".editable");
- editField(attr, attr.textContent + ' class="""');
- executeSoon(after);
- },
- after: function() {
- assertAttributes(doc.querySelector("#node24"), {
- id: "node24",
- class: ""
- });
- }
- },
-
- {
- desc: "Edit text",
- before: function() {
- let node = doc.querySelector('.node6').firstChild;
- is(node.nodeValue, "line6", "Text should be unchanged");
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let node = doc.querySelector('.node6').firstChild;
- let editor = markup.getContainer(node).editor;
- let field = editor.elt.querySelector("pre");
- editField(field, "New text");
- },
- after: function() {
- let node = doc.querySelector('.node6').firstChild;
- is(node.nodeValue, "New text", "Text should be changed.");
- },
- },
-
- {
- desc: "Add an attribute value containing < > &uuml; \" & '",
- before: function() {
- assertAttributes(doc.querySelector("#node25"), {
- id: "node25",
- });
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let editor = markup.getContainer(doc.querySelector("#node25")).editor;
- let attr = editor.newAttr;
- editField(attr, 'src="somefile.html?param1=<a>&param2=&uuml;"bl\'ah"');
- },
- after: function() {
- assertAttributes(doc.querySelector("#node25"), {
- id: "node25",
- src: "somefile.html?param1=&lt;a&gt;&param2=&uuml;&quot;bl&apos;ah"
- });
- }
- },
- ];
-
- // Create the helper tab for parsing...
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
- content.location = "http://mochi.test:8888/browser/browser/devtools/markupview/test/browser_inspector_markup_edit.html";
-
- function setupTest() {
- var target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- inspector = toolbox.getCurrentPanel();
- startTests();
- });
- }
-
- function startTests() {
- let startNode = doc.documentElement.cloneNode();
- markup = inspector.markup;
- markup.expandAll();
-
- let cursor = 0;
-
- function nextEditTest() {
- executeSoon(function() {
- if (cursor >= edits.length) {
- addAttributes();
- } else {
- let step = edits[cursor++];
- info("START " + step.desc);
- if (step.setup) {
- step.setup();
- }
- step.before();
- info("before execute");
- step.execute(function() {
- info("after execute");
- step.after();
- ok(markup.undo.canUndo(), "Should be able to undo.");
- markup.undo.undo();
- step.before();
- ok(markup.undo.canRedo(), "Should be able to redo.");
- markup.undo.redo();
- step.after();
- info("END " + step.desc);
- nextEditTest();
- });
- }
- });
- }
- nextEditTest();
- }
-
- function addAttributes() {
- let test = {
- desc: "Add attributes by adding to an existing attribute's entry",
- setup: function() {
- inspector.selection.setNode(doc.querySelector("#node18"));
- },
- before: function() {
- assertAttributes(doc.querySelector("#node18"), {
- id: "node18",
- });
-
- is(inspector.highlighter.nodeInfo.classesBox.textContent, "",
- "No classes in the infobar before edit.");
- },
- execute: function(after) {
- inspector.once("markupmutation", function() {
- // needed because we need to make sure the infobar is updated
- // not just the markupview (which happens in this event loop)
- executeSoon(after);
- });
- let editor = markup.getContainer(doc.querySelector("#node18")).editor;
- let attr = editor.attrs["id"].querySelector(".editable");
- editField(attr, attr.textContent + ' class="newclass" style="color:green"');
- },
- after: function() {
- assertAttributes(doc.querySelector("#node18"), {
- id: "node18",
- class: "newclass",
- style: "color:green"
- });
- is(inspector.highlighter.nodeInfo.classesBox.textContent, ".newclass",
- "Correct classes in the infobar after edit.");
- }
- };
- testAsyncSetup(test, editTagName);
- }
-
- function editTagName() {
- let test = {
- desc: "Edit the tag name",
- setup: function() {
- inspector.selection.setNode(doc.querySelector("#retag-me"));
- },
- before: function() {
- let node = doc.querySelector("#retag-me");
- let container = markup.getContainer(node);
-
- is(node.tagName, "DIV", "retag-me should be a div.");
- ok(container.selected, "retag-me should be selected.");
- ok(container.expanded, "retag-me should be expanded.");
- is(doc.querySelector("#retag-me-2").parentNode, node,
- "retag-me-2 should be a child of the old element.");
- },
- execute: function(after) {
- inspector.once("markupmutation", after);
- let node = doc.querySelector("#retag-me");
- let editor = markup.getContainer(node).editor;
- let field = editor.tag;
- editField(field, "p");
- },
- after: function() {
- let node = doc.querySelector("#retag-me");
- let container = markup.getContainer(node);
- is(node.tagName, "P", "retag-me should be a p.");
- ok(container.selected, "retag-me should be selected.");
- ok(container.expanded, "retag-me should be expanded.");
- is(doc.querySelector("#retag-me-2").parentNode, node,
- "retag-me-2 should be a child of the new element.");
- }
- };
- testAsyncSetup(test, removeElementWithDelete);
- }
-
- function removeElementWithDelete() {
- let test = {
- desc: "Remove an element with the delete key",
- before: function() {
- ok(!!doc.querySelector("#node18"), "Node 18 should exist.");
- },
- execute: function() {
- inspector.selection.setNode(doc.querySelector("#node18"));
- },
- executeCont: function() {
- EventUtils.sendKey("delete", inspector.panelWin);
- },
- after: function() {
- ok(!doc.querySelector("#node18"), "Node 18 should not exist.")
- }
- };
- testAsyncExecute(test, finishUp);
- }
-
- function testAsyncExecute(test, callback) {
- info("START " + test.desc);
-
- test.before();
- inspector.selection.once("new-node", function BIMET_testAsyncExecNewNode() {
- test.executeCont();
- test.after();
- undoRedo(test, callback);
- });
- executeSoon(function BIMET_setNode1() {
- test.execute();
- });
- }
-
- function testAsyncSetup(test, callback) {
- info("START " + test.desc);
-
- inspector.selection.once("new-node", function BIMET_testAsyncSetupNewNode() {
- test.before();
- test.execute(function() {
- test.after();
- undoRedo(test, callback);
- });
- });
- executeSoon(function BIMET_setNode2() {
- test.setup();
- });
- }
-
- function undoRedo(test, callback) {
- ok(markup.undo.canUndo(), "Should be able to undo.");
- markup.undo.undo();
- executeSoon(function() {
- test.before();
- ok(markup.undo.canRedo(), "Should be able to redo.");
- markup.undo.redo();
- executeSoon(function() {
- test.after();
- info("END " + test.desc);
- callback();
- });
- });
- }
-
- function finishUp() {
- while (markup.undo.canUndo()) {
- markup.undo.undo();
- }
- doc = inspector = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_mutation.html b/browser/devtools/markupview/test/browser_inspector_markup_mutation.html
deleted file mode 100644
index 65895a26c..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_mutation.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-
-<html class="html">
-
- <body class="body">
- <div class="node0">
- <div id="node1" class="node1">line1</div>
- <div id="node2" class="node2">line2</div>
- <p class="node3">line3</p>
- <!-- A comment -->
- <p id="node4" class="node4">line4
- <span class="node5">line5</span>
- <span class="node6">line6</span>
- <!-- A comment -->
- <a class="node7">line7<span class="node8">line8</span></a>
- <span class="node9">line9</span>
- <span class="node10">line10</span>
- <span class="node11">line11</span>
- <a class="node12">line12<span class="node13">line13</span></a>
- </p>
- <p id="node14">line14</p>
- <p class="node15">line15</p>
- </div>
- <div id="node16">
- <p id="node17">line17</p>
- </div>
- <div id="node18">
- <div id="node19">
- <div id="node20">
- <div id="node21">
- line21
- </div>
- </div>
- </div>
- </div>
- </body>
-</html>
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_mutation.js b/browser/devtools/markupview/test/browser_inspector_markup_mutation.js
deleted file mode 100644
index 0923262ce..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_mutation.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Any copyright", " is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that various mutations to the dom update the markup tool correctly.
- * The test for comparing the markup tool to the real dom is a bit weird:
- * - Select the text in the markup tool
- * - Parse that as innerHTML in a document we've created for the purpose.
- * - Remove extraneous whitespace in that tree
- * - Compare it to the real dom with isEqualNode.
- */
-
-function test() {
- waitForExplicitFinish();
-
- // Will hold the doc we're viewing
- let contentTab;
- let doc;
-
- // Holds the MarkupTool object we're testing.
- let markup;
-
- // Holds the document we use to help re-parse the markup tool's output.
- let parseTab;
- let parseDoc;
-
- let inspector;
-
- // Strip whitespace from a node and its children.
- function stripWhitespace(node)
- {
- node.normalize();
- let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
- null);
-
- while ((node = iter.nextNode())) {
- node.nodeValue = node.nodeValue.replace(/\s+/g, '');
- if (node.nodeType == Node.TEXT_NODE &&
- !/[^\s]/.exec(node.nodeValue)) {
- node.parentNode.removeChild(node);
- }
- }
- }
-
- // Verify that the markup in the tool is the same as the markup in the document.
- function checkMarkup()
- {
- markup.expandAll();
-
- let contentNode = doc.querySelector("body");
- let panelNode = markup._containers.get(contentNode).elt;
- let parseNode = parseDoc.querySelector("body");
-
- // Grab the text from the markup panel...
- let sel = panelNode.ownerDocument.defaultView.getSelection();
- sel.selectAllChildren(panelNode);
-
- // Parse it
- parseNode.outerHTML = sel;
- parseNode = parseDoc.querySelector("body");
-
- // Pull whitespace out of text and comment nodes, there will
- // be minor unimportant differences.
- stripWhitespace(parseNode);
-
- ok(contentNode.isEqualNode(parseNode), "Markup panel should match document.");
- }
-
- // All the mutation types we want to test.
- let mutations = [
- // Add an attribute
- function() {
- let node1 = doc.querySelector("#node1");
- node1.setAttribute("newattr", "newattrval");
- },
- function() {
- let node1 = doc.querySelector("#node1");
- node1.removeAttribute("newattr");
- },
- function() {
- let node1 = doc.querySelector("#node1");
- node1.textContent = "newtext";
- },
- function() {
- let node2 = doc.querySelector("#node2");
- node2.innerHTML = "<div><span>foo</span></div>";
- },
-
- function() {
- let node4 = doc.querySelector("#node4");
- while (node4.firstChild) {
- node4.removeChild(node4.firstChild);
- }
- },
- function() {
- // Move a child to a new parent.
- let node17 = doc.querySelector("#node17");
- let node1 = doc.querySelector("#node2");
- node1.appendChild(node17);
- },
-
- function() {
- // Swap a parent and child element, putting them in the same tree.
- // body
- // node1
- // node18
- // node19
- // node20
- // node21
- // will become:
- // body
- // node1
- // node20
- // node21
- // node18
- // node19
- let node18 = doc.querySelector("#node18");
- let node20 = doc.querySelector("#node20");
-
- let node1 = doc.querySelector("#node1");
-
- node1.appendChild(node20);
- node20.appendChild(node18);
- },
- ];
-
- // Create the helper tab for parsing...
- parseTab = gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- parseDoc = content.document;
-
- // Then create the actual dom we're inspecting...
- contentTab = gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload2() {
- gBrowser.selectedBrowser.removeEventListener("load", onload2, true);
- doc = content.document;
- // Strip whitespace from the doc for easier comparison.
- stripWhitespace(doc.documentElement);
- waitForFocus(setupTest, content);
- }, true);
- content.location = "http://mochi.test:8888/browser/browser/devtools/markupview/test/browser_inspector_markup_mutation.html";
- }, true);
-
- content.location = "data:text/html,<html></html>";
-
- function setupTest() {
- var target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- inspector = toolbox.getCurrentPanel();
- startTests();
- });
- }
-
- function startTests() {
- markup = inspector.markup;
- checkMarkup();
- nextStep(0);
- }
-
- function nextStep(cursor) {
- if (cursor >= mutations.length) {
- finishUp();
- return;
- }
- mutations[cursor]();
- inspector.once("markupmutation", function() {
- executeSoon(function() {
- checkMarkup();
- nextStep(cursor + 1);
- });
- });
- }
-
- function finishUp() {
- doc = inspector = null;
- gBrowser.removeTab(contentTab);
- gBrowser.removeTab(parseTab);
- finish();
- }
-}
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_navigation.html b/browser/devtools/markupview/test/browser_inspector_markup_navigation.html
deleted file mode 100644
index 9633052e1..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_navigation.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-
-<html class="html">
- <head class="head">
- <meta charset=utf-8 />
- </head>
-
- <body class="body">
- <div class="node0">
- <p class="node1">line1</p>
- <p class="node2">line2</p>
- <p class="node3">line3</p>
- <!-- A comment -->
- <p class="node4">line4
- <span class="node5">line5</span>
- <span class="node6">line6</span>
- <!-- A comment -->
- <a class="node7">line7<span class="node8">line8</span></a>
- <span class="node9">line9</span>
- <span class="node10">line10</span>
- <span class="node11">line11</span>
- <a class="node12">line12<span class="node13">line13</span></a>
- </p>
- <p class="node14">line14</p>
- <p class="node15">line15</p>
- </div>
- </body>
-</html>
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_navigation.js b/browser/devtools/markupview/test/browser_inspector_markup_navigation.js
deleted file mode 100644
index e36d3aa60..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_navigation.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Any copyright", " is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-
-function test() {
- let inspector;
-
- waitForExplicitFinish();
-
- let doc;
-
- let keySequences = [
- ["pageup", "*doctype*"],
- ["down", "html"],
- ["down", "head"],
- ["down", "body"],
- ["down", "node0"],
- ["right", "node0"],
- ["down", "node1"],
- ["down", "node2"],
- ["down", "node3"],
- ["down", "*comment*"],
- ["down", "node4"],
- ["right", "node4"],
- ["down", "*text*"],
- ["down", "node5"],
- ["down", "node6"],
- ["down", "*comment*"],
- ["down" , "node7"],
- ["right", "node7"],
- ["down", "*text*"],
- ["down", "node8"],
- ["left", "node7"],
- ["left", "node7"],
- ["right", "node7"],
- ["right", "*text*"],
- ["right", "*text*"],
- ["down", "node8"],
- ["right", "node8"],
- ["left", "node8"],
- ["down", "node9"],
- ["down", "node10"],
- ["down", "node11"],
- ["down", "node12"],
- ["right", "node12"],
- ["down", "*text*"],
- ["down", "node13"],
- ["down", "node14"],
- ["down", "node15"],
- ["down", "node15"],
- ["down", "node15"],
- ["up", "node14"],
- ["up", "node13"],
- ["up", "*text*"],
- ["up", "node12"],
- ["left", "node12"],
- ["down", "node14"],
- ["home", "*doctype*"],
- ["pagedown", "*text*"],
- ["down", "node5"],
- ["down", "node6"],
- ["down", "*comment*"],
- ["down", "node7"],
- ["left", "node7"],
- ["down", "node9"],
- ["down", "node10"],
- ["pageup", "node2"],
- ["pageup", "*doctype*"],
- ["down", "html"],
- ["left", "html"],
- ["down", "html"]
- ];
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
-
- content.location = "http://mochi.test:8888/browser/browser/devtools/markupview/test/browser_inspector_markup_navigation.html";
-
- function setupTest() {
- var target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- inspector = toolbox.getCurrentPanel();
- startNavigation();
- });
- }
-
- function startNavigation() {
- nextStep(0);
- }
-
- function nextStep(cursor) {
- if (cursor >= keySequences.length) {
- finishUp();
- return;
- }
-
- let key = keySequences[cursor][0];
- let className = keySequences[cursor][1];
- inspector.markup._frame.focus();
-
- switch(key) {
- case "right":
- EventUtils.synthesizeKey("VK_RIGHT", {});
- break;
- case "down":
- EventUtils.synthesizeKey("VK_DOWN", {});
- break;
- case "left":
- EventUtils.synthesizeKey("VK_LEFT", {});
- break;
- case "up":
- EventUtils.synthesizeKey("VK_UP", {});
- break;
- case "pageup":
- EventUtils.synthesizeKey("VK_PAGE_UP", {});
- break;
- case "pagedown":
- EventUtils.synthesizeKey("VK_PAGE_DOWN", {});
- break;
- case "home":
- EventUtils.synthesizeKey("VK_HOME", {});
- break;
- }
-
- executeSoon(function BIMNT_newNode() {
- let node = inspector.selection.node;
-
- if (className == "*comment*") {
- is(node.nodeType, Node.COMMENT_NODE, "[" + cursor + "] should be a comment after moving " + key);
- } else if (className == "*text*") {
- is(node.nodeType, Node.TEXT_NODE, "[" + cursor + "] should be text after moving " + key);
- } else if (className == "*doctype*") {
- is(node.nodeType, Node.DOCUMENT_TYPE_NODE, "[" + cursor + "] should be doctype after moving " + key);
- } else {
- is(node.className, className, "[" + cursor + "] right node selected: " + className + " after moving " + key);
- }
-
- nextStep(cursor + 1);
- });
- }
-
- function finishUp() {
- doc = inspector = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_subset.html b/browser/devtools/markupview/test/browser_inspector_markup_subset.html
deleted file mode 100644
index 8323f0b2e..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_subset.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-
-<html class="html">
- <body class="body">
- <div id="a"></div>
- <div id="b"></div>
- <div id="c"></div>
- <div id="d"></div>
- <div id="e"></div>
- <div id="f"></div>
- <div id="g"></div>
- <div id="h"></div>
- <div id="i"></div>
- <div id="j"></div>
- <div id="k"></div>
- <div id="l"></div>
- <div id="m"></div>
- <div id="n"></div>
- <div id="o"></div>
- <div id="p"></div>
- <div id="q"></div>
- <div id="r"></div>
- <div id="s"></div>
- <div id="t"></div>
- <div id="u"></div>
- <div id="v"></div>
- <div id="w"></div>
- <div id="x"></div>
- <div id="y"></div>
- <div id="z"></div>
- </body>
-</html>
diff --git a/browser/devtools/markupview/test/browser_inspector_markup_subset.js b/browser/devtools/markupview/test/browser_inspector_markup_subset.js
deleted file mode 100644
index 5b802c812..000000000
--- a/browser/devtools/markupview/test/browser_inspector_markup_subset.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Any copyright", " is dedicated to the Public Domain.
-http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that the markup view loads only as many nodes as specified
- * by the devtools.markup.pagesize preference.
- */
-
-registerCleanupFunction(function() {
- Services.prefs.clearUserPref("devtools.markup.pagesize");
-});
-Services.prefs.setIntPref("devtools.markup.pagesize", 5);
-
-
-function test() {
- waitForExplicitFinish();
-
- // Will hold the doc we're viewing
- let doc;
-
- let inspector;
-
- // Holds the MarkupTool object we're testing.
- let markup;
-
- function assertChildren(expected)
- {
- let container = markup.getContainer(doc.querySelector("body"));
- let found = [];
- for (let child of container.children.children) {
- if (child.classList.contains("more-nodes")) {
- found += "*more*";
- } else {
- found += child.container.node.getAttribute("id");
- }
- }
- is(expected, found, "Got the expected children.");
- }
-
- function forceReload()
- {
- let container = markup.getContainer(doc.querySelector("body"));
- container.childrenDirty = true;
- }
-
- let selections = [
- {
- desc: "Select the first item",
- selector: "#a",
- before: function() {
- },
- after: function() {
- assertChildren("abcde*more*");
- }
- },
- {
- desc: "Select the last item",
- selector: "#z",
- before: function() {},
- after: function() {
- assertChildren("*more*vwxyz");
- }
- },
- {
- desc: "Select an already-visible item",
- selector: "#v",
- before: function() {},
- after: function() {
- // Because "v" was already visible, we shouldn't have loaded
- // a different page.
- assertChildren("*more*vwxyz");
- },
- },
- {
- desc: "Verify childrenDirty reloads the page",
- selector: "#w",
- before: function() {
- forceReload();
- },
- after: function() {
- // But now that we don't already have a loaded page, selecting
- // w should center around w.
- assertChildren("*more*uvwxy*more*");
- },
- },
- ];
-
- // Create the helper tab for parsing...
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- doc = content.document;
- waitForFocus(setupTest, content);
- }, true);
- content.location = "http://mochi.test:8888/browser/browser/devtools/markupview/test/browser_inspector_markup_subset.html";
-
- function setupTest() {
- var target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- toolbox.once("inspector-selected", function SE_selected(id, aInspector) {
- inspector = aInspector;
- markup = inspector.markup;
- runNextSelection();
- });
- });
- }
-
- function runTests() {
- inspector.selection.once("new-node", startTests);
- executeSoon(function() {
- inspector.selection.setNode(doc.body);
- });
- }
-
- function runNextSelection() {
- let selection = selections.shift();
- if (!selection) {
- clickMore();
- return;
- }
-
- info(selection.desc);
- selection.before();
- inspector.selection.once("new-node", function() {
- selection.after();
- runNextSelection();
- });
- inspector.selection.setNode(doc.querySelector(selection.selector));
- }
-
- function clickMore() {
- info("Check that clicking more loads the whole thing.");
- // Make sure that clicking the "more" button loads all the nodes.
- let container = markup.getContainer(doc.querySelector("body"));
- let button = container.elt.querySelector("button");
- button.click();
- assertChildren("abcdefghijklmnopqrstuvwxyz");
- finishUp();
- }
-
- function finishUp() {
- doc = inspector = null;
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/markupview/test/head.js b/browser/devtools/markupview/test/head.js
deleted file mode 100644
index c1e1804bf..000000000
--- a/browser/devtools/markupview/test/head.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cu = Components.utils;
-
-let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-// Clear preferences that may be set during the course of tests.
-function clearUserPrefs()
-{
- Services.prefs.clearUserPref("devtools.inspector.htmlPanelOpen");
- Services.prefs.clearUserPref("devtools.inspector.sidebarOpen");
- Services.prefs.clearUserPref("devtools.inspector.activeSidebar");
-}
-
-registerCleanupFunction(clearUserPrefs);
diff --git a/browser/devtools/markupview/test/moz.build b/browser/devtools/markupview/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/markupview/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/netmonitor/moz.build b/browser/devtools/netmonitor/moz.build
index 493f80dc6..3e687979f 100644
--- a/browser/devtools/netmonitor/moz.build
+++ b/browser/devtools/netmonitor/moz.build
@@ -3,4 +3,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/netmonitor/test/Makefile.in b/browser/devtools/netmonitor/test/Makefile.in
deleted file mode 100644
index 7ec624bac..000000000
--- a/browser/devtools/netmonitor/test/Makefile.in
+++ /dev/null
@@ -1,73 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_TESTS = \
- browser_net_aaa_leaktest.js \
- browser_net_autoscroll.js \
- browser_net_simple-init.js \
- browser_net_page-nav.js \
- browser_net_prefs-and-l10n.js \
- browser_net_prefs-reload.js \
- browser_net_pane-collapse.js \
- browser_net_pane-toggle.js \
- browser_net_simple-request.js \
- browser_net_simple-request-data.js \
- browser_net_simple-request-details.js \
- browser_net_content-type.js \
- browser_net_cyrillic-01.js \
- browser_net_cyrillic-02.js \
- browser_net_large-response.js \
- browser_net_status-codes.js \
- browser_net_post-data-01.js \
- browser_net_post-data-02.js \
- browser_net_jsonp.js \
- browser_net_json-long.js \
- browser_net_json-malformed.js \
- browser_net_timeline_ticks.js \
- browser_net_sort-01.js \
- browser_net_sort-02.js \
- browser_net_sort-03.js \
- browser_net_filter-01.js \
- browser_net_filter-02.js \
- browser_net_filter-03.js \
- browser_net_accessibility-01.js \
- browser_net_accessibility-02.js \
- browser_net_footer-summary.js \
- browser_net_req-resp-bodies.js \
- head.js \
- $(NULL)
-
-MOCHITEST_BROWSER_PAGES = \
- test-image.png \
- html_simple-test-page.html \
- html_navigate-test-page.html \
- html_content-type-test-page.html \
- html_cyrillic-test-page.html \
- html_status-codes-test-page.html \
- html_post-data-test-page.html \
- html_post-raw-test-page.html \
- html_jsonp-test-page.html \
- html_json-long-test-page.html \
- html_json-malformed-test-page.html \
- html_sorting-test-page.html \
- html_filter-test-page.html \
- html_infinite-get-page.html \
- html_custom-get-page.html \
- sjs_simple-test-server.sjs \
- sjs_content-type-test-server.sjs \
- sjs_status-codes-test-server.sjs \
- sjs_sorting-test-server.sjs \
- $(NULL)
-
-MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/netmonitor/test/browser_net_aaa_leaktest.js b/browser/devtools/netmonitor/test/browser_net_aaa_leaktest.js
deleted file mode 100644
index a9cd6fea7..000000000
--- a/browser/devtools/netmonitor/test/browser_net_aaa_leaktest.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the network monitor leaks on initialization and sudden destruction.
- * You can also use this initialization format as a template for other tests.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, NetMonitorView, NetMonitorController } = aMonitor.panelWin;
- let { RequestsMenu, NetworkDetails } = NetMonitorView;
-
- ok(aTab, "Should have a tab available.");
- ok(aDebuggee, "Should have a debuggee available.");
- ok(aMonitor, "Should have a network monitor pane available.");
-
- ok(document, "Should have a document available.");
- ok(NetMonitorView, "Should have a NetMonitorView object available.");
- ok(NetMonitorController, "Should have a NetMonitorController object available.");
- ok(RequestsMenu, "Should have a RequestsMenu object available.");
- ok(NetworkDetails, "Should have a NetworkDetails object available.");
-
- teardown(aMonitor).then(finish);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_accessibility-01.js b/browser/devtools/netmonitor/test/browser_net_accessibility-01.js
deleted file mode 100644
index 7c9f54391..000000000
--- a/browser/devtools/netmonitor/test/browser_net_accessibility-01.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if focus modifiers work for the SideMenuWidget.
- */
-
-function test() {
- initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 2).then(() => {
- check(-1, false);
-
- RequestsMenu.focusLastVisibleItem();
- check(1, true);
- RequestsMenu.focusFirstVisibleItem();
- check(0, true);
-
- RequestsMenu.focusNextItem();
- check(1, true);
- RequestsMenu.focusPrevItem();
- check(0, true);
-
- RequestsMenu.focusItemAtDelta(+1);
- check(1, true);
- RequestsMenu.focusItemAtDelta(-1);
- check(0, true);
-
- RequestsMenu.focusItemAtDelta(+10);
- check(1, true);
- RequestsMenu.focusItemAtDelta(-10);
- check(0, true);
-
- aDebuggee.performRequests(18);
- return waitForNetworkEvents(aMonitor, 18);
- })
- .then(() => {
- RequestsMenu.focusLastVisibleItem();
- check(19, true);
- RequestsMenu.focusFirstVisibleItem();
- check(0, true);
-
- RequestsMenu.focusNextItem();
- check(1, true);
- RequestsMenu.focusPrevItem();
- check(0, true);
-
- RequestsMenu.focusItemAtDelta(+10);
- check(10, true);
- RequestsMenu.focusItemAtDelta(-10);
- check(0, true);
-
- RequestsMenu.focusItemAtDelta(+100);
- check(19, true);
- RequestsMenu.focusItemAtDelta(-100);
- check(0, true);
-
- teardown(aMonitor).then(finish);
- });
-
- let count = 0;
-
- function check(aSelectedIndex, aPaneVisibility) {
- info("Performing check " + (count++) + ".");
-
- is(RequestsMenu.selectedIndex, aSelectedIndex,
- "The selected item in the requests menu was incorrect.");
- is(NetMonitorView.detailsPaneHidden, !aPaneVisibility,
- "The network requests details pane visibility state was incorrect.");
- }
-
- aDebuggee.performRequests(2);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_accessibility-02.js b/browser/devtools/netmonitor/test/browser_net_accessibility-02.js
deleted file mode 100644
index aac9162e1..000000000
--- a/browser/devtools/netmonitor/test/browser_net_accessibility-02.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if keyboard and mouse navigation works in the network requests menu.
- */
-
-function test() {
- initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { window, $, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 2).then(() => {
- check(-1, false);
-
- EventUtils.sendKey("DOWN", window);
- check(0, true);
- EventUtils.sendKey("UP", window);
- check(0, true);
-
- EventUtils.sendKey("PAGE_DOWN", window);
- check(1, true);
- EventUtils.sendKey("PAGE_UP", window);
- check(0, true);
-
- EventUtils.sendKey("END", window);
- check(1, true);
- EventUtils.sendKey("HOME", window);
- check(0, true);
-
- aDebuggee.performRequests(18);
- return waitForNetworkEvents(aMonitor, 18);
- })
- .then(() => {
- EventUtils.sendKey("DOWN", window);
- check(1, true);
- EventUtils.sendKey("DOWN", window);
- check(2, true);
- EventUtils.sendKey("UP", window);
- check(1, true);
- EventUtils.sendKey("UP", window);
- check(0, true);
-
- EventUtils.sendKey("PAGE_DOWN", window);
- check(4, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(8, true);
- EventUtils.sendKey("PAGE_UP", window);
- check(4, true);
- EventUtils.sendKey("PAGE_UP", window);
- check(0, true);
-
- EventUtils.sendKey("HOME", window);
- check(0, true);
- EventUtils.sendKey("HOME", window);
- check(0, true);
- EventUtils.sendKey("PAGE_UP", window);
- check(0, true);
- EventUtils.sendKey("HOME", window);
- check(0, true);
-
- EventUtils.sendKey("END", window);
- check(19, true);
- EventUtils.sendKey("END", window);
- check(19, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(19, true);
- EventUtils.sendKey("END", window);
- check(19, true);
-
- EventUtils.sendKey("PAGE_UP", window);
- check(15, true);
- EventUtils.sendKey("PAGE_UP", window);
- check(11, true);
- EventUtils.sendKey("UP", window);
- check(10, true);
- EventUtils.sendKey("UP", window);
- check(9, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(13, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(17, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(19, true);
- EventUtils.sendKey("PAGE_DOWN", window);
- check(19, true);
-
- EventUtils.sendKey("HOME", window);
- check(0, true);
- EventUtils.sendKey("DOWN", window);
- check(1, true);
- EventUtils.sendKey("END", window);
- check(19, true);
- EventUtils.sendKey("DOWN", window);
- check(19, true);
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
- check(-1, false);
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, $(".side-menu-widget-item"));
- check(0, true);
-
- teardown(aMonitor).then(finish);
- });
-
- let count = 0;
-
- function check(aSelectedIndex, aPaneVisibility) {
- info("Performing check " + (count++) + ".");
-
- is(RequestsMenu.selectedIndex, aSelectedIndex,
- "The selected item in the requests menu was incorrect.");
- is(NetMonitorView.detailsPaneHidden, !aPaneVisibility,
- "The network requests details pane visibility state was incorrect.");
- }
-
- aDebuggee.performRequests(2);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_autoscroll.js b/browser/devtools/netmonitor/test/browser_net_autoscroll.js
deleted file mode 100644
index 64f60badf..000000000
--- a/browser/devtools/netmonitor/test/browser_net_autoscroll.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Bug 863102 - Automatically scroll down upon new network requests.
- */
-
-function test() {
- let monitor, debuggee, requestsContainer, scrollTop;
-
- initNetMonitor(INFINITE_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
- monitor = aMonitor;
- debuggee = aDebuggee;
- let win = monitor.panelWin;
- let topNode = win.document.getElementById("requests-menu-contents");
- requestsContainer = topNode.getElementsByTagName("scrollbox")[0];
- ok(!!requestsContainer, "Container element exists as expected.");
- })
-
- // (1) Check that the scroll position is maintained at the bottom
- // when the requests overflow the vertical size of the container.
- .then(() => {
- return waitForRequestsToOverflowContainer(monitor, requestsContainer);
- })
- .then(() => {
- ok(scrolledToBottom(requestsContainer), "Scrolled to bottom on overflow.");
- })
-
- // (2) Now set the scroll position somewhere in the middle and check
- // that additional requests do not change the scroll position.
- .then(() => {
- let children = requestsContainer.childNodes;
- let middleNode = children.item(children.length / 2);
- middleNode.scrollIntoView();
- ok(!scrolledToBottom(requestsContainer), "Not scrolled to bottom.");
- scrollTop = requestsContainer.scrollTop; // save for comparison later
- return waitForNetworkEvents(monitor, 8);
- })
- .then(() => {
- is(requestsContainer.scrollTop, scrollTop, "Did not scroll.");
- })
-
- // (3) Now set the scroll position back at the bottom and check that
- // additional requests *do* cause the container to scroll down.
- .then(() => {
- requestsContainer.scrollTop = requestsContainer.scrollHeight;
- ok(scrolledToBottom(requestsContainer), "Set scroll position to bottom.");
- return waitForNetworkEvents(monitor, 8);
- })
- .then(() => {
- ok(scrolledToBottom(requestsContainer), "Still scrolled to bottom.");
- })
-
- // (4) Now select an item in the list and check that additional requests
- // do not change the scroll position.
- .then(() => {
- monitor.panelWin.NetMonitorView.RequestsMenu.selectedIndex = 0;
- return waitForNetworkEvents(monitor, 8);
- })
- .then(() => {
- is(requestsContainer.scrollTop, 0, "Did not scroll.");
- })
-
- // Done; clean up.
- .then(() => {
- return teardown(monitor).then(finish);
- })
-
- // Handle exceptions in the chain of promises.
- .then(null, (err) => {
- ok(false, err);
- finish();
- });
-
- function waitForRequestsToOverflowContainer (aMonitor, aContainer) {
- return waitForNetworkEvents(aMonitor, 1).then(() => {
- if (aContainer.scrollHeight > aContainer.clientHeight) {
- // Wait for some more just for good measure.
- return waitForNetworkEvents(aMonitor, 8);
- } else {
- return waitForRequestsToOverflowContainer(aMonitor, aContainer);
- }
- });
- }
-
- function scrolledToBottom(aElement) {
- return aElement.scrollTop + aElement.clientHeight >= aElement.scrollHeight;
- }
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_content-type.js b/browser/devtools/netmonitor/test/browser_net_content-type.js
deleted file mode 100644
index 3c7ed2d62..000000000
--- a/browser/devtools/netmonitor/test/browser_net_content-type.js
+++ /dev/null
@@ -1,228 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if different response content types are handled correctly.
- */
-
-function test() {
- initNetMonitor(CONTENT_TYPE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 6).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=xml", {
- status: 200,
- statusText: "OK",
- type: "xml",
- fullMimeType: "text/xml; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
- "GET", CONTENT_TYPE_SJS + "?fmt=css", {
- status: 200,
- statusText: "OK",
- type: "css",
- fullMimeType: "text/css; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(2),
- "GET", CONTENT_TYPE_SJS + "?fmt=js", {
- status: 200,
- statusText: "OK",
- type: "js",
- fullMimeType: "application/javascript; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(3),
- "GET", CONTENT_TYPE_SJS + "?fmt=json", {
- status: 200,
- statusText: "OK",
- type: "json",
- fullMimeType: "application/json; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(4),
- "GET", CONTENT_TYPE_SJS + "?fmt=bogus", {
- status: 404,
- statusText: "Not Found",
- type: "html",
- fullMimeType: "text/html; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(5),
- "GET", TEST_IMAGE, {
- status: 200,
- statusText: "OK",
- type: "png",
- fullMimeType: "image/png",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.75),
- time: true
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- testResponseTab("xml")
- .then(() => {
- RequestsMenu.selectedIndex = 1;
- return testResponseTab("css");
- })
- .then(() => {
- RequestsMenu.selectedIndex = 2;
- return testResponseTab("js");
- })
- .then(() => {
- RequestsMenu.selectedIndex = 3;
- return testResponseTab("json");
- })
- .then(() => {
- RequestsMenu.selectedIndex = 4;
- return testResponseTab("html");
- })
- .then(() => {
- RequestsMenu.selectedIndex = 5;
- return testResponseTab("png");
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
-
- function testResponseTab(aType) {
- let tab = document.querySelectorAll("#details-pane tab")[3];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
-
- is(tab.getAttribute("selected"), "true",
- "The response tab in the network details pane should be selected.");
-
- function checkVisibility(aBox) {
- is(tabpanel.querySelector("#response-content-info-header")
- .hasAttribute("hidden"), true,
- "The response info header doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-json-box")
- .hasAttribute("hidden"), aBox != "json",
- "The response content json box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-textarea-box")
- .hasAttribute("hidden"), aBox != "textarea",
- "The response content textarea box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-image-box")
- .hasAttribute("hidden"), aBox != "image",
- "The response content image box doesn't have the intended visibility.");
- }
-
- switch (aType) {
- case "xml": {
- checkVisibility("textarea");
-
- return NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "<label value='greeting'>Hello XML!</label>",
- "The text shown in the source editor is incorrect for the xml request.");
- is(aEditor.getMode(), SourceEditor.MODES.HTML,
- "The mode active in the source editor is incorrect for the xml request.");
- });
- }
- case "css": {
- checkVisibility("textarea");
-
- return NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "body:pre { content: 'Hello CSS!' }",
- "The text shown in the source editor is incorrect for the xml request.");
- is(aEditor.getMode(), SourceEditor.MODES.CSS,
- "The mode active in the source editor is incorrect for the xml request.");
- });
- }
- case "js": {
- checkVisibility("textarea");
-
- return NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "function() { return 'Hello JS!'; }",
- "The text shown in the source editor is incorrect for the xml request.");
- is(aEditor.getMode(), SourceEditor.MODES.JAVASCRIPT,
- "The mode active in the source editor is incorrect for the xml request.");
- });
- }
- case "json": {
- checkVisibility("json");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
- "There should be 1 json scope displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-property").length, 2,
- "There should be 2 json properties displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let jsonScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
-
- is(jsonScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("jsonScopeName"),
- "The json scope doesn't have the correct title.");
-
- is(jsonScope.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"),
- "greeting", "The first json property name was incorrect.");
- is(jsonScope.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"),
- "\"Hello JSON!\"", "The first json property value was incorrect.");
-
- is(jsonScope.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"),
- "__proto__", "The second json property name was incorrect.");
- is(jsonScope.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"),
- "[object Object]", "The second json property value was incorrect.");
-
- return Promise.resolve();
- }
- case "html": {
- checkVisibility("textarea");
-
- return NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "<blink>Not Found</blink>",
- "The text shown in the source editor is incorrect for the xml request.");
- is(aEditor.getMode(), SourceEditor.MODES.HTML,
- "The mode active in the source editor is incorrect for the xml request.");
- });
- }
- case "png": {
- checkVisibility("image");
-
- let imageNode = tabpanel.querySelector("#response-content-image");
- let deferred = Promise.defer();
-
- imageNode.addEventListener("load", function onLoad() {
- imageNode.removeEventListener("load", onLoad);
-
- is(tabpanel.querySelector("#response-content-image-name-value")
- .getAttribute("value"), "test-image.png",
- "The image name info isn't correct.");
- is(tabpanel.querySelector("#response-content-image-mime-value")
- .getAttribute("value"), "image/png",
- "The image mime info isn't correct.");
- is(tabpanel.querySelector("#response-content-image-encoding-value")
- .getAttribute("value"), "base64",
- "The image encoding info isn't correct.");
- is(tabpanel.querySelector("#response-content-image-dimensions-value")
- .getAttribute("value"), "16 x 16",
- "The image dimensions info isn't correct.");
-
- deferred.resolve();
- });
-
- return deferred.promise;
- }
- }
- }
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_cyrillic-01.js b/browser/devtools/netmonitor/test/browser_net_cyrillic-01.js
deleted file mode 100644
index f9da54b31..000000000
--- a/browser/devtools/netmonitor/test/browser_net_cyrillic-01.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if cyrillic text is rendered correctly in the source editor.
- */
-
-function test() {
- initNetMonitor(CYRILLIC_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=txt", {
- status: 200,
- statusText: "DA DA DA"
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText().indexOf("\u044F"), 26, // Ñ
- "The text shown in the source editor is incorrect.");
- is(aEditor.getMode(), SourceEditor.MODES.TEXT,
- "The mode active in the source editor is incorrect.");
-
- teardown(aMonitor).then(finish);
- });
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_cyrillic-02.js b/browser/devtools/netmonitor/test/browser_net_cyrillic-02.js
deleted file mode 100644
index d47d8e4af..000000000
--- a/browser/devtools/netmonitor/test/browser_net_cyrillic-02.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if cyrillic text is rendered correctly in the source editor
- * when loaded directly from an HTML page.
- */
-
-function test() {
- initNetMonitor(CYRILLIC_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CYRILLIC_URL, {
- status: 200,
- statusText: "OK"
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText().indexOf("\u044F"), 189, // Ñ
- "The text shown in the source editor is incorrect.");
- is(aEditor.getMode(), SourceEditor.MODES.HTML,
- "The mode active in the source editor is incorrect.");
-
- teardown(aMonitor).then(finish);
- });
- });
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_filter-01.js b/browser/devtools/netmonitor/test/browser_net_filter-01.js
deleted file mode 100644
index c6d36e57f..000000000
--- a/browser/devtools/netmonitor/test/browser_net_filter-01.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if filtering items in the network table works correctly.
- */
-
-function test() {
- initNetMonitor(FILTERING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { $, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 8).then(() => {
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testButtons("all");
- testContents([1, 1, 1, 1, 1, 1, 1, 1])
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
- testButtons("html");
- return testContents([1, 0, 0, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-css-button"));
- testButtons("css");
- return testContents([0, 1, 0, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-js-button"));
- testButtons("js");
- return testContents([0, 0, 1, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-xhr-button"));
- testButtons("xhr");
- return testContents([1, 1, 1, 1, 1, 1, 1, 1]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-fonts-button"));
- testButtons("fonts");
- return testContents([0, 0, 0, 1, 0, 0, 0, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-images-button"));
- testButtons("images");
- return testContents([0, 0, 0, 0, 1, 0, 0, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-media-button"));
- testButtons("media");
- return testContents([0, 0, 0, 0, 0, 1, 1, 0]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-flash-button"));
- testButtons("flash");
- return testContents([0, 0, 0, 0, 0, 0, 0, 1]);
- })
- .then(() => {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-all-button"));
- testButtons("all");
- return testContents([1, 1, 1, 1, 1, 1, 1, 1]);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testButtons(aFilterType) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-filter-" + aFilterType + "-button");
- let buttons = doc.querySelectorAll(".requests-menu-footer-button");
-
- for (let button of buttons) {
- if (button != target) {
- is(button.hasAttribute("checked"), false,
- "The " + button.id + " button should not have a 'checked' attribute.");
- } else {
- is(button.hasAttribute("checked"), true,
- "The " + button.id + " button should have a 'checked' attribute.");
- }
- }
- }
-
- function testContents(aVisibility) {
- isnot(RequestsMenu.selectedItem, null,
- "There should still be a selected item after filtering.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be still selected after filtering.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should still be visible after filtering.");
-
- is(RequestsMenu.orderedItems.length, aVisibility.length,
- "There should be a specific amount of items in the requests menu.");
- is(RequestsMenu.visibleItems.length, aVisibility.filter(e => e).length,
- "There should be a specific amount of visbile items in the requests menu.");
-
- for (let i = 0; i < aVisibility.length; i++) {
- is(RequestsMenu.getItemAtIndex(i).target.hidden, !aVisibility[i],
- "The item at index " + i + " doesn't have the correct hidden state.");
- }
-
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=html", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "html",
- fullMimeType: "text/html; charset=utf-8"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
- "GET", CONTENT_TYPE_SJS + "?fmt=css", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "css",
- fullMimeType: "text/css; charset=utf-8"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(2),
- "GET", CONTENT_TYPE_SJS + "?fmt=js", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "js",
- fullMimeType: "application/javascript; charset=utf-8"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(3),
- "GET", CONTENT_TYPE_SJS + "?fmt=font", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "woff",
- fullMimeType: "font/woff"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(4),
- "GET", CONTENT_TYPE_SJS + "?fmt=image", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "png",
- fullMimeType: "image/png"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(5),
- "GET", CONTENT_TYPE_SJS + "?fmt=audio", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "ogg",
- fullMimeType: "audio/ogg"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(6),
- "GET", CONTENT_TYPE_SJS + "?fmt=video", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "webm",
- fullMimeType: "video/webm"
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(7),
- "GET", CONTENT_TYPE_SJS + "?fmt=flash", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "x-shockwave-flash",
- fullMimeType: "application/x-shockwave-flash"
- });
-
- return Promise.resolve(null);
- }
-
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_filter-02.js b/browser/devtools/netmonitor/test/browser_net_filter-02.js
deleted file mode 100644
index 5b8c6457a..000000000
--- a/browser/devtools/netmonitor/test/browser_net_filter-02.js
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if filtering items in the network table works correctly with new requests.
- */
-
-function test() {
- initNetMonitor(FILTERING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { $, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 8).then(() => {
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testButtons("all");
- testContents([1, 1, 1, 1, 1, 1, 1, 1])
- .then(() => {
- info("Testing html filtering.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
- testButtons("html");
- return testContents([1, 0, 0, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- return waitForNetworkEvents(aMonitor, 8);
- })
- .then(() => {
- info("Testing html filtering again.");
- testButtons("html");
- return testContents([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- return waitForNetworkEvents(aMonitor, 8);
- })
- .then(() => {
- info("Testing html filtering again.");
- testButtons("html");
- return testContents([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testButtons(aFilterType) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-filter-" + aFilterType + "-button");
- let buttons = doc.querySelectorAll(".requests-menu-footer-button");
-
- for (let button of buttons) {
- if (button != target) {
- is(button.hasAttribute("checked"), false,
- "The " + button.id + " button should not have a 'checked' attribute.");
- } else {
- is(button.hasAttribute("checked"), true,
- "The " + button.id + " button should have a 'checked' attribute.");
- }
- }
- }
-
- function testContents(aVisibility) {
- isnot(RequestsMenu.selectedItem, null,
- "There should still be a selected item after filtering.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be still selected after filtering.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should still be visible after filtering.");
-
- is(RequestsMenu.orderedItems.length, aVisibility.length,
- "There should be a specific amount of items in the requests menu.");
- is(RequestsMenu.visibleItems.length, aVisibility.filter(e => e).length,
- "There should be a specific amount of visbile items in the requests menu.");
-
- for (let i = 0; i < aVisibility.length; i++) {
- is(RequestsMenu.getItemAtIndex(i).target.hidden, !aVisibility[i],
- "The item at index " + i + " doesn't have the correct hidden state.");
- }
-
- for (let i = 0; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=html", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "html",
- fullMimeType: "text/html; charset=utf-8"
- });
- }
- for (let i = 1; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=css", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "css",
- fullMimeType: "text/css; charset=utf-8"
- });
- }
- for (let i = 2; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=js", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "js",
- fullMimeType: "application/javascript; charset=utf-8"
- });
- }
- for (let i = 3; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=font", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "woff",
- fullMimeType: "font/woff"
- });
- }
- for (let i = 4; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=image", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "png",
- fullMimeType: "image/png"
- });
- }
- for (let i = 5; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=audio", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "ogg",
- fullMimeType: "audio/ogg"
- });
- }
- for (let i = 6; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=video", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "webm",
- fullMimeType: "video/webm"
- });
- }
- for (let i = 7; i < aVisibility.length; i += 8) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(i),
- "GET", CONTENT_TYPE_SJS + "?fmt=flash", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "x-shockwave-flash",
- fullMimeType: "application/x-shockwave-flash"
- });
- }
-
- return Promise.resolve(null);
- }
-
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_filter-03.js b/browser/devtools/netmonitor/test/browser_net_filter-03.js
deleted file mode 100644
index e874a02ad..000000000
--- a/browser/devtools/netmonitor/test/browser_net_filter-03.js
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if filtering items in the network table works correctly with new requests
- * and while sorting is enabled.
- */
-
-function test() {
- initNetMonitor(FILTERING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { $, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 7).then(() => {
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testButtons("all");
- testContents([0, 1, 2, 3, 4, 5, 6], 7, 0)
- .then(() => {
- info("Sorting by size, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
- testButtons("all");
- return testContents([6, 4, 5, 0, 1, 2, 3], 7, 6);
- })
- .then(() => {
- info("Testing html filtering.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
- testButtons("html");
- return testContents([6, 4, 5, 0, 1, 2, 3], 1, 6);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests('{ "getMedia": true }');
- return waitForNetworkEvents(aMonitor, 7);
- })
- .then(() => {
- info("Testing html filtering again.");
- resetSorting();
- testButtons("html");
- return testContents([8, 13, 9, 11, 10, 12, 0, 4, 1, 5, 2, 6, 3, 7], 2, 13);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests('{ "getMedia": true }');
- return waitForNetworkEvents(aMonitor, 7);
- })
- .then(() => {
- info("Testing html filtering again.");
- resetSorting();
- testButtons("html");
- return testContents([12, 13, 20, 14, 16, 18, 15, 17, 19, 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11], 3, 20);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function resetSorting() {
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-waterfall-button"));
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
- }
-
- function testButtons(aFilterType) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-filter-" + aFilterType + "-button");
- let buttons = doc.querySelectorAll(".requests-menu-footer-button");
-
- for (let button of buttons) {
- if (button != target) {
- is(button.hasAttribute("checked"), false,
- "The " + button.id + " button should not have a 'checked' attribute.");
- } else {
- is(button.hasAttribute("checked"), true,
- "The " + button.id + " button should have a 'checked' attribute.");
- }
- }
- }
-
- function testContents(aOrder, aVisible, aSelection) {
- isnot(RequestsMenu.selectedItem, null,
- "There should still be a selected item after filtering.");
- is(RequestsMenu.selectedIndex, aSelection,
- "The first item should be still selected after filtering.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should still be visible after filtering.");
-
- is(RequestsMenu.orderedItems.length, aOrder.length,
- "There should be a specific amount of items in the requests menu.");
- is(RequestsMenu.visibleItems.length, aVisible,
- "There should be a specific amount of visbile items in the requests menu.");
-
- for (let i = 0; i < aOrder.length; i++) {
- is(RequestsMenu.getItemAtIndex(i), RequestsMenu.orderedItems[i],
- "The requests menu items aren't ordered correctly. Misplaced item " + i + ".");
- }
-
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i]),
- "GET", CONTENT_TYPE_SJS + "?fmt=html", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "html",
- fullMimeType: "text/html; charset=utf-8"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len]),
- "GET", CONTENT_TYPE_SJS + "?fmt=css", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "css",
- fullMimeType: "text/css; charset=utf-8"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 2]),
- "GET", CONTENT_TYPE_SJS + "?fmt=js", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "js",
- fullMimeType: "application/javascript; charset=utf-8"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 3]),
- "GET", CONTENT_TYPE_SJS + "?fmt=font", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "woff",
- fullMimeType: "font/woff"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 4]),
- "GET", CONTENT_TYPE_SJS + "?fmt=image", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "png",
- fullMimeType: "image/png"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 5]),
- "GET", CONTENT_TYPE_SJS + "?fmt=audio", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "ogg",
- fullMimeType: "audio/ogg"
- });
- }
- for (let i = 0, len = aOrder.length / 7; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 6]),
- "GET", CONTENT_TYPE_SJS + "?fmt=video", {
- fuzzyUrl: true,
- status: 200,
- statusText: "OK",
- type: "webm",
- fullMimeType: "video/webm"
- });
- }
-
- return Promise.resolve(null);
- }
-
- let str = "'<p>'" + new Array(10).join(Math.random(10)) + "'</p>'";
- aDebuggee.performRequests('{ "htmlContent": "' + str + '", "getMedia": true }');
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_footer-summary.js b/browser/devtools/netmonitor/test/browser_net_footer-summary.js
deleted file mode 100644
index 4ef217f53..000000000
--- a/browser/devtools/netmonitor/test/browser_net_footer-summary.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if the summary text displayed in the network requests menu footer
- * is correct.
- */
-
-function test() {
- let { PluralForm } = Cu.import("resource://gre/modules/PluralForm.jsm", {});
-
- initNetMonitor(FILTERING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { $, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
- testStatus();
-
- waitForNetworkEvents(aMonitor, 8).then(() => {
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-css-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-js-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-xhr-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-fonts-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-images-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-media-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-flash-button"));
- testStatus();
-
- info("Performing more requests.");
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- return waitForNetworkEvents(aMonitor, 8);
- })
- .then(() => {
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-css-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-js-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-xhr-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-fonts-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-images-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-media-button"));
- testStatus();
-
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-flash-button"));
- testStatus();
-
- teardown(aMonitor).then(finish);
- })
-
- function testStatus() {
- let summary = $("#request-menu-network-summary");
- let value = summary.getAttribute("value");
- info("Current summary: " + value);
-
- let visibleItems = RequestsMenu.visibleItems;
- let visibleRequestsCount = visibleItems.length;
- let totalRequestsCount = RequestsMenu.itemCount;
- info("Current requests: " + visibleRequestsCount + " of " + totalRequestsCount + ".");
-
- if (!totalRequestsCount) {
- is(value, "",
- "The current summary text is incorrect, expected an empty string.");
- return;
- }
-
- if (!visibleRequestsCount) {
- is(value, L10N.getStr("networkMenu.empty"),
- "The current summary text is incorrect, expected an 'empty' label.");
- return;
- }
-
- let totalBytes = RequestsMenu._getTotalBytesOfRequests(visibleItems);
- let totalMillis =
- RequestsMenu._getNewestRequest(visibleItems).attachment.endedMillis -
- RequestsMenu._getOldestRequest(visibleItems).attachment.startedMillis;
-
- info("Computed total bytes: " + totalBytes);
- info("Computed total millis: " + totalMillis);
-
- is(value, PluralForm.get(visibleRequestsCount, L10N.getStr("networkMenu.summary"))
- .replace("#1", visibleRequestsCount)
- .replace("#2", L10N.numberWithDecimals((totalBytes || 0) / 1024, 2))
- .replace("#3", L10N.numberWithDecimals((totalMillis || 0) / 1000, 2))
- , "The current summary text is incorrect.")
- }
-
- aDebuggee.performRequests('{ "getMedia": true, "getFlash": true }');
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_json-long.js b/browser/devtools/netmonitor/test/browser_net_json-long.js
deleted file mode 100644
index c683b8cda..000000000
--- a/browser/devtools/netmonitor/test/browser_net_json-long.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if very long JSON responses are handled correctly.
- */
-
-function test() {
- initNetMonitor(JSON_LONG_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- // This is receiving over 80 KB of json and will populate over 6000 items
- // in a variables view instance. Debug builds are slow.
- requestLongerTimeout(4);
-
- let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=json-long", {
- status: 200,
- statusText: "OK",
- type: "json",
- fullMimeType: "text/json; charset=utf-8",
- size: L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(85975/1024, 2)),
- time: true
- });
-
- aMonitor.panelWin.once("NetMonitor:ResponseBodyAvailable", () => {
- testResponseTab();
- teardown(aMonitor).then(finish);
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- function testResponseTab() {
- let tab = document.querySelectorAll("#details-pane tab")[3];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
-
- is(tab.getAttribute("selected"), "true",
- "The response tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#response-content-info-header")
- .hasAttribute("hidden"), true,
- "The response info header doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-json-box")
- .hasAttribute("hidden"), false,
- "The response content json box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-textarea-box")
- .hasAttribute("hidden"), true,
- "The response content textarea box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-image-box")
- .hasAttribute("hidden"), true,
- "The response content image box doesn't have the intended visibility.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
- "There should be 1 json scope displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-property").length, 6057,
- "There should be 6057 json properties displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let jsonScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
- let names = ".variables-view-property .name";
- let values = ".variables-view-property .value";
-
- is(jsonScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("jsonScopeName"),
- "The json scope doesn't have the correct title.");
-
- is(jsonScope.querySelectorAll(names)[0].getAttribute("value"),
- "0", "The first json property name was incorrect.");
- is(jsonScope.querySelectorAll(values)[0].getAttribute("value"),
- "[object Object]", "The first json property value was incorrect.");
-
- is(jsonScope.querySelectorAll(names)[1].getAttribute("value"),
- "greeting", "The second json property name was incorrect.");
- is(jsonScope.querySelectorAll(values)[1].getAttribute("value"),
- "\"Hello long string JSON!\"", "The second json property value was incorrect.");
-
- is(Array.slice(jsonScope.querySelectorAll(names), -1).shift().getAttribute("value"),
- "__proto__", "The last json property name was incorrect.");
- is(Array.slice(jsonScope.querySelectorAll(values), -1).shift().getAttribute("value"),
- "[object Object]", "The last json property value was incorrect.");
- }
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_json-malformed.js b/browser/devtools/netmonitor/test/browser_net_json-malformed.js
deleted file mode 100644
index 1ea3124d4..000000000
--- a/browser/devtools/netmonitor/test/browser_net_json-malformed.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if malformed JSON responses are handled correctly.
- */
-
-function test() {
- initNetMonitor(JSON_MALFORMED_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=json-malformed", {
- status: 200,
- statusText: "OK",
- type: "json",
- fullMimeType: "text/json; charset=utf-8"
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- let tab = document.querySelectorAll("#details-pane tab")[3];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
-
- is(tab.getAttribute("selected"), "true",
- "The response tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#response-content-info-header")
- .hasAttribute("hidden"), false,
- "The response info header doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-info-header")
- .getAttribute("value"),
- "SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data",
- "The response info header doesn't have the intended value attribute.");
- is(tabpanel.querySelector("#response-content-info-header")
- .getAttribute("tooltiptext"),
- "SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data",
- "The response info header doesn't have the intended tooltiptext attribute.");
-
- is(tabpanel.querySelector("#response-content-json-box")
- .hasAttribute("hidden"), true,
- "The response content json box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-textarea-box")
- .hasAttribute("hidden"), false,
- "The response content textarea box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-image-box")
- .hasAttribute("hidden"), true,
- "The response content image box doesn't have the intended visibility.");
-
- NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "{ \"greeting\": \"Hello malformed JSON!\" },",
- "The text shown in the source editor is incorrect.");
- is(aEditor.getMode(), SourceEditor.MODES.JAVASCRIPT,
- "The mode active in the source editor is incorrect.");
-
- teardown(aMonitor).then(finish);
- });
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_jsonp.js b/browser/devtools/netmonitor/test/browser_net_jsonp.js
deleted file mode 100644
index a3b3f03c9..000000000
--- a/browser/devtools/netmonitor/test/browser_net_jsonp.js
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if JSONP responses are handled correctly.
- */
-
-function test() {
- initNetMonitor(JSONP_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=jsonp&jsonp=$_0123Fun", {
- status: 200,
- statusText: "OK",
- type: "json",
- fullMimeType: "text/json; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
- time: true
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- testResponseTab();
- teardown(aMonitor).then(finish);
-
- function testResponseTab() {
- let tab = document.querySelectorAll("#details-pane tab")[3];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
-
- is(tab.getAttribute("selected"), "true",
- "The response tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#response-content-info-header")
- .hasAttribute("hidden"), true,
- "The response info header doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-json-box")
- .hasAttribute("hidden"), false,
- "The response content json box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-textarea-box")
- .hasAttribute("hidden"), true,
- "The response content textarea box doesn't have the intended visibility.");
- is(tabpanel.querySelector("#response-content-image-box")
- .hasAttribute("hidden"), true,
- "The response content image box doesn't have the intended visibility.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
- "There should be 1 json scope displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-property").length, 2,
- "There should be 2 json properties displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let jsonScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
-
- is(jsonScope.querySelector(".name").getAttribute("value"),
- L10N.getFormatStr("jsonpScopeName", "$_0123Fun"),
- "The json scope doesn't have the correct title.");
-
- is(jsonScope.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"),
- "greeting", "The first json property name was incorrect.");
- is(jsonScope.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"),
- "\"Hello JSONP!\"", "The first json property value was incorrect.");
-
- is(jsonScope.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"),
- "__proto__", "The second json property name was incorrect.");
- is(jsonScope.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"),
- "[object Object]", "The second json property value was incorrect.");
- }
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_large-response.js b/browser/devtools/netmonitor/test/browser_net_large-response.js
deleted file mode 100644
index 41561ed50..000000000
--- a/browser/devtools/netmonitor/test/browser_net_large-response.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if very large response contents are just displayed as plain text.
- */
-
-function test() {
- initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- // This test could potentially be slow because over 100 KB of stuff
- // is going to be requested and displayed in the source editor.
- requestLongerTimeout(2);
-
- let { document, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "GET", CONTENT_TYPE_SJS + "?fmt=html-long", {
- status: 200,
- statusText: "OK"
- });
-
- aMonitor.panelWin.once("NetMonitor:ResponseBodyAvailable", () => {
- NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- ok(aEditor.getText().match(/^<p>/),
- "The text shown in the source editor is incorrect.");
- is(aEditor.getMode(), SourceEditor.MODES.TEXT,
- "The mode active in the source editor is incorrect.");
-
- teardown(aMonitor).then(finish);
- });
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
- });
-
- aDebuggee.performRequests(1, CONTENT_TYPE_SJS + "?fmt=html-long");
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_page-nav.js b/browser/devtools/netmonitor/test/browser_net_page-nav.js
deleted file mode 100644
index 690a3b8c1..000000000
--- a/browser/devtools/netmonitor/test/browser_net_page-nav.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if page navigation ("close", "navigate", etc.) triggers an appropriate
- * action in the network monitor.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- testNavigate(() => testNavigateBack(() => testClose(() => finish())));
-
- function testNavigate(aCallback) {
- info("Navigating forward...");
-
- aMonitor.panelWin.once("NetMonitor:TargetWillNavigate", () => {
- is(aDebuggee.location, SIMPLE_URL,
- "Target started navigating to the correct location.");
-
- aMonitor.panelWin.once("NetMonitor:TargetNavigate", () => {
- is(aDebuggee.location, NAVIGATE_URL,
- "Target finished navigating to the correct location.");
-
- aCallback();
- });
- });
-
- aDebuggee.location = NAVIGATE_URL;
- }
-
- function testNavigateBack(aCallback) {
- info("Navigating backward...");
-
- aMonitor.panelWin.once("NetMonitor:TargetWillNavigate", () => {
- is(aDebuggee.location, NAVIGATE_URL,
- "Target started navigating back to the previous location.");
-
- aMonitor.panelWin.once("NetMonitor:TargetNavigate", () => {
- is(aDebuggee.location, SIMPLE_URL,
- "Target finished navigating back to the previous location.");
-
- aCallback();
- });
- });
-
- aDebuggee.location = SIMPLE_URL;
- }
-
- function testClose(aCallback) {
- info("Closing...");
-
- aMonitor.once("destroyed", () => {
- ok(!aMonitor._controller.client,
- "There shouldn't be a client available after destruction.");
- ok(!aMonitor._controller.tabClient,
- "There shouldn't be a tabClient available after destruction.");
- ok(!aMonitor._controller.webConsoleClient,
- "There shouldn't be a webConsoleClient available after destruction.");
-
- aCallback();
- });
-
- removeTab(aTab);
- }
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_pane-collapse.js b/browser/devtools/netmonitor/test/browser_net_pane-collapse.js
deleted file mode 100644
index 6434aa259..000000000
--- a/browser/devtools/netmonitor/test/browser_net_pane-collapse.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the network monitor panes collapse properly.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, Prefs, NetMonitorView } = aMonitor.panelWin;
- let detailsPane = document.getElementById("details-pane");
- let detailsPaneToggleButton = document.getElementById("details-pane-toggle");
-
- ok(detailsPane.hasAttribute("pane-collapsed") &&
- detailsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The details pane should initially be hidden.");
-
- NetMonitorView.toggleDetailsPane({ visible: true, animated: false });
-
- let width = ~~(detailsPane.getAttribute("width"));
- is(width, Prefs.networkDetailsWidth,
- "The details pane has an incorrect width.");
- is(detailsPane.style.marginLeft, "0px",
- "The details pane has an incorrect left margin.");
- is(detailsPane.style.marginRight, "0px",
- "The details pane has an incorrect right margin.");
- ok(!detailsPane.hasAttribute("animated"),
- "The details pane has an incorrect animated attribute.");
- ok(!detailsPane.hasAttribute("pane-collapsed") &&
- !detailsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The details pane should at this point be visible.");
-
- NetMonitorView.toggleDetailsPane({ visible: false, animated: true });
-
- let margin = -(width + 1) + "px";
- is(width, Prefs.networkDetailsWidth,
- "The details pane has an incorrect width after collapsing.");
- is(detailsPane.style.marginLeft, margin,
- "The details pane has an incorrect left margin after collapsing.");
- is(detailsPane.style.marginRight, margin,
- "The details pane has an incorrect right margin after collapsing.");
- ok(detailsPane.hasAttribute("animated"),
- "The details pane has an incorrect attribute after an animated collapsing.");
- ok(detailsPane.hasAttribute("pane-collapsed") &&
- detailsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The details pane should not be visible after collapsing.");
-
- NetMonitorView.toggleDetailsPane({ visible: true, animated: false });
-
- is(width, Prefs.networkDetailsWidth,
- "The details pane has an incorrect width after uncollapsing.");
- is(detailsPane.style.marginLeft, "0px",
- "The details pane has an incorrect left margin after uncollapsing.");
- is(detailsPane.style.marginRight, "0px",
- "The details pane has an incorrect right margin after uncollapsing.");
- ok(!detailsPane.hasAttribute("animated"),
- "The details pane has an incorrect attribute after an unanimated uncollapsing.");
- ok(!detailsPane.hasAttribute("pane-collapsed") &&
- !detailsPaneToggleButton.hasAttribute("pane-collapsed"),
- "The details pane should be visible again after uncollapsing.");
-
- teardown(aMonitor).then(finish);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_pane-toggle.js b/browser/devtools/netmonitor/test/browser_net_pane-toggle.js
deleted file mode 100644
index 552c39cda..000000000
--- a/browser/devtools/netmonitor/test/browser_net_pane-toggle.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if toggling the details pane works as expected.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), true,
- "The pane toggle button should be disabled when the frontend is opened.");
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("pane-collapsed"), true,
- "The pane toggle button should indicate that the details pane is " +
- "collapsed when the frontend is opened.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should be hidden when the frontend is opened.");
- is(RequestsMenu.selectedItem, null,
- "There should be no selected item in the requests menu.");
-
- aMonitor.panelWin.once("NetMonitor:NetworkEvent", () => {
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), false,
- "The pane toggle button should be enabled after the first request.");
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("pane-collapsed"), true,
- "The pane toggle button should still indicate that the details pane is " +
- "collapsed after the first request.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should still be hidden after the first request.");
- is(RequestsMenu.selectedItem, null,
- "There should still be no selected item in the requests menu.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
-
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), false,
- "The pane toggle button should still be enabled after being pressed.");
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("pane-collapsed"), false,
- "The pane toggle button should now indicate that the details pane is " +
- "not collapsed anymore after being pressed.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
-
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), false,
- "The pane toggle button should still be enabled after being pressed again.");
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("pane-collapsed"), true,
- "The pane toggle button should now indicate that the details pane is " +
- "collapsed after being pressed again.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should now be hidden after the toggle button was pressed again.");
- is(RequestsMenu.selectedItem, null,
- "There should now be no selected item in the requests menu.");
-
- teardown(aMonitor).then(finish);
- });
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_post-data-01.js b/browser/devtools/netmonitor/test/browser_net_post-data-01.js
deleted file mode 100644
index 1e23adeb3..000000000
--- a/browser/devtools/netmonitor/test/browser_net_post-data-01.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the POST requests display the correct information in the UI.
- */
-
-function test() {
- initNetMonitor(POST_DATA_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu, NetworkDetails } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
- NetworkDetails._params.lazyEmpty = false;
-
- waitForNetworkEvents(aMonitor, 0, 2).then(() => {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
- "POST", SIMPLE_SJS + "?foo=bar&baz=42&type=urlencoded", {
- status: 200,
- statusText: "Och Aye",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(1),
- "POST", SIMPLE_SJS + "?foo=bar&baz=42&type=multipart", {
- status: 200,
- statusText: "Och Aye",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- time: true
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[2]);
-
- testParamsTab("urlencoded")
- .then(() => {
- RequestsMenu.selectedIndex = 1;
- return testParamsTab("multipart");
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
-
- function testParamsTab(aType) {
- let tab = document.querySelectorAll("#details-pane tab")[2];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
-
- is(tab.getAttribute("selected"), "true",
- "The params tab in the network details pane should be selected.");
-
- function checkVisibility(aBox) {
- is(tabpanel.querySelector("#request-params-box")
- .hasAttribute("hidden"), !aBox.contains("params"),
- "The request params box doesn't have the indended visibility.");
- is(tabpanel.querySelector("#request-post-data-textarea-box")
- .hasAttribute("hidden"), !aBox.contains("textarea"),
- "The request post data textarea box doesn't have the indended visibility.");
- }
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 2,
- "There should be 2 param scopes displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let queryScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
- let postScope = tabpanel.querySelectorAll(".variables-view-scope")[1];
-
- is(queryScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("paramsQueryString"),
- "The query scope doesn't have the correct title.");
-
- is(postScope.querySelector(".name").getAttribute("value"),
- L10N.getStr(aType == "urlencoded" ? "paramsFormData" : "paramsPostPayload"),
- "The post scope doesn't have the correct title.");
-
- is(queryScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "foo", "The first query param name was incorrect.");
- is(queryScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- "\"bar\"", "The first query param value was incorrect.");
- is(queryScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
- "baz", "The second query param name was incorrect.");
- is(queryScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
- "\"42\"", "The second query param value was incorrect.");
- is(queryScope.querySelectorAll(".variables-view-variable .name")[2].getAttribute("value"),
- "type", "The third query param name was incorrect.");
- is(queryScope.querySelectorAll(".variables-view-variable .value")[2].getAttribute("value"),
- "\"" + aType + "\"", "The third query param value was incorrect.");
-
- if (aType == "urlencoded") {
- checkVisibility("params");
-
- is(tabpanel.querySelectorAll(".variables-view-variable").length, 5,
- "There should be 5 param values displayed in this tabpanel.");
- is(queryScope.querySelectorAll(".variables-view-variable").length, 3,
- "There should be 3 param values displayed in the query scope.");
- is(postScope.querySelectorAll(".variables-view-variable").length, 2,
- "There should be 2 param values displayed in the post scope.");
-
- is(postScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "foo", "The first post param name was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- "\"bar\"", "The first post param value was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
- "baz", "The second post param name was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
- "\"123\"", "The second post param value was incorrect.");
-
- return Promise.resolve();
- }
- else {
- checkVisibility("params textarea");
-
- is(tabpanel.querySelectorAll(".variables-view-variable").length, 3,
- "There should be 3 param values displayed in this tabpanel.");
- is(queryScope.querySelectorAll(".variables-view-variable").length, 3,
- "There should be 3 param values displayed in the query scope.");
- is(postScope.querySelectorAll(".variables-view-variable").length, 0,
- "There should be 0 param values displayed in the post scope.");
-
- return NetMonitorView.editor("#request-post-data-textarea").then((aEditor) => {
- ok(aEditor.getText().contains("Content-Disposition: form-data; name=\"text\""),
- "The text shown in the source editor is incorrect (1.1).");
- ok(aEditor.getText().contains("Content-Disposition: form-data; name=\"email\""),
- "The text shown in the source editor is incorrect (2.1).");
- ok(aEditor.getText().contains("Content-Disposition: form-data; name=\"range\""),
- "The text shown in the source editor is incorrect (3.1).");
- ok(aEditor.getText().contains("Content-Disposition: form-data; name=\"Custom field\""),
- "The text shown in the source editor is incorrect (4.1).");
- ok(aEditor.getText().contains("Some text..."),
- "The text shown in the source editor is incorrect (2.2).");
- ok(aEditor.getText().contains("42"),
- "The text shown in the source editor is incorrect (3.2).");
- ok(aEditor.getText().contains("Extra data"),
- "The text shown in the source editor is incorrect (4.2).");
- is(aEditor.getMode(), SourceEditor.MODES.TEXT,
- "The mode active in the source editor is incorrect.");
- });
- }
- }
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_post-data-02.js b/browser/devtools/netmonitor/test/browser_net_post-data-02.js
deleted file mode 100644
index b3d200a9e..000000000
--- a/browser/devtools/netmonitor/test/browser_net_post-data-02.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the POST requests display the correct information in the UI,
- * even for raw payloads without attached content-type headers.
- */
-
-function test() {
- initNetMonitor(POST_RAW_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu, NetworkDetails } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
- NetworkDetails._params.lazyEmpty = false;
-
- waitForNetworkEvents(aMonitor, 0, 1).then(() => {
- NetMonitorView.toggleDetailsPane({ visible: true }, 2)
- RequestsMenu.selectedIndex = 0;
-
- let tab = document.querySelectorAll("#details-pane tab")[2];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
-
- is(tab.getAttribute("selected"), "true",
- "The params tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#request-params-box")
- .hasAttribute("hidden"), false,
- "The request params box doesn't have the indended visibility.");
- is(tabpanel.querySelector("#request-post-data-textarea-box")
- .hasAttribute("hidden"), true,
- "The request post data textarea box doesn't have the indended visibility.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
- "There should be 1 param scopes displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let postScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
- is(postScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("paramsFormData"),
- "The post scope doesn't have the correct title.");
-
- is(postScope.querySelectorAll(".variables-view-variable").length, 2,
- "There should be 2 param values displayed in the post scope.");
- is(postScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "foo", "The first query param name was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- "\"bar\"", "The first query param value was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
- "baz", "The second query param name was incorrect.");
- is(postScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
- "\"123\"", "The second query param value was incorrect.");
-
- teardown(aMonitor).then(finish);
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js b/browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js
deleted file mode 100644
index ce0f31ff7..000000000
--- a/browser/devtools/netmonitor/test/browser_net_prefs-and-l10n.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the preferences and localization objects work correctly.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- ok(aMonitor.panelWin.L10N,
- "Should have a localization object available on the panel window.");
- ok(aMonitor.panelWin.Prefs,
- "Should have a preferences object available on the panel window.");
-
- function testL10N() {
- let { L10N } = aMonitor.panelWin;
-
- ok(L10N.stringBundle,
- "The localization object should have a string bundle available.");
-
- let bundleName = "chrome://browser/locale/devtools/netmonitor.properties";
- let stringBundle = Services.strings.createBundle(bundleName);
-
- is(L10N.getStr("netmonitor.label"),
- stringBundle.GetStringFromName("netmonitor.label"),
- "The getStr() method didn't return the expected string.");
-
- is(L10N.getFormatStr("networkMenu.totalMS", "foo"),
- stringBundle.formatStringFromName("networkMenu.totalMS", ["foo"], 1),
- "The getFormatStr() method didn't return the expected string.");
- }
-
- function testPrefs() {
- let { Prefs } = aMonitor.panelWin;
-
- is(Prefs.root, "devtools.netmonitor",
- "The preferences object should have a correct root path.");
-
- is(Prefs.networkDetailsWidth,
- Services.prefs.getIntPref("devtools.netmonitor.panes-network-details-width"),
- "Getting a pref should work correctly.");
-
- let previousValue = Prefs.networkDetailsWidth;
- let bogusValue = ~~(Math.random() * 100);
- Prefs.networkDetailsWidth = bogusValue;
- is(Prefs.networkDetailsWidth,
- Services.prefs.getIntPref("devtools.netmonitor.panes-network-details-width"),
- "Getting a pref after it has been modified should work correctly.");
- is(Prefs.networkDetailsWidth, bogusValue,
- "The pref wasn't updated correctly in the preferences object.");
-
- Prefs.networkDetailsWidth = previousValue;
- is(Prefs.networkDetailsWidth,
- Services.prefs.getIntPref("devtools.netmonitor.panes-network-details-width"),
- "Getting a pref after it has been modified again should work correctly.");
- is(Prefs.networkDetailsWidth, previousValue,
- "The pref wasn't updated correctly again in the preferences object.");
- }
-
- testL10N();
- testPrefs();
-
- teardown(aMonitor).then(finish);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_prefs-reload.js b/browser/devtools/netmonitor/test/browser_net_prefs-reload.js
deleted file mode 100644
index d5fd61c43..000000000
--- a/browser/devtools/netmonitor/test/browser_net_prefs-reload.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if the prefs that should survive across tool reloads work.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- // This test reopens the network monitor a bunch of times, for different
- // hosts (bottom, side, window). This seems to be slow on debug builds.
- requestLongerTimeout(3);
-
- let prefsToCheck = {
- networkDetailsWidth: {
- newValue: ~~(Math.random() * 200 + 100),
- validate: ($) => ~~$("#details-pane").getAttribute("width"),
- modifyFrontend: ($, aValue) => $("#details-pane").setAttribute("width", aValue)
- },
- networkDetailsHeight: {
- newValue: ~~(Math.random() * 300 + 100),
- validate: ($) => ~~$("#details-pane").getAttribute("height"),
- modifyFrontend: ($, aValue) => $("#details-pane").setAttribute("height", aValue)
- },
- /* add more prefs here... */
- };
-
- function storeFirstPrefValues() {
- info("Caching initial pref values.");
-
- for (let name in prefsToCheck) {
- let currentValue = aMonitor.panelWin.Prefs[name];
- prefsToCheck[name].firstValue = currentValue;
- }
- }
-
- function validateFirstPrefValues() {
- info("Validating current pref values to the UI elements.");
-
- for (let name in prefsToCheck) {
- let currentValue = aMonitor.panelWin.Prefs[name];
- let firstValue = prefsToCheck[name].firstValue;
- let validate = prefsToCheck[name].validate;
-
- is(currentValue, firstValue,
- "Pref " + name + " should be equal to first value: " + firstValue);
- is(currentValue, validate(aMonitor.panelWin.$),
- "Pref " + name + " should validate: " + currentValue);
- }
- }
-
- function modifyFrontend() {
- info("Modifying UI elements to the specified new values.");
-
- for (let name in prefsToCheck) {
- let currentValue = aMonitor.panelWin.Prefs[name];
- let firstValue = prefsToCheck[name].firstValue;
- let newValue = prefsToCheck[name].newValue;
- let validate = prefsToCheck[name].validate;
- let modifyFrontend = prefsToCheck[name].modifyFrontend;
-
- modifyFrontend(aMonitor.panelWin.$, newValue);
- info("Modified UI element affecting " + name + " to: " + newValue);
-
- is(currentValue, firstValue,
- "Pref " + name + " should still be equal to first value: " + firstValue);
- isnot(currentValue, newValue,
- "Pref " + name + " should't yet be equal to second value: " + newValue);
- is(newValue, validate(aMonitor.panelWin.$),
- "The UI element affecting " + name + " should validate: " + newValue);
- }
- }
-
- function validateNewPrefValues() {
- info("Invalidating old pref values to the modified UI elements.");
-
- for (let name in prefsToCheck) {
- let currentValue = aMonitor.panelWin.Prefs[name];
- let firstValue = prefsToCheck[name].firstValue;
- let newValue = prefsToCheck[name].newValue;
- let validate = prefsToCheck[name].validate;
-
- isnot(currentValue, firstValue,
- "Pref " + name + " should't be equal to first value: " + firstValue);
- is(currentValue, newValue,
- "Pref " + name + " should now be equal to second value: " + newValue);
- is(newValue, validate(aMonitor.panelWin.$),
- "The UI element affecting " + name + " should validate: " + newValue);
- }
- }
-
- function resetFrontend() {
- info("Resetting UI elements to the cached initial pref values.");
-
- for (let name in prefsToCheck) {
- let currentValue = aMonitor.panelWin.Prefs[name];
- let firstValue = prefsToCheck[name].firstValue;
- let newValue = prefsToCheck[name].newValue;
- let validate = prefsToCheck[name].validate;
- let modifyFrontend = prefsToCheck[name].modifyFrontend;
-
- modifyFrontend(aMonitor.panelWin.$, firstValue);
- info("Modified UI element affecting " + name + " to: " + firstValue);
-
- isnot(currentValue, firstValue,
- "Pref " + name + " should't yet be equal to first value: " + firstValue);
- is(currentValue, newValue,
- "Pref " + name + " should still be equal to second value: " + newValue);
- is(firstValue, validate(aMonitor.panelWin.$),
- "The UI element affecting " + name + " should validate: " + firstValue);
- }
- }
-
- function testBottom() {
- info("Testing prefs reload for a bottom host.");
- storeFirstPrefValues();
-
- // Validate and modify while toolbox is on the bottom.
- validateFirstPrefValues();
- modifyFrontend();
-
- return restartNetMonitor(aMonitor)
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate and reset frontend while toolbox is on the bottom.
- validateNewPrefValues();
- resetFrontend();
-
- return restartNetMonitor(aMonitor);
- })
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate.
- validateFirstPrefValues();
- });
- }
-
- function testSide() {
- info("Moving toolbox to the side...");
-
- return aMonitor._toolbox.switchHost(Toolbox.HostType.SIDE)
- .then(() => {
- info("Testing prefs reload for a side host.");
- storeFirstPrefValues();
-
- // Validate and modify frontend while toolbox is on the side.
- validateFirstPrefValues();
- modifyFrontend();
-
- return restartNetMonitor(aMonitor);
- })
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate and reset frontend while toolbox is on the side.
- validateNewPrefValues();
- resetFrontend();
-
- return restartNetMonitor(aMonitor);
- })
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate.
- validateFirstPrefValues();
- });
- }
-
- function testWindow() {
- info("Moving toolbox into a window...");
-
- return aMonitor._toolbox.switchHost(Toolbox.HostType.WINDOW)
- .then(() => {
- info("Testing prefs reload for a window host.");
- storeFirstPrefValues();
-
- // Validate and modify frontend while toolbox is in a window.
- validateFirstPrefValues();
- modifyFrontend();
-
- return restartNetMonitor(aMonitor);
- })
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate and reset frontend while toolbox is in a window.
- validateNewPrefValues();
- resetFrontend();
-
- return restartNetMonitor(aMonitor);
- })
- .then(([,, aNewMonitor]) => {
- aMonitor = aNewMonitor;
-
- // Revalidate.
- validateFirstPrefValues();
- });
- }
-
- function cleanupAndFinish() {
- info("Moving toolbox back to the bottom...");
-
- aMonitor._toolbox.switchHost(Toolbox.HostType.BOTTOM)
- .then(() => teardown(aMonitor))
- .then(finish);
- }
-
- testBottom()
- .then(testSide)
- .then(testWindow)
- .then(cleanupAndFinish);
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_req-resp-bodies.js b/browser/devtools/netmonitor/test/browser_net_req-resp-bodies.js
deleted file mode 100644
index 1f1a55a16..000000000
--- a/browser/devtools/netmonitor/test/browser_net_req-resp-bodies.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if request and response body logging stays on after opening the console.
- */
-
-function test() {
- initNetMonitor(JSON_LONG_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- function verifyRequest(aOffset) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOffset),
- "GET", CONTENT_TYPE_SJS + "?fmt=json-long", {
- status: 200,
- statusText: "OK",
- type: "json",
- fullMimeType: "text/json; charset=utf-8",
- size: L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(85975/1024, 2)),
- time: true
- });
- }
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequest(0);
-
- aMonitor._toolbox.once("webconsole-selected", () => {
- aMonitor._toolbox.once("netmonitor-selected", () => {
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- waitForNetworkEvents(aMonitor, 1).then(() => {
- verifyRequest(1);
- teardown(aMonitor).then(finish);
- });
-
- // Perform another batch of requests.
- aDebuggee.performRequests();
- });
-
- // Reload debugee.
- aDebuggee.location.reload();
- });
-
- // Switch back to the netmonitor.
- aMonitor._toolbox.selectTool("netmonitor");
- });
-
- // Switch to the webconsole.
- aMonitor._toolbox.selectTool("webconsole");
- });
-
- // Perform first batch of requests.
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_simple-init.js b/browser/devtools/netmonitor/test/browser_net_simple-init.js
deleted file mode 100644
index 9f444bb49..000000000
--- a/browser/devtools/netmonitor/test/browser_net_simple-init.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Simple check if the network monitor starts up and shuts down properly.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- is(aTab.linkedBrowser.contentWindow.wrappedJSObject.location, SIMPLE_URL,
- "The current tab's location is the correct one.");
- is(aDebuggee.location, SIMPLE_URL,
- "The current debuggee's location is the correct one.");
-
- function checkIfInitialized(aTag) {
- info("Checking if initialization is ok (" + aTag + ").");
-
- ok(aMonitor._view,
- "The network monitor view object exists (" + aTag + ").");
- ok(aMonitor._view._isInitialized,
- "The network monitor view object exists and is initialized (" + aTag + ").");
-
- ok(aMonitor._controller,
- "The network monitor controller object exists (" + aTag + ").");
- ok(aMonitor._controller._isInitialized,
- "The network monitor controller object exists and is initialized (" + aTag + ").");
-
- ok(aMonitor.isReady,
- "The network monitor panel appears to be ready (" + aTag + ").");
-
- ok(aMonitor._controller.client,
- "There should be a client available at this point (" + aTag + ").");
- ok(aMonitor._controller.tabClient,
- "There should be a tabClient available at this point (" + aTag + ").");
- ok(aMonitor._controller.webConsoleClient,
- "There should be a webConsoleClient available at this point (" + aTag + ").");
- }
-
- function checkIfDestroyed(aTag) {
- info("Checking if destruction is ok.");
-
- ok(!aMonitor._controller.client,
- "There shouldn't be a client available after destruction (" + aTag + ").");
- ok(!aMonitor._controller.tabClient,
- "There shouldn't be a tabClient available after destruction (" + aTag + ").");
- ok(!aMonitor._controller.webConsoleClient,
- "There shouldn't be a webConsoleClient available after destruction (" + aTag + ").");
- }
-
- executeSoon(() => {
- checkIfInitialized(1);
-
- aMonitor._controller.startupNetMonitor()
- .then(() => {
- info("Starting up again shouldn't do anything special.");
- checkIfInitialized(2);
- return aMonitor._controller.connect();
- })
- .then(() => {
- info("Connecting again shouldn't do anything special.");
- checkIfInitialized(3);
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- registerCleanupFunction(() => {
- checkIfDestroyed(1);
-
- aMonitor._controller.shutdownNetMonitor()
- .then(() => {
- info("Shutting down again shouldn't do anything special.");
- checkIfDestroyed(2);
- return aMonitor._controller.disconnect();
- })
- .then(() => {
- info("Disconnecting again shouldn't do anything special.");
- checkIfDestroyed(3);
- });
- });
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_simple-request-data.js b/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
deleted file mode 100644
index d9efa5eeb..000000000
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-data.js
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if requests render correct information in the menu UI.
- */
-
-function test() {
- initNetMonitor(SIMPLE_SJS).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1)
- .then(() => teardown(aMonitor))
- .then(finish);
-
- aMonitor.panelWin.once("NetMonitor:NetworkEvent", () => {
- is(RequestsMenu.selectedItem, null,
- "There shouldn't be any selected item in the requests menu.");
- is(RequestsMenu.itemCount, 1,
- "The requests menu should not be empty after the first request.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should still be hidden after the first request.");
-
- let requestItem = RequestsMenu.getItemAtIndex(0);
- let target = requestItem.target;
-
- is(typeof requestItem.value, "string",
- "The attached request id is incorrect.");
- isnot(requestItem.value, "",
- "The attached request id should not be empty.");
-
- is(typeof requestItem.attachment.startedDeltaMillis, "number",
- "The attached startedDeltaMillis is incorrect.");
- is(requestItem.attachment.startedDeltaMillis, 0,
- "The attached startedDeltaMillis should be zero.");
-
- is(typeof requestItem.attachment.startedMillis, "number",
- "The attached startedMillis is incorrect.");
- isnot(requestItem.attachment.startedMillis, 0,
- "The attached startedMillis should not be zero.");
-
- is(requestItem.attachment.requestHeaders, undefined,
- "The requestHeaders should not yet be set.");
- is(requestItem.attachment.requestCookies, undefined,
- "The requestCookies should not yet be set.");
- is(requestItem.attachment.requestPostData, undefined,
- "The requestPostData should not yet be set.");
-
- is(requestItem.attachment.responseHeaders, undefined,
- "The responseHeaders should not yet be set.");
- is(requestItem.attachment.responseCookies, undefined,
- "The responseCookies should not yet be set.");
-
- is(requestItem.attachment.httpVersion, undefined,
- "The httpVersion should not yet be set.");
- is(requestItem.attachment.status, undefined,
- "The status should not yet be set.");
- is(requestItem.attachment.statusText, undefined,
- "The statusText should not yet be set.");
-
- is(requestItem.attachment.headersSize, undefined,
- "The headersSize should not yet be set.");
- is(requestItem.attachment.contentSize, undefined,
- "The contentSize should not yet be set.");
-
- is(requestItem.attachment.mimeType, undefined,
- "The mimeType should not yet be set.");
- is(requestItem.attachment.responseContent, undefined,
- "The responseContent should not yet be set.");
-
- is(requestItem.attachment.totalTime, undefined,
- "The totalTime should not yet be set.");
- is(requestItem.attachment.eventTimings, undefined,
- "The eventTimings should not yet be set.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:RequestHeaders", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.requestHeaders,
- "There should be a requestHeaders attachment available.");
- ok(requestItem.attachment.requestHeaders.headers.length >= 6,
- "The requestHeaders attachment has an incorrect |headers| property.");
- // Can't test for an exact total number of headers, because it seems to
- // vary across pgo/non-pgo builds.
- isnot(requestItem.attachment.requestHeaders.headersSize, 0,
- "The requestHeaders attachment has an incorrect |headersSize| property.");
- // Can't test for the exact request headers size because the value may
- // vary across platforms ("User-Agent" header differs).
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:RequestCookies", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.requestCookies,
- "There should be a requestCookies attachment available.");
- is(requestItem.attachment.requestCookies.cookies.length, 0,
- "The requestCookies attachment has an incorrect |cookies| property.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:RequestPostData", () => {
- ok(false, "Trap listener: this request doesn't have any post data.")
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:ResponseHeaders", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.responseHeaders,
- "There should be a responseHeaders attachment available.");
- is(requestItem.attachment.responseHeaders.headers.length, 6,
- "The responseHeaders attachment has an incorrect |headers| property.");
- is(requestItem.attachment.responseHeaders.headersSize, 173,
- "The responseHeaders attachment has an incorrect |headersSize| property.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:ResponseCookies", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.responseCookies,
- "There should be a responseCookies attachment available.");
- is(requestItem.attachment.responseCookies.cookies.length, 0,
- "The responseCookies attachment has an incorrect |cookies| property.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS);
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdating:ResponseStart", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- is(requestItem.attachment.httpVersion, "HTTP/1.1",
- "The httpVersion attachment has an incorrect value.");
- is(requestItem.attachment.status, "200",
- "The status attachment has an incorrect value.");
- is(requestItem.attachment.statusText, "Och Aye",
- "The statusText attachment has an incorrect value.");
- is(requestItem.attachment.headersSize, 173,
- "The headersSize attachment has an incorrect value.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
- status: "200",
- statusText: "Och Aye"
- });
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdating:ResponseContent", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- is(requestItem.attachment.contentSize, "12",
- "The contentSize attachment has an incorrect value.");
- is(requestItem.attachment.mimeType, "text/plain; charset=utf-8",
- "The mimeType attachment has an incorrect value.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- });
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:ResponseContent", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.responseContent,
- "There should be a responseContent attachment available.");
- is(requestItem.attachment.responseContent.content.mimeType, "text/plain; charset=utf-8",
- "The responseContent attachment has an incorrect |content.mimeType| property.");
- is(requestItem.attachment.responseContent.content.text, "Hello world!",
- "The responseContent attachment has an incorrect |content.text| property.");
- is(requestItem.attachment.responseContent.content.size, 12,
- "The responseContent attachment has an incorrect |content.size| property.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- });
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdating:EventTimings", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- is(typeof requestItem.attachment.totalTime, "number",
- "The attached totalTime is incorrect.");
- ok(requestItem.attachment.totalTime >= 0,
- "The attached totalTime should be positive.");
-
- is(typeof requestItem.attachment.endedMillis, "number",
- "The attached endedMillis is incorrect.");
- ok(requestItem.attachment.endedMillis >= 0,
- "The attached endedMillis should be positive.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
- time: true
- });
- });
-
- aMonitor.panelWin.once("NetMonitor:NetworkEventUpdated:EventTimings", () => {
- let requestItem = RequestsMenu.getItemAtIndex(0);
-
- ok(requestItem.attachment.eventTimings,
- "There should be a eventTimings attachment available.");
- is(typeof requestItem.attachment.eventTimings.timings.blocked, "number",
- "The eventTimings attachment has an incorrect |timings.blocked| property.");
- is(typeof requestItem.attachment.eventTimings.timings.dns, "number",
- "The eventTimings attachment has an incorrect |timings.dns| property.");
- is(typeof requestItem.attachment.eventTimings.timings.connect, "number",
- "The eventTimings attachment has an incorrect |timings.connect| property.");
- is(typeof requestItem.attachment.eventTimings.timings.send, "number",
- "The eventTimings attachment has an incorrect |timings.send| property.");
- is(typeof requestItem.attachment.eventTimings.timings.wait, "number",
- "The eventTimings attachment has an incorrect |timings.wait| property.");
- is(typeof requestItem.attachment.eventTimings.timings.receive, "number",
- "The eventTimings attachment has an incorrect |timings.receive| property.");
- is(typeof requestItem.attachment.eventTimings.totalTime, "number",
- "The eventTimings attachment has an incorrect |totalTime| property.");
-
- verifyRequestItemTarget(requestItem, "GET", SIMPLE_SJS, {
- time: true
- });
- });
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_simple-request-details.js b/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
deleted file mode 100644
index c43afb222..000000000
--- a/browser/devtools/netmonitor/test/browser_net_simple-request-details.js
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if requests render correct information in the details UI.
- */
-
-function test() {
- initNetMonitor(SIMPLE_SJS).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, SourceEditor, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu, NetworkDetails } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- is(RequestsMenu.selectedItem, null,
- "There shouldn't be any selected item in the requests menu.");
- is(RequestsMenu.itemCount, 1,
- "The requests menu should not be empty after the first request.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should still be hidden after the first request.");
-
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.getElementById("details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testHeadersTab();
- testCookiesTab();
- testParamsTab();
- testResponseTab()
- .then(() => {
- testTimingsTab();
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testHeadersTab() {
- let tab = document.querySelectorAll("#details-pane tab")[0];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[0];
-
- is(tab.getAttribute("selected"), "true",
- "The headers tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#headers-summary-url-value").getAttribute("value"),
- SIMPLE_SJS, "The url summary value is incorrect.");
- is(tabpanel.querySelector("#headers-summary-url-value").getAttribute("tooltiptext"),
- SIMPLE_SJS, "The url summary tooltiptext is incorrect.");
- is(tabpanel.querySelector("#headers-summary-method-value").getAttribute("value"),
- "GET", "The method summary value is incorrect.");
- is(tabpanel.querySelector("#headers-summary-status-circle").getAttribute("code"),
- "200", "The status summary code is incorrect.");
- is(tabpanel.querySelector("#headers-summary-status-value").getAttribute("value"),
- "200 Och Aye", "The status summary value is incorrect.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 2,
- "There should be 2 header scopes displayed in this tabpanel.");
- ok(tabpanel.querySelectorAll(".variable-or-property").length >= 12,
- "There should be at least 12 header values displayed in this tabpanel.");
- // Can't test for an exact total number of headers, because it seems to
- // vary across pgo/non-pgo builds.
-
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let responseScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
- let requestScope = tabpanel.querySelectorAll(".variables-view-scope")[1];
-
- is(responseScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("responseHeaders") + " (" +
- L10N.getFormatStr("networkMenu.sizeKB", L10N.numberWithDecimals(173/1024, 3)) + ")",
- "The response headers scope doesn't have the correct title.");
-
- ok(requestScope.querySelector(".name").getAttribute("value").contains(
- L10N.getStr("requestHeaders") + " (0"),
- "The request headers scope doesn't have the correct title.");
- // Can't test for full request headers title because the size may
- // vary across platforms ("User-Agent" header differs). We're pretty
- // sure it's smaller than 1 MB though, so it starts with a 0.
-
- is(responseScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "Connection", "The first response header name was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- "\"close\"", "The first response header value was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
- "Content-Length", "The second response header name was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
- "\"12\"", "The second response header value was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .name")[2].getAttribute("value"),
- "Content-Type", "The third response header name was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .value")[2].getAttribute("value"),
- "\"text/plain; charset=utf-8\"", "The third response header value was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .name")[5].getAttribute("value"),
- "foo-bar", "The last response header name was incorrect.");
- is(responseScope.querySelectorAll(".variables-view-variable .value")[5].getAttribute("value"),
- "\"baz\"", "The last response header value was incorrect.");
-
- is(requestScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "Host", "The first request header name was incorrect.");
- is(requestScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- "\"example.com\"", "The first request header value was incorrect.");
- is(requestScope.querySelectorAll(".variables-view-variable .name")[5].getAttribute("value"),
- "Connection", "The penultimate request header name was incorrect.");
- is(requestScope.querySelectorAll(".variables-view-variable .value")[5].getAttribute("value"),
- "\"keep-alive\"", "The penultimate request header value was incorrect.");
-
- let lastReqHeaderName = requestScope.querySelectorAll(".variables-view-variable .name")[6];
- let lastReqHeaderValue = requestScope.querySelectorAll(".variables-view-variable .value")[6];
- if (lastReqHeaderName && lastReqHeaderValue) {
- is(lastReqHeaderName.getAttribute("value"),
- "Cache-Control", "The last request header name was incorrect.");
- is(lastReqHeaderValue.getAttribute("value"),
- "\"max-age=0\"", "The last request header value was incorrect.");
- } else {
- info("The number of request headers was 6 instead of 7. Technically, " +
- "not a failure in this particular test, but needs investigation.");
- }
- }
-
- function testCookiesTab() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[1]);
-
- let tab = document.querySelectorAll("#details-pane tab")[1];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[1];
-
- is(tab.getAttribute("selected"), "true",
- "The cookies tab in the network details pane should be selected.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 0,
- "There should be no cookie scopes displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variable-or-property").length, 0,
- "There should be no cookie values displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 1,
- "The empty notice should be displayed in this tabpanel.");
- }
-
- function testParamsTab() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[2]);
-
- let tab = document.querySelectorAll("#details-pane tab")[2];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
-
- is(tab.getAttribute("selected"), "true",
- "The params tab in the network details pane should be selected.");
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 0,
- "There should be no param scopes displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variable-or-property").length, 0,
- "There should be no param values displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 1,
- "The empty notice should be displayed in this tabpanel.");
-
- is(tabpanel.querySelector("#request-params-box")
- .hasAttribute("hidden"), false,
- "The request params box should not be hidden.");
- is(tabpanel.querySelector("#request-post-data-textarea-box")
- .hasAttribute("hidden"), true,
- "The request post data textarea box should be hidden.");
- }
-
- function testResponseTab() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[3]);
-
- let tab = document.querySelectorAll("#details-pane tab")[3];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[3];
-
- is(tab.getAttribute("selected"), "true",
- "The response tab in the network details pane should be selected.");
-
- is(tabpanel.querySelector("#response-content-info-header")
- .hasAttribute("hidden"), true,
- "The response info header should be hidden.");
- is(tabpanel.querySelector("#response-content-json-box")
- .hasAttribute("hidden"), true,
- "The response content json box should be hidden.");
- is(tabpanel.querySelector("#response-content-textarea-box")
- .hasAttribute("hidden"), false,
- "The response content textarea box should not be hidden.");
- is(tabpanel.querySelector("#response-content-image-box")
- .hasAttribute("hidden"), true,
- "The response content image box should be hidden.");
-
- return NetMonitorView.editor("#response-content-textarea").then((aEditor) => {
- is(aEditor.getText(), "Hello world!",
- "The text shown in the source editor is incorrect.");
- is(aEditor.getMode(), SourceEditor.MODES.TEXT,
- "The mode active in the source editor is incorrect.");
- });
- }
-
- function testTimingsTab() {
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[4]);
-
- let tab = document.querySelectorAll("#details-pane tab")[4];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[4];
-
- is(tab.getAttribute("selected"), "true",
- "The timings tab in the network details pane should be selected.");
-
- ok(tabpanel.querySelector("#timings-summary-blocked .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The blocked timing info does not appear to be correct.");
-
- ok(tabpanel.querySelector("#timings-summary-dns .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The dns timing info does not appear to be correct.");
-
- ok(tabpanel.querySelector("#timings-summary-connect .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The connect timing info does not appear to be correct.");
-
- ok(tabpanel.querySelector("#timings-summary-send .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The send timing info does not appear to be correct.");
-
- ok(tabpanel.querySelector("#timings-summary-wait .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The wait timing info does not appear to be correct.");
-
- ok(tabpanel.querySelector("#timings-summary-receive .requests-menu-timings-total")
- .getAttribute("value").match(/[0-9]+/),
- "The receive timing info does not appear to be correct.");
- }
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_simple-request.js b/browser/devtools/netmonitor/test/browser_net_simple-request.js
deleted file mode 100644
index 2544faf6b..000000000
--- a/browser/devtools/netmonitor/test/browser_net_simple-request.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if requests are handled correctly.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), true,
- "The pane toggle button should be disabled when the frontend is opened.");
- is(document.querySelector("#requests-menu-empty-notice")
- .hasAttribute("hidden"), false,
- "An empty notice should be displayed when the frontend is opened.");
- is(RequestsMenu.itemCount, 0,
- "The requests menu should be empty when the frontend is opened.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should be hidden when the frontend is opened.");
-
- aMonitor.panelWin.once("NetMonitor:NetworkEvent", () => {
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), false,
- "The pane toggle button should be enabled after the first request.");
- is(document.querySelector("#requests-menu-empty-notice")
- .hasAttribute("hidden"), true,
- "The empty notice should be hidden after the first request.");
- is(RequestsMenu.itemCount, 1,
- "The requests menu should not be empty after the first request.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should still be hidden after the first request.");
-
- aMonitor.panelWin.once("NetMonitor:NetworkEvent", () => {
- is(document.querySelector("#details-pane-toggle")
- .hasAttribute("disabled"), false,
- "The pane toggle button should be still be enabled after a reload.");
- is(document.querySelector("#requests-menu-empty-notice")
- .hasAttribute("hidden"), true,
- "The empty notice should be still hidden after a reload.");
- is(RequestsMenu.itemCount, 1,
- "The requests menu should not be empty after a reload.");
- is(NetMonitorView.detailsPaneHidden, true,
- "The details pane should still be hidden after a reload.");
-
- teardown(aMonitor).then(finish);
- });
-
- aDebuggee.location.reload();
- });
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_sort-01.js b/browser/devtools/netmonitor/test/browser_net_sort-01.js
deleted file mode 100644
index a57a5326d..000000000
--- a/browser/devtools/netmonitor/test/browser_net_sort-01.js
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if the sorting mechanism works correctly.
- */
-
-function test() {
- initNetMonitor(STATUS_CODES_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 5).then(() => {
- testContents([0, 1, 2, 3, 4])
- .then(() => {
- info("Testing swap(0, 0)");
- RequestsMenu.swapItemsAtIndices(0, 0);
- RequestsMenu.refreshZebra();
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing swap(0, 1)");
- RequestsMenu.swapItemsAtIndices(0, 1);
- RequestsMenu.refreshZebra();
- return testContents([1, 0, 2, 3, 4]);
- })
- .then(() => {
- info("Testing swap(0, 2)");
- RequestsMenu.swapItemsAtIndices(0, 2);
- RequestsMenu.refreshZebra();
- return testContents([1, 2, 0, 3, 4]);
- })
- .then(() => {
- info("Testing swap(0, 3)");
- RequestsMenu.swapItemsAtIndices(0, 3);
- RequestsMenu.refreshZebra();
- return testContents([1, 2, 3, 0, 4]);
- })
- .then(() => {
- info("Testing swap(0, 4)");
- RequestsMenu.swapItemsAtIndices(0, 4);
- RequestsMenu.refreshZebra();
- return testContents([1, 2, 3, 4, 0]);
- })
- .then(() => {
- info("Testing swap(1, 0)");
- RequestsMenu.swapItemsAtIndices(1, 0);
- RequestsMenu.refreshZebra();
- return testContents([0, 2, 3, 4, 1]);
- })
- .then(() => {
- info("Testing swap(1, 1)");
- RequestsMenu.swapItemsAtIndices(1, 1);
- RequestsMenu.refreshZebra();
- return testContents([0, 2, 3, 4, 1]);
- })
- .then(() => {
- info("Testing swap(1, 2)");
- RequestsMenu.swapItemsAtIndices(1, 2);
- RequestsMenu.refreshZebra();
- return testContents([0, 1, 3, 4, 2]);
- })
- .then(() => {
- info("Testing swap(1, 3)");
- RequestsMenu.swapItemsAtIndices(1, 3);
- RequestsMenu.refreshZebra();
- return testContents([0, 3, 1, 4, 2]);
- })
- .then(() => {
- info("Testing swap(1, 4)");
- RequestsMenu.swapItemsAtIndices(1, 4);
- RequestsMenu.refreshZebra();
- return testContents([0, 3, 4, 1, 2]);
- })
- .then(() => {
- info("Testing swap(2, 0)");
- RequestsMenu.swapItemsAtIndices(2, 0);
- RequestsMenu.refreshZebra();
- return testContents([2, 3, 4, 1, 0]);
- })
- .then(() => {
- info("Testing swap(2, 1)");
- RequestsMenu.swapItemsAtIndices(2, 1);
- RequestsMenu.refreshZebra();
- return testContents([1, 3, 4, 2, 0]);
- })
- .then(() => {
- info("Testing swap(2, 2)");
- RequestsMenu.swapItemsAtIndices(2, 2);
- RequestsMenu.refreshZebra();
- return testContents([1, 3, 4, 2, 0]);
- })
- .then(() => {
- info("Testing swap(2, 3)");
- RequestsMenu.swapItemsAtIndices(2, 3);
- RequestsMenu.refreshZebra();
- return testContents([1, 2, 4, 3, 0]);
- })
- .then(() => {
- info("Testing swap(2, 4)");
- RequestsMenu.swapItemsAtIndices(2, 4);
- RequestsMenu.refreshZebra();
- return testContents([1, 4, 2, 3, 0]);
- })
- .then(() => {
- info("Testing swap(3, 0)");
- RequestsMenu.swapItemsAtIndices(3, 0);
- RequestsMenu.refreshZebra();
- return testContents([1, 4, 2, 0, 3]);
- })
- .then(() => {
- info("Testing swap(3, 1)");
- RequestsMenu.swapItemsAtIndices(3, 1);
- RequestsMenu.refreshZebra();
- return testContents([3, 4, 2, 0, 1]);
- })
- .then(() => {
- info("Testing swap(3, 2)");
- RequestsMenu.swapItemsAtIndices(3, 2);
- RequestsMenu.refreshZebra();
- return testContents([2, 4, 3, 0, 1]);
- })
- .then(() => {
- info("Testing swap(3, 3)");
- RequestsMenu.swapItemsAtIndices(3, 3);
- RequestsMenu.refreshZebra();
- return testContents([2, 4, 3, 0, 1]);
- })
- .then(() => {
- info("Testing swap(3, 4)");
- RequestsMenu.swapItemsAtIndices(3, 4);
- RequestsMenu.refreshZebra();
- return testContents([2, 3, 4, 0, 1]);
- })
- .then(() => {
- info("Testing swap(4, 0)");
- RequestsMenu.swapItemsAtIndices(4, 0);
- RequestsMenu.refreshZebra();
- return testContents([2, 3, 0, 4, 1]);
- })
- .then(() => {
- info("Testing swap(4, 1)");
- RequestsMenu.swapItemsAtIndices(4, 1);
- RequestsMenu.refreshZebra();
- return testContents([2, 3, 0, 1, 4]);
- })
- .then(() => {
- info("Testing swap(4, 2)");
- RequestsMenu.swapItemsAtIndices(4, 2);
- RequestsMenu.refreshZebra();
- return testContents([4, 3, 0, 1, 2]);
- })
- .then(() => {
- info("Testing swap(4, 3)");
- RequestsMenu.swapItemsAtIndices(4, 3);
- RequestsMenu.refreshZebra();
- return testContents([3, 4, 0, 1, 2]);
- })
- .then(() => {
- info("Testing swap(4, 4)");
- RequestsMenu.swapItemsAtIndices(4, 4);
- RequestsMenu.refreshZebra();
- return testContents([3, 4, 0, 1, 2]);
- })
- .then(() => {
- info("Clearing sort.");
- RequestsMenu.sortBy();
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testContents([a, b, c, d, e]) {
- is(RequestsMenu.orderedItems.length, 5,
- "There should be a total of 5 items in the requests menu.");
- is(RequestsMenu.visibleItems.length, 5,
- "There should be a total of 5 visbile items in the requests menu.");
-
- is(RequestsMenu.getItemAtIndex(0), RequestsMenu.orderedItems[0],
- "The requests menu items aren't ordered correctly. First item is misplaced.");
- is(RequestsMenu.getItemAtIndex(1), RequestsMenu.orderedItems[1],
- "The requests menu items aren't ordered correctly. Second item is misplaced.");
- is(RequestsMenu.getItemAtIndex(2), RequestsMenu.orderedItems[2],
- "The requests menu items aren't ordered correctly. Third item is misplaced.");
- is(RequestsMenu.getItemAtIndex(3), RequestsMenu.orderedItems[3],
- "The requests menu items aren't ordered correctly. Fourth item is misplaced.");
- is(RequestsMenu.getItemAtIndex(4), RequestsMenu.orderedItems[4],
- "The requests menu items aren't ordered correctly. Fifth item is misplaced.");
-
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(a),
- "GET", STATUS_CODES_SJS + "?sts=100", {
- status: 101,
- statusText: "Switching Protocols",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(b),
- "GET", STATUS_CODES_SJS + "?sts=200", {
- status: 202,
- statusText: "Created",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(c),
- "GET", STATUS_CODES_SJS + "?sts=300", {
- status: 303,
- statusText: "See Other",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(d),
- "GET", STATUS_CODES_SJS + "?sts=400", {
- status: 404,
- statusText: "Not Found",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(e),
- "GET", STATUS_CODES_SJS + "?sts=500", {
- status: 501,
- statusText: "Not Implemented",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
-
- return Promise.resolve(null);
- }
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_sort-02.js b/browser/devtools/netmonitor/test/browser_net_sort-02.js
deleted file mode 100644
index b2e9cfe46..000000000
--- a/browser/devtools/netmonitor/test/browser_net_sort-02.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if sorting columns in the network table works correctly.
- */
-
-function test() {
- initNetMonitor(SORTING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- // It seems that this test may be slow on debug builds. This could be because
- // of the heavy dom manipulation associated with sorting.
- requestLongerTimeout(2);
-
- let { $, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 5).then(() => {
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testHeaders();
- testContents([0, 2, 4, 3, 1])
- .then(() => {
- info("Testing status sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-status-button"));
- testHeaders("status", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing status sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-status-button"));
- testHeaders("status", "descending");
- return testContents([4, 3, 2, 1, 0]);
- })
- .then(() => {
- info("Testing status sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-status-button"));
- testHeaders("status", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing method sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-method-button"));
- testHeaders("method", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing method sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-method-button"));
- testHeaders("method", "descending");
- return testContents([4, 3, 2, 1, 0]);
- })
- .then(() => {
- info("Testing method sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-method-button"));
- testHeaders("method", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing file sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-file-button"));
- testHeaders("file", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing file sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-file-button"));
- testHeaders("file", "descending");
- return testContents([4, 3, 2, 1, 0]);
- })
- .then(() => {
- info("Testing file sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-file-button"));
- testHeaders("file", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing type sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-type-button"));
- testHeaders("type", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing type sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-type-button"));
- testHeaders("type", "descending");
- return testContents([4, 3, 2, 1, 0]);
- })
- .then(() => {
- info("Testing type sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-type-button"));
- testHeaders("type", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing size sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
- testHeaders("size", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing size sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
- testHeaders("size", "descending");
- return testContents([4, 3, 2, 1, 0]);
- })
- .then(() => {
- info("Testing size sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-size-button"));
- testHeaders("size", "ascending");
- return testContents([0, 1, 2, 3, 4]);
- })
- .then(() => {
- info("Testing waterfall sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-waterfall-button"));
- testHeaders("waterfall", "ascending");
- return testContents([0, 2, 4, 3, 1]);
- })
- .then(() => {
- info("Testing waterfall sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-waterfall-button"));
- testHeaders("waterfall", "descending");
- return testContents([4, 2, 0, 1, 3]);
- })
- .then(() => {
- info("Testing waterfall sort, ascending. Checking sort loops correctly.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-waterfall-button"));
- testHeaders("waterfall", "ascending");
- return testContents([0, 2, 4, 3, 1]);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testHeaders(aSortType, aDirection) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-" + aSortType + "-button");
- let headers = doc.querySelectorAll(".requests-menu-header-button");
-
- for (let header of headers) {
- if (header != target) {
- is(header.hasAttribute("sorted"), false,
- "The " + header.id + " header should not have a 'sorted' attribute.");
- is(header.hasAttribute("tooltiptext"), false,
- "The " + header.id + " header should not have a 'tooltiptext' attribute.");
- } else {
- is(header.getAttribute("sorted"), aDirection,
- "The " + header.id + " header has an incorrect 'sorted' attribute.");
- is(header.getAttribute("tooltiptext"), aDirection == "ascending"
- ? L10N.getStr("networkMenu.sortedAsc")
- : L10N.getStr("networkMenu.sortedDesc"),
- "The " + header.id + " has an incorrect 'tooltiptext' attribute.");
- }
- }
- }
-
- function testContents([a, b, c, d, e]) {
- isnot(RequestsMenu.selectedItem, null,
- "There should still be a selected item after sorting.");
- is(RequestsMenu.selectedIndex, a,
- "The first item should be still selected after sorting.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should still be visible after sorting.");
-
- is(RequestsMenu.orderedItems.length, 5,
- "There should be a total of 5 items in the requests menu.");
- is(RequestsMenu.visibleItems.length, 5,
- "There should be a total of 5 visbile items in the requests menu.");
-
- is(RequestsMenu.getItemAtIndex(0), RequestsMenu.orderedItems[0],
- "The requests menu items aren't ordered correctly. First item is misplaced.");
- is(RequestsMenu.getItemAtIndex(1), RequestsMenu.orderedItems[1],
- "The requests menu items aren't ordered correctly. Second item is misplaced.");
- is(RequestsMenu.getItemAtIndex(2), RequestsMenu.orderedItems[2],
- "The requests menu items aren't ordered correctly. Third item is misplaced.");
- is(RequestsMenu.getItemAtIndex(3), RequestsMenu.orderedItems[3],
- "The requests menu items aren't ordered correctly. Fourth item is misplaced.");
- is(RequestsMenu.getItemAtIndex(4), RequestsMenu.orderedItems[4],
- "The requests menu items aren't ordered correctly. Fifth item is misplaced.");
-
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(a),
- "GET1", SORTING_SJS + "?index=1", {
- fuzzyUrl: true,
- status: 101,
- statusText: "Meh",
- type: "1",
- fullMimeType: "text/1",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(b),
- "GET2", SORTING_SJS + "?index=2", {
- fuzzyUrl: true,
- status: 200,
- statusText: "Meh",
- type: "2",
- fullMimeType: "text/2",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(c),
- "GET3", SORTING_SJS + "?index=3", {
- fuzzyUrl: true,
- status: 300,
- statusText: "Meh",
- type: "3",
- fullMimeType: "text/3",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(d),
- "GET4", SORTING_SJS + "?index=4", {
- fuzzyUrl: true,
- status: 400,
- statusText: "Meh",
- type: "4",
- fullMimeType: "text/4",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
- time: true
- });
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(e),
- "GET5", SORTING_SJS + "?index=5", {
- fuzzyUrl: true,
- status: 500,
- statusText: "Meh",
- type: "5",
- fullMimeType: "text/5",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
- time: true
- });
-
- return Promise.resolve(null);
- }
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_sort-03.js b/browser/devtools/netmonitor/test/browser_net_sort-03.js
deleted file mode 100644
index c6f9214bc..000000000
--- a/browser/devtools/netmonitor/test/browser_net_sort-03.js
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test if sorting columns in the network table works correctly with new requests.
- */
-
-function test() {
- initNetMonitor(SORTING_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- // It seems that this test may be slow on debug builds. This could be because
- // of the heavy dom manipulation associated with sorting.
- requestLongerTimeout(2);
-
- let { $, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- waitForNetworkEvents(aMonitor, 5).then(() => {
- EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
-
- isnot(RequestsMenu.selectedItem, null,
- "There should be a selected item in the requests menu.");
- is(RequestsMenu.selectedIndex, 0,
- "The first item should be selected in the requests menu.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should not be hidden after toggle button was pressed.");
-
- testHeaders();
- testContents([0, 2, 4, 3, 1], 0)
- .then(() => {
- info("Testing status sort, ascending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-status-button"));
- testHeaders("status", "ascending");
- return testContents([0, 1, 2, 3, 4], 0);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests();
- return waitForNetworkEvents(aMonitor, 5);
- })
- .then(() => {
- info("Testing status sort again, ascending.");
- testHeaders("status", "ascending");
- return testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0);
- })
- .then(() => {
- info("Testing status sort, descending.");
- EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-status-button"));
- testHeaders("status", "descending");
- return testContents([9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 9);
- })
- .then(() => {
- info("Performing more requests.");
- aDebuggee.performRequests();
- return waitForNetworkEvents(aMonitor, 5);
- })
- .then(() => {
- info("Testing status sort again, descending.");
- testHeaders("status", "descending");
- return testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 12);
- })
- .then(() => {
- return teardown(aMonitor);
- })
- .then(finish);
- });
-
- function testHeaders(aSortType, aDirection) {
- let doc = aMonitor.panelWin.document;
- let target = doc.querySelector("#requests-menu-" + aSortType + "-button");
- let headers = doc.querySelectorAll(".requests-menu-header-button");
-
- for (let header of headers) {
- if (header != target) {
- is(header.hasAttribute("sorted"), false,
- "The " + header.id + " header should not have a 'sorted' attribute.");
- is(header.hasAttribute("tooltiptext"), false,
- "The " + header.id + " header should not have a 'tooltiptext' attribute.");
- } else {
- is(header.getAttribute("sorted"), aDirection,
- "The " + header.id + " header has an incorrect 'sorted' attribute.");
- is(header.getAttribute("tooltiptext"), aDirection == "ascending"
- ? L10N.getStr("networkMenu.sortedAsc")
- : L10N.getStr("networkMenu.sortedDesc"),
- "The " + header.id + " has an incorrect 'tooltiptext' attribute.");
- }
- }
- }
-
- function testContents(aOrder, aSelection) {
- isnot(RequestsMenu.selectedItem, null,
- "There should still be a selected item after sorting.");
- is(RequestsMenu.selectedIndex, aSelection,
- "The first item should be still selected after sorting.");
- is(NetMonitorView.detailsPaneHidden, false,
- "The details pane should still be visible after sorting.");
-
- is(RequestsMenu.orderedItems.length, aOrder.length,
- "There should be a specific number of items in the requests menu.");
- is(RequestsMenu.visibleItems.length, aOrder.length,
- "There should be a specific number of visbile items in the requests menu.");
-
- for (let i = 0; i < aOrder.length; i++) {
- is(RequestsMenu.getItemAtIndex(i), RequestsMenu.orderedItems[i],
- "The requests menu items aren't ordered correctly. Misplaced item " + i + ".");
- }
-
- for (let i = 0, len = aOrder.length / 5; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i]),
- "GET1", SORTING_SJS + "?index=1", {
- fuzzyUrl: true,
- status: 101,
- statusText: "Meh",
- type: "1",
- fullMimeType: "text/1",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- }
- for (let i = 0, len = aOrder.length / 5; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len]),
- "GET2", SORTING_SJS + "?index=2", {
- fuzzyUrl: true,
- status: 200,
- statusText: "Meh",
- type: "2",
- fullMimeType: "text/2",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.01),
- time: true
- });
- }
- for (let i = 0, len = aOrder.length / 5; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 2]),
- "GET3", SORTING_SJS + "?index=3", {
- fuzzyUrl: true,
- status: 300,
- statusText: "Meh",
- type: "3",
- fullMimeType: "text/3",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- }
- for (let i = 0, len = aOrder.length / 5; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 3]),
- "GET4", SORTING_SJS + "?index=4", {
- fuzzyUrl: true,
- status: 400,
- statusText: "Meh",
- type: "4",
- fullMimeType: "text/4",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.03),
- time: true
- });
- }
- for (let i = 0, len = aOrder.length / 5; i < len; i++) {
- verifyRequestItemTarget(RequestsMenu.getItemAtIndex(aOrder[i + len * 4]),
- "GET5", SORTING_SJS + "?index=5", {
- fuzzyUrl: true,
- status: 500,
- statusText: "Meh",
- type: "5",
- fullMimeType: "text/5",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.04),
- time: true
- });
- }
-
- return Promise.resolve(null);
- }
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_status-codes.js b/browser/devtools/netmonitor/test/browser_net_status-codes.js
deleted file mode 100644
index 0e62f8071..000000000
--- a/browser/devtools/netmonitor/test/browser_net_status-codes.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if requests display the correct status code and text in the UI.
- */
-
-function test() {
- initNetMonitor(STATUS_CODES_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu, NetworkDetails } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
- NetworkDetails._params.lazyEmpty = false;
-
- waitForNetworkEvents(aMonitor, 5).then(() => {
- let requestItems = [];
-
- verifyRequestItemTarget(requestItems[0] = RequestsMenu.getItemAtIndex(0),
- "GET", STATUS_CODES_SJS + "?sts=100", {
- status: 101,
- statusText: "Switching Protocols",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- verifyRequestItemTarget(requestItems[1] = RequestsMenu.getItemAtIndex(1),
- "GET", STATUS_CODES_SJS + "?sts=200", {
- status: 202,
- statusText: "Created",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(requestItems[2] = RequestsMenu.getItemAtIndex(2),
- "GET", STATUS_CODES_SJS + "?sts=300", {
- status: 303,
- statusText: "See Other",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0),
- time: true
- });
- verifyRequestItemTarget(requestItems[3] = RequestsMenu.getItemAtIndex(3),
- "GET", STATUS_CODES_SJS + "?sts=400", {
- status: 404,
- statusText: "Not Found",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
- verifyRequestItemTarget(requestItems[4] = RequestsMenu.getItemAtIndex(4),
- "GET", STATUS_CODES_SJS + "?sts=500", {
- status: 501,
- statusText: "Not Implemented",
- type: "plain",
- fullMimeType: "text/plain; charset=utf-8",
- size: L10N.getFormatStrWithNumbers("networkMenu.sizeKB", 0.02),
- time: true
- });
-
- // Test summaries...
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[0]);
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[0].target);
- testSummary("GET", STATUS_CODES_SJS + "?sts=100", "101", "Switching Protocols");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[1].target);
- testSummary("GET", STATUS_CODES_SJS + "?sts=200", "202", "Created");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[2].target);
- testSummary("GET", STATUS_CODES_SJS + "?sts=300", "303", "See Other");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[3].target);
- testSummary("GET", STATUS_CODES_SJS + "?sts=400", "404", "Not Found");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[4].target);
- testSummary("GET", STATUS_CODES_SJS + "?sts=500", "501", "Not Implemented");
-
- // Test params...
- EventUtils.sendMouseEvent({ type: "mousedown" },
- document.querySelectorAll("#details-pane tab")[2]);
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[0].target);
- testParamsTab("\"100\"");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[1].target);
- testParamsTab("\"200\"");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[2].target);
- testParamsTab("\"300\"");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[3].target);
- testParamsTab("\"400\"");
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[4].target);
- testParamsTab("\"500\"");
-
- // We're done here.
- teardown(aMonitor).then(finish);
-
- function testSummary(aMethod, aUrl, aStatus, aStatusText) {
- let tab = document.querySelectorAll("#details-pane tab")[0];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[0];
-
- is(tabpanel.querySelector("#headers-summary-url-value").getAttribute("value"),
- aUrl, "The url summary value is incorrect.");
- is(tabpanel.querySelector("#headers-summary-method-value").getAttribute("value"),
- aMethod, "The method summary value is incorrect.");
- is(tabpanel.querySelector("#headers-summary-status-circle").getAttribute("code"),
- aStatus, "The status summary code is incorrect.");
- is(tabpanel.querySelector("#headers-summary-status-value").getAttribute("value"),
- aStatus + " " + aStatusText, "The status summary value is incorrect.");
- }
-
- function testParamsTab(aStatusParamValue) {
- let tab = document.querySelectorAll("#details-pane tab")[2];
- let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
-
- is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
- "There should be 1 param scope displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variable-or-property").length, 1,
- "There should be 1 param value displayed in this tabpanel.");
- is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
- "The empty notice should not be displayed in this tabpanel.");
-
- let paramsScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
-
- is(paramsScope.querySelector(".name").getAttribute("value"),
- L10N.getStr("paramsQueryString"),
- "The params scope doesn't have the correct title.");
-
- is(paramsScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
- "sts", "The param name was incorrect.");
- is(paramsScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
- aStatusParamValue, "The param value was incorrect.");
-
- is(tabpanel.querySelector("#request-params-box")
- .hasAttribute("hidden"), false,
- "The request params box should not be hidden.");
- is(tabpanel.querySelector("#request-post-data-textarea-box")
- .hasAttribute("hidden"), true,
- "The request post data textarea box should be hidden.");
- }
- });
-
- aDebuggee.performRequests();
- });
-}
diff --git a/browser/devtools/netmonitor/test/browser_net_timeline_ticks.js b/browser/devtools/netmonitor/test/browser_net_timeline_ticks.js
deleted file mode 100644
index a56bff992..000000000
--- a/browser/devtools/netmonitor/test/browser_net_timeline_ticks.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests if timeline correctly displays interval divisions.
- */
-
-function test() {
- initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
- info("Starting test... ");
-
- let { document, L10N, NetMonitorView } = aMonitor.panelWin;
- let { RequestsMenu } = NetMonitorView;
-
- RequestsMenu.lazyUpdate = false;
-
- ok(document.querySelector("#requests-menu-waterfall-label"),
- "An timeline label should be displayed when the frontend is opened.");
- ok(document.querySelectorAll(".requests-menu-timings-division").length == 0,
- "No tick labels should be displayed when the frontend is opened.");
-
- ok(!RequestsMenu._canvas,
- "No canvas should be created when the frontend is opened.");
- ok(!RequestsMenu._ctx,
- "No 2d context should be created when the frontend is opened.");
-
- waitForNetworkEvents(aMonitor, 1).then(() => {
- ok(!document.querySelector("#requests-menu-waterfall-label"),
- "The timeline label should be hidden after the first request.");
- ok(document.querySelectorAll(".requests-menu-timings-division").length >= 3,
- "There should be at least 3 tick labels in the network requests header.");
-
- is(document.querySelectorAll(".requests-menu-timings-division")[0]
- .getAttribute("value"), L10N.getFormatStr("networkMenu.divisionMS", 0),
- "The first tick label has an incorrect value");
- is(document.querySelectorAll(".requests-menu-timings-division")[1]
- .getAttribute("value"), L10N.getFormatStr("networkMenu.divisionMS", 80),
- "The second tick label has an incorrect value");
- is(document.querySelectorAll(".requests-menu-timings-division")[2]
- .getAttribute("value"), L10N.getFormatStr("networkMenu.divisionMS", 160),
- "The third tick label has an incorrect value");
-
- is(document.querySelectorAll(".requests-menu-timings-division")[0]
- .style.transform, "translateX(0px)",
- "The first tick label has an incorrect translation");
- is(document.querySelectorAll(".requests-menu-timings-division")[1]
- .style.transform, "translateX(80px)",
- "The second tick label has an incorrect translation");
- is(document.querySelectorAll(".requests-menu-timings-division")[2]
- .style.transform, "translateX(160px)",
- "The third tick label has an incorrect translation");
-
- ok(RequestsMenu._canvas,
- "A canvas should be created after the first request.");
- ok(RequestsMenu._ctx,
- "A 2d context should be created after the first request.");
-
- let imageData = RequestsMenu._ctx.getImageData(0, 0, 161, 1);
- ok(imageData, "The image data should have been created.");
-
- let data = imageData.data;
- ok(data, "The image data should contain a pixel array.");
-
- ok( hasPixelAt(0), "The tick at 0 is should not be empty.");
- ok(!hasPixelAt(1), "The tick at 1 is should be empty.");
- ok(!hasPixelAt(19), "The tick at 19 is should be empty.");
- ok( hasPixelAt(20), "The tick at 20 is should not be empty.");
- ok(!hasPixelAt(21), "The tick at 21 is should be empty.");
- ok(!hasPixelAt(39), "The tick at 39 is should be empty.");
- ok( hasPixelAt(40), "The tick at 40 is should not be empty.");
- ok(!hasPixelAt(41), "The tick at 41 is should be empty.");
- ok(!hasPixelAt(59), "The tick at 59 is should be empty.");
- ok( hasPixelAt(60), "The tick at 60 is should not be empty.");
- ok(!hasPixelAt(61), "The tick at 61 is should be empty.");
- ok(!hasPixelAt(79), "The tick at 79 is should be empty.");
- ok( hasPixelAt(80), "The tick at 80 is should not be empty.");
- ok(!hasPixelAt(81), "The tick at 81 is should be empty.");
- ok(!hasPixelAt(159), "The tick at 159 is should be empty.");
- ok( hasPixelAt(160), "The tick at 160 is should not be empty.");
- ok(!hasPixelAt(161), "The tick at 161 is should be empty.");
-
- ok(isPixelBrighterAtThan(0, 20),
- "The tick at 0 should be brighter than the one at 20");
- ok(isPixelBrighterAtThan(40, 20),
- "The tick at 40 should be brighter than the one at 20");
- ok(isPixelBrighterAtThan(40, 60),
- "The tick at 40 should be brighter than the one at 60");
- ok(isPixelBrighterAtThan(80, 60),
- "The tick at 80 should be brighter than the one at 60");
-
- ok(isPixelBrighterAtThan(80, 100),
- "The tick at 80 should be brighter than the one at 100");
- ok(isPixelBrighterAtThan(120, 100),
- "The tick at 120 should be brighter than the one at 100");
- ok(isPixelBrighterAtThan(120, 140),
- "The tick at 120 should be brighter than the one at 140");
- ok(isPixelBrighterAtThan(160, 140),
- "The tick at 160 should be brighter than the one at 140");
-
- ok(isPixelEquallyBright(20, 60),
- "The tick at 20 should be equally bright to the one at 60");
- ok(isPixelEquallyBright(100, 140),
- "The tick at 100 should be equally bright to the one at 140");
-
- ok(isPixelEquallyBright(40, 120),
- "The tick at 40 should be equally bright to the one at 120");
-
- ok(isPixelEquallyBright(0, 80),
- "The tick at 80 should be equally bright to the one at 160");
- ok(isPixelEquallyBright(80, 160),
- "The tick at 80 should be equally bright to the one at 160");
-
- function hasPixelAt(x) {
- let i = (x | 0) * 4;
- return data[i] && data[i + 1] && data[i + 2] && data[i + 3];
- }
-
- function isPixelBrighterAtThan(x1, x2) {
- let i = (x1 | 0) * 4;
- let j = (x2 | 0) * 4;
- return data[i + 3] > data [j + 3];
- }
-
- function isPixelEquallyBright(x1, x2) {
- let i = (x1 | 0) * 4;
- let j = (x2 | 0) * 4;
- return data[i + 3] == data [j + 3];
- }
-
- teardown(aMonitor).then(finish);
- });
-
- aDebuggee.location.reload();
- });
-}
diff --git a/browser/devtools/netmonitor/test/head.js b/browser/devtools/netmonitor/test/head.js
deleted file mode 100644
index dca1dc3cc..000000000
--- a/browser/devtools/netmonitor/test/head.js
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-
-let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
-let { Promise } = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
-let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-let Toolbox = devtools.Toolbox;
-
-const EXAMPLE_URL = "http://example.com/browser/browser/devtools/netmonitor/test/";
-
-const SIMPLE_URL = EXAMPLE_URL + "html_simple-test-page.html";
-const NAVIGATE_URL = EXAMPLE_URL + "html_navigate-test-page.html";
-const CONTENT_TYPE_URL = EXAMPLE_URL + "html_content-type-test-page.html";
-const CYRILLIC_URL = EXAMPLE_URL + "html_cyrillic-test-page.html";
-const STATUS_CODES_URL = EXAMPLE_URL + "html_status-codes-test-page.html";
-const POST_DATA_URL = EXAMPLE_URL + "html_post-data-test-page.html";
-const POST_RAW_URL = EXAMPLE_URL + "html_post-raw-test-page.html";
-const JSONP_URL = EXAMPLE_URL + "html_jsonp-test-page.html";
-const JSON_LONG_URL = EXAMPLE_URL + "html_json-long-test-page.html";
-const JSON_MALFORMED_URL = EXAMPLE_URL + "html_json-malformed-test-page.html";
-const SORTING_URL = EXAMPLE_URL + "html_sorting-test-page.html";
-const FILTERING_URL = EXAMPLE_URL + "html_filter-test-page.html";
-const INFINITE_GET_URL = EXAMPLE_URL + "html_infinite-get-page.html";
-const CUSTOM_GET_URL = EXAMPLE_URL + "html_custom-get-page.html";
-
-const SIMPLE_SJS = EXAMPLE_URL + "sjs_simple-test-server.sjs";
-const CONTENT_TYPE_SJS = EXAMPLE_URL + "sjs_content-type-test-server.sjs";
-const STATUS_CODES_SJS = EXAMPLE_URL + "sjs_status-codes-test-server.sjs";
-const SORTING_SJS = EXAMPLE_URL + "sjs_sorting-test-server.sjs";
-
-const TEST_IMAGE = EXAMPLE_URL + "test-image.png";
-
-// All tests are asynchronous.
-waitForExplicitFinish();
-
-// Enable logging for all the relevant tests.
-let gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
-Services.prefs.setBoolPref("devtools.debugger.log", true);
-
-registerCleanupFunction(() => {
- info("finish() was called, cleaning up...");
- Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
-});
-
-function addTab(aUrl, aWindow) {
- info("Adding tab: " + aUrl);
-
- let deferred = Promise.defer();
- let targetWindow = aWindow || window;
- let targetBrowser = targetWindow.gBrowser;
-
- targetWindow.focus();
- let tab = targetBrowser.selectedTab = targetBrowser.addTab(aUrl);
- let browser = tab.linkedBrowser;
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- deferred.resolve(tab);
- }, true);
-
- return deferred.promise;
-}
-
-function removeTab(aTab, aWindow) {
- info("Removing tab.");
-
- let targetWindow = aWindow || window;
- let targetBrowser = targetWindow.gBrowser;
-
- targetBrowser.removeTab(aTab);
-}
-
-function initNetMonitor(aUrl, aWindow) {
- info("Initializing a network monitor pane.");
-
- return addTab(aUrl).then((aTab) => {
- info("Net tab added successfully: " + aUrl);
-
- let deferred = Promise.defer();
- let debuggee = aTab.linkedBrowser.contentWindow.wrappedJSObject;
- let target = TargetFactory.forTab(aTab);
-
- gDevTools.showToolbox(target, "netmonitor").then((aToolbox) => {
- info("Netork monitor pane shown successfully.");
-
- let monitor = aToolbox.getCurrentPanel();
- deferred.resolve([aTab, debuggee, monitor]);
- });
-
- return deferred.promise;
- });
-}
-
-function restartNetMonitor(aMonitor, aNewUrl) {
- info("Restarting the specified network monitor.");
-
- let deferred = Promise.defer();
- let tab = aMonitor.target.tab;
- let url = aNewUrl || tab.linkedBrowser.contentWindow.wrappedJSObject.location.href;
-
- aMonitor.once("destroyed", () => initNetMonitor(url).then(deferred.resolve));
- removeTab(tab);
-
- return deferred.promise;
-}
-
-function teardown(aMonitor) {
- info("Destroying the specified network monitor.");
-
- let deferred = Promise.defer();
- let tab = aMonitor.target.tab;
-
- aMonitor.once("destroyed", () => executeSoon(deferred.resolve));
- removeTab(tab);
-
- return deferred.promise;
-}
-
-function waitForNetworkEvents(aMonitor, aGetRequests, aPostRequests = 0) {
- let deferred = Promise.defer();
-
- let panel = aMonitor.panelWin;
- let genericEvents = 0;
- let postEvents = 0;
-
- function onGenericEvent() {
- genericEvents++;
- maybeResolve();
- }
-
- function onPostEvent() {
- postEvents++;
- maybeResolve();
- }
-
- function maybeResolve() {
- info("> Network events progress: " +
- genericEvents + "/" + ((aGetRequests + aPostRequests) * 13) + ", " +
- postEvents + "/" + (aPostRequests * 2));
-
- // There are 15 updates which need to be fired for a request to be
- // considered finished. RequestPostData isn't fired for non-POST requests.
- if (genericEvents == (aGetRequests + aPostRequests) * 13 &&
- postEvents == aPostRequests * 2) {
-
- panel.off("NetMonitor:NetworkEventUpdating:RequestHeaders", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdated:RequestHeaders", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:RequestCookies", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:RequestPostData", onPostEvent);
- panel.off("NetMonitor:NetworkEventUpdated:RequestPostData", onPostEvent);
- panel.off("NetMonitor:NetworkEventUpdated:RequestCookies", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:ResponseHeaders", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdated:ResponseHeaders", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:ResponseCookies", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdated:ResponseCookies", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:ResponseStart", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:ResponseContent", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdated:ResponseContent", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdating:EventTimings", onGenericEvent);
- panel.off("NetMonitor:NetworkEventUpdated:EventTimings", onGenericEvent);
-
- executeSoon(deferred.resolve);
- }
- }
-
- panel.on("NetMonitor:NetworkEventUpdating:RequestHeaders", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdated:RequestHeaders", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:RequestCookies", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:RequestPostData", onPostEvent);
- panel.on("NetMonitor:NetworkEventUpdated:RequestPostData", onPostEvent);
- panel.on("NetMonitor:NetworkEventUpdated:RequestCookies", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:ResponseHeaders", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdated:ResponseHeaders", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:ResponseCookies", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdated:ResponseCookies", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:ResponseStart", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:ResponseContent", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdated:ResponseContent", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdating:EventTimings", onGenericEvent);
- panel.on("NetMonitor:NetworkEventUpdated:EventTimings", onGenericEvent);
-
- return deferred.promise;
-}
-
-function verifyRequestItemTarget(aRequestItem, aMethod, aUrl, aData = {}) {
- info("> Verifying: " + aMethod + " " + aUrl + " " + aData.toSource());
- info("> Request: " + aRequestItem.attachment.toSource());
-
- let requestsMenu = aRequestItem.ownerView;
- let widgetIndex = requestsMenu.indexOfItem(aRequestItem);
- let visibleIndex = requestsMenu.orderedVisibleItems.indexOf(aRequestItem);
-
- info("Widget index of item: " + widgetIndex);
- info("Visible index of item: " + visibleIndex);
-
- let { fuzzyUrl, status, statusText, type, fullMimeType, size, time } = aData;
- let { attachment, target } = aRequestItem
-
- let uri = Services.io.newURI(aUrl, null, null).QueryInterface(Ci.nsIURL);
- let name = uri.fileName || "/";
- let query = uri.query;
- let hostPort = uri.hostPort;
-
- if (fuzzyUrl) {
- ok(attachment.method.startsWith(aMethod), "The attached method is incorrect.");
- ok(attachment.url.startsWith(aUrl), "The attached url is incorrect.");
- } else {
- is(attachment.method, aMethod, "The attached method is incorrect.");
- is(attachment.url, aUrl, "The attached url is incorrect.");
- }
-
- is(target.querySelector(".requests-menu-method").getAttribute("value"),
- aMethod, "The displayed method is incorrect.");
-
- if (fuzzyUrl) {
- ok(target.querySelector(".requests-menu-file").getAttribute("value").startsWith(
- name + (query ? "?" + query : "")), "The displayed file is incorrect.");
- ok(target.querySelector(".requests-menu-file").getAttribute("tooltiptext").startsWith(
- name + (query ? "?" + query : "")), "The tooltip file is incorrect.");
- } else {
- is(target.querySelector(".requests-menu-file").getAttribute("value"),
- name + (query ? "?" + query : ""), "The displayed file is incorrect.");
- is(target.querySelector(".requests-menu-file").getAttribute("tooltiptext"),
- name + (query ? "?" + query : ""), "The tooltip file is incorrect.");
- }
-
- is(target.querySelector(".requests-menu-domain").getAttribute("value"),
- hostPort, "The displayed domain is incorrect.");
- is(target.querySelector(".requests-menu-domain").getAttribute("tooltiptext"),
- hostPort, "The tooltip domain is incorrect.");
-
- if (status !== undefined) {
- let value = target.querySelector(".requests-menu-status").getAttribute("code");
- let tooltip = target.querySelector(".requests-menu-status-and-method").getAttribute("tooltiptext");
- info("Displayed status: " + value);
- info("Tooltip status: " + tooltip);
- is(value, status, "The displayed status is incorrect.");
- is(tooltip, status + " " + statusText, "The tooltip status is incorrect.");
- }
- if (type !== undefined) {
- let value = target.querySelector(".requests-menu-type").getAttribute("value");
- let tooltip = target.querySelector(".requests-menu-type").getAttribute("tooltiptext");
- info("Displayed type: " + value);
- info("Tooltip type: " + tooltip);
- is(value, type, "The displayed type is incorrect.");
- is(tooltip, fullMimeType, "The tooltip type is incorrect.");
- }
- if (size !== undefined) {
- let value = target.querySelector(".requests-menu-size").getAttribute("value");
- let tooltip = target.querySelector(".requests-menu-size").getAttribute("tooltiptext");
- info("Displayed size: " + value);
- info("Tooltip size: " + tooltip);
- is(value, size, "The displayed size is incorrect.");
- is(tooltip, size, "The tooltip size is incorrect.");
- }
- if (time !== undefined) {
- let value = target.querySelector(".requests-menu-timings-total").getAttribute("value");
- let tooltip = target.querySelector(".requests-menu-timings-total").getAttribute("tooltiptext");
- info("Displayed time: " + value);
- info("Tooltip time: " + tooltip);
- ok(~~(value.match(/[0-9]+/)) >= 0, "The displayed time is incorrect.");
- ok(~~(tooltip.match(/[0-9]+/)) >= 0, "The tooltip time is incorrect.");
- }
-
- if (visibleIndex != -1) {
- if (visibleIndex % 2 == 0) {
- ok(aRequestItem.target.hasAttribute("even"),
- "Unexpected 'even' attribute for " + aRequestItem.value);
- ok(!aRequestItem.target.hasAttribute("odd"),
- "Unexpected 'odd' attribute for " + aRequestItem.value);
- } else {
- ok(!aRequestItem.target.hasAttribute("even"),
- "Unexpected 'even' attribute for " + aRequestItem.value);
- ok(aRequestItem.target.hasAttribute("odd"),
- "Unexpected 'odd' attribute for " + aRequestItem.value);
- }
- }
-}
diff --git a/browser/devtools/netmonitor/test/html_content-type-test-page.html b/browser/devtools/netmonitor/test/html_content-type-test-page.html
deleted file mode 100644
index 506ba21c1..000000000
--- a/browser/devtools/netmonitor/test/html_content-type-test-page.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Content type test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=xml", function() {
- get("sjs_content-type-test-server.sjs?fmt=css", function() {
- get("sjs_content-type-test-server.sjs?fmt=js", function() {
- get("sjs_content-type-test-server.sjs?fmt=json", function() {
- get("sjs_content-type-test-server.sjs?fmt=bogus", function() {
- get("test-image.png", function() {
- // Done.
- });
- });
- });
- });
- });
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_custom-get-page.html b/browser/devtools/netmonitor/test/html_custom-get-page.html
deleted file mode 100644
index b01ae09eb..000000000
--- a/browser/devtools/netmonitor/test/html_custom-get-page.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Performing a custom number of GETs</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- // Use a count parameter to defeat caching.
- var count = 0;
-
- function performRequests(aTotal, aUrl, aTimeout = 0) {
- if (!aTotal) {
- return;
- }
- get(aUrl || "request_" + (count++), function() {
- setTimeout(performRequests.bind(this, --aTotal, aUrl, aTimeout), aTimeout);
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_cyrillic-test-page.html b/browser/devtools/netmonitor/test/html_cyrillic-test-page.html
deleted file mode 100644
index b9a0dc9d0..000000000
--- a/browser/devtools/netmonitor/test/html_cyrillic-test-page.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Cyrillic type test</p>
- <p>Братан, Ñ‚Ñ‹ вообще качаешьÑÑ?</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=txt", function() {
- // Done.
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_filter-test-page.html b/browser/devtools/netmonitor/test/html_filter-test-page.html
deleted file mode 100644
index 6719991d9..000000000
--- a/browser/devtools/netmonitor/test/html_filter-test-page.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Filtering test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- // Use a random parameter to defeat caching.
- xhr.open("GET", aAddress + "&" + Math.random(), true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests(aOptions) {
- var options = JSON.parse(aOptions);
- get("sjs_content-type-test-server.sjs?fmt=html&res=" + options.htmlContent, function() {
- get("sjs_content-type-test-server.sjs?fmt=css", function() {
- get("sjs_content-type-test-server.sjs?fmt=js", function() {
- if (!options.getMedia) {
- return;
- }
- get("sjs_content-type-test-server.sjs?fmt=font", function() {
- get("sjs_content-type-test-server.sjs?fmt=image", function() {
- get("sjs_content-type-test-server.sjs?fmt=audio", function() {
- get("sjs_content-type-test-server.sjs?fmt=video", function() {
- if (!options.getFlash) {
- return;
- }
- get("sjs_content-type-test-server.sjs?fmt=flash", function() {
- // Done.
- });
- });
- });
- });
- });
- });
- });
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_infinite-get-page.html b/browser/devtools/netmonitor/test/html_infinite-get-page.html
deleted file mode 100644
index 882dc57de..000000000
--- a/browser/devtools/netmonitor/test/html_infinite-get-page.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Infinite GETs</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- // Use a count parameter to defeat caching.
- var count = 0;
-
- (function performRequests() {
- get("request_" + (count++), function() {
- setTimeout(performRequests, 50);
- });
- })();
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_json-long-test-page.html b/browser/devtools/netmonitor/test/html_json-long-test-page.html
deleted file mode 100644
index 4889d76c7..000000000
--- a/browser/devtools/netmonitor/test/html_json-long-test-page.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>JSON long string test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-long", function() {
- // Done.
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_json-malformed-test-page.html b/browser/devtools/netmonitor/test/html_json-malformed-test-page.html
deleted file mode 100644
index 3c47c797f..000000000
--- a/browser/devtools/netmonitor/test/html_json-malformed-test-page.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>JSON malformed test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=json-malformed", function() {
- // Done.
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_jsonp-test-page.html b/browser/devtools/netmonitor/test/html_jsonp-test-page.html
deleted file mode 100644
index 7cf0c6bbb..000000000
--- a/browser/devtools/netmonitor/test/html_jsonp-test-page.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>JSONP test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_content-type-test-server.sjs?fmt=jsonp&jsonp=$_0123Fun", function() {
- // Done.
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_navigate-test-page.html b/browser/devtools/netmonitor/test/html_navigate-test-page.html
deleted file mode 100644
index 69284120a..000000000
--- a/browser/devtools/netmonitor/test/html_navigate-test-page.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Navigation test</p>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_post-data-test-page.html b/browser/devtools/netmonitor/test/html_post-data-test-page.html
deleted file mode 100644
index 4be478226..000000000
--- a/browser/devtools/netmonitor/test/html_post-data-test-page.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- <style>
- input {
- display: block;
- margin: 12px;
- }
- </style>
- </head>
-
- <body>
- <p>POST data test</p>
- <form enctype="multipart/form-data" method="post" name="form-name">
- <input type="text" name="text" placeholder="text" value="Some text..."/>
- <input type="email" name="email" placeholder="email"/>
- <input type="range" name="range" value="42"/>
- <input type="button" value="Post me!" onclick="window.form()">
- </form>
-
- <script type="text/javascript">
- function post(aAddress, aMessage, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-
- var data = "";
- for (var i in aMessage) {
- data += "&" + i + "=" + aMessage[i];
- }
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(data);
- }
-
- function form(aAddress, aForm, aCallback) {
- var formData = new FormData(document.forms.namedItem(aForm));
- formData.append("Custom field", "Extra data");
-
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(formData);
- }
-
- function performRequests() {
- var url = "sjs_simple-test-server.sjs";
- var url1 = url + "?foo=bar&baz=42&type=urlencoded";
- var url2 = url + "?foo=bar&baz=42&type=multipart";
-
- post(url1, { foo: "bar", baz: 123 }, function() {
- form(url2, "form-name", function() {
- // Done.
- });
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_post-raw-test-page.html b/browser/devtools/netmonitor/test/html_post-raw-test-page.html
deleted file mode 100644
index b3148a77e..000000000
--- a/browser/devtools/netmonitor/test/html_post-raw-test-page.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>POST raw test</p>
-
- <script type="text/javascript">
- function post(aAddress, aMessage, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(aMessage);
- }
-
- function performRequests() {
- var rawData = "Content-Type: application/x-www-form-urlencoded\r\n\r\nfoo=bar&baz=123";
- post("sjs_simple-test-server.sjs", rawData, function() {
- // Done.
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_simple-test-page.html b/browser/devtools/netmonitor/test/html_simple-test-page.html
deleted file mode 100644
index a8eae55bf..000000000
--- a/browser/devtools/netmonitor/test/html_simple-test-page.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Simple test</p>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_sorting-test-page.html b/browser/devtools/netmonitor/test/html_sorting-test-page.html
deleted file mode 100644
index 9326ded2d..000000000
--- a/browser/devtools/netmonitor/test/html_sorting-test-page.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Sorting test</p>
-
- <script type="text/javascript">
- function get(aAddress, aIndex, aCallback) {
- var xhr = new XMLHttpRequest();
- // Use a random parameter to defeat caching.
- xhr.open("GET" + aIndex, aAddress + "?index=" + aIndex + "&" + Math.random(), true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_sorting-test-server.sjs", 1, function() {
- get("sjs_sorting-test-server.sjs", 5, function() {
- get("sjs_sorting-test-server.sjs", 2, function() {
- get("sjs_sorting-test-server.sjs", 4, function() {
- get("sjs_sorting-test-server.sjs", 3, function() {
- // Done.
- });
- });
- });
- });
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/html_status-codes-test-page.html b/browser/devtools/netmonitor/test/html_status-codes-test-page.html
deleted file mode 100644
index f19570e71..000000000
--- a/browser/devtools/netmonitor/test/html_status-codes-test-page.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!doctype html>
-
-<html>
- <head>
- <meta charset="utf-8"/>
- <title>Network Monitor test page</title>
- </head>
-
- <body>
- <p>Status codes test</p>
-
- <script type="text/javascript">
- function get(aAddress, aCallback) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", aAddress, true);
-
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- aCallback();
- }
- };
- xhr.send(null);
- }
-
- function performRequests() {
- get("sjs_status-codes-test-server.sjs?sts=100", function() {
- get("sjs_status-codes-test-server.sjs?sts=200", function() {
- get("sjs_status-codes-test-server.sjs?sts=300", function() {
- get("sjs_status-codes-test-server.sjs?sts=400", function() {
- get("sjs_status-codes-test-server.sjs?sts=500", function() {
- // Done.
- });
- });
- });
- });
- });
- }
- </script>
- </body>
-
-</html>
diff --git a/browser/devtools/netmonitor/test/moz.build b/browser/devtools/netmonitor/test/moz.build
deleted file mode 100644
index 58ce5e273..000000000
--- a/browser/devtools/netmonitor/test/moz.build
+++ /dev/null
@@ -1,5 +0,0 @@
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs b/browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs
deleted file mode 100644
index a0cb4ec65..000000000
--- a/browser/devtools/netmonitor/test/sjs_content-type-test-server.sjs
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const { classes: Cc, interfaces: Ci } = Components;
-
-function handleRequest(request, response) {
- response.processAsync();
-
- let params = request.queryString.split("&");
- let format = params.filter((s) => s.contains("fmt="))[0].split("=")[1];
-
- Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer).initWithCallback(() => {
- switch (format) {
- case "txt": {
- response.setStatusLine(request.httpVersion, 200, "DA DA DA");
- response.setHeader("Content-Type", "text/plain", false);
- response.write("Братан, Ñ‚Ñ‹ вообще качаешьÑÑ?");
- response.finish();
- break;
- }
- case "xml": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/xml; charset=utf-8", false);
- response.write("<label value='greeting'>Hello XML!</label>");
- response.finish();
- break;
- }
- case "html": {
- let content = params.filter((s) => s.contains("res="))[0].split("=")[1];
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/html; charset=utf-8", false);
- response.write(content || "<p>Hello HTML!</p>");
- response.finish();
- break;
- }
- case "html-long": {
- let str = new Array(102400 /* 100 KB in bytes */).join(".");
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/html; charset=utf-8", false);
- response.write("<p>" + str + "</p>");
- response.finish();
- break;
- }
- case "css": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/css; charset=utf-8", false);
- response.write("body:pre { content: 'Hello CSS!' }");
- response.finish();
- break;
- }
- case "js": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "application/javascript; charset=utf-8", false);
- response.write("function() { return 'Hello JS!'; }");
- response.finish();
- break;
- }
- case "json": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "application/json; charset=utf-8", false);
- response.write("{ \"greeting\": \"Hello JSON!\" }");
- response.finish();
- break;
- }
- case "jsonp": {
- let fun = params.filter((s) => s.contains("jsonp="))[0].split("=")[1];
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/json; charset=utf-8", false);
- response.write(fun + "({ \"greeting\": \"Hello JSONP!\" })");
- response.finish();
- break;
- }
- case "json-long": {
- let str = "{ \"greeting\": \"Hello long string JSON!\" },";
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/json; charset=utf-8", false);
- response.write("[" + new Array(2048).join(str).slice(0, -1) + "]");
- response.finish();
- break;
- }
- case "json-malformed": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "text/json; charset=utf-8", false);
- response.write("{ \"greeting\": \"Hello malformed JSON!\" },");
- response.finish();
- break;
- }
- case "font": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "font/woff", false);
- response.finish();
- break;
- }
- case "image": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "image/png", false);
- response.finish();
- break;
- }
- case "audio": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "audio/ogg", false);
- response.finish();
- break;
- }
- case "video": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "video/webm", false);
- response.finish();
- break;
- }
- case "flash": {
- response.setStatusLine(request.httpVersion, 200, "OK");
- response.setHeader("Content-Type", "application/x-shockwave-flash", false);
- response.finish();
- break;
- }
- default: {
- response.setStatusLine(request.httpVersion, 404, "Not Found");
- response.setHeader("Content-Type", "text/html; charset=utf-8", false);
- response.write("<blink>Not Found</blink>");
- response.finish();
- break;
- }
- }
- }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
-}
diff --git a/browser/devtools/netmonitor/test/sjs_simple-test-server.sjs b/browser/devtools/netmonitor/test/sjs_simple-test-server.sjs
deleted file mode 100644
index 15fe9f8ae..000000000
--- a/browser/devtools/netmonitor/test/sjs_simple-test-server.sjs
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function handleRequest(request, response) {
- response.setStatusLine(request.httpVersion, 200, "Och Aye");
- response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
- response.setHeader("Foo-Bar", "baz", false);
- response.write("Hello world!");
-}
diff --git a/browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs b/browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs
deleted file mode 100644
index fd31b3266..000000000
--- a/browser/devtools/netmonitor/test/sjs_sorting-test-server.sjs
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const { classes: Cc, interfaces: Ci } = Components;
-
-function handleRequest(request, response) {
- response.processAsync();
-
- let params = request.queryString.split("&");
- let index = params.filter((s) => s.contains("index="))[0].split("=")[1];
-
- Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer).initWithCallback(() => {
- response.setStatusLine(request.httpVersion, index == 1 ? 101 : index * 100, "Meh");
- response.setHeader("Content-Type", "text/" + index, false);
- response.write(new Array(index * 10).join(index)); // + 0.01 KB
- response.finish();
- }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
-}
diff --git a/browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs b/browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs
deleted file mode 100644
index bc07336ee..000000000
--- a/browser/devtools/netmonitor/test/sjs_status-codes-test-server.sjs
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const { classes: Cc, interfaces: Ci } = Components;
-
-function handleRequest(request, response) {
- response.processAsync();
-
- let params = request.queryString.split("&");
- let status = params.filter((s) => s.contains("sts="))[0].split("=")[1];
-
- Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer).initWithCallback(() => {
- switch (status) {
- case "100":
- response.setStatusLine(request.httpVersion, 101, "Switching Protocols");
- break;
- case "200":
- response.setStatusLine(request.httpVersion, 202, "Created");
- break;
- case "300":
- response.setStatusLine(request.httpVersion, 303, "See Other");
- break;
- case "400":
- response.setStatusLine(request.httpVersion, 404, "Not Found");
- break;
- case "500":
- response.setStatusLine(request.httpVersion, 501, "Not Implemented");
- break;
- }
- response.setHeader("Content-Type", "text/plain; charset=utf-8", false);
- response.write("Hello status code " + status + "!");
- response.finish();
- }, 10, Ci.nsITimer.TYPE_ONE_SHOT); // Make sure this request takes a few ms.
-}
diff --git a/browser/devtools/netmonitor/test/test-image.png b/browser/devtools/netmonitor/test/test-image.png
deleted file mode 100644
index 769c63634..000000000
--- a/browser/devtools/netmonitor/test/test-image.png
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/profiler/moz.build b/browser/devtools/profiler/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/profiler/moz.build
+++ b/browser/devtools/profiler/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/profiler/test/Makefile.in b/browser/devtools/profiler/test/Makefile.in
deleted file mode 100644
index 398afe09a..000000000
--- a/browser/devtools/profiler/test/Makefile.in
+++ /dev/null
@@ -1,39 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-# Disabled for intermittent failures.
-# browser_profiler_run.js \
-# browser_profiler_bug_855244_multiple_tabs.js \
-# browser_profiler_controller.js \
-# browser_profiler_bug_830664_multiple_profiles.js \
-# browser_profiler_console_api.js \
-# browser_profiler_console_api_named.js \
-# browser_profiler_console_api_mixed.js \
-# browser_profiler_console_api_content.js \
-
-MOCHITEST_BROWSER_TESTS = \
- browser_profiler_profiles.js \
- browser_profiler_remote.js \
- browser_profiler_bug_834878_source_buttons.js \
- browser_profiler_cmd.js \
- head.js \
- $(NULL)
-
-MOCHITEST_BROWSER_PAGES = \
- mock_profiler_bug_834878_page.html \
- mock_profiler_bug_834878_script.js \
- mock_console_api.html \
- $(NULL)
-
-MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/profiler/test/browser_profiler_bug_830664_multiple_profiles.js b/browser/devtools/profiler/test/browser_profiler_bug_830664_multiple_profiles.js
deleted file mode 100644
index 1acafd5c8..000000000
--- a/browser/devtools/profiler/test/browser_profiler_bug_830664_multiple_profiles.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel, gUid;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, function onSetUp(tab, browser, panel) {
- gTab = tab;
- gPanel = panel;
-
- gPanel.once("profileCreated", function (_, uid) {
- gUid = uid;
- let profile = gPanel.profiles.get(uid);
-
- if (profile.isReady) {
- startProfiling();
- } else {
- profile.once("ready", startProfiling);
- }
- });
- gPanel.createProfile();
- });
-}
-
-function startProfiling() {
- gPanel.profiles.get(gPanel.activeProfile.uid).once("started", function () {
- setTimeout(function () {
- sendFromProfile(2, "start");
- gPanel.profiles.get(2).once("started", function () setTimeout(stopProfiling, 50));
- }, 50);
- });
-
- sendFromProfile(gPanel.activeProfile.uid, "start");
-}
-
-function stopProfiling() {
- is(getSidebarItem(1).attachment.state, PROFILE_RUNNING);
- is(getSidebarItem(2).attachment.state, PROFILE_RUNNING);
-
- gPanel.profiles.get(gPanel.activeProfile.uid).once("stopped", function () {
- is(getSidebarItem(1).attachment.state, PROFILE_COMPLETED);
-
- sendFromProfile(2, "stop");
- gPanel.profiles.get(2).once("stopped", confirmAndFinish);
- });
-
- sendFromProfile(gPanel.activeProfile.uid, "stop");
-}
-
-function confirmAndFinish(ev, data) {
- is(getSidebarItem(1).attachment.state, PROFILE_COMPLETED);
- is(getSidebarItem(2).attachment.state, PROFILE_COMPLETED);
-
- tearDown(gTab, function onTearDown() {
- gPanel = null;
- gTab = null;
- gUid = null;
- });
-}
diff --git a/browser/devtools/profiler/test/browser_profiler_bug_834878_source_buttons.js b/browser/devtools/profiler/test/browser_profiler_bug_834878_source_buttons.js
deleted file mode 100644
index 3fdc40e95..000000000
--- a/browser/devtools/profiler/test/browser_profiler_bug_834878_source_buttons.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const BASE = "http://example.com/browser/browser/devtools/profiler/test/";
-const URL = BASE + "mock_profiler_bug_834878_page.html";
-const SCRIPT = BASE + "mock_profiler_bug_834878_script.js";
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, function onSetUp(tab, browser, panel) {
- panel.once("profileCreated", function () {
- let data = { uri: SCRIPT, line: 5, isChrome: false };
-
- panel.displaySource(data, function onOpen() {
- let target = TargetFactory.forTab(tab);
- let dbg = gDevTools.getToolbox(target).getPanel("jsdebugger");
- let view = dbg.panelWin.DebuggerView;
-
- is(view.Sources.selectedValue, data.uri, "URI is different");
- is(view.editor.getCaretPosition().line, data.line - 1,
- "Line is different");
-
- // Test the case where script is already loaded.
- view.editor.setCaretPosition(1);
- gDevTools.showToolbox(target, "jsprofiler").then(function () {
- panel.displaySource(data, function onOpenAgain() {
- is(view.editor.getCaretPosition().line, data.line - 1,
- "Line is different");
- tearDown(tab);
- });
- });
- });
- });
-
- panel.createProfile();
- });
-}
diff --git a/browser/devtools/profiler/test/browser_profiler_bug_855244_multiple_tabs.js b/browser/devtools/profiler/test/browser_profiler_bug_855244_multiple_tabs.js
deleted file mode 100644
index 74a831d0e..000000000
--- a/browser/devtools/profiler/test/browser_profiler_bug_855244_multiple_tabs.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab1, gPanel1;
-let gTab2, gPanel2;
-
-// Tests that you can run the profiler in multiple tabs at the same
-// time and that closing the debugger panel in one tab doesn't lock
-// profilers in other tabs.
-
-registerCleanupFunction(function () {
- gTab1 = gTab2 = gPanel1 = gPanel2 = null;
-});
-
-function test() {
- waitForExplicitFinish();
-
- openTwoTabs()
- .then(startTwoProfiles)
- .then(stopFirstProfile)
- .then(stopSecondProfile)
- .then(closeTabs)
- .then(openTwoTabs)
- .then(startTwoProfiles)
- .then(closeFirstPanel)
- .then(stopSecondProfile)
- .then(closeTabs)
- .then(finish);
-}
-
-function openTwoTabs() {
- let deferred = Promise.defer();
-
- setUp(URL, (tab, browser, panel) => {
- gTab1 = tab;
- gPanel1 = panel;
-
- loadTab(URL, (tab, browser) => {
- gTab2 = tab;
- openProfiler(tab, () => {
- let target = TargetFactory.forTab(tab);
- gPanel2 = gDevTools.getToolbox(target).getPanel("jsprofiler");
- deferred.resolve();
- });
- });
- });
-
- return deferred.promise;
-}
-
-function startTwoProfiles() {
- let deferred = Promise.defer();
- gPanel1.controller.start("Profile 1", (err) => {
- ok(!err, "Profile in tab 1 started without errors");
- gPanel2.controller.start("Profile 1", (err) => {
- ok(!err, "Profile in tab 2 started without errors");
- gPanel1.controller.isActive((err, isActive) => {
- ok(isActive, "Profiler is active");
- deferred.resolve();
- });
- });
- });
-
- return deferred.promise;
-}
-
-function stopFirstProfile() {
- let deferred = Promise.defer();
-
- gPanel1.controller.stop("Profile 1", (err, data) => {
- ok(!err, "Profile in tab 1 stopped without errors");
- ok(data, "Profile in tab 1 returned some data");
- deferred.resolve();
- });
-
- return deferred.promise;
-}
-
-function stopSecondProfile() {
- let deferred = Promise.defer();
-
- gPanel2.controller.stop("Profile 1", (err, data) => {
- ok(!err, "Profile in tab 2 stopped without errors");
- ok(data, "Profile in tab 2 returned some data");
- deferred.resolve();
- });
-
- return deferred.promise;
-}
-
-function closeTabs() {
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-}
-
-function closeFirstPanel() {
- let target = TargetFactory.forTab(gTab1);
- let toolbox = gDevTools.getToolbox(target);
- return toolbox.destroy;
-}
diff --git a/browser/devtools/profiler/test/browser_profiler_cmd.js b/browser/devtools/profiler/test/browser_profiler_cmd.js
deleted file mode 100644
index 321b01b48..000000000
--- a/browser/devtools/profiler/test/browser_profiler_cmd.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gcli = Cu.import("resource://gre/modules/devtools/gcli.jsm", {}).gcli;
-let gTarget, gPanel, gOptions;
-
-function cmd(typed, expected="") {
- helpers.audit(gOptions, [{
- setup: typed,
- exec: { output: expected }
- }]);
-}
-
-function test() {
- waitForExplicitFinish();
-
- helpers.addTabWithToolbar(URL, function (options) {
- gOptions = options;
- gTarget = options.target;
-
- return gDevTools.showToolbox(options.target, "jsprofiler")
- .then(setupGlobals)
- .then(testProfilerStart)
- .then(testProfilerList)
- .then(testProfilerStop)
- .then(testProfilerClose)
- .then(testProfilerCloseWhenClosed)
- }).then(finishUp);
-}
-
-function setupGlobals() {
- let deferred = Promise.defer();
- gPanel = gDevTools.getToolbox(gTarget).getPanel("jsprofiler");
- deferred.resolve();
- return deferred.promise;
-}
-
-function testProfilerStart() {
- let deferred = Promise.defer();
-
- gPanel.once("started", function () {
- is(gPanel.profiles.size, 2, "There are two profiles");
- ok(!gPanel.getProfileByName("Profile 1").isStarted, "Profile 1 wasn't started");
- ok(gPanel.getProfileByName("Profile 2").isStarted, "Profile 2 was started");
- cmd('profiler start "Profile 2"', "This profile has already been started");
- deferred.resolve();
- });
-
- cmd("profiler start", gcli.lookup("profilerStarting2"));
- return deferred.promise;
-}
-
-function testProfilerList() {
- let deferred = Promise.defer();
-
- cmd("profiler list", /^.*Profile\s1.*Profile\s2\s\*.*$/);
- deferred.resolve();
-
- return deferred.promise;
-}
-
-function testProfilerStop() {
- let deferred = Promise.defer();
-
- gPanel.once("stopped", function () {
- ok(!gPanel.getProfileByName("Profile 2").isStarted, "Profile 2 was stopped");
- ok(gPanel.getProfileByName("Profile 2").isFinished, "Profile 2 was stopped");
- cmd('profiler stop "Profile 2"', "This profile has already been completed. " +
- "Use 'profile show' command to see its results");
- cmd('profiler stop "Profile 1"', "This profile has not been started yet. " +
- "Use 'profile start' to start profiling");
- cmd('profiler stop "invalid"', "Profile not found")
- deferred.resolve();
- });
-
- cmd('profiler stop "Profile 2"', gcli.lookup("profilerStopping2"));
- return deferred.promise;
-}
-
-function testProfilerShow() {
- let deferred = Promise.defer();
-
- is(gPanel.getProfileByName("Profile 2").uid, gPanel.activeProfile.uid,
- "Profile 2 is active");
-
- gPanel.once("profileSwitched", function () {
- is(gPanel.getProfileByName("Profile 1").uid, gPanel.activeProfile.uid,
- "Profile 1 is active");
- cmd('profile show "invalid"', "Profile not found");
- deferred.resolve();
- });
-
- cmd('profile show "Profile 1"');
- return deferred.promise;
-}
-
-function testProfilerClose() {
- let deferred = Promise.defer();
-
- helpers.audit(gOptions, [{
- setup: "profiler close",
- completed: false,
- exec: { output: "" }
- }]);
-
- let toolbox = gDevTools.getToolbox(gOptions.target);
- if (!toolbox) {
- ok(true, "Profiler was closed.");
- deferred.resolve();
- } else {
- toolbox.on("destroyed", function () {
- ok(true, "Profiler was closed.");
- deferred.resolve();
- });
- }
-
- return deferred.promise;
-}
-
-function testProfilerCloseWhenClosed() {
- // We need to call this test to make sure there are no
- // errors when executing 'profiler close' on a closed
- // toolbox. See bug 863636 for more info.
-
- let deferred = Promise.defer();
-
- helpers.audit(gOptions, [{
- setup: "profiler close",
- completed: false,
- exec: { output: "" }
- }]);
-
- let toolbox = gDevTools.getToolbox(gOptions.target);
- if (!toolbox) {
- ok(true, "Profiler was closed.");
- deferred.resolve();
- } else {
- toolbox.on("destroyed", function () {
- ok(true, "Profiler was closed.");
- deferred.resolve();
- });
- }
-
- return deferred.promise;
-}
-
-function finishUp() {
- gTarget = null;
- gPanel = null;
- gOptions = null;
- finish();
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_console_api.js b/browser/devtools/profiler/test/browser_profiler_console_api.js
deleted file mode 100644
index 0b25c0142..000000000
--- a/browser/devtools/profiler/test/browser_profiler_console_api.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, (tab, browser, panel) => {
- gTab = tab;
- gPanel = panel;
-
- openConsole(tab, testConsoleProfile);
- });
-}
-
-function testConsoleProfile(hud) {
- hud.jsterm.clearOutput(true);
-
- // Here we start two named profiles and then end one of them.
- // profileEnd, when name is not provided, simply pops the latest
- // profile.
-
- let profilesStarted = 0;
-
- function profileEnd(_, uid) {
- let profile = gPanel.profiles.get(uid);
-
- profile.once("started", () => {
- if (++profilesStarted < 2)
- return;
-
- gPanel.off("profileCreated", profileEnd);
- gPanel.profiles.get(3).once("stopped", () => {
- openProfiler(gTab, checkProfiles);
- });
-
- hud.jsterm.execute("console.profileEnd()");
- });
- }
-
- gPanel.on("profileCreated", profileEnd);
- hud.jsterm.execute("console.profile()");
- hud.jsterm.execute("console.profile()");
-}
-
-function checkProfiles(toolbox) {
- let panel = toolbox.getPanel("jsprofiler");
-
- is(getSidebarItem(1, panel).attachment.state, PROFILE_IDLE);
- is(getSidebarItem(2, panel).attachment.state, PROFILE_RUNNING);
- is(getSidebarItem(3, panel).attachment.state, PROFILE_COMPLETED);
-
- // Make sure we can still stop profiles via the UI.
-
- gPanel.profiles.get(2).once("stopped", () => {
- is(getSidebarItem(2, panel).attachment.state, PROFILE_COMPLETED);
- tearDown(gTab, () => gTab = gPanel = null);
- });
-
- sendFromProfile(2, "stop");
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_console_api_content.js b/browser/devtools/profiler/test/browser_profiler_console_api_content.js
deleted file mode 100644
index 67e0b1084..000000000
--- a/browser/devtools/profiler/test/browser_profiler_console_api_content.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-const BASE = "http://example.com/browser/browser/devtools/profiler/test/";
-const PAGE = BASE + "mock_console_api.html";
-
-let gTab, gPanel, gToolbox;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, (tab, browser, panel) => {
- gTab = tab;
- gPanel = panel;
-
- openProfiler(tab, (toolbox) => {
- gToolbox = toolbox;
- loadUrl(PAGE, tab, () => {
- gPanel.sidebar.on("stateChanged", (_, item) => {
- if (item.attachment.state !== PROFILE_COMPLETED)
- return;
-
- runTests();
- });
- });
- });
- });
-}
-
-function runTests() {
- is(getSidebarItem(1).attachment.state, PROFILE_IDLE);
- is(getSidebarItem(2).attachment.state, PROFILE_COMPLETED);
-
- gPanel.once("parsed", () => {
- function assertSampleAndFinish() {
- let [win,doc] = getProfileInternals();
- let sample = doc.getElementsByClassName("samplePercentage");
-
- if (sample.length <= 0)
- return void setTimeout(assertSampleAndFinish, 100);
-
- ok(sample.length > 0, "We have Cleopatra UI displayed");
- tearDown(gTab, () => {
- gTab = null;
- gPanel = null;
- gToolbox = null;
- });
- }
-
- assertSampleAndFinish();
- });
-
- let profile = gPanel.profiles.get(2);
- gPanel.sidebar.selectedItem = gPanel.sidebar.getItemByProfile(profile);
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_console_api_mixed.js b/browser/devtools/profiler/test/browser_profiler_console_api_mixed.js
deleted file mode 100644
index 548050e88..000000000
--- a/browser/devtools/profiler/test/browser_profiler_console_api_mixed.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, (tab, browser, panel) => {
- gTab = tab;
- gPanel = panel;
-
- openProfiler(tab, runTests);
- });
-}
-
-function runTests(toolbox) {
- let panel = toolbox.getPanel("jsprofiler");
-
- panel.profiles.get(1).once("started", () => {
- is(getSidebarItem(1, panel).attachment.state, PROFILE_RUNNING);
-
- openConsole(gTab, (hud) => {
- panel.profiles.get(1).once("stopped", () => {
- is(getSidebarItem(1, panel).attachment.state, PROFILE_COMPLETED);
- tearDown(gTab, () => gTab = gPanel = null);
- });
-
- hud.jsterm.execute("console.profileEnd()");
- });
- });
-
- sendFromProfile(1, "start");
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_console_api_named.js b/browser/devtools/profiler/test/browser_profiler_console_api_named.js
deleted file mode 100644
index 460676aa7..000000000
--- a/browser/devtools/profiler/test/browser_profiler_console_api_named.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, (tab, browser, panel) => {
- gTab = tab;
- gPanel = panel;
-
- openConsole(tab, testConsoleProfile);
- });
-}
-
-function testConsoleProfile(hud) {
- hud.jsterm.clearOutput(true);
-
- // Here we start two named profiles and then end one of them.
-
- let profilesStarted = 0;
-
- function profileEnd(_, uid) {
- let profile = gPanel.profiles.get(uid);
-
- profile.once("started", () => {
- if (++profilesStarted < 2)
- return;
-
- gPanel.off("profileCreated", profileEnd);
- gPanel.profiles.get(2).once("stopped", () => {
- openProfiler(gTab, checkProfiles);
- });
-
- hud.jsterm.execute("console.profileEnd('Second')");
- });
- }
-
- gPanel.on("profileCreated", profileEnd);
- hud.jsterm.execute("console.profile('Second')");
- hud.jsterm.execute("console.profile('Third')");
-}
-
-function checkProfiles(toolbox) {
- let panel = toolbox.getPanel("jsprofiler");
-
- is(getSidebarItem(1, panel).attachment.state, PROFILE_IDLE);
- is(getSidebarItem(2, panel).attachment.name, "Second");
- is(getSidebarItem(2, panel).attachment.state, PROFILE_COMPLETED);
- is(getSidebarItem(3, panel).attachment.name, "Third");
- is(getSidebarItem(3, panel).attachment.state, PROFILE_RUNNING);
-
- // Make sure we can still stop profiles via the queue pop.
-
- gPanel.profiles.get(3).once("stopped", () => {
- openProfiler(gTab, () => {
- is(getSidebarItem(3, panel).attachment.state, PROFILE_COMPLETED);
- tearDown(gTab, () => gTab = gPanel = null);
- });
- });
-
- openConsole(gTab, (hud) => hud.jsterm.execute("console.profileEnd()"));
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_controller.js b/browser/devtools/profiler/test/browser_profiler_controller.js
deleted file mode 100644
index 8881f01bd..000000000
--- a/browser/devtools/profiler/test/browser_profiler_controller.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, function onSetUp(tab, browser, panel) {
- gTab = tab;
- gPanel = panel;
-
- testInactive(startFirstProfile);
- });
-}
-
-function testInactive(next=function(){}) {
- gPanel.controller.isActive(function (err, isActive) {
- ok(!err, "isActive didn't return any errors");
- ok(!isActive, "Profiler is not active");
- next();
- });
-}
-
-function testActive(next=function(){}) {
- gPanel.controller.isActive(function (err, isActive) {
- ok(!err, "isActive didn't return any errors");
- ok(isActive, "Profiler is active");
- next();
- });
-}
-
-function startFirstProfile() {
- gPanel.controller.start("Profile 1", function (err) {
- ok(!err, "Profile 1 started without errors");
- testActive(startSecondProfile);
- });
-}
-
-function startSecondProfile() {
- gPanel.controller.start("Profile 2", function (err) {
- ok(!err, "Profile 2 started without errors");
- testActive(stopFirstProfile);
- });
-}
-
-function stopFirstProfile() {
- gPanel.controller.stop("Profile 1", function (err, data) {
- ok(!err, "Profile 1 stopped without errors");
- ok(data, "Profiler returned some data");
-
- testActive(stopSecondProfile);
- });
-}
-
-function stopSecondProfile() {
- gPanel.controller.stop("Profile 2", function (err, data) {
- ok(!err, "Profile 2 stopped without errors");
- ok(data, "Profiler returned some data");
- testInactive(tearDown.call(null, gTab, function () gTab = gPanel = null));
- });
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_profiles.js b/browser/devtools/profiler/test/browser_profiler_profiles.js
deleted file mode 100644
index 10f7b4bcb..000000000
--- a/browser/devtools/profiler/test/browser_profiler_profiles.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, function onSetUp(tab, browser, panel) {
- gTab = tab;
- gPanel = panel;
-
- panel.once("profileCreated", onProfileCreated);
- panel.once("profileSwitched", onProfileSwitched);
-
- testNewProfile();
- });
-}
-
-function testNewProfile() {
- is(gPanel.profiles.size, 1, "There is only one profile");
-
- let btn = gPanel.document.getElementById("profiler-create");
- ok(!btn.getAttribute("disabled"), "Create Profile button is not disabled");
- btn.click();
-}
-
-function onProfileCreated(name, uid) {
- is(gPanel.profiles.size, 2, "There are two profiles now");
- ok(gPanel.activeProfile.uid !== uid, "New profile is not yet active");
-
- let btn = gPanel.document.getElementById("profile-" + uid);
- ok(btn, "Profile item has been added to the sidebar");
- btn.click();
-}
-
-function onProfileSwitched(name, uid) {
- gPanel.once("profileCreated", onNamedProfileCreated);
- gPanel.once("profileSwitched", onNamedProfileSwitched);
-
- ok(gPanel.activeProfile.uid === uid, "Switched to a new profile");
- gPanel.createProfile("Custom Profile");
-}
-
-function onNamedProfileCreated(name, uid) {
- is(gPanel.profiles.size, 3, "There are three profiles now");
- is(gPanel.getProfileByUID(uid).name, "Custom Profile", "Name is correct");
-
- let profile = gPanel.profiles.get(uid);
- let data = gPanel.sidebar.getItemByProfile(profile).attachment;
-
- is(data.uid, uid, "UID is correct");
- is(data.name, "Custom Profile", "Name is correct on the label");
-
- let btn = gPanel.document.getElementById("profile-" + uid);
- ok(btn, "Profile item has been added to the sidebar");
- btn.click();
-}
-
-function onNamedProfileSwitched(name, uid) {
- ok(gPanel.activeProfile.uid === uid, "Switched to a new profile");
-
- tearDown(gTab, function onTearDown() {
- gPanel = null;
- gTab = null;
- });
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_remote.js b/browser/devtools/profiler/test/browser_profiler_remote.js
deleted file mode 100644
index 450f9d290..000000000
--- a/browser/devtools/profiler/test/browser_profiler_remote.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let temp = {};
-
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm", temp);
-let DebuggerServer = temp.DebuggerServer;
-
-Cu.import("resource://gre/modules/devtools/dbg-client.jsm", temp);
-let DebuggerClient = temp.DebuggerClient;
-let debuggerSocketConnect = temp.debuggerSocketConnect;
-
-Cu.import("resource:///modules/devtools/ProfilerController.jsm", temp);
-let ProfilerController = temp.ProfilerController;
-
-function test() {
- waitForExplicitFinish();
- Services.prefs.setBoolPref(REMOTE_ENABLED, true);
-
- loadTab(URL, function onTabLoad(tab, browser) {
- DebuggerServer.init(function () true);
- DebuggerServer.addBrowserActors();
- is(DebuggerServer._socketConnections, 0);
-
- DebuggerServer.openListener(2929);
- is(DebuggerServer._socketConnections, 1);
-
- let transport = debuggerSocketConnect("127.0.0.1", 2929);
- let client = new DebuggerClient(transport);
- client.connect(function onClientConnect() {
- let target = { isRemote: true, client: client };
- let controller = new ProfilerController(target);
-
- controller.connect(function onControllerConnect() {
- // If this callback is called, this means listTabs call worked.
- // Which means that the transport worked. Time to finish up this
- // test.
-
- function onShutdown() {
- window.removeEventListener("Debugger:Shutdown", onShutdown, true);
- transport = client = null;
- finish();
- }
-
- window.addEventListener("Debugger:Shutdown", onShutdown, true);
-
- client.close(function () {
- gBrowser.removeTab(tab);
- });
- });
- });
- });
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/browser_profiler_run.js b/browser/devtools/profiler/test/browser_profiler_run.js
deleted file mode 100644
index 80e162ffb..000000000
--- a/browser/devtools/profiler/test/browser_profiler_run.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
-
-let gTab, gPanel, gAttempts = 0;
-
-function test() {
- waitForExplicitFinish();
-
- setUp(URL, function onSetUp(tab, browser, panel) {
- gTab = tab;
- gPanel = panel;
-
- panel.once("started", onStart);
- panel.once("parsed", onParsed);
-
- testUI();
- });
-}
-
-function testUI() {
- ok(gPanel, "Profiler panel exists");
- ok(gPanel.activeProfile, "Active profile exists");
-
- let [win, doc] = getProfileInternals();
- let startButton = doc.querySelector(".controlPane #startWrapper button");
- let stopButton = doc.querySelector(".controlPane #stopWrapper button");
-
- ok(startButton, "Start button exists");
- ok(stopButton, "Stop button exists");
-
- startButton.click();
-}
-
-function onStart() {
- gPanel.controller.isActive(function (err, isActive) {
- ok(isActive, "Profiler is running");
-
- let [win, doc] = getProfileInternals();
- let stopButton = doc.querySelector(".controlPane #stopWrapper button");
-
- setTimeout(function () stopButton.click(), 100);
- });
-}
-
-function onParsed() {
- function assertSample() {
- let [win,doc] = getProfileInternals();
- let sample = doc.getElementsByClassName("samplePercentage");
-
- if (sample.length <= 0) {
- return void setTimeout(assertSample, 100);
- }
-
- ok(sample.length > 0, "We have some items displayed");
- is(sample[0].innerHTML, "100.0%", "First percentage is 100%");
-
- tearDown(gTab, function onTearDown() {
- gPanel = null;
- gTab = null;
- });
- }
-
- assertSample();
-}
diff --git a/browser/devtools/profiler/test/head.js b/browser/devtools/profiler/test/head.js
deleted file mode 100644
index 8833f57cf..000000000
--- a/browser/devtools/profiler/test/head.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let temp = {};
-
-const PROFILER_ENABLED = "devtools.profiler.enabled";
-const REMOTE_ENABLED = "devtools.debugger.remote-enabled";
-const PROFILE_IDLE = 0;
-const PROFILE_RUNNING = 1;
-const PROFILE_COMPLETED = 2;
-
-Cu.import("resource:///modules/devtools/gDevTools.jsm", temp);
-let gDevTools = temp.gDevTools;
-
-Cu.import("resource://gre/modules/devtools/Loader.jsm", temp);
-let TargetFactory = temp.devtools.TargetFactory;
-
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm", temp);
-let DebuggerServer = temp.DebuggerServer;
-
-Cu.import("resource:///modules/HUDService.jsm", temp);
-let HUDService = temp.HUDService;
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
-
-registerCleanupFunction(function () {
- helpers = null;
- Services.prefs.clearUserPref(PROFILER_ENABLED);
- Services.prefs.clearUserPref(REMOTE_ENABLED);
- DebuggerServer.destroy();
-});
-
-function getProfileInternals(uid) {
- let profile = (uid != null) ? gPanel.profiles.get(uid) : gPanel.activeProfile;
- let win = profile.iframe.contentWindow;
- let doc = win.document;
-
- return [win, doc];
-}
-
-function getSidebarItem(uid, panel=gPanel) {
- let profile = panel.profiles.get(uid);
- return panel.sidebar.getItemByProfile(profile);
-}
-
-function sendFromProfile(uid, msg) {
- let [win, doc] = getProfileInternals(uid);
- win.parent.postMessage({ uid: uid, status: msg }, "*");
-}
-
-function loadTab(url, callback) {
- let tab = gBrowser.addTab();
- gBrowser.selectedTab = tab;
- loadUrl(url, tab, callback);
-}
-
-function loadUrl(url, tab, callback) {
- content.location.assign(url);
- let browser = gBrowser.getBrowserForTab(tab);
- if (browser.contentDocument.readyState === "complete") {
- callback(tab, browser);
- return;
- }
-
- let onLoad = function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- callback(tab, browser);
- };
-
- browser.addEventListener("load", onLoad, true);
-}
-
-function openProfiler(tab, callback) {
- let target = TargetFactory.forTab(tab);
- gDevTools.showToolbox(target, "jsprofiler").then(callback);
-}
-
-function openConsole(tab, cb=function(){}) {
- // This function was borrowed from webconsole/test/head.js
- let target = TargetFactory.forTab(tab);
-
- gDevTools.showToolbox(target, "webconsole").then(function (toolbox) {
- let hud = toolbox.getCurrentPanel().hud;
- hud.jsterm._lazyVariablesView = false;
- cb(hud);
- });
-}
-
-function closeProfiler(tab, callback) {
- let target = TargetFactory.forTab(tab);
- let toolbox = gDevTools.getToolbox(target);
- toolbox.destroy().then(callback);
-}
-
-function setUp(url, callback=function(){}) {
- Services.prefs.setBoolPref(PROFILER_ENABLED, true);
-
- loadTab(url, function onTabLoad(tab, browser) {
- openProfiler(tab, function onProfilerOpen() {
- let target = TargetFactory.forTab(tab);
- let panel = gDevTools.getToolbox(target).getPanel("jsprofiler");
- callback(tab, browser, panel);
- });
- });
-}
-
-function tearDown(tab, callback=function(){}) {
- closeProfiler(tab, function onProfilerClose() {
- callback();
-
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-
- finish();
- });
-}
diff --git a/browser/devtools/profiler/test/mock_console_api.html b/browser/devtools/profiler/test/mock_console_api.html
deleted file mode 100644
index 2a626c9aa..000000000
--- a/browser/devtools/profiler/test/mock_console_api.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>console.profile from content</title>
- </head>
-
- <body>
- <script>
- console.profile();
- var a = new Array(500);
- while (a.length) {
- a.shift();
- }
- console.profileEnd();
- </script>
- </body>
-</html> \ No newline at end of file
diff --git a/browser/devtools/profiler/test/mock_profiler_bug_834878_page.html b/browser/devtools/profiler/test/mock_profiler_bug_834878_page.html
deleted file mode 100644
index ad150b98a..000000000
--- a/browser/devtools/profiler/test/mock_profiler_bug_834878_page.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<!DOCTYPE HTML>
-<html>
- <head>
- <meta charset='utf-8'/>
- <title>Profiler Script Linking Test</title>
- <script type="text/javascript" src="mock_profiler_bug_834878_script.js">
- </script>
- </head>
- <body>
- </body>
-</html>
diff --git a/browser/devtools/profiler/test/mock_profiler_bug_834878_script.js b/browser/devtools/profiler/test/mock_profiler_bug_834878_script.js
deleted file mode 100644
index 0ef5f3772..000000000
--- a/browser/devtools/profiler/test/mock_profiler_bug_834878_script.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function main() {
- console.log("Hello, World!");
- return 0;
-} \ No newline at end of file
diff --git a/browser/devtools/profiler/test/moz.build b/browser/devtools/profiler/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/profiler/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/responsivedesign/moz.build b/browser/devtools/responsivedesign/moz.build
index 5abe8b3be..6ecebe123 100644
--- a/browser/devtools/responsivedesign/moz.build
+++ b/browser/devtools/responsivedesign/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/responsivedesign/test/Makefile.in b/browser/devtools/responsivedesign/test/Makefile.in
deleted file mode 100644
index a01d9dba9..000000000
--- a/browser/devtools/responsivedesign/test/Makefile.in
+++ /dev/null
@@ -1,22 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_responsiveui.js \
- browser_responsiveuiaddcustompreset.js \
- browser_responsiveruleview.js \
- browser_responsive_cmd.js \
- browser_responsivecomputedview.js \
- head.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/responsivedesign/test/browser_responsive_cmd.js b/browser/devtools/responsivedesign/test/browser_responsive_cmd.js
deleted file mode 100644
index 5b468e7d9..000000000
--- a/browser/devtools/responsivedesign/test/browser_responsive_cmd.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- function isOpen() {
- return !!gBrowser.selectedTab.__responsiveUI;
- }
-
- helpers.addTabWithToolbar("about:blank", function(options) {
- return helpers.audit(options, [
- {
- setup: "resize toggle",
- check: {
- input: 'resize toggle',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(isOpen(), "responsive mode is open");
- },
- },
- {
- setup: "resize toggle",
- check: {
- input: 'resize toggle',
- hints: '',
- markup: 'VVVVVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(!isOpen(), "responsive mode is closed");
- },
- },
- {
- setup: "resize on",
- check: {
- input: 'resize on',
- hints: '',
- markup: 'VVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(isOpen(), "responsive mode is open");
- },
- },
- {
- setup: "resize off",
- check: {
- input: 'resize off',
- hints: '',
- markup: 'VVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(!isOpen(), "responsive mode is closed");
- },
- },
- {
- setup: "resize to 400 400",
- check: {
- input: 'resize to 400 400',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- width: { value: 400 },
- height: { value: 400 },
- }
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(isOpen(), "responsive mode is open");
- },
- },
- {
- setup: "resize off",
- check: {
- input: 'resize off',
- hints: '',
- markup: 'VVVVVVVVVV',
- status: 'VALID'
- },
- exec: {
- output: ""
- },
- post: function() {
- ok(!isOpen(), "responsive mode is closed");
- },
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/responsivedesign/test/browser_responsivecomputedview.js b/browser/devtools/responsivedesign/test/browser_responsivecomputedview.js
deleted file mode 100644
index 1b51a8b3b..000000000
--- a/browser/devtools/responsivedesign/test/browser_responsivecomputedview.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let instance;
-
- let computedView;
- let inspector;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,<html><style>" +
- "div {" +
- " width: 500px;" +
- " height: 10px;" +
- " background: purple;" +
- "} " +
- "@media screen and (max-width: 200px) {" +
- " div { " +
- " width: 100px;" +
- " }" +
- "};" +
- "</style><div></div></html>"
-
- function computedWidth() {
- for (let prop of computedView.propertyViews) {
- if (prop.name === "width") {
- return prop.valueNode.textContent;
- }
- }
- return null;
- }
-
- function startTest() {
- document.getElementById("Tools:ResponsiveUI").doCommand();
- executeSoon(onUIOpen);
- }
-
- function onUIOpen() {
- instance = gBrowser.selectedTab.__responsiveUI;
- ok(instance, "instance of the module is attached to the tab.");
-
- instance.stack.setAttribute("notransition", "true");
- registerCleanupFunction(function() {
- instance.stack.removeAttribute("notransition");
- });
-
- instance.setSize(500, 500);
-
- openInspector(onInspectorUIOpen);
- }
-
- function onInspectorUIOpen(aInspector) {
- inspector = aInspector;
- ok(inspector, "Got inspector instance");
- inspector.sidebar.select("computedview");
-
- let div = content.document.getElementsByTagName("div")[0];
-
- inspector.sidebar.once("computedview-ready", function() {
- Services.obs.addObserver(testShrink, "StyleInspector-populated", false);
- inspector.selection.setNode(div);
- });
- }
-
- function testShrink() {
- Services.obs.removeObserver(testShrink, "StyleInspector-populated");
-
- computedView = inspector.sidebar.getWindowForTab("computedview").computedview.view;
- ok(computedView, "We have access to the Computed View object");
-
- is(computedWidth(), "500px", "Should show 500px initially.");
-
- Services.obs.addObserver(function onShrink() {
- Services.obs.removeObserver(onShrink, "StyleInspector-populated");
- is(computedWidth(), "100px", "div should be 100px after shrinking.");
- testGrow();
- }, "StyleInspector-populated", false);
-
- instance.setSize(100, 100);
- }
-
- function testGrow() {
- Services.obs.addObserver(function onGrow() {
- Services.obs.removeObserver(onGrow, "StyleInspector-populated");
- is(computedWidth(), "500px", "Should be 500px after growing.");
- finishUp();
- }, "StyleInspector-populated", false);
-
- instance.setSize(500, 500);
- }
-
- function finishUp() {
- document.getElementById("Tools:ResponsiveUI").doCommand();
-
- // Menus are correctly updated?
- is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "false", "menu unchecked");
-
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/responsivedesign/test/browser_responsiveruleview.js b/browser/devtools/responsivedesign/test/browser_responsiveruleview.js
deleted file mode 100644
index 9aeb3147a..000000000
--- a/browser/devtools/responsivedesign/test/browser_responsiveruleview.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let instance;
-
- let ruleView;
- let inspector;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,<html><style>" +
- "div {" +
- " width: 500px;" +
- " height: 10px;" +
- " background: purple;" +
- "} " +
- "@media screen and (max-width: 200px) {" +
- " div { " +
- " width: 100px;" +
- " }" +
- "};" +
- "</style><div></div></html>"
-
- function numberOfRules() {
- return ruleView.element.querySelectorAll(".ruleview-code").length;
- }
-
- function startTest() {
- document.getElementById("Tools:ResponsiveUI").doCommand();
- executeSoon(onUIOpen);
- }
-
- function onUIOpen() {
- instance = gBrowser.selectedTab.__responsiveUI;
- ok(instance, "instance of the module is attached to the tab.");
-
- instance.stack.setAttribute("notransition", "true");
- registerCleanupFunction(function() {
- instance.stack.removeAttribute("notransition");
- });
-
- instance.setSize(500, 500);
-
- openInspector(onInspectorUIOpen);
- }
-
- function onInspectorUIOpen(aInspector) {
- inspector = aInspector;
- ok(inspector, "Got inspector instance");
- inspector.sidebar.select("ruleview");
-
- let div = content.document.getElementsByTagName("div")[0];
-
- inspector.sidebar.once("ruleview-ready", function() {
- Services.obs.addObserver(testShrink, "StyleInspector-populated", false);
- inspector.selection.setNode(div);
- });
- }
-
- function testShrink() {
- Services.obs.removeObserver(testShrink, "StyleInspector-populated");
-
- ruleView = inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
-
- is(numberOfRules(), 2, "Should have two rules initially.");
-
- ruleView.element.addEventListener("CssRuleViewRefreshed", function refresh() {
- ruleView.element.removeEventListener("CssRuleViewRefreshed", refresh, false);
- is(numberOfRules(), 3, "Should have three rules after shrinking.");
- testGrow();
- }, false);
-
- instance.setSize(100, 100);
- }
-
- function testGrow() {
- ruleView.element.addEventListener("CssRuleViewRefreshed", function refresh() {
- ruleView.element.removeEventListener("CssRuleViewRefreshed", refresh, false);
- is(numberOfRules(), 2, "Should have two rules after growing.");
- finishUp();
- }, false);
-
- instance.setSize(500, 500);
- }
-
- function finishUp() {
- document.getElementById("Tools:ResponsiveUI").doCommand();
-
- // Menus are correctly updated?
- is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "false", "menu unchecked");
-
- gBrowser.removeCurrentTab();
- finish();
- }
-}
diff --git a/browser/devtools/responsivedesign/test/browser_responsiveui.js b/browser/devtools/responsivedesign/test/browser_responsiveui.js
deleted file mode 100644
index 47cebfd39..000000000
--- a/browser/devtools/responsivedesign/test/browser_responsiveui.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let instance, widthBeforeClose, heightBeforeClose;
- let mgr = ResponsiveUI.ResponsiveUIManager;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,mop";
-
- function startTest() {
- document.getElementById("Tools:ResponsiveUI").removeAttribute("disabled");
- mgr.once("on", function() {executeSoon(onUIOpen)});
- synthesizeKeyFromKeyTag("key_responsiveUI");
- }
-
- function onUIOpen() {
- // Is it open?
- let container = gBrowser.getBrowserContainer();
- is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
-
- // Menus are correctly updated?
- is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "true", "menus checked");
-
- instance = gBrowser.selectedTab.__responsiveUI;
- ok(instance, "instance of the module is attached to the tab.");
-
- if (instance._floatingScrollbars) {
- ensureScrollbarsAreFloating();
- }
-
- instance.transitionsEnabled = false;
-
- testPresets();
- }
-
- function ensureScrollbarsAreFloating() {
- let body = gBrowser.contentDocument.body;
- let html = gBrowser.contentDocument.documentElement;
-
- let originalWidth = body.getBoundingClientRect().width;
-
- html.style.overflowY = "scroll"; // Force scrollbars
- // Flush. Should not be needed as getBoundingClientRect() should flush,
- // but just in case.
- gBrowser.contentWindow.getComputedStyle(html).overflowY;
- let newWidth = body.getBoundingClientRect().width;
- is(originalWidth, newWidth, "Floating scrollbars are presents");
- }
-
- function testPresets() {
- function testOnePreset(c) {
- if (c == 0) {
- executeSoon(testCustom);
- return;
- }
- instance.menulist.selectedIndex = c;
- let item = instance.menulist.firstChild.childNodes[c];
- let [width, height] = extractSizeFromString(item.getAttribute("label"));
- is(content.innerWidth, width, "preset " + c + ": dimension valid (width)");
- is(content.innerHeight, height, "preset " + c + ": dimension valid (height)");
-
- testOnePreset(c - 1);
- }
- // Starting from length - 4 because last 3 items are not presets : separator, addbutton and removebutton
- testOnePreset(instance.menulist.firstChild.childNodes.length - 4);
- }
-
- function extractSizeFromString(str) {
- let numbers = str.match(/(\d+)[^\d]*(\d+)/);
- if (numbers) {
- return [numbers[1], numbers[2]];
- } else {
- return [null, null];
- }
- }
-
- function testCustom() {
- let initialWidth = content.innerWidth;
- let initialHeight = content.innerHeight;
-
- let x = 2, y = 2;
- EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousedown"}, window);
- x += 20; y += 10;
- EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mousemove"}, window);
- EventUtils.synthesizeMouse(instance.resizer, x, y, {type: "mouseup"}, window);
-
- let expectedWidth = initialWidth + 20;
- let expectedHeight = initialHeight + 10;
- info("initial width: " + initialWidth);
- info("initial height: " + initialHeight);
- is(content.innerWidth, expectedWidth, "Size correcty updated (width).");
- is(content.innerHeight, expectedHeight, "Size correcty updated (height).");
- is(instance.menulist.selectedIndex, 0, "Custom menuitem selected");
- let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
- is(width, expectedWidth, "Label updated (width).");
- is(height, expectedHeight, "Label updated (height).");
- rotate();
- }
-
- function rotate() {
- let initialWidth = content.innerWidth;
- let initialHeight = content.innerHeight;
-
- info("rotate");
- instance.rotate();
-
- is(content.innerWidth, initialHeight, "The width is now the height.");
- is(content.innerHeight, initialWidth, "The height is now the width.");
- let [width, height] = extractSizeFromString(instance.menulist.firstChild.firstChild.getAttribute("label"));
- is(width, initialHeight, "Label updated (width).");
- is(height, initialWidth, "Label updated (height).");
-
- widthBeforeClose = content.innerWidth;
- heightBeforeClose = content.innerHeight;
-
- info("XXX BUG 851296: instance.closing: " + !!instance.closing);
-
- mgr.once("off", function() {
- info("XXX BUG 851296: 'off' received.");
- executeSoon(restart);
- });
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- }
-
- function restart() {
- info("XXX BUG 851296: restarting.");
- info("XXX BUG 851296: __responsiveUI: " + gBrowser.selectedTab.__responsiveUI);
- mgr.once("on", function() {
- info("XXX BUG 851296: 'on' received.");
- executeSoon(onUIOpen2);
- });
- //XXX BUG 851296: synthesizeKeyFromKeyTag("key_responsiveUI");
- mgr.toggle(window, gBrowser.selectedTab);
- info("XXX BUG 851296: restart() finished.");
- }
-
- function onUIOpen2() {
- info("XXX BUG 851296: onUIOpen2.");
- let container = gBrowser.getBrowserContainer();
- is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
-
- // Menus are correctly updated?
- is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "true", "menus checked");
-
- is(content.innerWidth, widthBeforeClose, "width restored.");
- is(content.innerHeight, heightBeforeClose, "height restored.");
-
- mgr.once("off", function() {executeSoon(finishUp)});
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- }
-
- function finishUp() {
-
- // Menus are correctly updated?
- is(document.getElementById("Tools:ResponsiveUI").getAttribute("checked"), "false", "menu unchecked");
-
- delete instance;
- gBrowser.removeCurrentTab();
- finish();
- }
-
- function synthesizeKeyFromKeyTag(aKeyId) {
- let key = document.getElementById(aKeyId);
- isnot(key, null, "Successfully retrieved the <key> node");
-
- let modifiersAttr = key.getAttribute("modifiers");
-
- let name = null;
-
- if (key.getAttribute("keycode"))
- name = key.getAttribute("keycode");
- else if (key.getAttribute("key"))
- name = key.getAttribute("key");
-
- isnot(name, null, "Successfully retrieved keycode/key");
-
- let modifiers = {
- shiftKey: modifiersAttr.match("shift"),
- ctrlKey: modifiersAttr.match("ctrl"),
- altKey: modifiersAttr.match("alt"),
- metaKey: modifiersAttr.match("meta"),
- accelKey: modifiersAttr.match("accel")
- }
-
- info("XXX BUG 851296: key name: " + name);
- info("XXX BUG 851296: key modifiers: " + JSON.stringify(modifiers));
- EventUtils.synthesizeKey(name, modifiers);
- }
-}
diff --git a/browser/devtools/responsivedesign/test/browser_responsiveuiaddcustompreset.js b/browser/devtools/responsivedesign/test/browser_responsiveuiaddcustompreset.js
deleted file mode 100644
index cba6f4fe7..000000000
--- a/browser/devtools/responsivedesign/test/browser_responsiveuiaddcustompreset.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- let instance, deletedPresetA, deletedPresetB, oldPrompt;
- let mgr = ResponsiveUI.ResponsiveUIManager;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload() {
- gBrowser.selectedBrowser.removeEventListener("load", onload, true);
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html;charset=utf8,test custom presets in responsive mode";
-
- // This test uses executeSoon() when responsive mode is initialized and when
- // it is destroyed such that we get out of the init/destroy loops. If we try
- // to init/destroy immediately, without waiting for the next loop, we get
- // intermittent test failures.
-
- function startTest() {
- // Mocking prompt
- oldPrompt = Services.prompt;
- Services.prompt = {
- value: "",
- returnBool: true,
- prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
- aValue.value = this.value;
- return this.returnBool;
- }
- };
-
- registerCleanupFunction(() => Services.prompt = oldPrompt);
-
- info("test started, waiting for responsive mode to activate");
-
- document.getElementById("Tools:ResponsiveUI").removeAttribute("disabled");
- mgr.once("on", onUIOpen);
- synthesizeKeyFromKeyTag("key_responsiveUI");
- }
-
- function onUIOpen() {
- // Is it open?
- let container = gBrowser.getBrowserContainer();
- is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
-
- instance = gBrowser.selectedTab.__responsiveUI;
- ok(instance, "instance of the module is attached to the tab.");
-
- instance.transitionsEnabled = false;
-
- testAddCustomPreset();
- }
-
- function testAddCustomPreset() {
- // Tries to add a custom preset and cancel the prompt
- let idx = instance.menulist.selectedIndex;
- let presetCount = instance.presets.length;
-
- Services.prompt.value = "";
- Services.prompt.returnBool = false;
- instance.addbutton.doCommand();
-
- is(idx, instance.menulist.selectedIndex, "selected item didn't change after add preset and cancel");
- is(presetCount, instance.presets.length, "number of presets didn't change after add preset and cancel");
-
- let customHeight = 123, customWidth = 456;
- instance.setSize(customWidth, customHeight);
-
- // Adds the custom preset with "Testing preset"
- Services.prompt.value = "Testing preset";
- Services.prompt.returnBool = true;
- instance.addbutton.doCommand();
-
- instance.menulist.selectedIndex = 1;
-
- info("waiting for responsive mode to turn off");
- mgr.once("off", restart);
-
- // Force document reflow to avoid intermittent failures.
- info("document height " + document.height);
-
- // We're still in the loop of initializing the responsive mode.
- // Let's wait next loop to stop it.
- executeSoon(function() {
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- });
- }
-
- function restart() {
- info("Restarting Responsive Mode");
- mgr.once("on", function() {
- let container = gBrowser.getBrowserContainer();
- is(container.getAttribute("responsivemode"), "true", "In responsive mode.");
-
- instance = gBrowser.selectedTab.__responsiveUI;
-
- testCustomPresetInList();
- });
-
- // We're still in the loop of destroying the responsive mode.
- // Let's wait next loop to start it.
- executeSoon(function() {
- synthesizeKeyFromKeyTag("key_responsiveUI");
- });
- }
-
- function testCustomPresetInList() {
- let customPresetIndex = getPresetIndex("456x123 (Testing preset)");
- ok(customPresetIndex >= 0, "is the previously added preset (idx = " + customPresetIndex + ") in the list of items");
-
- instance.menulist.selectedIndex = customPresetIndex;
-
- is(content.innerWidth, 456, "add preset, and selected in the list, dimension valid (width)");
- is(content.innerHeight, 123, "add preset, and selected in the list, dimension valid (height)");
-
- testDeleteCustomPresets();
- }
-
- function testDeleteCustomPresets() {
- instance.removebutton.doCommand();
-
- instance.menulist.selectedIndex = 2;
- deletedPresetA = instance.menulist.selectedItem.getAttribute("label");
- instance.removebutton.doCommand();
-
- instance.menulist.selectedIndex = 2;
- deletedPresetB = instance.menulist.selectedItem.getAttribute("label");
- instance.removebutton.doCommand();
-
- info("waiting for responsive mode to turn off");
- mgr.once("off", restartAgain);
-
- // We're still in the loop of initializing the responsive mode.
- // Let's wait next loop to stop it.
- executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {}));
- }
-
- function restartAgain() {
- info("waiting for responsive mode to turn on");
- mgr.once("on", () => {
- instance = gBrowser.selectedTab.__responsiveUI;
- testCustomPresetsNotInListAnymore();
- });
-
- // We're still in the loop of destroying the responsive mode.
- // Let's wait next loop to start it.
- executeSoon(() => synthesizeKeyFromKeyTag("key_responsiveUI"));
- }
-
- function testCustomPresetsNotInListAnymore() {
- let customPresetIndex = getPresetIndex(deletedPresetA);
- is(customPresetIndex, -1, "deleted preset " + deletedPresetA + " is not in the list anymore");
-
- customPresetIndex = getPresetIndex(deletedPresetB);
- is(customPresetIndex, -1, "deleted preset " + deletedPresetB + " is not in the list anymore");
-
- executeSoon(finishUp);
- }
-
- function finishUp() {
- delete instance;
- gBrowser.removeCurrentTab();
-
- finish();
- }
-
- function getPresetIndex(presetLabel) {
- function testOnePreset(c) {
- if (c == 0) {
- return -1;
- }
- instance.menulist.selectedIndex = c;
-
- let item = instance.menulist.firstChild.childNodes[c];
- if (item.getAttribute("label") === presetLabel) {
- return c;
- } else {
- return testOnePreset(c - 1);
- }
- }
- return testOnePreset(instance.menulist.firstChild.childNodes.length - 4);
- }
-
- function synthesizeKeyFromKeyTag(aKeyId) {
- let key = document.getElementById(aKeyId);
- isnot(key, null, "Successfully retrieved the <key> node");
-
- let name = null;
-
- if (key.getAttribute("keycode"))
- name = key.getAttribute("keycode");
- else if (key.getAttribute("key"))
- name = key.getAttribute("key");
-
- isnot(name, null, "Successfully retrieved keycode/key");
-
- key.doCommand();
- }
-}
diff --git a/browser/devtools/responsivedesign/test/head.js b/browser/devtools/responsivedesign/test/head.js
deleted file mode 100644
index c357f1a8a..000000000
--- a/browser/devtools/responsivedesign/test/head.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let {devtools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
-
-function openInspector(callback)
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- callback(toolbox.getCurrentPanel());
- });
-}
-
diff --git a/browser/devtools/responsivedesign/test/moz.build b/browser/devtools/responsivedesign/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/responsivedesign/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/scratchpad/moz.build b/browser/devtools/scratchpad/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/scratchpad/moz.build
+++ b/browser/devtools/scratchpad/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/scratchpad/test/Makefile.in b/browser/devtools/scratchpad/test/Makefile.in
deleted file mode 100644
index e74af132a..000000000
--- a/browser/devtools/scratchpad/test/Makefile.in
+++ /dev/null
@@ -1,44 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_scratchpad_initialization.js \
- browser_scratchpad_contexts.js \
- browser_scratchpad_tab_switch.js \
- browser_scratchpad_execute_print.js \
- browser_scratchpad_inspect.js \
- browser_scratchpad_files.js \
- browser_scratchpad_ui.js \
- browser_scratchpad_bug_646070_chrome_context_pref.js \
- browser_scratchpad_bug_660560_tab.js \
- browser_scratchpad_open.js \
- browser_scratchpad_restore.js \
- browser_scratchpad_bug_679467_falsy.js \
- browser_scratchpad_bug_699130_edit_ui_updates.js \
- browser_scratchpad_bug_669612_unsaved.js \
- browser_scratchpad_bug684546_reset_undo.js \
- browser_scratchpad_bug690552_display_outputs_errors.js \
- browser_scratchpad_bug650345_find_ui.js \
- browser_scratchpad_bug714942_goto_line_ui.js \
- browser_scratchpad_bug_650760_help_key.js \
- browser_scratchpad_bug_651942_recent_files.js \
- browser_scratchpad_bug756681_display_non_error_exceptions.js \
- browser_scratchpad_bug_751744_revert_to_saved.js \
- browser_scratchpad_bug740948_reload_and_run.js \
- browser_scratchpad_bug_661762_wrong_window_focus.js \
- browser_scratchpad_bug_644413_modeline.js \
- head.js \
-
-# Disable test due to bug 807234 becoming basically permanent
-# browser_scratchpad_bug_653427_confirm_close.js \
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug650345_find_ui.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug650345_find_ui.js
deleted file mode 100644
index 81e45aeef..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug650345_find_ui.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test the Find feature in Scratchpad";
-}
-
-function runTests(aWindow, aScratchpad)
-{
- let editor = aScratchpad.editor;
- let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
- editor.setText(text);
-
- let needle = "foobar";
- editor.setSelection(0, needle.length);
-
- let oldPrompt = Services.prompt;
- Services.prompt = {
- prompt: function() { return true; },
- };
-
- let findKey = "F";
- info("test Ctrl/Cmd-" + findKey + " (find)");
- EventUtils.synthesizeKey(findKey, {accelKey: true}, aWindow);
- let selection = editor.getSelection();
- let newIndex = text.indexOf(needle, needle.length);
- is(selection.start, newIndex, "selection.start is correct");
- is(selection.end, newIndex + needle.length, "selection.end is correct");
-
- info("test cmd_find");
- aWindow.goDoCommand("cmd_find");
- selection = editor.getSelection();
- is(selection.start, 0, "selection.start is correct");
- is(selection.end, needle.length, "selection.end is correct");
-
- let findNextKey = Services.appinfo.OS == "Darwin" ? "G" : "VK_F3";
- let findNextKeyOptions = Services.appinfo.OS == "Darwin" ?
- {accelKey: true} : {};
-
- info("test " + findNextKey + " (findNext)");
- EventUtils.synthesizeKey(findNextKey, findNextKeyOptions, aWindow);
- selection = editor.getSelection();
- is(selection.start, newIndex, "selection.start is correct");
- is(selection.end, newIndex + needle.length, "selection.end is correct");
-
- info("test cmd_findAgain");
- aWindow.goDoCommand("cmd_findAgain");
- selection = editor.getSelection();
- is(selection.start, 0, "selection.start is correct");
- is(selection.end, needle.length, "selection.end is correct");
-
- let findPreviousKey = Services.appinfo.OS == "Darwin" ? "G" : "VK_F3";
- let findPreviousKeyOptions = Services.appinfo.OS == "Darwin" ?
- {accelKey: true, shiftKey: true} : {shiftKey: true};
-
- info("test " + findPreviousKey + " (findPrevious)");
- EventUtils.synthesizeKey(findPreviousKey, findPreviousKeyOptions, aWindow);
- selection = editor.getSelection();
- is(selection.start, newIndex, "selection.start is correct");
- is(selection.end, newIndex + needle.length, "selection.end is correct");
-
- info("test cmd_findPrevious");
- aWindow.goDoCommand("cmd_findPrevious");
- selection = editor.getSelection();
- is(selection.start, 0, "selection.start is correct");
- is(selection.end, needle.length, "selection.end is correct");
-
- needle = "BAZbaz";
- newIndex = text.toLowerCase().indexOf(needle.toLowerCase());
-
- Services.prompt = {
- prompt: function(aWindow, aTitle, aMessage, aValue) {
- aValue.value = needle;
- return true;
- },
- };
-
- info("test Ctrl/Cmd-" + findKey + " (find) with a custom value");
- EventUtils.synthesizeKey(findKey, {accelKey: true}, aWindow);
- selection = editor.getSelection();
- is(selection.start, newIndex, "selection.start is correct");
- is(selection.end, newIndex + needle.length, "selection.end is correct");
-
- Services.prompt = oldPrompt;
-
- finish();
-}
-
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug684546_reset_undo.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug684546_reset_undo.js
deleted file mode 100644
index d4ec88012..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug684546_reset_undo.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
-// Reference to the Scratchpad object.
-let gScratchpad;
-
-// Reference to the temporary nsIFile we will work with.
-let gFileA;
-let gFileB;
-
-// The temporary file content.
-let gFileAContent = "// File A ** Hello World!";
-let gFileBContent = "// File B ** Goodbye All";
-
-// Help track if one or both files are saved
-let gFirstFileSaved = false;
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test that undo get's reset after file load in Scratchpad";
-}
-
-function runTests()
-{
- gScratchpad = gScratchpadWindow.Scratchpad;
-
- // Create a temporary file.
- gFileA = FileUtils.getFile("TmpD", ["fileAForBug684546.tmp"]);
- gFileA.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
-
- gFileB = FileUtils.getFile("TmpD", ["fileBForBug684546.tmp"]);
- gFileB.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
-
- // Write the temporary file.
- let foutA = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- foutA.init(gFileA.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- 0644, foutA.DEFER_OPEN);
-
- let foutB = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- foutB.init(gFileB.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- 0644, foutB.DEFER_OPEN);
-
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
- createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let fileContentStreamA = converter.convertToInputStream(gFileAContent);
- let fileContentStreamB = converter.convertToInputStream(gFileBContent);
-
- NetUtil.asyncCopy(fileContentStreamA, foutA, tempFileSaved);
- NetUtil.asyncCopy(fileContentStreamB, foutB, tempFileSaved);
-}
-
-function tempFileSaved(aStatus)
-{
- let success = Components.isSuccessCode(aStatus);
-
- ok(success, "a temporary file was saved successfully");
-
- if (!success)
- {
- finish();
- return;
- }
-
- if (gFirstFileSaved && success)
- {
- ok((gFirstFileSaved && success), "Both files loaded");
- // Import the file A into Scratchpad.
- gScratchpad.importFromFile(gFileA.QueryInterface(Ci.nsILocalFile), true,
- fileAImported);
- }
- gFirstFileSaved = success;
-}
-
-function fileAImported(aStatus, aFileContent)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file A was imported successfully with Scratchpad");
-
- is(aFileContent, gFileAContent, "received data is correct");
-
- is(gScratchpad.getText(), gFileAContent, "the editor content is correct");
-
- gScratchpad.setText("new text", gScratchpad.getText().length);
-
- is(gScratchpad.getText(), gFileAContent + "new text", "text updated correctly");
- gScratchpad.undo();
- is(gScratchpad.getText(), gFileAContent, "undo works");
- gScratchpad.redo();
- is(gScratchpad.getText(), gFileAContent + "new text", "redo works");
-
- // Import the file B into Scratchpad.
- gScratchpad.importFromFile(gFileB.QueryInterface(Ci.nsILocalFile), true,
- fileBImported);
-}
-
-function fileBImported(aStatus, aFileContent)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file B was imported successfully with Scratchpad");
-
- is(aFileContent, gFileBContent, "received data is correct");
-
- is(gScratchpad.getText(), gFileBContent, "the editor content is correct");
-
- ok(!gScratchpad.editor.canUndo(), "editor cannot undo after load");
-
- gScratchpad.undo();
- is(gScratchpad.getText(), gFileBContent,
- "the editor content is still correct after undo");
-
- gScratchpad.setText("new text", gScratchpad.getText().length);
- is(gScratchpad.getText(), gFileBContent + "new text", "text updated correctly");
-
- gScratchpad.undo();
- is(gScratchpad.getText(), gFileBContent, "undo works");
- ok(!gScratchpad.editor.canUndo(), "editor cannot undo after load (again)");
-
- gScratchpad.redo();
- is(gScratchpad.getText(), gFileBContent + "new text", "redo works");
-
- // Done!
- finish();
-}
-
-registerCleanupFunction(function() {
- if (gFileA && gFileA.exists())
- {
- gFileA.remove(false);
- gFileA = null;
- }
- if (gFileB && gFileB.exists())
- {
- gFileB.remove(false);
- gFileB = null;
- }
- gScratchpad = null;
-});
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js
deleted file mode 100644
index 637af088e..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
- openScratchpad(runTests, {"state":{"text":""}});
- }, true);
-
- content.location = "data:text/html,<p>test that exceptions our output as " +
- "comments for 'display' and not sent to the console in Scratchpad";
-}
-
-function runTests()
-{
- let scratchpad = gScratchpadWindow.Scratchpad;
-
- let message = "\"Hello World!\""
- let openComment = "\n/*\n";
- let closeComment = "\n*/";
- let error = "throw new Error(\"Ouch!\")";
-
- let tests = [{
- method: "display",
- code: message,
- result: message + openComment + "Hello World!" + closeComment,
- label: "message display output"
- },
- {
- method: "display",
- code: error,
- result: error + openComment + "Exception: Ouch!\n@" +
- scratchpad.uniqueName + ":1" + closeComment,
- label: "error display output",
- },
- {
- method: "run",
- code: message,
- result: message,
- label: "message run output",
- },
- {
- method: "run",
- code: error,
- result: error + openComment + "Exception: Ouch!\n@" +
- scratchpad.uniqueName + ":1" + closeComment,
- label: "error run output",
- }];
-
- runAsyncTests(scratchpad, tests).then(finish);
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug714942_goto_line_ui.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug714942_goto_line_ui.js
deleted file mode 100644
index 5cbc344db..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug714942_goto_line_ui.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test the 'Jump to line' feature in Scratchpad";
-}
-
-function runTests(aWindow, aScratchpad)
-{
- let editor = aScratchpad.editor;
- let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
- editor.setText(text);
- editor.setCaretOffset(0);
-
- let oldPrompt = Services.prompt;
- let desiredValue = null;
- Services.prompt = {
- prompt: function(aWindow, aTitle, aMessage, aValue) {
- aValue.value = desiredValue;
- return true;
- },
- };
-
- desiredValue = 3;
- EventUtils.synthesizeKey("J", {accelKey: true}, aWindow);
- is(editor.getCaretOffset(), 34, "caret offset is correct");
-
- desiredValue = 2;
- aWindow.goDoCommand("cmd_gotoLine")
- is(editor.getCaretOffset(), 17, "caret offset is correct (again)");
-
- Services.prompt = oldPrompt;
-
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug740948_reload_and_run.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug740948_reload_and_run.js
deleted file mode 100644
index 354ccbf75..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug740948_reload_and_run.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
-let EDITOR_TEXT = [
- "var evt = new CustomEvent('foo', { bubbles: true });",
- "document.body.innerHTML = 'Modified text';",
- "window.dispatchEvent(evt);"
-].join("\n");
-
-function test()
-{
- waitForExplicitFinish();
- Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,Scratchpad test for bug 740948";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- ok(sp, "Scratchpad object exists in new window");
-
- // Test that Reload And Run command is enabled in the content
- // context and disabled in the browser context.
-
- let reloadAndRun = gScratchpadWindow.document.
- getElementById("sp-cmd-reloadAndRun");
- ok(reloadAndRun, "Reload And Run command exists");
- ok(!reloadAndRun.hasAttribute("disabled"),
- "Reload And Run command is enabled");
-
- sp.setBrowserContext();
- ok(reloadAndRun.hasAttribute("disabled"),
- "Reload And Run command is disabled in the browser context.");
-
- // Switch back to the content context and run our predefined
- // code. This code modifies the body of our document and dispatches
- // a custom event 'foo'. We listen to that event and check the
- // body to make sure that the page has been reloaded and Scratchpad
- // code has been executed.
-
- sp.setContentContext();
- sp.setText(EDITOR_TEXT);
-
- let browser = gBrowser.selectedBrowser;
-
- browser.addEventListener("DOMWindowCreated", function onWindowCreated() {
- browser.removeEventListener("DOMWindowCreated", onWindowCreated, true);
-
- browser.contentWindow.addEventListener("foo", function onFoo() {
- browser.contentWindow.removeEventListener("foo", onFoo, true);
-
- is(browser.contentWindow.document.body.innerHTML, "Modified text",
- "After reloading, HTML is different.");
-
- Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
- finish();
- }, true);
- }, true);
-
- ok(browser.contentWindow.document.body.innerHTML !== "Modified text",
- "Before reloading, HTML is intact.");
- sp.reloadAndRun();
-}
-
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug756681_display_non_error_exceptions.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug756681_display_non_error_exceptions.js
deleted file mode 100644
index 894af5ffd..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug756681_display_non_error_exceptions.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function browserLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", browserLoad, true);
- openScratchpad(runTests, {"state":{"text":""}});
- }, true);
-
- content.location = "data:text/html, test that exceptions are output as " +
- "comments correctly in Scratchpad";
-}
-
-function runTests()
-{
- var scratchpad = gScratchpadWindow.Scratchpad;
-
- var message = "\"Hello World!\""
- var openComment = "\n/*\n";
- var closeComment = "\n*/";
- var error1 = "throw new Error(\"Ouch!\")";
- var error2 = "throw \"A thrown string\"";
- var error3 = "throw {}";
- var error4 = "document.body.appendChild(document.body)";
-
- let tests = [{
- // Display message
- method: "display",
- code: message,
- result: message + openComment + "Hello World!" + closeComment,
- label: "message display output"
- },
- {
- // Display error1, throw new Error("Ouch")
- method: "display",
- code: error1,
- result: error1 + openComment +
- "Exception: Ouch!\n@" + scratchpad.uniqueName + ":1" + closeComment,
- label: "error display output"
- },
- {
- // Display error2, throw "A thrown string"
- method: "display",
- code: error2,
- result: error2 + openComment + "Exception: A thrown string" + closeComment,
- label: "thrown string display output"
- },
- {
- // Display error3, throw {}
- method: "display",
- code: error3,
- result: error3 + openComment + "Exception: [object Object]" + closeComment,
- label: "thrown object display output"
- },
- {
- // Display error4, document.body.appendChild(document.body)
- method: "display",
- code: error4,
- result: error4 + openComment + "Exception: Node cannot be inserted " +
- "at the specified point in the hierarchy\n@1" + closeComment,
- label: "Alternative format error display output"
- },
- {
- // Run message
- method: "run",
- code: message,
- result: message,
- label: "message run output"
- },
- {
- // Run error1, throw new Error("Ouch")
- method: "run",
- code: error1,
- result: error1 + openComment +
- "Exception: Ouch!\n@" + scratchpad.uniqueName + ":1" + closeComment,
- label: "error run output"
- },
- {
- // Run error2, throw "A thrown string"
- method: "run",
- code: error2,
- result: error2 + openComment + "Exception: A thrown string" + closeComment,
- label: "thrown string run output"
- },
- {
- // Run error3, throw {}
- method: "run",
- code: error3,
- result: error3 + openComment + "Exception: [object Object]" + closeComment,
- label: "thrown object run output"
- },
- {
- // Run error4, document.body.appendChild(document.body)
- method: "run",
- code: error4,
- result: error4 + openComment + "Exception: Node cannot be inserted " +
- "at the specified point in the hierarchy\n@1" + closeComment,
- label: "Alternative format error run output"
- }];
-
- runAsyncTests(scratchpad, tests).then(finish);
-} \ No newline at end of file
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js
deleted file mode 100644
index 54d5e835a..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_644413_modeline.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-
-
-let gScratchpad; // Reference to the Scratchpad object.
-let gFile; // Reference to the temporary nsIFile we will work with.
-let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
-
-// The temporary file content.
-let gFileContent = "function main() { return 0; }";
-
-function test() {
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test file open and save in Scratchpad";
-}
-
-function runTests() {
- gScratchpad = gScratchpadWindow.Scratchpad;
- function size(obj) { return Object.keys(obj).length; }
-
- // Test Scratchpad._scanModeLine method.
- let obj = gScratchpad._scanModeLine();
- is(size(obj), 0, "Mode-line object has no properties");
-
- obj = gScratchpad._scanModeLine("/* This is not a mode-line comment */");
- is(size(obj), 0, "Mode-line object has no properties");
-
- obj = gScratchpad._scanModeLine("/* -sp-context:browser */");
- is(size(obj), 1, "Mode-line object has one property");
- is(obj["-sp-context"], "browser");
-
- obj = gScratchpad._scanModeLine("/* -sp-context: browser */");
- is(size(obj), 1, "Mode-line object has one property");
- is(obj["-sp-context"], "browser");
-
- obj = gScratchpad._scanModeLine("// -sp-context: browser");
- is(size(obj), 1, "Mode-line object has one property");
- is(obj["-sp-context"], "browser");
-
- obj = gScratchpad._scanModeLine("/* -sp-context:browser, other:true */");
- is(size(obj), 2, "Mode-line object has two properties");
- is(obj["-sp-context"], "browser");
- is(obj["other"], "true");
-
- // Test importing files with a mode-line in them.
- let content = "/* -sp-context:browser */\n" + gFileContent;
- createTempFile("fileForBug644413.tmp", content, function(aStatus, aFile) {
- ok(Components.isSuccessCode(aStatus), "File was saved successfully");
-
- gFile = aFile;
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true, fileImported);
- });
-}
-
-function fileImported(status, content) {
- ok(Components.isSuccessCode(status), "File was imported successfully");
-
- // Since devtools.chrome.enabled is off, Scratchpad should still be in
- // the content context.
- is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT);
-
- // Set the pref and try again.
- Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
-
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true, function(status, content) {
- ok(Components.isSuccessCode(status), "File was imported successfully");
- is(gScratchpad.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER);
-
- gFile.remove(false);
- gFile = null;
- gScratchpad = null;
- finish();
- });
-}
-
-registerCleanupFunction(function () {
- Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
-}); \ No newline at end of file
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js
deleted file mode 100644
index 28f6b08fe..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
-
-function test()
-{
- waitForExplicitFinish();
-
- Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- ok(window.Scratchpad, "Scratchpad variable exists");
-
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,Scratchpad test for bug 646070 - chrome context preference";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- ok(sp, "Scratchpad object exists in new window");
-
- let environmentMenu = gScratchpadWindow.document.
- getElementById("sp-environment-menu");
- ok(environmentMenu, "Environment menu element exists");
- ok(!environmentMenu.hasAttribute("hidden"),
- "Environment menu is visible");
-
- let errorConsoleCommand = gScratchpadWindow.document.
- getElementById("sp-cmd-errorConsole");
- ok(errorConsoleCommand, "Error console command element exists");
- ok(!errorConsoleCommand.hasAttribute("disabled"),
- "Error console command is enabled");
-
- let chromeContextCommand = gScratchpadWindow.document.
- getElementById("sp-cmd-browserContext");
- ok(chromeContextCommand, "Chrome context command element exists");
- ok(!chromeContextCommand.hasAttribute("disabled"),
- "Chrome context command is disabled");
-
- Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
-
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_650760_help_key.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_650760_help_key.js
deleted file mode 100644
index faf5d2994..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_650760_help_key.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- content.location = "data:text/html,Test keybindings for opening Scratchpad MDN Documentation, bug 650760";
- gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
-
- ok(window.Scratchpad, "Scratchpad variable exists");
-
- openScratchpad(runTest);
- }, true);
-}
-
-function runTest()
-{
- let sp = gScratchpadWindow.Scratchpad;
- ok(sp, "Scratchpad object exists in new window");
- ok(sp.editor.hasFocus(), "the editor has focus");
-
- let keyid = gScratchpadWindow.document.getElementById("key_openHelp");
- let modifiers = keyid.getAttribute("modifiers");
-
- let key = null;
- if (keyid.getAttribute("keycode"))
- key = keyid.getAttribute("keycode");
-
- else if (keyid.getAttribute("key"))
- key = keyid.getAttribute("key");
-
- isnot(key, null, "Successfully retrieved keycode/key");
-
- var aEvent = {
- shiftKey: modifiers.match("shift"),
- ctrlKey: modifiers.match("ctrl"),
- altKey: modifiers.match("alt"),
- metaKey: modifiers.match("meta"),
- accelKey: modifiers.match("accel")
- }
-
- info("check that the MDN page is opened on \"F1\"");
- let linkClicked = false;
- sp.openDocumentationPage = function(event) { linkClicked = true; };
-
- EventUtils.synthesizeKey(key, aEvent, gScratchpadWindow);
-
- is(linkClicked, true, "MDN page will open");
- finishTest();
-}
-
-function finishTest()
-{
- gScratchpadWindow.close();
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js
deleted file mode 100644
index 3ab397650..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js
+++ /dev/null
@@ -1,355 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-
-// Reference to the Scratchpad object.
-let gScratchpad;
-
-// References to the temporary nsIFiles.
-let gFile01;
-let gFile02;
-let gFile03;
-let gFile04;
-
-// lists of recent files.
-var lists = {
- recentFiles01: null,
- recentFiles02: null,
- recentFiles03: null,
- recentFiles04: null,
-};
-
-// Temporary file names.
-let gFileName01 = "file01_ForBug651942.tmp"
-let gFileName02 = "☕" // See bug 783858 for more information
-let gFileName03 = "file03_ForBug651942.tmp"
-let gFileName04 = "file04_ForBug651942.tmp"
-
-// Content for the temporary files.
-let gFileContent;
-let gFileContent01 = "hello.world.01('bug651942');";
-let gFileContent02 = "hello.world.02('bug651942');";
-let gFileContent03 = "hello.world.03('bug651942');";
-let gFileContent04 = "hello.world.04('bug651942');";
-
-function startTest()
-{
- gScratchpad = gScratchpadWindow.Scratchpad;
-
- gFile01 = createAndLoadTemporaryFile(gFile01, gFileName01, gFileContent01);
- gFile02 = createAndLoadTemporaryFile(gFile02, gFileName02, gFileContent02);
- gFile03 = createAndLoadTemporaryFile(gFile03, gFileName03, gFileContent03);
-}
-
-// Test to see if the three files we created in the 'startTest()'-method have
-// been added to the list of recent files.
-function testAddedToRecent()
-{
- lists.recentFiles01 = gScratchpad.getRecentFiles();
-
- is(lists.recentFiles01.length, 3,
- "Temporary files created successfully and added to list of recent files.");
-
- // Create a 4th file, this should clear the oldest file.
- gFile04 = createAndLoadTemporaryFile(gFile04, gFileName04, gFileContent04);
-}
-
-// We have opened a 4th file. Test to see if the oldest recent file was removed,
-// and that the other files were reordered successfully.
-function testOverwriteRecent()
-{
- lists.recentFiles02 = gScratchpad.getRecentFiles();
-
- is(lists.recentFiles02[0], lists.recentFiles01[1],
- "File02 was reordered successfully in the 'recent files'-list.");
- is(lists.recentFiles02[1], lists.recentFiles01[2],
- "File03 was reordered successfully in the 'recent files'-list.");
- isnot(lists.recentFiles02[2], lists.recentFiles01[2],
- "File04: was added successfully.");
-
- // Open the oldest recent file.
- gScratchpad.openFile(0);
-}
-
-// We have opened the "oldest"-recent file. Test to see if it is now the most
-// recent file, and that the other files were reordered successfully.
-function testOpenOldestRecent()
-{
- lists.recentFiles03 = gScratchpad.getRecentFiles();
-
- is(lists.recentFiles02[0], lists.recentFiles03[2],
- "File04 was reordered successfully in the 'recent files'-list.");
- is(lists.recentFiles02[1], lists.recentFiles03[0],
- "File03 was reordered successfully in the 'recent files'-list.");
- is(lists.recentFiles02[2], lists.recentFiles03[1],
- "File02 was reordered successfully in the 'recent files'-list.");
-
- Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 0);
-}
-
-// The "devtools.scratchpad.recentFilesMax"-preference was set to zero (0).
-// This should disable the "Open Recent"-menu by hiding it (this should not
-// remove any files from the list). Test to see if it's been hidden.
-function testHideMenu()
-{
- let menu = gScratchpadWindow.document.getElementById("sp-open_recent-menu");
- ok(menu.hasAttribute("hidden"), "The menu was hidden successfully.");
-
- Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 2);
-}
-
-// We have set the recentFilesMax-pref to one (1), this enables the feature,
-// removes the two oldest files, rebuilds the menu and removes the
-// "hidden"-attribute from it. Test to see if this works.
-function testChangedMaxRecent()
-{
- let menu = gScratchpadWindow.document.getElementById("sp-open_recent-menu");
- ok(!menu.hasAttribute("hidden"), "The menu is visible. \\o/");
-
- lists.recentFiles04 = gScratchpad.getRecentFiles();
-
- is(lists.recentFiles04.length, 2,
- "Two recent files were successfully removed from the 'recent files'-list");
-
- let doc = gScratchpadWindow.document;
- let popup = doc.getElementById("sp-menu-open_recentPopup");
-
- let menuitemLabel = popup.children[0].getAttribute("label");
- let correctMenuItem = false;
- if (menuitemLabel === lists.recentFiles03[2] &&
- menuitemLabel === lists.recentFiles04[1]) {
- correctMenuItem = true;
- }
-
- is(correctMenuItem, true,
- "Two recent files were successfully removed from the 'Open Recent'-menu");
-
- // We now remove one file from the harddrive and use the recent-menuitem for
- // it to make sure the user is notified that the file no longer exists.
- // This is tested in testOpenDeletedFile().
- gFile04.remove(false);
-
- // Make sure the file has been deleted before continuing to avoid
- // intermittent oranges.
- waitForFileDeletion();
-}
-
-function waitForFileDeletion() {
- if (gFile04.exists()) {
- executeSoon(waitForFileDeletion);
- return;
- }
-
- gFile04 = null;
- gScratchpad.openFile(0);
-}
-
-// By now we should have two recent files stored in the list but one of the
-// files should be missing on the harddrive.
-function testOpenDeletedFile() {
- let doc = gScratchpadWindow.document;
- let popup = doc.getElementById("sp-menu-open_recentPopup");
-
- is(gScratchpad.getRecentFiles().length, 1,
- "The missing file was successfully removed from the list.");
- // The number of recent files stored, plus the separator and the
- // clearRecentMenuItems-item.
- is(popup.children.length, 3,
- "The missing file was successfully removed from the menu.");
- ok(gScratchpad.notificationBox.currentNotification,
- "The notification was successfully displayed.");
- is(gScratchpad.notificationBox.currentNotification.label,
- gScratchpad.strings.GetStringFromName("fileNoLongerExists.notification"),
- "The notification label is correct.");
-
- gScratchpad.clearRecentFiles();
-}
-
-// We have cleared the last file. Test to see if the last file was removed,
-// the menu is empty and was disabled successfully.
-function testClearedAll()
-{
- let doc = gScratchpadWindow.document;
- let menu = doc.getElementById("sp-open_recent-menu");
- let popup = doc.getElementById("sp-menu-open_recentPopup");
-
- is(gScratchpad.getRecentFiles().length, 0,
- "All recent files removed successfully.");
- is(popup.children.length, 0, "All menuitems removed successfully.");
- ok(menu.hasAttribute("disabled"),
- "No files in the menu, it was disabled successfully.");
-
- finishTest();
-}
-
-function createAndLoadTemporaryFile(aFile, aFileName, aFileContent)
-{
- // Create a temporary file.
- aFile = FileUtils.getFile("TmpD", [aFileName]);
- aFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
-
- // Write the temporary file.
- let fout = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- fout.init(aFile.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- 0644, fout.DEFER_OPEN);
-
- gScratchpad.setFilename(aFile.path);
- gScratchpad.importFromFile(aFile.QueryInterface(Ci.nsILocalFile), true,
- fileImported);
- gScratchpad.saveFile(fileSaved);
-
- return aFile;
-}
-
-function fileImported(aStatus)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was imported successfully with Scratchpad");
-}
-
-function fileSaved(aStatus)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was saved successfully with Scratchpad");
-
- checkIfMenuIsPopulated();
-}
-
-function checkIfMenuIsPopulated()
-{
- let doc = gScratchpadWindow.document;
- let expectedMenuitemCount = doc.getElementById("sp-menu-open_recentPopup").
- children.length;
- // The number of recent files stored, plus the separator and the
- // clearRecentMenuItems-item.
- let recentFilesPlusExtra = gScratchpad.getRecentFiles().length + 2;
-
- if (expectedMenuitemCount > 2) {
- is(expectedMenuitemCount, recentFilesPlusExtra,
- "the recent files menu was populated successfully.");
- }
-}
-
-/**
- * The PreferenceObserver listens for preference changes while Scratchpad is
- * running.
- */
-var PreferenceObserver = {
- _initialized: false,
-
- _timesFired: 0,
- set timesFired(aNewValue) {
- this._timesFired = aNewValue;
- },
- get timesFired() {
- return this._timesFired;
- },
-
- init: function PO_init()
- {
- if (this._initialized) {
- return;
- }
-
- this.branch = Services.prefs.getBranch("devtools.scratchpad.");
- this.branch.addObserver("", this, false);
- this._initialized = true;
- },
-
- observe: function PO_observe(aMessage, aTopic, aData)
- {
- if (aTopic != "nsPref:changed") {
- return;
- }
-
- switch (this.timesFired) {
- case 0:
- this.timesFired = 1;
- break;
- case 1:
- this.timesFired = 2;
- break;
- case 2:
- this.timesFired = 3;
- testAddedToRecent();
- break;
- case 3:
- this.timesFired = 4;
- testOverwriteRecent();
- break;
- case 4:
- this.timesFired = 5;
- testOpenOldestRecent();
- break;
- case 5:
- this.timesFired = 6;
- testHideMenu();
- break;
- case 6:
- this.timesFired = 7;
- testChangedMaxRecent();
- break;
- case 7:
- this.timesFired = 8;
- testOpenDeletedFile();
- break;
- case 8:
- this.timesFired = 9;
- testClearedAll();
- break;
- }
- },
-
- uninit: function PO_uninit () {
- this.branch.removeObserver("", this);
- }
-};
-
-function test()
-{
- waitForExplicitFinish();
-
- registerCleanupFunction(function () {
- gFile01.remove(false);
- gFile01 = null;
- gFile02.remove(false);
- gFile02 = null;
- gFile03.remove(false);
- gFile03 = null;
- // gFile04 was removed earlier.
- lists.recentFiles01 = null;
- lists.recentFiles02 = null;
- lists.recentFiles03 = null;
- lists.recentFiles04 = null;
- gScratchpad = null;
-
- PreferenceObserver.uninit();
- Services.prefs.clearUserPref("devtools.scratchpad.recentFilesMax");
- });
-
- Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 3);
-
- // Initiate the preference observer after we have set the temporary recent
- // files max for this test.
- PreferenceObserver.init();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(startTest);
- }, true);
-
- content.location = "data:text/html,<p>test recent files in Scratchpad";
-}
-
-function finishTest()
-{
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js
deleted file mode 100644
index cbcaf0ddf..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js
+++ /dev/null
@@ -1,227 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-
-// only finish() when correct number of tests are done
-const expected = 9;
-var count = 0;
-function done()
-{
- if (++count == expected) {
- cleanup();
- finish();
- }
-}
-
-var gFile;
-
-var oldPrompt = Services.prompt;
-var promptButton = -1;
-
-function test()
-{
- waitForExplicitFinish();
-
- gFile = createTempFile("fileForBug653427.tmp");
- writeFile(gFile, "text", testUnsaved.call(this));
-
- Services.prompt = {
- confirmEx: function() {
- return promptButton;
- }
- };
-
- testNew();
- testSavedFile();
-
- gBrowser.selectedTab = gBrowser.addTab();
- content.location = "data:text/html,<p>test scratchpad save file prompt on closing";
-}
-
-function testNew()
-{
- openScratchpad(function(win) {
- win.Scratchpad.close(function() {
- ok(win.closed, "new scratchpad window should close without prompting")
- done();
- });
- }, {noFocus: true});
-}
-
-function testSavedFile()
-{
- openScratchpad(function(win) {
- win.Scratchpad.filename = "test.js";
- win.Scratchpad.editor.dirty = false;
- win.Scratchpad.close(function() {
- ok(win.closed, "scratchpad from file with no changes should close")
- done();
- });
- }, {noFocus: true});
-}
-
-function testUnsaved()
-{
- function setFilename(aScratchpad, aFile) {
- aScratchpad.setFilename(aFile);
- }
-
- testUnsavedFileCancel(setFilename);
- testUnsavedFileSave(setFilename);
- testUnsavedFileDontSave(setFilename);
- testCancelAfterLoad();
-
- function mockSaveFile(aScratchpad) {
- let SaveFileStub = function (aCallback) {
- /*
- * An argument for aCallback must pass Components.isSuccessCode
- *
- * A version of isSuccessCode in JavaScript:
- * function isSuccessCode(returnCode) {
- * return (returnCode & 0x80000000) == 0;
- * }
- */
- aCallback(1);
- };
-
- aScratchpad.saveFile = SaveFileStub;
- }
-
- // Run these tests again but this time without setting a filename to
- // test that Scratchpad always asks for confirmation on dirty editor.
- testUnsavedFileCancel(mockSaveFile);
- testUnsavedFileSave(mockSaveFile);
- testUnsavedFileDontSave();
-}
-
-function testUnsavedFileCancel(aCallback=function () {})
-{
- openScratchpad(function(win) {
- aCallback(win.Scratchpad, "test.js");
- win.Scratchpad.editor.dirty = true;
-
- promptButton = win.BUTTON_POSITION_CANCEL;
-
- win.Scratchpad.close(function() {
- ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
- win.close();
- done();
- });
- }, {noFocus: true});
-}
-
-// Test a regression where our confirmation dialog wasn't appearing
-// after openFile calls. See bug 801982.
-function testCancelAfterLoad()
-{
- openScratchpad(function(win) {
- win.Scratchpad.setRecentFile(gFile);
- win.Scratchpad.openFile(0);
- win.Scratchpad.editor.dirty = true;
- promptButton = win.BUTTON_POSITION_CANCEL;
-
- let EventStub = {
- called: false,
- preventDefault: function() {
- EventStub.called = true;
- }
- };
-
- win.Scratchpad.onClose(EventStub, function() {
- ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
- ok(EventStub.called, "aEvent.preventDefault was called");
-
- win.Scratchpad.editor.dirty = false;
- win.close();
- done();
- });
- }, {noFocus: true});
-}
-
-function testUnsavedFileSave(aCallback=function () {})
-{
- openScratchpad(function(win) {
- win.Scratchpad.importFromFile(gFile, true, function(status, content) {
- aCallback(win.Scratchpad, gFile.path);
-
- let text = "new text";
- win.Scratchpad.setText(text);
-
- promptButton = win.BUTTON_POSITION_SAVE;
-
- win.Scratchpad.close(function() {
- ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
- readFile(gFile, function(savedContent) {
- is(savedContent, text, 'prompted "Save" worked when closing scratchpad');
- done();
- });
- });
- });
- }, {noFocus: true});
-}
-
-function testUnsavedFileDontSave(aCallback=function () {})
-{
- openScratchpad(function(win) {
- aCallback(win.Scratchpad, gFile.path);
- win.Scratchpad.editor.dirty = true;
-
- promptButton = win.BUTTON_POSITION_DONT_SAVE;
-
- win.Scratchpad.close(function() {
- ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
- done();
- });
- }, {noFocus: true});
-}
-
-function cleanup()
-{
- Services.prompt = oldPrompt;
- gFile.remove(false);
- gFile = null;
-}
-
-function createTempFile(name)
-{
- let file = FileUtils.getFile("TmpD", [name]);
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
- file.QueryInterface(Ci.nsILocalFile)
- return file;
-}
-
-function writeFile(file, content, callback)
-{
- let fout = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- 0644, fout.DEFER_OPEN);
-
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
- createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let fileContentStream = converter.convertToInputStream(content);
-
- NetUtil.asyncCopy(fileContentStream, fout, callback);
-}
-
-function readFile(file, callback)
-{
- let channel = NetUtil.newChannel(file);
- channel.contentType = "application/javascript";
-
- NetUtil.asyncFetch(channel, function(inputStream, status) {
- ok(Components.isSuccessCode(status),
- "file was read successfully");
-
- let content = NetUtil.readInputStreamToString(inputStream,
- inputStream.available());
- callback(content);
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js
deleted file mode 100644
index 3687c8173..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
-
- ok(window.Scratchpad, "Scratchpad variable exists");
-
- Services.prefs.setIntPref("devtools.editor.tabsize", 5);
-
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,Scratchpad test for the Tab key, bug 660560";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- ok(sp, "Scratchpad object exists in new window");
-
- ok(sp.editor.hasFocus(), "the editor has focus");
-
- sp.setText("window.foo;");
- sp.editor.setCaretOffset(0);
-
- EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
-
- is(sp.getText(), " window.foo;", "Tab key added 5 spaces");
-
- is(sp.editor.getCaretOffset(), 5, "caret location is correct");
-
- sp.editor.setCaretOffset(6);
-
- EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
-
- is(sp.getText(), " w indow.foo;",
- "Tab key added 4 spaces");
-
- is(sp.editor.getCaretOffset(), 10, "caret location is correct");
-
- // Test the new insertTextAtCaret() method.
-
- sp.insertTextAtCaret("omg");
-
- is(sp.getText(), " w omgindow.foo;", "insertTextAtCaret() works");
-
- is(sp.editor.getCaretOffset(), 13, "caret location is correct after update");
-
- gScratchpadWindow.close();
-
- Services.prefs.setIntPref("devtools.editor.tabsize", 6);
- Services.prefs.setBoolPref("devtools.editor.expandtab", false);
-
- openScratchpad(runTests2);
-}
-
-function runTests2()
-{
- let sp = gScratchpadWindow.Scratchpad;
-
- sp.setText("window.foo;");
- sp.editor.setCaretOffset(0);
-
- EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
-
- is(sp.getText(), "\twindow.foo;", "Tab key added the tab character");
-
- is(sp.editor.getCaretOffset(), 1, "caret location is correct");
-
- Services.prefs.clearUserPref("devtools.editor.tabsize");
- Services.prefs.clearUserPref("devtools.editor.expandtab");
-
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_661762_wrong_window_focus.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_661762_wrong_window_focus.js
deleted file mode 100644
index 94342b048..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_661762_wrong_window_focus.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource:///modules/HUDService.jsm", tempScope);
-let HUDService = tempScope.HUDService;
-
-function test()
-{
- waitForExplicitFinish();
-
- // To test for this bug we open a Scratchpad window, save its
- // reference and then open another one. This way the first window
- // loses its focus.
- //
- // Then we open a web console and execute a console.log statement
- // from the first Scratch window (that's why we needed to save its
- // reference).
- //
- // Then we wait for our message to appear in the console and click
- // on the location link. After that we check which Scratchpad window
- // is currently active (it should be the older one).
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- openScratchpad(function () {
- let sw = gScratchpadWindow;
-
- openScratchpad(function () {
- function onWebConsoleOpen(subj) {
- Services.obs.removeObserver(onWebConsoleOpen,
- "web-console-created");
- subj.QueryInterface(Ci.nsISupportsString);
-
- let hud = HUDService.getHudReferenceById(subj.data);
- hud.jsterm.clearOutput(true);
- executeSoon(testFocus.bind(null, sw, hud));
- }
-
- Services.obs.
- addObserver(onWebConsoleOpen, "web-console-created", false);
-
- HUDService.consoleUI.toggleHUD();
- });
- });
- }, true);
-
- content.location = "data:text/html;charset=utf8,<p>test window focus for Scratchpad.";
-}
-
-function testFocus(sw, hud) {
- let sp = sw.Scratchpad;
-
- function onMessage(subj) {
- Services.obs.removeObserver(onMessage, "web-console-message-created");
-
- var loc = hud.jsterm.outputNode.querySelector(".webconsole-location");
- ok(loc, "location element exists");
- is(loc.value, sw.Scratchpad.uniqueName + ":1",
- "location value is correct");
-
- sw.addEventListener("focus", function onFocus() {
- sw.removeEventListener("focus", onFocus, true);
-
- let win = Services.wm.getMostRecentWindow("devtools:scratchpad");
-
- ok(win, "there are active Scratchpad windows");
- is(win.Scratchpad.uniqueName, sw.Scratchpad.uniqueName,
- "correct window is in focus");
-
- // gScratchpadWindow will be closed automatically but we need to
- // close the second window ourselves.
- sw.close();
- finish();
- }, true);
-
- // Simulate a click on the "Scratchpad/N:1" link.
- EventUtils.synthesizeMouse(loc, 2, 2, {}, hud.iframeWindow);
- }
-
- // Sending messages to web console is an asynchronous operation. That's
- // why we have to setup an observer here.
- Services.obs.addObserver(onMessage, "web-console-message-created", false);
-
- sp.setText("console.log('foo');");
- sp.run().then(function ([selection, error, result]) {
- is(selection, "console.log('foo');", "selection is correct");
- is(error, undefined, "error is correct");
- is(result, undefined, "result is correct");
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js
deleted file mode 100644
index 15d4bb615..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// only finish() when correct number of tests are done
-const expected = 4;
-var count = 0;
-function done()
-{
- if (++count == expected) {
- finish();
- }
-}
-
-var ScratchpadManager = Scratchpad.ScratchpadManager;
-
-
-function test()
-{
- waitForExplicitFinish();
-
- testListeners();
- testRestoreNotFromFile();
- testRestoreFromFileSaved();
- testRestoreFromFileUnsaved();
-
- gBrowser.selectedTab = gBrowser.addTab();
- content.location = "data:text/html,<p>test star* UI for unsaved file changes";
-}
-
-function testListeners()
-{
- openScratchpad(function(aWin, aScratchpad) {
- aScratchpad.setText("new text");
- ok(isStar(aWin), "show start if scratchpad text changes");
-
- aScratchpad.editor.dirty = false;
- ok(!isStar(aWin), "no star before changing text");
-
- aScratchpad.setFilename("foo.js");
- aScratchpad.setText("new text2");
- ok(isStar(aWin), "shows star if scratchpad text changes");
-
- aScratchpad.editor.dirty = false;
- ok(!isStar(aWin), "no star if scratchpad was just saved");
-
- aScratchpad.setText("new text3");
- ok(isStar(aWin), "shows star if scratchpad has more changes");
-
- aScratchpad.undo();
- ok(!isStar(aWin), "no star if scratchpad undo to save point");
-
- aScratchpad.undo();
- ok(isStar(aWin), "star if scratchpad undo past save point");
-
- aWin.close();
- done();
- }, {noFocus: true});
-}
-
-function testRestoreNotFromFile()
-{
- let session = [{
- text: "test1",
- executionContext: 1
- }];
-
- let [win] = ScratchpadManager.restoreSession(session);
- openScratchpad(function(aWin, aScratchpad) {
- aScratchpad.setText("new text");
- ok(isStar(win), "show star if restored scratchpad isn't from a file");
-
- win.close();
- done();
- }, {window: win, noFocus: true});
-}
-
-function testRestoreFromFileSaved()
-{
- let session = [{
- filename: "test.js",
- text: "test1",
- executionContext: 1,
- saved: true
- }];
-
- let [win] = ScratchpadManager.restoreSession(session);
- openScratchpad(function(aWin, aScratchpad) {
- ok(!isStar(win), "no star before changing text in scratchpad restored from file");
-
- aScratchpad.setText("new text");
- ok(isStar(win), "star when text changed from scratchpad restored from file");
-
- win.close();
- done();
- }, {window: win, noFocus: true});
-}
-
-function testRestoreFromFileUnsaved()
-{
- let session = [{
- filename: "test.js",
- text: "test1",
- executionContext: 1,
- saved: false
- }];
-
- let [win] = ScratchpadManager.restoreSession(session);
- openScratchpad(function() {
- ok(isStar(win), "star with scratchpad restored with unsaved text");
-
- win.close();
- done();
- }, {window: win, noFocus: true});
-}
-
-function isStar(win)
-{
- return win.document.title.match(/^\*[^\*]/);
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js
deleted file mode 100644
index 08785a76b..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(testFalsy);
- }, true);
-
- content.location = "data:text/html,<p>test falsy display() values in Scratchpad";
-}
-
-function testFalsy()
-{
- let scratchpad = gScratchpadWindow.Scratchpad;
- verifyFalsies(scratchpad).then(function() {
- scratchpad.setBrowserContext();
- verifyFalsies(scratchpad).then(finish);
- });
-}
-
-
-function verifyFalsies(scratchpad)
-{
- let tests = [{
- method: "display",
- code: "undefined",
- result: "undefined\n/*\nundefined\n*/",
- label: "undefined is displayed"
- },
- {
- method: "display",
- code: "false",
- result: "false\n/*\nfalse\n*/",
- label: "false is displayed"
- },
- {
- method: "display",
- code: "0",
- result: "0\n/*\n0\n*/",
- label: "0 is displayed"
- },
- {
- method: "display",
- code: "null",
- result: "null\n/*\nnull\n*/",
- label: "null is displayed"
- },
- {
- method: "display",
- code: "NaN",
- result: "NaN\n/*\nNaN\n*/",
- label: "NaN is displayed"
- },
- {
- method: "display",
- code: "''",
- result: "''\n/*\n\n*/",
- label: "the empty string is displayed"
- }];
-
- return runAsyncTests(scratchpad, tests);
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js
deleted file mode 100644
index 4befa8d69..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js
+++ /dev/null
@@ -1,187 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,test Edit menu updates Scratchpad - bug 699130";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- let doc = gScratchpadWindow.document;
- let winUtils = gScratchpadWindow.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIDOMWindowUtils);
- let OS = Services.appinfo.OS;
-
- info("will test the Edit menu");
-
- let pass = 0;
-
- sp.setText("bug 699130: hello world! (edit menu)");
-
- let editMenu = doc.getElementById("sp-edit-menu");
- ok(editMenu, "the Edit menu");
- let menubar = editMenu.parentNode;
- ok(menubar, "menubar found");
-
- let editMenuIndex = -1;
- for (let i = 0; i < menubar.children.length; i++) {
- if (menubar.children[i] === editMenu) {
- editMenuIndex = i;
- break;
- }
- }
- isnot(editMenuIndex, -1, "Edit menu index is correct");
-
- let menuPopup = editMenu.menupopup;
- ok(menuPopup, "the Edit menupopup");
- let cutItem = doc.getElementById("se-menu-cut");
- ok(cutItem, "the Cut menuitem");
- let pasteItem = doc.getElementById("se-menu-paste");
- ok(pasteItem, "the Paste menuitem");
-
- let anchor = doc.documentElement;
- let isContextMenu = false;
-
- let openMenu = function(aX, aY, aCallback) {
- if (!editMenu || OS != "Darwin") {
- menuPopup.addEventListener("popupshown", function onPopupShown() {
- menuPopup.removeEventListener("popupshown", onPopupShown, false);
- executeSoon(aCallback);
- }, false);
- }
-
- executeSoon(function() {
- if (editMenu) {
- if (OS == "Darwin") {
- winUtils.forceUpdateNativeMenuAt(editMenuIndex);
- executeSoon(aCallback);
- } else {
- editMenu.open = true;
- }
- } else {
- menuPopup.openPopup(anchor, "overlap", aX, aY, isContextMenu, false);
- }
- });
- };
-
- let closeMenu = function(aCallback) {
- if (!editMenu || OS != "Darwin") {
- menuPopup.addEventListener("popuphidden", function onPopupHidden() {
- menuPopup.removeEventListener("popuphidden", onPopupHidden, false);
- executeSoon(aCallback);
- }, false);
- }
-
- executeSoon(function() {
- if (editMenu) {
- if (OS == "Darwin") {
- winUtils.forceUpdateNativeMenuAt(editMenuIndex);
- executeSoon(aCallback);
- } else {
- editMenu.open = false;
- }
- } else {
- menuPopup.hidePopup();
- }
- });
- };
-
- let firstShow = function() {
- ok(cutItem.hasAttribute("disabled"), "cut menuitem is disabled");
- closeMenu(firstHide);
- };
-
- let firstHide = function() {
- sp.selectRange(0, 10);
- openMenu(11, 11, showAfterSelect);
- };
-
- let showAfterSelect = function() {
- ok(!cutItem.hasAttribute("disabled"), "cut menuitem is enabled after select");
- closeMenu(hideAfterSelect);
- };
-
- let hideAfterSelect = function() {
- sp.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onCut);
- waitForFocus(function () {
- let selectedText = sp.editor.getSelectedText();
- ok(selectedText.length > 0, "non-empty selected text will be cut");
-
- EventUtils.synthesizeKey("x", {accelKey: true}, gScratchpadWindow);
- }, gScratchpadWindow);
- };
-
- let onCut = function() {
- sp.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onCut);
- openMenu(12, 12, showAfterCut);
- };
-
- let showAfterCut = function() {
- ok(cutItem.hasAttribute("disabled"), "cut menuitem is disabled after cut");
- ok(!pasteItem.hasAttribute("disabled"), "paste menuitem is enabled after cut");
- closeMenu(hideAfterCut);
- };
-
- let hideAfterCut = function() {
- sp.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
- waitForFocus(function () {
- EventUtils.synthesizeKey("v", {accelKey: true}, gScratchpadWindow);
- }, gScratchpadWindow);
- };
-
- let onPaste = function() {
- sp.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
- openMenu(13, 13, showAfterPaste);
- };
-
- let showAfterPaste = function() {
- ok(cutItem.hasAttribute("disabled"), "cut menuitem is disabled after paste");
- ok(!pasteItem.hasAttribute("disabled"), "paste menuitem is enabled after paste");
- closeMenu(hideAfterPaste);
- };
-
- let hideAfterPaste = function() {
- if (pass == 0) {
- pass++;
- testContextMenu();
- } else {
- finish();
- }
- };
-
- let testContextMenu = function() {
- info("will test the context menu");
-
- editMenu = null;
- isContextMenu = true;
-
- menuPopup = doc.getElementById("scratchpad-text-popup");
- ok(menuPopup, "the context menupopup");
- cutItem = doc.getElementById("se-cMenu-cut");
- ok(cutItem, "the Cut menuitem");
- pasteItem = doc.getElementById("se-cMenu-paste");
- ok(pasteItem, "the Paste menuitem");
-
- sp.setText("bug 699130: hello world! (context menu)");
- openMenu(10, 10, firstShow);
- };
-
- openMenu(10, 10, firstShow);
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_bug_751744_revert_to_saved.js b/browser/devtools/scratchpad/test/browser_scratchpad_bug_751744_revert_to_saved.js
deleted file mode 100644
index 9af0ad4f8..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_751744_revert_to_saved.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-
-// Reference to the Scratchpad object.
-let gScratchpad;
-
-// Reference to the temporary nsIFiles.
-let gFile;
-
-// Temporary file name.
-let gFileName = "testFileForBug751744.tmp"
-
-
-// Content for the temporary file.
-let gFileContent = "/* this file is already saved */\n" +
- "function foo() { alert('bar') }";
-let gLength = gFileContent.length;
-
-// Reference to the menu entry.
-let menu;
-
-function startTest()
-{
- gScratchpad = gScratchpadWindow.Scratchpad;
- menu = gScratchpadWindow.document.getElementById("sp-menu-revert");
- createAndLoadTemporaryFile();
-}
-
-function testAfterSaved() {
- // Check if the revert menu is disabled as the file is at saved state.
- ok(menu.hasAttribute("disabled"), "The revert menu entry is disabled.");
-
- // chancging the text in the file
- gScratchpad.setText("\nfoo();", gLength, gLength);
- // Checking the text got changed
- is(gScratchpad.getText(), gFileContent + "\nfoo();",
- "The text changed the first time.");
-
- // Revert menu now should be enabled.
- ok(!menu.hasAttribute("disabled"),
- "The revert menu entry is enabled after changing text first time");
-
- // reverting back to last saved state.
- gScratchpad.revertFile(testAfterRevert);
-}
-
-function testAfterRevert() {
- // Check if the file's text got reverted
- is(gScratchpad.getText(), gFileContent,
- "The text reverted back to original text.");
- // The revert menu should be disabled again.
- ok(menu.hasAttribute("disabled"),
- "The revert menu entry is disabled after reverting.");
-
- // chancging the text in the file again
- gScratchpad.setText("\nalert(foo.toSource());", gLength, gLength);
- // Saving the file.
- gScratchpad.saveFile(testAfterSecondSave);
-}
-
-function testAfterSecondSave() {
- // revert menu entry should be disabled.
- ok(menu.hasAttribute("disabled"),
- "The revert menu entry is disabled after saving.");
-
- // changing the text.
- gScratchpad.setText("\nfoo();", gLength + 23, gLength + 23);
-
- // revert menu entry should get enabled yet again.
- ok(!menu.hasAttribute("disabled"),
- "The revert menu entry is enabled after changing text third time");
-
- // reverting back to last saved state.
- gScratchpad.revertFile(testAfterSecondRevert);
-}
-
-function testAfterSecondRevert() {
- // Check if the file's text got reverted
- is(gScratchpad.getText(), gFileContent + "\nalert(foo.toSource());",
- "The text reverted back to the changed saved text.");
- // The revert menu should be disabled again.
- ok(menu.hasAttribute("disabled"),
- "Revert menu entry is disabled after reverting to changed saved state.");
- gFile.remove(false);
- gFile = null;
- gScratchpad = null;
-}
-
-function createAndLoadTemporaryFile()
-{
- // Create a temporary file.
- gFile = FileUtils.getFile("TmpD", [gFileName]);
- gFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
-
- // Write the temporary file.
- let fout = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- fout.init(gFile.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- 0644, fout.DEFER_OPEN);
-
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
- createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let fileContentStream = converter.convertToInputStream(gFileContent);
-
- NetUtil.asyncCopy(fileContentStream, fout, tempFileSaved);
-}
-
-function tempFileSaved(aStatus)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was saved successfully");
-
- // Import the file into Scratchpad.
- gScratchpad.setFilename(gFile.path);
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true,
- testAfterSaved);
-}
-
-function test()
-{
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(startTest);
- }, true);
-
- content.location = "data:text/html,<p>test reverting to last saved state of" +
- " a file </p>";
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_contexts.js b/browser/devtools/scratchpad/test/browser_scratchpad_contexts.js
deleted file mode 100644
index 6c0c684ae..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_contexts.js
+++ /dev/null
@@ -1,174 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,test context switch in Scratchpad";
-}
-
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
- let chromeMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
- let notificationBox = sp.notificationBox;
-
- ok(contentMenu, "found #sp-menu-content");
- ok(chromeMenu, "found #sp-menu-browser");
- ok(notificationBox, "found Scratchpad.notificationBox");
-
- let tests = [{
- method: "run",
- prepare: function() {
- sp.setContentContext();
-
- is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
- "executionContext is content");
-
- is(contentMenu.getAttribute("checked"), "true",
- "content menuitem is checked");
-
- isnot(chromeMenu.getAttribute("checked"), "true",
- "chrome menuitem is not checked");
-
- ok(!notificationBox.currentNotification,
- "there is no notification in content context");
-
- let dsp = sp.contentSandbox.__SCRATCHPAD__;
-
- ok(sp.contentSandbox.__SCRATCHPAD__,
- "there is a variable named __SCRATCHPAD__");
-
- ok(sp.contentSandbox.__SCRATCHPAD__.editor,
- "scratchpad is actually an instance of Scratchpad");
-
- sp.setText("window.foobarBug636725 = 'aloha';");
-
- ok(!content.wrappedJSObject.foobarBug636725,
- "no content.foobarBug636725");
- },
- then: function() {
- is(content.wrappedJSObject.foobarBug636725, "aloha",
- "content.foobarBug636725 has been set");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.setBrowserContext();
-
- is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER,
- "executionContext is chrome");
-
- is(chromeMenu.getAttribute("checked"), "true",
- "chrome menuitem is checked");
-
- isnot(contentMenu.getAttribute("checked"), "true",
- "content menuitem is not checked");
-
- ok(sp.chromeSandbox.__SCRATCHPAD__,
- "there is a variable named __SCRATCHPAD__");
-
- ok(sp.chromeSandbox.__SCRATCHPAD__.editor,
- "scratchpad is actually an instance of Scratchpad");
-
- ok(notificationBox.currentNotification,
- "there is a notification in browser context");
-
- sp.setText("2'", 31, 32);
-
- is(sp.getText(), "window.foobarBug636725 = 'aloha2';",
- "setText() worked");
- },
- then: function() {
- is(window.foobarBug636725, "aloha2",
- "window.foobarBug636725 has been set");
-
- delete window.foobarBug636725;
- ok(!window.foobarBug636725, "no window.foobarBug636725");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.setText("gBrowser", 7);
-
- is(sp.getText(), "window.gBrowser",
- "setText() worked with no end for the replace range");
- },
- then: function([, , result]) {
- is(typeof result.addTab, "function",
- "chrome context has access to chrome objects");
- }
- },
- {
- method: "run",
- prepare: function() {
- // Check that the sandbox is cached.
- sp.setText("typeof foobarBug636725cache;");
- },
- then: function([, , result]) {
- is(result, "undefined", "global variable does not exist");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.setText("var foobarBug636725cache = 'foo';" +
- "typeof foobarBug636725cache;");
- },
- then: function([, , result]) {
- is(result, "string",
- "global variable exists across two different executions");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.resetContext();
- sp.setText("typeof foobarBug636725cache;");
- },
- then: function([, , result]) {
- is(result, "undefined",
- "global variable no longer exists after calling resetContext()");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.setText("var foobarBug636725cache2 = 'foo';" +
- "typeof foobarBug636725cache2;");
- },
- then: function([, , result]) {
- is(result, "string",
- "global variable exists across two different executions");
- }
- },
- {
- method: "run",
- prepare: function() {
- sp.setContentContext();
-
- is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
- "executionContext is content");
-
- sp.setText("typeof foobarBug636725cache2;");
- },
- then: function([, , result]) {
- is(result, "undefined",
- "global variable no longer exists after changing the context");
- }
- }];
-
- runAsyncCallbackTests(sp, tests).then(finish);
-} \ No newline at end of file
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js b/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js
deleted file mode 100644
index a2c43c3ca..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test run() and display() in Scratchpad";
-}
-
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- let tests = [{
- method: "run",
- prepare: function() {
- content.wrappedJSObject.foobarBug636725 = 1;
- sp.setText("++window.foobarBug636725");
- },
- then: function([code, , result]) {
- is(code, sp.getText(), "code is correct");
- is(result, content.wrappedJSObject.foobarBug636725,
- "result is correct");
-
- is(sp.getText(), "++window.foobarBug636725",
- "run() does not change the editor content");
-
- is(content.wrappedJSObject.foobarBug636725, 2,
- "run() updated window.foobarBug636725");
- }
- },
- {
- method: "display",
- prepare: function() {},
- then: function() {
- is(content.wrappedJSObject.foobarBug636725, 3,
- "display() updated window.foobarBug636725");
-
- is(sp.getText(), "++window.foobarBug636725\n/*\n3\n*/",
- "display() shows evaluation result in the textbox");
-
- is(sp.selectedText, "\n/*\n3\n*/", "selectedText is correct");
- }
- },
- {
- method: "run",
- prepare: function() {
- let selection = sp.getSelectionRange();
- is(selection.start, 24, "selection.start is correct");
- is(selection.end, 32, "selection.end is correct");
-
- // Test selection run() and display().
-
- sp.setText("window.foobarBug636725 = 'a';\n" +
- "window.foobarBug636725 = 'b';");
-
- sp.selectRange(1, 2);
-
- selection = sp.getSelectionRange();
-
- is(selection.start, 1, "selection.start is 1");
- is(selection.end, 2, "selection.end is 2");
-
- sp.selectRange(0, 29);
-
- selection = sp.getSelectionRange();
-
- is(selection.start, 0, "selection.start is 0");
- is(selection.end, 29, "selection.end is 29");
- },
- then: function([code, , result]) {
- is(code, "window.foobarBug636725 = 'a';", "code is correct");
- is(result, "a", "result is correct");
-
- is(sp.getText(), "window.foobarBug636725 = 'a';\n" +
- "window.foobarBug636725 = 'b';",
- "run() does not change the textbox value");
-
- is(content.wrappedJSObject.foobarBug636725, "a",
- "run() worked for the selected range");
- }
- },
- {
- method: "display",
- prepare: function() {
- sp.setText("window.foobarBug636725 = 'c';\n" +
- "window.foobarBug636725 = 'b';");
-
- sp.selectRange(0, 22);
- },
- then: function() {
- is(content.wrappedJSObject.foobarBug636725, "a",
- "display() worked for the selected range");
-
- is(sp.getText(), "window.foobarBug636725" +
- "\n/*\na\n*/" +
- " = 'c';\n" +
- "window.foobarBug636725 = 'b';",
- "display() shows evaluation result in the textbox");
-
- is(sp.selectedText, "\n/*\na\n*/", "selectedText is correct");
- }
- }]
-
-
- runAsyncCallbackTests(sp, tests).then(function() {
- let selection = sp.getSelectionRange();
- is(selection.start, 22, "selection.start is correct");
- is(selection.end, 30, "selection.end is correct");
-
- sp.deselect();
-
- ok(!sp.selectedText, "selectedText is empty");
-
- selection = sp.getSelectionRange();
- is(selection.start, selection.end, "deselect() works");
-
- // Test undo/redo.
-
- sp.setText("foo1");
- sp.setText("foo2");
- is(sp.getText(), "foo2", "editor content updated");
- sp.undo();
- is(sp.getText(), "foo1", "undo() works");
- sp.redo();
- is(sp.getText(), "foo2", "redo() works");
-
- finish();
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_files.js b/browser/devtools/scratchpad/test/browser_scratchpad_files.js
deleted file mode 100644
index e31af7946..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_files.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tempScope = {};
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-let NetUtil = tempScope.NetUtil;
-
-// Reference to the Scratchpad object.
-let gScratchpad;
-
-// Reference to the temporary nsIFile we will work with.
-let gFile;
-
-// The temporary file content.
-let gFileContent = "hello.world('bug636725');";
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<p>test file open and save in Scratchpad";
-}
-
-function runTests()
-{
- gScratchpad = gScratchpadWindow.Scratchpad;
-
- createTempFile("fileForBug636725.tmp", gFileContent, function(aStatus, aFile) {
- ok(Components.isSuccessCode(aStatus),
- "The temporary file was saved successfully");
-
- gFile = aFile;
- gScratchpad.importFromFile(gFile.QueryInterface(Ci.nsILocalFile), true,
- fileImported);
- });
-}
-
-function fileImported(aStatus, aFileContent)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was imported successfully with Scratchpad");
-
- is(aFileContent, gFileContent,
- "received data is correct");
-
- is(gScratchpad.getText(), gFileContent,
- "the editor content is correct");
-
- // Save the file after changes.
- gFileContent += "// omg, saved!";
- gScratchpad.setText(gFileContent);
-
- gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsILocalFile), true, true,
- fileExported);
-}
-
-function fileExported(aStatus)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was exported successfully with Scratchpad");
-
- let oldContent = gFileContent;
-
- // Attempt another file save, with confirmation which returns false.
- gFileContent += "// omg, saved twice!";
- gScratchpad.setText(gFileContent);
-
- let oldConfirm = gScratchpadWindow.confirm;
- let askedConfirmation = false;
- gScratchpadWindow.confirm = function() {
- askedConfirmation = true;
- return false;
- };
-
- gScratchpad.exportToFile(gFile.QueryInterface(Ci.nsILocalFile), false, true,
- fileExported2);
-
- gScratchpadWindow.confirm = oldConfirm;
-
- ok(askedConfirmation, "exportToFile() asked for overwrite confirmation");
-
- gFileContent = oldContent;
-
- let channel = NetUtil.newChannel(gFile);
- channel.contentType = "application/javascript";
-
- // Read back the temporary file.
- NetUtil.asyncFetch(channel, fileRead);
-}
-
-function fileExported2()
-{
- ok(false, "exportToFile() did not cancel file overwrite");
-}
-
-function fileRead(aInputStream, aStatus)
-{
- ok(Components.isSuccessCode(aStatus),
- "the temporary file was read back successfully");
-
- let updatedContent =
- NetUtil.readInputStreamToString(aInputStream, aInputStream.available());;
-
- is(updatedContent, gFileContent, "file properly updated");
-
- // Done!
- gFile.remove(false);
- gFile = null;
- gScratchpad = null;
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js b/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
deleted file mode 100644
index 67bca826a..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
- ok(window.Scratchpad, "Scratchpad variable exists");
-
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,initialization test for Scratchpad";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- ok(sp, "Scratchpad object exists in new window");
- is(typeof sp.run, "function", "Scratchpad.run() exists");
- is(typeof sp.inspect, "function", "Scratchpad.inspect() exists");
- is(typeof sp.display, "function", "Scratchpad.display() exists");
-
- let environmentMenu = gScratchpadWindow.document.
- getElementById("sp-environment-menu");
- ok(environmentMenu, "Environment menu element exists");
- ok(environmentMenu.hasAttribute("hidden"),
- "Environment menu is not visible");
-
- let errorConsoleCommand = gScratchpadWindow.document.
- getElementById("sp-cmd-errorConsole");
- ok(errorConsoleCommand, "Error console command element exists");
- is(errorConsoleCommand.getAttribute("disabled"), "true",
- "Error console command is disabled");
-
- let chromeContextCommand = gScratchpadWindow.document.
- getElementById("sp-cmd-browserContext");
- ok(chromeContextCommand, "Chrome context command element exists");
- is(chromeContextCommand.getAttribute("disabled"), "true",
- "Chrome context command is disabled");
-
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js b/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js
deleted file mode 100644
index b4e81a991..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html;charset=utf8,<p>test inspect() in Scratchpad</p>";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
-
- sp.setText("({ a: 'foobarBug636725' })");
-
- sp.inspect().then(function() {
- let sidebar = sp.sidebar;
- ok(sidebar.visible, "sidebar is open");
-
-
- let found = false;
-
- outer: for (let scope in sidebar.variablesView) {
- for (let [, obj] in scope) {
- for (let [, prop] in obj) {
- if (prop.name == "a" && prop.value == "foobarBug636725") {
- found = true;
- break outer;
- }
- }
- }
- }
-
- ok(found, "found the property");
-
- let tabbox = sidebar._sidebar._tabbox;
- is(tabbox.width, 300, "Scratchpad sidebar width is correct");
- ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible");
- sidebar.hide();
- ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden");
- sp.inspect().then(function() {
- is(tabbox.width, 300, "Scratchpad sidebar width is still correct");
- ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible again");
- finish();
- });
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_open.js b/browser/devtools/scratchpad/test/browser_scratchpad_open.js
deleted file mode 100644
index 462d9ad2d..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_open.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// only finish() when correct number of tests are done
-const expected = 3;
-var count = 0;
-var lastUniqueName = null;
-
-function done()
-{
- if (++count == expected) {
- finish();
- }
-}
-
-function test()
-{
- waitForExplicitFinish();
- testOpen();
- testOpenWithState();
- testOpenInvalidState();
-}
-
-function testUniqueName(name)
-{
- ok(name, "Scratchpad has a uniqueName");
-
- if (lastUniqueName === null) {
- lastUniqueName = name;
- return;
- }
-
- ok(name !== lastUniqueName,
- "Unique name for this instance differs from the last one.");
-}
-
-function testOpen()
-{
- openScratchpad(function(win) {
- is(win.Scratchpad.filename, undefined, "Default filename is undefined");
- isnot(win.Scratchpad.getText(), null, "Default text should not be null");
- is(win.Scratchpad.executionContext, win.SCRATCHPAD_CONTEXT_CONTENT,
- "Default execution context is content");
- testUniqueName(win.Scratchpad.uniqueName);
-
- win.close();
- done();
- }, {noFocus: true});
-}
-
-function testOpenWithState()
-{
- let state = {
- filename: "testfile",
- executionContext: 2,
- text: "test text"
- };
-
- openScratchpad(function(win) {
- is(win.Scratchpad.filename, state.filename, "Filename loaded from state");
- is(win.Scratchpad.executionContext, state.executionContext, "Execution context loaded from state");
- is(win.Scratchpad.getText(), state.text, "Content loaded from state");
- testUniqueName(win.Scratchpad.uniqueName);
-
- win.close();
- done();
- }, {state: state, noFocus: true});
-}
-
-function testOpenInvalidState()
-{
- let win = openScratchpad(null, {state: 7});
- ok(!win, "no scratchpad opened if state is not an object");
- done();
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_restore.js b/browser/devtools/scratchpad/test/browser_scratchpad_restore.js
deleted file mode 100644
index a83c4213c..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_restore.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var ScratchpadManager = Scratchpad.ScratchpadManager;
-
-/* Call the iterator for each item in the list,
- calling the final callback with all the results
- after every iterator call has sent its result */
-function asyncMap(items, iterator, callback)
-{
- let expected = items.length;
- let results = [];
-
- items.forEach(function(item) {
- iterator(item, function(result) {
- results.push(result);
- if (results.length == expected) {
- callback(results);
- }
- });
- });
-}
-
-function test()
-{
- waitForExplicitFinish();
- testRestore();
-}
-
-function testRestore()
-{
- let states = [
- {
- filename: "testfile",
- text: "test1",
- executionContext: 2
- },
- {
- text: "text2",
- executionContext: 1
- },
- {
- text: "text3",
- executionContext: 1
- }
- ];
-
- asyncMap(states, function(state, done) {
- // Open some scratchpad windows
- openScratchpad(done, {state: state, noFocus: true});
- }, function(wins) {
- // Then save the windows to session store
- ScratchpadManager.saveOpenWindows();
-
- // Then get their states
- let session = ScratchpadManager.getSessionState();
-
- // Then close them
- wins.forEach(function(win) {
- win.close();
- });
-
- // Clear out session state for next tests
- ScratchpadManager.saveOpenWindows();
-
- // Then restore them
- let restoredWins = ScratchpadManager.restoreSession(session);
-
- is(restoredWins.length, 3, "Three scratchad windows restored");
-
- asyncMap(restoredWins, function(restoredWin, done) {
- openScratchpad(function(aWin) {
- let state = aWin.Scratchpad.getState();
- aWin.close();
- done(state);
- }, {window: restoredWin, noFocus: true});
- }, function(restoredStates) {
- // Then make sure they were restored with the right states
- ok(statesMatch(restoredStates, states),
- "All scratchpad window states restored correctly");
-
- // Yay, we're done!
- finish();
- });
- });
-}
-
-function statesMatch(restoredStates, states)
-{
- return states.every(function(state) {
- return restoredStates.some(function(restoredState) {
- return state.filename == restoredState.filename
- && state.text == restoredState.text
- && state.executionContext == restoredState.executionContext;
- })
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js b/browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js
deleted file mode 100644
index 68314b930..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let tab1;
-let tab2;
-let sp;
-
-function test()
-{
- waitForExplicitFinish();
-
- tab1 = gBrowser.addTab();
- gBrowser.selectedTab = tab1;
- gBrowser.selectedBrowser.addEventListener("load", function onLoad1() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad1, true);
-
- tab2 = gBrowser.addTab();
- gBrowser.selectedTab = tab2;
- gBrowser.selectedBrowser.addEventListener("load", function onLoad2() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad2, true);
- openScratchpad(runTests);
- }, true);
- content.location = "data:text/html,test context switch in Scratchpad tab 2";
- }, true);
-
- content.location = "data:text/html,test context switch in Scratchpad tab 1";
-}
-
-function runTests()
-{
- sp = gScratchpadWindow.Scratchpad;
-
- let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
- let browserMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
- let notificationBox = sp.notificationBox;
-
- ok(contentMenu, "found #sp-menu-content");
- ok(browserMenu, "found #sp-menu-browser");
- ok(notificationBox, "found Scratchpad.notificationBox");
-
- sp.setContentContext();
-
- is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
- "executionContext is content");
-
- is(contentMenu.getAttribute("checked"), "true",
- "content menuitem is checked");
-
- isnot(browserMenu.getAttribute("checked"), "true",
- "chrome menuitem is not checked");
-
- is(notificationBox.currentNotification, null,
- "there is no notification currently shown for content context");
-
- sp.setText("window.foosbug653108 = 'aloha';");
-
- ok(!content.wrappedJSObject.foosbug653108,
- "no content.foosbug653108");
-
- sp.run().then(function() {
- is(content.wrappedJSObject.foosbug653108, "aloha",
- "content.foosbug653108 has been set");
-
- gBrowser.tabContainer.addEventListener("TabSelect", runTests2, true);
- gBrowser.selectedTab = tab1;
- });
-}
-
-function runTests2() {
- gBrowser.tabContainer.removeEventListener("TabSelect", runTests2, true);
-
- ok(!window.foosbug653108, "no window.foosbug653108");
-
- sp.setText("window.foosbug653108");
- sp.run().then(function([, , result]) {
- isnot(result, "aloha", "window.foosbug653108 is not aloha");
-
- sp.setText("window.foosbug653108 = 'ahoyhoy';");
- sp.run().then(function() {
- is(content.wrappedJSObject.foosbug653108, "ahoyhoy",
- "content.foosbug653108 has been set 2");
-
- gBrowser.selectedBrowser.addEventListener("load", runTests3, true);
- content.location = "data:text/html,test context switch in Scratchpad location 2";
- });
- });
-}
-
-function runTests3() {
- gBrowser.selectedBrowser.removeEventListener("load", runTests3, true);
- // Check that the sandbox is not cached.
-
- sp.setText("typeof foosbug653108;");
- sp.run().then(function([, , result]) {
- is(result, "undefined", "global variable does not exist");
-
- tab1 = null;
- tab2 = null;
- sp = null;
- finish();
- });
-}
diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_ui.js b/browser/devtools/scratchpad/test/browser_scratchpad_ui.js
deleted file mode 100644
index a41aea149..000000000
--- a/browser/devtools/scratchpad/test/browser_scratchpad_ui.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openScratchpad(runTests);
- }, true);
-
- content.location = "data:text/html,<title>foobarBug636725</title>" +
- "<p>test inspect() in Scratchpad";
-}
-
-function runTests()
-{
- let sp = gScratchpadWindow.Scratchpad;
- let doc = gScratchpadWindow.document;
-
- let methodsAndItems = {
- "sp-menu-newscratchpad": "openScratchpad",
- "sp-menu-open": "openFile",
- "sp-menu-save": "saveFile",
- "sp-menu-saveas": "saveFileAs",
- "sp-text-run": "run",
- "sp-text-inspect": "inspect",
- "sp-text-display": "display",
- "sp-text-resetContext": "resetContext",
- "sp-menu-content": "setContentContext",
- "sp-menu-browser": "setBrowserContext",
- };
-
- let lastMethodCalled = null;
- sp.__noSuchMethod__ = function(aMethodName) {
- lastMethodCalled = aMethodName;
- };
-
- for (let id in methodsAndItems) {
- lastMethodCalled = null;
-
- let methodName = methodsAndItems[id];
- let oldMethod = sp[methodName];
- ok(oldMethod, "found method " + methodName + " in Scratchpad object");
-
- delete sp[methodName];
-
- let menu = doc.getElementById(id);
- ok(menu, "found menuitem #" + id);
-
- try {
- menu.doCommand();
- }
- catch (ex) {
- ok(false, "exception thrown while executing the command of menuitem #" + id);
- }
-
- ok(lastMethodCalled == methodName,
- "method " + methodName + " invoked by the associated menuitem");
-
- sp[methodName] = oldMethod;
- }
-
- delete sp.__noSuchMethod__;
-
- finish();
-}
diff --git a/browser/devtools/scratchpad/test/head.js b/browser/devtools/scratchpad/test/head.js
deleted file mode 100644
index 07dfd0239..000000000
--- a/browser/devtools/scratchpad/test/head.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-
-Cu.import("resource://gre/modules/NetUtil.jsm", tempScope);
-Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
-Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", tempScope);
-
-
-let NetUtil = tempScope.NetUtil;
-let FileUtils = tempScope.FileUtils;
-let Promise = tempScope.Promise;
-
-let gScratchpadWindow; // Reference to the Scratchpad chrome window object
-
-/**
- * Open a Scratchpad window.
- *
- * @param function aReadyCallback
- * Optional. The function you want invoked when the Scratchpad instance
- * is ready.
- * @param object aOptions
- * Optional. Options for opening the scratchpad:
- * - window
- * Provide this if there's already a Scratchpad window you want to wait
- * loading for.
- * - state
- * Scratchpad state object. This is used when Scratchpad is open.
- * - noFocus
- * Boolean that tells you do not want the opened window to receive
- * focus.
- * @return nsIDOMWindow
- * The new window object that holds Scratchpad. Note that the
- * gScratchpadWindow global is also updated to reference the new window
- * object.
- */
-function openScratchpad(aReadyCallback, aOptions)
-{
- aOptions = aOptions || {};
-
- let win = aOptions.window ||
- Scratchpad.ScratchpadManager.openScratchpad(aOptions.state);
- if (!win) {
- return;
- }
-
- let onLoad = function() {
- win.removeEventListener("load", onLoad, false);
-
- win.Scratchpad.addObserver({
- onReady: function(aScratchpad) {
- aScratchpad.removeObserver(this);
-
- if (aOptions.noFocus) {
- aReadyCallback(win, aScratchpad);
- } else {
- waitForFocus(aReadyCallback.bind(null, win, aScratchpad), win);
- }
- }
- });
- };
-
- if (aReadyCallback) {
- win.addEventListener("load", onLoad, false);
- }
-
- gScratchpadWindow = win;
- return gScratchpadWindow;
-}
-
-/**
- * Create a temporary file, write to it and call a callback
- * when done.
- *
- * @param string aName
- * Name of your temporary file.
- * @param string aContent
- * Temporary file's contents.
- * @param function aCallback
- * Optional callback to be called when we're done writing
- * to the file. It will receive two parameters: status code
- * and a file object.
- */
-function createTempFile(aName, aContent, aCallback=function(){})
-{
- // Create a temporary file.
- let file = FileUtils.getFile("TmpD", [aName]);
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("666", 8));
-
- // Write the temporary file.
- let fout = Cc["@mozilla.org/network/file-output-stream;1"].
- createInstance(Ci.nsIFileOutputStream);
- fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
- parseInt("644", 8), fout.DEFER_OPEN);
-
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
- createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let fileContentStream = converter.convertToInputStream(aContent);
-
- NetUtil.asyncCopy(fileContentStream, fout, function (aStatus) {
- aCallback(aStatus, file);
- });
-}
-
-/**
- * Run a set of asychronous tests sequentially defined by input and output.
- *
- * @param Scratchpad aScratchpad
- * The scratchpad to use in running the tests.
- * @param array aTests
- * An array of test objects, each with the following properties:
- * - method
- * Scratchpad method to use, one of "run", "display", or "inspect".
- * - code
- * Code to run in the scratchpad.
- * - result
- * Expected code that will be in the scratchpad upon completion.
- * - label
- * The tests label which will be logged in the test runner output.
- * @return Promise
- * The promise that will be resolved when all tests are finished.
- */
-function runAsyncTests(aScratchpad, aTests)
-{
- let deferred = Promise.defer();
-
- (function runTest() {
- if (aTests.length) {
- let test = aTests.shift();
- aScratchpad.setText(test.code);
- aScratchpad[test.method]().then(function success() {
- is(aScratchpad.getText(), test.result, test.label);
- runTest();
- }, function failure(error) {
- ok(false, error.stack + " " + test.label);
- runTest();
- });
- } else {
- deferred.resolve();
- }
- })();
-
- return deferred.promise;
-}
-
-/**
- * Run a set of asychronous tests sequentially with callbacks to prepare each
- * test and to be called when the test result is ready.
- *
- * @param Scratchpad aScratchpad
- * The scratchpad to use in running the tests.
- * @param array aTests
- * An array of test objects, each with the following properties:
- * - method
- * Scratchpad method to use, one of "run", "display", or "inspect".
- * - prepare
- * The callback to run just prior to executing the scratchpad method.
- * - then
- * The callback to run when the scratchpad execution promise resolves.
- * @return Promise
- * The promise that will be resolved when all tests are finished.
- */
-function runAsyncCallbackTests(aScratchpad, aTests)
-{
- let deferred = Promise.defer();
-
- (function runTest() {
- if (aTests.length) {
- let test = aTests.shift();
- test.prepare();
- aScratchpad[test.method]().then(test.then.bind(test)).then(runTest);
- } else {
- deferred.resolve();
- }
- })();
-
- return deferred.promise;
-}
-
-
-function cleanup()
-{
- if (gScratchpadWindow) {
- gScratchpadWindow.close();
- gScratchpadWindow = null;
- }
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-}
-
-registerCleanupFunction(cleanup);
diff --git a/browser/devtools/scratchpad/test/moz.build b/browser/devtools/scratchpad/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/scratchpad/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/shared/moz.build b/browser/devtools/shared/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/shared/moz.build
+++ b/browser/devtools/shared/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/shared/test/Makefile.in b/browser/devtools/shared/test/Makefile.in
deleted file mode 100644
index 088cfa596..000000000
--- a/browser/devtools/shared/test/Makefile.in
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_eventemitter_basic.js \
- browser_layoutHelpers.js \
- browser_require_basic.js \
- browser_telemetry_buttonsandsidebar.js \
- browser_telemetry_toolboxtabs_inspector.js \
- browser_telemetry_toolboxtabs_jsdebugger.js \
- browser_telemetry_toolboxtabs_jsprofiler.js \
- browser_telemetry_toolboxtabs_netmonitor.js \
- browser_telemetry_toolboxtabs_options.js \
- browser_telemetry_toolboxtabs_styleeditor.js \
- browser_telemetry_toolboxtabs_webconsole.js \
- browser_templater_basic.js \
- browser_toolbar_basic.js \
- browser_toolbar_tooltip.js \
- browser_toolbar_webconsole_errors_count.js \
- head.js \
- leakhunt.js \
- $(NULL)
-
-MOCHITEST_BROWSER_FILES += \
- browser_templater_basic.html \
- browser_toolbar_basic.html \
- browser_toolbar_webconsole_errors_count.html \
- browser_layoutHelpers.html \
- browser_layoutHelpers_iframe.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/shared/test/browser_eventemitter_basic.js b/browser/devtools/shared/test/browser_eventemitter_basic.js
deleted file mode 100644
index 7e9cccae3..000000000
--- a/browser/devtools/shared/test/browser_eventemitter_basic.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test() {
- testEmitter();
- testEmitter({});
-}
-
-
-function testEmitter(aObject) {
- Cu.import("resource:///modules/devtools/shared/event-emitter.js", this);
-
- let emitter;
-
- if (aObject) {
- emitter = aObject;
- EventEmitter.decorate(emitter);
- } else {
- emitter = new EventEmitter();
- }
-
- ok(emitter, "We have an event emitter");
-
- emitter.on("next", next);
- emitter.emit("next", "abc", "def");
-
- let beenHere1 = false;
- function next(eventName, str1, str2) {
- is(eventName, "next", "Got event");
- is(str1, "abc", "Argument 1 is correct");
- is(str2, "def", "Argument 2 is correct");
-
- ok(!beenHere1, "first time in next callback");
- beenHere1 = true;
-
- emitter.off("next", next);
-
- emitter.emit("next");
-
- emitter.once("onlyonce", onlyOnce);
-
- emitter.emit("onlyonce");
- emitter.emit("onlyonce");
- }
-
- let beenHere2 = false;
- function onlyOnce() {
- ok(!beenHere2, "\"once\" listner has been called once");
- beenHere2 = true;
- emitter.emit("onlyonce");
-
- killItWhileEmitting();
- }
-
- function killItWhileEmitting() {
- function c1() {
- ok(true, "c1 called");
- }
- function c2() {
- ok(true, "c2 called");
- emitter.off("tick", c3);
- }
- function c3() {
- ok(false, "c3 should not be called");
- }
- function c4() {
- ok(true, "c4 called");
- }
-
- emitter.on("tick", c1);
- emitter.on("tick", c2);
- emitter.on("tick", c3);
- emitter.on("tick", c4);
-
- emitter.emit("tick");
-
- delete emitter;
- finish();
- }
-}
diff --git a/browser/devtools/shared/test/browser_layoutHelpers.html b/browser/devtools/shared/test/browser_layoutHelpers.html
deleted file mode 100644
index 3b9a285b4..000000000
--- a/browser/devtools/shared/test/browser_layoutHelpers.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title> Layout Helpers </title>
-
-<style>
- html {
- height: 300%;
- width: 300%;
- }
- div#some {
- position: absolute;
- background: black;
- width: 2px;
- height: 2px;
- }
- iframe {
- position: absolute;
- width: 40px;
- height: 40px;
- border: 0;
- }
-</style>
-
-<div id=some></div>
-<iframe id=frame src='./browser_layoutHelpers_iframe.html'></iframe>
diff --git a/browser/devtools/shared/test/browser_layoutHelpers.js b/browser/devtools/shared/test/browser_layoutHelpers.js
deleted file mode 100644
index 9747399a4..000000000
--- a/browser/devtools/shared/test/browser_layoutHelpers.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that scrollIntoViewIfNeeded works properly.
-
-let imported = {};
-Components.utils.import("resource:///modules/devtools/LayoutHelpers.jsm",
- imported);
-registerCleanupFunction(function () {
- imported = {};
-});
-
-let LayoutHelpers = imported.LayoutHelpers;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/browser_layoutHelpers.html";
-
-function test() {
- addTab(TEST_URI, function(browser, tab) {
- info("Starting browser_layoutHelpers.js");
- let doc = browser.contentDocument;
- runTest(doc.defaultView, doc.getElementById('some'));
- gBrowser.removeCurrentTab();
- finish();
- });
-}
-
-function runTest(win, some) {
- some.style.top = win.innerHeight + 'px';
- some.style.left = win.innerWidth + 'px';
- // The tests start with a black 2x2 pixels square below bottom right.
- // Do not resize the window during the tests.
-
- win.scroll(win.innerWidth / 2, win.innerHeight + 2); // Above the viewport.
- LayoutHelpers.scrollIntoViewIfNeeded(some);
- is(win.scrollY, Math.floor(win.innerHeight / 2) + 1,
- 'Element completely hidden above should appear centered.');
-
- win.scroll(win.innerWidth / 2, win.innerHeight + 1); // On the top edge.
- LayoutHelpers.scrollIntoViewIfNeeded(some);
- is(win.scrollY, win.innerHeight,
- 'Element partially visible above should appear above.');
-
- win.scroll(win.innerWidth / 2, 0); // Just below the viewport.
- LayoutHelpers.scrollIntoViewIfNeeded(some);
- is(win.scrollY, Math.floor(win.innerHeight / 2) + 1,
- 'Element completely hidden below should appear centered.');
-
- win.scroll(win.innerWidth / 2, 1); // On the bottom edge.
- LayoutHelpers.scrollIntoViewIfNeeded(some);
- is(win.scrollY, 2,
- 'Element partially visible below should appear below.');
-
-
- win.scroll(win.innerWidth / 2, win.innerHeight + 2); // Above the viewport.
- LayoutHelpers.scrollIntoViewIfNeeded(some, false);
- is(win.scrollY, win.innerHeight,
- 'Element completely hidden above should appear above ' +
- 'if parameter is false.');
-
- win.scroll(win.innerWidth / 2, win.innerHeight + 1); // On the top edge.
- LayoutHelpers.scrollIntoViewIfNeeded(some, false);
- is(win.scrollY, win.innerHeight,
- 'Element partially visible above should appear above ' +
- 'if parameter is false.');
-
- win.scroll(win.innerWidth / 2, 0); // Below the viewport.
- LayoutHelpers.scrollIntoViewIfNeeded(some, false);
- is(win.scrollY, 2,
- 'Element completely hidden below should appear below ' +
- 'if parameter is false.');
-
- win.scroll(win.innerWidth / 2, 1); // On the bottom edge.
- LayoutHelpers.scrollIntoViewIfNeeded(some, false);
- is(win.scrollY, 2,
- 'Element partially visible below should appear below ' +
- 'if parameter is false.');
-
- // The case of iframes.
- win.scroll(0, 0);
-
- let frame = win.document.getElementById('frame');
- let fwin = frame.contentWindow;
-
- frame.style.top = win.innerHeight + 'px';
- frame.style.left = win.innerWidth + 'px';
-
- fwin.addEventListener('load', function frameLoad() {
- let some = fwin.document.getElementById('some');
- LayoutHelpers.scrollIntoViewIfNeeded(some);
- is(win.scrollX, Math.floor(win.innerWidth / 2) + 20,
- 'Scrolling from an iframe should center the iframe vertically.');
- is(win.scrollY, Math.floor(win.innerHeight / 2) + 20,
- 'Scrolling from an iframe should center the iframe horizontally.');
- is(fwin.scrollX, Math.floor(fwin.innerWidth / 2) + 1,
- 'Scrolling from an iframe should center the element vertically.');
- is(fwin.scrollY, Math.floor(fwin.innerHeight / 2) + 1,
- 'Scrolling from an iframe should center the element horizontally.');
- }, false);
-}
diff --git a/browser/devtools/shared/test/browser_layoutHelpers_iframe.html b/browser/devtools/shared/test/browser_layoutHelpers_iframe.html
deleted file mode 100644
index 66ef5b293..000000000
--- a/browser/devtools/shared/test/browser_layoutHelpers_iframe.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<title> Layout Helpers </title>
-
-<style>
- html {
- height: 300%;
- width: 300%;
- }
- div#some {
- position: absolute;
- background: black;
- width: 2px;
- height: 2px;
- }
-</style>
-
-<div id=some></div>
-
diff --git a/browser/devtools/shared/test/browser_require_basic.js b/browser/devtools/shared/test/browser_require_basic.js
deleted file mode 100644
index f86974df4..000000000
--- a/browser/devtools/shared/test/browser_require_basic.js
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that source URLs in the Web Console can be clicked to display the
-// standard View Source window.
-
-let [ define, require ] = (function() {
- let tempScope = {};
- Components.utils.import("resource://gre/modules/devtools/Require.jsm", tempScope);
- return [ tempScope.define, tempScope.require ];
-})();
-
-function test() {
- addTab("about:blank", function() {
- info("Starting Require Tests");
- setup();
-
- testWorking();
- testDomains();
- testLeakage();
- testMultiImport();
- testRecursive();
- testUncompilable();
- testFirebug();
-
- shutdown();
- });
-}
-
-function setup() {
- define('gclitest/requirable', [ 'require', 'exports', 'module' ], function(require, exports, module) {
- exports.thing1 = 'thing1';
- exports.thing2 = 2;
-
- let status = 'initial';
- exports.setStatus = function(aStatus) { status = aStatus; };
- exports.getStatus = function() { return status; };
- });
-
- define('gclitest/unrequirable', [ 'require', 'exports', 'module' ], function(require, exports, module) {
- null.throwNPE();
- });
-
- define('gclitest/recurse', [ 'require', 'exports', 'module', 'gclitest/recurse' ], function(require, exports, module) {
- require('gclitest/recurse');
- });
-
- define('gclitest/firebug', [ 'gclitest/requirable' ], function(requirable) {
- return { requirable: requirable, fb: true };
- });
-}
-
-function shutdown() {
- delete define.modules['gclitest/requirable'];
- delete define.globalDomain.modules['gclitest/requirable'];
- delete define.modules['gclitest/unrequirable'];
- delete define.globalDomain.modules['gclitest/unrequirable'];
- delete define.modules['gclitest/recurse'];
- delete define.globalDomain.modules['gclitest/recurse'];
- delete define.modules['gclitest/firebug'];
- delete define.globalDomain.modules['gclitest/firebug'];
-
- define = undefined;
- require = undefined;
-
- finish();
-}
-
-function testWorking() {
- // 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
- let requireable = require('gclitest/requirable');
- is('thing1', requireable.thing1, 'thing1 was required');
- is(2, requireable.thing2, 'thing2 was required');
- is(requireable.thing3, undefined, 'thing3 was not required');
-}
-
-function testDomains() {
- let requireable = require('gclitest/requirable');
- is(requireable.status, undefined, 'requirable has no status');
- requireable.setStatus(null);
- is(null, requireable.getStatus(), 'requirable.getStatus changed to null');
- is(requireable.status, undefined, 'requirable still has no status');
- requireable.setStatus('42');
- is('42', requireable.getStatus(), 'requirable.getStatus changed to 42');
- is(requireable.status, undefined, 'requirable *still* has no status');
-
- let domain = new define.Domain();
- let requireable2 = domain.require('gclitest/requirable');
- is(requireable2.status, undefined, 'requirable2 has no status');
- is('initial', requireable2.getStatus(), 'requirable2.getStatus is initial');
- requireable2.setStatus(999);
- is(999, requireable2.getStatus(), 'requirable2.getStatus changed to 999');
- is(requireable2.status, undefined, 'requirable2 still has no status');
-
- is('42', requireable.getStatus(), 'status 42');
- ok(requireable.status === undefined, 'requirable has no status (as expected)');
-
- delete domain.modules['gclitest/requirable'];
-}
-
-function testLeakage() {
- let requireable = require('gclitest/requirable');
- is(requireable.setup, null, 'leakage of setup');
- is(requireable.shutdown, null, 'leakage of shutdown');
- is(requireable.testWorking, null, 'leakage of testWorking');
-}
-
-function testMultiImport() {
- let r1 = require('gclitest/requirable');
- let r2 = require('gclitest/requirable');
- is(r1, r2, 'double require was strict equal');
-}
-
-function testUncompilable() {
- // 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
- try {
- let unrequireable = require('gclitest/unrequirable');
- fail();
- }
- catch (ex) {
- // an exception is expected
- }
-}
-
-function testRecursive() {
- // See Bug 658583
- // require('gclitest/recurse');
- // Also see the comments in the testRecursive() function
-}
-
-function testFirebug() {
- let requirable = require('gclitest/requirable');
- let firebug = require('gclitest/firebug');
- ok(firebug.fb, 'firebug.fb is true');
- is(requirable, firebug.requirable, 'requirable pass-through');
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_buttonsandsidebar.js b/browser/devtools/shared/test/browser_telemetry_buttonsandsidebar.js
deleted file mode 100644
index 8553ed799..000000000
--- a/browser/devtools/shared/test/browser_telemetry_buttonsandsidebar.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_buttonsandsidebar.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- testButtons();
-}
-
-function testButtons() {
- info("Testing buttons");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- let container = toolbox.doc.getElementById("toolbox-buttons");
- let buttons = container.getElementsByTagName("toolbarbutton");
-
- // Copy HTMLCollection to array.
- buttons = Array.prototype.slice.call(buttons);
-
- (function testButton() {
- let button = buttons.pop();
-
- if (button) {
- info("Clicking button " + button.id);
- button.click();
- delayedClicks(button, 3).then(function(button) {
- if (buttons.length == 0) {
- // Remove scratchpads
- let wins = Services.wm.getEnumerator("devtools:scratchpad");
- while (wins.hasMoreElements()) {
- let win = wins.getNext();
- info("Closing scratchpad window");
- win.close();
- }
-
- testSidebar();
- } else {
- setTimeout(testButton, TOOL_DELAY);
- }
- });
- }
- })();
- }).then(null, reportError);
-}
-
-function delayedClicks(node, clicks) {
- let deferred = Promise.defer();
- let clicked = 0;
-
- setTimeout(function delayedClick() {
- info("Clicking button " + node.id);
- node.click();
- clicked++;
-
- if (clicked >= clicks) {
- deferred.resolve(node);
- } else {
- setTimeout(delayedClick, TOOL_DELAY);
- }
- }, TOOL_DELAY);
-
- return deferred.promise;
-}
-
-function testSidebar() {
- info("Testing sidebar");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- let inspector = toolbox.getCurrentPanel();
- let sidebarTools = ["ruleview", "computedview", "fontinspector", "layoutview"];
-
- // Concatenate the array with itself so that we can open each tool twice.
- sidebarTools.push.apply(sidebarTools, sidebarTools);
-
- setTimeout(function selectSidebarTab() {
- let tool = sidebarTools.pop();
- if (tool) {
- inspector.sidebar.select(tool);
- setTimeout(function() {
- setTimeout(selectSidebarTab, TOOL_DELAY);
- }, TOOL_DELAY);
- } else {
- checkResults();
- }
- }, TOOL_DELAY);
- });
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.startsWith("DEVTOOLS_INSPECTOR_")) {
- // Inspector stats are tested in browser_telemetry_toolboxtabs.js so we
- // skip them here because we only open the inspector once for this test.
- continue;
- }
-
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js
deleted file mode 100644
index e53c1b829..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_inspector.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("inspector", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js
deleted file mode 100644
index 1b1a6234b..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_jsdebugger.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("jsdebugger", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js
deleted file mode 100644
index 567219222..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_jsprofiler.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("jsprofiler", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js
deleted file mode 100644
index bc139acfb..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_netmonitor.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("netmonitor", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js
deleted file mode 100644
index 687a07c38..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_options.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("options", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js
deleted file mode 100644
index 9e30c74fa..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_styleeditor.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("styleeditor", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js
deleted file mode 100644
index ba027e7fd..000000000
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_styleeditor_webconsole.js</p>";
-
-// Because we need to gather stats for the period of time that a tool has been
-// opened we make use of setTimeout() to create tool active times.
-const TOOL_DELAY = 200;
-
-let {Promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {});
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-
-let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
-let Telemetry = require("devtools/shared/telemetry");
-
-function init() {
- Telemetry.prototype.telemetryInfo = {};
- Telemetry.prototype._oldlog = Telemetry.prototype.log;
- Telemetry.prototype.log = function(histogramId, value) {
- if (histogramId) {
- if (!this.telemetryInfo[histogramId]) {
- this.telemetryInfo[histogramId] = [];
- }
-
- this.telemetryInfo[histogramId].push(value);
- }
- }
-
- openToolboxTabTwice("webconsole", false);
-}
-
-function openToolboxTabTwice(id, secondPass) {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, id).then(function(toolbox) {
- info("Toolbox tab " + id + " opened");
-
- toolbox.once("destroyed", function() {
- if (secondPass) {
- checkResults();
- } else {
- openToolboxTabTwice(id, true);
- }
- });
- // We use a timeout to check the tools active time
- setTimeout(function() {
- gDevTools.closeToolbox(target);
- }, TOOL_DELAY);
- }).then(null, reportError);
-}
-
-function checkResults() {
- let result = Telemetry.prototype.telemetryInfo;
-
- for (let [histId, value] of Iterator(result)) {
- if (histId.endsWith("OPENED_PER_USER_FLAG")) {
- ok(value.length === 1 && value[0] === true,
- "Per user value " + histId + " has a single value of true");
- } else if (histId.endsWith("OPENED_BOOLEAN")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element === true;
- });
-
- ok(okay, "All " + histId + " entries are === true");
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
- ok(value.length > 1, histId + " has more than one entry");
-
- let okay = value.every(function(element) {
- return element > 0;
- });
-
- ok(okay, "All " + histId + " entries have time > 0");
- }
- }
-
- finishUp();
-}
-
-function reportError(error) {
- let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
-
- ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
- error.lineNumber + "\n\nStack trace:" + stack);
- finishUp();
-}
-
-function finishUp() {
- gBrowser.removeCurrentTab();
-
- Telemetry.prototype.log = Telemetry.prototype._oldlog;
- delete Telemetry.prototype._oldlog;
- delete Telemetry.prototype.telemetryInfo;
-
- TargetFactory = Services = Promise = require = null;
-
- finish();
-}
-
-function test() {
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- waitForFocus(init, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/shared/test/browser_templater_basic.html b/browser/devtools/shared/test/browser_templater_basic.html
deleted file mode 100644
index 473c731f3..000000000
--- a/browser/devtools/shared/test/browser_templater_basic.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<html>
-<head>
- <title>DOM Template Tests</title>
-</head>
-<body>
-
-</body>
-</html>
-
diff --git a/browser/devtools/shared/test/browser_templater_basic.js b/browser/devtools/shared/test/browser_templater_basic.js
deleted file mode 100644
index ce8cb130e..000000000
--- a/browser/devtools/shared/test/browser_templater_basic.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the DOM Template engine works properly
-
-/*
- * These tests run both in Mozilla/Mochitest and plain browsers (as does
- * domtemplate)
- * We should endevour to keep the source in sync.
- */
-
-var Promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}).Promise;
-var template = Cu.import("resource://gre/modules/devtools/Templater.jsm", {}).template;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/browser_templater_basic.html";
-
-function test() {
- addTab(TEST_URI, function() {
- info("Starting DOM Templater Tests");
- runTest(0);
- });
-}
-
-function runTest(index) {
- var options = tests[index] = tests[index]();
- var holder = content.document.createElement('div');
- holder.id = options.name;
- var body = content.document.body;
- body.appendChild(holder);
- holder.innerHTML = options.template;
-
- info('Running ' + options.name);
- template(holder, options.data, options.options);
-
- if (typeof options.result == 'string') {
- is(holder.innerHTML, options.result, options.name);
- }
- else {
- ok(holder.innerHTML.match(options.result) != null,
- options.name + ' result=\'' + holder.innerHTML + '\'');
- }
-
- if (options.also) {
- options.also(options);
- }
-
- function runNextTest() {
- index++;
- if (index < tests.length) {
- runTest(index);
- }
- else {
- finished();
- }
- }
-
- if (options.later) {
- var ais = is.bind(this);
-
- function createTester(holder, options) {
- return function() {
- ais(holder.innerHTML, options.later, options.name + ' later');
- runNextTest();
- }.bind(this);
- }
-
- executeSoon(createTester(holder, options));
- }
- else {
- runNextTest();
- }
-}
-
-function finished() {
- gBrowser.removeCurrentTab();
- info("Finishing DOM Templater Tests");
- tests = null;
- finish();
-}
-
-/**
- * Why have an array of functions that return data rather than just an array
- * of the data itself? Some of these tests contain calls to delayReply() which
- * sets up async processing using executeSoon(). Since the execution of these
- * tests is asynchronous, the delayed reply will probably arrive before the
- * test is executed, making the test be synchronous. So we wrap the data in a
- * function so we only set it up just before we use it.
- */
-var tests = [
- function() { return {
- name: 'simpleNesting',
- template: '<div id="ex1">${nested.value}</div>',
- data: { nested:{ value:'pass 1' } },
- result: '<div id="ex1">pass 1</div>'
- };},
-
- function() { return {
- name: 'returnDom',
- template: '<div id="ex2">${__element.ownerDocument.createTextNode(\'pass 2\')}</div>',
- options: { allowEval: true },
- data: {},
- result: '<div id="ex2">pass 2</div>'
- };},
-
- function() { return {
- name: 'srcChange',
- template: '<img _src="${fred}" id="ex3">',
- data: { fred:'green.png' },
- result: /<img( id="ex3")? src="green.png"( id="ex3")?>/
- };},
-
- function() { return {
- name: 'ifTrue',
- template: '<p if="${name !== \'jim\'}">hello ${name}</p>',
- options: { allowEval: true },
- data: { name: 'fred' },
- result: '<p>hello fred</p>'
- };},
-
- function() { return {
- name: 'ifFalse',
- template: '<p if="${name !== \'jim\'}">hello ${name}</p>',
- options: { allowEval: true },
- data: { name: 'jim' },
- result: ''
- };},
-
- function() { return {
- name: 'simpleLoop',
- template: '<p foreach="index in ${[ 1, 2, 3 ]}">${index}</p>',
- options: { allowEval: true },
- data: {},
- result: '<p>1</p><p>2</p><p>3</p>'
- };},
-
- function() { return {
- name: 'loopElement',
- template: '<loop foreach="i in ${array}">${i}</loop>',
- data: { array: [ 1, 2, 3 ] },
- result: '123'
- };},
-
- // Bug 692028: DOMTemplate memory leak with asynchronous arrays
- // Bug 692031: DOMTemplate async loops do not drop the loop element
- function() { return {
- name: 'asyncLoopElement',
- template: '<loop foreach="i in ${array}">${i}</loop>',
- data: { array: delayReply([1, 2, 3]) },
- result: '<span></span>',
- later: '123'
- };},
-
- function() { return {
- name: 'saveElement',
- template: '<p save="${element}">${name}</p>',
- data: { name: 'pass 8' },
- result: '<p>pass 8</p>',
- also: function(options) {
- ok(options.data.element.innerHTML, 'pass 9', 'saveElement saved');
- delete options.data.element;
- }
- };},
-
- function() { return {
- name: 'useElement',
- template: '<p id="pass9">${adjust(__element)}</p>',
- options: { allowEval: true },
- data: {
- adjust: function(element) {
- is('pass9', element.id, 'useElement adjust');
- return 'pass 9b'
- }
- },
- result: '<p id="pass9">pass 9b</p>'
- };},
-
- function() { return {
- name: 'asyncInline',
- template: '${delayed}',
- data: { delayed: delayReply('inline') },
- result: '<span></span>',
- later: 'inline'
- };},
-
- // Bug 692028: DOMTemplate memory leak with asynchronous arrays
- function() { return {
- name: 'asyncArray',
- template: '<p foreach="i in ${delayed}">${i}</p>',
- data: { delayed: delayReply([1, 2, 3]) },
- result: '<span></span>',
- later: '<p>1</p><p>2</p><p>3</p>'
- };},
-
- function() { return {
- name: 'asyncMember',
- template: '<p foreach="i in ${delayed}">${i}</p>',
- data: { delayed: [delayReply(4), delayReply(5), delayReply(6)] },
- result: '<span></span><span></span><span></span>',
- later: '<p>4</p><p>5</p><p>6</p>'
- };},
-
- // Bug 692028: DOMTemplate memory leak with asynchronous arrays
- function() { return {
- name: 'asyncBoth',
- template: '<p foreach="i in ${delayed}">${i}</p>',
- data: {
- delayed: delayReply([
- delayReply(4),
- delayReply(5),
- delayReply(6)
- ])
- },
- result: '<span></span>',
- later: '<p>4</p><p>5</p><p>6</p>'
- };},
-
- // Bug 701762: DOMTemplate fails when ${foo()} returns undefined
- function() { return {
- name: 'functionReturningUndefiend',
- template: '<p>${foo()}</p>',
- options: { allowEval: true },
- data: {
- foo: function() {}
- },
- result: '<p>undefined</p>'
- };},
-
- // Bug 702642: DOMTemplate is relatively slow when evaluating JS ${}
- function() { return {
- name: 'propertySimple',
- template: '<p>${a.b.c}</p>',
- data: { a: { b: { c: 'hello' } } },
- result: '<p>hello</p>'
- };},
-
- function() { return {
- name: 'propertyPass',
- template: '<p>${Math.max(1, 2)}</p>',
- options: { allowEval: true },
- result: '<p>2</p>'
- };},
-
- function() { return {
- name: 'propertyFail',
- template: '<p>${Math.max(1, 2)}</p>',
- result: '<p>${Math.max(1, 2)}</p>'
- };},
-
- // Bug 723431: DOMTemplate should allow customisation of display of
- // null/undefined values
- function() { return {
- name: 'propertyUndefAttrFull',
- template: '<p>${nullvar}|${undefinedvar1}|${undefinedvar2}</p>',
- data: { nullvar: null, undefinedvar1: undefined },
- result: '<p>null|undefined|undefined</p>'
- };},
-
- function() { return {
- name: 'propertyUndefAttrBlank',
- template: '<p>${nullvar}|${undefinedvar1}|${undefinedvar2}</p>',
- data: { nullvar: null, undefinedvar1: undefined },
- options: { blankNullUndefined: true },
- result: '<p>||</p>'
- };},
-
- function() { return {
- name: 'propertyUndefAttrFull',
- template: '<div><p value="${nullvar}"></p><p value="${undefinedvar1}"></p><p value="${undefinedvar2}"></p></div>',
- data: { nullvar: null, undefinedvar1: undefined },
- result: '<div><p value="null"></p><p value="undefined"></p><p value="undefined"></p></div>'
- };},
-
- function() { return {
- name: 'propertyUndefAttrBlank',
- template: '<div><p value="${nullvar}"></p><p value="${undefinedvar1}"></p><p value="${undefinedvar2}"></p></div>',
- data: { nullvar: null, undefinedvar1: undefined },
- options: { blankNullUndefined: true },
- result: '<div><p value=""></p><p value=""></p><p value=""></p></div>'
- };}
-];
-
-function delayReply(data) {
- var d = Promise.defer();
- executeSoon(function() {
- d.resolve(data);
- });
- return d.promise;
-}
diff --git a/browser/devtools/shared/test/browser_toolbar_basic.html b/browser/devtools/shared/test/browser_toolbar_basic.html
deleted file mode 100644
index 7ec012b0e..000000000
--- a/browser/devtools/shared/test/browser_toolbar_basic.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!doctype html>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Developer Toolbar Tests</title>
- <style type="text/css">
- #single { color: red; }
- </style>
- <script type="text/javascript">var a=1;</script>
-</head>
-<body>
-
-<p id=single>
-1
-</p>
-
-<p class=twin>
-2a
-</p>
-
-<p class=twin>
-2b
-</p>
-
-<style>
-.twin { color: blue; }
-</style>
-<script>var b=2;</script>
-
-</body>
-</html>
-
diff --git a/browser/devtools/shared/test/browser_toolbar_basic.js b/browser/devtools/shared/test/browser_toolbar_basic.js
deleted file mode 100644
index 8819effc1..000000000
--- a/browser/devtools/shared/test/browser_toolbar_basic.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the developer toolbar works properly
-
-const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/browser_toolbar_basic.html";
-
-function test() {
- addTab(TEST_URI, function(browser, tab) {
- info("Starting browser_toolbar_basic.js");
- runTest();
- });
-}
-
-function runTest() {
- ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in runTest");
-
- oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkOpen));
- document.getElementById("Tools:DevToolbar").doCommand();
-}
-
-function isChecked(b) {
- return b.getAttribute("checked") == "true";
-}
-
-function checkOpen() {
- ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkOpen");
- let close = document.getElementById("developer-toolbar-closebutton");
- ok(close, "Close button exists");
-
- let toggleToolbox =
- document.getElementById("devtoolsMenuBroadcaster_DevToolbox");
- ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
-
- addTab("about:blank", function(browser, tab) {
- info("Opened a new tab");
-
- ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
-
- gBrowser.removeCurrentTab();
-
- oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkClosed));
- document.getElementById("Tools:DevToolbar").doCommand();
- });
- });
-}
-
-function checkClosed() {
- ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkClosed");
-
- oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkReOpen));
- document.getElementById("Tools:DevToolbar").doCommand();
-}
-
-function checkReOpen() {
- ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkReOpen");
-
- let toggleToolbox =
- document.getElementById("devtoolsMenuBroadcaster_DevToolbox");
- ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
-
- oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkReClosed));
- document.getElementById("developer-toolbar-closebutton").doCommand();
-}
-
-function checkReClosed() {
- ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkReClosed");
-
- finish();
-}
diff --git a/browser/devtools/shared/test/browser_toolbar_tooltip.js b/browser/devtools/shared/test/browser_toolbar_tooltip.js
deleted file mode 100644
index fa86b2fcb..000000000
--- a/browser/devtools/shared/test/browser_toolbar_tooltip.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the developer toolbar works properly
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>Tooltip Tests</p>";
-
-function test() {
- addTab(TEST_URI, function(browser, tab) {
- info("Starting browser_toolbar_tooltip.js");
- openTest();
- });
-}
-
-function openTest() {
- ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in runTest");
-
- oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(runTest));
- document.getElementById("Tools:DevToolbar").doCommand();
-}
-
-function runTest() {
- let tooltipPanel = DeveloperToolbar.tooltipPanel;
-
- DeveloperToolbar.display.focusManager.helpRequest();
- DeveloperToolbar.display.inputter.setInput('help help');
-
- DeveloperToolbar.display.inputter.setCursor({ start: 'help help'.length });
- is(tooltipPanel._dimensions.start, 'help '.length,
- 'search param start, when cursor at end');
- ok(getLeftMargin() > 30, 'tooltip offset, when cursor at end')
-
- DeveloperToolbar.display.inputter.setCursor({ start: 'help'.length });
- is(tooltipPanel._dimensions.start, 0,
- 'search param start, when cursor at end of command');
- ok(getLeftMargin() > 9, 'tooltip offset, when cursor at end of command')
-
- DeveloperToolbar.display.inputter.setCursor({ start: 'help help'.length - 1 });
- is(tooltipPanel._dimensions.start, 'help '.length,
- 'search param start, when cursor at penultimate position');
- ok(getLeftMargin() > 30, 'tooltip offset, when cursor at penultimate position')
-
- DeveloperToolbar.display.inputter.setCursor({ start: 0 });
- is(tooltipPanel._dimensions.start, 0,
- 'search param start, when cursor at start');
- ok(getLeftMargin() > 9, 'tooltip offset, when cursor at start')
-
- finish();
-}
-
-function getLeftMargin() {
- let style = DeveloperToolbar.tooltipPanel._panel.style.marginLeft;
- return parseInt(style.slice(0, -2), 10);
-}
diff --git a/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.html b/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.html
deleted file mode 100644
index 216cc0d49..000000000
--- a/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE HTML>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Developer Toolbar Tests - errors count in the Web Console button</title>
- <script type="text/javascript">
- console.log("foobarBug762996consoleLog");
- window.onload = function() {
- window.foobarBug762996load();
- };
- window.foobarBug762996a();
- </script>
- <script type="text/javascript">
- window.foobarBug762996b();
- </script>
-</head>
-<body>
- <p>Hello world! Test for errors count in the Web Console button (developer
- toolbar).</p>
- <p style="color: foobarBug762996css"><button>click me</button></p>
- <script type="text/javascript;version=1.8">
- "use strict";
- let testObj = {};
- document.querySelector("button").onclick = function() {
- let test = testObj.fooBug788445 + "warning";
- window.foobarBug762996click();
- };
- </script>
-</body>
-</html>
diff --git a/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.js b/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.js
deleted file mode 100644
index aaf027451..000000000
--- a/browser/devtools/shared/test/browser_toolbar_webconsole_errors_count.js
+++ /dev/null
@@ -1,245 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the developer toolbar errors count works properly.
-
-function test() {
- const TEST_URI = "http://example.com/browser/browser/devtools/shared/test/" +
- "browser_toolbar_webconsole_errors_count.html";
-
- let HUDService = Cu.import("resource:///modules/HUDService.jsm",
- {}).HUDService;
- let gDevTools = Cu.import("resource:///modules/devtools/gDevTools.jsm",
- {}).gDevTools;
-
- let webconsole = document.getElementById("developer-toolbar-toolbox-button");
- let tab1, tab2;
-
- Services.prefs.setBoolPref("javascript.options.strict", true);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("javascript.options.strict");
- });
-
- ignoreAllUncaughtExceptions();
- addTab(TEST_URI, openToolbar);
-
- function openToolbar(browser, tab) {
- tab1 = tab;
- ignoreAllUncaughtExceptions(false);
-
- expectUncaughtException();
-
- if (!DeveloperToolbar.visible) {
- DeveloperToolbar.show(true, onOpenToolbar);
- }
- else {
- onOpenToolbar();
- }
- }
-
- function onOpenToolbar() {
- ok(DeveloperToolbar.visible, "DeveloperToolbar is visible");
-
- waitForButtonUpdate({
- name: "web console button shows page errors",
- errors: 3,
- warnings: 0,
- callback: addErrors,
- });
- }
-
- function addErrors() {
- expectUncaughtException();
-
- waitForFocus(function() {
- let button = content.document.querySelector("button");
- executeSoon(function() {
- EventUtils.synthesizeMouse(button, 3, 2, {}, content);
- });
- }, content);
-
- waitForButtonUpdate({
- name: "button shows one more error after click in page",
- errors: 4,
- warnings: 1,
- callback: () => {
- ignoreAllUncaughtExceptions();
- addTab(TEST_URI, onOpenSecondTab);
- },
- });
- }
-
- function onOpenSecondTab(browser, tab) {
- tab2 = tab;
-
- ignoreAllUncaughtExceptions(false);
- expectUncaughtException();
-
- waitForButtonUpdate({
- name: "button shows correct number of errors after new tab is open",
- errors: 3,
- warnings: 0,
- callback: switchToTab1,
- });
- }
-
- function switchToTab1() {
- gBrowser.selectedTab = tab1;
- waitForButtonUpdate({
- name: "button shows the page errors from tab 1",
- errors: 4,
- warnings: 1,
- callback: openWebConsole.bind(null, tab1, onWebConsoleOpen),
- });
- }
-
- function onWebConsoleOpen(hud) {
- waitForValue({
- name: "web console shows the page errors",
- validator: function() {
- return hud.outputNode.querySelectorAll(".hud-exception").length;
- },
- value: 4,
- success: checkConsoleOutput.bind(null, hud),
- failure: finish,
- });
- }
-
- function checkConsoleOutput(hud) {
- let msgs = ["foobarBug762996a", "foobarBug762996b", "foobarBug762996load",
- "foobarBug762996click", "foobarBug762996consoleLog",
- "foobarBug762996css", "fooBug788445"];
- msgs.forEach(function(msg) {
- isnot(hud.outputNode.textContent.indexOf(msg), -1,
- msg + " found in the Web Console output");
- });
-
- hud.jsterm.clearOutput();
-
- is(hud.outputNode.textContent.indexOf("foobarBug762996color"), -1,
- "clearOutput() worked");
-
- expectUncaughtException();
- let button = content.document.querySelector("button");
- EventUtils.synthesizeMouse(button, 2, 2, {}, content);
-
- waitForButtonUpdate({
- name: "button shows one more error after another click in page",
- errors: 5,
- warnings: 1, // warnings are not repeated by the js engine
- callback: () => waitForValue(waitForNewError),
- });
-
- let waitForNewError = {
- name: "the Web Console displays the new error",
- validator: function() {
- return hud.outputNode.textContent.indexOf("foobarBug762996click") > -1;
- },
- success: doClearConsoleButton.bind(null, hud),
- failure: finish,
- };
- }
-
- function doClearConsoleButton(hud) {
- let clearButton = hud.ui.rootElement
- .querySelector(".webconsole-clear-console-button");
- EventUtils.synthesizeMouse(clearButton, 2, 2, {}, hud.iframeWindow);
-
- is(hud.outputNode.textContent.indexOf("foobarBug762996click"), -1,
- "clear console button worked");
- is(getErrorsCount(), 0, "page errors counter has been reset");
- let tooltip = getTooltipValues();
- is(tooltip[1], 0, "page warnings counter has been reset");
-
- doPageReload(hud);
- }
-
- function doPageReload(hud) {
- tab1.linkedBrowser.addEventListener("load", onReload, true);
-
- ignoreAllUncaughtExceptions();
- content.location.reload();
-
- function onReload() {
- tab1.linkedBrowser.removeEventListener("load", onReload, true);
- ignoreAllUncaughtExceptions(false);
- expectUncaughtException();
-
- waitForButtonUpdate({
- name: "the Web Console button count has been reset after page reload",
- errors: 3,
- warnings: 0,
- callback: waitForValue.bind(null, waitForConsoleOutputAfterReload),
- });
- }
-
- let waitForConsoleOutputAfterReload = {
- name: "the Web Console displays the correct number of errors after reload",
- validator: function() {
- return hud.outputNode.querySelectorAll(".hud-exception").length;
- },
- value: 3,
- success: function() {
- isnot(hud.outputNode.textContent.indexOf("foobarBug762996load"), -1,
- "foobarBug762996load found in console output after page reload");
- testEnd();
- },
- failure: testEnd,
- };
- }
-
- function testEnd() {
- document.getElementById("developer-toolbar-closebutton").doCommand();
- let target1 = TargetFactory.forTab(tab1);
- gDevTools.closeToolbox(target1);
- gBrowser.removeTab(tab1);
- gBrowser.removeTab(tab2);
- finish();
- }
-
- // Utility functions
-
- function getErrorsCount() {
- let count = webconsole.getAttribute("error-count");
- return count ? count : "0";
- }
-
- function getTooltipValues() {
- let matches = webconsole.getAttribute("tooltiptext")
- .match(/(\d+) errors?, (\d+) warnings?/);
- return matches ? [matches[1], matches[2]] : [0, 0];
- }
-
- function waitForButtonUpdate(options) {
- function check() {
- let errors = getErrorsCount();
- let tooltip = getTooltipValues();
- let result = errors == options.errors && tooltip[1] == options.warnings;
- if (result) {
- ok(true, options.name);
- is(errors, tooltip[0], "button error-count is the same as in the tooltip");
-
- // Get out of the toolbar event execution loop.
- executeSoon(options.callback);
- }
- return result;
- }
-
- if (!check()) {
- info("wait for: " + options.name);
- DeveloperToolbar.on("errors-counter-updated", function onUpdate(event) {
- if (check()) {
- DeveloperToolbar.off(event, onUpdate);
- }
- });
- }
- }
-
- function openWebConsole(tab, callback)
- {
- let target = TargetFactory.forTab(tab);
- gDevTools.showToolbox(target, "webconsole").then((toolbox) =>
- callback(toolbox.getCurrentPanel().hud));
- }
-}
diff --git a/browser/devtools/shared/test/head.js b/browser/devtools/shared/test/head.js
deleted file mode 100644
index d79c5c4c8..000000000
--- a/browser/devtools/shared/test/head.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TargetFactory = devtools.TargetFactory;
-
-/**
- * Open a new tab at a URL and call a callback on load
- */
-function addTab(aURL, aCallback)
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- content.location = aURL;
-
- let tab = gBrowser.selectedTab;
- let browser = gBrowser.getBrowserForTab(tab);
-
- function onTabLoad() {
- browser.removeEventListener("load", onTabLoad, true);
- aCallback(browser, tab, browser.contentDocument);
- }
-
- browser.addEventListener("load", onTabLoad, true);
-}
-
-registerCleanupFunction(function tearDown() {
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-
- console = undefined;
-});
-
-function catchFail(func) {
- return function() {
- try {
- return func.apply(null, arguments);
- }
- catch (ex) {
- ok(false, ex);
- console.error(ex);
- finish();
- throw ex;
- }
- };
-}
-
-/**
- * Polls a given function waiting for the given value.
- *
- * @param object aOptions
- * Options object with the following properties:
- * - validator
- * A validator function that should return the expected value. This is
- * called every few milliseconds to check if the result is the expected
- * one. When the returned result is the expected one, then the |success|
- * function is called and polling stops. If |validator| never returns
- * the expected value, then polling timeouts after several tries and
- * a failure is recorded - the given |failure| function is invoked.
- * - success
- * A function called when the validator function returns the expected
- * value.
- * - failure
- * A function called if the validator function timeouts - fails to return
- * the expected value in the given time.
- * - name
- * Name of test. This is used to generate the success and failure
- * messages.
- * - timeout
- * Timeout for validator function, in milliseconds. Default is 5000 ms.
- * - value
- * The expected value. If this option is omitted then the |validator|
- * function must return a trueish value.
- * Each of the provided callback functions will receive two arguments:
- * the |aOptions| object and the last value returned by |validator|.
- */
-function waitForValue(aOptions)
-{
- let start = Date.now();
- let timeout = aOptions.timeout || 5000;
- let lastValue;
-
- function wait(validatorFn, successFn, failureFn)
- {
- if ((Date.now() - start) > timeout) {
- // Log the failure.
- ok(false, "Timed out while waiting for: " + aOptions.name);
- let expected = "value" in aOptions ?
- "'" + aOptions.value + "'" :
- "a trueish value";
- info("timeout info :: got '" + lastValue + "', expected " + expected);
- failureFn(aOptions, lastValue);
- return;
- }
-
- lastValue = validatorFn(aOptions, lastValue);
- let successful = "value" in aOptions ?
- lastValue == aOptions.value :
- lastValue;
- if (successful) {
- ok(true, aOptions.name);
- successFn(aOptions, lastValue);
- }
- else {
- setTimeout(function() wait(validatorFn, successFn, failureFn), 100);
- }
- }
-
- wait(aOptions.validator, aOptions.success, aOptions.failure);
-}
-
-function oneTimeObserve(name, callback) {
- var func = function() {
- Services.obs.removeObserver(func, name);
- callback();
- };
- Services.obs.addObserver(func, name, false);
-}
diff --git a/browser/devtools/shared/test/leakhunt.js b/browser/devtools/shared/test/leakhunt.js
deleted file mode 100644
index 66d067a3c..000000000
--- a/browser/devtools/shared/test/leakhunt.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Memory leak hunter. Walks a tree of objects looking for DOM nodes.
- * Usage:
- * leakHunt({
- * thing: thing,
- * otherthing: otherthing
- * });
- */
-function leakHunt(root) {
- var path = [];
- var seen = [];
-
- try {
- var output = leakHunt.inner(root, path, seen);
- output.forEach(function(line) {
- dump(line + '\n');
- });
- }
- catch (ex) {
- dump(ex + '\n');
- }
-}
-
-leakHunt.inner = function LH_inner(root, path, seen) {
- var prefix = new Array(path.length).join(' ');
-
- var reply = [];
- function log(msg) {
- reply.push(msg);
- }
-
- var direct
- try {
- direct = Object.keys(root);
- }
- catch (ex) {
- log(prefix + ' Error enumerating: ' + ex);
- return reply;
- }
-
- try {
- var index = 0;
- for (var data of root) {
- var prop = '' + index;
- leakHunt.digProperty(prop, data, path, seen, direct, log);
- index++;
- }
- }
- catch (ex) { /* Ignore things that are not enumerable */ }
-
- for (var prop in root) {
- var data;
- try {
- data = root[prop];
- }
- catch (ex) {
- log(prefix + ' ' + prop + ' = Error: ' + ex.toString().substring(0, 30));
- continue;
- }
-
- leakHunt.digProperty(prop, data, path, seen, direct, log);
- }
-
- return reply;
-}
-
-leakHunt.hide = [ /^string$/, /^number$/, /^boolean$/, /^null/, /^undefined/ ];
-
-leakHunt.noRecurse = [
- /^string$/, /^number$/, /^boolean$/, /^null/, /^undefined/,
- /^Window$/, /^Document$/,
- /^XULDocument$/, /^XULElement$/,
- /^DOMWindow$/, /^HTMLDocument$/, /^HTML.*Element$/, /^ChromeWindow$/
-];
-
-leakHunt.digProperty = function LH_digProperty(prop, data, path, seen, direct, log) {
- var newPath = path.slice();
- newPath.push(prop);
- var prefix = new Array(newPath.length).join(' ');
-
- var recurse = true;
- var message = leakHunt.getType(data);
-
- if (leakHunt.matchesAnyPattern(message, leakHunt.hide)) {
- return;
- }
-
- if (message === 'function' && direct.indexOf(prop) == -1) {
- return;
- }
-
- if (message === 'string') {
- var extra = data.length > 10 ? data.substring(0, 9) + '_' : data;
- message += ' "' + extra.replace(/\n/g, "|") + '"';
- recurse = false;
- }
- else if (leakHunt.matchesAnyPattern(message, leakHunt.noRecurse)) {
- message += ' (no recurse)'
- recurse = false;
- }
- else if (seen.indexOf(data) !== -1) {
- message += ' (already seen)';
- recurse = false;
- }
-
- if (recurse) {
- seen.push(data);
- var lines = leakHunt.inner(data, newPath, seen);
- if (lines.length == 0) {
- if (message !== 'function') {
- log(prefix + prop + ' = ' + message + ' { }');
- }
- }
- else {
- log(prefix + prop + ' = ' + message + ' {');
- lines.forEach(function(line) {
- log(line);
- });
- log(prefix + '}');
- }
- }
- else {
- log(prefix + prop + ' = ' + message);
- }
-};
-
-leakHunt.matchesAnyPattern = function LH_matchesAnyPattern(str, patterns) {
- var match = false;
- patterns.forEach(function(pattern) {
- if (str.match(pattern)) {
- match = true;
- }
- });
- return match;
-};
-
-leakHunt.getType = function LH_getType(data) {
- if (data === null) {
- return 'null';
- }
- if (data === undefined) {
- return 'undefined';
- }
-
- var type = typeof data;
- if (type === 'object' || type === 'Object') {
- type = leakHunt.getCtorName(data);
- }
-
- return type;
-};
-
-leakHunt.getCtorName = function LH_getCtorName(aObj) {
- try {
- if (aObj.constructor && aObj.constructor.name) {
- return aObj.constructor.name;
- }
- }
- catch (ex) {
- return 'UnknownObject';
- }
-
- // If that fails, use Objects toString which sometimes gives something
- // better than 'Object', and at least defaults to Object if nothing better
- return Object.prototype.toString.call(aObj).slice(8, -1);
-};
diff --git a/browser/devtools/shared/test/moz.build b/browser/devtools/shared/test/moz.build
deleted file mode 100644
index 191c90f0b..000000000
--- a/browser/devtools/shared/test/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
diff --git a/browser/devtools/shared/test/unit/test_undoStack.js b/browser/devtools/shared/test/unit/test_undoStack.js
deleted file mode 100644
index f1a230693..000000000
--- a/browser/devtools/shared/test/unit/test_undoStack.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const Cu = Components.utils;
-let {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
-
-let loader = new Loader.Loader({
- paths: {
- "": "resource://gre/modules/commonjs/",
- "devtools": "resource:///modules/devtools",
- },
- globals: {},
-});
-let require = Loader.Require(loader, { id: "undo-test" })
-
-let {UndoStack} = require("devtools/shared/undo");
-
-const MAX_SIZE = 5;
-
-function run_test()
-{
- let str = "";
- let stack = new UndoStack(MAX_SIZE);
-
- function add(ch) {
- stack.do(function() {
- str += ch;
- }, function() {
- str = str.slice(0, -1);
- });
- }
-
- do_check_false(stack.canUndo());
- do_check_false(stack.canRedo());
-
- // Check adding up to the limit of the size
- add("a");
- do_check_true(stack.canUndo());
- do_check_false(stack.canRedo());
-
- add("b");
- add("c");
- add("d");
- add("e");
-
- do_check_eq(str, "abcde");
-
- // Check a simple undo+redo
- stack.undo();
-
- do_check_eq(str, "abcd");
- do_check_true(stack.canRedo());
-
- stack.redo();
- do_check_eq(str, "abcde")
- do_check_false(stack.canRedo());
-
- // Check an undo followed by a new action
- stack.undo();
- do_check_eq(str, "abcd");
-
- add("q");
- do_check_eq(str, "abcdq");
- do_check_false(stack.canRedo());
-
- stack.undo();
- do_check_eq(str, "abcd");
- stack.redo();
- do_check_eq(str, "abcdq");
-
- // Revert back to the beginning of the queue...
- while (stack.canUndo()) {
- stack.undo();
- }
- do_check_eq(str, "");
-
- // Now put it all back....
- while (stack.canRedo()) {
- stack.redo();
- }
- do_check_eq(str, "abcdq");
-
- // Now go over the undo limit...
- add("1");
- add("2");
- add("3");
-
- do_check_eq(str, "abcdq123");
-
- // And now undoing the whole stack should only undo 5 actions.
- while (stack.canUndo()) {
- stack.undo();
- }
-
- do_check_eq(str, "abc");
-}
diff --git a/browser/devtools/shared/test/unit/xpcshell.ini b/browser/devtools/shared/test/unit/xpcshell.ini
deleted file mode 100644
index 342274bed..000000000
--- a/browser/devtools/shared/test/unit/xpcshell.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-head =
-tail =
-firefox-appdir = browser
-
-[test_undoStack.js]
diff --git a/browser/devtools/sourceeditor/moz.build b/browser/devtools/sourceeditor/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/sourceeditor/moz.build
+++ b/browser/devtools/sourceeditor/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/sourceeditor/test/Makefile.in b/browser/devtools/sourceeditor/test/Makefile.in
deleted file mode 100644
index 018370a80..000000000
--- a/browser/devtools/sourceeditor/test/Makefile.in
+++ /dev/null
@@ -1,37 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_sourceeditor_initialization.js \
- browser_bug684862_paste_html.js \
- browser_bug687573_vscroll.js \
- browser_bug687568_pagescroll.js \
- browser_bug687580_drag_and_drop.js \
- browser_bug684546_reset_undo.js \
- browser_bug695035_middle_click_paste.js \
- browser_bug687160_line_api.js \
- browser_bug650345_find.js \
- browser_bug703692_focus_blur.js \
- browser_bug725388_mouse_events.js \
- browser_bug707987_debugger_breakpoints.js \
- browser_bug712982_line_ruler_click.js \
- browser_bug725618_moveLines_shortcut.js \
- browser_bug700893_dirty_state.js \
- browser_bug729480_line_vertical_align.js \
- browser_bug725430_comment_uncomment.js \
- browser_bug731721_debugger_stepping.js \
- browser_bug729960_block_bracket_jump.js \
- browser_bug744021_next_prev_bracket_jump.js \
- browser_bug725392_mouse_coords_char_offset.js \
- head.js \
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/sourceeditor/test/browser_bug650345_find.js b/browser/devtools/sourceeditor/test/browser_bug650345_find.js
deleted file mode 100644
index c4fa74d81..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug650345_find.js
+++ /dev/null
@@ -1,149 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 650345' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
- editor.setText(text);
-
- let needle = "foobar";
- is(editor.find(), -1, "find() works");
- ok(!editor.lastFind, "no editor.lastFind yet");
-
- is(editor.find(needle), 0, "find('" + needle + "') works");
- is(editor.lastFind.str, needle, "lastFind.str is correct");
- is(editor.lastFind.index, 0, "lastFind.index is correct");
- is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
- is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
-
- let newIndex = text.indexOf(needle, needle.length);
- is(editor.findNext(), newIndex, "findNext() works");
- is(editor.lastFind.str, needle, "lastFind.str is correct");
- is(editor.lastFind.index, newIndex, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
- is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
-
- is(editor.findNext(), -1, "findNext() works again");
- is(editor.lastFind.index, -1, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
-
- is(editor.findPrevious(), 0, "findPrevious() works");
- is(editor.lastFind.index, 0, "lastFind.index is correct");
- is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
-
- is(editor.findPrevious(), -1, "findPrevious() works again");
- is(editor.lastFind.index, -1, "lastFind.index is correct");
- is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
-
- is(editor.findNext(), newIndex, "findNext() works");
- is(editor.lastFind.index, newIndex, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
-
- is(editor.findNext(true), 0, "findNext(true) works");
- is(editor.lastFind.index, 0, "lastFind.index is correct");
- is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
-
- is(editor.findNext(true), newIndex, "findNext(true) works again");
- is(editor.lastFind.index, newIndex, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
-
- is(editor.findPrevious(true), 0, "findPrevious(true) works");
- is(editor.lastFind.index, 0, "lastFind.index is correct");
- is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
-
- is(editor.findPrevious(true), newIndex, "findPrevious(true) works again");
- is(editor.lastFind.index, newIndex, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
-
- needle = "error";
- is(editor.find(needle), -1, "find('" + needle + "') works");
- is(editor.lastFind.str, needle, "lastFind.str is correct");
- is(editor.lastFind.index, -1, "lastFind.index is correct");
- is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");
- is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
-
- is(editor.findNext(), -1, "findNext() works");
- is(editor.lastFind.str, needle, "lastFind.str is correct");
- is(editor.lastFind.index, -1, "lastFind.index is correct");
- is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");
- is(editor.findNext(true), -1, "findNext(true) works");
-
- is(editor.findPrevious(), -1, "findPrevious() works");
- is(editor.findPrevious(true), -1, "findPrevious(true) works");
-
- needle = "bug650345";
- newIndex = text.indexOf(needle);
-
- is(editor.find(needle), newIndex, "find('" + needle + "') works");
- is(editor.findNext(), -1, "findNext() works");
- is(editor.findNext(true), newIndex, "findNext(true) works");
- is(editor.findPrevious(), -1, "findPrevious() works");
- is(editor.findPrevious(true), newIndex, "findPrevious(true) works");
- is(editor.lastFind.index, newIndex, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
-
- is(editor.find(needle, {ignoreCase: 1}), newIndex,
- "find('" + needle + "', {ignoreCase: 1}) works");
- is(editor.lastFind.ignoreCase, true, "lastFind.ignoreCase is correct");
-
- let newIndex2 = text.toLowerCase().indexOf(needle, newIndex + needle.length);
- is(editor.findNext(), newIndex2, "findNext() works");
- is(editor.findNext(), -1, "findNext() works");
- is(editor.lastFind.index, -1, "lastFind.index is correct");
- is(editor.lastFind.lastFound, newIndex2, "lastFind.lastFound is correct");
-
- is(editor.findNext(true), newIndex, "findNext(true) works");
-
- is(editor.findPrevious(), -1, "findPrevious() works");
- is(editor.findPrevious(true), newIndex2, "findPrevious(true) works");
- is(editor.findPrevious(), newIndex, "findPrevious() works again");
-
- needle = "foobar";
- newIndex = text.indexOf(needle, 2);
- is(editor.find(needle, {start: 2}), newIndex,
- "find('" + needle + "', {start:2}) works");
- is(editor.findNext(), -1, "findNext() works");
- is(editor.findNext(true), 0, "findNext(true) works");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug684546_reset_undo.js b/browser/devtools/sourceeditor/test/browser_bug684546_reset_undo.js
deleted file mode 100644
index 4fbb01bde..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug684546_reset_undo.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 684546 - reset undo' width='300' height='500'>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- editor = new SourceEditor();
- editor.init(box, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.setText("First");
- editor.setText("Second", 5);
- is(editor.getText(), "FirstSecond", "text set correctly.");
- editor.undo();
- is(editor.getText(), "First", "undo works.");
- editor.redo();
- is(editor.getText(), "FirstSecond", "redo works.");
- editor.resetUndo();
- ok(!editor.canUndo(), "canUndo() is correct");
- ok(!editor.canRedo(), "canRedo() is correct");
- editor.undo();
- is(editor.getText(), "FirstSecond", "reset undo works correctly");
- editor.setText("Third", 11);
- is(editor.getText(), "FirstSecondThird", "text set correctly");
- editor.undo();
- is(editor.getText(), "FirstSecond", "undo works after reset");
- editor.redo();
- is(editor.getText(), "FirstSecondThird", "redo works after reset");
- editor.resetUndo();
- ok(!editor.canUndo(), "canUndo() is correct (again)");
- ok(!editor.canRedo(), "canRedo() is correct (again)");
- editor.undo();
- is(editor.getText(), "FirstSecondThird", "reset undo still works correctly");
-
- finish();
-}
-
-registerCleanupFunction(function() {
- editor.destroy();
- testWin.close();
- testWin = editor = null;
-});
diff --git a/browser/devtools/sourceeditor/test/browser_bug684862_paste_html.js b/browser/devtools/sourceeditor/test/browser_bug684862_paste_html.js
deleted file mode 100644
index 44a8854c5..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug684862_paste_html.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const pageUrl = "data:text/html,<ul><li>test<li>foobarBug684862";
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- waitForFocus(pageLoaded, content);
- }, true);
-
- content.location = pageUrl;
-}
-
-function pageLoaded()
-{
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 684862 - paste HTML' width='600' height='500'>" +
- "<script type='application/javascript' src='chrome://global/content/globalOverlay.js'/>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let doCopy = function() {
- gBrowser.selectedBrowser.focus();
- EventUtils.synthesizeKey("a", {accelKey: true}, content);
- EventUtils.synthesizeKey("c", {accelKey: true}, content);
- };
-
- let clipboardValidator = function(aData) aData.indexOf("foobarBug684862") > -1;
-
- let onCopy = function() {
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
- };
-
- waitForClipboard(clipboardValidator, doCopy, onCopy, testEnd);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- editor = new SourceEditor();
- editor.init(box, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- ok(!editor.getText(), "editor has no content");
- is(editor.getCaretOffset(), 0, "caret location");
-
- let onPaste = function() {
- editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
-
- let text = editor.getText();
- ok(text, "editor has content after paste");
-
- let pos = text.indexOf("foobarBug684862");
- isnot(pos, -1, "editor content is correct");
- // Test for bug 699541 - Pasted HTML shows twice in Orion.
- is(text.lastIndexOf("foobarBug684862"), pos, "editor content is correct (no duplicate)");
-
- executeSoon(function() {
- editor.setCaretOffset(4);
- EventUtils.synthesizeKey("a", {}, testWin);
- EventUtils.synthesizeKey("VK_RIGHT", {}, testWin);
-
- text = editor.getText();
-
- is(text.indexOf("foobarBug684862"), pos + 1,
- "editor content is correct after navigation");
- is(editor.getCaretOffset(), 6, "caret location");
-
- executeSoon(testEnd);
- });
- };
-
- editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
-
- // Do paste
- executeSoon(function() {
- testWin.goDoCommand("cmd_paste");
- });
-}
-
-function testEnd()
-{
- if (editor) {
- editor.destroy();
- }
- if (testWin) {
- testWin.close();
- }
- testWin = editor = null;
- gBrowser.removeCurrentTab();
-
- waitForFocus(finish, window);
-}
-
diff --git a/browser/devtools/sourceeditor/test/browser_bug687160_line_api.js b/browser/devtools/sourceeditor/test/browser_bug687160_line_api.js
deleted file mode 100644
index 6eb3c22fe..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug687160_line_api.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 660784' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
-
- editor.focus();
-
- editor.setText("line1\nline2\nline3");
-
- if (component != "textarea") {
- is(editor.getLineCount(), 3, "getLineCount() works");
- }
-
- editor.setCaretPosition(1);
- is(editor.getCaretOffset(), 6, "setCaretPosition(line) works");
-
- let pos;
- if (component != "textarea") {
- pos = editor.getCaretPosition();
- ok(pos.line == 1 && pos.col == 0, "getCaretPosition() works");
- }
-
- editor.setCaretPosition(1, 3);
- is(editor.getCaretOffset(), 9, "setCaretPosition(line, column) works");
-
- if (component != "textarea") {
- pos = editor.getCaretPosition();
- ok(pos.line == 1 && pos.col == 3, "getCaretPosition() works");
- }
-
- editor.setCaretPosition(2);
- is(editor.getCaretOffset(), 12, "setCaretLine() works, confirmed");
-
- if (component != "textarea") {
- pos = editor.getCaretPosition();
- ok(pos.line == 2 && pos.col == 0, "setCaretPosition(line) works, again");
- }
-
- let offsetLine = editor.getLineAtOffset(0);
- is(offsetLine, 0, "getLineAtOffset() is correct for offset 0");
-
- let offsetLine = editor.getLineAtOffset(6);
- is(offsetLine, 1, "getLineAtOffset() is correct for offset 6");
-
- let offsetLine = editor.getLineAtOffset(12);
- is(offsetLine, 2, "getLineAtOffset() is correct for offset 12");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
-}
-
diff --git a/browser/devtools/sourceeditor/test/browser_bug687568_pagescroll.js b/browser/devtools/sourceeditor/test/browser_bug687568_pagescroll.js
deleted file mode 100644
index 39ed4fb0c..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug687568_pagescroll.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component != "orion") {
- ok(true, "skip test for bug 687568: only applicable for Orion");
- return; // Testing for the fix requires direct Orion API access.
- }
-
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 687568 - page scroll' width='600' height='500'>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- editor = new SourceEditor();
- editor.init(box, { showLineNumbers: true }, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- let view = editor._view;
- let model = editor._model;
-
- let lineHeight = view.getLineHeight();
- let editorHeight = view.getClientArea().height;
- let linesPerPage = Math.floor(editorHeight / lineHeight);
- let totalLines = 3 * linesPerPage;
-
- let text = "";
- for (let i = 0; i < totalLines; i++) {
- text += "l" + i + "\n";
- }
-
- editor.setText(text);
- editor.setCaretOffset(0);
-
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
-
- let bottomLine = view.getBottomIndex(true);
- view.setTopIndex(bottomLine + 1);
-
- executeSoon(function() {
- EventUtils.synthesizeKey("VK_PAGE_DOWN", {shiftKey: true}, testWin);
-
- executeSoon(function() {
- let topLine = view.getTopIndex(true);
- let topLineOffset = model.getLineStart(topLine);
- let selection = editor.getSelection();
- ok(selection.start < topLineOffset && topLineOffset < selection.end,
- "top visible line is selected");
-
- editor.destroy();
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- });
- });
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug687573_vscroll.js b/browser/devtools/sourceeditor/test/browser_bug687573_vscroll.js
deleted file mode 100644
index 06f790033..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug687573_vscroll.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component == "textarea") {
- ok(true, "skip test for bug 687573: not applicable for TEXTAREAs");
- return; // TEXTAREAs have different behavior
- }
-
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 687573 - vertical scroll' width='300' height='500'>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- let text = "abba\n" +
- "\n" +
- "abbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
- "abbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
- "abbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
- "\n" +
- "abba\n";
-
- let config = {
- showLineNumbers: true,
- initialText: text,
- };
-
- editor = new SourceEditor();
- editor.init(box, config, editorLoaded);
-}
-
-function editorLoaded()
-{
- let VK_LINE_END = "VK_END";
- let VK_LINE_END_OPT = {};
- let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
- if (OS == "Darwin") {
- VK_LINE_END = "VK_RIGHT";
- VK_LINE_END_OPT = {accelKey: true};
- }
-
- editor.focus();
-
- editor.setCaretOffset(0);
- is(editor.getCaretOffset(), 0, "caret location at start");
-
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
-
- // line 3
- is(editor.getCaretOffset(), 6, "caret location, keypress Down two times, line 3");
-
- // line 3 end
- EventUtils.synthesizeKey(VK_LINE_END, VK_LINE_END_OPT, testWin);
- is(editor.getCaretOffset(), 46, "caret location, keypress End, line 3 end");
-
- // line 4
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- is(editor.getCaretOffset(), 87, "caret location, keypress Down, line 4");
-
- // line 4 end
- EventUtils.synthesizeKey(VK_LINE_END, VK_LINE_END_OPT, testWin);
- is(editor.getCaretOffset(), 135, "caret location, keypress End, line 4 end");
-
- // line 5 end
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- is(editor.getCaretOffset(), 176, "caret location, keypress Down, line 5 end");
-
- // line 6 end
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- is(editor.getCaretOffset(), 177, "caret location, keypress Down, line 6 end");
-
- // The executeSoon() calls are needed to allow reflows...
- EventUtils.synthesizeKey("VK_UP", {}, testWin);
- executeSoon(function() {
- // line 5 end
- is(editor.getCaretOffset(), 176, "caret location, keypress Up, line 5 end");
-
- EventUtils.synthesizeKey("VK_UP", {}, testWin);
- executeSoon(function() {
- // line 4 end
- is(editor.getCaretOffset(), 135, "caret location, keypress Up, line 4 end");
-
- // line 3 end
- EventUtils.synthesizeKey("VK_UP", {}, testWin);
- is(editor.getCaretOffset(), 46, "caret location, keypress Up, line 3 end");
-
- // line 2 end
- EventUtils.synthesizeKey("VK_UP", {}, testWin);
- is(editor.getCaretOffset(), 5, "caret location, keypress Up, line 2 end");
-
- // line 3 end
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- is(editor.getCaretOffset(), 46, "caret location, keypress Down, line 3 end");
-
- // line 4 end
- EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
- is(editor.getCaretOffset(), 135, "caret location, keypress Down, line 4 end");
-
- editor.destroy();
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- });
- });
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug687580_drag_and_drop.js b/browser/devtools/sourceeditor/test/browser_bug687580_drag_and_drop.js
deleted file mode 100644
index 6b493969b..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug687580_drag_and_drop.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component != "orion") {
- ok(true, "skip test for bug 687580: only applicable for Orion");
- return; // Testing for the fix requires direct Orion API access.
- }
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 687580 - drag and drop' width='600' height='500'>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- editor = new SourceEditor();
- editor.init(box, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- let view = editor._view;
- let model = editor._model;
-
- let lineHeight = view.getLineHeight();
- let editorHeight = view.getClientArea().height;
- let linesPerPage = Math.floor(editorHeight / lineHeight);
- let totalLines = 2 * linesPerPage;
-
- let text = "foobarBug687580-";
- for (let i = 0; i < totalLines; i++) {
- text += "l" + i + "\n";
- }
-
- editor.setText(text);
- editor.setCaretOffset(0);
-
- let bottomPixel = view.getBottomPixel();
-
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
- EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
-
- let initialSelection = editor.getSelection();
-
- let ds = Cc["@mozilla.org/widget/dragservice;1"].
- getService(Ci.nsIDragService);
-
- let target = view._clientDiv;
- let targetWin = target.ownerDocument.defaultView;
-
- let dataTransfer = null;
-
- let onDragStart = function(aEvent) {
- target.removeEventListener("dragstart", onDragStart, false);
-
- dataTransfer = aEvent.dataTransfer;
- ok(dataTransfer, "dragstart event fired");
- ok(dataTransfer.types.contains("text/plain"),
- "dataTransfer text/plain available");
- let text = dataTransfer.getData("text/plain");
- isnot(text.indexOf("foobarBug687580"), -1, "text/plain data is correct");
-
- dataTransfer.dropEffect = "move";
- };
-
- let onDrop = executeSoon.bind(null, function() {
- target.removeEventListener("drop", onDrop, false);
-
- let selection = editor.getSelection();
- is(selection.end - selection.start,
- initialSelection.end - initialSelection.start,
- "selection is correct");
- is(editor.getText(0, 2), "l3", "drag and drop worked");
-
- let offset = editor.getCaretOffset();
- ok(offset > initialSelection.end, "new caret location");
-
- let initialLength = initialSelection.end - initialSelection.start;
- let dropText = editor.getText(offset - initialLength, offset);
- isnot(dropText.indexOf("foobarBug687580"), -1, "drop text is correct");
-
- editor.destroy();
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- });
-
- executeSoon(function() {
- ds.startDragSession();
-
- target.addEventListener("dragstart", onDragStart, false);
- target.addEventListener("drop", onDrop, false);
-
- EventUtils.synthesizeMouse(target, 10, 10, {type: "mousedown"}, targetWin);
-
- EventUtils.synthesizeMouse(target, 11, bottomPixel - 25, {type: "mousemove"},
- targetWin);
-
- EventUtils.synthesizeMouse(target, 12, bottomPixel - 15, {type: "mousemove"},
- targetWin);
-
- let clientX = 5;
- let clientY = bottomPixel - 10;
-
- let event = targetWin.document.createEvent("DragEvents");
- event.initDragEvent("dragenter", true, true, targetWin, 0, 0, 0, clientX,
- clientY, false, false, false, false, 0, null,
- dataTransfer);
- target.dispatchEvent(event);
-
- event = targetWin.document.createEvent("DragEvents");
- event.initDragEvent("dragover", true, true, targetWin, 0, 0, 0, clientX + 1,
- clientY + 2, false, false, false, false, 0, null,
- dataTransfer);
- target.dispatchEvent(event);
-
- EventUtils.synthesizeMouse(target, clientX + 2, clientY + 1,
- {type: "mouseup"}, targetWin);
-
- event = targetWin.document.createEvent("DragEvents");
- event.initDragEvent("drop", true, true, targetWin, 0, 0, 0, clientX + 2,
- clientY + 3, false, false, false, false, 0, null,
- dataTransfer);
- target.dispatchEvent(event);
-
- event = targetWin.document.createEvent("DragEvents");
- event.initDragEvent("dragend", true, true, targetWin, 0, 0, 0, clientX + 3,
- clientY + 2, false, false, false, false, 0, null,
- dataTransfer);
- target.dispatchEvent(event);
-
- ds.endDragSession(true);
- });
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js b/browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js
deleted file mode 100644
index 40775a11c..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- if (Services.appinfo.OS != "Linux") {
- ok(true, "this test only applies to Linux, skipping.")
- return;
- }
-
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 695035' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let hbox = testWin.document.querySelector("hbox");
-
- editor = new SourceEditor();
- editor.init(hbox, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- let initialText = "initial text!";
-
- editor.setText(initialText);
-
- let expectedString = "foobarBug695035-" + Date.now();
-
- let doCopy = function() {
- let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
- getService(Ci.nsIClipboardHelper);
- clipboardHelper.copyStringToClipboard(expectedString,
- Ci.nsIClipboard.kSelectionClipboard,
- testWin.document);
- };
-
- let onCopy = function() {
- editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
-
- EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
- EventUtils.synthesizeMouse(editor.editorElement, 11, 11, {button: 1}, testWin);
- };
-
- let onPaste = function() {
- editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
-
- let text = editor.getText();
- isnot(text.indexOf(expectedString), -1, "middle-click paste works");
- isnot(text, initialText, "middle-click paste works (confirmed)");
-
- executeSoon(doTestBug695032);
- };
-
- let doTestBug695032 = function() {
- info("test for bug 695032 - editor selection should be placed in the X11 primary selection buffer");
-
- let text = "foobarBug695032 test me, test me!";
- editor.setText(text);
-
- waitForSelection(text, function() {
- EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
- }, testEnd, testEnd);
- };
-
- waitForSelection(expectedString, doCopy, onCopy, testEnd);
-}
-
-function testEnd()
-{
- editor.destroy();
- testWin.close();
-
- testWin = editor = null;
-
- waitForFocus(finish, window);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug700893_dirty_state.js b/browser/devtools/sourceeditor/test/browser_bug700893_dirty_state.js
deleted file mode 100644
index 3b9552659..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug700893_dirty_state.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component == "textarea") {
- ok(true, "skip test for bug 700893: only applicable for non-textarea components");
- return;
- }
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 700893' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {initialText: "foobar"}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
-
- is(editor.dirty, false, "editory is not dirty");
-
- let event = null;
- let eventHandler = function(aEvent) {
- event = aEvent;
- };
- editor.addEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
-
- editor.setText("omg");
-
- is(editor.dirty, true, "editor is dirty");
- ok(event, "DirtyChanged event fired")
- is(event.oldValue, false, "event.oldValue is correct");
- is(event.newValue, true, "event.newValue is correct");
-
- event = null;
- editor.setText("foo 2");
- ok(!event, "no DirtyChanged event fired");
-
- editor.dirty = false;
-
- is(editor.dirty, false, "editor marked as clean");
- ok(event, "DirtyChanged event fired")
- is(event.oldValue, true, "event.oldValue is correct");
- is(event.newValue, false, "event.newValue is correct");
-
- event = null;
- editor.setText("foo 3");
-
- is(editor.dirty, true, "editor is dirty after changes");
- ok(event, "DirtyChanged event fired")
- is(event.oldValue, false, "event.oldValue is correct");
- is(event.newValue, true, "event.newValue is correct");
-
- editor.undo();
- is(editor.dirty, false, "editor is not dirty after undo");
- ok(event, "DirtyChanged event fired")
- is(event.oldValue, true, "event.oldValue is correct");
- is(event.newValue, false, "event.newValue is correct");
-
- editor.removeEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug703692_focus_blur.js b/browser/devtools/sourceeditor/test/browser_bug703692_focus_blur.js
deleted file mode 100644
index 16c20f52c..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug703692_focus_blur.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='Test for bug 703692' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let hbox = testWin.document.querySelector("hbox");
-
- editor = new SourceEditor();
- editor.init(hbox, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- let focusHandler = function(aEvent) {
- editor.removeEventListener(SourceEditor.EVENTS.FOCUS, focusHandler);
- editor.addEventListener(SourceEditor.EVENTS.BLUR, blurHandler);
-
- ok(aEvent, "Focus event fired");
- window.focus();
- };
-
- let blurHandler = function(aEvent) {
- editor.removeEventListener(SourceEditor.EVENTS.BLUR, blurHandler);
-
- ok(aEvent, "Blur event fired");
- executeSoon(testEnd);
- }
-
- editor.addEventListener(SourceEditor.EVENTS.FOCUS, focusHandler);
-
- editor.focus();
-}
-
-function testEnd()
-{
- if (editor) {
- editor.destroy();
- }
- if (testWin) {
- testWin.close();
- }
- testWin = editor = null;
-
- waitForFocus(finish, window);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug707987_debugger_breakpoints.js b/browser/devtools/sourceeditor/test/browser_bug707987_debugger_breakpoints.js
deleted file mode 100644
index f7d839b6c..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug707987_debugger_breakpoints.js
+++ /dev/null
@@ -1,169 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component == "textarea") {
- ok(true, "skip test for bug 707987: only applicable for non-textarea components");
- return;
- }
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 707987' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showAnnotationRuler: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
-
- editor.setText("line1\nline2\nline3\nline4");
-
- is(editor.getBreakpoints().length, 0, "no breakpoints");
-
- let event = null;
- let eventHandler = function(aEvent) {
- event = aEvent;
- };
- editor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, eventHandler);
-
- // Add breakpoint at line 0
-
- editor.addBreakpoint(0);
-
- let breakpoints = editor.getBreakpoints();
- is(breakpoints.length, 1, "one breakpoint added");
- is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
- ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
-
- ok(event, "breakpoint event fired");
- is(event.added.length, 1, "one breakpoint added (confirmed)");
- is(event.removed.length, 0, "no breakpoint removed");
- is(event.added[0].line, 0, "event added[0].line is correct");
- ok(!event.added[0].condition, "event added[0].condition is correct");
-
- // Add breakpoint at line 3
-
- event = null;
- editor.addBreakpoint(3, "foo == 'bar'");
-
- breakpoints = editor.getBreakpoints();
- is(breakpoints.length, 2, "another breakpoint added");
- is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
- ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
- is(breakpoints[1].line, 3, "breakpoint[1].line is correct");
- is(breakpoints[1].condition, "foo == 'bar'",
- "breakpoint[1].condition is correct");
-
- ok(event, "breakpoint event fired");
- is(event.added.length, 1, "another breakpoint added (confirmed)");
- is(event.removed.length, 0, "no breakpoint removed");
- is(event.added[0].line, 3, "event added[0].line is correct");
- is(event.added[0].condition, "foo == 'bar'",
- "event added[0].condition is correct");
-
- // Try to add another breakpoint at line 0
-
- event = null;
- editor.addBreakpoint(0);
-
- is(editor.getBreakpoints().length, 2, "no breakpoint added");
- is(event, null, "no breakpoint event fired");
-
- // Try to remove a breakpoint from line 1
-
- is(editor.removeBreakpoint(1), false, "removeBreakpoint(1) returns false");
- is(editor.getBreakpoints().length, 2, "no breakpoint removed");
- is(event, null, "no breakpoint event fired");
-
- // Remove the breakpoint from line 0
-
- is(editor.removeBreakpoint(0), true, "removeBreakpoint(0) returns true");
-
- breakpoints = editor.getBreakpoints();
- is(breakpoints[0].line, 3, "breakpoint[0].line is correct");
- is(breakpoints[0].condition, "foo == 'bar'",
- "breakpoint[0].condition is correct");
-
- ok(event, "breakpoint event fired");
- is(event.added.length, 0, "no breakpoint added");
- is(event.removed.length, 1, "one breakpoint removed");
- is(event.removed[0].line, 0, "event removed[0].line is correct");
- ok(!event.removed[0].condition, "event removed[0].condition is correct");
-
- // Remove the breakpoint from line 3
-
- event = null;
- is(editor.removeBreakpoint(3), true, "removeBreakpoint(3) returns true");
-
- is(editor.getBreakpoints().length, 0, "no breakpoints");
- ok(event, "breakpoint event fired");
- is(event.added.length, 0, "no breakpoint added");
- is(event.removed.length, 1, "one breakpoint removed");
- is(event.removed[0].line, 3, "event removed[0].line is correct");
- is(event.removed[0].condition, "foo == 'bar'",
- "event removed[0].condition is correct");
-
- // Add a breakpoint with the mouse
-
- event = null;
- EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
-
- breakpoints = editor.getBreakpoints();
- is(breakpoints.length, 1, "one breakpoint added");
- is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
- ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
-
- ok(event, "breakpoint event fired");
- is(event.added.length, 1, "one breakpoint added (confirmed)");
- is(event.removed.length, 0, "no breakpoint removed");
- is(event.added[0].line, 0, "event added[0].line is correct");
- ok(!event.added[0].condition, "event added[0].condition is correct");
-
- // Remove a breakpoint with the mouse
-
- event = null;
- EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
-
- breakpoints = editor.getBreakpoints();
- is(breakpoints.length, 0, "one breakpoint removed");
-
- ok(event, "breakpoint event fired");
- is(event.added.length, 0, "no breakpoint added");
- is(event.removed.length, 1, "one breakpoint removed (confirmed)");
- is(event.removed[0].line, 0, "event removed[0].line is correct");
- ok(!event.removed[0].condition, "event removed[0].condition is correct");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug712982_line_ruler_click.js b/browser/devtools/sourceeditor/test/browser_bug712982_line_ruler_click.js
deleted file mode 100644
index 61397fbcf..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug712982_line_ruler_click.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component == "textarea") {
- ok(true, "skip test for bug 712982: only applicable for non-textarea components");
- return;
- }
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 712982' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showLineNumbers: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
-
- editor.setText("line1\nline2\nline3\nline4");
-
- editor.setCaretPosition(3);
- let pos = editor.getCaretPosition();
- ok(pos.line == 3 && pos.col == 0, "initial caret location is correct");
-
- EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
-
- is(editor.getCaretOffset(), 0, "click on line 0 worked");
-
- editor.setCaretPosition(2);
- EventUtils.synthesizeMouse(editor.editorElement, 11, 11,
- {shiftKey: true}, testWin);
- is(editor.getSelectedText().trim(), "line1\nline2", "shift+click works");
-
- editor.setCaretOffset(0);
-
- EventUtils.synthesizeMouse(editor.editorElement, 10, 10,
- {clickCount: 2}, testWin);
-
- is(editor.getSelectedText().trim(), "line1", "double click works");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js b/browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js
deleted file mode 100644
index 16e6701af..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='Test for bug 725388' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let hbox = testWin.document.querySelector("hbox");
-
- editor = new SourceEditor();
- editor.init(hbox, {}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
- testWin.resizeBy(1, 2);
-
- let text = "BrowserBug - 725388";
- editor.setText(text);
-
- let target = editor.editorElement;
- let targetWin = target.ownerDocument.defaultView;
-
- let eventsFired = 0;
-
- let done = function() {
- eventsFired++;
- if (eventsFired == 3) {
- executeSoon(testEnd);
- }
- };
-
- let mMoveHandler = function(aEvent) {
- editor.removeEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler);
-
- is(aEvent.event.type, "mousemove", "MouseMove event fired.");
-
- executeSoon(done);
- };
-
- let mOverHandler = function(aEvent) {
- editor.removeEventListener(SourceEditor.EVENTS.MOUSE_OVER, mOverHandler);
-
- is(aEvent.event.type, "mouseover", "MouseOver event fired.");
-
- executeSoon(done);
- };
-
- let mOutHandler = function(aEvent) {
- editor.removeEventListener(SourceEditor.EVENTS.MOUSE_OUT, mOutHandler);
-
- is(aEvent.event.type, "mouseout", "MouseOut event fired.");
-
- executeSoon(done);
- };
-
- editor.addEventListener(SourceEditor.EVENTS.MOUSE_OVER, mOverHandler);
- editor.addEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler);
- editor.addEventListener(SourceEditor.EVENTS.MOUSE_OUT, mOutHandler);
-
- waitForFocus(function() {
- EventUtils.synthesizeMouse(target, 10, 10, {type: "mouseover"},
- targetWin);
- EventUtils.synthesizeMouse(target, 15, 17, {type: "mousemove"},
- targetWin);
- EventUtils.synthesizeMouse(target, -10, -10, {type: "mouseout"},
- targetWin);
- }, targetWin);
-}
-
-function testEnd()
-{
- if (editor) {
- editor.destroy();
- }
- if (testWin) {
- testWin.close();
- }
- testWin = editor = null;
-
- waitForFocus(finish, window);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug725392_mouse_coords_char_offset.js b/browser/devtools/sourceeditor/test/browser_bug725392_mouse_coords_char_offset.js
deleted file mode 100644
index 5d5dcff5f..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug725392_mouse_coords_char_offset.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test()
-{
- let testWin;
- let editor;
- let mousePos = { x: 36, y: 4 };
- let expectedOffset = 5;
- let maxDiff = 10;
-
- waitForExplicitFinish();
-
- function editorLoaded(aEditor, aWindow)
- {
- editor = aEditor;
- testWin = aWindow;
-
- let text = fillEditor(editor, 3);
- editor.setText(text);
- editor.setCaretOffset(0);
-
- doMouseMove(testPage1);
- }
-
- function doMouseMove(aCallback)
- {
- function mouseEventHandler(aEvent)
- {
- editor.removeEventListener(editor.EVENTS.MOUSE_OUT, mouseEventHandler);
- editor.removeEventListener(editor.EVENTS.MOUSE_OVER, mouseEventHandler);
- editor.removeEventListener(editor.EVENTS.MOUSE_MOVE, mouseEventHandler);
-
- executeSoon(aCallback.bind(null, aEvent));
- }
-
- editor.addEventListener(editor.EVENTS.MOUSE_MOVE, mouseEventHandler);
- editor.addEventListener(editor.EVENTS.MOUSE_OUT, mouseEventHandler);
- editor.addEventListener(editor.EVENTS.MOUSE_OVER, mouseEventHandler);
-
- let target = editor.editorElement;
- let targetWin = testWin;
-
- EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
- {type: "mousemove"}, targetWin);
- EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
- {type: "mouseout"}, targetWin);
- EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
- {type: "mouseover"}, targetWin);
- }
-
- function checkValue(aValue, aExpectedValue)
- {
- let result = Math.abs(aValue - aExpectedValue) <= maxDiff;
- if (!result) {
- info("checkValue() given " + aValue + " expected " + aExpectedValue);
- }
- return result;
- }
-
- function testPage1(aEvent)
- {
- let {event: { clientX: clientX, clientY: clientY }, x: x, y: y} = aEvent;
-
- info("testPage1 " + aEvent.type +
- " clientX " + clientX + " clientY " + clientY +
- " x " + x + " y " + y);
-
- // x and y are in document coordinates.
- // clientX and clientY are in view coordinates.
- // since we are scrolled at the top, both are expected to be approximately
- // the same.
- ok(checkValue(x, mousePos.x), "x is in range");
- ok(checkValue(y, mousePos.y), "y is in range");
-
- ok(checkValue(clientX, mousePos.x), "clientX is in range");
- ok(checkValue(clientY, mousePos.y), "clientY is in range");
-
- // we give document-relative coordinates here.
- let offset = editor.getOffsetAtLocation(x, y);
- ok(checkValue(offset, expectedOffset), "character offset is correct");
-
- let rect = {x: x, y: y};
- let viewCoords = editor.convertCoordinates(rect, "document", "view");
- ok(checkValue(viewCoords.x, clientX), "viewCoords.x is in range");
- ok(checkValue(viewCoords.y, clientY), "viewCoords.y is in range");
-
- rect = {x: clientX, y: clientY};
- let docCoords = editor.convertCoordinates(rect, "view", "document");
- ok(checkValue(docCoords.x, x), "docCoords.x is in range");
- ok(checkValue(docCoords.y, y), "docCoords.y is in range");
-
- // we are given document-relative coordinates.
- let offsetPos = editor.getLocationAtOffset(expectedOffset);
- ok(checkValue(offsetPos.x, x), "offsetPos.x is in range");
- ok(checkValue(offsetPos.y, y), "offsetPos.y is in range");
-
- // Scroll the view and test again.
- let topIndex = Math.round(editor.getLineCount() / 2);
- editor.setTopIndex(topIndex);
- expectedOffset += editor.getLineStart(topIndex);
-
- executeSoon(doMouseMove.bind(null, testPage2));
- }
-
- function testPage2(aEvent)
- {
- let {event: { clientX: clientX, clientY: clientY }, x: x, y: y} = aEvent;
-
- info("testPage2 " + aEvent.type +
- " clientX " + clientX + " clientY " + clientY +
- " x " + x + " y " + y);
-
- // after page scroll document coordinates need to be different from view
- // coordinates.
- ok(checkValue(x, mousePos.x), "x is not different from clientX");
- ok(!checkValue(y, mousePos.y), "y is different from clientY");
-
- ok(checkValue(clientX, mousePos.x), "clientX is in range");
- ok(checkValue(clientY, mousePos.y), "clientY is in range");
-
- // we give document-relative coordinates here.
- let offset = editor.getOffsetAtLocation(x, y);
- ok(checkValue(offset, expectedOffset), "character offset is correct");
-
- let rect = {x: x, y: y};
- let viewCoords = editor.convertCoordinates(rect, "document", "view");
- ok(checkValue(viewCoords.x, clientX), "viewCoords.x is in range");
- ok(checkValue(viewCoords.y, clientY), "viewCoords.y is in range");
-
- rect = {x: clientX, y: clientY};
- let docCoords = editor.convertCoordinates(rect, "view", "document");
- ok(checkValue(docCoords.x, x), "docCoords.x is in range");
- ok(checkValue(docCoords.y, y), "docCoords.y is in range");
-
- // we are given document-relative coordinates.
- let offsetPos = editor.getLocationAtOffset(expectedOffset);
- ok(checkValue(offsetPos.x, x), "offsetPos.x is in range");
- ok(checkValue(offsetPos.y, y), "offsetPos.y is in range");
-
- executeSoon(testEnd);
- }
-
- function testEnd()
- {
- if (editor) {
- editor.destroy();
- }
- if (testWin) {
- testWin.close();
- }
-
- waitForFocus(finish, window);
- }
-
- openSourceEditorWindow(editorLoaded);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug725430_comment_uncomment.js b/browser/devtools/sourceeditor/test/browser_bug725430_comment_uncomment.js
deleted file mode 100644
index 5fbe1d89b..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug725430_comment_uncomment.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 725430' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showLineNumbers: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
- let text = "firstline\nsecondline\nthirdline\nfourthline";
-
- editor.setMode(SourceEditor.MODES.JAVASCRIPT);
- editor.setText(text)
-
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), "//" + text, "JS Single line Commenting Works");
- editor.undo();
- is(editor.getText(), text, "Undo Single Line Commenting action works");
- editor.redo();
- is(editor.getText(), "//" + text, "Redo works");
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "JS Single Line Uncommenting works");
-
- editor.setText(text);
-
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), "/*" + text + "*/", "JS Block Commenting works");
- editor.undo();
- is(editor.getText(), text, "Undo Block Commenting action works");
- editor.redo();
- is(editor.getText(), "/*" + text + "*/", "Redo works");
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "JS Block Uncommenting works");
- editor.undo();
- is(editor.getText(), "/*" + text + "*/", "Undo Block Uncommenting works");
- editor.redo();
- is(editor.getText(), text, "Redo works");
-
- let regText = "//firstline\n // secondline\nthird//line\n//fourthline";
- let expText = "firstline\n secondline\nthird//line\nfourthline";
- editor.setText(regText);
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), expText, "JS Multiple Line Uncommenting works");
- editor.undo();
- is(editor.getText(), regText, "Undo Multiple Line Uncommenting works");
- editor.redo();
- is(editor.getText(), expText, "Redo works");
-
- editor.setMode(SourceEditor.MODES.CSS);
- editor.setText(text);
-
- expText = "/*firstline*/\nsecondline\nthirdline\nfourthline";
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), expText, "CSS Commenting without selection works");
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "CSS Uncommenting without selection works");
-
- editor.setText(text);
-
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), "/*" + text + "*/", "CSS Multiple Line Commenting works");
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "CSS Multiple Line Uncommenting works");
-
- editor.setMode(SourceEditor.MODES.HTML);
- editor.setText(text);
-
- expText = "<!--firstline-->\nsecondline\nthirdline\nfourthline";
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), expText, "HTML Commenting without selection works");
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "HTML Uncommenting without selection works");
-
- editor.setText(text);
-
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), "<!--" + text + "-->", "HTML Multiple Line Commenting works");
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "HTML Multiple Line Uncommenting works");
-
- editor.setMode(SourceEditor.MODES.TEXT);
- editor.setText(text);
-
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "Commenting disabled in Text mode");
- editor.setText(regText);
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), regText, "Uncommenting disabled in Text mode");
-
- editor.setText(text);
- editor.readOnly = true;
-
- editor.setCaretPosition(0);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), text, "Commenting disabled in ReadOnly mode");
- editor.setText(regText);
- EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
- EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
- is(editor.getText(), regText, "Uncommenting disabled in ReadOnly mode");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug725618_moveLines_shortcut.js b/browser/devtools/sourceeditor/test/browser_bug725618_moveLines_shortcut.js
deleted file mode 100644
index c86a436c6..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug725618_moveLines_shortcut.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let editor;
-let testWin;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 725618 - moveLines shortcut' width='300' height='500'>" +
- "<box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- let text = "target\nfoo\nbar"
- let config = {
- initialText: text,
- };
-
- editor = new SourceEditor();
- editor.init(box, config, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- editor.setCaretOffset(0);
-
- let modifiers = {altKey: true, ctrlKey: Services.appinfo.OS == "Darwin"};
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "foo\ntarget\nbar", "Move lines down works");
- is(editor.getSelectedText(), "target\n", "selection is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "foo\nbar\ntarget", "Move lines down works");
- is(editor.getSelectedText(), "target", "selection is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "foo\nbar\ntarget", "Check for bottom of editor works");
- is(editor.getSelectedText(), "target", "selection is correct");
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "foo\ntarget\nbar", "Move lines up works");
- is(editor.getSelectedText(), "target\n", "selection is correct");
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar", "Move lines up works");
- is(editor.getSelectedText(), "target\n", "selection is correct");
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar", "Check for top of editor works");
- is(editor.getSelectedText(), "target\n", "selection is correct");
-
- editor.setSelection(0, 10);
- info("text within selection =" + editor.getSelectedText());
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "bar\ntarget\nfoo", "Multiple line move down works");
- is(editor.getSelectedText(), "target\nfoo", "selection is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "bar\ntarget\nfoo",
- "Check for bottom of editor works with multiple line selection");
- is(editor.getSelectedText(), "target\nfoo", "selection is correct");
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar", "Multiple line move up works");
- is(editor.getSelectedText(), "target\nfoo\n", "selection is correct");
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar",
- "Check for top of editor works with multiple line selection");
- is(editor.getSelectedText(), "target\nfoo\n", "selection is correct");
-
- editor.readOnly = true;
-
- editor.setCaretOffset(0);
-
- EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar",
- "Check for readOnly mode works with move lines up");
-
- EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
- is(editor.getText(), "target\nfoo\nbar",
- "Check for readOnly mode works with move lines down");
-
- finish();
-}
-
-registerCleanupFunction(function()
-{
- editor.destroy();
- testWin.close();
- testWin = editor = null;
-});
diff --git a/browser/devtools/sourceeditor/test/browser_bug729480_line_vertical_align.js b/browser/devtools/sourceeditor/test/browser_bug729480_line_vertical_align.js
deleted file mode 100644
index 171141ba5..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug729480_line_vertical_align.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let editor;
-const VERTICAL_OFFSET = 3;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 729480 - allow setCaretPosition align the target line" +
- " vertically in view according to a third argument'" +
- " width='300' height='300'><box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- let box = testWin.document.querySelector("box");
-
- editor = new SourceEditor();
- editor.init(box, {showLineNumbers: true}, editorLoaded);
-}
-
-function editorLoaded()
-{
- editor.focus();
-
- // setting 3 pages of lines containing the line number.
- let view = editor._view;
-
- let lineHeight = view.getLineHeight();
- let editorHeight = view.getClientArea().height;
- let linesPerPage = Math.floor(editorHeight / lineHeight);
- let totalLines = 3 * linesPerPage;
-
- let text = "";
- for (let i = 0; i < totalLines; i++) {
- text += "Line " + i + "\n";
- }
-
- editor.setText(text);
- editor.setCaretOffset(0);
-
- let offset = Math.min(Math.round(linesPerPage/2), VERTICAL_OFFSET);
- // Building the iterator array.
- // [line, alignment, topIndex_check]
- let iterateOn = [
- [0, "TOP", 0],
- [25, "TOP", 25 - offset],
- // Case when the target line is already in view.
- [27, "TOP", 25 - offset],
- [0, "BOTTOM", 0],
- [5, "BOTTOM", 0],
- [38, "BOTTOM", 38 - linesPerPage + offset],
- [0, "CENTER", 0],
- [4, "CENTER", 0],
- [34, "CENTER", 34 - Math.round(linesPerPage/2)]
- ];
-
- function testEnd() {
- editor.destroy();
- testWin.close();
- testWin = editor = null;
- waitForFocus(finish, window);
- }
-
- function testPosition(pos) {
- is(editor.getTopIndex(), iterateOn[pos][2], "scroll is correct for test #" + pos);
- iterator(++pos);
- }
-
- function iterator(i) {
- if (i == iterateOn.length) {
- testEnd();
- } else {
- editor.setCaretPosition(iterateOn[i][0], 0,
- editor.VERTICAL_ALIGN[iterateOn[i][1]]);
- executeSoon(testPosition.bind(this, i));
- }
- }
- iterator(0);
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug729960_block_bracket_jump.js b/browser/devtools/sourceeditor/test/browser_bug729960_block_bracket_jump.js
deleted file mode 100644
index 534018e24..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug729960_block_bracket_jump.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 729960' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showLineNumbers: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
- let JSText = "function foo(aVar) {\n" +
- " // Block Level 1\n\n" +
- " function level2() {\n" +
- " let baz = aVar;\n" +
- " // Block Level 2\n" +
- " function level3() {\n" +
- " // Block Level 3\n" +
- " }\n" +
- " }\n" +
- " // Block Level 1" +
- " function bar() { /* Block Level 2 */ }\n" +
- "}";
-
- editor.setMode(SourceEditor.MODES.JAVASCRIPT);
- editor.setText(JSText);
-
- // Setting caret at Line 1 bracket start.
- editor.setCaretOffset(19);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 220,
- "JS : Jump to closing bracket of the code block when caret at block start");
-
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 20,
- "JS : Jump to opening bracket of the code block when caret at block end");
-
- // Setting caret at Line 10 start.
- editor.setCaretOffset(161);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 20,
- "JS : Jump to opening bracket of code block when inside the function");
-
- editor.setCaretOffset(161);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 220,
- "JS : Jump to closing bracket of code block when inside the function");
-
- // Setting caret at Line 6 start.
- editor.setCaretOffset(67);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 159,
- "JS : Jump to closing bracket in a nested function with caret inside");
-
- editor.setCaretOffset(67);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 62,
- "JS : Jump to opening bracket in a nested function with caret inside");
-
- let CSSText = "#object {\n" +
- " property: value;\n" +
- " /* comment */\n" +
- "}";
-
- editor.setMode(SourceEditor.MODES.CSS);
- editor.setText(CSSText);
-
- // Setting caret at Line 1 bracket start.
- editor.setCaretOffset(8);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 45,
- "CSS : Jump to closing bracket of the code block when caret at block start");
-
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 9,
- "CSS : Jump to opening bracket of the code block when caret at block end");
-
- // Setting caret at Line 3 start.
- editor.setCaretOffset(28);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 9,
- "CSS : Jump to opening bracket of code block when inside the function");
-
- editor.setCaretOffset(28);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 45,
- "CSS : Jump to closing bracket of code block when inside the function");
-
- let HTMLText = "<html>\n" +
- " <head>\n" +
- " <title>Testing Block Jump</title>\n" +
- " </head>\n" +
- " <body></body>\n" +
- "</html>";
-
- editor.setMode(SourceEditor.MODES.HTML);
- editor.setText(HTMLText);
-
- // Setting caret at Line 1 end.
- editor.setCaretOffset(6);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 6,
- "HTML : Jump to block end : Nothing happens in html mode");
-
- // Setting caret at Line 4 end.
- editor.setCaretOffset(64);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 64,
- "HTML : Jump to block start : Nothing happens in html mode");
-
- let text = "line 1\n" +
- "line 2\n" +
- "line 3\n" +
- "line 4\n";
-
- editor.setMode(SourceEditor.MODES.TEXT);
- editor.setText(text);
-
- // Setting caret at Line 1 start.
- editor.setCaretOffset(0);
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 0,
- "Text : Jump to block end : Nothing happens in text mode");
-
- // Setting caret at Line 4 end.
- editor.setCaretOffset(28);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 28,
- "Text : Jump to block start : Nothing happens in text mode");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug731721_debugger_stepping.js b/browser/devtools/sourceeditor/test/browser_bug731721_debugger_stepping.js
deleted file mode 100644
index 3326f563e..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug731721_debugger_stepping.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 731721' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showAnnotationRuler: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
-
- editor.setText("line1\nline2\nline3\nline4");
-
- is(editor.getDebugLocation(), -1, "no debugger location");
-
- editor.setDebugLocation(1);
- is(editor.getDebugLocation(), 1, "set debugger location works");
-
- editor.setDebugLocation(3);
- is(editor.getDebugLocation(), 3, "change debugger location works");
-
- editor.setDebugLocation(-1);
- is(editor.getDebugLocation(), -1, "clear debugger location works");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_bug744021_next_prev_bracket_jump.js b/browser/devtools/sourceeditor/test/browser_bug744021_next_prev_bracket_jump.js
deleted file mode 100644
index 72b7d45c6..000000000
--- a/browser/devtools/sourceeditor/test/browser_bug744021_next_prev_bracket_jump.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function test() {
-
- let temp = {};
- Cu.import("resource:///modules/source-editor.jsm", temp);
- let SourceEditor = temp.SourceEditor;
-
- waitForExplicitFinish();
-
- let editor;
-
- const windowUrl = "data:text/xml;charset=utf8,<?xml version='1.0'?><window " +
- "xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' " +
- "title='test for bug 744021' width='600' height='500'><hbox flex='1'/>" +
- "</window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable," +
- "dialog=no";
-
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank",
- windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let hbox = testWin.document.querySelector("hbox");
- editor = new SourceEditor();
- editor.init(hbox, {showLineNumbers: true}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
- let JSText = "function foo() {\n" +
- " \n" +
- " function level2() {\n" +
- " \n" +
- " function level3() {\n" +
- " \n" +
- " }\n" +
- " }\n" +
- " function bar() { /* Block Level 2 */ }\n" +
- "}\n" +
- "function baz() {\n" +
- " \n" +
- "}";
-
- editor.setMode(SourceEditor.MODES.JAVASCRIPT);
- editor.setText(JSText);
-
- // Setting caret at end of line 11 (function baz() {).
- editor.setCaretOffset(147);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 16,
- "JS : Jump to opening bracket of previous sibling block when no parent");
-
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 129,
- "JS : Jump to closing bracket of same code block");
-
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 151,
- "JS : Jump to closing bracket of next sibling code block");
-
- let CSSText = "#object1 {\n" +
- " property: value;\n" +
- " /* comment */\n" +
- "}\n" +
- ".class1 {\n" +
- " property: value;\n" +
- "}";
-
- editor.setMode(SourceEditor.MODES.CSS);
- editor.setText(CSSText);
-
- // Setting caret at Line 5 end (.class1 {).
- editor.setCaretOffset(57);
- EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 10,
- "CSS : Jump to opening bracket of previous sibling code block");
-
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 46,
- "CSS : Jump to closing bracket of same code block");
-
- EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
- is(editor.getCaretOffset(), 77,
- "CSS : Jump to closing bracket of next sibling code block");
-
- editor.destroy();
-
- testWin.close();
- testWin = editor = null;
-
- waitForFocus(finish, window);
- }
-}
diff --git a/browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js b/browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js
deleted file mode 100644
index c605f9860..000000000
--- a/browser/devtools/sourceeditor/test/browser_sourceeditor_initialization.js
+++ /dev/null
@@ -1,499 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-let tempScope = {};
-Cu.import("resource:///modules/source-editor.jsm", tempScope);
-let SourceEditor = tempScope.SourceEditor;
-
-let testWin;
-let testDoc;
-let editor;
-
-function test()
-{
- waitForExplicitFinish();
-
- const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='test for bug 660784' width='600' height='500'><hbox flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-}
-
-function initEditor()
-{
- testDoc = testWin.document;
-
- let hbox = testDoc.querySelector("hbox");
-
- editor = new SourceEditor();
- let config = {
- showLineNumbers: true,
- initialText: "foobarbaz",
- tabSize: 7,
- expandTab: true,
- };
-
- editor.init(hbox, config, editorLoaded);
-}
-
-function editorLoaded()
-{
- ok(editor.editorElement, "editor loaded");
-
- is(editor.parentElement, testDoc.querySelector("hbox"),
- "parentElement is correct");
-
- editor.focus();
-
- is(editor.getMode(), SourceEditor.DEFAULTS.mode, "default editor mode");
-
- // Test general editing methods.
-
- ok(!editor.canUndo(), "canUndo() works (nothing to undo), just loaded");
-
- ok(!editor.readOnly, "editor is not read-only");
-
- is(editor.getText(), "foobarbaz", "placeholderText works");
-
- is(editor.getText().length, editor.getCharCount(),
- "getCharCount() is correct");
-
- is(editor.getText(3, 5), "ba", "getText() range works");
-
- editor.setText("source-editor");
-
- is(editor.getText(), "source-editor", "setText() works");
-
- editor.setText("code", 0, 6);
-
- is(editor.getText(), "code-editor", "setText() range works");
-
- ok(editor.canUndo(), "canUndo() works (things to undo)");
- ok(!editor.canRedo(), "canRedo() works (nothing to redo yet)");
-
- editor.undo();
-
- is(editor.getText(), "source-editor", "undo() works");
-
- ok(editor.canRedo(), "canRedo() works (things to redo)");
-
- editor.redo();
-
- is(editor.getText(), "code-editor", "redo() works");
-
- EventUtils.synthesizeKey("VK_Z", {accelKey: true}, testWin);
-
- is(editor.getText(), "source-editor", "Ctrl-Z (undo) works");
-
- EventUtils.synthesizeKey("VK_Z", {accelKey: true, shiftKey: true}, testWin);
-
- is(editor.getText(), "code-editor", "Ctrl-Shift-Z (redo) works");
-
- editor.undo();
-
- EventUtils.synthesizeKey("VK_Y", {accelKey: true}, testWin);
- if (Services.appinfo.OS == "WINNT" ||
- Services.appinfo.OS == "Linux") {
- is(editor.getText(), "code-editor",
- "CTRL+Y does redo on Linux and Windows");
- } else {
- is(editor.getText(), "source-editor",
- "CTRL+Y doesn't redo on machines other than Linux and Windows");
- editor.setText("code-editor");
- }
-
- // Test selection methods.
-
- editor.setSelection(0, 4);
-
- is(editor.getSelectedText(), "code", "getSelectedText() works");
-
- let selection = editor.getSelection();
- ok(selection.start == 0 && selection.end == 4, "getSelection() works");
-
- editor.dropSelection();
-
- selection = editor.getSelection();
- ok(selection.start == 4 && selection.end == 4, "dropSelection() works");
-
- editor.setCaretOffset(7);
- is(editor.getCaretOffset(), 7, "setCaretOffset() works");
-
- // Test grouped changes.
-
- editor.setText("foobar");
-
- editor.startCompoundChange();
-
- editor.setText("foo1");
- editor.setText("foo2");
- editor.setText("foo3");
-
- editor.endCompoundChange();
-
- is(editor.getText(), "foo3", "editor content is correct");
-
- editor.undo();
- is(editor.getText(), "foobar", "compound change undo() works");
-
- editor.redo();
- is(editor.getText(), "foo3", "compound change redo() works");
-
- // Minimal keyboard usage tests.
-
- ok(editor.hasFocus(), "editor has focus");
-
- editor.setText("code-editor");
- editor.setCaretOffset(7);
- EventUtils.synthesizeKey(".", {}, testWin);
-
- is(editor.getText(), "code-ed.itor", "focus() and typing works");
-
- EventUtils.synthesizeKey("a", {}, testWin);
-
- is(editor.getText(), "code-ed.aitor", "typing works");
-
- is(editor.getCaretOffset(), 9, "caret moved");
-
- EventUtils.synthesizeKey("VK_LEFT", {}, testWin);
-
- is(editor.getCaretOffset(), 8, "caret moved to the left");
-
- EventUtils.synthesizeKey(".", {}, testWin);
- EventUtils.synthesizeKey("VK_TAB", {}, testWin);
-
- is(editor.getText(), "code-ed.. aitor", "Tab works");
-
- is(editor.getCaretOffset(), 14, "caret location is correct");
-
- // Test the Tab key.
-
- editor.setText("a\n b\n c");
- editor.setCaretOffset(0);
-
- EventUtils.synthesizeKey("VK_TAB", {}, testWin);
- is(editor.getText(), " a\n b\n c", "Tab works");
-
- // Code editor specific tests. These are not applicable when the textarea
- // fallback is used.
- let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
- if (component != "textarea") {
- editor.setMode(SourceEditor.MODES.JAVASCRIPT);
- is(editor.getMode(), SourceEditor.MODES.JAVASCRIPT, "setMode() works");
-
- editor.setSelection(0, editor.getCharCount() - 1);
- EventUtils.synthesizeKey("VK_TAB", {}, testWin);
- is(editor.getText(), " a\n b\n c", "lines indented");
-
- EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}, testWin);
- is(editor.getText(), " a\n b\n c", "lines outdented (shift-tab)");
-
- testEclipseBug362107();
- testBug687577();
- testBackspaceKey();
- testReturnKey();
- }
-
- // Test the read-only mode.
-
- editor.setText("foofoo");
-
- editor.readOnly = true;
- EventUtils.synthesizeKey("b", {}, testWin);
- is(editor.getText(), "foofoo", "editor is now read-only (keyboard)");
-
- editor.setText("foobar");
- is(editor.getText(), "foobar", "editor allows programmatic changes (setText)");
-
- EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
- is(editor.getText(), "foobar", "Enter key does nothing");
-
- EventUtils.synthesizeKey("VK_TAB", {}, testWin);
- is(editor.getText(), "foobar", "Tab does nothing");
-
- editor.setText(" foobar");
- EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}, testWin);
- is(editor.getText(), " foobar", "Shift+Tab does nothing");
-
- editor.readOnly = false;
-
- editor.setCaretOffset(editor.getCharCount());
- EventUtils.synthesizeKey("-", {}, testWin);
- is(editor.getText(), " foobar-", "editor is now editable again");
-
- // Test the Selection event.
-
- editor.setText("foobarbaz");
-
- editor.setSelection(1, 4);
-
- let event = null;
-
- let eventHandler = function(aEvent) {
- event = aEvent;
- };
- editor.addEventListener(SourceEditor.EVENTS.SELECTION, eventHandler);
-
- editor.setSelection(0, 3);
-
- ok(event, "selection event fired");
- ok(event.oldValue.start == 1 && event.oldValue.end == 4,
- "event.oldValue is correct");
- ok(event.newValue.start == 0 && event.newValue.end == 3,
- "event.newValue is correct");
-
- event = null;
- editor.dropSelection();
-
- ok(event, "selection dropped");
- ok(event.oldValue.start == 0 && event.oldValue.end == 3,
- "event.oldValue is correct");
- ok(event.newValue.start == 3 && event.newValue.end == 3,
- "event.newValue is correct");
-
- event = null;
- EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
-
- ok(event, "select all worked");
- ok(event.oldValue.start == 3 && event.oldValue.end == 3,
- "event.oldValue is correct");
- ok(event.newValue.start == 0 && event.newValue.end == 9,
- "event.newValue is correct");
-
- event = null;
- editor.removeEventListener(SourceEditor.EVENTS.SELECTION, eventHandler);
- editor.dropSelection();
-
- ok(!event, "selection event listener removed");
-
- // Test the TextChanged event.
-
- editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, eventHandler);
-
- EventUtils.synthesizeKey(".", {}, testWin);
-
- ok(event, "the TextChanged event fired after keypress");
- is(event.start, 9, "event.start is correct");
- is(event.removedCharCount, 0, "event.removedCharCount is correct");
- is(event.addedCharCount, 1, "event.addedCharCount is correct");
-
- editor.setText("line1\nline2\nline3");
- let chars = editor.getText().length;
- event = null;
-
- editor.setText("a\nline4\nline5", chars);
-
- ok(event, "the TextChanged event fired after setText()");
- is(event.start, chars, "event.start is correct");
- is(event.removedCharCount, 0, "event.removedCharCount is correct");
- is(event.addedCharCount, 13, "event.addedCharCount is correct");
-
- event = null;
- editor.setText("line3b\nline4b\nfoo", 12, 24);
-
- ok(event, "the TextChanged event fired after setText() again");
- is(event.start, 12, "event.start is correct");
- is(event.removedCharCount, 12, "event.removedCharCount is correct");
- is(event.addedCharCount, 17, "event.addedCharCount is correct");
-
- editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, eventHandler);
-
- testClipboardEvents();
-}
-
-function testEnd()
-{
- editor.destroy();
- ok(!editor.parentElement && !editor.editorElement, "destroy() works");
-
- testWin.close();
-
- testWin = testDoc = editor = null;
-
- waitForFocus(finish, window);
-}
-
-function testBackspaceKey()
-{
- editor.setText(" a\n b\n c");
- editor.setCaretOffset(7);
- EventUtils.synthesizeKey("VK_BACK_SPACE", {}, testWin);
- is(editor.getText(), "a\n b\n c", "line outdented (Backspace)");
-
- editor.undo();
-
- editor.setCaretOffset(6);
- EventUtils.synthesizeKey("VK_BACK_SPACE", {}, testWin);
- is(editor.getText(), " a\n b\n c", "backspace one char works");
-}
-
-function testReturnKey()
-{
- editor.setText(" a\n b\n c");
-
- editor.setCaretOffset(8);
- EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
- EventUtils.synthesizeKey("x", {}, testWin);
-
- let lineDelimiter = editor.getLineDelimiter();
- ok(lineDelimiter, "we have the line delimiter");
-
- let indentationString = editor.getIndentationString();
- is(" ", indentationString, "we have an indentation string of 7 spaces");
-
- is(editor.getText(), " a" + lineDelimiter + " x\n b\n c",
- "return maintains indentation");
-
- editor.setCaretOffset(12 + lineDelimiter.length);
- EventUtils.synthesizeKey("z", {}, testWin);
- EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
- EventUtils.synthesizeKey("y", {}, testWin);
- is(editor.getText(), " a" + lineDelimiter +
- " z" + lineDelimiter + " yx\n b\n c",
- "return maintains indentation (again)");
-}
-
-function testClipboardEvents()
-{
- editor.setText("foobar");
-
- let doCut = function() {
- EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
-
- is(editor.getSelectedText(), "foobar", "select all worked");
-
- EventUtils.synthesizeKey("x", {accelKey: true}, testWin);
- };
-
- let onCut = function() {
- ok(!editor.getText(), "cut works");
- editor.setText("test--");
- editor.setCaretOffset(5);
-
- editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
- EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
- };
-
- let onPaste1 = function() {
- editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
-
- is(editor.getText(), "test-foobar-", "paste works");
-
- executeSoon(waitForClipboard.bind(this, "test", doCopy, onCopy, testEnd));
- };
-
- let doCopy = function() {
- editor.setSelection(0, 4);
- EventUtils.synthesizeKey("c", {accelKey: true}, testWin);
- };
-
- let onCopy = function() {
- editor.setSelection(5, 11);
- editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
- EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
- };
-
- let pasteTextChanges = 0;
- let removedCharCount = 0;
- let addedCharCount = 0;
- let onPaste2 = function(aEvent) {
- pasteTextChanges++;
- ok(aEvent && (pasteTextChanges == 1 || pasteTextChanges == 2),
- "event TEXT_CHANGED fired " + pasteTextChanges + " time(s)");
-
- is(aEvent.start, 5, "event.start is correct");
- if (aEvent.removedCharCount) {
- removedCharCount = aEvent.removedCharCount;
- }
- if (aEvent.addedCharCount) {
- addedCharCount = aEvent.addedCharCount;
- }
-
- if (pasteTextChanges == 2 || addedCharCount && removedCharCount) {
- editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
- executeSoon(checkPaste2Result);
- }
- };
-
- let checkPaste2Result = function() {
- is(removedCharCount, 6, "event.removedCharCount is correct");
- is(addedCharCount, 4, "event.addedCharCount is correct");
-
- is(editor.getText(), "test-test-", "paste works after copy");
- testEnd();
- };
-
- waitForClipboard("foobar", doCut, onCut, testEnd);
-}
-
-function testEclipseBug362107()
-{
- // Test for Eclipse Bug 362107:
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=362107
- let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
- if (OS != "Linux") {
- return;
- }
-
- editor.setText("line 1\nline 2\nline 3");
- editor.setCaretOffset(16);
-
- EventUtils.synthesizeKey("VK_UP", {ctrlKey: true}, testWin);
- is(editor.getCaretOffset(), 9, "Ctrl-Up works");
-
- EventUtils.synthesizeKey("VK_UP", {ctrlKey: true}, testWin);
- is(editor.getCaretOffset(), 2, "Ctrl-Up works twice");
-
- EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true}, testWin);
- is(editor.getCaretOffset(), 9, "Ctrl-Down works");
-
- EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true}, testWin);
- is(editor.getCaretOffset(), 16, "Ctrl-Down works twice");
-}
-
-function testBug687577()
-{
- // Test for Mozilla Bug 687577:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=687577
- let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
- if (OS != "Linux") {
- return;
- }
-
- editor.setText("line foobar 1\nline foobar 2\nline foobar 3");
- editor.setCaretOffset(39);
-
- EventUtils.synthesizeKey("VK_LEFT", {ctrlKey: true, shiftKey: true}, testWin);
- let selection = editor.getSelection();
- is(selection.start, 33, "select.start after Ctrl-Shift-Left");
- is(selection.end, 39, "select.end after Ctrl-Shift-Left");
-
- EventUtils.synthesizeKey("VK_UP", {ctrlKey: true, shiftKey: true}, testWin);
- selection = editor.getSelection();
- is(selection.start, 14, "select.start after Ctrl-Shift-Up");
- is(selection.end, 39, "select.end after Ctrl-Shift-Up");
-
- EventUtils.synthesizeKey("VK_UP", {ctrlKey: true, shiftKey: true}, testWin);
- selection = editor.getSelection();
- is(selection.start, 0, "select.start after Ctrl-Shift-Up (again)");
- is(selection.end, 39, "select.end after Ctrl-Shift-Up (again)");
-
- EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true, shiftKey: true}, testWin);
- selection = editor.getSelection();
- is(selection.start, 27, "select.start after Ctrl-Shift-Down");
- is(selection.end, 39, "select.end after Ctrl-Shift-Down");
-
- EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true, shiftKey: true}, testWin);
- selection = editor.getSelection();
- is(selection.start, 39, "select.start after Ctrl-Shift-Down (again)");
- is(selection.end, 41, "select.end after Ctrl-Shift-Down (again)");
-}
diff --git a/browser/devtools/sourceeditor/test/head.js b/browser/devtools/sourceeditor/test/head.js
deleted file mode 100644
index e348509c4..000000000
--- a/browser/devtools/sourceeditor/test/head.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-function getLoadContext() {
- return window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIWebNavigation)
- .QueryInterface(Ci.nsILoadContext);
-}
-
-/*
- * Polls the X11 primary selection buffer waiting for the expected value. A known
- * value different than the expected value is put on the clipboard first (and
- * also polled for) so we can be sure the value we get isn't just the expected
- * value because it was already in the buffer.
- *
- * @param aExpectedStringOrValidatorFn
- * The string value that is expected to be in the X11 primary selection buffer
- * or a validator function getting clipboard data and returning a bool.
- * @param aSetupFn
- * A function responsible for setting the primary selection buffer to the
- * expected value, called after the known value setting succeeds.
- * @param aSuccessFn
- * A function called when the expected value is found in the primary
- * selection buffer.
- * @param aFailureFn
- * A function called if the expected value isn't found in the primary
- * selection buffer within 5s. It can also be called if the known value
- * can't be found.
- * @param aFlavor [optional] The flavor to look for. Defaults to "text/unicode".
- */
-function waitForSelection(aExpectedStringOrValidatorFn, aSetupFn,
- aSuccessFn, aFailureFn, aFlavor) {
- let requestedFlavor = aFlavor || "text/unicode";
-
- // Build a default validator function for common string input.
- var inputValidatorFn = typeof(aExpectedStringOrValidatorFn) == "string"
- ? function(aData) aData == aExpectedStringOrValidatorFn
- : aExpectedStringOrValidatorFn;
-
- let clipboard = Cc["@mozilla.org/widget/clipboard;1"].
- getService(Ci.nsIClipboard);
-
- // reset for the next use
- function reset() {
- waitForSelection._polls = 0;
- }
-
- function wait(validatorFn, successFn, failureFn, flavor) {
- if (++waitForSelection._polls > 50) {
- // Log the failure.
- ok(false, "Timed out while polling the X11 primary selection buffer.");
- reset();
- failureFn();
- return;
- }
-
- let transferable = Cc["@mozilla.org/widget/transferable;1"].
- createInstance(Ci.nsITransferable);
- transferable.init(getLoadContext());
- transferable.addDataFlavor(requestedFlavor);
-
- clipboard.getData(transferable, clipboard.kSelectionClipboard);
-
- let str = {};
- let strLength = {};
-
- transferable.getTransferData(requestedFlavor, str, strLength);
-
- let data = null;
- if (str.value) {
- let strValue = str.value.QueryInterface(Ci.nsISupportsString);
- data = strValue.data.substring(0, strLength.value / 2);
- }
-
- if (validatorFn(data)) {
- // Don't show the success message when waiting for preExpectedVal
- if (preExpectedVal) {
- preExpectedVal = null;
- } else {
- ok(true, "The X11 primary selection buffer has the correct value");
- }
- reset();
- successFn();
- } else {
- setTimeout(function() wait(validatorFn, successFn, failureFn, flavor), 100);
- }
- }
-
- // First we wait for a known value different from the expected one.
- var preExpectedVal = waitForSelection._monotonicCounter +
- "-waitForSelection-known-value";
-
- let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
- getService(Ci.nsIClipboardHelper);
- clipboardHelper.copyStringToClipboard(preExpectedVal,
- Ci.nsIClipboard.kSelectionClipboard,
- document);
-
- wait(function(aData) aData == preExpectedVal,
- function() {
- // Call the original setup fn
- aSetupFn();
- wait(inputValidatorFn, aSuccessFn, aFailureFn, requestedFlavor);
- }, aFailureFn, "text/unicode");
-}
-
-waitForSelection._polls = 0;
-waitForSelection.__monotonicCounter = 0;
-waitForSelection.__defineGetter__("_monotonicCounter", function () {
- return waitForSelection.__monotonicCounter++;
-});
-
-/**
- * Open a new window with a source editor inside.
- *
- * @param function aCallback
- * The function you want invoked once the editor is loaded. The function
- * is given two arguments: editor instance and the window object.
- * @param object [aOptions]
- * The options object to pass to the SourceEditor.init() method.
- */
-function openSourceEditorWindow(aCallback, aOptions) {
- const windowUrl = "data:text/xml;charset=UTF-8,<?xml version='1.0'?>" +
- "<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
- " title='Test for Source Editor' width='600' height='500'><box flex='1'/></window>";
- const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
-
- let editor = null;
- let testWin = Services.ww.openWindow(null, windowUrl, "_blank",
- windowFeatures, null);
- testWin.addEventListener("load", function onWindowLoad() {
- testWin.removeEventListener("load", onWindowLoad, false);
- waitForFocus(initEditor, testWin);
- }, false);
-
- function initEditor()
- {
- let tempScope = {};
- Cu.import("resource:///modules/source-editor.jsm", tempScope);
-
- let box = testWin.document.querySelector("box");
- editor = new tempScope.SourceEditor();
- editor.init(box, aOptions || {}, editorLoaded);
- }
-
- function editorLoaded()
- {
- editor.focus();
- waitForFocus(aCallback.bind(null, editor, testWin), testWin);
- }
-}
-
-/**
- * Get text needed to fill the editor view.
- *
- * @param object aEditor
- * The SourceEditor instance you work with.
- * @param number aPages
- * The number of pages you want filled with lines.
- * @return string
- * The string you can insert into the editor so you fill the desired
- * number of pages.
- */
-function fillEditor(aEditor, aPages) {
- let view = aEditor._view;
- let model = aEditor._model;
-
- let lineHeight = view.getLineHeight();
- let editorHeight = view.getClientArea().height;
- let linesPerPage = Math.floor(editorHeight / lineHeight);
- let totalLines = aPages * linesPerPage;
-
- let text = "";
- for (let i = 0; i < totalLines; i++) {
- text += "l" + i + " lorem ipsum dolor sit amet. lipsum foobaris bazbaz,\n";
- }
-
- return text;
-}
diff --git a/browser/devtools/sourceeditor/test/moz.build b/browser/devtools/sourceeditor/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/sourceeditor/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/styleeditor/moz.build b/browser/devtools/styleeditor/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/styleeditor/moz.build
+++ b/browser/devtools/styleeditor/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/styleeditor/test/Makefile.in b/browser/devtools/styleeditor/test/Makefile.in
deleted file mode 100644
index 1918c406a..000000000
--- a/browser/devtools/styleeditor/test/Makefile.in
+++ /dev/null
@@ -1,55 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_styleeditor_enabled.js \
- browser_styleeditor_filesave.js \
- browser_styleeditor_cmd_edit.js \
- browser_styleeditor_cmd_edit.html \
- browser_styleeditor_import.js \
- browser_styleeditor_import_rule.js \
- browser_styleeditor_init.js \
- browser_styleeditor_loading.js \
- browser_styleeditor_new.js \
- browser_styleeditor_pretty.js \
- browser_styleeditor_private_perwindowpb.js \
- browser_styleeditor_sv_keynav.js \
- browser_styleeditor_sv_resize.js \
- browser_styleeditor_bug_740541_iframes.js \
- browser_styleeditor_bug_851132_middle_click.js \
- browser_styleeditor_bug_870339.js \
- browser_styleeditor_nostyle.js \
- browser_styleeditor_reload.js \
- head.js \
- four.html \
- head.js \
- import.css \
- import.html \
- import2.css \
- longload.html \
- media.html \
- media-small.css \
- minified.html \
- nostyle.html \
- resources_inpage.jsi \
- resources_inpage1.css \
- resources_inpage2.css \
- simple.css \
- simple.css.gz \
- simple.css.gz^headers^ \
- simple.gz.html \
- simple.html \
- test_private.html \
- test_private.css \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_bug_740541_iframes.js b/browser/devtools/styleeditor/test/browser_styleeditor_bug_740541_iframes.js
deleted file mode 100644
index f438bc454..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_bug_740541_iframes.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
-
- function makeStylesheet(selector) {
- return ("data:text/css;charset=UTF-8," +
- encodeURIComponent(selector + " { }"));
- }
-
- function makeDocument(stylesheets, framedDocuments) {
- stylesheets = stylesheets || [];
- framedDocuments = framedDocuments || [];
- return "data:text/html;charset=UTF-8," + encodeURIComponent(
- Array.prototype.concat.call(
- ["<!DOCTYPE html>",
- "<html>",
- "<head>",
- "<title>Bug 740541</title>"],
- stylesheets.map(function (sheet) {
- return '<link rel="stylesheet" type="text/css" href="'+sheet+'">';
- }),
- ["</head>",
- "<body>"],
- framedDocuments.map(function (doc) {
- return '<iframe src="'+doc+'"></iframe>';
- }),
- ["</body>",
- "</html>"]
- ).join("\n"));
- }
-
- const DOCUMENT_WITH_INLINE_STYLE = "data:text/html;charset=UTF-8," +
- encodeURIComponent(
- ["<!DOCTYPE html>",
- "<html>",
- " <head>",
- " <title>Bug 740541</title>",
- ' <style type="text/css">',
- " .something {",
- " }",
- " </style>",
- " </head>",
- " <body>",
- " </body>",
- " </html>"
- ].join("\n"));
-
- const FOUR = TEST_BASE_HTTP + "four.html";
-
- const SIMPLE = TEST_BASE_HTTP + "simple.css";
-
- const SIMPLE_DOCUMENT = TEST_BASE_HTTP + "simple.html";
-
-
- const TESTCASE_URI = makeDocument(
- [makeStylesheet(".a")],
- [makeDocument([],
- [FOUR,
- DOCUMENT_WITH_INLINE_STYLE]),
- makeDocument([makeStylesheet(".b"),
- SIMPLE],
- [makeDocument([makeStylesheet(".c")],
- [])]),
- makeDocument([SIMPLE], []),
- SIMPLE_DOCUMENT
- ]);
-
- const EXPECTED_STYLE_SHEET_COUNT = 12;
-
- waitForExplicitFinish();
- let styleSheetCount = 0;
- addTabAndOpenStyleEditor(function (aPanel) {
- aPanel.UI.on("editor-added", function () {
- ++styleSheetCount;
- info(styleSheetCount+" out of "+
- EXPECTED_STYLE_SHEET_COUNT+" style sheets loaded");
- if (styleSheetCount == EXPECTED_STYLE_SHEET_COUNT) {
- ok(true, "all style sheets loaded");
- // The right number of events have been received; check that
- // they actually show up in the style editor UI.
- is(aPanel.UI.editors.length, EXPECTED_STYLE_SHEET_COUNT,
- "UI elements present");
- finish();
- }
- });
- });
- content.location = TESTCASE_URI;
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_bug_851132_middle_click.js b/browser/devtools/styleeditor/test/browser_styleeditor_bug_851132_middle_click.js
deleted file mode 100644
index b196339a2..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_bug_851132_middle_click.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "four.html";
-
-let gUI;
-
-function test() {
- waitForExplicitFinish();
-
- let count = 0;
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", function(event, editor) {
- count++;
- if (count == 2) {
- runTests();
- }
- })
- });
-
- content.location = TESTCASE_URI;
-}
-
-let timeoutID;
-
-function runTests() {
- gBrowser.tabContainer.addEventListener("TabOpen", onTabAdded, false);
- gUI.editors[0].getSourceEditor().then(onEditor0Attach);
- gUI.editors[1].getSourceEditor().then(onEditor1Attach);
-}
-
-function getStylesheetNameLinkFor(aEditor) {
- return aEditor.summary.querySelector(".stylesheet-name");
-}
-
-function onEditor0Attach(aEditor) {
- waitForFocus(function () {
- // left mouse click should focus editor 1
- EventUtils.synthesizeMouseAtCenter(
- getStylesheetNameLinkFor(gUI.editors[1]),
- {button: 0},
- gPanelWindow);
- }, gPanelWindow);
-}
-
-function onEditor1Attach(aEditor) {
- ok(aEditor.sourceEditor.hasFocus(),
- "left mouse click has given editor 1 focus");
-
- // right mouse click should not open a new tab
- EventUtils.synthesizeMouseAtCenter(
- getStylesheetNameLinkFor(gUI.editors[2]),
- {button: 1},
- gPanelWindow);
-
- setTimeout(finish, 0);
-}
-
-function onTabAdded() {
- ok(false, "middle mouse click has opened a new tab");
- finish();
-}
-
-registerCleanupFunction(function () {
- gBrowser.tabContainer.removeEventListener("TabOpen", onTabAdded, false);
- gUI = null;
-});
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_bug_870339.js b/browser/devtools/styleeditor/test/browser_styleeditor_bug_870339.js
deleted file mode 100644
index 6daa0f4f8..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_bug_870339.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function test()
-{
- const SIMPLE = TEST_BASE_HTTP + "simple.css";
- const DOCUMENT_WITH_ONE_STYLESHEET = "data:text/html;charset=UTF-8," +
- encodeURIComponent(
- ["<!DOCTYPE html>",
- "<html>",
- " <head>",
- " <title>Bug 870339</title>",
- ' <link rel="stylesheet" type="text/css" href="'+SIMPLE+'">',
- " </head>",
- " <body>",
- " </body>",
- "</html>"
- ].join("\n"));
-
- waitForExplicitFinish();
- addTabAndOpenStyleEditor(function (aPanel) {
- let debuggee = aPanel._debuggee;
-
- // Spam the _onNewDocument callback multiple times before the
- // StyleEditorActor has a chance to respond to the first one.
- const SPAM_COUNT = 2;
- for (let i=0; i<SPAM_COUNT; ++i) {
- debuggee._onNewDocument();
- }
-
- // Wait for the StyleEditorActor to respond to each "newDocument"
- // message.
- let loadCount = 0;
- debuggee.on("document-load", function () {
- ++loadCount;
- if (loadCount == SPAM_COUNT) {
- // No matter how large SPAM_COUNT is, the number of style
- // sheets should never be more than the number of style sheets
- // in the document.
- is(debuggee.styleSheets.length, 1, "correct style sheet count");
- finish();
- }
- });
- });
- content.location = DOCUMENT_WITH_ONE_STYLESHEET;
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html b/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html
deleted file mode 100644
index 28fccb331..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<head>
- <meta charset="utf-8">
- <title>Resources</title>
- <script type="text/javascript" id="script1">
- window.addEventListener('load', function() {
- var pid = document.getElementById('pid');
- var div = document.createElement('div');
- div.id = 'divid';
- div.classList.add('divclass');
- div.appendChild(document.createTextNode('div'));
- div.setAttribute('data-a1', 'div');
- pid.parentNode.appendChild(div);
- });
- </script>
- <script src="resources_inpage.jsi"></script>
- <link rel="stylesheet" type="text/css" href="resources_inpage1.css"/>
- <link rel="stylesheet" type="text/css" href="resources_inpage2.css"/>
- <style type="text/css">
- p { color: #800; }
- div { color: #008; }
- h4 { color: #080; }
- h3 { color: #880; }
- </style>
-</head>
-<body>
- <style type="text/css" id=style2>
- .pclass { background-color: #FEE; }
- .divclass { background-color: #EEF; }
- .h4class { background-color: #EFE; }
- .h3class { background-color: #FFE; }
- </style>
-
- <p class="pclass" id="pid" data-a1="p">paragraph</p>
-
- <script>
- var pid = document.getElementById('pid');
- var h4 = document.createElement('h4');
- h4.id = 'h4id';
- h4.classList.add('h4class');
- h4.appendChild(document.createTextNode('h4'));
- h4.setAttribute('data-a1', 'h4');
- pid.parentNode.appendChild(h4);
- </script>
-
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js b/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js
deleted file mode 100644
index f64e96864..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the edit command works
-
-const TEST_URI = "http://example.com/browser/browser/devtools/styleeditor/" +
- "test/browser_styleeditor_cmd_edit.html";
-
-
-function test() {
- let windowClosed = Promise.defer();
-
- helpers.addTabWithToolbar(TEST_URI, function(options) {
- return helpers.audit(options, [
- {
- setup: "edit",
- check: {
- input: 'edit',
- hints: ' <resource> [line]',
- markup: 'VVVV',
- status: 'ERROR',
- args: {
- resource: { status: 'INCOMPLETE' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit i",
- check: {
- input: 'edit i',
- hints: 'nline-css [line]',
- markup: 'VVVVVI',
- status: 'ERROR',
- args: {
- resource: { arg: ' i', status: 'INCOMPLETE' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit c",
- check: {
- input: 'edit c',
- hints: 'ss#style2 [line]',
- markup: 'VVVVVI',
- status: 'ERROR',
- args: {
- resource: { arg: ' c', status: 'INCOMPLETE' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit http",
- check: {
- input: 'edit http',
- hints: '://example.com/browser/browser/devtools/styleeditor/test/resources_inpage1.css [line]',
- markup: 'VVVVVIIII',
- status: 'ERROR',
- args: {
- resource: { arg: ' http', status: 'INCOMPLETE', message: '' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit page1",
- check: {
- input: 'edit page1',
- hints: ' [line] -> http://example.com/browser/browser/devtools/styleeditor/test/resources_inpage1.css',
- markup: 'VVVVVIIIII',
- status: 'ERROR',
- args: {
- resource: { arg: ' page1', status: 'INCOMPLETE', message: '' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit page2",
- check: {
- input: 'edit page2',
- hints: ' [line] -> http://example.com/browser/browser/devtools/styleeditor/test/resources_inpage2.css',
- markup: 'VVVVVIIIII',
- status: 'ERROR',
- args: {
- resource: { arg: ' page2', status: 'INCOMPLETE', message: '' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit stylez",
- check: {
- input: 'edit stylez',
- hints: ' [line]',
- markup: 'VVVVVEEEEEE',
- status: 'ERROR',
- args: {
- resource: { arg: ' stylez', status: 'ERROR', message: 'Can\'t use \'stylez\'.' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit css#style2",
- check: {
- input: 'edit css#style2',
- hints: ' [line]',
- markup: 'VVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- resource: { arg: ' css#style2', status: 'VALID', message: '' },
- line: { status: 'VALID' },
- }
- },
- },
- {
- setup: "edit css#style2 5",
- check: {
- input: 'edit css#style2 5',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVV',
- status: 'VALID',
- args: {
- resource: { arg: ' css#style2', status: 'VALID', message: '' },
- line: { value: 5, arg: ' 5', status: 'VALID' },
- }
- },
- },
- {
- setup: "edit css#style2 0",
- check: {
- input: 'edit css#style2 0',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVE',
- status: 'ERROR',
- args: {
- resource: { arg: ' css#style2', status: 'VALID', message: '' },
- line: { arg: ' 0', status: 'ERROR', message: '0 is smaller than minimum allowed: 1.' },
- }
- },
- },
- {
- setup: "edit css#style2 -1",
- check: {
- input: 'edit css#style2 -1',
- hints: '',
- markup: 'VVVVVVVVVVVVVVVVEE',
- status: 'ERROR',
- args: {
- resource: { arg: ' css#style2', status: 'VALID', message: '' },
- line: { arg: ' -1', status: 'ERROR', message: '-1 is smaller than minimum allowed: 1.' },
- }
- },
- },
- {
- // Bug 759853
- skipIf: true,
- name: "edit exec",
- setup: function() {
- var windowListener = {
- onOpenWindow: function(win) {
- // Wait for the window to finish loading
- let win = win.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- win.close();
- }, false);
- win.addEventListener("unload", function onUnload() {
- win.removeEventListener("unload", onUnload, false);
- Services.wm.removeListener(windowListener);
- windowClosed.resolve();
- }, false);
- },
- onCloseWindow: function(win) { },
- onWindowTitleChange: function(win, title) { }
- };
-
- Services.wm.addListener(windowListener);
-
- helpers.setInput(options, "edit css#style2");
- },
- check: {
- input: "edit css#style2",
- args: {
- resource: {
- value: function(resource) {
- let style2 = options.window.document.getElementById("style2");
- return resource.element.ownerNode == style2;
- }
- },
- line: { value: 1 },
- },
- },
- exec: {
- output: "",
- },
- post: function() {
- return windowClosed.promise;
- }
- },
- ]);
- }).then(finish);
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_enabled.js b/browser/devtools/styleeditor/test/browser_styleeditor_enabled.js
deleted file mode 100644
index faa687373..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_enabled.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// https rather than chrome to improve coverage
-const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
-
-function test()
-{
- waitForExplicitFinish();
-
- let count = 0;
- addTabAndOpenStyleEditor(function(panel) {
- let UI = panel.UI;
- UI.on("editor-added", function(event, editor) {
- count++;
- if (count == 2) {
- // we test against first stylesheet after all are ready
- let editor = UI.editors[0];
- editor.getSourceEditor().then(runTests.bind(this, UI, editor));
- }
- })
- });
-
- content.location = TESTCASE_URI;
-}
-
-function runTests(UI, editor)
-{
- testEnabledToggle(UI, editor);
-}
-
-function testEnabledToggle(UI, editor)
-{
- let summary = editor.summary;
- let enabledToggle = summary.querySelector(".stylesheet-enabled");
- ok(enabledToggle, "enabled toggle button exists");
-
- is(editor.styleSheet.disabled, false,
- "first stylesheet is initially enabled");
-
- is(summary.classList.contains("disabled"), false,
- "first stylesheet is initially enabled, UI does not have DISABLED class");
-
- let disabledToggleCount = 0;
- editor.on("property-change", function(event, property) {
- if (property != "disabled") {
- return;
- }
- disabledToggleCount++;
-
- if (disabledToggleCount == 1) {
- is(editor.styleSheet.disabled, true, "first stylesheet is now disabled");
- is(summary.classList.contains("disabled"), true,
- "first stylesheet is now disabled, UI has DISABLED class");
-
- // now toggle it back to enabled
- waitForFocus(function () {
- EventUtils.synthesizeMouseAtCenter(enabledToggle, {}, gPanelWindow);
- }, gPanelWindow);
- return;
- }
-
- // disabledToggleCount == 2
- is(editor.styleSheet.disabled, false, "first stylesheet is now enabled again");
- is(summary.classList.contains("disabled"), false,
- "first stylesheet is now enabled again, UI does not have DISABLED class");
-
- finish();
- });
-
- waitForFocus(function () {
- EventUtils.synthesizeMouseAtCenter(enabledToggle, {}, gPanelWindow);
- }, gPanelWindow);
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_filesave.js b/browser/devtools/styleeditor/test/browser_styleeditor_filesave.js
deleted file mode 100644
index d0588b630..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_filesave.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI_HTML = TEST_BASE + "simple.html";
-const TESTCASE_URI_CSS = TEST_BASE + "simple.css";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-let tempScope = {};
-Components.utils.import("resource://gre/modules/FileUtils.jsm", tempScope);
-Components.utils.import("resource://gre/modules/NetUtil.jsm", tempScope);
-let FileUtils = tempScope.FileUtils;
-let NetUtil = tempScope.NetUtil;
-
-
-function test()
-{
- waitForExplicitFinish();
-
- copy(TESTCASE_URI_HTML, "simple.html", function(htmlFile) {
- copy(TESTCASE_URI_CSS, "simple.css", function(cssFile) {
- addTabAndOpenStyleEditor(function(panel) {
- let UI = panel.UI;
- UI.on("editor-added", function(event, editor) {
- if (editor.styleSheet.styleSheetIndex != 0) {
- return; // we want to test against the first stylesheet
- }
- let editor = UI.editors[0];
- editor.getSourceEditor().then(runTests.bind(this, editor));
- })
- });
-
- let uri = Services.io.newFileURI(htmlFile);
- let filePath = uri.resolve("");
- content.location = filePath;
- });
- });
-}
-
-function runTests(editor)
-{
- editor.saveToFile(null, function (file) {
- ok(file, "file should get saved directly when using a file:// URI");
- finish();
- });
-}
-
-function copy(aSrcChromeURL, aDestFileName, aCallback)
-{
- let destFile = FileUtils.getFile("ProfD", [aDestFileName]);
- write(read(aSrcChromeURL), destFile, aCallback);
-}
-
-function read(aSrcChromeURL)
-{
- let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
- .getService(Ci.nsIScriptableInputStream);
-
- let channel = Services.io.newChannel(aSrcChromeURL, null, null);
- let input = channel.open();
- scriptableStream.init(input);
-
- let data = scriptableStream.read(input.available());
- scriptableStream.close();
- input.close();
-
- return data;
-}
-
-function write(aData, aFile, aCallback)
-{
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Ci.nsIScriptableUnicodeConverter);
-
- converter.charset = "UTF-8";
-
- let istream = converter.convertToInputStream(aData);
- let ostream = FileUtils.openSafeFileOutputStream(aFile);
-
- NetUtil.asyncCopy(istream, ostream, function(status) {
- if (!Components.isSuccessCode(status)) {
- info("Coudln't write to " + aFile.path);
- return;
- }
-
- aCallback(aFile);
- });
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_import.js b/browser/devtools/styleeditor/test/browser_styleeditor_import.js
deleted file mode 100644
index 452e97111..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_import.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// http rather than chrome to improve coverage
-const TESTCASE_URI = TEST_BASE_HTTP + "simple.html";
-
-let tempScope = {};
-Components.utils.import("resource://gre/modules/FileUtils.jsm", tempScope);
-let FileUtils = tempScope.FileUtils;
-
-const FILENAME = "styleeditor-import-test.css";
-const SOURCE = "body{background:red;}";
-
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", testEditorAdded);
- });
-
- content.location = TESTCASE_URI;
-}
-
-function testImport()
-{
- // create file to import first
- let file = FileUtils.getFile("ProfD", [FILENAME]);
- let ostream = FileUtils.openSafeFileOutputStream(file);
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let istream = converter.convertToInputStream(SOURCE);
- NetUtil.asyncCopy(istream, ostream, function (status) {
- FileUtils.closeSafeFileOutputStream(ostream);
-
- // click the import button now that the file to import is ready
- gUI._mockImportFile = file;
-
- waitForFocus(function () {
- let document = gPanelWindow.document
- let importButton = document.querySelector(".style-editor-importButton");
- ok(importButton, "import button exists");
-
- EventUtils.synthesizeMouseAtCenter(importButton, {}, gPanelWindow);
- }, gPanelWindow);
- });
-}
-
-let gAddedCount = 0;
-function testEditorAdded(aEvent, aEditor)
-{
- if (++gAddedCount == 2) {
- // test import after the 2 initial stylesheets have been loaded
- gUI.editors[0].getSourceEditor().then(function() {
- testImport();
- });
- }
-
- if (!aEditor.savedFile) {
- return;
- }
-
- is(aEditor.savedFile.leafName, FILENAME,
- "imported stylesheet will be saved directly into the same file");
- is(aEditor.friendlyName, FILENAME,
- "imported stylesheet has the same name as the filename");
-
- gUI = null;
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_import_rule.js b/browser/devtools/styleeditor/test/browser_styleeditor_import_rule.js
deleted file mode 100644
index 345d1ac95..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_import_rule.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// http rather than chrome to improve coverage
-const TESTCASE_URI = TEST_BASE_HTTP + "import.html";
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", onEditorAdded);
- });
-
- content.location = TESTCASE_URI;
-}
-
-let gAddedCount = 0;
-function onEditorAdded()
-{
- if (++gAddedCount != 3) {
- return;
- }
-
- is(gUI.editors.length, 3,
- "there are 3 stylesheets after loading @imports");
-
- is(gUI.editors[0].styleSheet.href, TEST_BASE_HTTP + "simple.css",
- "stylesheet 1 is simple.css");
-
- is(gUI.editors[1].styleSheet.href, TEST_BASE_HTTP + "import.css",
- "stylesheet 2 is import.css");
-
- is(gUI.editors[2].styleSheet.href, TEST_BASE_HTTP + "import2.css",
- "stylesheet 3 is import2.css");
-
- gUI = null;
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_init.js b/browser/devtools/styleeditor/test/browser_styleeditor_init.js
deleted file mode 100644
index 0e0afedbb..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_init.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "simple.html";
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", testEditorAdded);
- });
-
- content.location = TESTCASE_URI;
-}
-
-let gEditorAddedCount = 0;
-function testEditorAdded(aEvent, aEditor)
-{
- if (aEditor.styleSheet.styleSheetIndex == 0) {
- gEditorAddedCount++;
- testFirstStyleSheetEditor(aEditor);
- }
- if (aEditor.styleSheet.styleSheetIndex == 1) {
- gEditorAddedCount++;
- testSecondStyleSheetEditor(aEditor);
- }
-
- if (gEditorAddedCount == 2) {
- gUI = null;
- finish();
- }
-}
-
-function testFirstStyleSheetEditor(aEditor)
-{
- // Note: the html <link> contains charset="UTF-8".
- ok(aEditor._state.text.indexOf("\u263a") >= 0,
- "stylesheet is unicode-aware.");
-
- //testing TESTCASE's simple.css stylesheet
- is(aEditor.styleSheet.styleSheetIndex, 0,
- "first stylesheet is at index 0");
-
- is(aEditor, gUI.editors[0],
- "first stylesheet corresponds to StyleEditorChrome.editors[0]");
-
- let summary = aEditor.summary;
-
- let name = summary.querySelector(".stylesheet-name > label").getAttribute("value");
- is(name, "simple.css",
- "first stylesheet's name is `simple.css`");
-
- let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
- is(parseInt(ruleCount), 1,
- "first stylesheet UI shows rule count as 1");
-
- ok(summary.classList.contains("splitview-active"),
- "first stylesheet UI is focused/active");
-}
-
-function testSecondStyleSheetEditor(aEditor)
-{
- //testing TESTCASE's inline stylesheet
- is(aEditor.styleSheet.styleSheetIndex, 1,
- "second stylesheet is at index 1");
-
- is(aEditor, gUI.editors[1],
- "second stylesheet corresponds to StyleEditorChrome.editors[1]");
-
- let summary = aEditor.summary;
-
- let name = summary.querySelector(".stylesheet-name > label").getAttribute("value");
- ok(/^<.*>$/.test(name),
- "second stylesheet's name is surrounded by `<>`");
-
- let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
- is(parseInt(ruleCount), 3,
- "second stylesheet UI shows rule count as 3");
-
- ok(!summary.classList.contains("splitview-active"),
- "second stylesheet UI is NOT focused/active");
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_loading.js b/browser/devtools/styleeditor/test/browser_styleeditor_loading.js
deleted file mode 100644
index 144cc01b8..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_loading.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "longload.html";
-
-
-function test()
-{
- waitForExplicitFinish();
-
- // launch Style Editor right when the tab is created (before load)
- // this checks that the Style Editor still launches correctly when it is opened
- // *while* the page is still loading. The Style Editor should not signal that
- // it is loaded until the accompanying content page is loaded.
-
- addTabAndOpenStyleEditor(function(panel) {
- panel.UI.on("editor-added", testEditorAdded);
-
- content.location = TESTCASE_URI;
- });
-}
-
-function testEditorAdded(event, editor)
-{
- let root = gPanelWindow.document.querySelector(".splitview-root");
- ok(!root.classList.contains("loading"),
- "style editor root element does not have 'loading' class name anymore");
-
- let button = gPanelWindow.document.querySelector(".style-editor-newButton");
- ok(!button.hasAttribute("disabled"),
- "new style sheet button is enabled");
-
- button = gPanelWindow.document.querySelector(".style-editor-importButton");
- ok(!button.hasAttribute("disabled"),
- "import button is enabled");
-
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_new.js b/browser/devtools/styleeditor/test/browser_styleeditor_new.js
deleted file mode 100644
index 8b301b5dd..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_new.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "simple.html";
-
-let TRANSITION_CLASS = "moz-styleeditor-transitioning";
-let TESTCASE_CSS_SOURCE = "body{background-color:red;";
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", testEditorAdded);
- });
-
- content.location = TESTCASE_URI;
-}
-
-let gAddedCount = 0; // to add new stylesheet after the 2 initial stylesheets
-let gNewEditor; // to make sure only one new stylesheet got created
-let gOriginalHref;
-
-let checksCompleted = 0;
-
-function testEditorAdded(aEvent, aEditor)
-{
- gAddedCount++;
- if (gAddedCount == 2) {
- waitForFocus(function () {// create a new style sheet
- let newButton = gPanelWindow.document.querySelector(".style-editor-newButton");
- ok(newButton, "'new' button exists");
-
- EventUtils.synthesizeMouseAtCenter(newButton, {}, gPanelWindow);
- }, gPanelWindow);
- }
- if (gAddedCount < 3) {
- return;
- }
-
- ok(!gNewEditor, "creating a new stylesheet triggers one EditorAdded event");
- gNewEditor = aEditor; // above test will fail if we get a duplicate event
-
- is(gUI.editors.length, 3,
- "creating a new stylesheet added a new StyleEditor instance");
-
- aEditor.styleSheet.once("style-applied", function() {
- // when changes have been completely applied to live stylesheet after transisiton
- ok(!content.document.documentElement.classList.contains(TRANSITION_CLASS),
- "StyleEditor's transition class has been removed from content");
-
- if (++checksCompleted == 3) {
- cleanup();
- }
- });
-
- aEditor.styleSheet.on("property-change", function(event, property) {
- if (property == "ruleCount") {
- let ruleCount = aEditor.summary.querySelector(".stylesheet-rule-count").textContent;
- is(parseInt(ruleCount), 1,
- "new editor shows 1 rule after modification");
-
- if (++checksCompleted == 3) {
- cleanup();
- }
- }
- });
-
- aEditor.getSourceEditor().then(testEditor);
-}
-
-function testEditor(aEditor) {
- waitForFocus(function () {
- gOriginalHref = aEditor.styleSheet.href;
-
- let summary = aEditor.summary;
-
- ok(aEditor.sourceLoaded,
- "new editor is loaded when attached");
- ok(aEditor.isNew,
- "new editor has isNew flag");
-
- ok(aEditor.sourceEditor.hasFocus(),
- "new editor has focus");
-
- let summary = aEditor.summary;
- let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
- is(parseInt(ruleCount), 0,
- "new editor initially shows 0 rules");
-
- let computedStyle = content.getComputedStyle(content.document.body, null);
- is(computedStyle.backgroundColor, "rgb(255, 255, 255)",
- "content's background color is initially white");
-
- EventUtils.synthesizeKey("[", {accelKey: true}, gPanelWindow);
- is(aEditor.sourceEditor.getText(), "",
- "Nothing happened as it is a known shortcut in source editor");
-
- EventUtils.synthesizeKey("]", {accelKey: true}, gPanelWindow);
- is(aEditor.sourceEditor.getText(), "",
- "Nothing happened as it is a known shortcut in source editor");
-
- for each (let c in TESTCASE_CSS_SOURCE) {
- EventUtils.synthesizeKey(c, {}, gPanelWindow);
- }
-
- is(aEditor.sourceEditor.getText(), TESTCASE_CSS_SOURCE + "}",
- "rule bracket has been auto-closed");
-
- ok(aEditor.unsaved,
- "new editor has unsaved flag");
-
- // we know that the testcase above will start a CSS transition
- content.addEventListener("transitionend", onTransitionEnd, false);
-}, gPanelWindow) ;
-}
-
-function onTransitionEnd() {
- content.removeEventListener("transitionend", onTransitionEnd, false);
-
- let computedStyle = content.getComputedStyle(content.document.body, null);
- is(computedStyle.backgroundColor, "rgb(255, 0, 0)",
- "content's background color has been updated to red");
-
- if (gNewEditor) {
- is(gNewEditor.styleSheet.href, gOriginalHref,
- "style sheet href did not change");
- }
-
- if (++checksCompleted == 3) {
- cleanup();
- }
-}
-
-function cleanup() {
- gNewEditor = null;
- gUI = null;
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_nostyle.js b/browser/devtools/styleeditor/test/browser_styleeditor_nostyle.js
deleted file mode 100644
index cc7af9556..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_nostyle.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "nostyle.html";
-
-
-function test()
-{
- waitForExplicitFinish();
-
- // launch Style Editor right when the tab is created (before load)
- // this checks that the Style Editor still launches correctly when it is opened
- // *while* the page is still loading. The Style Editor should not signal that
- // it is loaded until the accompanying content page is loaded.
-
- addTabAndOpenStyleEditor(function(panel) {
- panel.UI.once("document-load", testDocumentLoad);
-
- content.location = TESTCASE_URI;
- });
-}
-
-function testDocumentLoad(event)
-{
- let root = gPanelWindow.document.querySelector(".splitview-root");
- ok(!root.classList.contains("loading"),
- "style editor root element does not have 'loading' class name anymore");
-
- ok(root.querySelector(".empty.placeholder"), "showing 'no style' indicator");
-
- let button = gPanelWindow.document.querySelector(".style-editor-newButton");
- ok(!button.hasAttribute("disabled"),
- "new style sheet button is enabled");
-
- button = gPanelWindow.document.querySelector(".style-editor-importButton");
- ok(!button.hasAttribute("disabled"),
- "import button is enabled");
-
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_pretty.js b/browser/devtools/styleeditor/test/browser_styleeditor_pretty.js
deleted file mode 100644
index 94cd695c8..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_pretty.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "minified.html";
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", function(event, editor) {
- editor.getSourceEditor().then(function() {
- testEditor(editor);
- });
- });
- });
-
- content.location = TESTCASE_URI;
-}
-
-let editorTestedCount = 0;
-function testEditor(aEditor)
-{
- if (aEditor.styleSheet.styleSheetIndex == 0) {
- let prettifiedSource = "body\{\r?\n\tbackground\:white;\r?\n\}\r?\n\r?\ndiv\{\r?\n\tfont\-size\:4em;\r?\n\tcolor\:red\r?\n\}\r?\n";
- let prettifiedSourceRE = new RegExp(prettifiedSource);
-
- ok(prettifiedSourceRE.test(aEditor.sourceEditor.getText()),
- "minified source has been prettified automatically");
- editorTestedCount++;
- let summary = gUI.editors[1].summary;
- EventUtils.synthesizeMouseAtCenter(summary, {}, gPanelWindow);
- }
-
- if (aEditor.styleSheet.styleSheetIndex == 1) {
- let originalSource = "body \{ background\: red; \}\r?\ndiv \{\r?\nfont\-size\: 5em;\r?\ncolor\: red\r?\n\}";
- let originalSourceRE = new RegExp(originalSource);
-
- ok(originalSourceRE.test(aEditor.sourceEditor.getText()),
- "non-minified source has been left untouched");
- editorTestedCount++;
- }
-
- if (editorTestedCount == 2) {
- gUI = null;
- finish();
- }
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js b/browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js
deleted file mode 100644
index 3b336e13a..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_private_perwindowpb.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test makes sure that the style editor does not store any
-// content CSS files in the permanent cache when opened from PB mode.
-
-let gUI;
-
-function test() {
- waitForExplicitFinish();
- let windowsToClose = [];
- let testURI = 'http://' + TEST_HOST + '/browser/browser/devtools/styleeditor/test/test_private.html';
-
- function checkCache() {
- checkDiskCacheFor(TEST_HOST);
-
- gUI = null;
- finish();
- }
-
- function doTest(aWindow) {
- aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- cache.evictEntries(Ci.nsICache.STORE_ANYWHERE);
- openStyleEditorInWindow(aWindow, function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", onEditorAdded);
- });
- }, true);
-
- aWindow.gBrowser.selectedBrowser.loadURI(testURI);
- }
-
- function onEditorAdded(aEvent, aEditor) {
- if (aEditor.sourceLoaded) {
- checkCache();
- }
- else {
- aEditor.on("source-load", checkCache);
- }
- }
-
- function testOnWindow(options, callback) {
- let win = OpenBrowserWindow(options);
- win.addEventListener("load", function onLoad() {
- win.removeEventListener("load", onLoad, false);
- windowsToClose.push(win);
- executeSoon(function() callback(win));
- }, false);
- };
-
- registerCleanupFunction(function() {
- windowsToClose.forEach(function(win) {
- win.close();
- });
- });
-
- testOnWindow({private: true}, function(win) {
- doTest(win);
- });
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_reload.js b/browser/devtools/styleeditor/test/browser_styleeditor_reload.js
deleted file mode 100644
index 267fbcffe..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_reload.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
-const NEW_URI = TEST_BASE_HTTPS + "media.html";
-
-const LINE_NO = 5;
-const COL_NO = 3;
-
-let gContentWin;
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gContentWin = gBrowser.selectedTab.linkedBrowser.contentWindow.wrappedJSObject;
- gUI = panel.UI;
-
- let count = 0;
- gUI.on("editor-added", function editorAdded(event, editor) {
- if (++count == 2) {
- gUI.off("editor-added", editorAdded);
- gUI.editors[0].getSourceEditor().then(runTests);
- }
- })
- });
-
- content.location = TESTCASE_URI;
-}
-
-function runTests()
-{
- let count = 0;
- gUI.once("editor-selected", (event, editor) => {
- editor.getSourceEditor().then(() => {
- info("selected second editor, about to reload page");
- reloadPage();
-
- gUI.on("editor-added", function editorAdded(event, editor) {
- if (++count == 2) {
- gUI.off("editor-added", editorAdded);
- gUI.editors[1].getSourceEditor().then(testRemembered);
- }
- })
- });
- });
- gUI.selectStyleSheet(gUI.editors[1].styleSheet.href, LINE_NO, COL_NO);
-}
-
-function testRemembered()
-{
- is(gUI.selectedEditor, gUI.editors[1], "second editor is selected");
-
- let {line, col} = gUI.selectedEditor.sourceEditor.getCaretPosition();
- is(line, LINE_NO, "correct line selected");
- is(col, COL_NO, "correct column selected");
-
- testNewPage();
-}
-
-function testNewPage()
-{
- let count = 0;
- gUI.on("editor-added", function editorAdded(event, editor) {
- info("editor added here")
- if (++count == 2) {
- gUI.off("editor-added", editorAdded);
- gUI.editors[0].getSourceEditor().then(testNotRemembered);
- }
- })
-
- info("navigating to a different page");
- navigatePage();
-}
-
-function testNotRemembered()
-{
- is(gUI.selectedEditor, gUI.editors[0], "first editor is selected");
-
- let {line, col} = gUI.selectedEditor.sourceEditor.getCaretPosition();
- is(line, 0, "first line is selected");
- is(col, 0, "first column is selected");
-
- gUI = null;
- finish();
-}
-
-function reloadPage()
-{
- gContentWin.location.reload();
-}
-
-function navigatePage()
-{
- gContentWin.location = NEW_URI;
-} \ No newline at end of file
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_sv_keynav.js b/browser/devtools/styleeditor/test/browser_styleeditor_sv_keynav.js
deleted file mode 100644
index 853417812..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_sv_keynav.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "four.html";
-
-let gUI;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- gUI = panel.UI;
- gUI.on("editor-added", function(event, editor) {
- if (editor == gUI.editors[3]) {
- runTests();
- }
- });
- });
-
- content.location = TESTCASE_URI;
-}
-
-function runTests()
-{
- gUI.editors[0].getSourceEditor().then(onEditor0Attach);
- gUI.editors[2].getSourceEditor().then(onEditor2Attach);
-}
-
-function getStylesheetNameLinkFor(aEditor)
-{
- return aEditor.summary.querySelector(".stylesheet-name");
-}
-
-function onEditor0Attach(aEditor)
-{
- waitForFocus(function () {
- let summary = aEditor.summary;
- EventUtils.synthesizeMouseAtCenter(summary, {}, gPanelWindow);
-
- let item = getStylesheetNameLinkFor(gUI.editors[0]);
- is(gPanelWindow.document.activeElement, item,
- "editor 0 item is the active element");
-
- EventUtils.synthesizeKey("VK_DOWN", {}, gPanelWindow);
- item = getStylesheetNameLinkFor(gUI.editors[1]);
- is(gPanelWindow.document.activeElement, item,
- "editor 1 item is the active element");
-
- EventUtils.synthesizeKey("VK_HOME", {}, gPanelWindow);
- item = getStylesheetNameLinkFor(gUI.editors[0]);
- is(gPanelWindow.document.activeElement, item,
- "fist editor item is the active element");
-
- EventUtils.synthesizeKey("VK_END", {}, gPanelWindow);
- item = getStylesheetNameLinkFor(gUI.editors[3]);
- is(gPanelWindow.document.activeElement, item,
- "last editor item is the active element");
-
- EventUtils.synthesizeKey("VK_UP", {}, gPanelWindow);
- item = getStylesheetNameLinkFor(gUI.editors[2]);
- is(gPanelWindow.document.activeElement, item,
- "editor 2 item is the active element");
-
- EventUtils.synthesizeKey("VK_RETURN", {}, gPanelWindow);
- // this will attach and give focus editor 2
- }, gPanelWindow);
-}
-
-function onEditor2Attach(aEditor)
-{
- ok(aEditor.sourceEditor.hasFocus(),
- "editor 2 has focus");
-
- gUI = null;
- finish();
-}
diff --git a/browser/devtools/styleeditor/test/browser_styleeditor_sv_resize.js b/browser/devtools/styleeditor/test/browser_styleeditor_sv_resize.js
deleted file mode 100644
index 6b143f180..000000000
--- a/browser/devtools/styleeditor/test/browser_styleeditor_sv_resize.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TESTCASE_URI = TEST_BASE + "simple.html";
-
-let gOriginalWidth; // these are set by runTests()
-let gOriginalHeight;
-
-function test()
-{
- waitForExplicitFinish();
-
- addTabAndOpenStyleEditor(function(panel) {
- let UI = panel.UI;
- UI.on("editor-added", function(event, editor) {
- if (editor == UI.editors[1]) {
- // wait until both editors are added
- runTests(UI);
- }
- });
- });
-
- content.location = TESTCASE_URI;
-}
-
-function runTests(aUI)
-{
- is(aUI.editors.length, 2,
- "there is 2 stylesheets initially");
-
- aUI.editors[0].getSourceEditor().then(function onEditorAttached(aEditor) {
- executeSoon(function () {
- waitForFocus(function () {
- // queue a resize to inverse aspect ratio
- // this will trigger a detach and reattach (to workaround bug 254144)
- let originalSourceEditor = aEditor.sourceEditor;
- aEditor.sourceEditor.setCaretOffset(4); // to check the caret is preserved
-
- gOriginalWidth = gPanelWindow.outerWidth;
- gOriginalHeight = gPanelWindow.outerHeight;
- gPanelWindow.resizeTo(120, 480);
-
- executeSoon(function () {
- is(aEditor.sourceEditor, originalSourceEditor,
- "the editor still references the same SourceEditor instance");
- is(aEditor.sourceEditor.getCaretOffset(), 4,
- "the caret position has been preserved");
-
- // queue a resize to original aspect ratio
- waitForFocus(function () {
- gPanelWindow.resizeTo(gOriginalWidth, gOriginalHeight);
- executeSoon(function () {
- finish();
- });
- }, gPanelWindow);
- });
- }, gPanelWindow);
- });
- });
-}
diff --git a/browser/devtools/styleeditor/test/four.html b/browser/devtools/styleeditor/test/four.html
deleted file mode 100644
index c0d51d691..000000000
--- a/browser/devtools/styleeditor/test/four.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>four stylesheets</title>
- <link rel="stylesheet" type="text/css" media="scren" href="simple.css"/>
- <style type="text/css">
- div {
- font-size: 2em;
- }
- </style>
- <style type="text/css">
- span {
- font-size: 3em;
- }
- </style>
- <style type="text/css">
- p {
- font-size: 4em;
- }
- </style>
-</head>
-<body>
- <div>four <span>stylesheets</span></div>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/head.js b/browser/devtools/styleeditor/test/head.js
deleted file mode 100644
index 561493189..000000000
--- a/browser/devtools/styleeditor/test/head.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_BASE = "chrome://mochitests/content/browser/browser/devtools/styleeditor/test/";
-const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/styleeditor/test/";
-const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/styleeditor/test/";
-const TEST_HOST = 'mochi.test:8888';
-
-let tempScope = {};
-Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
-let TargetFactory = tempScope.devtools.TargetFactory;
-Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
-let console = tempScope.console;
-
-let gPanelWindow;
-let cache = Cc["@mozilla.org/network/cache-service;1"]
- .getService(Ci.nsICacheService);
-
-
-// Import the GCLI test helper
-let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
-Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
-
-function cleanup()
-{
- gPanelWindow = null;
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
-}
-
-function addTabAndOpenStyleEditor(callback) {
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openStyleEditorInWindow(window, callback);
- }, true);
-}
-
-function openStyleEditorInWindow(win, callback) {
- let target = TargetFactory.forTab(win.gBrowser.selectedTab);
- win.gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
- let panel = toolbox.getCurrentPanel();
- gPanelWindow = panel._panelWin;
-
- panel.UI._alwaysDisableAnimations = true;
-
- /*
- if (aSheet) {
- panel.selectStyleSheet(aSheet, aLine, aCol);
- } */
-
- callback(panel);
- });
-}
-
-/*
-function launchStyleEditorChrome(aCallback, aSheet, aLine, aCol)
-{
- launchStyleEditorChromeFromWindow(window, aCallback, aSheet, aLine, aCol);
-}
-
-function launchStyleEditorChromeFromWindow(aWindow, aCallback, aSheet, aLine, aCol)
-{
- let target = TargetFactory.forTab(aWindow.gBrowser.selectedTab);
- gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
- let panel = toolbox.getCurrentPanel();
- gPanelWindow = panel._panelWin;
- gPanelWindow.styleEditorChrome._alwaysDisableAnimations = true;
- if (aSheet) {
- panel.selectStyleSheet(aSheet, aLine, aCol);
- }
- aCallback(gPanelWindow.styleEditorChrome);
- });
-}
-
-function addTabAndLaunchStyleEditorChromeWhenLoaded(aCallback, aSheet, aLine, aCol)
-{
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- launchStyleEditorChrome(aCallback, aSheet, aLine, aCol);
- }, true);
-}
-*/
-
-function checkDiskCacheFor(host)
-{
- let foundPrivateData = false;
-
- let visitor = {
- visitDevice: function(deviceID, deviceInfo) {
- if (deviceID == "disk")
- info("disk device contains " + deviceInfo.entryCount + " entries");
- return deviceID == "disk";
- },
-
- visitEntry: function(deviceID, entryInfo) {
- info(entryInfo.key);
- foundPrivateData |= entryInfo.key.contains(host);
- is(foundPrivateData, false, "web content present in disk cache");
- }
- };
- cache.visitEntries(visitor);
- is(foundPrivateData, false, "private data present in disk cache");
-}
-
-registerCleanupFunction(cleanup);
diff --git a/browser/devtools/styleeditor/test/import.css b/browser/devtools/styleeditor/test/import.css
deleted file mode 100644
index df532fb96..000000000
--- a/browser/devtools/styleeditor/test/import.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-@import url(import2.css);
-
-body {
- margin: 0;
-}
-
diff --git a/browser/devtools/styleeditor/test/import.html b/browser/devtools/styleeditor/test/import.html
deleted file mode 100644
index bc92baeba..000000000
--- a/browser/devtools/styleeditor/test/import.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>import testcase</title>
- <link rel="stylesheet" charset="UTF-8" type="text/css" media="screen" href="simple.css"/>
- <link rel="stylesheet" charset="UTF-8" type="text/css" media="screen" href="import.css"/>
-</head>
-<body>
- <div>import <span>testcase</span></div>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/import2.css b/browser/devtools/styleeditor/test/import2.css
deleted file mode 100644
index fbbe14d9a..000000000
--- a/browser/devtools/styleeditor/test/import2.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-@import url(import.css);
-
-p {
- padding: 5px;
-}
-
diff --git a/browser/devtools/styleeditor/test/longload.html b/browser/devtools/styleeditor/test/longload.html
deleted file mode 100644
index 8e58daeb7..000000000
--- a/browser/devtools/styleeditor/test/longload.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Long load</title>
- <link rel="stylesheet" charset="UTF-8" type="text/css" media="screen" href="simple.css"/>
- <style type="text/css">
- body {
- background: white;
- }
-
- div {
- font-size: 4em;
- }
-
- div > span {
- text-decoration: underline;
- }
- </style>
-</head>
-<body>
- Time passes:
- <script>
- for (i = 0; i < 5000; i++) {
- document.write("<br>...");
- }
- </script>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/media-small.css b/browser/devtools/styleeditor/test/media-small.css
deleted file mode 100644
index d64756ddc..000000000
--- a/browser/devtools/styleeditor/test/media-small.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* this stylesheet applies when min-width<400px */
-body {
- background: red;
-}
-
diff --git a/browser/devtools/styleeditor/test/media.html b/browser/devtools/styleeditor/test/media.html
deleted file mode 100644
index ef05818c5..000000000
--- a/browser/devtools/styleeditor/test/media.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <link rel="stylesheet" type="text/css" href="simple.css" media="screen,print"/>
- <link rel="stylesheet" type="text/css" href="media-small.css" media="screen and (min-width: 200px)"/>
-</head>
-<body>
- <div>test for media labels</div>
-</body>
-</html>
-
diff --git a/browser/devtools/styleeditor/test/minified.html b/browser/devtools/styleeditor/test/minified.html
deleted file mode 100644
index a7d3eec32..000000000
--- a/browser/devtools/styleeditor/test/minified.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>minified testcase</title>
- <style type="text/css"><!--
-body{background:white;}div{font-size:4em;color:red}
---></style>
- <style type="text/css">body { background: red; }
-div {
-font-size: 5em;
-color: red
-}</style>
-</head>
-<body>
- <div>minified <span>testcase</span></div>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/moz.build b/browser/devtools/styleeditor/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/styleeditor/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/styleeditor/test/nostyle.html b/browser/devtools/styleeditor/test/nostyle.html
deleted file mode 100644
index f6a6769e6..000000000
--- a/browser/devtools/styleeditor/test/nostyle.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <div>
- Page with no stylesheets
- </div>
-</html> \ No newline at end of file
diff --git a/browser/devtools/styleeditor/test/resources_inpage.jsi b/browser/devtools/styleeditor/test/resources_inpage.jsi
deleted file mode 100644
index 8b7895af5..000000000
--- a/browser/devtools/styleeditor/test/resources_inpage.jsi
+++ /dev/null
@@ -1,12 +0,0 @@
-
-// This script is used from within browser_styleeditor_cmd_edit.html
-
-window.addEventListener('load', function() {
- var pid = document.getElementById('pid');
- var h3 = document.createElement('h3');
- h3.id = 'h3id';
- h3.classList.add('h3class');
- h3.appendChild(document.createTextNode('h3'));
- h3.setAttribute('data-a1', 'h3');
- pid.parentNode.appendChild(h3);
-});
diff --git a/browser/devtools/styleeditor/test/resources_inpage1.css b/browser/devtools/styleeditor/test/resources_inpage1.css
deleted file mode 100644
index 644deaaea..000000000
--- a/browser/devtools/styleeditor/test/resources_inpage1.css
+++ /dev/null
@@ -1,11 +0,0 @@
-@charset "utf-8";
-
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-#pid { border-top: 2px dotted #F00; }
-#divid { border-top: 2px dotted #00F; }
-#h4id { border-top: 2px dotted #0F0; }
-#h3id { border-top: 2px dotted #FF0; }
diff --git a/browser/devtools/styleeditor/test/resources_inpage2.css b/browser/devtools/styleeditor/test/resources_inpage2.css
deleted file mode 100644
index e4fa48e53..000000000
--- a/browser/devtools/styleeditor/test/resources_inpage2.css
+++ /dev/null
@@ -1,11 +0,0 @@
-@charset "utf-8";
-
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-*[data-a1=p] { border-left: 4px solid #F00; }
-*[data-a1=div] { border-left: 4px solid #00F; }
-*[data-a1=h4] { border-left: 4px solid #0F0; }
-*[data-a1=h3] { border-left: 4px solid #FF0; }
diff --git a/browser/devtools/styleeditor/test/simple.css b/browser/devtools/styleeditor/test/simple.css
deleted file mode 100644
index 829fe9e6c..000000000
--- a/browser/devtools/styleeditor/test/simple.css
+++ /dev/null
@@ -1,9 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-/* ☺ */
-
-body {
- margin: 0;
-}
-
diff --git a/browser/devtools/styleeditor/test/simple.css.gz b/browser/devtools/styleeditor/test/simple.css.gz
deleted file mode 100644
index ee3b9efbc..000000000
--- a/browser/devtools/styleeditor/test/simple.css.gz
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/styleeditor/test/simple.css.gz^headers^ b/browser/devtools/styleeditor/test/simple.css.gz^headers^
deleted file mode 100644
index 092020ab0..000000000
--- a/browser/devtools/styleeditor/test/simple.css.gz^headers^
+++ /dev/null
@@ -1,4 +0,0 @@
-Vary: Accept-Encoding
-Content-Encoding: gzip
-Content-Type: text/css
-
diff --git a/browser/devtools/styleeditor/test/simple.gz.html b/browser/devtools/styleeditor/test/simple.gz.html
deleted file mode 100644
index d63362b8e..000000000
--- a/browser/devtools/styleeditor/test/simple.gz.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>simple testcase</title>
- <link rel="stylesheet" type="text/css" media="scren" href="simple.css.gz"/>
- <style type="text/css">
- body {
- background: white;
- }
-
- div {
- font-size: 4em;
- }
-
- div > span {
- text-decoration: underline;
- }
- </style>
-</head>
-<body>
- <div>simple <span>testcase</span></div>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/simple.html b/browser/devtools/styleeditor/test/simple.html
deleted file mode 100644
index 2e7ce3eac..000000000
--- a/browser/devtools/styleeditor/test/simple.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>simple testcase</title>
- <link rel="stylesheet" charset="UTF-8" type="text/css" media="screen" href="simple.css"/>
- <style type="text/css">
- body {
- background: white;
- }
-
- div {
- font-size: 4em;
- }
-
- div > span {
- text-decoration: underline;
- }
- </style>
-</head>
-<body>
- <div>simple <span>testcase</span></div>
-</body>
-</html>
diff --git a/browser/devtools/styleeditor/test/test_private.css b/browser/devtools/styleeditor/test/test_private.css
deleted file mode 100644
index 438954d36..000000000
--- a/browser/devtools/styleeditor/test/test_private.css
+++ /dev/null
@@ -1,3 +0,0 @@
-body {
- background-color: red;
-} \ No newline at end of file
diff --git a/browser/devtools/styleeditor/test/test_private.html b/browser/devtools/styleeditor/test/test_private.html
deleted file mode 100644
index bfde3520e..000000000
--- a/browser/devtools/styleeditor/test/test_private.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<head>
-<link rel="stylesheet" href="test_private.css"></link>
-</head>
-<body>
-</body>
-</html>
diff --git a/browser/devtools/styleinspector/moz.build b/browser/devtools/styleinspector/moz.build
index 86ec46748..8deb0b138 100644
--- a/browser/devtools/styleinspector/moz.build
+++ b/browser/devtools/styleinspector/moz.build
@@ -4,4 +4,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/styleinspector/test/Makefile.in b/browser/devtools/styleinspector/test/Makefile.in
deleted file mode 100644
index 7d68cf613..000000000
--- a/browser/devtools/styleinspector/test/Makefile.in
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_styleinspector.js \
- browser_bug683672.js \
- browser_styleinspector_bug_672746_default_styles.js \
- browser_styleinspector_bug_672744_search_filter.js \
- $(filter awaiting-promise-based-init, browser_bug589375_keybindings.js) \
- browser_styleinspector_bug_689759_no_results_placeholder.js \
- browser_bug_692400_element_style.js \
- browser_csslogic_inherited.js \
- browser_ruleview_734259_style_editor_link.js \
- browser_ruleview_editor.js \
- browser_ruleview_editor_changedvalues.js \
- browser_ruleview_copy.js \
- browser_ruleview_focus.js \
- browser_ruleview_inherit.js \
- browser_ruleview_manipulation.js \
- browser_ruleview_override.js \
- browser_ruleview_ui.js \
- browser_ruleview_update.js \
- browser_bug705707_is_content_stylesheet.js \
- browser_bug722196_property_view_media_queries.js \
- browser_bug722196_rule_view_media_queries.js \
- browser_bug_592743_specificity.js \
- browser_bug722691_rule_view_increment.js \
- browser_computedview_734259_style_editor_link.js \
- browser_computedview_copy.js\
- browser_styleinspector_bug_677930_urls_clickable.js \
- head.js \
- $(NULL)
-
-MOCHITEST_BROWSER_FILES += \
- browser_bug683672.html \
- browser_bug705707_is_content_stylesheet.html \
- browser_bug705707_is_content_stylesheet_imported.css \
- browser_bug705707_is_content_stylesheet_imported2.css \
- browser_bug705707_is_content_stylesheet_linked.css \
- browser_bug705707_is_content_stylesheet_script.css \
- browser_bug705707_is_content_stylesheet.xul \
- browser_bug705707_is_content_stylesheet_xul.css \
- browser_bug722196_identify_media_queries.html \
- browser_styleinspector_bug_677930_urls_clickable.html \
- browser_styleinspector_bug_677930_urls_clickable \
- browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css \
- test-image.png \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/styleinspector/test/browser_bug589375_keybindings.js b/browser/devtools/styleinspector/test/browser_bug589375_keybindings.js
deleted file mode 100644
index 37e5a042e..000000000
--- a/browser/devtools/styleinspector/test/browser_bug589375_keybindings.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the key bindings work properly.
-
-let doc;
-let inspector;
-let computedView;
-let iframe;
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- '.matches {color: #F00;}</style>' +
- '<span class="matches">Some styled text</span>' +
- '</div>';
- doc.title = "Style Inspector key binding test";
-
- openInspector(openComputedView);
-}
-
-function openComputedView(aInspector)
-{
- inspector = aInspector;
- iframe = inspector._toolbox.frame;
-
- Services.obs.addObserver(runTests, "StyleInspector-populated", false);
-
- inspector.sidebar.select("computedview");
-}
-
-function runTests()
-{
- Services.obs.removeObserver(runTests, "StyleInspector-populated");
- computedView = getComputedView(inspector);
-
- var span = doc.querySelector(".matches");
- ok(span, "captain, we have the matches span");
-
- inspector.selection.setNode(span);
-
- is(span, computedView.viewedElement,
- "style inspector node matches the selected node");
- is(computedView.viewedElement, computedView.cssLogic.viewedElement,
- "cssLogic node matches the cssHtmlTree node");
-
- info("checking keybindings");
-
- let searchbar = computedView.searchField;
- let propView = getFirstVisiblePropertyView();
- let rulesTable = propView.matchedSelectorsContainer;
- let matchedExpander = propView.matchedExpander;
-
- info("Adding focus event handler to search filter");
- searchbar.addEventListener("focus", function searchbarFocused() {
- searchbar.removeEventListener("focus", searchbarFocused);
- info("search filter is focused");
- info("tabbing to property expander node");
- EventUtils.synthesizeKey("VK_TAB", {}, iframe.contentWindow);
- });
-
- info("Adding focus event handler to property expander");
- matchedExpander.addEventListener("focus", function expanderFocused() {
- matchedExpander.removeEventListener("focus", expanderFocused);
- info("property expander is focused");
- info("checking expand / collapse");
- testKey(iframe.contentWindow, "VK_SPACE", rulesTable);
- testKey(iframe.contentWindow, "VK_RETURN", rulesTable);
-
- checkHelpLinkKeybinding();
- computedView.destroy();
- finishUp();
- });
-
- info("Making sure that the style inspector panel is focused");
- SimpleTest.waitForFocus(function windowFocused() {
- info("window is focused");
- info("focusing search filter");
- searchbar.focus();
- }, iframe.contentWindow);
-}
-
-function getFirstVisiblePropertyView()
-{
- let propView = null;
- computedView.propertyViews.some(function(aPropView) {
- if (aPropView.visible) {
- propView = aPropView;
- return true;
- }
- return false;
- });
-
- return propView;
-}
-
-function testKey(aContext, aVirtKey, aRulesTable)
-{
- info("testing " + aVirtKey + " key");
- info("expanding rules table");
- EventUtils.synthesizeKey(aVirtKey, {}, aContext);
- isnot(aRulesTable.innerHTML, "", "rules Table is populated");
- info("collapsing rules table");
- EventUtils.synthesizeKey(aVirtKey, {}, aContext);
- is(aRulesTable.innerHTML, "", "rules Table is not populated");
-}
-
-function checkHelpLinkKeybinding()
-{
- info("checking help link keybinding");
- let propView = getFirstVisiblePropertyView();
-
- info("check that MDN link is opened on \"F1\"");
- let linkClicked = false;
- propView.mdnLinkClick = function(aEvent) {
- linkClicked = true;
- };
- EventUtils.synthesizeKey("VK_F1", {}, iframe.contentWindow);
- is(linkClicked, true, "MDN link will be shown");
-}
-
-function finishUp()
-{
- doc = inspector = iframe = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,default styles test";
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug683672.html b/browser/devtools/styleinspector/test/browser_bug683672.html
deleted file mode 100644
index 8fe007409..000000000
--- a/browser/devtools/styleinspector/test/browser_bug683672.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
- <head>
- <style>
- .matched1, .matched2, .matched3, .matched4, .matched5 {
- color: #000;
- }
-
- div {
- position: absolute;
- top: 40px;
- left: 20px;
- border: 1px solid #000;
- color: #111;
- width: 100px;
- height: 50px;
- }
- </style>
- </head>
- <body>
- inspectstyle($("test"));
- <div id="test" class="matched1 matched2 matched3 matched4 matched5">Test div</div>
- <div id="dummy">
- <div></div>
- </div>
- </body>
-</html>
diff --git a/browser/devtools/styleinspector/test/browser_bug683672.js b/browser/devtools/styleinspector/test/browser_bug683672.js
deleted file mode 100644
index 0189e848f..000000000
--- a/browser/devtools/styleinspector/test/browser_bug683672.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the style inspector works properly
-
-let doc;
-let inspector;
-let div;
-let computedView;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/test/browser_bug683672.html";
-
-let tempScope = {};
-let {CssHtmlTree, PropertyView} = devtools.require("devtools/styleinspector/computed-view");
-
-function test()
-{
- waitForExplicitFinish();
- addTab(TEST_URI);
- browser.addEventListener("load", tabLoaded, true);
-}
-
-function tabLoaded()
-{
- browser.removeEventListener("load", tabLoaded, true);
- doc = content.document;
- openInspector(selectNode);
-}
-
-function selectNode(aInspector)
-{
- inspector = aInspector;
-
- div = content.document.getElementById("test");
- ok(div, "captain, we have the div");
-
- inspector.selection.setNode(div);
-
- inspector.sidebar.once("computedview-ready", function() {
- computedView = getComputedView(inspector);
-
- inspector.sidebar.select("computedview");
- runTests();
- });
-}
-
-function runTests()
-{
- testMatchedSelectors();
-
- info("finishing up");
- finishUp();
-}
-
-function testMatchedSelectors()
-{
- info("checking selector counts, matched rules and titles");
-
- is(div, computedView.viewedElement,
- "style inspector node matches the selected node");
-
- let propertyView = new PropertyView(computedView, "color");
- let numMatchedSelectors = propertyView.propertyInfo.matchedSelectors.length;
-
- is(numMatchedSelectors, 6,
- "CssLogic returns the correct number of matched selectors for div");
-
- is(propertyView.hasMatchedSelectors, true,
- "hasMatchedSelectors returns true");
-}
-
-function finishUp()
-{
- doc = inspector = div = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.html b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.html
deleted file mode 100644
index 96ef5b6e9..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-<head>
- <title>test</title>
-
- <link href="./browser_bug705707_is_content_stylesheet_linked.css" rel="stylesheet" type="text/css">
-
- <script>
- // Load script.css
- function loadCSS() {
- var link = document.createElement('link');
- link.rel = 'stylesheet';
- link.type = 'text/css';
- link.href = "./browser_bug705707_is_content_stylesheet_script.css";
- document.getElementsByTagName('head')[0].appendChild(link);
- }
- </script>
-
- <style>
- table {
- border: 1px solid #000;
- }
- </style>
-</head>
-<body onload="loadCSS();">
- <table id="target">
- <tr>
- <td>
- <h3>Simple test</h3>
- </td>
- </tr>
- </table>
-</body>
-</html>
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js
deleted file mode 100644
index 13de2a1ff..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the correct stylesheets origins are identified in HTML & XUL
-// stylesheets
-
-let doc;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/" +
- "test/browser_bug705707_is_content_stylesheet.html";
-const TEST_URI2 = "http://example.com/browser/browser/devtools/styleinspector/" +
- "test/browser_bug705707_is_content_stylesheet.xul";
-const XUL_URI = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService)
- .newURI(TEST_URI2, null, null);
-const XUL_PRINCIPAL = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Ci.nsIScriptSecurityManager)
- .getNoAppCodebasePrincipal(XUL_URI);
-
-
-let {CssLogic} = devtools.require("devtools/styleinspector/css-logic");
-
-function test()
-{
- waitForExplicitFinish();
- addTab(TEST_URI);
- browser.addEventListener("load", htmlLoaded, true);
-}
-
-function htmlLoaded()
-{
- browser.removeEventListener("load", htmlLoaded, true);
- doc = content.document;
- testFromHTML()
-}
-
-function testFromHTML()
-{
- let target = doc.querySelector("#target");
-
- executeSoon(function() {
- checkSheets(target);
- gBrowser.removeCurrentTab();
- openXUL();
- });
-}
-
-function openXUL()
-{
- Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
- .addFromPrincipal(XUL_PRINCIPAL, 'allowXULXBL', Ci.nsIPermissionManager.ALLOW_ACTION);
- addTab(TEST_URI2);
- browser.addEventListener("load", xulLoaded, true);
-}
-
-function xulLoaded()
-{
- browser.removeEventListener("load", xulLoaded, true);
- doc = content.document;
- testFromXUL()
-}
-
-function testFromXUL()
-{
- let target = doc.querySelector("#target");
-
- executeSoon(function() {
- checkSheets(target);
- finishUp();
- });
-}
-
-function checkSheets(aTarget)
-{
- let domUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
- .getService(Ci.inIDOMUtils);
- let domRules = domUtils.getCSSStyleRules(aTarget);
-
- for (let i = 0, n = domRules.Count(); i < n; i++) {
- let domRule = domRules.GetElementAt(i);
- let sheet = domRule.parentStyleSheet;
- let isContentSheet = CssLogic.isContentStylesheet(sheet);
-
- if (!sheet.href ||
- /browser_bug705707_is_content_stylesheet_/.test(sheet.href)) {
- ok(isContentSheet, sheet.href + " identified as content stylesheet");
- } else {
- ok(!isContentSheet, sheet.href + " identified as non-content stylesheet");
- }
- }
-}
-
-function finishUp()
-{
- info("finishing up");
- Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
- .addFromPrincipal(XUL_PRINCIPAL, 'allowXULXBL', Ci.nsIPermissionManager.DENY_ACTION);
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.xul b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.xul
deleted file mode 100644
index abbd03030..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.xul
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
-<?xml-stylesheet href="./browser_bug705707_is_content_stylesheet_xul.css"
- type="text/css"?>
-<!DOCTYPE window>
-<window id="testwindow" xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <label id="target" value="Simple XUL document" />
-</window> \ No newline at end of file
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported.css b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported.css
deleted file mode 100644
index 4092afeea..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported.css
+++ /dev/null
@@ -1,5 +0,0 @@
-@import url("./browser_bug705707_is_content_stylesheet_imported2.css");
-
-#target {
- text-decoration: underline;
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported2.css b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported2.css
deleted file mode 100644
index 77c73299e..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported2.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#target {
- text-decoration: underline;
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_linked.css b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_linked.css
deleted file mode 100644
index 712ba78fb..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_linked.css
+++ /dev/null
@@ -1,3 +0,0 @@
-table {
- border-collapse: collapse;
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_script.css b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_script.css
deleted file mode 100644
index bf4fc8ddc..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_script.css
+++ /dev/null
@@ -1,5 +0,0 @@
-@import url("./browser_bug705707_is_content_stylesheet_imported.css");
-
-table {
- opacity: 1;
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_xul.css b/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_xul.css
deleted file mode 100644
index a14ae7f6f..000000000
--- a/browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_xul.css
+++ /dev/null
@@ -1,3 +0,0 @@
-#target {
- font-size: 200px;
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug722196_identify_media_queries.html b/browser/devtools/styleinspector/test/browser_bug722196_identify_media_queries.html
deleted file mode 100644
index 1adb8bc7a..000000000
--- a/browser/devtools/styleinspector/test/browser_bug722196_identify_media_queries.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<head>
- <title>test</title>
- <script type="application/javascript;version=1.7">
-
- </script>
- <style>
- div {
- width: 1000px;
- height: 100px;
- background-color: #f00;
- }
-
- @media screen and (min-width: 1px) {
- div {
- width: 200px;
- }
- }
- </style>
-</head>
-<body>
-<div></div>
-</body>
-</html>
diff --git a/browser/devtools/styleinspector/test/browser_bug722196_property_view_media_queries.js b/browser/devtools/styleinspector/test/browser_bug722196_property_view_media_queries.js
deleted file mode 100644
index 9fe1b464a..000000000
--- a/browser/devtools/styleinspector/test/browser_bug722196_property_view_media_queries.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that we correctly display appropriate media query titles in the
-// property view.
-
-let doc;
-let computedView;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/" +
- "test/browser_bug722196_identify_media_queries.html";
-
-function test()
-{
- waitForExplicitFinish();
- addTab(TEST_URI);
- browser.addEventListener("load", docLoaded, true);
-}
-
-function docLoaded()
-{
- browser.removeEventListener("load", docLoaded, true);
- doc = content.document;
-
- openInspector(selectNode);
-}
-
-function selectNode(aInspector)
-{
- var div = doc.querySelector("div");
- ok(div, "captain, we have the div");
-
- aInspector.selection.setNode(div);
-
- aInspector.sidebar.once("computedview-ready", function() {
- aInspector.sidebar.select("computedview");
- computedView = getComputedView(aInspector);
- checkSheets();
- });
-}
-
-function checkSheets()
-{
- let cssLogic = computedView.cssLogic;
- cssLogic.processMatchedSelectors();
-
- let _strings = Services.strings
- .createBundle("chrome://browser/locale/devtools/styleinspector.properties");
-
- let inline = _strings.GetStringFromName("rule.sourceInline");
-
- let source1 = inline + ":8";
- let source2 = inline + ":15 @media screen and (min-width: 1px)";
- is(cssLogic._matchedRules[0][0].source, source1,
- "rule.source gives correct output for rule 1");
- is(cssLogic._matchedRules[1][0].source, source2,
- "rule.source gives correct output for rule 2");
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug722196_rule_view_media_queries.js b/browser/devtools/styleinspector/test/browser_bug722196_rule_view_media_queries.js
deleted file mode 100644
index 93d5b9625..000000000
--- a/browser/devtools/styleinspector/test/browser_bug722196_rule_view_media_queries.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that we correctly display appropriate media query titles in the
-// rule view.
-
-let doc;
-
-const TEST_URI = "http://example.com/browser/browser/devtools/styleinspector/" +
- "test/browser_bug722196_identify_media_queries.html";
-
-function test()
-{
- waitForExplicitFinish();
- addTab(TEST_URI);
- browser.addEventListener("load", docLoaded, true);
-}
-
-function docLoaded()
-{
- browser.removeEventListener("load", docLoaded, true);
- doc = content.document;
- checkSheets();
-}
-
-function checkSheets()
-{
- var div = doc.querySelector("div");
- ok(div, "captain, we have the div");
-
- let elementStyle = new _ElementStyle(div);
- is(elementStyle.rules.length, 3, "Should have 3 rules.");
-
- let _strings = Services.strings
- .createBundle("chrome://browser/locale/devtools/styleinspector.properties");
-
- let inline = _strings.GetStringFromName("rule.sourceInline");
-
- is(elementStyle.rules[0].title, inline, "check rule 0 title");
- is(elementStyle.rules[1].title, inline +
- ":15 @media screen and (min-width: 1px)", "check rule 1 title");
- is(elementStyle.rules[2].title, inline + ":8", "check rule 2 title");
- finishUp();
-}
-
-function finishUp()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug722691_rule_view_increment.js b/browser/devtools/styleinspector/test/browser_bug722691_rule_view_increment.js
deleted file mode 100644
index e74b842a1..000000000
--- a/browser/devtools/styleinspector/test/browser_bug722691_rule_view_increment.js
+++ /dev/null
@@ -1,198 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that increasing/decreasing values in rule view using
-// arrow keys works correctly.
-
-let doc;
-let ruleDialog;
-let ruleView;
-
-function setUpTests()
-{
- doc.body.innerHTML = '<div id="test" style="' +
- 'margin-top:0px;' +
- 'padding-top: 0px;' +
- 'color:#000000;' +
- 'background-color: #000000; >"'+
- '</div>';
- let testElement = doc.getElementById("test");
- ruleDialog = openDialog("chrome://browser/content/devtools/cssruleview.xhtml",
- "cssruleviewtest",
- "width=350,height=350");
- ruleDialog.addEventListener("load", function onLoad(evt) {
- ruleDialog.removeEventListener("load", onLoad, true);
- let doc = ruleDialog.document;
- ruleView = new CssRuleView(doc);
- doc.documentElement.appendChild(ruleView.element);
- ruleView.highlight(testElement);
- waitForFocus(runTests, ruleDialog);
- }, true);
-}
-
-function runTests()
-{
- let idRuleEditor = ruleView.element.children[0]._ruleEditor;
- let marginPropEditor = idRuleEditor.rule.textProps[0].editor;
- let paddingPropEditor = idRuleEditor.rule.textProps[1].editor;
- let hexColorPropEditor = idRuleEditor.rule.textProps[2].editor;
- let rgbColorPropEditor = idRuleEditor.rule.textProps[3].editor;
-
- (function() {
- info("INCREMENTS");
- newTest( marginPropEditor, {
- 1: { alt: true, start: "0px", end: "0.1px", selectAll: true },
- 2: { start: "0px", end: "1px", selectAll: true },
- 3: { shift: true, start: "0px", end: "10px", selectAll: true },
- 4: { down: true, alt: true, start: "0.1px", end: "0px", selectAll: true },
- 5: { down: true, start: "0px", end: "-1px", selectAll: true },
- 6: { down: true, shift: true, start: "0px", end: "-10px", selectAll: true },
- 7: { pageUp: true, shift: true, start: "0px", end: "100px", selectAll: true },
- 8: { pageDown: true, shift: true, start: "0px", end: "-100px", selectAll: true,
- nextTest: test2 }
- });
- EventUtils.synthesizeMouse(marginPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- })();
-
- function test2() {
- info("UNITS");
- newTest( paddingPropEditor, {
- 1: { start: "0px", end: "1px", selectAll: true },
- 2: { start: "0pt", end: "1pt", selectAll: true },
- 3: { start: "0pc", end: "1pc", selectAll: true },
- 4: { start: "0em", end: "1em", selectAll: true },
- 5: { start: "0%", end: "1%", selectAll: true },
- 6: { start: "0in", end: "1in", selectAll: true },
- 7: { start: "0cm", end: "1cm", selectAll: true },
- 8: { start: "0mm", end: "1mm", selectAll: true },
- 9: { start: "0ex", end: "1ex", selectAll: true,
- nextTest: test3 }
- });
- EventUtils.synthesizeMouse(paddingPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- };
-
- function test3() {
- info("HEX COLORS");
- newTest( hexColorPropEditor, {
- 1: { start: "#CCCCCC", end: "#CDCDCD", selectAll: true},
- 2: { shift: true, start: "#CCCCCC", end: "#DCDCDC", selectAll: true },
- 3: { start: "#CCCCCC", end: "#CDCCCC", selection: [1,3] },
- 4: { shift: true, start: "#CCCCCC", end: "#DCCCCC", selection: [1,3] },
- 5: { start: "#FFFFFF", end: "#FFFFFF", selectAll: true },
- 6: { down: true, shift: true, start: "#000000", end: "#000000", selectAll: true,
- nextTest: test4 }
- });
- EventUtils.synthesizeMouse(hexColorPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- };
-
- function test4() {
- info("RGB COLORS");
- newTest( rgbColorPropEditor, {
- 1: { start: "rgb(0,0,0)", end: "rgb(0,1,0)", selection: [6,7] },
- 2: { shift: true, start: "rgb(0,0,0)", end: "rgb(0,10,0)", selection: [6,7] },
- 3: { start: "rgb(0,255,0)", end: "rgb(0,255,0)", selection: [6,9] },
- 4: { shift: true, start: "rgb(0,250,0)", end: "rgb(0,255,0)", selection: [6,9] },
- 5: { down: true, start: "rgb(0,0,0)", end: "rgb(0,0,0)", selection: [6,7] },
- 6: { down: true, shift: true, start: "rgb(0,5,0)", end: "rgb(0,0,0)", selection: [6,7],
- nextTest: test5 }
- });
- EventUtils.synthesizeMouse(rgbColorPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- };
-
- function test5() {
- info("SHORTHAND");
- newTest( paddingPropEditor, {
- 1: { start: "0px 0px 0px 0px", end: "0px 1px 0px 0px", selection: [4,7] },
- 2: { shift: true, start: "0px 0px 0px 0px", end: "0px 10px 0px 0px", selection: [4,7] },
- 3: { start: "0px 0px 0px 0px", end: "1px 0px 0px 0px", selectAll: true },
- 4: { shift: true, start: "0px 0px 0px 0px", end: "10px 0px 0px 0px", selectAll: true },
- 5: { down: true, start: "0px 0px 0px 0px", end: "0px 0px -1px 0px", selection: [8,11] },
- 6: { down: true, shift: true, start: "0px 0px 0px 0px", end: "-10px 0px 0px 0px", selectAll: true,
- nextTest: test6 }
- });
- EventUtils.synthesizeMouse(paddingPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- };
-
- function test6() {
- info("ODD CASES");
- newTest( marginPropEditor, {
- 1: { start: "98.7%", end: "99.7%", selection: [3,3] },
- 2: { alt: true, start: "98.7%", end: "98.8%", selection: [3,3] },
- 3: { start: "0", end: "1" },
- 4: { down: true, start: "0", end: "-1" },
- 5: { start: "'a=-1'", end: "'a=0'", selection: [4,4] },
- 6: { start: "0 -1px", end: "0 0px", selection: [2,2] },
- 7: { start: "url(-1)", end: "url(-1)", selection: [4,4] },
- 8: { start: "url('test1.1.png')", end: "url('test1.2.png')", selection: [11,11] },
- 9: { start: "url('test1.png')", end: "url('test2.png')", selection: [9,9] },
- 10: { shift: true, start: "url('test1.1.png')", end: "url('test11.1.png')", selection: [9,9] },
- 11: { down: true, start: "url('test-1.png')", end: "url('test-2.png')", selection: [9,11] },
- 12: { start: "url('test1.1.png')", end: "url('test1.2.png')", selection: [11,12] },
- 13: { down: true, alt: true, start: "url('test-0.png')", end: "url('test--0.1.png')", selection: [10,11] },
- 14: { alt: true, start: "url('test--0.1.png')", end: "url('test-0.png')", selection: [10,14],
- endTest: true }
- });
- EventUtils.synthesizeMouse(marginPropEditor.valueSpan, 1, 1, {}, ruleDialog);
- };
-}
-
-function newTest( propEditor, tests )
-{
- waitForEditorFocus(propEditor.element, function onElementFocus(aEditor) {
- for( test in tests) {
- testIncrement( aEditor, tests[test] );
- }
- }, false);
-}
-
-function testIncrement( aEditor, aOptions )
-{
- aEditor.input.value = aOptions.start;
- let input = aEditor.input;
- if ( aOptions.selectAll ) {
- input.select();
- } else if ( aOptions.selection ) {
- input.setSelectionRange(aOptions.selection[0], aOptions.selection[1]);
- }
- is(input.value, aOptions.start, "Value initialized at " + aOptions.start);
- input.addEventListener("keyup", function onIncrementUp() {
- input.removeEventListener("keyup", onIncrementUp, false);
- input = aEditor.input;
- is(input.value, aOptions.end, "Value changed to " + aOptions.end);
- if( aOptions.nextTest) {
- aOptions.nextTest();
- }
- else if( aOptions.endTest ) {
- finishTest();
- }
- }, false);
- let key;
- key = ( aOptions.down ) ? "VK_DOWN" : "VK_UP";
- key = ( aOptions.pageDown ) ? "VK_PAGE_DOWN" : ( aOptions.pageUp ) ? "VK_PAGE_UP" : key;
- EventUtils.synthesizeKey(key,
- {altKey: aOptions.alt, shiftKey: aOptions.shift},
- ruleDialog);
-}
-
-function finishTest()
-{
- ruleView.clear();
- ruleDialog.close();
- ruleDialog = ruleView = null;
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onload(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onload, true);
- doc = content.document;
- waitForFocus(setUpTests, content);
- }, true);
- content.location = "data:text/html,sample document for bug 722691";
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug_592743_specificity.js b/browser/devtools/styleinspector/test/browser_bug_592743_specificity.js
deleted file mode 100644
index 237d45b1e..000000000
--- a/browser/devtools/styleinspector/test/browser_bug_592743_specificity.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that CSS specificity is properly calculated.
-
-const DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"]
- .getService(Ci.inIDOMUtils);
-
-function createDocument()
-{
- let doc = content.document;
- doc.body.innerHTML = getStylesheetText();
- doc.title = "Computed view specificity test";
- runTests(doc);
-}
-
-function runTests(doc) {
- let cssLogic = new CssLogic();
- cssLogic.highlight(doc.body);
-
- let tests = getTests();
- let cssSheet = cssLogic.sheets[0];
- let cssRule = cssSheet.domSheet.cssRules[0];
- let selectors = CssLogic.getSelectors(cssRule);
-
- for (let i = 0; i < selectors.length; i++) {
- let selectorText = selectors[i];
- let selector = new CssSelector(cssRule, selectorText, i);
- let expected = getExpectedSpecificity(selectorText);
- let specificity = DOMUtils.getSpecificity(selector._cssRule,
- selector.selectorIndex)
- is(specificity, expected,
- 'selector "' + selectorText + '" has a specificity of ' + expected);
- }
- finishUp();
-}
-
-function getExpectedSpecificity(selectorText) {
- let tests = getTests();
-
- for (let test of tests) {
- if (test.text == selectorText) {
- return test.expected;
- }
- }
-}
-
-function getTests() {
- return [
- {text: "*", expected: 0},
- {text: "LI", expected: 1},
- {text: "UL LI", expected: 2},
- {text: "UL OL + LI", expected: 3},
- {text: "H1 + [REL=\"up\"]", expected: 257},
- {text: "UL OL LI.red", expected: 259},
- {text: "LI.red.level", expected: 513},
- {text: ".red .level", expected: 512},
- {text: "#x34y", expected: 65536},
- {text: "#s12:not(FOO)", expected: 65537},
- {text: "body#home div#warning p.message", expected: 131331},
- {text: "* body#home div#warning p.message", expected: 131331},
- {text: "#footer :not(nav) li", expected: 65538},
- {text: "bar:nth-child(n)", expected: 257},
- {text: "li::-moz-list-number", expected: 1},
- {text: "a:hover", expected: 257},
- ];
-}
-
-function getStylesheetText() {
- let tests = getTests();
- let text = "";
-
- tests.forEach(function(test) {
- if (text.length > 0) {
- text += ",";
- }
- text += test.text;
- });
- return '<style type="text/css">' + text + " {color:red;}</style>";
-}
-
-function finishUp()
-{
- CssLogic = CssSelector = tempScope = null;
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,Computed view specificity test";
-}
diff --git a/browser/devtools/styleinspector/test/browser_bug_692400_element_style.js b/browser/devtools/styleinspector/test/browser_bug_692400_element_style.js
deleted file mode 100644
index 484ea28af..000000000
--- a/browser/devtools/styleinspector/test/browser_bug_692400_element_style.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests for selector text errors.
-
-let doc;
-let computedView;
-
-function createDocument()
-{
- doc.body.innerHTML = "<div style='color:blue;'></div>";
-
- doc.title = "Style Inspector Selector Text Test";
-
- openInspector(openComputedView);
-}
-
-
-function openComputedView(aInspector)
-{
- let div = doc.querySelector("div");
- ok(div, "captain, we have the test div");
-
- aInspector.selection.setNode(div);
-
- aInspector.sidebar.once("computedview-ready", function() {
- aInspector.sidebar.select("computedview");
- computedView = getComputedView(aInspector);
-
- Services.obs.addObserver(SI_checkText, "StyleInspector-populated", false);
- });
-}
-
-function SI_checkText()
-{
- Services.obs.removeObserver(SI_checkText, "StyleInspector-populated");
-
- let propertyView = null;
- computedView.propertyViews.some(function(aView) {
- if (aView.name == "color") {
- propertyView = aView;
- return true;
- }
- return false;
- });
-
- ok(propertyView, "found PropertyView for color");
-
- is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors is true");
-
- propertyView.matchedExpanded = true;
- propertyView.refreshMatchedSelectors();
-
- let span = propertyView.matchedSelectorsContainer.querySelector("span.rule-text");
- ok(span, "found the first table row");
-
- let selector = propertyView.matchedSelectorViews[0];
- ok(selector, "found the first matched selector view");
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,selector text test, bug 692400";
-}
diff --git a/browser/devtools/styleinspector/test/browser_computedview_734259_style_editor_link.js b/browser/devtools/styleinspector/test/browser_computedview_734259_style_editor_link.js
deleted file mode 100644
index a3091aa06..000000000
--- a/browser/devtools/styleinspector/test/browser_computedview_734259_style_editor_link.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let inspector;
-let computedView;
-
-const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
- [".highlight {",
- "color: blue",
- "}"].join("\n"));
-
-const DOCUMENT_URL = "data:text/html,"+encodeURIComponent(
- ['<html>' +
- '<head>' +
- '<title>Computed view style editor link test</title>',
- '<style type="text/css"> ',
- 'html { color: #000000; } ',
- 'span { font-variant: small-caps; color: #000000; } ',
- '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ',
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">',
- '</style>',
- '<link rel="stylesheet" type="text/css" href="'+STYLESHEET_URL+'">',
- '</head>',
- '<body>',
- '<h1>Some header text</h1>',
- '<p id="salutation" style="font-size: 12pt">hi.</p>',
- '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ',
- 'solely to provide some things to ',
- '<span style="color: yellow" class="highlight">',
- 'highlight</span> and <span style="font-weight: bold">count</span> ',
- 'style list-items in the box at right. If you are reading this, ',
- 'you should go do something else instead. Maybe read a book. Or better ',
- 'yet, write some test-cases for another bit of code. ',
- '<span style="font-style: italic">some text</span></p>',
- '<p id="closing">more text</p>',
- '<p>even more text</p>',
- '</div>',
- '</body>',
- '</html>'].join("\n"));
-
-
-
-function selectNode(aInspector)
-{
- inspector = aInspector;
-
- let span = doc.querySelector("span");
- ok(span, "captain, we have the span");
-
- aInspector.selection.setNode(span);
-
- aInspector.sidebar.once("computedview-ready", function() {
- aInspector.sidebar.select("computedview");
-
- computedView = getComputedView(aInspector);
-
- Services.obs.addObserver(testInlineStyle, "StyleInspector-populated", false);
- });
-}
-
-function testInlineStyle()
-{
- Services.obs.removeObserver(testInlineStyle, "StyleInspector-populated");
-
- info("expanding property");
- expandProperty(0, function propertyExpanded() {
- Services.ww.registerNotification(function onWindow(aSubject, aTopic) {
- if (aTopic != "domwindowopened") {
- return;
- }
- info("window opened");
- let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function windowLoad() {
- win.removeEventListener("load", windowLoad);
- info("window load completed");
- let windowType = win.document.documentElement.getAttribute("windowtype");
- is(windowType, "navigator:view-source", "view source window is open");
- info("closing window");
- win.close();
- Services.ww.unregisterNotification(onWindow);
- executeSoon(() => {
- testInlineStyleSheet();
- });
- });
- });
- let link = getLinkByIndex(0);
- link.click();
- });
-}
-
-function testInlineStyleSheet()
-{
- info("clicking an inline stylesheet");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.getToolbox(target);
- toolbox.once("styleeditor-selected", () => {
- let panel = toolbox.getCurrentPanel();
-
- panel.UI.once("editor-selected", (event, editor) => {
- validateStyleEditorSheet(editor, 0);
- executeSoon(() => {
- testExternalStyleSheet(toolbox);
- });
- });
- });
-
- let link = getLinkByIndex(2);
- link.click();
-}
-
-function testExternalStyleSheet(toolbox) {
- info ("clicking an external stylesheet");
-
- let panel = toolbox.getCurrentPanel();
- panel.UI.once("editor-selected", (event, editor) => {
- is(toolbox.currentToolId, "styleeditor", "style editor selected");
- validateStyleEditorSheet(editor, 1);
- finishUp();
- });
-
- toolbox.selectTool("inspector").then(function () {
- info("inspector selected");
- let link = getLinkByIndex(1);
- link.click();
- });
-}
-
-function validateStyleEditorSheet(aEditor, aExpectedSheetIndex)
-{
- info("validating style editor stylesheet");
- let sheet = doc.styleSheets[aExpectedSheetIndex];
- is(aEditor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
-}
-
-function expandProperty(aIndex, aCallback)
-{
- let contentDoc = computedView.styleDocument;
- let expando = contentDoc.querySelectorAll(".expandable")[aIndex];
- expando.click();
-
- // We use executeSoon to give the property time to expand.
- executeSoon(aCallback);
-}
-
-function getLinkByIndex(aIndex)
-{
- let contentDoc = computedView.styleDocument;
- let links = contentDoc.querySelectorAll(".rule-link .link");
- return links[aIndex];
-}
-
-function finishUp()
-{
- doc = inspector = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
- true);
- doc = content.document;
- waitForFocus(function () { openInspector(selectNode); }, content);
- }, true);
-
- content.location = DOCUMENT_URL;
-}
diff --git a/browser/devtools/styleinspector/test/browser_computedview_copy.js b/browser/devtools/styleinspector/test/browser_computedview_copy.js
deleted file mode 100644
index 67337a8e6..000000000
--- a/browser/devtools/styleinspector/test/browser_computedview_copy.js
+++ /dev/null
@@ -1,148 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the style inspector works properly
-
-let doc;
-let win;
-let computedView;
-
-XPCOMUtils.defineLazyGetter(this, "osString", function() {
- return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
-});
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- 'span { font-variant: small-caps; color: #000000; } ' +
- '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="font-size: 12pt">hi.</p>\n' +
- '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' +
- 'solely to provide some things to <span style="color: yellow">' +
- 'highlight</span> and <span style="font-weight: bold">count</span> ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- '<span style="font-style: italic">some text</span></p>\n' +
- '<p id="closing">more text</p>\n' +
- '<p>even more text</p>' +
- '</div>';
- doc.title = "Computed view context menu test";
-
- openInspector(selectNode)
-}
-
-function selectNode(aInspector)
-{
- let span = doc.querySelector("span");
- ok(span, "captain, we have the span");
-
- aInspector.selection.setNode(span);
-
- aInspector.sidebar.once("computedview-ready", function() {
- aInspector.sidebar.select("computedview");
-
- computedView = getComputedView(aInspector);
- win = aInspector.sidebar.getWindowForTab("computedview");
-
- Services.obs.addObserver(runStyleInspectorTests,
- "StyleInspector-populated", false);
- });
-}
-
-
-function runStyleInspectorTests()
-{
- Services.obs.removeObserver(runStyleInspectorTests,
- "StyleInspector-populated", false);
-
- let contentDocument = computedView.styleDocument;
- let prop = contentDocument.querySelector(".property-view");
- ok(prop, "captain, we have the property-view node");
-
- checkCopySelection();
-}
-
-function checkCopySelection()
-{
- let contentDocument = computedView.styleDocument;
- let props = contentDocument.querySelectorAll(".property-view");
- ok(props, "captain, we have the property-view nodes");
-
- let range = document.createRange();
- range.setStart(props[0], 0);
- range.setEnd(props[3], 3);
- win.getSelection().addRange(range);
-
- info("Checking that cssHtmlTree.siBoundCopy() " +
- " returns the correct clipboard value");
-
- let expectedPattern = "color: rgb\\(255, 255, 0\\);[\\r\\n]+" +
- "font-family: helvetica,sans-serif;[\\r\\n]+" +
- "font-size: 16px;[\\r\\n]+" +
- "font-variant: small-caps;[\\r\\n]*";
-
- SimpleTest.waitForClipboard(function CS_boundCopyCheck() {
- return checkClipboardData(expectedPattern);
- },
- function() {fireCopyEvent(props[0])}, closeStyleInspector, function() {
- failedClipboard(expectedPattern, closeStyleInspector);
- });
-}
-
-function checkClipboardData(aExpectedPattern)
-{
- let actual = SpecialPowers.getClipboardData("text/unicode");
- let expectedRegExp = new RegExp(aExpectedPattern, "g");
- return expectedRegExp.test(actual);
-}
-
-function failedClipboard(aExpectedPattern, aCallback)
-{
- // Format expected text for comparison
- let terminator = osString == "WINNT" ? "\r\n" : "\n";
- aExpectedPattern = aExpectedPattern.replace(/\[\\r\\n\][+*]/g, terminator);
- aExpectedPattern = aExpectedPattern.replace(/\\\(/g, "(");
- aExpectedPattern = aExpectedPattern.replace(/\\\)/g, ")");
-
- let actual = SpecialPowers.getClipboardData("text/unicode");
-
- // Trim the right hand side of our strings. This is because expectedPattern
- // accounts for windows sometimes adding a newline to our copied data.
- aExpectedPattern = aExpectedPattern.trimRight();
- actual = actual.trimRight();
-
- dump("TEST-UNEXPECTED-FAIL | Clipboard text does not match expected ... " +
- "results (escaped for accurate comparison):\n");
- info("Actual: " + escape(actual));
- info("Expected: " + escape(aExpectedPattern));
- aCallback();
-}
-
-function closeStyleInspector()
-{
- finishUp();
-}
-
-function finishUp()
-{
- computedView = doc = win = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,computed view context menu test";
-}
diff --git a/browser/devtools/styleinspector/test/browser_csslogic_inherited.js b/browser/devtools/styleinspector/test/browser_csslogic_inherited.js
deleted file mode 100644
index e56c869d0..000000000
--- a/browser/devtools/styleinspector/test/browser_csslogic_inherited.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that inherited properties are treated correctly.
-
-let doc;
-
-function createDocument()
-{
- doc.body.innerHTML = '<div style="margin-left:10px; font-size: 5px"><div id="innerdiv">Inner div</div></div>';
- doc.title = "Style Inspector Inheritance Test";
-
- let cssLogic = new CssLogic();
- cssLogic.highlight(doc.getElementById("innerdiv"));
-
- let marginProp = cssLogic.getPropertyInfo("margin-left");
- is(marginProp.matchedRuleCount, 0, "margin-left should not be included in matched selectors.");
-
- let fontSizeProp = cssLogic.getPropertyInfo("font-size");
- is(fontSizeProp.matchedRuleCount, 1, "font-size should be included in matched selectors.");
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,selector text test, bug 692400";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js b/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js
deleted file mode 100644
index 9dbcfed11..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let win;
-let doc;
-let contentWindow;
-let inspector;
-let toolbox;
-
-let tempScope = {};
-Cu.import("resource://gre/modules/Services.jsm", tempScope);
-let Services = tempScope.Services;
-
-const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
- ["#first {",
- "color: blue",
- "}"].join("\n"));
-
-const DOCUMENT_URL = "data:text/html,"+encodeURIComponent(
- ['<html>' +
- '<head>' +
- '<title>Rule view style editor link test</title>',
- '<style type="text/css"> ',
- 'html { color: #000000; } ',
- 'div { font-variant: small-caps; color: #000000; } ',
- '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ',
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">',
- '</style>',
- '<link rel="stylesheet" type="text/css" href="'+STYLESHEET_URL+'">',
- '</head>',
- '<body>',
- '<h1>Some header text</h1>',
- '<p id="salutation" style="font-size: 12pt">hi.</p>',
- '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ',
- 'solely to provide some things to ',
- '<span style="color: yellow" class="highlight">',
- 'highlight</span> and <span style="font-weight: bold">count</span> ',
- 'style list-items in the box at right. If you are reading this, ',
- 'you should go do something else instead. Maybe read a book. Or better ',
- 'yet, write some test-cases for another bit of code. ',
- '<span style="font-style: italic">some text</span></p>',
- '<p id="closing">more text</p>',
- '<p>even more text</p>',
- '</div>',
- '</body>',
- '</html>'].join("\n"));
-
-function openToolbox() {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, "inspector").then(function(aToolbox) {
- toolbox = aToolbox;
- inspector = toolbox.getCurrentPanel();
- inspector.sidebar.select("ruleview");
- highlightNode();
- });
-}
-
-function highlightNode()
-{
- // Highlight a node.
- let div = content.document.getElementsByTagName("div")[0];
-
- inspector.selection.once("new-node", function() {
- is(inspector.selection.node, div, "selection matches the div element");
- testInlineStyle();
- });
- executeSoon(function() {
- inspector.selection.setNode(div);
- });
-}
-
-function testInlineStyle()
-{
- executeSoon(function() {
- info("clicking an inline style");
-
- Services.ww.registerNotification(function onWindow(aSubject, aTopic) {
- if (aTopic != "domwindowopened") {
- return;
- }
-
- win = aSubject.QueryInterface(Ci.nsIDOMWindow);
- win.addEventListener("load", function windowLoad() {
- win.removeEventListener("load", windowLoad);
- let windowType = win.document.documentElement.getAttribute("windowtype");
- is(windowType, "navigator:view-source", "view source window is open");
- win.close();
- Services.ww.unregisterNotification(onWindow);
- executeSoon(() => {
- testInlineStyleSheet();
- });
- });
- });
-
- let link = getLinkByIndex(0);
- link.scrollIntoView();
- link.click();
- });
-}
-
-function testInlineStyleSheet()
-{
- info("clicking an inline stylesheet");
-
- toolbox.once("styleeditor-ready", function(id, aToolbox) {
- let panel = toolbox.getCurrentPanel();
-
- panel.UI.once("editor-selected", (event, editor) => {
- validateStyleEditorSheet(editor, 0);
- executeSoon(() => {
- testExternalStyleSheet(toolbox);
- });
- });
- });
-
- let link = getLinkByIndex(2);
- link.scrollIntoView();
- link.click();
-}
-
-function testExternalStyleSheet(toolbox) {
- info ("clicking an external stylesheet");
-
- let panel = toolbox.getCurrentPanel();
- panel.UI.once("editor-selected", (event, editor) => {
- is(toolbox.currentToolId, "styleeditor", "style editor tool selected");
- validateStyleEditorSheet(editor, 1);
- finishUp();
- });
-
- toolbox.selectTool("inspector").then(function () {
- let link = getLinkByIndex(1);
- link.scrollIntoView();
- link.click();
- });
-}
-
-function validateStyleEditorSheet(aEditor, aExpectedSheetIndex)
-{
- info("validating style editor stylesheet");
- let sheet = doc.styleSheets[aExpectedSheetIndex];
- is(aEditor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
-}
-
-function getLinkByIndex(aIndex)
-{
- let contentDoc = ruleView().doc;
- contentWindow = contentDoc.defaultView;
- let links = contentDoc.querySelectorAll(".ruleview-rule-source");
- return links[aIndex];
-}
-
-function finishUp()
-{
- gBrowser.removeCurrentTab();
- contentWindow = doc = inspector = toolbox = win = null;
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
- true);
- doc = content.document;
- waitForFocus(openToolbox, content);
- }, true);
-
- content.location = DOCUMENT_URL;
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_copy.js b/browser/devtools/styleinspector/test/browser_ruleview_copy.js
deleted file mode 100644
index add61957b..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_copy.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let inspector;
-let win;
-
-XPCOMUtils.defineLazyGetter(this, "osString", function() {
- return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
-});
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- 'html { color: #000000; } ' +
- 'span { font-variant: small-caps; color: #000000; } ' +
- '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="font-size: 12pt">hi.</p>\n' +
- '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' +
- 'solely to provide some things to <span style="color: yellow">' +
- 'highlight</span> and <span style="font-weight: bold">count</span> ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- '<span style="font-style: italic">some text</span></p>\n' +
- '<p id="closing">more text</p>\n' +
- '<p>even more text</p>' +
- '</div>';
- doc.title = "Rule view context menu test";
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- inspector = toolbox.getCurrentPanel();
- inspector.sidebar.select("ruleview");
- win = inspector.sidebar.getWindowForTab("ruleview");
- highlightNode();
- });
-}
-
-function highlightNode()
-{
- // Highlight a node.
- let div = content.document.getElementsByTagName("div")[0];
-
- inspector.selection.once("new-node", function() {
- is(inspector.selection.node, div, "selection matches the div element");
- executeSoon(checkCopySelection);
- });
- executeSoon(function() {
- inspector.selection.setNode(div);
- });
-}
-
-function checkCopySelection()
-{
- let contentDoc = win.document;
- let props = contentDoc.querySelectorAll(".ruleview-property");
- let values = contentDoc.querySelectorAll(".ruleview-propertycontainer");
-
- let range = document.createRange();
- range.setStart(props[0], 0);
- range.setEnd(values[4], 2);
-
- let selection = win.getSelection();
- selection.addRange(range);
-
- info("Checking that _boundCopy() returns the correct " +
- "clipboard value");
- let expectedPattern = " margin: 10em;[\\r\\n]+" +
- " font-size: 14pt;[\\r\\n]+" +
- " font-family: helvetica,sans-serif;[\\r\\n]+" +
- " color: rgb\\(170, 170, 170\\);[\\r\\n]+" +
- "}[\\r\\n]+" +
- "html {[\\r\\n]+" +
- " color: rgb\\(0, 0, 0\\);[\\r\\n]*";
-
- SimpleTest.waitForClipboard(function IUI_boundCopyCheck() {
- return checkClipboardData(expectedPattern);
- },function() {fireCopyEvent(props[0])}, finishup, function() {
- failedClipboard(expectedPattern, finishup);
- });
-}
-
-function selectNode(aNode) {
- let doc = aNode.ownerDocument;
- let win = doc.defaultView;
- let range = doc.createRange();
-
- range.selectNode(aNode);
- win.getSelection().addRange(range);
-}
-
-function checkClipboardData(aExpectedPattern)
-{
- let actual = SpecialPowers.getClipboardData("text/unicode");
- let expectedRegExp = new RegExp(aExpectedPattern, "g");
- return expectedRegExp.test(actual);
-}
-
-function failedClipboard(aExpectedPattern, aCallback)
-{
- // Format expected text for comparison
- let terminator = osString == "WINNT" ? "\r\n" : "\n";
- aExpectedPattern = aExpectedPattern.replace(/\[\\r\\n\][+*]/g, terminator);
- aExpectedPattern = aExpectedPattern.replace(/\\\(/g, "(");
- aExpectedPattern = aExpectedPattern.replace(/\\\)/g, ")");
-
- let actual = SpecialPowers.getClipboardData("text/unicode");
-
- // Trim the right hand side of our strings. This is because expectedPattern
- // accounts for windows sometimes adding a newline to our copied data.
- aExpectedPattern = aExpectedPattern.trimRight();
- actual = actual.trimRight();
-
- dump("TEST-UNEXPECTED-FAIL | Clipboard text does not match expected ... " +
- "results (escaped for accurate comparison):\n");
- info("Actual: " + escape(actual));
- info("Expected: " + escape(aExpectedPattern));
- aCallback();
-}
-
-function finishup()
-{
- gBrowser.removeCurrentTab();
- doc = inspector = null;
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
- true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,<p>rule view context menu test</p>";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_editor.js b/browser/devtools/styleinspector/test/browser_ruleview_editor.js
deleted file mode 100644
index f4a891dac..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_editor.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc = content.document;
-
-function expectDone(aValue, aCommit, aNext)
-{
- return function(aDoneValue, aDoneCommit) {
- dump("aDoneValue: " + aDoneValue + " commit: " + aDoneCommit + "\n");
-
- is(aDoneValue, aValue, "Should get expected value");
- is(aDoneCommit, aDoneCommit, "Should get expected commit value");
- aNext();
- }
-}
-
-function clearBody()
-{
- doc.body.innerHTML = "";
-}
-
-function createSpan()
-{
- let span = doc.createElement("span");
- span.setAttribute("tabindex", "0");
- span.textContent = "Edit Me!";
- doc.body.appendChild(span);
- return span;
-}
-
-function testReturnCommit()
-{
- clearBody();
- let span = createSpan();
- editableField({
- element: span,
- initial: "explicit initial",
- start: function() {
- is(inplaceEditor(span).input.value, "explicit initial", "Explicit initial value should be used.");
- inplaceEditor(span).input.value = "Test Value";
- EventUtils.sendKey("return");
- },
- done: expectDone("Test Value", true, testBlurCommit)
- });
- span.click();
-}
-
-function testBlurCommit()
-{
- clearBody();
- let span = createSpan();
- editableField({
- element: span,
- start: function() {
- is(inplaceEditor(span).input.value, "Edit Me!", "textContent of the span used.");
- inplaceEditor(span).input.value = "Test Value";
- inplaceEditor(span).input.blur();
- },
- done: expectDone("Test Value", true, testAdvanceCharCommit)
- });
- span.click();
-}
-
-function testAdvanceCharCommit()
-{
- clearBody();
- let span = createSpan();
- editableField({
- element: span,
- advanceChars: ":",
- start: function() {
- let input = inplaceEditor(span).input;
- for each (let ch in "Test:") {
- EventUtils.sendChar(ch);
- }
- },
- done: expectDone("Test", true, testEscapeCancel)
- });
- span.click();
-}
-
-function testEscapeCancel()
-{
- clearBody();
- let span = createSpan();
- editableField({
- element: span,
- initial: "initial text",
- start: function() {
- inplaceEditor(span).input.value = "Test Value";
- EventUtils.sendKey("escape");
- },
- done: expectDone("initial text", false, finishTest)
- });
- span.click();
-}
-
-
-function finishTest()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(testReturnCommit, content);
- }, true);
-
- content.location = "data:text/html,inline editor tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues.js b/browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues.js
deleted file mode 100644
index 28ccdf0a9..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let ruleDialog;
-let ruleView;
-
-var gRuleViewChanged = false;
-function ruleViewChanged()
-{
- gRuleViewChanged = true;
-}
-
-function expectChange()
-{
- ok(gRuleViewChanged, "Rule view should have fired a change event.");
- gRuleViewChanged = false;
-}
-
-function startTest()
-{
- let style = '' +
- '#testid {' +
- ' background-color: blue;' +
- '} ' +
- '.testclass {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
- let testElement = doc.getElementById("testid");
-
- ruleDialog = openDialog("chrome://browser/content/devtools/cssruleview.xhtml",
- "cssruleviewtest",
- "width=200,height=350");
- ruleDialog.addEventListener("load", function onLoad(evt) {
- ruleDialog.removeEventListener("load", onLoad, true);
- let doc = ruleDialog.document;
- ruleView = new CssRuleView(doc);
- doc.documentElement.appendChild(ruleView.element);
- ruleView.element.addEventListener("CssRuleViewChanged", ruleViewChanged, false);
- ruleView.highlight(testElement);
- waitForFocus(testCancelNew, ruleDialog);
- }, true);
-}
-
-function testCancelNew()
-{
- // Start at the beginning: start to add a rule to the element's style
- // declaration, but leave it empty.
- let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
- waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(elementRuleEditor.newPropSpan), aEditor, "Next focused editor should be the new property editor.");
- let input = aEditor.input;
- waitForEditorBlur(aEditor, function () {
- ok(!gRuleViewChanged, "Shouldn't get a change event after a cancel.");
- is(elementRuleEditor.rule.textProps.length, 0, "Should have canceled creating a new text property.");
- ok(!elementRuleEditor.propertyList.hasChildNodes(), "Should not have any properties.");
- testCreateNew();
- });
- aEditor.input.blur();
- });
- EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
- { },
- ruleDialog);
-}
-
-function testCreateNew()
-{
- // Create a new property.
- let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
- waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(elementRuleEditor.newPropSpan), aEditor, "Next focused editor should be the new property editor.");
- let input = aEditor.input;
- input.value = "background-color";
-
- waitForEditorFocus(elementRuleEditor.element, function onNewValue(aEditor) {
- expectChange();
- is(elementRuleEditor.rule.textProps.length, 1, "Should have created a new text property.");
- is(elementRuleEditor.propertyList.children.length, 1, "Should have created a property editor.");
- let textProp = elementRuleEditor.rule.textProps[0];
- is(aEditor, inplaceEditor(textProp.editor.valueSpan), "Should be editing the value span now.");
- aEditor.input.value = "#XYZ";
- waitForEditorBlur(aEditor, function() {
- expectChange();
- is(textProp.value, "#XYZ", "Text prop should have been changed.");
- is(textProp.editor._validate(), false, "#XYZ should not be a valid entry");
- testEditProperty();
- });
- aEditor.input.blur();
- });
- EventUtils.synthesizeKey("VK_RETURN", {}, ruleDialog);
- });
-
- EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
- { },
- ruleDialog);
-}
-
-function testEditProperty()
-{
- let idRuleEditor = ruleView.element.children[1]._ruleEditor;
- let propEditor = idRuleEditor.rule.textProps[0].editor;
- waitForEditorFocus(propEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(propEditor.nameSpan), aEditor, "Next focused editor should be the name editor.");
- let input = aEditor.input;
- waitForEditorFocus(propEditor.element, function onNewName(aEditor) {
- expectChange();
- input = aEditor.input;
- is(inplaceEditor(propEditor.valueSpan), aEditor, "Focus should have moved to the value.");
-
- waitForEditorBlur(aEditor, function() {
- expectChange();
- let value = idRuleEditor.rule.style.getPropertyValue("border-color");
- is(value, "red", "border-color should have been set.");
- is(propEditor._validate(), true, "red should be a valid entry");
- finishTest();
- });
-
- for each (let ch in "red;") {
- EventUtils.sendChar(ch, ruleDialog);
- }
- });
- for each (let ch in "border-color:") {
- EventUtils.sendChar(ch, ruleDialog);
- }
- });
-
- EventUtils.synthesizeMouse(propEditor.nameSpan, 32, 1,
- { },
- ruleDialog);
-}
-
-function finishTest()
-{
- ruleView.element.removeEventListener("CssRuleViewChanged", ruleViewChanged, false);
- ruleView.clear();
- ruleDialog.close();
- ruleDialog = ruleView = null;
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function changedValues_load(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, changedValues_load, true);
- doc = content.document;
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,test rule view user changes";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_focus.js b/browser/devtools/styleinspector/test/browser_ruleview_focus.js
deleted file mode 100644
index da45169ae..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_focus.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that focus doesn't leave the style editor when adding a property
-// (bug 719916)
-
-let doc;
-let inspector;
-let stylePanel;
-
-function openRuleView()
-{
- var target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- inspector = toolbox.getCurrentPanel();
- inspector.sidebar.select("ruleview");
-
- // Highlight a node.
- let node = content.document.getElementsByTagName("h1")[0];
-
- inspector.sidebar.once("ruleview-ready", testFocus);
- });
-}
-
-function testFocus()
-{
- let win = inspector.sidebar.getWindowForTab("ruleview");
- let brace = win.document.querySelectorAll(".ruleview-ruleclose")[0];
-
- waitForEditorFocus(brace.parentNode, function onNewElement(aEditor) {
- aEditor.input.value = "color";
- waitForEditorFocus(brace.parentNode, function onEditingValue(aEditor) {
- // If we actually get this focus we're ok.
- ok(true, "We got focus.");
- aEditor.input.value = "green";
-
- // If we've retained focus, pressing return will start a new editor.
- // If not, we'll wait here until we time out.
- waitForEditorFocus(brace.parentNode, function onNewEditor(aEditor) {
- aEditor.input.blur();
- finishUp();
- });
- EventUtils.sendKey("return");
- });
- EventUtils.sendKey("return");
- });
-
- brace.click();
-}
-
-function finishUp()
-{
- doc = inspector = stylePanel = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- doc.title = "Rule View Test";
- waitForFocus(openRuleView, content);
- }, true);
-
- content.location = "data:text/html,<h1>Some header text</h1>";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_inherit.js b/browser/devtools/styleinspector/test/browser_ruleview_inherit.js
deleted file mode 100644
index 472e9cfa5..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_inherit.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-
-function simpleInherit()
-{
- let style = '' +
- '#test2 {' +
- ' background-color: green;' +
- ' color: purple;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="test2"><div id="test1">Styled Node</div></div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("test1"));
-
- is(elementStyle.rules.length, 2, "Should have 2 rules.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- let inheritRule = elementStyle.rules[1];
- is(inheritRule.selectorText, "#test2", "Inherited rule should be the one that includes inheritable properties.");
- ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
- is(inheritRule.textProps.length, 1, "Should only display one inherited style");
- let inheritProp = inheritRule.textProps[0];
- is(inheritProp.name, "color", "color should have been inherited.");
-
- styleNode.parentNode.removeChild(styleNode);
-
- emptyInherit();
-}
-
-function emptyInherit()
-{
- // No inheritable styles, this rule shouldn't show up.
- let style = '' +
- '#test2 {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="test2"><div id="test1">Styled Node</div></div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("test1"));
-
- is(elementStyle.rules.length, 1, "Should have 1 rule.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- styleNode.parentNode.removeChild(styleNode);
-
- elementStyleInherit();
-}
-
-function elementStyleInherit()
-{
- doc.body.innerHTML = '<div id="test2" style="color: red"><div id="test1">Styled Node</div></div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("test1"));
-
- is(elementStyle.rules.length, 2, "Should have 2 rules.");
-
- let elementRule = elementStyle.rules[0];
- ok(!elementRule.inherited, "Element style attribute should not consider itself inherited.");
-
- let inheritRule = elementStyle.rules[1];
- ok(!inheritRule.domRule, "Inherited rule should be an element style, not a rule.");
- ok(!!inheritRule.inherited, "Rule should consider itself inherited.");
- is(inheritRule.textProps.length, 1, "Should only display one inherited style");
- let inheritProp = inheritRule.textProps[0];
- is(inheritProp.name, "color", "color should have been inherited.");
-
- finishTest();
-}
-
-function finishTest()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(simpleInherit, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_manipulation.js b/browser/devtools/styleinspector/test/browser_ruleview_manipulation.js
deleted file mode 100644
index b077c5400..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_manipulation.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-
-function simpleOverride()
-{
- doc.body.innerHTML = '<div id="testid">Styled Node</div>';
- let element = doc.getElementById("testid");
- let elementStyle = new _ElementStyle(element);
-
- let elementRule = elementStyle.rules[0];
- let firstProp = elementRule.createProperty("background-color", "green", "");
- let secondProp = elementRule.createProperty("background-color", "blue", "");
- is(elementRule.textProps[0], firstProp, "Rules should be in addition order.");
- is(elementRule.textProps[1], secondProp, "Rules should be in addition order.");
-
- is(element.style.getPropertyValue("background-color"), "blue", "Second property should have been used.");
-
- secondProp.remove();
- is(element.style.getPropertyValue("background-color"), "green", "After deleting second property, first should be used.");
-
- secondProp = elementRule.createProperty("background-color", "blue", "");
- is(element.style.getPropertyValue("background-color"), "blue", "New property should be used.");
-
- is(elementRule.textProps[0], firstProp, "Rules shouldn't have switched places.");
- is(elementRule.textProps[1], secondProp, "Rules shouldn't have switched places.");
-
- secondProp.setEnabled(false);
- is(element.style.getPropertyValue("background-color"), "green", "After disabling second property, first value should be used");
-
- firstProp.setEnabled(false);
- is(element.style.getPropertyValue("background-color"), "", "After disabling both properties, value should be empty.");
-
- secondProp.setEnabled(true);
- is(element.style.getPropertyValue("background-color"), "blue", "Value should be set correctly after re-enabling");
-
- firstProp.setEnabled(true);
- is(element.style.getPropertyValue("background-color"), "blue", "Re-enabling an earlier property shouldn't make it override a later property.");
- is(elementRule.textProps[0], firstProp, "Rules shouldn't have switched places.");
- is(elementRule.textProps[1], secondProp, "Rules shouldn't have switched places.");
-
- firstProp.setValue("purple", "");
- is(element.style.getPropertyValue("background-color"), "blue", "Modifying an earlier property shouldn't override a later property.");
-
- finishTest();
-}
-
-function finishTest()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(simpleOverride, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_override.js b/browser/devtools/styleinspector/test/browser_ruleview_override.js
deleted file mode 100644
index 54e5233aa..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_override.js
+++ /dev/null
@@ -1,159 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-
-function simpleOverride()
-{
- let style = '' +
- '#testid {' +
- ' background-color: blue;' +
- '} ' +
- '.testclass {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("testid"));
-
- let idRule = elementStyle.rules[1];
- let idProp = idRule.textProps[0];
- is(idProp.name, "background-color", "First ID prop should be background-color");
- ok(!idProp.overridden, "ID prop should not be overridden.");
-
- let classRule = elementStyle.rules[2];
- let classProp = classRule.textProps[0];
- is(classProp.name, "background-color", "First class prop should be background-color");
- ok(classProp.overridden, "Class property should be overridden.");
-
- // Override background-color by changing the element style.
- let elementRule = elementStyle.rules[0];
- elementRule.createProperty("background-color", "purple", "");
- let elementProp = elementRule.textProps[0];
- is(classProp.name, "background-color", "First element prop should now be background-color");
-
- ok(!elementProp.overridden, "Element style property should not be overridden");
- ok(idProp.overridden, "ID property should be overridden");
- ok(classProp.overridden, "Class property should be overridden");
-
- styleNode.parentNode.removeChild(styleNode);
-
- partialOverride();
-}
-
-function partialOverride()
-{
- let style = '' +
- // Margin shorthand property...
- '.testclass {' +
- ' margin: 2px;' +
- '}' +
- // ... will be partially overridden.
- '#testid {' +
- ' margin-left: 1px;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("testid"));
-
- let classRule = elementStyle.rules[2];
- let classProp = classRule.textProps[0];
- ok(!classProp.overridden, "Class prop shouldn't be overridden, some props are still being used.");
- for each (let computed in classProp.computed) {
- if (computed.name.indexOf("margin-left") == 0) {
- ok(computed.overridden, "margin-left props should be overridden.");
- } else {
- ok(!computed.overridden, "Non-margin-left props should not be overridden.");
- }
- }
-
- styleNode.parentNode.removeChild(styleNode);
-
- importantOverride();
-}
-
-function importantOverride()
-{
- let style = '' +
- // Margin shorthand property...
- '.testclass {' +
- ' background-color: green !important;' +
- '}' +
- // ... will be partially overridden.
- '#testid {' +
- ' background-color: blue;' +
- '}';
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("testid"));
-
- let idRule = elementStyle.rules[1];
- let idProp = idRule.textProps[0];
- ok(idProp.overridden, "Not-important rule should be overridden.");
-
- let classRule = elementStyle.rules[2];
- let classProp = classRule.textProps[0];
- ok(!classProp.overridden, "Important rule should not be overridden.");
-
- styleNode.parentNode.removeChild(styleNode);
-
- let elementRule = elementStyle.rules[0];
- let elementProp = elementRule.createProperty("background-color", "purple", "important");
- ok(classProp.overridden, "New important prop should override class property.");
- ok(!elementProp.overridden, "New important prop should not be overriden.");
-
- disableOverride();
-}
-
-function disableOverride()
-{
- let style = '' +
- '#testid {' +
- ' background-color: blue;' +
- '}' +
- '.testclass {' +
- ' background-color: green;' +
- '}';
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
-
- let elementStyle = new _ElementStyle(doc.getElementById("testid"));
-
- let idRule = elementStyle.rules[1];
- let idProp = idRule.textProps[0];
- idProp.setEnabled(false);
-
- let classRule = elementStyle.rules[2];
- let classProp = classRule.textProps[0];
- ok(!classProp.overridden, "Class prop should not be overridden after id prop was disabled.");
-
- styleNode.parentNode.removeChild(styleNode);
-
- finishTest();
-}
-
-function finishTest()
-{
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(simpleOverride, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_ui.js b/browser/devtools/styleinspector/test/browser_ruleview_ui.js
deleted file mode 100644
index b7b69f85b..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_ui.js
+++ /dev/null
@@ -1,218 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let ruleDialog;
-let ruleView;
-
-var gRuleViewChanged = false;
-function ruleViewChanged()
-{
- gRuleViewChanged = true;
-}
-
-function expectChange()
-{
- ok(gRuleViewChanged, "Rule view should have fired a change event.");
- gRuleViewChanged = false;
-}
-
-function startTest()
-{
- let style = '' +
- '#testid {' +
- ' background-color: blue;' +
- '} ' +
- '.testclass, .unmatched {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
- let testElement = doc.getElementById("testid");
-
- ruleDialog = openDialog("chrome://browser/content/devtools/cssruleview.xhtml",
- "cssruleviewtest",
- "width=200,height=350");
- ruleDialog.addEventListener("load", function onLoad(evt) {
- ruleDialog.removeEventListener("load", onLoad);
- let doc = ruleDialog.document;
- ruleView = new CssRuleView(doc);
- doc.documentElement.appendChild(ruleView.element);
- ruleView.element.addEventListener("CssRuleViewChanged", ruleViewChanged, false);
- is(ruleView.element.querySelectorAll("#noResults").length, 1, "Has a no-results element.");
- ruleView.highlight(testElement);
- is(ruleView.element.querySelectorAll("#noResults").length, 0, "After a highlight, no longer has a no-results element.");
- ruleView.highlight(null);
- is(ruleView.element.querySelectorAll("#noResults").length, 1, "After highlighting null, has a no-results element again.");
- ruleView.highlight(testElement);
-
- let classEditor = ruleView.element.children[2]._ruleEditor;
- is(classEditor.selectorText.querySelector(".ruleview-selector-matched").textContent, ".testclass", ".textclass should be matched.");
- is(classEditor.selectorText.querySelector(".ruleview-selector-unmatched").textContent, ".unmatched", ".unmatched should not be matched.");
-
- waitForFocus(testCancelNew, ruleDialog);
- }, true);
-}
-
-function testCancelNew()
-{
- // Start at the beginning: start to add a rule to the element's style
- // declaration, but leave it empty.
-
- let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
- waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(elementRuleEditor.newPropSpan), aEditor, "Next focused editor should be the new property editor.");
- let input = aEditor.input;
- waitForEditorBlur(aEditor, function () {
- ok(!gRuleViewChanged, "Shouldn't get a change event after a cancel.");
- is(elementRuleEditor.rule.textProps.length, 0, "Should have canceled creating a new text property.");
- ok(!elementRuleEditor.propertyList.hasChildNodes(), "Should not have any properties.");
- testCreateNew();
- });
- aEditor.input.blur();
- });
-
- EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
- { },
- ruleDialog);
-}
-
-function testCreateNew()
-{
- // Create a new property.
- let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
- waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(elementRuleEditor.newPropSpan), aEditor, "Next focused editor should be the new property editor.");
-
- let input = aEditor.input;
-
- ok(input.selectionStart === 0 && input.selectionEnd === input.value.length, "Editor contents are selected.");
-
- // Try clicking on the editor's input again, shouldn't cause trouble (see bug 761665).
- EventUtils.synthesizeMouse(input, 1, 1, { }, ruleDialog);
- input.select();
-
- input.value = "background-color";
-
- waitForEditorFocus(elementRuleEditor.element, function onNewValue(aEditor) {
- expectChange();
- is(elementRuleEditor.rule.textProps.length, 1, "Should have created a new text property.");
- is(elementRuleEditor.propertyList.children.length, 1, "Should have created a property editor.");
- let textProp = elementRuleEditor.rule.textProps[0];
- is(aEditor, inplaceEditor(textProp.editor.valueSpan), "Should be editing the value span now.");
-
- aEditor.input.value = "purple";
- waitForEditorBlur(aEditor, function() {
- expectChange();
- is(textProp.value, "purple", "Text prop should have been changed.");
- testEditProperty();
- });
-
- aEditor.input.blur();
- });
- EventUtils.sendKey("return", ruleDialog);
- });
-
- EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
- { },
- ruleDialog);
-}
-
-function testEditProperty()
-{
- let idRuleEditor = ruleView.element.children[1]._ruleEditor;
- let propEditor = idRuleEditor.rule.textProps[0].editor;
- waitForEditorFocus(propEditor.element, function onNewElement(aEditor) {
- is(inplaceEditor(propEditor.nameSpan), aEditor, "Next focused editor should be the name editor.");
-
- let input = aEditor.input;
-
- dump("SELECTION END IS: " + input.selectionEnd + "\n");
- ok(input.selectionStart === 0 && input.selectionEnd === input.value.length, "Editor contents are selected.");
-
- // Try clicking on the editor's input again, shouldn't cause trouble (see bug 761665).
- EventUtils.synthesizeMouse(input, 1, 1, { }, ruleDialog);
- input.select();
-
- waitForEditorFocus(propEditor.element, function onNewName(aEditor) {
- expectChange();
- is(inplaceEditor(propEditor.valueSpan), aEditor, "Focus should have moved to the value.");
-
- input = aEditor.input;
-
- ok(input.selectionStart === 0 && input.selectionEnd === input.value.length, "Editor contents are selected.");
-
- // Try clicking on the editor's input again, shouldn't cause trouble (see bug 761665).
- EventUtils.synthesizeMouse(input, 1, 1, { }, ruleDialog);
- input.select();
-
- waitForEditorBlur(aEditor, function() {
- expectChange();
- is(idRuleEditor.rule.style.getPropertyValue("border-color"), "red",
- "border-color should have been set.");
-
- let props = ruleView.element.querySelectorAll(".ruleview-property");
- for (let i = 0; i < props.length; i++) {
- is(props[i].hasAttribute("dirty"), i <= 1,
- "props[" + i + "] marked dirty as appropriate");
- }
- testDisableProperty();
- });
-
- for each (let ch in "red;") {
- EventUtils.sendChar(ch, ruleDialog);
- is(propEditor.warning.hidden, ch == "d" || ch == ";",
- "warning triangle is hidden or shown as appropriate");
- }
- });
- for each (let ch in "border-color:") {
- EventUtils.sendChar(ch, ruleDialog);
- }
- });
-
- EventUtils.synthesizeMouse(propEditor.nameSpan, 32, 1,
- { },
- ruleDialog);
-}
-
-function testDisableProperty()
-{
- let idRuleEditor = ruleView.element.children[1]._ruleEditor;
- let propEditor = idRuleEditor.rule.textProps[0].editor;
-
- propEditor.enable.click();
- is(idRuleEditor.rule.style.getPropertyValue("border-color"), "", "Border-color should have been unset.");
- expectChange();
-
- propEditor.enable.click();
- is(idRuleEditor.rule.style.getPropertyValue("border-color"), "red",
- "Border-color should have been reset.");
- expectChange();
-
- finishTest();
-}
-
-function finishTest()
-{
- ruleView.clear();
- ruleDialog.close();
- ruleDialog = ruleView = null;
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_ruleview_update.js b/browser/devtools/styleinspector/test/browser_ruleview_update.js
deleted file mode 100644
index de6f613ed..000000000
--- a/browser/devtools/styleinspector/test/browser_ruleview_update.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let doc;
-let ruleDialog;
-let ruleView;
-let testElement;
-
-function startTest()
-{
- let style = '' +
- '#testid {' +
- ' background-color: blue;' +
- '} ' +
- '.testclass {' +
- ' background-color: green;' +
- '}';
-
- let styleNode = addStyle(doc, style);
- doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
- testElement = doc.getElementById("testid");
-
- let elementStyle = 'margin-top: 1px; padding-top: 5px;'
- testElement.setAttribute("style", elementStyle);
-
- ruleDialog = openDialog("chrome://browser/content/devtools/cssruleview.xhtml",
- "cssruleviewtest",
- "width=200,height=350");
- ruleDialog.addEventListener("load", function onLoad(evt) {
- ruleDialog.removeEventListener("load", onLoad);
- let doc = ruleDialog.document;
- ruleView = new CssRuleView(doc);
- doc.documentElement.appendChild(ruleView.element);
- ruleView.highlight(testElement);
- waitForFocus(testRuleChanges, ruleDialog);
- }, true);
-}
-
-function testRuleChanges()
-{
- let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
- is(selectors.length, 3, "Three rules visible.");
- is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
- is(selectors[1].textContent.indexOf("#testid"), 0, "Second item is id rule.");
- is(selectors[2].textContent.indexOf(".testclass"), 0, "Third item is class rule.");
-
- // Change the id and refresh.
- testElement.setAttribute("id", "differentid");
- ruleView.nodeChanged();
-
- let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
- is(selectors.length, 2, "Three rules visible.");
- is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
- is(selectors[1].textContent.indexOf(".testclass"), 0, "Second item is class rule.");
-
- testElement.setAttribute("id", "testid");
- ruleView.nodeChanged();
-
- // Put the id back.
- let selectors = ruleView.doc.querySelectorAll(".ruleview-selector");
- is(selectors.length, 3, "Three rules visible.");
- is(selectors[0].textContent.indexOf("element"), 0, "First item is inline style.");
- is(selectors[1].textContent.indexOf("#testid"), 0, "Second item is id rule.");
- is(selectors[2].textContent.indexOf(".testclass"), 0, "Third item is class rule.");
-
- testPropertyChanges();
-}
-
-function validateTextProp(aProp, aEnabled, aName, aValue, aDesc)
-{
- is(aProp.enabled, aEnabled, aDesc + ": enabled.");
- is(aProp.name, aName, aDesc + ": name.");
- is(aProp.value, aValue, aDesc + ": value.");
-
- is(aProp.editor.enable.hasAttribute("checked"), aEnabled, aDesc + ": enabled checkbox.");
- is(aProp.editor.nameSpan.textContent, aName, aDesc + ": name span.");
- is(aProp.editor.valueSpan.textContent, aValue, aDesc + ": value span.");
-}
-
-function testPropertyChanges()
-{
- // Add a second margin-top value, just to make things interesting.
- let ruleEditor = ruleView._elementStyle.rules[0].editor;
- ruleEditor.addProperty("margin-top", "5px", "");
-
- let rule = ruleView._elementStyle.rules[0];
-
- // Set the element style back to a 1px margin-top.
- testElement.setAttribute("style", "margin-top: 1px; padding-top: 5px");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], true, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], false, "margin-top", "5px", "Second margin property disabled");
-
- // Now set it back to 5px, the 5px value should be re-enabled.
- testElement.setAttribute("style", "margin-top: 5px; padding-top: 5px;");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], true, "margin-top", "5px", "Second margin property disabled");
-
- // Set the margin property to a value that doesn't exist in the editor.
- // Should reuse the currently-enabled element (the second one.)
- testElement.setAttribute("style", "margin-top: 15px; padding-top: 5px;");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[0], false, "margin-top", "1px", "First margin property re-enabled");
- validateTextProp(rule.textProps[2], true, "margin-top", "15px", "Second margin property disabled");
-
- // Remove the padding-top attribute. Should disable the padding property but not remove it.
- testElement.setAttribute("style", "margin-top: 5px;");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[1], false, "padding-top", "5px", "Padding property disabled");
-
- // Put the padding-top attribute back in, should re-enable the padding property.
- testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 3, "Correct number of properties");
- validateTextProp(rule.textProps[1], true, "padding-top", "25px", "Padding property enabled");
-
- // Add an entirely new property.
- testElement.setAttribute("style", "margin-top: 5px; padding-top: 25px; padding-left: 20px;");
- ruleView.nodeChanged();
- is(rule.editor.element.querySelectorAll(".ruleview-property").length, 4, "Added a property");
- validateTextProp(rule.textProps[3], true, "padding-left", "20px", "Padding property enabled");
-
- finishTest();
-}
-
-function finishTest()
-{
- ruleView.clear();
- ruleDialog.close();
- ruleDialog = ruleView = null;
- doc = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(startTest, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector.js b/browser/devtools/styleinspector/test/browser_styleinspector.js
deleted file mode 100644
index 78c67ef6a..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the style inspector works properly
-
-let doc;
-let inspector;
-let computedView;
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- 'span { font-variant: small-caps; color: #000000; } ' +
- '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="font-size: 12pt">hi.</p>\n' +
- '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' +
- 'solely to provide some things to <span style="color: yellow">' +
- 'highlight</span> and <span style="font-weight: bold">count</span> ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- '<span style="font-style: italic">Maybe more inspector test-cases!</span></p>\n' +
- '<p id="closing">end transmission</p>\n' +
- '<p>Inspect using inspectstyle(document.querySelectorAll("span")[0])</p>' +
- '</div>';
- doc.title = "Style Inspector Test";
-
- openInspector(openComputedView);
-}
-
-function openComputedView(aInspector)
-{
- inspector = aInspector;
-
- inspector.sidebar.once("computedview-ready", function() {
- computedView = getComputedView(inspector);
-
- inspector.sidebar.select("computedview");
- runStyleInspectorTests();
- });
-}
-
-function runStyleInspectorTests()
-{
- var spans = doc.querySelectorAll("span");
- ok(spans, "captain, we have the spans");
-
- for (var i = 0, numSpans = spans.length; i < numSpans; i++) {
- inspector.selection.setNode(spans[i]);
-
- is(spans[i], computedView.viewedElement,
- "style inspector node matches the selected node");
- is(computedView.viewedElement, computedView.cssLogic.viewedElement,
- "cssLogic node matches the cssHtmlTree node");
- }
-
- SI_CheckProperty();
- finishUp();
-}
-
-function SI_CheckProperty()
-{
- let cssLogic = computedView.cssLogic;
- let propertyInfo = cssLogic.getPropertyInfo("color");
- ok(propertyInfo.matchedRuleCount > 0, "color property has matching rules");
-}
-
-function finishUp()
-{
- doc = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic style inspector tests";
-}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_672744_search_filter.js b/browser/devtools/styleinspector/test/browser_styleinspector_bug_672744_search_filter.js
deleted file mode 100644
index 16e3aecbf..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_672744_search_filter.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the search filter works properly.
-
-let doc;
-let inspector;
-let computedView;
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- '.matches {color: #F00;}</style>' +
- '<span id="matches" class="matches">Some styled text</span>' +
- '</div>';
- doc.title = "Style Inspector Search Filter Test";
-
- openInspector(openComputedView);
-}
-
-function openComputedView(aInspector)
-{
- inspector = aInspector;
-
- inspector.sidebar.once("computedview-ready", function() {
- inspector.sidebar.select("computedview");
- computedView = getComputedView(inspector);
-
- runStyleInspectorTests();
- });
-}
-
-function runStyleInspectorTests()
-{
- Services.obs.addObserver(SI_toggleDefaultStyles, "StyleInspector-populated", false);
- SI_inspectNode();
-}
-
-function SI_inspectNode()
-{
- var span = doc.querySelector("#matches");
- ok(span, "captain, we have the matches span");
-
- inspector.selection.setNode(span);
-
- is(span, computedView.viewedElement,
- "style inspector node matches the selected node");
- is(computedView.viewedElement, computedView.cssLogic.viewedElement,
- "cssLogic node matches the cssHtmlTree node");
-}
-
-function SI_toggleDefaultStyles()
-{
- Services.obs.removeObserver(SI_toggleDefaultStyles, "StyleInspector-populated");
-
- info("checking \"Browser styles\" checkbox");
-
- let doc = computedView.styleDocument;
- let checkbox = doc.querySelector(".includebrowserstyles");
- Services.obs.addObserver(SI_AddFilterText, "StyleInspector-populated", false);
- checkbox.click();
-}
-
-function SI_AddFilterText()
-{
- Services.obs.removeObserver(SI_AddFilterText, "StyleInspector-populated");
-
- let doc = computedView.styleDocument;
- let searchbar = doc.querySelector(".devtools-searchinput");
- Services.obs.addObserver(SI_checkFilter, "StyleInspector-populated", false);
- info("setting filter text to \"color\"");
- searchbar.focus();
-
- let win =computedView.styleWindow;
- EventUtils.synthesizeKey("c", {}, win);
- EventUtils.synthesizeKey("o", {}, win);
- EventUtils.synthesizeKey("l", {}, win);
- EventUtils.synthesizeKey("o", {}, win);
- EventUtils.synthesizeKey("r", {}, win);
-}
-
-function SI_checkFilter()
-{
- Services.obs.removeObserver(SI_checkFilter, "StyleInspector-populated");
- let propertyViews = computedView.propertyViews;
-
- info("check that the correct properties are visible");
- propertyViews.forEach(function(propView) {
- let name = propView.name;
- is(propView.visible, name.indexOf("color") > -1,
- "span " + name + " property visibility check");
- });
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = inspector = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,default styles test";
-}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_672746_default_styles.js b/browser/devtools/styleinspector/test/browser_styleinspector_bug_672746_default_styles.js
deleted file mode 100644
index 860fc7d4d..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_672746_default_styles.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the checkbox to include browser styles works properly.
-
-let doc;
-let inspector;
-let computedView;
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- '.matches {color: #F00;}</style>' +
- '<span id="matches" class="matches">Some styled text</span>' +
- '</div>';
- doc.title = "Style Inspector Default Styles Test";
-
- openInspector(openComputedView);
-}
-
-function openComputedView(aInspector)
-{
- inspector = aInspector;
-
- inspector.sidebar.once("computedview-ready", function() {
- inspector.sidebar.select("computedview");
- computedView = getComputedView(inspector);
-
- runStyleInspectorTests();
- });
-}
-
-function runStyleInspectorTests()
-{
- Services.obs.addObserver(SI_check, "StyleInspector-populated", false);
- SI_inspectNode();
-}
-
-function SI_inspectNode()
-{
- let span = doc.querySelector("#matches");
- ok(span, "captain, we have the matches span");
-
- inspector.selection.setNode(span);
-
- is(span, computedView.viewedElement,
- "style inspector node matches the selected node");
- is(computedView.viewedElement, computedView.cssLogic.viewedElement,
- "cssLogic node matches the cssHtmlTree node");
-}
-
-function SI_check()
-{
- Services.obs.removeObserver(SI_check, "StyleInspector-populated");
- is(propertyVisible("color"), true,
- "span #matches color property is visible");
- is(propertyVisible("background-color"), false,
- "span #matches background-color property is hidden");
-
- SI_toggleDefaultStyles();
-}
-
-function SI_toggleDefaultStyles()
-{
- // Click on the checkbox.
- let doc = computedView.styleDocument;
- let checkbox = doc.querySelector(".includebrowserstyles");
- Services.obs.addObserver(SI_checkDefaultStyles, "StyleInspector-populated", false);
-
- checkbox.click();
-}
-
-function SI_checkDefaultStyles()
-{
- Services.obs.removeObserver(SI_checkDefaultStyles, "StyleInspector-populated");
- // Check that the default styles are now applied.
- is(propertyVisible("color"), true,
- "span color property is visible");
- is(propertyVisible("background-color"), true,
- "span background-color property is visible");
-
- finishUp();
-}
-
-function propertyVisible(aName)
-{
- info("Checking property visibility for " + aName);
- let propertyViews = computedView.propertyViews;
- for each (let propView in propertyViews) {
- if (propView.name == aName) {
- return propView.visible;
- }
- }
- return false;
-}
-
-function finishUp()
-{
- doc = inspector = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,default styles test";
-}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.html b/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.html
deleted file mode 100644
index 44b5f0e3d..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<html>
- <head>
-
- <link href="./browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css" rel="stylesheet" type="text/css">
-
- </head>
- <body>
-
- <div class="relative">Background image with relative path (loaded from external css)</div>
-
- <div class="absolute">Background image with absolute path (loaded from external css)</div>
-
- <div class="base64">Background image with base64 url (loaded from external css)</div>
-
- <div class="inline" style="background: url(test-image.png);">Background image with relative path (loaded from style attribute)</div>';
-
- <div class="noimage">No background image :(</div>
- </body>
-</html>
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.js b/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.js
deleted file mode 100644
index 215313081..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests to make sure that URLs are clickable in the rule view
-
-let doc;
-let computedView;
-let inspector;
-
-const BASE_URL = "http://example.com/browser/browser/" +
- "devtools/styleinspector/test/";
-const TEST_URI = BASE_URL +
- "browser_styleinspector_bug_677930_urls_clickable.html";
-const TEST_IMAGE = BASE_URL + "test-image.png";
-const BASE_64_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
-
-function createDocument()
-{
- doc.title = "Style Inspector URL Clickable test";
-
- openInspector(function(aInspector) {
- inspector = aInspector;
- executeSoon(selectNode);
- });
-}
-
-
-function selectNode(aInspector)
-{
- let sidebar = inspector.sidebar;
- let iframe = sidebar._tabbox.querySelector(".iframe-ruleview");
- let contentDoc = iframe.contentWindow.document;
-
- let relative = doc.querySelector(".relative");
- let absolute = doc.querySelector(".absolute");
- let inline = doc.querySelector(".inline");
- let base64 = doc.querySelector(".base64");
- let noimage = doc.querySelector(".noimage");
-
- ok(relative, "captain, we have the relative div");
- ok(absolute, "captain, we have the absolute div");
- ok(inline, "captain, we have the inline div");
- ok(base64, "captain, we have the base64 div");
- ok(noimage, "captain, we have the noimage div");
-
- inspector.selection.setNode(relative);
- is(inspector.selection.node, relative, "selection matches the relative element");
- let relativeLink = contentDoc.querySelector(".ruleview-propertycontainer a");
- ok (relativeLink, "Link exists for relative node");
- ok (relativeLink.getAttribute("href"), TEST_IMAGE);
-
- inspector.selection.setNode(absolute);
- is(inspector.selection.node, absolute, "selection matches the absolute element");
- let absoluteLink = contentDoc.querySelector(".ruleview-propertycontainer a");
- ok (absoluteLink, "Link exists for absolute node");
- ok (absoluteLink.getAttribute("href"), TEST_IMAGE);
-
- inspector.selection.setNode(inline);
- is(inspector.selection.node, inline, "selection matches the inline element");
- let inlineLink = contentDoc.querySelector(".ruleview-propertycontainer a");
- ok (inlineLink, "Link exists for inline node");
- ok (inlineLink.getAttribute("href"), TEST_IMAGE);
-
- inspector.selection.setNode(base64);
- is(inspector.selection.node, base64, "selection matches the base64 element");
- let base64Link = contentDoc.querySelector(".ruleview-propertycontainer a");
- ok (base64Link, "Link exists for base64 node");
- ok (base64Link.getAttribute("href"), BASE_64_URL);
-
- inspector.selection.setNode(noimage);
- is(inspector.selection.node, noimage, "selection matches the inline element");
- let noimageLink = contentDoc.querySelector(".ruleview-propertycontainer a");
- ok (!noimageLink, "There is no link for the node with no background image");
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = computedView = inspector = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = TEST_URI;
-}
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css b/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css
deleted file mode 100644
index f55c54a89..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.relative {
- background-image: url(../test-image.png);
-}
-.absolute {
- background: url("http://example.com/browser/browser/devtools/styleinspector/test/test-image.png");
-}
-.base64 {
- background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==');
-} \ No newline at end of file
diff --git a/browser/devtools/styleinspector/test/browser_styleinspector_bug_689759_no_results_placeholder.js b/browser/devtools/styleinspector/test/browser_styleinspector_bug_689759_no_results_placeholder.js
deleted file mode 100644
index 0bfea2947..000000000
--- a/browser/devtools/styleinspector/test/browser_styleinspector_bug_689759_no_results_placeholder.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the no results placeholder works properly.
-
-let doc;
-let inspector;
-let computedView;
-
-function createDocument()
-{
- doc.body.innerHTML = '<style type="text/css"> ' +
- '.matches {color: #F00;}</style>' +
- '<span id="matches" class="matches">Some styled text</span>';
- doc.title = "Tests that the no results placeholder works properly";
-
- openInspector(openComputedView);
-}
-
-function openComputedView(aInspector)
-{
- inspector = aInspector;
-
- inspector.sidebar.once("computedview-ready", function() {
- inspector.sidebar.select("computedview");
- computedView = getComputedView(inspector);
-
- runStyleInspectorTests();
- });
-}
-
-
-function runStyleInspectorTests()
-{
- Services.obs.addObserver(SI_AddFilterText, "StyleInspector-populated", false);
-
- let span = doc.querySelector("#matches");
- ok(span, "captain, we have the matches span");
-
- inspector.selection.setNode(span);
-
- is(span, computedView.viewedElement,
- "style inspector node matches the selected node");
- is(computedView.viewedElement, computedView.cssLogic.viewedElement,
- "cssLogic node matches the cssHtmlTree node");
-}
-
-function SI_AddFilterText()
-{
- Services.obs.removeObserver(SI_AddFilterText, "StyleInspector-populated");
-
- let searchbar = computedView.searchField;
- let searchTerm = "xxxxx";
-
- Services.obs.addObserver(SI_checkPlaceholderVisible, "StyleInspector-populated", false);
- info("setting filter text to \"" + searchTerm + "\"");
- searchbar.focus();
- for each (let c in searchTerm) {
- EventUtils.synthesizeKey(c, {}, computedView.styleWindow);
- }
-}
-
-function SI_checkPlaceholderVisible()
-{
- Services.obs.removeObserver(SI_checkPlaceholderVisible, "StyleInspector-populated");
- info("SI_checkPlaceholderVisible called");
- let placeholder = computedView.noResults;
- let win = computedView.styleWindow;
- let display = win.getComputedStyle(placeholder).display;
-
- is(display, "block", "placeholder is visible");
-
- SI_ClearFilterText();
-}
-
-function SI_ClearFilterText()
-{
- let searchbar = computedView.searchField;
-
- Services.obs.addObserver(SI_checkPlaceholderHidden, "StyleInspector-populated", false);
- info("clearing filter text");
- searchbar.focus();
- searchbar.value = "";
- EventUtils.synthesizeKey("c", {}, computedView.styleWindow);
-}
-
-function SI_checkPlaceholderHidden()
-{
- Services.obs.removeObserver(SI_checkPlaceholderHidden, "StyleInspector-populated");
- let placeholder = computedView.noResults;
- let win = computedView.styleWindow;
- let display = win.getComputedStyle(placeholder).display;
-
- is(display, "none", "placeholder is hidden");
-
- finishUp();
-}
-
-function finishUp()
-{
- doc = inspector = computedView = null;
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) {
- gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,no results placeholder test";
-}
diff --git a/browser/devtools/styleinspector/test/head.js b/browser/devtools/styleinspector/test/head.js
deleted file mode 100644
index 76358fd39..000000000
--- a/browser/devtools/styleinspector/test/head.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let tempScope = {};
-Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
-let ConsoleUtils = tempScope.ConsoleUtils;
-let gDevTools = tempScope.gDevTools;
-
-Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
-let devtools = tempScope.devtools;
-
-let TargetFactory = devtools.TargetFactory;
-let {CssHtmlTree} = devtools.require("devtools/styleinspector/computed-view");
-let {CssRuleView, _ElementStyle} = devtools.require("devtools/styleinspector/rule-view");
-let {CssLogic, CssSelector} = devtools.require("devtools/styleinspector/css-logic");
-
-let {
- editableField,
- getInplaceEditorForSpan: inplaceEditor
-} = devtools.require("devtools/shared/inplace-editor");
-Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
-let console = tempScope.console;
-
-let browser, hudId, hud, hudBox, filterBox, outputNode, cs;
-
-function addTab(aURL)
-{
- gBrowser.selectedTab = gBrowser.addTab();
- content.location = aURL;
- browser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
-}
-
-function openInspector(callback)
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- callback(toolbox.getCurrentPanel());
- });
-}
-
-function addStyle(aDocument, aString)
-{
- let node = aDocument.createElement('style');
- node.setAttribute("type", "text/css");
- node.textContent = aString;
- aDocument.getElementsByTagName("head")[0].appendChild(node);
- return node;
-}
-
-function finishTest()
-{
- finish();
-}
-
-function tearDown()
-{
- try {
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- }
- catch (ex) {
- dump(ex);
- }
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
- browser = hudId = hud = filterBox = outputNode = cs = null;
-}
-
-function getComputedView(inspector) {
- return inspector.sidebar.getWindowForTab("computedview").computedview.view;
-}
-
-function ruleView()
-{
- return inspector.sidebar.getWindowForTab("ruleview").ruleview.view;
-}
-
-function waitForEditorFocus(aParent, aCallback)
-{
- aParent.addEventListener("focus", function onFocus(evt) {
- if (inplaceEditor(evt.target) && evt.target.tagName == "input") {
- aParent.removeEventListener("focus", onFocus, true);
- let editor = inplaceEditor(evt.target);
- executeSoon(function() {
- aCallback(editor);
- });
- }
- }, true);
-}
-
-function waitForEditorBlur(aEditor, aCallback)
-{
- let input = aEditor.input;
- input.addEventListener("blur", function onBlur() {
- input.removeEventListener("blur", onBlur, false);
- executeSoon(function() {
- aCallback();
- });
- }, false);
-}
-
-function fireCopyEvent(element) {
- let evt = element.ownerDocument.createEvent("Event");
- evt.initEvent("copy", true, true);
- element.dispatchEvent(evt);
-}
-
-function contextMenuClick(element) {
- var evt = element.ownerDocument.createEvent('MouseEvents');
-
- var button = 2; // right click
-
- evt.initMouseEvent('contextmenu', true, true,
- element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false,
- false, false, false, button, null);
-
- element.dispatchEvent(evt);
-}
-
-registerCleanupFunction(tearDown);
-
-waitForExplicitFinish();
-
diff --git a/browser/devtools/styleinspector/test/moz.build b/browser/devtools/styleinspector/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/styleinspector/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/styleinspector/test/test-image.png b/browser/devtools/styleinspector/test/test-image.png
deleted file mode 100644
index 769c63634..000000000
--- a/browser/devtools/styleinspector/test/test-image.png
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/tilt/moz.build b/browser/devtools/tilt/moz.build
index 5abe8b3be..6ecebe123 100644
--- a/browser/devtools/tilt/moz.build
+++ b/browser/devtools/tilt/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/tilt/test/Makefile.in b/browser/devtools/tilt/test/Makefile.in
deleted file mode 100644
index cf3e6d351..000000000
--- a/browser/devtools/tilt/test/Makefile.in
+++ /dev/null
@@ -1,63 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- head.js \
- browser_tilt_01_lazy_getter.js \
- browser_tilt_02_notifications-seq.js \
- browser_tilt_02_notifications.js \
- browser_tilt_02_notifications-tabs.js \
- browser_tilt_03_tab_switch.js \
- browser_tilt_04_initialization.js \
- browser_tilt_05_destruction-esc.js \
- browser_tilt_05_destruction-url.js \
- browser_tilt_05_destruction.js \
- browser_tilt_arcball-reset-typeahead.js \
- browser_tilt_arcball-reset.js \
- browser_tilt_arcball.js \
- browser_tilt_controller.js \
- browser_tilt_gl01.js \
- browser_tilt_gl02.js \
- browser_tilt_gl03.js \
- browser_tilt_gl04.js \
- browser_tilt_gl05.js \
- browser_tilt_gl06.js \
- browser_tilt_gl07.js \
- browser_tilt_gl08.js \
- browser_tilt_math01.js \
- browser_tilt_math02.js \
- browser_tilt_math03.js \
- browser_tilt_math04.js \
- browser_tilt_math05.js \
- browser_tilt_math06.js \
- browser_tilt_math07.js \
- browser_tilt_picking.js \
- browser_tilt_picking_inspector.js \
- browser_tilt_picking_delete.js \
- browser_tilt_picking_highlight01-offs.js \
- browser_tilt_picking_highlight01.js \
- browser_tilt_picking_highlight02.js \
- browser_tilt_picking_highlight03.js \
- browser_tilt_picking_miv.js \
- browser_tilt_utils01.js \
- browser_tilt_utils02.js \
- browser_tilt_utils03.js \
- browser_tilt_utils04.js \
- browser_tilt_utils05.js \
- browser_tilt_utils06.js \
- browser_tilt_utils07.js \
- browser_tilt_utils08.js \
- browser_tilt_visualizer.js \
- browser_tilt_zoom.js \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/tilt/test/browser_tilt_01_lazy_getter.js b/browser/devtools/tilt/test/browser_tilt_01_lazy_getter.js
deleted file mode 100644
index de77ccb90..000000000
--- a/browser/devtools/tilt/test/browser_tilt_01_lazy_getter.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- ok(Tilt,
- "The Tilt object wasn't got correctly via defineLazyGetter.");
- is(Tilt.chromeWindow, window,
- "The top-level window wasn't saved correctly");
- ok(Tilt.visualizers,
- "The holder object for all the instances of the visualizer doesn't exist.")
- ok(Tilt.NOTIFICATIONS,
- "The notifications constants weren't referenced correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_02_notifications-seq.js b/browser/devtools/tilt/test/browser_tilt_02_notifications-seq.js
deleted file mode 100644
index 18a71338f..000000000
--- a/browser/devtools/tilt/test/browser_tilt_02_notifications-seq.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tabEvents = "";
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping notifications test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping notifications test because WebGL isn't supported.");
- return;
- }
-
- requestLongerTimeout(10);
- waitForExplicitFinish();
-
- createTab(function() {
- Services.obs.addObserver(finalize, DESTROYED, false);
- Services.obs.addObserver(obs_STARTUP, STARTUP, false);
- Services.obs.addObserver(obs_INITIALIZING, INITIALIZING, false);
- Services.obs.addObserver(obs_INITIALIZED, INITIALIZED, false);
- Services.obs.addObserver(obs_DESTROYING, DESTROYING, false);
- Services.obs.addObserver(obs_BEFORE_DESTROYED, BEFORE_DESTROYED, false);
- Services.obs.addObserver(obs_DESTROYED, DESTROYED, false);
-
- info("Starting up the Tilt notifications test.");
- createTilt({}, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function obs_STARTUP(win) {
- info("Handling the STARTUP notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "STARTUP;";
-}
-
-function obs_INITIALIZING(win) {
- info("Handling the INITIALIZING notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "INITIALIZING;";
-}
-
-function obs_INITIALIZED(win) {
- info("Handling the INITIALIZED notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "INITIALIZED;";
-
- Tilt.destroy(Tilt.currentWindowId, true);
-}
-
-function obs_DESTROYING(win) {
- info("Handling the DESTROYING( notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "DESTROYING;";
-}
-
-function obs_BEFORE_DESTROYED(win) {
- info("Handling the BEFORE_DESTROYED notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "BEFORE_DESTROYED;";
-}
-
-function obs_DESTROYED(win) {
- info("Handling the DESTROYED notification.");
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "DESTROYED;";
-}
-
-function finalize(win) {
- if (!tabEvents) {
- return;
- }
-
- is(win, gBrowser.selectedBrowser.contentWindow, "Saw the correct window");
- is(tabEvents, "STARTUP;INITIALIZING;INITIALIZED;DESTROYING;BEFORE_DESTROYED;DESTROYED;",
- "The notifications weren't fired in the correct order.");
-
- cleanup();
-}
-
-function cleanup() {
- info("Cleaning up the notifications test.");
-
- Services.obs.removeObserver(finalize, DESTROYED);
- Services.obs.removeObserver(obs_INITIALIZING, INITIALIZING);
- Services.obs.removeObserver(obs_INITIALIZED, INITIALIZED);
- Services.obs.removeObserver(obs_DESTROYING, DESTROYING);
- Services.obs.removeObserver(obs_BEFORE_DESTROYED, BEFORE_DESTROYED);
- Services.obs.removeObserver(obs_DESTROYED, DESTROYED);
-
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_02_notifications-tabs.js b/browser/devtools/tilt/test/browser_tilt_02_notifications-tabs.js
deleted file mode 100644
index 435af263c..000000000
--- a/browser/devtools/tilt/test/browser_tilt_02_notifications-tabs.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tab0, tab1, tab2;
-let testStep = -1;
-
-let expected = [];
-function expect(notification, win) {
- expected.push({ notification: notification, window: win });
-}
-
-function notification(win, topic) {
- if (expected.length == 0) {
- is(topic, null, "Shouldn't see a notification");
- return;
- }
-
- let { notification, window } = expected.shift();
- is(topic, notification, "Saw the expected notification");
- is(win, window, "Saw the expected window");
-}
-
-function after(notification, callback) {
- function observer() {
- Services.obs.removeObserver(observer, notification);
- executeSoon(callback);
- }
- Services.obs.addObserver(observer, notification, false);
-}
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping tab switch test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping tab switch test because WebGL isn't supported.");
- return;
- }
-
- Services.obs.addObserver(notification, STARTUP, false);
- Services.obs.addObserver(notification, INITIALIZING, false);
- Services.obs.addObserver(notification, INITIALIZED, false);
- Services.obs.addObserver(notification, DESTROYING, false);
- Services.obs.addObserver(notification, BEFORE_DESTROYED, false);
- Services.obs.addObserver(notification, DESTROYED, false);
- Services.obs.addObserver(notification, SHOWN, false);
- Services.obs.addObserver(notification, HIDDEN, false);
-
- waitForExplicitFinish();
-
- tab0 = gBrowser.selectedTab;
- nextStep();
-}
-
-function createTab2() {
-}
-
-let testSteps = [
- function step0() {
- tab1 = createTab(function() {
- expect(STARTUP, tab1.linkedBrowser.contentWindow);
- expect(INITIALIZING, tab1.linkedBrowser.contentWindow);
- expect(INITIALIZED, tab1.linkedBrowser.contentWindow);
- after(INITIALIZED, nextStep);
-
- createTilt({}, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
- },
- function step1() {
- expect(HIDDEN, tab1.linkedBrowser.contentWindow);
-
- tab2 = createTab(function() {
- expect(STARTUP, tab2.linkedBrowser.contentWindow);
- expect(INITIALIZING, tab2.linkedBrowser.contentWindow);
- expect(INITIALIZED, tab2.linkedBrowser.contentWindow);
- after(INITIALIZED, nextStep);
-
- createTilt({}, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
- },
- function step2() {
- expect(HIDDEN, tab2.linkedBrowser.contentWindow);
- after(HIDDEN, nextStep);
-
- gBrowser.selectedTab = tab0;
- },
- function step3() {
- expect(SHOWN, tab2.linkedBrowser.contentWindow);
- after(SHOWN, nextStep);
-
- gBrowser.selectedTab = tab2;
- },
- function step4() {
- expect(HIDDEN, tab2.linkedBrowser.contentWindow);
- expect(SHOWN, tab1.linkedBrowser.contentWindow);
- after(SHOWN, nextStep);
-
- gBrowser.selectedTab = tab1;
- },
- function step5() {
- expect(HIDDEN, tab1.linkedBrowser.contentWindow);
- expect(SHOWN, tab2.linkedBrowser.contentWindow);
- after(SHOWN, nextStep);
-
- gBrowser.selectedTab = tab2;
- },
- function step6() {
- expect(DESTROYING, tab2.linkedBrowser.contentWindow);
- expect(BEFORE_DESTROYED, tab2.linkedBrowser.contentWindow);
- expect(DESTROYED, tab2.linkedBrowser.contentWindow);
- after(DESTROYED, nextStep);
-
- Tilt.destroy(Tilt.currentWindowId, true);
- },
- function step7() {
- expect(SHOWN, tab1.linkedBrowser.contentWindow);
-
- gBrowser.removeCurrentTab();
- tab2 = null;
-
- expect(DESTROYING, tab1.linkedBrowser.contentWindow);
- expect(HIDDEN, tab1.linkedBrowser.contentWindow);
- expect(BEFORE_DESTROYED, tab1.linkedBrowser.contentWindow);
- expect(DESTROYED, tab1.linkedBrowser.contentWindow);
- after(DESTROYED, nextStep);
-
- gBrowser.removeCurrentTab();
- tab1 = null;
- },
- function step8_cleanup() {
- is(gBrowser.selectedTab, tab0, "Should be back to the first tab");
-
- cleanup();
- }
-];
-
-function cleanup() {
- if (tab1) {
- gBrowser.removeTab(tab1);
- tab1 = null;
- }
- if (tab2) {
- gBrowser.removeTab(tab2);
- tab2 = null;
- }
-
- Services.obs.removeObserver(notification, STARTUP);
- Services.obs.removeObserver(notification, INITIALIZING);
- Services.obs.removeObserver(notification, INITIALIZED);
- Services.obs.removeObserver(notification, DESTROYING);
- Services.obs.removeObserver(notification, BEFORE_DESTROYED);
- Services.obs.removeObserver(notification, DESTROYED);
- Services.obs.removeObserver(notification, SHOWN);
- Services.obs.removeObserver(notification, HIDDEN);
-
- finish();
-}
-
-function nextStep() {
- let step = testSteps.shift();
- info("Executing " + step.name);
- step();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_02_notifications.js b/browser/devtools/tilt/test/browser_tilt_02_notifications.js
deleted file mode 100644
index fe42001f1..000000000
--- a/browser/devtools/tilt/test/browser_tilt_02_notifications.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tab0, tab1;
-let testStep = -1;
-let tabEvents = "";
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping notifications test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping notifications test because WebGL isn't supported.");
- return;
- }
-
- requestLongerTimeout(10);
- waitForExplicitFinish();
-
- gBrowser.tabContainer.addEventListener("TabSelect", tabSelect, false);
- createNewTab();
-}
-
-function createNewTab() {
- tab0 = gBrowser.selectedTab;
-
- tab1 = createTab(function() {
- Services.obs.addObserver(finalize, DESTROYED, false);
- Services.obs.addObserver(tab_STARTUP, STARTUP, false);
- Services.obs.addObserver(tab_INITIALIZING, INITIALIZING, false);
- Services.obs.addObserver(tab_DESTROYING, DESTROYING, false);
- Services.obs.addObserver(tab_SHOWN, SHOWN, false);
- Services.obs.addObserver(tab_HIDDEN, HIDDEN, false);
-
- info("Starting up the Tilt notifications test.");
- createTilt({
- onTiltOpen: function()
- {
- testStep = 0;
- tabSelect();
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function tab_STARTUP(win) {
- info("Handling the STARTUP notification.");
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "STARTUP;";
-}
-
-function tab_INITIALIZING(win) {
- info("Handling the INITIALIZING notification.");
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "INITIALIZING;";
-}
-
-function tab_DESTROYING(win) {
- info("Handling the DESTROYING notification.");
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "DESTROYING;";
-}
-
-function tab_SHOWN(win) {
- info("Handling the SHOWN notification.");
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "SHOWN;";
-}
-
-function tab_HIDDEN(win) {
- info("Handling the HIDDEN notification.");
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
- tabEvents += "HIDDEN;";
-}
-
-let testSteps = [
- function step0() {
- info("Selecting tab0.");
- gBrowser.selectedTab = tab0;
- },
- function step1() {
- info("Selecting tab1.");
- gBrowser.selectedTab = tab1;
- },
- function step2() {
- info("Killing it.");
- Tilt.destroy(Tilt.currentWindowId, true);
- }
-];
-
-function finalize(win) {
- if (!tabEvents) {
- return;
- }
-
- is(win, tab1.linkedBrowser.contentWindow, "Saw the correct window");
-
- is(tabEvents, "STARTUP;INITIALIZING;HIDDEN;SHOWN;DESTROYING;",
- "The notifications weren't fired in the correct order.");
-
- cleanup();
-}
-
-function cleanup() {
- info("Cleaning up the notifications test.");
-
- tab0 = null;
- tab1 = null;
-
- Services.obs.removeObserver(finalize, DESTROYED);
- Services.obs.removeObserver(tab_INITIALIZING, INITIALIZING);
- Services.obs.removeObserver(tab_DESTROYING, DESTROYING);
- Services.obs.removeObserver(tab_SHOWN, SHOWN);
- Services.obs.removeObserver(tab_HIDDEN, HIDDEN);
-
- gBrowser.tabContainer.removeEventListener("TabSelect", tabSelect);
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function tabSelect() {
- if (testStep !== -1) {
- executeSoon(testSteps[testStep]);
- testStep++;
- }
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_03_tab_switch.js b/browser/devtools/tilt/test/browser_tilt_03_tab_switch.js
deleted file mode 100644
index 0ea5c886f..000000000
--- a/browser/devtools/tilt/test/browser_tilt_03_tab_switch.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tab0, tab1, tab2;
-let testStep = -1;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping tab switch test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping tab switch test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- gBrowser.tabContainer.addEventListener("TabSelect", tabSelect, false);
- createTab1();
-}
-
-function createTab1() {
- tab0 = gBrowser.selectedTab;
-
- tab1 = createTab(function() {
- createTilt({
- onTiltOpen: function()
- {
- createTab2();
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function createTab2() {
- tab2 = createTab(function() {
-
- createTilt({
- onTiltOpen: function()
- {
- testStep = 0;
- tabSelect();
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-let testSteps = [
- function step0() {
- gBrowser.selectedTab = tab1;
- },
- function step1() {
- gBrowser.selectedTab = tab0;
- },
- function step2() {
- gBrowser.selectedTab = tab1;
- },
- function step3() {
- gBrowser.selectedTab = tab2;
- },
- function step4() {
- Tilt.destroy(Tilt.currentWindowId);
- gBrowser.removeCurrentTab();
- tab2 = null;
- },
- function step5() {
- Tilt.destroy(Tilt.currentWindowId);
- gBrowser.removeCurrentTab();
- tab1 = null;
- },
- function step6_cleanup() {
- cleanup();
- }
-];
-
-function cleanup() {
- gBrowser.tabContainer.removeEventListener("TabSelect", tabSelect, false);
-
- if (tab1) {
- gBrowser.removeTab(tab1);
- tab1 = null;
- }
- if (tab2) {
- gBrowser.removeTab(tab2);
- tab2 = null;
- }
-
- finish();
-}
-
-function tabSelect() {
- if (testStep !== -1) {
- executeSoon(testSteps[testStep]);
- testStep++;
- }
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_04_initialization.js b/browser/devtools/tilt/test/browser_tilt_04_initialization.js
deleted file mode 100644
index 314fb22e6..000000000
--- a/browser/devtools/tilt/test/browser_tilt_04_initialization.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping initialization test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping initialization test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
-
- is(id, Tilt.currentWindowId,
- "The unique window identifiers should match for the same window.");
-
- createTilt({
- onTiltOpen: function(instance)
- {
- is(document.activeElement, instance.presenter.canvas,
- "The visualizer canvas should be focused on initialization.");
-
- ok(Tilt.visualizers[id] instanceof TiltVisualizer,
- "A new instance of the visualizer wasn't created properly.");
- ok(Tilt.visualizers[id].isInitialized(),
- "The new instance of the visualizer wasn't initialized properly.");
- },
- onTiltClose: function()
- {
- is(document.activeElement, gBrowser.selectedBrowser,
- "The focus wasn't correctly given back to the selectedBrowser.");
-
- is(Tilt.visualizers[id], null,
- "The current instance of the visualizer wasn't destroyed properly.");
- },
- onEnd: function()
- {
- cleanup();
- }
- }, true, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function cleanup() {
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_05_destruction-esc.js b/browser/devtools/tilt/test/browser_tilt_05_destruction-esc.js
deleted file mode 100644
index 503f79254..000000000
--- a/browser/devtools/tilt/test/browser_tilt_05_destruction-esc.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping destruction test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping destruction test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function()
- {
- tiltOpened = true;
-
- Services.obs.addObserver(finalize, DESTROYED, false);
- EventUtils.sendKey("ESCAPE");
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function finalize() {
- let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
-
- is(Tilt.visualizers[id], null,
- "The current instance of the visualizer wasn't destroyed properly.");
-
- cleanup();
-}
-
-function cleanup() {
- if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_05_destruction-url.js b/browser/devtools/tilt/test/browser_tilt_05_destruction-url.js
deleted file mode 100644
index 61d428218..000000000
--- a/browser/devtools/tilt/test/browser_tilt_05_destruction-url.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping destruction test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping destruction test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function()
- {
- tiltOpened = true;
-
- Services.obs.addObserver(finalize, DESTROYED, false);
- window.content.location = "about:mozilla";
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function finalize() {
- let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
-
- is(Tilt.visualizers[id], null,
- "The current instance of the visualizer wasn't destroyed properly.");
-
- cleanup();
-}
-
-function cleanup() {
- if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_05_destruction.js b/browser/devtools/tilt/test/browser_tilt_05_destruction.js
deleted file mode 100644
index a083fa1bc..000000000
--- a/browser/devtools/tilt/test/browser_tilt_05_destruction.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping destruction test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping destruction test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function()
- {
- tiltOpened = true;
-
- Services.obs.addObserver(finalize, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function finalize() {
- let id = TiltUtils.getWindowId(gBrowser.selectedBrowser.contentWindow);
-
- is(Tilt.visualizers[id], null,
- "The current instance of the visualizer wasn't destroyed properly.");
-
- cleanup();
-}
-
-function cleanup() {
- if (tiltOpened) { Services.obs.removeObserver(finalize, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_arcball-reset-typeahead.js b/browser/devtools/tilt/test/browser_tilt_arcball-reset-typeahead.js
deleted file mode 100644
index 366bfa323..000000000
--- a/browser/devtools/tilt/test/browser_tilt_arcball-reset-typeahead.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping part of the arcball test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping part of the arcball test because WebGL isn't supported.");
- return;
- }
-
- requestLongerTimeout(10);
- waitForExplicitFinish();
- Services.prefs.setBoolPref("accessibility.typeaheadfind", true);
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- tiltOpened = true;
-
- performTest(instance.presenter.canvas,
- instance.controller.arcball, function() {
-
- info("Killing arcball reset test.");
-
- Services.prefs.setBoolPref("accessibility.typeaheadfind", false);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function performTest(canvas, arcball, callback) {
- is(document.activeElement, canvas,
- "The visualizer canvas should be focused when performing this test.");
-
-
- info("Starting arcball reset test.");
-
- // start translating and rotating sometime at random
-
- window.setTimeout(function() {
- info("Synthesizing key down events.");
-
- EventUtils.synthesizeKey("VK_S", { type: "keydown" }); // add a little
- EventUtils.synthesizeKey("VK_RIGHT", { type: "keydown" }); // diversity
-
- // wait for some arcball translations and rotations to happen
-
- window.setTimeout(function() {
- info("Synthesizing key up events.");
-
- EventUtils.synthesizeKey("VK_S", { type: "keyup" });
- EventUtils.synthesizeKey("VK_RIGHT", { type: "keyup" });
-
- // ok, transformations finished, we can now try to reset the model view
-
- window.setTimeout(function() {
- info("Synthesizing arcball reset key press.");
-
- arcball._onResetStart = function() {
- info("Starting arcball reset animation.");
- };
-
- arcball._onResetStep = function() {
- info("\nlastRot: " + quat4.str(arcball._lastRot) +
- "\ndeltaRot: " + quat4.str(arcball._deltaRot) +
- "\ncurrentRot: " + quat4.str(arcball._currentRot) +
- "\nlastTrans: " + vec3.str(arcball._lastTrans) +
- "\ndeltaTrans: " + vec3.str(arcball._deltaTrans) +
- "\ncurrentTrans: " + vec3.str(arcball._currentTrans) +
- "\nadditionalRot: " + vec3.str(arcball._additionalRot) +
- "\nadditionalTrans: " + vec3.str(arcball._additionalTrans) +
- "\nzoomAmount: " + arcball._zoomAmount);
- };
-
- arcball._onResetFinish = function() {
- ok(isApproxVec(arcball._lastRot, [0, 0, 0, 1]),
- "The arcball _lastRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._deltaRot, [0, 0, 0, 1]),
- "The arcball _deltaRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._currentRot, [0, 0, 0, 1]),
- "The arcball _currentRot field wasn't reset correctly.");
-
- ok(isApproxVec(arcball._lastTrans, [0, 0, 0]),
- "The arcball _lastTrans field wasn't reset correctly.");
- ok(isApproxVec(arcball._deltaTrans, [0, 0, 0]),
- "The arcball _deltaTrans field wasn't reset correctly.");
- ok(isApproxVec(arcball._currentTrans, [0, 0, 0]),
- "The arcball _currentTrans field wasn't reset correctly.");
-
- ok(isApproxVec(arcball._additionalRot, [0, 0, 0]),
- "The arcball _additionalRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._additionalTrans, [0, 0, 0]),
- "The arcball _additionalTrans field wasn't reset correctly.");
-
- ok(isApproxVec([arcball._zoomAmount], [0]),
- "The arcball _zoomAmount field wasn't reset correctly.");
-
- executeSoon(function() {
- info("Finishing arcball reset test.");
- callback();
- });
- };
-
- EventUtils.synthesizeKey("VK_R", { type: "keydown" });
-
- }, Math.random() * 1000); // leave enough time for transforms to happen
- }, Math.random() * 1000);
- }, Math.random() * 1000);
-}
-
-function cleanup() {
- info("Cleaning up arcball reset test.");
-
- if (tiltOpened) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_arcball-reset.js b/browser/devtools/tilt/test/browser_tilt_arcball-reset.js
deleted file mode 100644
index 72e11236e..000000000
--- a/browser/devtools/tilt/test/browser_tilt_arcball-reset.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping part of the arcball test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping part of the arcball test because WebGL isn't supported.");
- return;
- }
-
- requestLongerTimeout(10);
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- tiltOpened = true;
-
- performTest(instance.presenter.canvas,
- instance.controller.arcball, function() {
-
- info("Killing arcball reset test.");
-
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function performTest(canvas, arcball, callback) {
- is(document.activeElement, canvas,
- "The visualizer canvas should be focused when performing this test.");
-
-
- info("Starting arcball reset test.");
-
- // start translating and rotating sometime at random
-
- window.setTimeout(function() {
- info("Synthesizing key down events.");
-
- EventUtils.synthesizeKey("VK_W", { type: "keydown" });
- EventUtils.synthesizeKey("VK_LEFT", { type: "keydown" });
-
- // wait for some arcball translations and rotations to happen
-
- window.setTimeout(function() {
- info("Synthesizing key up events.");
-
- EventUtils.synthesizeKey("VK_W", { type: "keyup" });
- EventUtils.synthesizeKey("VK_LEFT", { type: "keyup" });
-
- // ok, transformations finished, we can now try to reset the model view
-
- window.setTimeout(function() {
- info("Synthesizing arcball reset key press.");
-
- arcball._onResetStart = function() {
- info("Starting arcball reset animation.");
- };
-
- arcball._onResetStep = function() {
- info("\nlastRot: " + quat4.str(arcball._lastRot) +
- "\ndeltaRot: " + quat4.str(arcball._deltaRot) +
- "\ncurrentRot: " + quat4.str(arcball._currentRot) +
- "\nlastTrans: " + vec3.str(arcball._lastTrans) +
- "\ndeltaTrans: " + vec3.str(arcball._deltaTrans) +
- "\ncurrentTrans: " + vec3.str(arcball._currentTrans) +
- "\nadditionalRot: " + vec3.str(arcball._additionalRot) +
- "\nadditionalTrans: " + vec3.str(arcball._additionalTrans) +
- "\nzoomAmount: " + arcball._zoomAmount);
- };
-
- arcball._onResetFinish = function() {
- ok(isApproxVec(arcball._lastRot, [0, 0, 0, 1]),
- "The arcball _lastRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._deltaRot, [0, 0, 0, 1]),
- "The arcball _deltaRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._currentRot, [0, 0, 0, 1]),
- "The arcball _currentRot field wasn't reset correctly.");
-
- ok(isApproxVec(arcball._lastTrans, [0, 0, 0]),
- "The arcball _lastTrans field wasn't reset correctly.");
- ok(isApproxVec(arcball._deltaTrans, [0, 0, 0]),
- "The arcball _deltaTrans field wasn't reset correctly.");
- ok(isApproxVec(arcball._currentTrans, [0, 0, 0]),
- "The arcball _currentTrans field wasn't reset correctly.");
-
- ok(isApproxVec(arcball._additionalRot, [0, 0, 0]),
- "The arcball _additionalRot field wasn't reset correctly.");
- ok(isApproxVec(arcball._additionalTrans, [0, 0, 0]),
- "The arcball _additionalTrans field wasn't reset correctly.");
-
- ok(isApproxVec([arcball._zoomAmount], [0]),
- "The arcball _zoomAmount field wasn't reset correctly.");
-
- executeSoon(function() {
- info("Finishing arcball reset test.");
- callback();
- });
- };
-
- EventUtils.synthesizeKey("VK_R", { type: "keydown" });
-
- }, Math.random() * 1000); // leave enough time for transforms to happen
- }, Math.random() * 1000);
- }, Math.random() * 1000);
-}
-
-function cleanup() {
- info("Cleaning up arcball reset test.");
-
- if (tiltOpened) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_arcball.js b/browser/devtools/tilt/test/browser_tilt_arcball.js
deleted file mode 100644
index 3d1078e1b..000000000
--- a/browser/devtools/tilt/test/browser_tilt_arcball.js
+++ /dev/null
@@ -1,496 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function cloneUpdate(update) {
- return {
- rotation: quat4.create(update.rotation),
- translation: vec3.create(update.translation)
- };
-}
-
-function isExpectedUpdate(update1, update2) {
- if (update1.length !== update2.length) {
- return false;
- }
- for (let i = 0, len = update1.length; i < len; i++) {
- if (!isApproxVec(update1[i].rotation, update2[i].rotation) ||
- !isApproxVec(update1[i].translation, update2[i].translation)) {
- info("isExpectedUpdate expected " + JSON.stringify(update1), ", got " +
- JSON.stringify(update2) + " instead.");
- return false;
- }
- }
- return true;
-}
-
-function test() {
- let arcball1 = new TiltVisualizer.Arcball(window, 123, 456);
-
- is(arcball1.width, 123,
- "The first arcball width wasn't set correctly.");
- is(arcball1.height, 456,
- "The first arcball height wasn't set correctly.");
- is(arcball1.radius, 123,
- "The first arcball radius wasn't implicitly set correctly.");
-
-
- let arcball2 = new TiltVisualizer.Arcball(window, 987, 654);
-
- is(arcball2.width, 987,
- "The second arcball width wasn't set correctly.");
- is(arcball2.height, 654,
- "The second arcball height wasn't set correctly.");
- is(arcball2.radius, 654,
- "The second arcball radius wasn't implicitly set correctly.");
-
-
- let arcball3 = new TiltVisualizer.Arcball(window, 512, 512);
-
- let sphereVec = vec3.create();
- arcball3._pointToSphere(123, 456, 256, 512, 512, sphereVec);
-
- ok(isApproxVec(sphereVec, [-0.009765625, 0.390625, 0.9204980731010437]),
- "The _pointToSphere() function didn't map the coordinates correctly.");
-
- let stack1 = [];
- let expect1 = [
- { rotation: [
- -0.08877250552177429, 0.0242881178855896,
- -0.04222869873046875, -0.9948599338531494],
- translation: [0, 0, 0] },
- { rotation: [
- -0.13086390495300293, 0.03413732722401619,
- -0.06334304809570312, -0.9887855648994446],
- translation: [0, 0, 0] },
- { rotation: [
- -0.15138940513134003, 0.03854173421859741,
- -0.07390022277832031, -0.9849540591239929],
- translation: [0, 0, 0] },
- { rotation: [
- -0.1615273654460907, 0.040619146078825,
- -0.0791788101196289, -0.9828477501869202],
- translation: [0, 0, 0] },
- { rotation: [
- -0.16656573116779327, 0.04162723943591118,
- -0.0818181037902832, -0.9817478656768799],
- translation: [0, 0, 0] },
- { rotation: [
- -0.16907735168933868, 0.042123712599277496,
- -0.08313775062561035, -0.9811863303184509],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17033125460147858, 0.042370058596134186,
- -0.08379757404327393, -0.9809026718139648],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17095772922039032, 0.04249274358153343,
- -0.08412748575210571, -0.9807600975036621],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17127084732055664, 0.04255397245287895,
- -0.0842924416065216, -0.9806886315345764],
- translation: [0, 0, 0] },
- { rotation: [
- -0.171427384018898, 0.042584557086229324,
- -0.08437491953372955, -0.9806528687477112],
- translation: [0, 0, 0] }];
-
- arcball3.mouseDown(10, 10, 1);
- arcball3.mouseMove(10, 100);
- for (let i1 = 0; i1 < 10; i1++) {
- stack1.push(cloneUpdate(arcball3.update()));
- }
-
- ok(isExpectedUpdate(stack1, expect1),
- "Mouse down & move events didn't create the expected transform. results.");
-
- let stack2 = [];
- let expect2 = [
- { rotation: [
- -0.1684110015630722, 0.04199237748980522,
- -0.0827873945236206, -0.9813361167907715],
- translation: [0, 0, 0] },
- { rotation: [
- -0.16936375200748444, 0.04218007251620293,
- -0.08328840136528015, -0.9811217188835144],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17003019154071808, 0.04231100529432297,
- -0.08363909274339676, -0.9809709787368774],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17049652338027954, 0.042402446269989014,
- -0.0838845893740654, -0.9808651208877563],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17082282900810242, 0.042466338723897934,
- -0.08405643701553345, -0.9807908535003662],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17105120420455933, 0.04251104220747948,
- -0.08417671173810959, -0.9807388186454773],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17121103405952454, 0.04254228621721268,
- -0.08426092565059662, -0.9807023406028748],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17132291197776794, 0.042564138770103455,
- -0.08431987464427948, -0.9806767106056213],
- translation: [0, 0, 0] },
- { rotation: [
- -0.1714012324810028, 0.04257945716381073,
- -0.08436112850904465, -0.9806588888168335],
- translation: [0, 0, 0] },
- { rotation: [
- -0.17145603895187378, 0.042590171098709106,
- -0.08439001441001892, -0.9806463718414307],
- translation: [0, 0, 0] }];
-
- arcball3.mouseUp(100, 100);
- for (let i2 = 0; i2 < 10; i2++) {
- stack2.push(cloneUpdate(arcball3.update()));
- }
-
- ok(isExpectedUpdate(stack2, expect2),
- "Mouse up events didn't create the expected transformation results.");
-
- let stack3 = [];
- let expect3 = [
- { rotation: [
- -0.17149439454078674, 0.04259764403104782,
- -0.08441022783517838, -0.9806375503540039],
- translation: [0, 0, -1] },
- { rotation: [
- -0.17152123153209686, 0.04260288551449776,
- -0.08442437648773193, -0.980631411075592],
- translation: [0, 0, -1.899999976158142] },
- { rotation: [
- -0.1715400665998459, 0.04260658100247383,
- -0.08443428575992584, -0.9806271195411682],
- translation: [0, 0, -2.7100000381469727] },
- { rotation: [
- -0.17155319452285767, 0.04260912910103798,
- -0.08444121479988098, -0.9806240797042847],
- translation: [0, 0, -3.439000129699707] },
- { rotation: [
- -0.17156240344047546, 0.042610932141542435,
- -0.08444607257843018, -0.9806219935417175],
- translation: [0, 0, -4.095099925994873] },
- { rotation: [
- -0.1715688556432724, 0.042612191289663315,
- -0.08444946259260178, -0.9806205034255981],
- translation: [0, 0, -4.685589790344238] },
- { rotation: [
- -0.17157337069511414, 0.04261308163404465,
- -0.0844518393278122, -0.980619490146637],
- translation: [0, 0, -5.217031002044678] },
- { rotation: [
- -0.17157652974128723, 0.0426136814057827,
- -0.0844535157084465, -0.9806187748908997],
- translation: [0, 0, -5.6953277587890625] },
- { rotation: [
- -0.17157875001430511, 0.04261413961648941,
- -0.08445467799901962, -0.9806182980537415],
- translation: [0, 0, -6.125794887542725] },
- { rotation: [
- -0.17158031463623047, 0.04261442646384239,
- -0.08445550501346588, -0.980617880821228],
- translation: [0, 0, -6.5132155418396] }];
-
- arcball3.zoom(10);
- for (let i3 = 0; i3 < 10; i3++) {
- stack3.push(cloneUpdate(arcball3.update()));
- }
-
- ok(isExpectedUpdate(stack3, expect3),
- "Mouse zoom events didn't create the expected transformation results.");
-
- let stack4 = [];
- let expect4 = [
- { rotation: [
- -0.17158135771751404, 0.04261462762951851,
- -0.08445606380701065, -0.9806176424026489],
- translation: [0, 0, -6.861894130706787] },
- { rotation: [
- -0.1715821474790573, 0.04261479899287224,
- -0.08445646613836288, -0.9806175231933594],
- translation: [0, 0, -7.1757049560546875] },
- { rotation: [
- -0.1715826541185379, 0.0426148846745491,
- -0.08445674180984497, -0.980617344379425],
- translation: [0, 0, -7.458134651184082] },
- { rotation: [
- -0.17158304154872894, 0.04261497035622597,
- -0.08445693552494049, -0.9806172847747803],
- translation: [0, 0, -7.7123212814331055] },
- { rotation: [
- -0.17158329486846924, 0.042615000158548355,
- -0.08445708453655243, -0.9806172251701355],
- translation: [0, 0, -7.941089153289795] },
- { rotation: [
- -0.17158347368240356, 0.04261505603790283,
- -0.084457166492939, -0.9806172251701355],
- translation: [0, 0, -8.146980285644531] },
- { rotation: [
- -0.1715836226940155, 0.04261508584022522,
- -0.08445724099874496, -0.9806171655654907],
- translation: [0, 0, -8.332282066345215] },
- { rotation: [
- -0.17158368229866028, 0.04261508584022522,
- -0.08445728570222855, -0.980617105960846],
- translation: [0, 0, -8.499053955078125] },
- { rotation: [
- -0.17158377170562744, 0.04261511191725731,
- -0.08445732295513153, -0.980617105960846],
- translation: [0, 0, -8.649148941040039] },
- { rotation: [
- -0.17158380150794983, 0.04261511191725731,
- -0.08445733785629272, -0.980617105960846],
- translation: [0, 0, -8.784234046936035] }];
-
- arcball3.keyDown(arcball3.rotateKeys.left);
- arcball3.keyDown(arcball3.rotateKeys.right);
- arcball3.keyDown(arcball3.rotateKeys.up);
- arcball3.keyDown(arcball3.rotateKeys.down);
- arcball3.keyDown(arcball3.panKeys.left);
- arcball3.keyDown(arcball3.panKeys.right);
- arcball3.keyDown(arcball3.panKeys.up);
- arcball3.keyDown(arcball3.panKeys.down);
- for (let i4 = 0; i4 < 10; i4++) {
- stack4.push(cloneUpdate(arcball3.update()));
- }
-
- ok(isExpectedUpdate(stack4, expect4),
- "Key down events didn't create the expected transformation results.");
-
- let stack5 = [];
- let expect5 = [
- { rotation: [
- -0.1715838462114334, 0.04261511191725731,
- -0.08445736765861511, -0.980617105960846],
- translation: [0, 0, -8.905810356140137] },
- { rotation: [
- -0.1715838462114334, 0.04261511191725731,
- -0.08445736765861511, -0.980617105960846],
- translation: [0, 0, -9.015229225158691] },
- { rotation: [
- -0.1715838462114334, 0.04261511191725731,
- -0.08445736765861511, -0.980617105960846],
- translation: [0, 0, -9.113706588745117] },
- { rotation: [
- -0.1715838611125946, 0.04261511191725731,
- -0.0844573825597763, -0.9806170463562012],
- translation: [0, 0, -9.202336311340332] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.282102584838867] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.35389232635498] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.418502807617188] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.476652145385742] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.528986930847168] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.576087951660156] }];
-
- arcball3.keyUp(arcball3.rotateKeys.left);
- arcball3.keyUp(arcball3.rotateKeys.right);
- arcball3.keyUp(arcball3.rotateKeys.up);
- arcball3.keyUp(arcball3.rotateKeys.down);
- arcball3.keyUp(arcball3.panKeys.left);
- arcball3.keyUp(arcball3.panKeys.right);
- arcball3.keyUp(arcball3.panKeys.up);
- arcball3.keyUp(arcball3.panKeys.down);
- for (let i5 = 0; i5 < 10; i5++) {
- stack5.push(cloneUpdate(arcball3.update()));
- }
-
- ok(isExpectedUpdate(stack5, expect5),
- "Key up events didn't create the expected transformation results.");
-
- let stack6 = [];
- let expect6 = [
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -9.618478775024414] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, -6.156630992889404] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 0.4590320587158203] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 9.913128852844238] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 21.921815872192383] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 36.22963333129883] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 52.60667037963867] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 70.84600067138672] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 90.76139831542969] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 112.18525695800781] }];
-
- arcball3.keyDown(arcball3.zoomKeys["in"][0]);
- arcball3.keyDown(arcball3.zoomKeys["in"][1]);
- arcball3.keyDown(arcball3.zoomKeys["in"][2]);
- for (let i6 = 0; i6 < 10; i6++) {
- stack6.push(cloneUpdate(arcball3.update()));
- }
- arcball3.keyUp(arcball3.zoomKeys["in"][0]);
- arcball3.keyUp(arcball3.zoomKeys["in"][1]);
- arcball3.keyUp(arcball3.zoomKeys["in"][2]);
-
- ok(isExpectedUpdate(stack6, expect6),
- "Key zoom in events didn't create the expected transformation results.");
-
- let stack7 = [];
- let expect7 = [
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 134.96673583984375] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 151.97006225585938] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 163.77305603027344] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 170.895751953125] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 173.80618286132812] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 172.92556762695312] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 168.6330108642578] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 161.26971435546875] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 151.1427459716797] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 138.52847290039062] }];
-
- arcball3.keyDown(arcball3.zoomKeys["out"][0]);
- arcball3.keyDown(arcball3.zoomKeys["out"][1]);
- for (let i7 = 0; i7 < 10; i7++) {
- stack7.push(cloneUpdate(arcball3.update()));
- }
- arcball3.keyUp(arcball3.zoomKeys["out"][0]);
- arcball3.keyUp(arcball3.zoomKeys["out"][1]);
-
- ok(isExpectedUpdate(stack7, expect7),
- "Key zoom out events didn't create the expected transformation results.");
-
- let stack8 = [];
- let expect8 = [
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 123.67562866210938] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 111.30806732177734] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 100.17726135253906] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 90.15953826904297] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 81.14358520507812] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 73.02922821044922] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 65.72630310058594] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 59.15367126464844] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 53.238304138183594] },
- { rotation: [
- -0.17158392071723938, 0.0426151417195797,
- -0.0844573974609375, -0.980617105960846],
- translation: [0, 0, 47.91447448730469] }];
-
- arcball3.keyDown(arcball3.zoomKeys["unzoom"]);
- for (let i8 = 0; i8 < 10; i8++) {
- stack8.push(cloneUpdate(arcball3.update()));
- }
- arcball3.keyUp(arcball3.zoomKeys["unzoom"]);
-
- ok(isExpectedUpdate(stack8, expect8),
- "Key zoom reset events didn't create the expected transformation results.");
-
-
- arcball3.resize(123, 456);
- is(arcball3.width, 123,
- "The third arcball width wasn't updated correctly.");
- is(arcball3.height, 456,
- "The third arcball height wasn't updated correctly.");
- is(arcball3.radius, 123,
- "The third arcball radius wasn't implicitly updated correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_controller.js b/browser/devtools/tilt/test/browser_tilt_controller.js
deleted file mode 100644
index 0dbf37aad..000000000
--- a/browser/devtools/tilt/test/browser_tilt_controller.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping controller test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping controller test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- let canvas = instance.presenter.canvas;
- let prev_tran = vec3.create([0, 0, 0]);
- let prev_rot = quat4.create([0, 0, 0, 1]);
-
- function tran() {
- return instance.presenter.transforms.translation;
- }
-
- function rot() {
- return instance.presenter.transforms.rotation;
- }
-
- function save() {
- prev_tran = vec3.create(tran());
- prev_rot = quat4.create(rot());
- }
-
- ok(isEqualVec(tran(), prev_tran),
- "At init, the translation should be zero.");
- ok(isEqualVec(rot(), prev_rot),
- "At init, the rotation should be zero.");
-
-
- function testEventCancel(cancellingEvent) {
- is(document.activeElement, canvas,
- "The visualizer canvas should be focused when performing this test.");
-
- EventUtils.synthesizeKey("VK_A", { type: "keydown" });
- EventUtils.synthesizeKey("VK_LEFT", { type: "keydown" });
- instance.controller._update();
-
- ok(!isEqualVec(tran(), prev_tran),
- "After a translation key is pressed, the vector should change.");
- ok(!isEqualVec(rot(), prev_rot),
- "After a rotation key is pressed, the quaternion should change.");
-
- save();
-
-
- cancellingEvent();
- instance.controller._update();
-
- ok(!isEqualVec(tran(), prev_tran),
- "Even if the canvas lost focus, the vector has some inertia.");
- ok(!isEqualVec(rot(), prev_rot),
- "Even if the canvas lost focus, the quaternion has some inertia.");
-
- save();
-
-
- while (!isEqualVec(tran(), prev_tran) ||
- !isEqualVec(rot(), prev_rot)) {
- instance.controller._update();
- save();
- }
-
- ok(isEqualVec(tran(), prev_tran) && isEqualVec(rot(), prev_rot),
- "After focus lost, the transforms inertia eventually stops.");
- }
-
- info("Setting typeaheadfind to true.");
-
- Services.prefs.setBoolPref("accessibility.typeaheadfind", true);
- testEventCancel(function() {
- EventUtils.synthesizeKey("T", { type: "keydown", altKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("I", { type: "keydown", ctrlKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("L", { type: "keydown", metaKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("T", { type: "keydown", shiftKey: 1 });
- });
-
- info("Setting typeaheadfind to false.");
-
- Services.prefs.setBoolPref("accessibility.typeaheadfind", false);
- testEventCancel(function() {
- EventUtils.synthesizeKey("T", { type: "keydown", altKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("I", { type: "keydown", ctrlKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("L", { type: "keydown", metaKey: 1 });
- });
- testEventCancel(function() {
- EventUtils.synthesizeKey("T", { type: "keydown", shiftKey: 1 });
- });
-
- info("Testing if loosing focus halts any stacked arcball animations.");
-
- testEventCancel(function() {
- gBrowser.selectedBrowser.contentWindow.focus();
- });
- },
- onEnd: function()
- {
- cleanup();
- }
- }, true, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function cleanup() {
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl01.js b/browser/devtools/tilt/test/browser_tilt_gl01.js
deleted file mode 100644
index 7f931d7a3..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl01.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl01 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- ok(renderer,
- "The TiltGL.Renderer constructor should have initialized a new object.");
-
- ok(gl instanceof WebGLRenderingContext,
- "The renderer context wasn't created correctly from the passed canvas.");
-
-
- let clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE),
- clearDepth = gl.getParameter(gl.DEPTH_CLEAR_VALUE);
-
- is(clearColor[0], 0,
- "The default red clear color wasn't set correctly at initialization.");
- is(clearColor[1], 0,
- "The default green clear color wasn't set correctly at initialization.");
- is(clearColor[2], 0,
- "The default blue clear color wasn't set correctly at initialization.");
- is(clearColor[3], 0,
- "The default alpha clear color wasn't set correctly at initialization.");
- is(clearDepth, 1,
- "The default clear depth wasn't set correctly at initialization.");
-
- is(renderer.width, canvas.width,
- "The renderer width wasn't set correctly from the passed canvas.");
- is(renderer.height, canvas.height,
- "The renderer height wasn't set correctly from the passed canvas.");
-
- ok(renderer.mvMatrix,
- "The model view matrix wasn't initialized properly.");
- ok(renderer.projMatrix,
- "The model view matrix wasn't initialized properly.");
-
- ok(isApproxVec(renderer._fillColor, [1, 1, 1, 1]),
- "The default fill color wasn't set correctly.");
- ok(isApproxVec(renderer._strokeColor, [0, 0, 0, 1]),
- "The default stroke color wasn't set correctly.");
- is(renderer._strokeWeightValue, 1,
- "The default stroke weight wasn't set correctly.");
-
- ok(renderer._colorShader,
- "A default color shader should have been created.");
-
- ok(typeof renderer.Program, "function",
- "At init, the renderer should have created a Program constructor.");
- ok(typeof renderer.VertexBuffer, "function",
- "At init, the renderer should have created a VertexBuffer constructor.");
- ok(typeof renderer.IndexBuffer, "function",
- "At init, the renderer should have created a IndexBuffer constructor.");
- ok(typeof renderer.Texture, "function",
- "At init, the renderer should have created a Texture constructor.");
-
- renderer.depthTest(true);
- is(gl.getParameter(gl.DEPTH_TEST), true,
- "The depth test wasn't enabled when requested.");
-
- renderer.depthTest(false);
- is(gl.getParameter(gl.DEPTH_TEST), false,
- "The depth test wasn't disabled when requested.");
-
- renderer.stencilTest(true);
- is(gl.getParameter(gl.STENCIL_TEST), true,
- "The stencil test wasn't enabled when requested.");
-
- renderer.stencilTest(false);
- is(gl.getParameter(gl.STENCIL_TEST), false,
- "The stencil test wasn't disabled when requested.");
-
- renderer.cullFace("front");
- is(gl.getParameter(gl.CULL_FACE), true,
- "The cull face wasn't enabled when requested.");
- is(gl.getParameter(gl.CULL_FACE_MODE), gl.FRONT,
- "The cull face front mode wasn't set correctly.");
-
- renderer.cullFace("back");
- is(gl.getParameter(gl.CULL_FACE), true,
- "The cull face wasn't enabled when requested.");
- is(gl.getParameter(gl.CULL_FACE_MODE), gl.BACK,
- "The cull face back mode wasn't set correctly.");
-
- renderer.cullFace("both");
- is(gl.getParameter(gl.CULL_FACE), true,
- "The cull face wasn't enabled when requested.");
- is(gl.getParameter(gl.CULL_FACE_MODE), gl.FRONT_AND_BACK,
- "The cull face back mode wasn't set correctly.");
-
- renderer.cullFace(false);
- is(gl.getParameter(gl.CULL_FACE), false,
- "The cull face wasn't disabled when requested.");
-
- renderer.frontFace("cw");
- is(gl.getParameter(gl.FRONT_FACE), gl.CW,
- "The front face cw mode wasn't set correctly.");
-
- renderer.frontFace("ccw");
- is(gl.getParameter(gl.FRONT_FACE), gl.CCW,
- "The front face ccw mode wasn't set correctly.");
-
- renderer.blendMode("alpha");
- is(gl.getParameter(gl.BLEND), true,
- "The blend mode wasn't enabled when requested.");
- is(gl.getParameter(gl.BLEND_SRC_ALPHA), gl.SRC_ALPHA,
- "The soruce blend func wasn't set correctly.");
- is(gl.getParameter(gl.BLEND_DST_ALPHA), gl.ONE_MINUS_SRC_ALPHA,
- "The destination blend func wasn't set correctly.");
-
- renderer.blendMode("add");
- is(gl.getParameter(gl.BLEND), true,
- "The blend mode wasn't enabled when requested.");
- is(gl.getParameter(gl.BLEND_SRC_ALPHA), gl.SRC_ALPHA,
- "The soruce blend func wasn't set correctly.");
- is(gl.getParameter(gl.BLEND_DST_ALPHA), gl.ONE,
- "The destination blend func wasn't set correctly.");
-
- renderer.blendMode(false);
- is(gl.getParameter(gl.CULL_FACE), false,
- "The blend mode wasn't disabled when requested.");
-
-
- is(gl.getParameter(gl.CURRENT_PROGRAM), null,
- "No program should be initially set in the WebGL context.");
-
- renderer.useColorShader(new renderer.VertexBuffer([1, 2, 3], 3));
-
- ok(gl.getParameter(gl.CURRENT_PROGRAM) instanceof WebGLProgram,
- "The correct program hasn't been set in the WebGL context.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl02.js b/browser/devtools/tilt/test/browser_tilt_gl02.js
deleted file mode 100644
index a55acdd41..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl02.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl02 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- renderer.fill([1, 0, 0, 1]);
- ok(isApproxVec(renderer._fillColor, [1, 0, 0, 1]),
- "The fill color wasn't set correctly.");
-
- renderer.stroke([0, 1, 0, 1]);
- ok(isApproxVec(renderer._strokeColor, [0, 1, 0, 1]),
- "The stroke color wasn't set correctly.");
-
- renderer.strokeWeight(2);
- is(renderer._strokeWeightValue, 2,
- "The stroke weight wasn't set correctly.");
- is(gl.getParameter(gl.LINE_WIDTH), 2,
- "The stroke weight wasn't applied correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl03.js b/browser/devtools/tilt/test/browser_tilt_gl03.js
deleted file mode 100644
index 491f9279b..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl03.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl03 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- renderer.defaults();
- is(gl.getParameter(gl.DEPTH_TEST), true,
- "The depth test wasn't set to the correct default value.");
- is(gl.getParameter(gl.STENCIL_TEST), false,
- "The stencil test wasn't set to the correct default value.");
- is(gl.getParameter(gl.CULL_FACE), false,
- "The cull face wasn't set to the correct default value.");
- is(gl.getParameter(gl.FRONT_FACE), gl.CCW,
- "The front face wasn't set to the correct default value.");
- is(gl.getParameter(gl.BLEND), true,
- "The blend mode wasn't set to the correct default value.");
- is(gl.getParameter(gl.BLEND_SRC_ALPHA), gl.SRC_ALPHA,
- "The soruce blend func wasn't set to the correct default value.");
- is(gl.getParameter(gl.BLEND_DST_ALPHA), gl.ONE_MINUS_SRC_ALPHA,
- "The destination blend func wasn't set to the correct default value.");
-
-
- ok(isApproxVec(renderer._fillColor, [1, 1, 1, 1]),
- "The fill color wasn't set to the correct default value.");
- ok(isApproxVec(renderer._strokeColor, [0, 0, 0, 1]),
- "The stroke color wasn't set to the correct default value.");
- is(renderer._strokeWeightValue, 1,
- "The stroke weight wasn't set to the correct default value.");
- is(gl.getParameter(gl.LINE_WIDTH), 1,
- "The stroke weight wasn't applied with the correct default value.");
-
-
- ok(isApproxVec(renderer.projMatrix, [
- 1.2071068286895752, 0, 0, 0, 0, -2.4142136573791504, 0, 0, 0, 0,
- -1.0202020406723022, -1, -181.06602478027344, 181.06602478027344,
- 148.14492797851562, 181.06602478027344
- ]), "The default perspective projection matrix wasn't set correctly.");
-
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
- ]), "The default model view matrix wasn't set correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl04.js b/browser/devtools/tilt/test/browser_tilt_gl04.js
deleted file mode 100644
index 4ccfd472a..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl04.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl04 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- renderer.perspective();
- ok(isApproxVec(renderer.projMatrix, [
- 1.2071068286895752, 0, 0, 0, 0, -2.4142136573791504, 0, 0, 0, 0,
- -1.0202020406723022, -1, -181.06602478027344, 181.06602478027344,
- 148.14492797851562, 181.06602478027344
- ]), "The default perspective proj. matrix wasn't calculated correctly.");
-
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
- ]), "Changing the perpective matrix should reset the modelview by default.");
-
-
- renderer.ortho();
- ok(isApproxVec(renderer.projMatrix, [
- 0.006666666828095913, 0, 0, 0, 0, -0.013333333656191826, 0, 0, 0, 0, -1,
- 0, -1, 1, 0, 1
- ]), "The default ortho proj. matrix wasn't calculated correctly.");
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
- ]), "Changing the ortho matrix should reset the modelview by default.");
-
-
- renderer.projection(mat4.perspective(45, 1, 0.1, 100));
- ok(isApproxVec(renderer.projMatrix, [
- 2.4142136573791504, 0, 0, 0, 0, 2.4142136573791504, 0, 0, 0, 0,
- -1.0020020008087158, -1, 0, 0, -0.20020020008087158, 0
- ]), "A custom proj. matrix couldn't be set correctly.");
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
- ]), "Setting a custom proj. matrix should reset the model view by default.");
-
-
- renderer.translate(1, 1, 1);
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1
- ]), "The translation transformation wasn't applied correctly.");
-
- renderer.rotate(0.5, 1, 1, 1);
- ok(isApproxVec(renderer.mvMatrix, [
- 0.9183883666992188, 0.317602276802063, -0.23599065840244293, 0,
- -0.23599065840244293, 0.9183883666992188, 0.317602276802063, 0,
- 0.317602276802063, -0.23599065840244293, 0.9183883666992188, 0, 1, 1, 1, 1
- ]), "The rotation transformation wasn't applied correctly.");
-
- renderer.rotateX(0.5);
- ok(isApproxVec(renderer.mvMatrix, [
- 0.9183883666992188, 0.317602276802063, -0.23599065840244293, 0,
- -0.05483464524149895, 0.6928216814994812, 0.7190210819244385, 0,
- 0.391862154006958, -0.6474001407623291, 0.6536949872970581, 0, 1, 1, 1, 1
- ]), "The X rotation transformation wasn't applied correctly.");
-
- renderer.rotateY(0.5);
- ok(isApproxVec(renderer.mvMatrix, [
- 0.6180928945541382, 0.5891023874282837, -0.5204993486404419, 0,
- -0.05483464524149895, 0.6928216814994812, 0.7190210819244385, 0,
- 0.7841902375221252, -0.4158804416656494, 0.4605313837528229, 0, 1, 1, 1, 1
- ]), "The Y rotation transformation wasn't applied correctly.");
-
- renderer.rotateZ(0.5);
- ok(isApproxVec(renderer.mvMatrix, [
- 0.5161384344100952, 0.8491423726081848, -0.11206408590078354, 0,
- -0.3444514572620392, 0.3255774974822998, 0.8805410265922546, 0,
- 0.7841902375221252, -0.4158804416656494, 0.4605313837528229, 0, 1, 1, 1, 1
- ]), "The Z rotation transformation wasn't applied correctly.");
-
- renderer.scale(2, 2, 2);
- ok(isApproxVec(renderer.mvMatrix, [
- 1.0322768688201904, 1.6982847452163696, -0.22412817180156708, 0,
- -0.6889029145240784, 0.6511549949645996, 1.7610820531845093, 0,
- 1.5683804750442505, -0.8317608833312988, 0.9210627675056458, 0, 1, 1, 1, 1
- ]), "The Z rotation transformation wasn't applied correctly.");
-
- renderer.transform(mat4.create());
- ok(isApproxVec(renderer.mvMatrix, [
- 1.0322768688201904, 1.6982847452163696, -0.22412817180156708, 0,
- -0.6889029145240784, 0.6511549949645996, 1.7610820531845093, 0,
- 1.5683804750442505, -0.8317608833312988, 0.9210627675056458, 0, 1, 1, 1, 1
- ]), "The identity matrix transformation wasn't applied correctly.");
-
- renderer.origin(1, 1, 1);
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
- ]), "The origin wasn't reset to identity correctly.");
-
- renderer.translate(1, 2);
- ok(isApproxVec(renderer.mvMatrix, [
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 0, 1
- ]), "The second translation transformation wasn't applied correctly.");
-
- renderer.scale(3, 4);
- ok(isApproxVec(renderer.mvMatrix, [
- 3, 0, 0, 0, 0, 4, 0, 0, 0, 0, 1, 0, 1, 2, 0, 1
- ]), "The second scale transformation wasn't applied correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl05.js b/browser/devtools/tilt/test/browser_tilt_gl05.js
deleted file mode 100644
index ffc4d1bb6..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl05.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl05 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- let mesh = {
- vertices: new renderer.VertexBuffer([1, 2, 3], 3),
- indices: new renderer.IndexBuffer([1]),
- };
-
- ok(mesh.vertices instanceof TiltGL.VertexBuffer,
- "The mesh vertices weren't saved at initialization.");
- ok(mesh.indices instanceof TiltGL.IndexBuffer,
- "The mesh indices weren't saved at initialization.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl06.js b/browser/devtools/tilt/test/browser_tilt_gl06.js
deleted file mode 100644
index 0f900d1b1..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl06.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl06 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- let vb = new renderer.VertexBuffer([1, 2, 3, 4, 5, 6], 3);
-
- ok(vb instanceof TiltGL.VertexBuffer,
- "The vertex buffer object wasn't instantiated correctly.");
- ok(vb._ref,
- "The vertex buffer gl element wasn't created at initialization.");
- ok(vb.components,
- "The vertex buffer components weren't created at initialization.");
- is(vb.itemSize, 3,
- "The vertex buffer item size isn't set correctly.");
- is(vb.numItems, 2,
- "The vertex buffer number of items weren't calculated correctly.");
-
-
- let ib = new renderer.IndexBuffer([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
-
- ok(ib instanceof TiltGL.IndexBuffer,
- "The index buffer object wasn't instantiated correctly.");
- ok(ib._ref,
- "The index buffer gl element wasn't created at initialization.");
- ok(ib.components,
- "The index buffer components weren't created at initialization.");
- is(ib.itemSize, 1,
- "The index buffer item size isn't set correctly.");
- is(ib.numItems, 10,
- "The index buffer number of items weren't calculated correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl07.js b/browser/devtools/tilt/test/browser_tilt_gl07.js
deleted file mode 100644
index 671a4fa2c..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl07.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl07 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- let p = new renderer.Program({
- vs: TiltGL.ColorShader.vs,
- fs: TiltGL.ColorShader.fs,
- attributes: ["vertexPosition"],
- uniforms: ["mvMatrix", "projMatrix", "fill"]
- });
-
- ok(p instanceof TiltGL.Program,
- "The program object wasn't instantiated correctly.");
-
- ok(p._ref,
- "The program WebGL object wasn't created properly.");
- isnot(p._id, -1,
- "The program id wasn't set properly.");
- ok(p._attributes,
- "The program attributes cache wasn't created properly.");
- ok(p._uniforms,
- "The program uniforms cache wasn't created properly.");
-
- is(typeof p._attributes.vertexPosition, "number",
- "The vertexPosition attribute wasn't cached as it should.");
- is(typeof p._uniforms.mvMatrix, "object",
- "The mvMatrix uniform wasn't cached as it should.");
- is(typeof p._uniforms.projMatrix, "object",
- "The projMatrix uniform wasn't cached as it should.");
- is(typeof p._uniforms.fill, "object",
- "The fill uniform wasn't cached as it should.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_gl08.js b/browser/devtools/tilt/test/browser_tilt_gl08.js
deleted file mode 100644
index 10fff4932..000000000
--- a/browser/devtools/tilt/test/browser_tilt_gl08.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let isWebGLAvailable;
-
-function onWebGLFail() {
- isWebGLAvailable = false;
-}
-
-function onWebGLSuccess() {
- isWebGLAvailable = true;
-}
-
-function test() {
- if (!isWebGLSupported()) {
- info("Skipping tilt_gl08 because WebGL isn't supported on this hardware.");
- return;
- }
-
- let canvas = createCanvas();
-
- let renderer = new TiltGL.Renderer(canvas, onWebGLFail, onWebGLSuccess);
- let gl = renderer.context;
-
- if (!isWebGLAvailable) {
- return;
- }
-
-
- let t = new renderer.Texture({
- source: canvas,
- format: "RGB"
- });
-
- ok(t instanceof TiltGL.Texture,
- "The texture object wasn't instantiated correctly.");
-
- ok(t._ref,
- "The texture WebGL object wasn't created properly.");
- isnot(t._id, -1,
- "The texture id wasn't set properly.");
- isnot(t.width, -1,
- "The texture width wasn't set properly.");
- isnot(t.height, -1,
- "The texture height wasn't set properly.");
- ok(t.loaded,
- "The texture loaded flag wasn't set to true as it should.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math01.js b/browser/devtools/tilt/test/browser_tilt_math01.js
deleted file mode 100644
index da9e23285..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math01.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- ok(isApprox(TiltMath.radians(30), 0.523598775),
- "The radians() function didn't calculate the value correctly.");
-
- ok(isApprox(TiltMath.degrees(0.5), 28.64788975),
- "The degrees() function didn't calculate the value correctly.");
-
- ok(isApprox(TiltMath.map(0.5, 0, 1, 0, 100), 50),
- "The map() function didn't calculate the value correctly.");
-
- is(TiltMath.isPowerOfTwo(32), true,
- "The isPowerOfTwo() function didn't return the expected value.");
-
- is(TiltMath.isPowerOfTwo(33), false,
- "The isPowerOfTwo() function didn't return the expected value.");
-
- ok(isApprox(TiltMath.nextPowerOfTwo(31), 32),
- "The nextPowerOfTwo() function didn't calculate the 1st value correctly.");
-
- ok(isApprox(TiltMath.nextPowerOfTwo(32), 32),
- "The nextPowerOfTwo() function didn't calculate the 2nd value correctly.");
-
- ok(isApprox(TiltMath.nextPowerOfTwo(33), 64),
- "The nextPowerOfTwo() function didn't calculate the 3rd value correctly.");
-
- ok(isApprox(TiltMath.clamp(5, 1, 3), 3),
- "The clamp() function didn't calculate the 1st value correctly.");
-
- ok(isApprox(TiltMath.clamp(5, 3, 1), 3),
- "The clamp() function didn't calculate the 2nd value correctly.");
-
- ok(isApprox(TiltMath.saturate(5), 1),
- "The saturate() function didn't calculate the 1st value correctly.");
-
- ok(isApprox(TiltMath.saturate(-5), 0),
- "The saturate() function didn't calculate the 2nd value correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("#f00"), [1, 0, 0, 1]),
- "The hex2rgba() function didn't calculate the 1st rgba values correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("#f008"), [1, 0, 0, 0.53]),
- "The hex2rgba() function didn't calculate the 2nd rgba values correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("#ff0000"), [1, 0, 0, 1]),
- "The hex2rgba() function didn't calculate the 3rd rgba values correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("#ff0000aa"), [1, 0, 0, 0.66]),
- "The hex2rgba() function didn't calculate the 4th rgba values correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("rgba(255, 0, 0, 0.5)"), [1, 0, 0, 0.5]),
- "The hex2rgba() function didn't calculate the 5th rgba values correctly.");
-
- ok(isApproxVec(TiltMath.hex2rgba("rgb(255, 0, 0)"), [1, 0, 0, 1]),
- "The hex2rgba() function didn't calculate the 6th rgba values correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math02.js b/browser/devtools/tilt/test/browser_tilt_math02.js
deleted file mode 100644
index dae2708c4..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math02.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let v1 = vec3.create();
-
- ok(v1, "Should have created a vector with vec3.create().");
- is(v1.length, 3, "A vec3 should have 3 elements.");
-
- ok(isApproxVec(v1, [0, 0, 0]),
- "When created, a vec3 should have the values default to 0.");
-
- vec3.set([1, 2, 3], v1);
- ok(isApproxVec(v1, [1, 2, 3]),
- "The vec3.set() function didn't set the values correctly.");
-
- vec3.zero(v1);
- ok(isApproxVec(v1, [0, 0, 0]),
- "The vec3.zero() function didn't set the values correctly.");
-
- let v2 = vec3.create([4, 5, 6]);
- ok(isApproxVec(v2, [4, 5, 6]),
- "When cloning arrays, a vec3 should have the values copied.");
-
- let v3 = vec3.create(v2);
- ok(isApproxVec(v3, [4, 5, 6]),
- "When cloning vectors, a vec3 should have the values copied.");
-
- vec3.add(v2, v3);
- ok(isApproxVec(v2, [8, 10, 12]),
- "The vec3.add() function didn't set the x value correctly.");
-
- vec3.subtract(v2, v3);
- ok(isApproxVec(v2, [4, 5, 6]),
- "The vec3.subtract() function didn't set the values correctly.");
-
- vec3.negate(v2);
- ok(isApproxVec(v2, [-4, -5, -6]),
- "The vec3.negate() function didn't set the values correctly.");
-
- vec3.scale(v2, -2);
- ok(isApproxVec(v2, [8, 10, 12]),
- "The vec3.scale() function didn't set the values correctly.");
-
- vec3.normalize(v1);
- ok(isApproxVec(v1, [0, 0, 0]),
- "Normalizing a vector with zero length should return [0, 0, 0].");
-
- vec3.normalize(v2);
- ok(isApproxVec(v2, [
- 0.4558423161506653, 0.5698028802871704, 0.6837634444236755
- ]), "The vec3.normalize() function didn't set the values correctly.");
-
- vec3.cross(v2, v3);
- ok(isApproxVec(v2, [
- 5.960464477539063e-8, -1.1920928955078125e-7, 5.960464477539063e-8
- ]), "The vec3.cross() function didn't set the values correctly.");
-
- vec3.dot(v2, v3);
- ok(isApproxVec(v2, [
- 5.960464477539063e-8, -1.1920928955078125e-7, 5.960464477539063e-8
- ]), "The vec3.dot() function didn't set the values correctly.");
-
- ok(isApproxVec([vec3.length(v2)], [1.4600096599955427e-7]),
- "The vec3.length() function didn't calculate the value correctly.");
-
- vec3.direction(v2, v3);
- ok(isApproxVec(v2, [
- -0.4558422863483429, -0.5698028802871704, -0.6837634444236755
- ]), "The vec3.direction() function didn't set the values correctly.");
-
- vec3.lerp(v2, v3, 0.5);
- ok(isApproxVec(v2, [
- 1.7720788717269897, 2.2150986194610596, 2.65811824798584
- ]), "The vec3.lerp() function didn't set the values correctly.");
-
-
- vec3.project([100, 100, 10], [0, 0, 100, 100],
- mat4.create(), mat4.perspective(45, 1, 0.1, 100), v1);
- ok(isApproxVec(v1, [-1157.10693359375, 1257.10693359375, 0]),
- "The vec3.project() function didn't set the values correctly.");
-
- vec3.unproject([100, 100, 1], [0, 0, 100, 100],
- mat4.create(), mat4.perspective(45, 1, 0.1, 100), v1);
- ok(isApproxVec(v1, [
- 41.420406341552734, -41.420406341552734, -99.99771118164062
- ]), "The vec3.project() function didn't set the values correctly.");
-
-
- let ray = vec3.createRay([10, 10, 0], [100, 100, 1], [0, 0, 100, 100],
- mat4.create(), mat4.perspective(45, 1, 0.1, 100));
-
- ok(isApproxVec(ray.origin, [
- -0.03313708305358887, 0.03313708305358887, -0.1000000014901161
- ]), "The vec3.createRay() function didn't create the position correctly.");
- ok(isApproxVec(ray.direction, [
- 0.35788586614428364, -0.35788586614428364, -0.862458934459091
- ]), "The vec3.createRay() function didn't create the direction correctly.");
-
-
- is(vec3.str([0, 0, 0]), "[0, 0, 0]",
- "The vec3.str() function didn't work properly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math03.js b/browser/devtools/tilt/test/browser_tilt_math03.js
deleted file mode 100644
index 9a039ae77..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math03.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let m1 = mat3.create();
-
- ok(m1, "Should have created a matrix with mat3.create().");
- is(m1.length, 9, "A mat3 should have 9 elements.");
-
- ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
- "When created, a mat3 should have the values default to identity.");
-
- mat3.set([1, 2, 3, 4, 5, 6, 7, 8, 9], m1);
- ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
- "The mat3.set() function didn't set the values correctly.");
-
- mat3.transpose(m1);
- ok(isApproxVec(m1, [1, 4, 7, 2, 5, 8, 3, 6, 9]),
- "The mat3.transpose() function didn't set the values correctly.");
-
- mat3.identity(m1);
- ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
- "The mat3.identity() function didn't set the values correctly.");
-
- let m2 = mat3.toMat4(m1);
- ok(isApproxVec(m2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
- "The mat3.toMat4() function didn't set the values correctly.");
-
-
- is(mat3.str([1, 2, 3, 4, 5, 6, 7, 8, 9]), "[1, 2, 3, 4, 5, 6, 7, 8, 9]",
- "The mat3.str() function didn't work properly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math04.js b/browser/devtools/tilt/test/browser_tilt_math04.js
deleted file mode 100644
index 587dc45fd..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math04.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let m1 = mat4.create();
-
- ok(m1, "Should have created a matrix with mat4.create().");
- is(m1.length, 16, "A mat4 should have 16 elements.");
-
- ok(isApproxVec(m1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
- "When created, a mat4 should have the values default to identity.");
-
- mat4.set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], m1);
- ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
- "The mat4.set() function didn't set the values correctly.");
-
- mat4.transpose(m1);
- ok(isApproxVec(m1, [1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]),
- "The mat4.transpose() function didn't set the values correctly.");
-
- mat4.identity(m1);
- ok(isApproxVec(m1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
- "The mat4.identity() function didn't set the values correctly.");
-
- ok(isApprox(mat4.determinant(m1), 1),
- "The mat4.determinant() function didn't calculate the value correctly.");
-
- let m2 = mat4.inverse([1, 3, 1, 1, 1, 1, 2, 1, 2, 3, 4, 1, 1, 1, 1, 1]);
- ok(isApproxVec(m2, [
- -1, -3, 1, 3, 0.5, 0, 0, -0.5, 0, 1, 0, -1, 0.5, 2, -1, -0.5
- ]), "The mat4.inverse() function didn't calculate the values correctly.");
-
- let m3 = mat4.toRotationMat([
- 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]);
- ok(isApproxVec(m3, [
- 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 0, 0, 0, 1
- ]), "The mat4.toRotationMat() func. didn't calculate the values correctly.");
-
- let m4 = mat4.toMat3([
- 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]);
- ok(isApproxVec(m4, [1, 5, 9, 2, 6, 10, 3, 7, 11]),
- "The mat4.toMat3() function didn't set the values correctly.");
-
- let m5 = mat4.toInverseMat3([
- 1, 3, 1, 1, 1, 1, 2, 1, 2, 3, 4, 1, 1, 1, 1, 1]);
- ok(isApproxVec(m5, [2, 9, -5, 0, -2, 1, -1, -3, 2]),
- "The mat4.toInverseMat3() function didn't set the values correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math05.js b/browser/devtools/tilt/test/browser_tilt_math05.js
deleted file mode 100644
index d39695f55..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math05.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let m1 = mat4.create([
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
-
- let m2 = mat4.create([
- 0, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16]);
-
- mat4.multiply(m1, m2);
- ok(isApproxVec(m1, [
- 275, 302, 329, 356, 304, 336, 368, 400,
- 332, 368, 404, 440, 360, 400, 440, 480
- ]), "The mat4.multiply() function didn't set the values correctly.");
-
- let v1 = mat4.multiplyVec3(m1, [1, 2, 3]);
- ok(isApproxVec(v1, [2239, 2478, 2717]),
- "The mat4.multiplyVec3() function didn't set the values correctly.");
-
- let v2 = mat4.multiplyVec4(m1, [1, 2, 3, 0]);
- ok(isApproxVec(v2, [1879, 2078, 2277, 2476]),
- "The mat4.multiplyVec4() function didn't set the values correctly.");
-
- mat4.translate(m1, [1, 2, 3]);
- ok(isApproxVec(m1, [
- 275, 302, 329, 356, 304, 336, 368, 400,
- 332, 368, 404, 440, 2239, 2478, 2717, 2956
- ]), "The mat4.translate() function didn't set the values correctly.");
-
- mat4.scale(m1, [1, 2, 3]);
- ok(isApproxVec(m1, [
- 275, 302, 329, 356, 608, 672, 736, 800,
- 996, 1104, 1212, 1320, 2239, 2478, 2717, 2956
- ]), "The mat4.scale() function didn't set the values correctly.");
-
- mat4.rotate(m1, 0.5, [1, 1, 1]);
- ok(isApproxVec(m1, [
- 210.6123046875, 230.2483367919922, 249.88438415527344, 269.5204162597656,
- 809.8145751953125, 896.520751953125, 983.2268676757812,
- 1069.9329833984375, 858.5731201171875, 951.23095703125,
- 1043.8887939453125, 1136.5465087890625, 2239, 2478, 2717, 2956
- ]), "The mat4.rotate() function didn't set the values correctly.");
-
- mat4.rotateX(m1, 0.5);
- ok(isApproxVec(m1, [
- 210.6123046875, 230.2483367919922, 249.88438415527344, 269.5204162597656,
- 1122.301025390625, 1242.8154296875, 1363.3297119140625,
- 1483.843994140625, 365.2230224609375, 404.96875, 444.71453857421875,
- 484.460205078125, 2239, 2478, 2717, 2956
- ]), "The mat4.rotateX() function didn't set the values correctly.");
-
- mat4.rotateY(m1, 0.5);
- ok(isApproxVec(m1, [
- 9.732441902160645, 7.909564018249512, 6.086670875549316,
- 4.263822555541992, 1122.301025390625, 1242.8154296875, 1363.3297119140625,
- 1483.843994140625, 421.48626708984375, 465.78045654296875,
- 510.0746765136719, 554.3687744140625, 2239, 2478, 2717, 2956
- ]), "The mat4.rotateY() function didn't set the values correctly.");
-
- mat4.rotateZ(m1, 0.5);
- ok(isApproxVec(m1, [
- 546.6007690429688, 602.7787475585938, 658.9566650390625, 715.1345825195312,
- 980.245849609375, 1086.881103515625, 1193.5162353515625,
- 1300.1514892578125, 421.48626708984375, 465.78045654296875,
- 510.0746765136719, 554.3687744140625, 2239, 2478, 2717, 2956
- ]), "The mat4.rotateZ() function didn't set the values correctly.");
-
-
- let m3 = mat4.frustum(0, 100, 200, 0, 0.1, 100);
- ok(isApproxVec(m3, [
- 0.0020000000949949026, 0, 0, 0, 0, -0.0010000000474974513, 0, 0, 1, -1,
- -1.0020020008087158, -1, 0, 0, -0.20020020008087158, 0
- ]), "The mat4.frustum() function didn't compute the values correctly.");
-
- let m4 = mat4.perspective(45, 1.6, 0.1, 100);
- ok(isApproxVec(m4, [1.5088834762573242, 0, 0, 0, 0, 2.4142136573791504, 0,
- 0, 0, 0, -1.0020020008087158, -1, 0, 0, -0.20020020008087158, 0
- ]), "The mat4.frustum() function didn't compute the values correctly.");
-
- let m5 = mat4.ortho(0, 100, 200, 0, -1, 1);
- ok(isApproxVec(m5, [
- 0.019999999552965164, 0, 0, 0, 0, -0.009999999776482582, 0, 0,
- 0, 0, -1, 0, -1, 1, 0, 1
- ]), "The mat4.ortho() function didn't compute the values correctly.");
-
- let m6 = mat4.lookAt([1, 2, 3], [4, 5, 6], [0, 1, 0]);
- ok(isApproxVec(m6, [
- -0.7071067690849304, -0.40824830532073975, -0.5773502588272095, 0, 0,
- 0.8164966106414795, -0.5773502588272095, 0, 0.7071067690849304,
- -0.40824830532073975, -0.5773502588272095, 0, -1.4142135381698608, 0,
- 3.464101552963257, 1
- ]), "The mat4.lookAt() function didn't compute the values correctly.");
-
-
- is(mat4.str([
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
- "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]",
- "The mat4.str() function didn't work properly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math06.js b/browser/devtools/tilt/test/browser_tilt_math06.js
deleted file mode 100644
index 2ed331eaa..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math06.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let q1 = quat4.create();
-
- ok(q1, "Should have created a quaternion with quat4.create().");
- is(q1.length, 4, "A quat4 should have 4 elements.");
-
- ok(isApproxVec(q1, [0, 0, 0, 1]),
- "When created, a vec3 should have the values default to identity.");
-
- quat4.set([1, 2, 3, 4], q1);
- ok(isApproxVec(q1, [1, 2, 3, 4]),
- "The quat4.set() function didn't set the values correctly.");
-
- quat4.identity(q1);
- ok(isApproxVec(q1, [0, 0, 0, 1]),
- "The quat4.identity() function didn't set the values correctly.");
-
- quat4.set([5, 6, 7, 8], q1);
- ok(isApproxVec(q1, [5, 6, 7, 8]),
- "The quat4.set() function didn't set the values correctly.");
-
- quat4.calculateW(q1);
- ok(isApproxVec(q1, [5, 6, 7, -10.440306663513184]),
- "The quat4.calculateW() function didn't compute the values correctly.");
-
- quat4.inverse(q1);
- ok(isApproxVec(q1, [-5, -6, -7, -10.440306663513184]),
- "The quat4.inverse() function didn't compute the values correctly.");
-
- quat4.normalize(q1);
- ok(isApproxVec(q1, [
- -0.33786869049072266, -0.40544241666793823,
- -0.4730161726474762, -0.7054905295372009
- ]), "The quat4.normalize() function didn't compute the values correctly.");
-
- ok(isApprox(quat4.length(q1), 1),
- "The mat4.length() function didn't calculate the value correctly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_math07.js b/browser/devtools/tilt/test/browser_tilt_math07.js
deleted file mode 100644
index 309d3763d..000000000
--- a/browser/devtools/tilt/test/browser_tilt_math07.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let q1 = quat4.create([1, 2, 3, 4]);
- let q2 = quat4.create([5, 6, 7, 8]);
-
- quat4.multiply(q1, q2);
- ok(isApproxVec(q1, [24, 48, 48, -6]),
- "The quat4.multiply() function didn't set the values correctly.");
-
- let v1 = quat4.multiplyVec3(q1, [9, 9, 9]);
- ok(isApproxVec(v1, [5508, 54756, 59940]),
- "The quat4.multiplyVec3() function didn't set the values correctly.");
-
- let m1 = quat4.toMat3(q1);
- ok(isApproxVec(m1, [
- -9215, 2880, 1728, 1728, -5759, 4896, 2880, 4320, -5759
- ]), "The quat4.toMat3() function didn't set the values correctly.");
-
- let m2 = quat4.toMat4(q1);
- ok(isApproxVec(m2, [
- -9215, 2880, 1728, 0, 1728, -5759, 4896, 0,
- 2880, 4320, -5759, 0, 0, 0, 0, 1
- ]), "The quat4.toMat4() function didn't set the values correctly.");
-
- quat4.calculateW(q1);
- quat4.calculateW(q2);
- quat4.slerp(q1, q2, 0.5);
- ok(isApproxVec(q1, [24, 48, 48, -71.99305725097656]),
- "The quat4.slerp() function didn't set the values correctly.");
-
- let q3 = quat4.fromAxis([1, 1, 1], 0.5);
- ok(isApproxVec(q3, [
- 0.24740396440029144, 0.24740396440029144, 0.24740396440029144,
- 0.9689124226570129
- ]), "The quat4.fromAxis() function didn't compute the values correctly.");
-
- let q4 = quat4.fromEuler(0.5, 0.75, 1.25);
- ok(isApproxVec(q4, [
- 0.15310347080230713, 0.39433568716049194,
- 0.4540249705314636, 0.7841683626174927
- ]), "The quat4.fromEuler() function didn't compute the values correctly.");
-
-
- is(quat4.str([1, 2, 3, 4]), "[1, 2, 3, 4]",
- "The quat4.str() function didn't work properly.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking.js b/browser/devtools/tilt/test/browser_tilt_picking.js
deleted file mode 100644
index c79056a3b..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let pickDone = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping picking test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping picking test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- let presenter = instance.presenter;
- let canvas = presenter.canvas;
-
- presenter._onSetupMesh = function() {
- let p = getPickablePoint(presenter);
-
- presenter.pickNode(p[0], p[1], {
- onpick: function(data)
- {
- ok(data.index > 0,
- "Simply picking a node didn't work properly.");
-
- pickDone = true;
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- }
- });
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function cleanup() {
- if (pickDone) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_delete.js b/browser/devtools/tilt/test/browser_tilt_picking_delete.js
deleted file mode 100644
index c45d44b03..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_delete.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeDeleted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping picking delete test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping picking delete test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenNodeRemoved, NODE_REMOVED, false);
-
- presenter._onSetupMesh = function() {
- let p = getPickablePoint(presenter);
-
- presenter.highlightNodeAt(p[0], p[1], {
- onpick: function()
- {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
-
- nodeDeleted = true;
- presenter.deleteNode();
- }
- });
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenNodeRemoved() {
- ok(presenter._currentSelection > 0,
- "Deleting a node shouldn't change the current selection.");
- ok(presenter._highlight.disabled,
- "After deleting a node, it shouldn't be highlighted.");
-
- let nodeIndex = presenter._currentSelection;
- let vertices = presenter._meshStacks[0].vertices.components;
-
- for (let i = 0, k = 36 * nodeIndex; i < 36; i++) {
- is(vertices[i + k], 0,
- "The stack vertices weren't degenerated properly.");
- }
-
- executeSoon(function() {
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeDeleted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_highlight01-offs.js b/browser/devtools/tilt/test/browser_tilt_picking_highlight01-offs.js
deleted file mode 100644
index abfd4f586..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_highlight01-offs.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeHighlighted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
-
- presenter._onInitializationFinished = function() {
- let contentDocument = presenter.contentWindow.document;
- let div = contentDocument.getElementById("far-far-away");
-
- nodeHighlighted = true;
- presenter.highlightNode(div, "moveIntoView");
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenHighlighting() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
- ok(presenter.controller.arcball._resetInProgress,
- "Highlighting a node that's not already visible should trigger a reset!");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
- Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
- presenter.highlightNode(null);
- });
-}
-
-function whenUnhighlighting() {
- ok(presenter._currentSelection < 0,
- "Unhighlighting a should remove the current selection.");
- ok(presenter._highlight.disabled,
- "After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_highlight01.js b/browser/devtools/tilt/test/browser_tilt_picking_highlight01.js
deleted file mode 100644
index 82871270e..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_highlight01.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeHighlighted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
-
- presenter._onInitializationFinished = function() {
- let contentDocument = presenter.contentWindow.document;
- let div = contentDocument.getElementById("first-law");
-
- nodeHighlighted = true;
- presenter.highlightNode(div, "moveIntoView");
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenHighlighting() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
- ok(!presenter.controller.arcball._resetInProgress,
- "Highlighting a node that's already visible shouldn't trigger a reset.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
- Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
- presenter.highlightNode(null);
- });
-}
-
-function whenUnhighlighting() {
- ok(presenter._currentSelection < 0,
- "Unhighlighting a should remove the current selection.");
- ok(presenter._highlight.disabled,
- "After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_highlight02.js b/browser/devtools/tilt/test/browser_tilt_picking_highlight02.js
deleted file mode 100644
index fc8d0fc51..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_highlight02.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeHighlighted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
-
- presenter._onInitializationFinished = function() {
- nodeHighlighted = true;
- presenter.highlightNodeAt.apply(this, getPickablePoint(presenter));
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenHighlighting() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
- Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
- presenter.highlightNode(null);
- });
-}
-
-function whenUnhighlighting() {
- ok(presenter._currentSelection < 0,
- "Unhighlighting a should remove the current selection.");
- ok(presenter._highlight.disabled,
- "After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_highlight03.js b/browser/devtools/tilt/test/browser_tilt_picking_highlight03.js
deleted file mode 100644
index 721189f65..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_highlight03.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeHighlighted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
-
- presenter._onInitializationFinished = function() {
- nodeHighlighted = true;
- presenter.highlightNodeFor(3); // 1 = html, 2 = body, 3 = first div
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenHighlighting() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
- Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
- presenter.highlightNodeFor(-1);
- });
-}
-
-function whenUnhighlighting() {
- ok(presenter._currentSelection < 0,
- "Unhighlighting a should remove the current selection.");
- ok(presenter._highlight.disabled,
- "After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_inspector.js b/browser/devtools/tilt/test/browser_tilt_picking_inspector.js
deleted file mode 100644
index 0ec302a07..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_inspector.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
- let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
-
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- let contentDocument = toolbox.target.tab.linkedBrowser.contentDocument;
- let div = contentDocument.getElementById("first-law");
- toolbox.getCurrentPanel().selection.setNode(div);
-
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- whenOpen();
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
- });
-}
-
-function whenOpen() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
- ok(!presenter.controller.arcball._resetInProgress,
- "Highlighting a node that's already visible shouldn't trigger a reset.");
-
- executeSoon(function() {
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- Services.obs.removeObserver(cleanup, DESTROYED);
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_picking_miv.js b/browser/devtools/tilt/test/browser_tilt_picking_miv.js
deleted file mode 100644
index 64b911a00..000000000
--- a/browser/devtools/tilt/test/browser_tilt_picking_miv.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let nodeHighlighted = false;
-let presenter;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping highlight test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping highlight test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- createTilt({
- onTiltOpen: function(instance)
- {
- presenter = instance.presenter;
- Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
-
- presenter._onInitializationFinished = function() {
- let contentDocument = presenter.contentWindow.document;
- let div = contentDocument.getElementById("far-far-away");
-
- nodeHighlighted = true;
- presenter.highlightNode(div);
- };
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function whenHighlighting() {
- ok(presenter._currentSelection > 0,
- "Highlighting a node didn't work properly.");
- ok(!presenter._highlight.disabled,
- "After highlighting a node, it should be highlighted. D'oh.");
- ok(!presenter.controller.arcball._resetInProgress,
- "Highlighting a node that's not already visible shouldn't trigger a reset " +
- "without this being explicitly requested!");
-
- EventUtils.sendKey("F");
- executeSoon(whenBringingIntoView);
-}
-
-function whenBringingIntoView() {
- ok(presenter._currentSelection > 0,
- "The node should still be selected.");
- ok(!presenter._highlight.disabled,
- "The node should still be highlighted");
- ok(presenter.controller.arcball._resetInProgress,
- "Highlighting a node that's not already visible should trigger a reset " +
- "when this is being explicitly requested!");
-
- executeSoon(function() {
- Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
-}
-
-function cleanup() {
- if (nodeHighlighted) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils01.js b/browser/devtools/tilt/test/browser_tilt_utils01.js
deleted file mode 100644
index 7beb6a3a2..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils01.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let prefs = TiltUtils.Preferences;
- ok(prefs, "The TiltUtils.Preferences wasn't found.");
-
- prefs.create("test-pref-bool", "boolean", true);
- prefs.create("test-pref-int", "integer", 42);
- prefs.create("test-pref-string", "string", "hello world!");
-
- is(prefs.get("test-pref-bool", "boolean"), true,
- "The boolean test preference wasn't initially set correctly.");
- is(prefs.get("test-pref-int", "integer"), 42,
- "The integer test preference wasn't initially set correctly.");
- is(prefs.get("test-pref-string", "string"), "hello world!",
- "The string test preference wasn't initially set correctly.");
-
-
- prefs.set("test-pref-bool", "boolean", false);
- prefs.set("test-pref-int", "integer", 24);
- prefs.set("test-pref-string", "string", "!dlrow olleh");
-
- is(prefs.get("test-pref-bool", "boolean"), false,
- "The boolean test preference wasn't changed correctly.");
- is(prefs.get("test-pref-int", "integer"), 24,
- "The integer test preference wasn't changed correctly.");
- is(prefs.get("test-pref-string", "string"), "!dlrow olleh",
- "The string test preference wasn't changed correctly.");
-
-
- is(typeof prefs.get("unknown-pref", "boolean"), "undefined",
- "Inexisted boolean prefs should be handled as undefined.");
- is(typeof prefs.get("unknown-pref", "integer"), "undefined",
- "Inexisted integer prefs should be handled as undefined.");
- is(typeof prefs.get("unknown-pref", "string"), "undefined",
- "Inexisted string prefs should be handled as undefined.");
-
-
- is(prefs.get("test-pref-bool", "integer"), null,
- "The get() boolean function didn't handle incorrect types as it should.");
- is(prefs.get("test-pref-bool", "string"), null,
- "The get() boolean function didn't handle incorrect types as it should.");
- is(prefs.get("test-pref-int", "boolean"), null,
- "The get() integer function didn't handle incorrect types as it should.");
- is(prefs.get("test-pref-int", "string"), null,
- "The get() integer function didn't handle incorrect types as it should.");
- is(prefs.get("test-pref-string", "boolean"), null,
- "The get() string function didn't handle incorrect types as it should.");
- is(prefs.get("test-pref-string", "integer"), null,
- "The get() string function didn't handle incorrect types as it should.");
-
-
- is(typeof prefs.get(), "undefined",
- "The get() function should not work if not enough params are passed.");
- is(typeof prefs.set(), "undefined",
- "The set() function should not work if not enough params are passed.");
- is(typeof prefs.create(), "undefined",
- "The create() function should not work if not enough params are passed.");
-
-
- is(prefs.get("test-pref-wrong-type", "wrong-type", 1), null,
- "The get() function should expect only correct pref types.");
- is(prefs.set("test-pref-wrong-type", "wrong-type", 1), false,
- "The set() function should expect only correct pref types.");
- is(prefs.create("test-pref-wrong-type", "wrong-type", 1), false,
- "The create() function should expect only correct pref types.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils02.js b/browser/devtools/tilt/test/browser_tilt_utils02.js
deleted file mode 100644
index fcee265c6..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils02.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let l10 = TiltUtils.L10n;
- ok(l10, "The TiltUtils.L10n wasn't found.");
-
-
- ok(l10.stringBundle,
- "The necessary string bundle wasn't found.");
- is(l10.get(), null,
- "The get() function shouldn't work if no params are passed.");
- is(l10.format(), null,
- "The format() function shouldn't work if no params are passed.");
-
- is(typeof l10.get("initWebGL.error"), "string",
- "No valid string was returned from a corect name in the bundle.");
- is(typeof l10.format("linkProgram.error", ["error"]), "string",
- "No valid formatted string was returned from a name in the bundle.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils03.js b/browser/devtools/tilt/test/browser_tilt_utils03.js
deleted file mode 100644
index 61d256fe1..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils03.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let dom = TiltUtils.DOM;
-
- is(dom.parentNode, null,
- "The parent node should not be initially set.");
-
- dom.parentNode = {};
- ok(dom.parentNode,
- "The parent node should now be set.");
-
- TiltUtils.clearCache();
- is(dom.parentNode, null,
- "The parent node should not be set after clearing the cache.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils04.js b/browser/devtools/tilt/test/browser_tilt_utils04.js
deleted file mode 100644
index 8574c266e..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils04.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- let dom = TiltUtils.DOM;
- ok(dom, "The TiltUtils.DOM wasn't found.");
-
-
- is(dom.initCanvas(), null,
- "The initCanvas() function shouldn't work if no parent node is set.");
-
-
- dom.parentNode = gBrowser.parentNode;
- ok(dom.parentNode,
- "The necessary parent node wasn't found.");
-
-
- let canvas = dom.initCanvas(null, {
- append: true,
- focusable: true,
- width: 123,
- height: 456,
- id: "tilt-test-canvas"
- });
-
- is(canvas.width, 123,
- "The test canvas doesn't have the correct width set.");
- is(canvas.height, 456,
- "The test canvas doesn't have the correct height set.");
- is(canvas.getAttribute("tabindex"), 1,
- "The test canvas tab index wasn't set correctly.");
- is(canvas.getAttribute("id"), "tilt-test-canvas",
- "The test canvas doesn't have the correct id set.");
- ok(dom.parentNode.ownerDocument.getElementById(canvas.id),
- "A canvas should be appended to the parent node if specified.");
- canvas.parentNode.removeChild(canvas);
-
- let canvas2 = dom.initCanvas(null, { id: "tilt-test-canvas2" });
-
- is(canvas2.width, dom.parentNode.clientWidth,
- "The second test canvas doesn't have the implicit width set.");
- is(canvas2.height, dom.parentNode.clientHeight,
- "The second test canvas doesn't have the implicit height set.");
- is(canvas2.id, "tilt-test-canvas2",
- "The second test canvas doesn't have the correct id set.");
- is(dom.parentNode.ownerDocument.getElementById(canvas2.id), null,
- "A canvas shouldn't be appended to the parent node if not specified.");
-
-
- dom.parentNode = null;
- is(dom.parentNode, null,
- "The necessary parent node shouldn't be found anymore.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils05.js b/browser/devtools/tilt/test/browser_tilt_utils05.js
deleted file mode 100644
index 0f09d198e..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils05.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const STACK_THICKNESS = 15;
-
-function init(callback) {
- let iframe = gBrowser.ownerDocument.createElement("iframe");
-
- iframe.addEventListener("load", function onLoad() {
- iframe.removeEventListener("load", onLoad, true);
- callback(iframe);
-
- gBrowser.parentNode.removeChild(iframe);
- finish();
- }, true);
-
- iframe.setAttribute("src", ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<head>",
- "<style>",
- "</style>",
- "<script>",
- "</script>",
- "</head>",
- "<body style='margin: 0;'>",
- "<div style='margin-top: 98px;" +
- "margin-left: 76px;" +
- "width: 123px;" +
- "height: 456px;' id='test-div'>",
- "<span></span>",
- "</div>",
- "</body>",
- "</html>"
- ].join(""));
-
- gBrowser.parentNode.appendChild(iframe);
-}
-
-function test() {
- waitForExplicitFinish();
- ok(TiltUtils, "The TiltUtils object doesn't exist.");
-
- let dom = TiltUtils.DOM;
- ok(dom, "The TiltUtils.DOM wasn't found.");
-
- init(function(iframe) {
- let cwDimensions = dom.getContentWindowDimensions(iframe.contentWindow);
-
- is(cwDimensions.width - iframe.contentWindow.scrollMaxX,
- iframe.contentWindow.innerWidth,
- "The content window width wasn't calculated correctly.");
- is(cwDimensions.height - iframe.contentWindow.scrollMaxY,
- iframe.contentWindow.innerHeight,
- "The content window height wasn't calculated correctly.");
-
- let nodeCoordinates = LayoutHelpers.getRect(
- iframe.contentDocument.getElementById("test-div"), iframe.contentWindow);
-
- let frameOffset = LayoutHelpers.getIframeContentOffset(iframe);
- let frameRect = iframe.getBoundingClientRect();
-
- is(nodeCoordinates.top, frameRect.top + frameOffset[0] + 98,
- "The node coordinates top value wasn't calculated correctly.");
- is(nodeCoordinates.left, frameRect.left + frameOffset[1] + 76,
- "The node coordinates left value wasn't calculated correctly.");
- is(nodeCoordinates.width, 123,
- "The node coordinates width value wasn't calculated correctly.");
- is(nodeCoordinates.height, 456,
- "The node coordinates height value wasn't calculated correctly.");
-
-
- let store = dom.traverse(iframe.contentWindow);
-
- let expected = [
- { name: "html", depth: 0 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "head", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "body", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "style", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "script", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "div", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "span", depth: 3 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- ];
-
- is(store.nodes.length, expected.length,
- "The traverse() function didn't walk the correct number of nodes.");
- is(store.info.length, expected.length,
- "The traverse() function didn't examine the correct number of nodes.");
-
- for (let i = 0; i < expected.length; i++) {
- is(store.info[i].name, expected[i].name,
- "traversed node " + (i + 1) + " isn't the expected one.");
- is(store.info[i].coord.depth, expected[i].depth,
- "traversed node " + (i + 1) + " doesn't have the expected depth.");
- is(store.info[i].coord.thickness, expected[i].thickness,
- "traversed node " + (i + 1) + " doesn't have the expected thickness.");
- }
- });
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils06.js b/browser/devtools/tilt/test/browser_tilt_utils06.js
deleted file mode 100644
index eee915261..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils06.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let someObject = {
- a: 1,
- func: function()
- {
- this.b = 2;
- }
-};
-
-let anotherObject = {
- _finalize: function()
- {
- someObject.c = 3;
- }
-};
-
-function test() {
- ok(TiltUtils, "The TiltUtils object doesn't exist.");
-
- TiltUtils.bindObjectFunc(someObject, "", anotherObject);
- someObject.func();
-
- is(someObject.a, 1,
- "The bindObjectFunc() messed the non-function members of the object.");
- isnot(someObject.b, 2,
- "The bindObjectFunc() didn't ignore the old scope correctly.");
- is(anotherObject.b, 2,
- "The bindObjectFunc() didn't set the new scope correctly.");
-
-
- TiltUtils.destroyObject(anotherObject);
- is(someObject.c, 3,
- "The finalize function wasn't called when an object was destroyed.");
-
-
- TiltUtils.destroyObject(someObject);
- is(typeof someObject.a, "undefined",
- "Not all members of the destroyed object were deleted.");
- is(typeof someObject.func, "undefined",
- "Not all function members of the destroyed object were deleted.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils07.js b/browser/devtools/tilt/test/browser_tilt_utils07.js
deleted file mode 100644
index 0c07300a8..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils07.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const STACK_THICKNESS = 15;
-
-function init(callback) {
- let iframe = gBrowser.ownerDocument.createElement("iframe");
-
- iframe.addEventListener("load", function onLoad() {
- iframe.removeEventListener("load", onLoad, true);
- callback(iframe);
-
- gBrowser.parentNode.removeChild(iframe);
- finish();
- }, true);
-
- iframe.setAttribute("src", ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<frameset cols='50%,50%'>",
- "<frame src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<div id='test-div' style='width: 123px; height: 456px;'></div>",
- "</body>",
- "</html>"
- ].join(""),
- "' />",
- "<frame src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<span></span>",
- "</body>",
- "</html>"
- ].join(""),
- "' />",
- "</frameset>",
- "<iframe src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body>",
- "<span></span>",
- "</body>",
- "</html>"
- ].join(""),
- "'></iframe>",
- "<frame src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<span></span>",
- "</body>",
- "</html>"
- ].join(""),
- "' />",
- "<frame src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<iframe src='",
- ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body>",
- "<div></div>",
- "</body>",
- "</html>"
- ].join(""),
- "'></iframe>",
- "</body>",
- "</html>"
- ].join(""),
- "' />",
- "</body>",
- "</html>"
- ].join(""));
-
- gBrowser.parentNode.appendChild(iframe);
-}
-
-function test() {
- waitForExplicitFinish();
- ok(TiltUtils, "The TiltUtils object doesn't exist.");
-
- let dom = TiltUtils.DOM;
- ok(dom, "The TiltUtils.DOM wasn't found.");
-
- init(function(iframe) {
- let cwDimensions = dom.getContentWindowDimensions(iframe.contentWindow);
-
- is(cwDimensions.width - iframe.contentWindow.scrollMaxX,
- iframe.contentWindow.innerWidth,
- "The content window width wasn't calculated correctly.");
- is(cwDimensions.height - iframe.contentWindow.scrollMaxY,
- iframe.contentWindow.innerHeight,
- "The content window height wasn't calculated correctly.");
-
- let nodeCoordinates = LayoutHelpers.getRect(
- iframe.contentDocument.getElementById("test-div"), iframe.contentWindow);
-
- let frameOffset = LayoutHelpers.getIframeContentOffset(iframe);
- let frameRect = iframe.getBoundingClientRect();
-
- is(nodeCoordinates.top, frameRect.top + frameOffset[0],
- "The node coordinates top value wasn't calculated correctly.");
- is(nodeCoordinates.left, frameRect.left + frameOffset[1],
- "The node coordinates left value wasn't calculated correctly.");
- is(nodeCoordinates.width, 123,
- "The node coordinates width value wasn't calculated correctly.");
- is(nodeCoordinates.height, 456,
- "The node coordinates height value wasn't calculated correctly.");
-
-
- let store = dom.traverse(iframe.contentWindow);
-
- let expected = [
- { name: "html", depth: 0 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "head", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "body", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "div", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "span", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "iframe", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "span", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "iframe", depth: 2 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "html", depth: 3 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "html", depth: 3 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "head", depth: 4 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "body", depth: 4 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "head", depth: 4 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "body", depth: 4 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "span", depth: 5 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "div", depth: 5 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- ];
-
- is(store.nodes.length, expected.length,
- "The traverse() function didn't walk the correct number of nodes.");
- is(store.info.length, expected.length,
- "The traverse() function didn't examine the correct number of nodes.");
-
- for (let i = 0; i < expected.length; i++) {
- is(store.info[i].name, expected[i].name,
- "traversed node " + (i + 1) + " isn't the expected one.");
- is(store.info[i].coord.depth, expected[i].depth,
- "traversed node " + (i + 1) + " doesn't have the expected depth.");
- is(store.info[i].coord.thickness, expected[i].thickness,
- "traversed node " + (i + 1) + " doesn't have the expected thickness.");
- }
- });
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_utils08.js b/browser/devtools/tilt/test/browser_tilt_utils08.js
deleted file mode 100644
index 797c9e7a7..000000000
--- a/browser/devtools/tilt/test/browser_tilt_utils08.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const STACK_THICKNESS = 15;
-
-function init(callback) {
- let iframe = gBrowser.ownerDocument.createElement("iframe");
-
- iframe.addEventListener("load", function onLoad() {
- iframe.removeEventListener("load", onLoad, true);
- callback(iframe);
-
- gBrowser.parentNode.removeChild(iframe);
- finish();
- }, true);
-
- iframe.setAttribute("src", ["data:text/html,",
- "<!DOCTYPE html>",
- "<html>",
- "<body style='margin: 0;'>",
- "<div>",
- "<p>Foo</p>",
- "<div>",
- "<span>Bar</span>",
- "</div>",
- "<div></div>",
- "</div>",
- "</body>",
- "</html>"
- ].join(""));
-
- gBrowser.parentNode.appendChild(iframe);
-}
-
-function nodeCallback(aContentWindow, aNode, aParentPosition) {
- let coord = TiltUtils.DOM.getNodePosition(aContentWindow, aNode, aParentPosition);
-
- if (aNode.localName != "div")
- coord.thickness = 0;
-
- if (aNode.localName == "span")
- coord.depth += STACK_THICKNESS;
-
- return coord;
-}
-
-function test() {
- waitForExplicitFinish();
- ok(TiltUtils, "The TiltUtils object doesn't exist.");
-
- let dom = TiltUtils.DOM;
- ok(dom, "The TiltUtils.DOM wasn't found.");
-
- init(function(iframe) {
- let store = dom.traverse(iframe.contentWindow, {
- nodeCallback: nodeCallback
- });
-
- let expected = [
- { name: "html", depth: 0 * STACK_THICKNESS, thickness: 0 },
- { name: "head", depth: 0 * STACK_THICKNESS, thickness: 0 },
- { name: "body", depth: 0 * STACK_THICKNESS, thickness: 0 },
- { name: "div", depth: 0 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "p", depth: 1 * STACK_THICKNESS, thickness: 0 },
- { name: "div", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "div", depth: 1 * STACK_THICKNESS, thickness: STACK_THICKNESS },
- { name: "span", depth: 3 * STACK_THICKNESS, thickness: 0 },
- ];
-
- is(store.nodes.length, expected.length,
- "The traverse() function didn't walk the correct number of nodes.");
- is(store.info.length, expected.length,
- "The traverse() function didn't examine the correct number of nodes.");
-
- for (let i = 0; i < expected.length; i++) {
- is(store.info[i].name, expected[i].name,
- "traversed node " + (i + 1) + " isn't the expected one.");
- is(store.info[i].coord.depth, expected[i].depth,
- "traversed node " + (i + 1) + " doesn't have the expected depth.");
- is(store.info[i].coord.thickness, expected[i].thickness,
- "traversed node " + (i + 1) + " doesn't have the expected thickness.");
- }
- });
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_visualizer.js b/browser/devtools/tilt/test/browser_tilt_visualizer.js
deleted file mode 100644
index bc7c2bc18..000000000
--- a/browser/devtools/tilt/test/browser_tilt_visualizer.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping notifications test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping visualizer test because WebGL isn't supported.");
- return;
- }
-
- let webGLError = false;
- let webGLLoad = false;
-
- let visualizer = new TiltVisualizer({
- chromeWindow: window,
- contentWindow: gBrowser.selectedBrowser.contentWindow,
- parentNode: gBrowser.selectedBrowser.parentNode,
- notifications: Tilt.NOTIFICATIONS,
- tab: gBrowser.selectedTab,
-
- onError: function onWebGLError()
- {
- webGLError = true;
- },
-
- onLoad: function onWebGLLoad()
- {
- webGLLoad = true;
- }
- });
- visualizer.init();
-
- ok(webGLError ^ webGLLoad,
- "The WebGL context should either be created or not.");
-
- if (webGLError) {
- info("Skipping visualizer test because WebGL couldn't be initialized.");
- return;
- }
-
- ok(visualizer.canvas,
- "Visualizer constructor should have created a child canvas object.");
- ok(visualizer.presenter,
- "Visualizer constructor should have created a child presenter object.");
- ok(visualizer.controller,
- "Visualizer constructor should have created a child controller object.");
- ok(visualizer.isInitialized(),
- "The visualizer should have been initialized properly.");
- ok(visualizer.presenter.isInitialized(),
- "The visualizer presenter should have been initialized properly.");
- ok(visualizer.controller.isInitialized(),
- "The visualizer controller should have been initialized properly.");
-
- testPresenter(visualizer.presenter);
- testController(visualizer.controller);
-
- visualizer.removeOverlay();
- is(visualizer.canvas.parentNode, null,
- "The visualizer canvas wasn't removed from the parent node.");
-
- visualizer.cleanup();
- is(visualizer.presenter, undefined,
- "The visualizer presenter wasn't destroyed.");
- is(visualizer.controller, undefined,
- "The visualizer controller wasn't destroyed.");
- is(visualizer.canvas, undefined,
- "The visualizer canvas wasn't destroyed.");
-}
-
-function testPresenter(presenter) {
- ok(presenter._renderer,
- "The presenter renderer wasn't initialized properly.");
- ok(presenter._visualizationProgram,
- "The presenter visualizationProgram wasn't initialized properly.");
- ok(presenter._texture,
- "The presenter texture wasn't initialized properly.");
- ok(!presenter._meshStacks,
- "The presenter meshStacks shouldn't be initialized yet.");
- ok(!presenter._meshWireframe,
- "The presenter meshWireframe shouldn't be initialized yet.");
- ok(presenter._traverseData,
- "The presenter nodesInformation wasn't initialized properly.");
- ok(presenter._highlight,
- "The presenter highlight wasn't initialized properly.");
- ok(presenter._highlight.disabled,
- "The presenter highlight should be initially disabled.");
- ok(isApproxVec(presenter._highlight.v0, [0, 0, 0]),
- "The presenter highlight first vertex should be initially zeroed.");
- ok(isApproxVec(presenter._highlight.v1, [0, 0, 0]),
- "The presenter highlight second vertex should be initially zeroed.");
- ok(isApproxVec(presenter._highlight.v2, [0, 0, 0]),
- "The presenter highlight third vertex should be initially zeroed.");
- ok(isApproxVec(presenter._highlight.v3, [0, 0, 0]),
- "The presenter highlight fourth vertex should be initially zeroed.");
- ok(presenter.transforms,
- "The presenter transforms wasn't initialized properly.");
- is(presenter.transforms.zoom, 1,
- "The presenter transforms zoom should be initially 1.");
- ok(isApproxVec(presenter.transforms.offset, [0, 0, 0]),
- "The presenter transforms offset should be initially zeroed.");
- ok(isApproxVec(presenter.transforms.translation, [0, 0, 0]),
- "The presenter transforms translation should be initially zeroed.");
- ok(isApproxVec(presenter.transforms.rotation, [0, 0, 0, 1]),
- "The presenter transforms rotation should be initially set to identity.");
-
- presenter.setTranslation([1, 2, 3]);
- presenter.setRotation([5, 6, 7, 8]);
-
- ok(isApproxVec(presenter.transforms.translation, [1, 2, 3]),
- "The presenter transforms translation wasn't modified as it should");
- ok(isApproxVec(presenter.transforms.rotation, [5, 6, 7, 8]),
- "The presenter transforms rotation wasn't modified as it should");
- ok(presenter._redraw,
- "The new transforms should have issued a redraw request.");
-}
-
-function testController(controller) {
- ok(controller.arcball,
- "The controller arcball wasn't initialized properly.");
- ok(!controller.coordinates,
- "The presenter meshWireframe shouldn't be initialized yet.");
-}
diff --git a/browser/devtools/tilt/test/browser_tilt_zoom.js b/browser/devtools/tilt/test/browser_tilt_zoom.js
deleted file mode 100644
index af6ac2c91..000000000
--- a/browser/devtools/tilt/test/browser_tilt_zoom.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-const ZOOM = 2;
-const RESIZE = 50;
-let tiltOpened = false;
-
-function test() {
- if (!isTiltEnabled()) {
- info("Skipping controller test because Tilt isn't enabled.");
- return;
- }
- if (!isWebGLSupported()) {
- info("Skipping controller test because WebGL isn't supported.");
- return;
- }
-
- waitForExplicitFinish();
-
- createTab(function() {
- TiltUtils.setDocumentZoom(window, ZOOM);
-
- createTilt({
- onTiltOpen: function(instance)
- {
- tiltOpened = true;
-
- ok(isApprox(instance.presenter._getPageZoom(), ZOOM),
- "The Highlighter zoom doesn't have the expected results.");
-
- ok(isApprox(instance.presenter.transforms.zoom, ZOOM),
- "The presenter transforms zoom wasn't initially set correctly.");
-
- let contentWindow = gBrowser.selectedBrowser.contentWindow;
- let initialWidth = contentWindow.innerWidth;
- let initialHeight = contentWindow.innerHeight;
-
- let renderer = instance.presenter._renderer;
- let arcball = instance.controller.arcball;
-
- ok(isApprox(contentWindow.innerWidth * ZOOM, renderer.width, 1),
- "The renderer width wasn't set correctly before the resize.");
- ok(isApprox(contentWindow.innerHeight * ZOOM, renderer.height, 1),
- "The renderer height wasn't set correctly before the resize.");
-
- ok(isApprox(contentWindow.innerWidth * ZOOM, arcball.width, 1),
- "The arcball width wasn't set correctly before the resize.");
- ok(isApprox(contentWindow.innerHeight * ZOOM, arcball.height, 1),
- "The arcball height wasn't set correctly before the resize.");
-
-
- window.resizeBy(-RESIZE * ZOOM, -RESIZE * ZOOM);
-
- executeSoon(function() {
- ok(isApprox(contentWindow.innerWidth + RESIZE, initialWidth, 1),
- "The content window width wasn't set correctly after the resize.");
- ok(isApprox(contentWindow.innerHeight + RESIZE, initialHeight, 1),
- "The content window height wasn't set correctly after the resize.");
-
- ok(isApprox(contentWindow.innerWidth * ZOOM, renderer.width, 1),
- "The renderer width wasn't set correctly after the resize.");
- ok(isApprox(contentWindow.innerHeight * ZOOM, renderer.height, 1),
- "The renderer height wasn't set correctly after the resize.");
-
- ok(isApprox(contentWindow.innerWidth * ZOOM, arcball.width, 1),
- "The arcball width wasn't set correctly after the resize.");
- ok(isApprox(contentWindow.innerHeight * ZOOM, arcball.height, 1),
- "The arcball height wasn't set correctly after the resize.");
-
-
- window.resizeBy(RESIZE * ZOOM, RESIZE * ZOOM);
-
-
- Services.obs.addObserver(cleanup, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
- }
- }, false, function suddenDeath()
- {
- info("Tilt could not be initialized properly.");
- cleanup();
- });
- });
-}
-
-function cleanup() {
- if (tiltOpened) { Services.obs.removeObserver(cleanup, DESTROYED); }
- gBrowser.removeCurrentTab();
- finish();
-}
diff --git a/browser/devtools/tilt/test/head.js b/browser/devtools/tilt/test/head.js
deleted file mode 100644
index 25482ead6..000000000
--- a/browser/devtools/tilt/test/head.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let {devtools} = Components.utils.import("resource://gre/modules/devtools/Loader.jsm", {});
-let TiltManager = devtools.require("devtools/tilt/tilt").TiltManager;
-let TiltGL = devtools.require("devtools/tilt/tilt-gl");
-let {EPSILON, TiltMath, vec3, mat3, mat4, quat4} = devtools.require("devtools/tilt/tilt-math");
-let TiltUtils = devtools.require("devtools/tilt/tilt-utils");
-let {TiltVisualizer} = devtools.require("devtools/tilt/tilt-visualizer");
-
-let tempScope = {};
-Components.utils.import("resource:///modules/devtools/LayoutHelpers.jsm", tempScope);
-let LayoutHelpers = tempScope.LayoutHelpers;
-
-
-const DEFAULT_HTML = "data:text/html," +
- "<DOCTYPE html>" +
- "<html>" +
- "<head>" +
- "<meta charset='utf-8'/>" +
- "<title>Three Laws</title>" +
- "</head>" +
- "<body>" +
- "<div id='first-law'>" +
- "A robot may not injure a human being or, through inaction, allow a " +
- "human being to come to harm." +
- "</div>" +
- "<div>" +
- "A robot must obey the orders given to it by human beings, except " +
- "where such orders would conflict with the First Law." +
- "</div>" +
- "<div>" +
- "A robot must protect its own existence as long as such protection " +
- "does not conflict with the First or Second Laws." +
- "</div>" +
- "<div id='far-far-away' style='position: absolute; top: 250%;'>" +
- "I like bacon." +
- "</div>" +
- "<body>" +
- "</html>";
-
-let Tilt = TiltManager.getTiltForBrowser(window);
-
-const STARTUP = Tilt.NOTIFICATIONS.STARTUP;
-const INITIALIZING = Tilt.NOTIFICATIONS.INITIALIZING;
-const INITIALIZED = Tilt.NOTIFICATIONS.INITIALIZED;
-const DESTROYING = Tilt.NOTIFICATIONS.DESTROYING;
-const BEFORE_DESTROYED = Tilt.NOTIFICATIONS.BEFORE_DESTROYED;
-const DESTROYED = Tilt.NOTIFICATIONS.DESTROYED;
-const SHOWN = Tilt.NOTIFICATIONS.SHOWN;
-const HIDDEN = Tilt.NOTIFICATIONS.HIDDEN;
-const HIGHLIGHTING = Tilt.NOTIFICATIONS.HIGHLIGHTING;
-const UNHIGHLIGHTING = Tilt.NOTIFICATIONS.UNHIGHLIGHTING;
-const NODE_REMOVED = Tilt.NOTIFICATIONS.NODE_REMOVED;
-
-const TILT_ENABLED = Services.prefs.getBoolPref("devtools.tilt.enabled");
-
-
-function isTiltEnabled() {
- info("Apparently, Tilt is" + (TILT_ENABLED ? "" : " not") + " enabled.");
- return TILT_ENABLED;
-}
-
-function isWebGLSupported() {
- let supported = !TiltGL.isWebGLForceEnabled() &&
- TiltGL.isWebGLSupported() &&
- TiltGL.create3DContext(createCanvas());
-
- info("Apparently, WebGL is" + (supported ? "" : " not") + " supported.");
- return supported;
-}
-
-function isApprox(num1, num2, delta) {
- if (Math.abs(num1 - num2) > (delta || EPSILON)) {
- info("isApprox expected " + num1 + ", got " + num2 + " instead.");
- return false;
- }
- return true;
-}
-
-function isApproxVec(vec1, vec2, delta) {
- vec1 = Array.prototype.slice.call(vec1);
- vec2 = Array.prototype.slice.call(vec2);
-
- if (vec1.length !== vec2.length) {
- return false;
- }
- for (let i = 0, len = vec1.length; i < len; i++) {
- if (!isApprox(vec1[i], vec2[i], delta)) {
- info("isApproxVec expected [" + vec1 + "], got [" + vec2 + "] instead.");
- return false;
- }
- }
- return true;
-}
-
-function isEqualVec(vec1, vec2) {
- vec1 = Array.prototype.slice.call(vec1);
- vec2 = Array.prototype.slice.call(vec2);
-
- if (vec1.length !== vec2.length) {
- return false;
- }
- for (let i = 0, len = vec1.length; i < len; i++) {
- if (vec1[i] !== vec2[i]) {
- info("isEqualVec expected [" + vec1 + "], got [" + vec2 + "] instead.");
- return false;
- }
- }
- return true;
-}
-
-function createCanvas() {
- return document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
-}
-
-
-function createTab(callback, location) {
- info("Creating a tab, with callback " + typeof callback +
- ", and location " + location + ".");
-
- let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- callback(tab);
- }, true);
-
- gBrowser.selectedBrowser.contentWindow.location = location || DEFAULT_HTML;
- return tab;
-}
-
-
-function createTilt(callbacks, close, suddenDeath) {
- info("Creating Tilt, with callbacks {" + Object.keys(callbacks) + "}" +
- ", autoclose param " + close +
- ", and sudden death handler " + typeof suddenDeath + ".");
-
- handleFailure(suddenDeath);
-
- Services.prefs.setBoolPref("webgl.verbose", true);
- TiltUtils.Output.suppressAlerts = true;
-
- info("Attempting to start Tilt.");
- Services.obs.addObserver(onTiltOpen, INITIALIZING, false);
- Tilt.toggle();
-
- function onTiltOpen() {
- info("Tilt was opened.");
- Services.obs.removeObserver(onTiltOpen, INITIALIZING);
-
- executeSoon(function() {
- if ("function" === typeof callbacks.onTiltOpen) {
- info("Calling 'onTiltOpen'.");
- callbacks.onTiltOpen(Tilt.visualizers[Tilt.currentWindowId]);
- }
- if (close) {
- executeSoon(function() {
- info("Attempting to close Tilt.");
- Services.obs.addObserver(onTiltClose, DESTROYED, false);
- Tilt.destroy(Tilt.currentWindowId);
- });
- }
- });
- }
-
- function onTiltClose() {
- info("Tilt was closed.");
- Services.obs.removeObserver(onTiltClose, DESTROYED);
-
- executeSoon(function() {
- if ("function" === typeof callbacks.onTiltClose) {
- info("Calling 'onTiltClose'.");
- callbacks.onTiltClose();
- }
- if ("function" === typeof callbacks.onEnd) {
- info("Calling 'onEnd'.");
- callbacks.onEnd();
- }
- });
- }
-
- function handleFailure(suddenDeath) {
- Tilt.failureCallback = function() {
- info("Tilt FAIL.");
- Services.obs.removeObserver(onTiltOpen, INITIALIZING);
-
- info("Now relying on sudden death handler " + typeof suddenDeath + ".");
- suddenDeath && suddenDeath();
- }
- }
-}
-
-function getPickablePoint(presenter) {
- let vertices = presenter._meshStacks[0].vertices.components;
-
- let topLeft = vec3.create([vertices[0], vertices[1], vertices[2]]);
- let bottomRight = vec3.create([vertices[6], vertices[7], vertices[8]]);
- let center = vec3.lerp(topLeft, bottomRight, 0.5, []);
-
- let renderer = presenter._renderer;
- let viewport = [0, 0, renderer.width, renderer.height];
-
- return vec3.project(center, viewport, renderer.mvMatrix, renderer.projMatrix);
-}
diff --git a/browser/devtools/tilt/test/moz.build b/browser/devtools/tilt/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/tilt/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/webconsole/moz.build b/browser/devtools/webconsole/moz.build
index 5abe8b3be..6ecebe123 100644
--- a/browser/devtools/webconsole/moz.build
+++ b/browser/devtools/webconsole/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/devtools/webconsole/test/Makefile.in b/browser/devtools/webconsole/test/Makefile.in
deleted file mode 100644
index f4a8ca682..000000000
--- a/browser/devtools/webconsole/test/Makefile.in
+++ /dev/null
@@ -1,245 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_webconsole_notifications.js \
- browser_webconsole_message_node_id.js \
- browser_webconsole_bug_580030_errors_after_page_reload.js \
- browser_webconsole_basic_net_logging.js \
- browser_webconsole_bug_579412_input_focus.js \
- browser_webconsole_bug_580001_closing_after_completion.js \
- browser_webconsole_bug_580400_groups.js \
- browser_webconsole_bug_588730_text_node_insertion.js \
- browser_webconsole_bug_601667_filter_buttons.js \
- browser_webconsole_bug_597136_external_script_errors.js \
- browser_webconsole_bug_597136_network_requests_from_chrome.js \
- browser_webconsole_completion.js \
- browser_webconsole_console_logging_api.js \
- browser_webconsole_change_font_size.js \
- browser_webconsole_chrome.js \
- browser_webconsole_execution_scope.js \
- browser_webconsole_for_of.js \
- browser_webconsole_history.js \
- browser_webconsole_js_input_and_output_styling.js \
- browser_webconsole_js_input_expansion.js \
- browser_webconsole_live_filtering_of_message_types.js \
- browser_webconsole_live_filtering_on_search_strings.js \
- browser_warn_user_about_replaced_api.js \
- browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js \
- browser_webconsole_bug_586388_select_all.js \
- browser_webconsole_bug_588967_input_expansion.js \
- browser_webconsole_log_node_classes.js \
- browser_webconsole_network_panel.js \
- browser_webconsole_jsterm.js \
- browser_webconsole_null_and_undefined_output.js \
- browser_webconsole_output_order.js \
- browser_webconsole_property_provider.js \
- browser_webconsole_bug_587617_output_copy.js \
- browser_webconsole_bug_585237_line_limit.js \
- browser_webconsole_bug_582201_duplicate_errors.js \
- browser_webconsole_bug_580454_timestamp_l10n.js \
- browser_webconsole_netlogging.js \
- browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js \
- browser_webconsole_bug_734061_No_input_change_and_Tab_key_pressed.js \
- browser_webconsole_bug_594477_clickable_output.js \
- browser_webconsole_bug_589162_css_filter.js \
- browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js \
- browser_webconsole_bug_595350_multiple_windows_and_tabs.js \
- browser_webconsole_bug_594497_history_arrow_keys.js \
- browser_webconsole_bug_588342_document_focus.js \
- browser_webconsole_bug_595934_message_categories.js \
- browser_webconsole_bug_601352_scroll.js \
- browser_webconsole_bug_592442_closing_brackets.js \
- browser_webconsole_bug_593003_iframe_wrong_hud.js \
- browser_webconsole_bug_613013_console_api_iframe.js \
- browser_webconsole_bug_597756_reopen_closed_tab.js \
- browser_webconsole_bug_600183_charset.js \
- browser_webconsole_bug_601177_log_levels.js \
- browser_webconsole_bug_597460_filter_scroll.js \
- browser_webconsole_console_extras.js \
- browser_webconsole_bug_598357_jsterm_output.js \
- browser_webconsole_bug_603750_websocket.js \
- browser_webconsole_abbreviate_source_url.js \
- browser_webconsole_view_source.js \
- browser_webconsole_bug_602572_log_bodies_checkbox.js \
- browser_webconsole_bug_614793_jsterm_scroll.js \
- browser_webconsole_bug_599725_response_headers.js \
- browser_webconsole_bug_613642_maintain_scroll.js \
- browser_webconsole_bug_613642_prune_scroll.js \
- browser_webconsole_bug_618078_network_exceptions.js \
- browser_webconsole_bug_613280_jsterm_copy.js \
- browser_webconsole_bug_630733_response_redirect_headers.js \
- browser_webconsole_bug_621644_jsterm_dollar.js \
- browser_webconsole_bug_632817.js \
- browser_webconsole_bug_611795.js \
- browser_webconsole_bug_618311_close_panels.js \
- browser_webconsole_bug_626484_output_copy_order.js \
- browser_webconsole_bug_632347_iterators_generators.js \
- browser_webconsole_bug_642108_pruneTest.js \
- browser_webconsole_bug_585956_console_trace.js \
- browser_webconsole_bug_595223_file_uri.js \
- browser_webconsole_bug_632275_getters_document_width.js \
- browser_webconsole_bug_644419_log_limits.js \
- browser_webconsole_bug_646025_console_file_location.js \
- browser_webconsole_bug_642615_autocomplete.js \
- browser_webconsole_bug_585991_autocomplete_popup.js \
- browser_webconsole_bug_585991_autocomplete_keys.js \
- browser_webconsole_bug_660806_history_nav.js \
- browser_webconsole_bug_651501_document_body_autocomplete.js \
- browser_webconsole_bug_653531_highlighter_console_helper.js \
- browser_webconsole_bug_659907_console_dir.js \
- browser_webconsole_bug_664131_console_group.js \
- browser_webconsole_bug_704295.js \
- browser_webconsole_bug_658368_time_methods.js \
- browser_webconsole_bug_764572_output_open_url.js \
- browser_webconsole_bug_622303_persistent_filters.js \
- browser_webconsole_bug_770099_bad_policyuri.js \
- browser_webconsole_bug_770099_violation.js \
- browser_webconsole_bug_766001_JS_Console_in_Debugger.js \
- browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js \
- browser_cached_messages.js \
- browser_bug664688_sandbox_update_after_navigation.js \
- browser_result_format_as_string.js \
- browser_webconsole_bug_737873_mixedcontent.js \
- browser_output_breaks_after_console_dir_uninspectable.js \
- browser_console_log_inspectable_object.js \
- browser_bug_638949_copy_link_location.js \
- browser_output_longstring_expand.js \
- browser_netpanel_longstring_expand.js \
- browser_repeated_messages_accuracy.js \
- browser_webconsole_bug_821877_csp_errors.js \
- browser_eval_in_debugger_stackframe.js \
- browser_console_variables_view.js \
- browser_console_variables_view_while_debugging.js \
- browser_console.js \
- browser_longstring_hang.js \
- browser_console_consolejsm_output.js \
- browser_webconsole_bug_837351_securityerrors.js \
- browser_bug_865871_variables_view_close_on_esc_key.js \
- browser_bug_865288_repeat_different_objects.js \
- browser_jsterm_inspect.js \
- browser_bug_869003_inspect_cross_domain_object.js \
- browser_bug_862916_console_dir_and_filter_off.js \
- browser_console_native_getters.js \
- browser_bug_871156_ctrlw_close_tab.js \
- browser_console_private_browsing.js \
- browser_console_nsiconsolemessage.js \
- browser_webconsole_bug_817834_add_edited_input_to_history.js \
- browser_console_addonsdk_loader_exception.js \
- browser_console_error_source_click.js \
- browser_console_clear_on_reload.js \
- browser_console_keyboard_accessibility.js \
- browser_console_filters.js \
- browser_console_dead_objects.js \
- browser_console_variables_view_while_debugging_and_inspecting.js \
- head.js \
- $(NULL)
-
-ifeq ($(OS_ARCH), Darwin)
-MOCHITEST_BROWSER_FILES += \
- browser_webconsole_bug_804845_ctrl_key_nav.js \
- $(NULL)
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-MOCHITEST_BROWSER_FILES += \
- browser_webconsole_bug_623749_ctrl_a_select_all_winnt.js \
- $(NULL)
-endif
-
-MOCHITEST_BROWSER_FILES += \
- test-console.html \
- test-network.html \
- test-network-request.html \
- test-mutation.html \
- testscript.js \
- test-filter.html \
- test-observe-http-ajax.html \
- test-data.json \
- test-data.json^headers^ \
- test-property-provider.html \
- test-error.html \
- test-duplicate-error.html \
- test-image.png \
- test-encoding-ISO-8859-1.html \
- test-bug-593003-iframe-wrong-hud.html \
- test-bug-593003-iframe-wrong-hud-iframe.html \
- test-console-replaced-api.html \
- test-own-console.html \
- test-bug-595934-css-loader.html \
- test-bug-595934-css-loader.css \
- test-bug-595934-css-loader.css^headers^ \
- test-bug-595934-imagemap.html \
- test-bug-595934-html.html \
- test-bug-595934-malformedxml.xhtml \
- test-bug-595934-svg.xhtml \
- test-bug-595934-workers.html \
- test-bug-595934-workers.js \
- test-bug-595934-canvas.html \
- test-bug-595934-canvas.js \
- test-bug-595934-css-parser.html \
- test-bug-595934-css-parser.css \
- test-bug-595934-canvas-css.html \
- test-bug-595934-canvas-css.js \
- test-bug-595934-malformedxml-external.html \
- test-bug-595934-malformedxml-external.xml \
- test-bug-595934-empty-getelementbyid.html \
- test-bug-595934-empty-getelementbyid.js \
- test-bug-595934-image.html \
- test-bug-595934-image.jpg \
- test-bug-597136-external-script-errors.html \
- test-bug-597136-external-script-errors.js \
- test-bug-613013-console-api-iframe.html \
- test-bug-597756-reopen-closed-tab.html \
- test-bug-600183-charset.html \
- test-bug-600183-charset.html^headers^ \
- test-bug-601177-log-levels.html \
- test-bug-601177-log-levels.js \
- test-console-extras.html \
- test-bug-603750-websocket.html \
- test-bug-603750-websocket.js \
- test-bug-599725-response-headers.sjs \
- test-bug-618078-network-exceptions.html \
- test-bug-630733-response-redirect-headers.sjs \
- test-bug-621644-jsterm-dollar.html \
- test-bug-632347-iterators-generators.html \
- test-bug-585956-console-trace.html \
- test-bug-644419-log-limits.html \
- test-bug-632275-getters.html \
- test-bug-646025-console-file-location.html \
- test-bug-782653-css-errors.html \
- test-bug-782653-css-errors-1.css \
- test-bug-782653-css-errors-2.css \
- test-file-location.js \
- test-bug-658368-time-methods.html \
- test-webconsole-error-observer.html \
- test-for-of.html \
- test_bug_770099_violation.html \
- test_bug_770099_violation.html^headers^ \
- test_bug_770099_bad_policy_uri.html \
- test_bug_770099_bad_policy_uri.html^headers^ \
- test-result-format-as-string.html \
- test-bug-737873-mixedcontent.html \
- test-repeated-messages.html \
- test-bug-766001-console-log.js \
- test-bug-766001-js-console-links.html \
- test-bug-766001-js-errors.js \
- test-bug-821877-csperrors.html \
- test-bug-821877-csperrors.html^headers^ \
- test-eval-in-stackframe.html \
- test-bug-859170-longstring-hang.html \
- test-bug-837351-security-errors.html \
- test-bug-869003-top-window.html \
- test-bug-869003-iframe.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/devtools/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js b/browser/devtools/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
deleted file mode 100644
index 7a9947103..000000000
--- a/browser/devtools/webconsole/test/browser_bug664688_sandbox_update_after_navigation.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests if the JSTerm sandbox is updated when the user navigates from one
-// domain to another, in order to avoid permission denied errors with a sandbox
-// created for a different origin.
-
-function test()
-{
- const TEST_URI1 = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
- const TEST_URI2 = "http://example.org/browser/browser/devtools/webconsole/test/test-console.html";
-
- let hud;
- let msgForLocation1;
-
- waitForExplicitFinish();
-
- gBrowser.selectedTab = gBrowser.addTab(TEST_URI1);
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(gBrowser.selectedTab, pageLoad1);
- }, true);
-
- function pageLoad1(aHud)
- {
- hud = aHud;
-
- hud.jsterm.clearOutput();
- hud.jsterm.execute("window.location.href");
-
- info("wait for window.location.href");
-
- msgForLocation1 = {
- webconsole: hud,
- messages: [
- {
- name: "window.location.href jsterm input",
- text: "window.location.href",
- category: CATEGORY_INPUT,
- },
- {
- name: "window.location.href result is displayed",
- text: TEST_URI1,
- category: CATEGORY_OUTPUT,
- },
- ]
- };
-
- waitForMessages(msgForLocation1).then(() => {
- gBrowser.selectedBrowser.addEventListener("load", onPageLoad2, true);
- content.location = TEST_URI2;
- });
- }
-
- function onPageLoad2() {
- gBrowser.selectedBrowser.removeEventListener("load", onPageLoad2, true);
-
- is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
- "no permission denied errors");
-
- hud.jsterm.clearOutput();
- hud.jsterm.execute("window.location.href");
-
- info("wait for window.location.href after page navigation");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "window.location.href jsterm input",
- text: "window.location.href",
- category: CATEGORY_INPUT,
- },
- {
- name: "window.location.href result is displayed",
- text: TEST_URI2,
- category: CATEGORY_OUTPUT,
- },
- ]
- }).then(() => {
- is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
- "no permission denied errors");
-
- gBrowser.goBack();
- waitForSuccess(waitForBack);
- });
- }
-
- let waitForBack = {
- name: "go back",
- validatorFn: function()
- {
- return content.location.href == TEST_URI1;
- },
- successFn: function()
- {
- hud.jsterm.clearOutput();
- executeSoon(() => {
- hud.jsterm.execute("window.location.href");
- });
-
- info("wait for window.location.href after goBack()");
- waitForMessages(msgForLocation1).then(() => executeSoon(() => {
- is(hud.outputNode.textContent.indexOf("Permission denied"), -1,
- "no permission denied errors");
- finishTest();
- }));
- },
- failureFn: finishTest,
- };
-}
diff --git a/browser/devtools/webconsole/test/browser_bug_638949_copy_link_location.js b/browser/devtools/webconsole/test/browser_bug_638949_copy_link_location.js
deleted file mode 100644
index 3853d531b..000000000
--- a/browser/devtools/webconsole/test/browser_bug_638949_copy_link_location.js
+++ /dev/null
@@ -1,107 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/" +
- "test/test-console.html?_date=" + Date.now();
-const COMMAND_NAME = "consoleCmd_copyURL";
-const CONTEXT_MENU_ID = "#menu_copyURL";
-
-let HUD = null;
-let output = null;
-let menu = null;
-
-function test() {
- registerCleanupFunction(() => {
- HUD = output = menu = null;
- });
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function (aHud) {
- HUD = aHud;
- output = aHud.outputNode;
- menu = HUD.iframeWindow.document.getElementById("output-contextmenu");
-
- executeSoon(testWithoutNetActivity);
- });
- }, true);
-}
-
-// Return whether "Copy Link Location" command is enabled or not.
-function isEnabled() {
- let controller = top.document.commandDispatcher
- .getControllerForCommand(COMMAND_NAME);
- return controller && controller.isCommandEnabled(COMMAND_NAME);
-}
-
-function testWithoutNetActivity() {
- HUD.jsterm.clearOutput();
- content.console.log("bug 638949");
-
- // Test that the "Copy Link Location" command is disabled for non-network
- // messages.
- waitForMessages({
- webconsole: HUD,
- messages: [{
- text: "bug 638949",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onConsoleMessage);
-}
-
-function onConsoleMessage(aResults) {
- output.focus();
- output.selectedItem = [...aResults[0].matched][0];
-
- goUpdateCommand(COMMAND_NAME);
- ok(!isEnabled(), COMMAND_NAME + "is disabled");
-
- // Test that the "Copy Link Location" menu item is hidden for non-network
- // messages.
- waitForContextMenu(menu, output.selectedItem, () => {
- let isHidden = menu.querySelector(CONTEXT_MENU_ID).hidden;
- ok(isHidden, CONTEXT_MENU_ID + " is hidden");
- }, testWithNetActivity);
-}
-
-function testWithNetActivity() {
- HUD.jsterm.clearOutput();
- content.location.reload(); // Reloading will produce network logging
-
- // Test that the "Copy Link Location" command is enabled and works
- // as expected for any network-related message.
- // This command should copy only the URL.
- waitForMessages({
- webconsole: HUD,
- messages: [{
- text: "test-console.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- }],
- }).then(onNetworkMessage);
-}
-
-function onNetworkMessage(aResults) {
- output.focus();
- output.selectedItem = [...aResults[0].matched][0];
-
- goUpdateCommand(COMMAND_NAME);
- ok(isEnabled(), COMMAND_NAME + " is enabled");
-
- waitForClipboard(output.selectedItem.url, () => goDoCommand(COMMAND_NAME),
- testMenuWithNetActivity, testMenuWithNetActivity);
-}
-
-function testMenuWithNetActivity() {
- // Test that the "Copy Link Location" menu item is visible for network-related
- // messages.
- waitForContextMenu(menu, output.selectedItem, () => {
- let isVisible = !menu.querySelector(CONTEXT_MENU_ID).hidden;
- ok(isVisible, CONTEXT_MENU_ID + " is visible");
- }, finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_bug_862916_console_dir_and_filter_off.js b/browser/devtools/webconsole/test/browser_bug_862916_console_dir_and_filter_off.js
deleted file mode 100644
index 6dfc00b8a..000000000
--- a/browser/devtools/webconsole/test/browser_bug_862916_console_dir_and_filter_off.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that the output for console.dir() works even if Logging filter is off.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>test for bug 862916";
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- ok(hud, "web console opened");
-
- hud.setFilterState("log", false);
- registerCleanupFunction(() => hud.setFilterState("log", true));
-
- content.wrappedJSObject.fooBarz = "bug862916";
- hud.jsterm.execute("console.dir(window)");
- hud.jsterm.once("variablesview-fetched", (aEvent, aVar) => {
- ok(aVar, "variables view object");
- findVariableViewProperties(aVar, [
- { name: "fooBarz", value: "bug862916" },
- ], { webconsole: hud }).then(finishTest);
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_bug_865288_repeat_different_objects.js b/browser/devtools/webconsole/test/browser_bug_865288_repeat_different_objects.js
deleted file mode 100644
index df3335082..000000000
--- a/browser/devtools/webconsole/test/browser_bug_865288_repeat_different_objects.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that makes sure messages are not considered repeated when console.log()
-// is invoked with different objects, see bug 865288.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html";
-
-let hud = null;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- hud = aHud;
-
- // Check that css warnings are not coalesced if they come from different lines.
- info("waiting for 3 console.log objects");
-
- hud.jsterm.clearOutput(true);
- content.wrappedJSObject.testConsoleObjects();
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "3 console.log messages",
- text: "abba",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- count: 3,
- repeats: 1,
- objects: true,
- }],
- }).then(checkMessages);
-}
-
-function checkMessages(aResults)
-{
- let result = aResults[0];
- let msgs = [...result.matched];
- is(msgs.length, 3, "3 message elements");
- let m = -1;
-
- function nextMessage()
- {
- let msg = msgs[++m];
- if (msg) {
- ok(msg, "message element #" + m);
-
- let clickable = msg.querySelector(".hud-clickable");
- ok(clickable, "clickable object #" + m);
-
- scrollOutputToNode(msg);
- clickObject(clickable);
- }
- else {
- finishTest();
- }
- }
-
- nextMessage();
-
- function clickObject(aObject)
- {
- hud.jsterm.once("variablesview-fetched", onObjectFetch);
- EventUtils.synthesizeMouse(aObject, 2, 2, {}, hud.iframeWindow);
- }
-
- function onObjectFetch(aEvent, aVar)
- {
- findVariableViewProperties(aVar, [
- { name: "id", value: "abba" + m },
- ], { webconsole: hud }).then(nextMessage);
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_bug_865871_variables_view_close_on_esc_key.js b/browser/devtools/webconsole/test/browser_bug_865871_variables_view_close_on_esc_key.js
deleted file mode 100644
index 7e47d38c3..000000000
--- a/browser/devtools/webconsole/test/browser_bug_865871_variables_view_close_on_esc_key.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that the variables view sidebar can be closed by pressing Escape in the
-// web console.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
-
-let gWebConsole, gJSTerm, gVariablesView;
-
-function test()
-{
- registerCleanupFunction(() => {
- gWebConsole = gJSTerm = gVariablesView = null;
- });
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
- gJSTerm.execute("fooObj", onExecuteFooObj);
-}
-
-function onExecuteFooObj()
-{
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output message found");
- isnot(msg.textContent.indexOf("[object Object]"), -1, "message text check");
-
- gJSTerm.once("variablesview-fetched", onFooObjFetch);
- EventUtils.synthesizeMouse(msg, 2, 2, {}, gWebConsole.iframeWindow)
-}
-
-function onFooObjFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "testProp", value: "testValue" },
- ], { webconsole: gWebConsole }).then(onTestPropFound);
-}
-
-function onTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the |testProp| property in the variables view");
-
- is(content.wrappedJSObject.fooObj.testProp, aResults[0].value,
- "|fooObj.testProp| value is correct");
-
- gVariablesView.window.focus();
- gJSTerm.once("sidebar-closed", onSidebarClosed);
- EventUtils.synthesizeKey("VK_ESCAPE", {}, gVariablesView.window);
-}
-
-function onSidebarClosed()
-{
- gJSTerm.clearOutput();
- gJSTerm.execute("window", onExecuteWindow);
-}
-
-function onExecuteWindow()
-{
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output message found");
- isnot(msg.textContent.indexOf("[object Window]"), -1, "message text check");
-
- gJSTerm.once("variablesview-fetched", onWindowFetch);
- EventUtils.synthesizeMouse(msg, 2, 2, {}, gWebConsole.iframeWindow)
-}
-
-function onWindowFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "foo", value: "globalFooBug783499" },
- ], { webconsole: gWebConsole }).then(onFooFound);
-}
-
-function onFooFound(aResults)
-{
- gVariablesView.window.focus();
- gJSTerm.once("sidebar-closed", finishTest);
- EventUtils.synthesizeKey("VK_ESCAPE", {}, gVariablesView.window);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_bug_869003_inspect_cross_domain_object.js b/browser/devtools/webconsole/test/browser_bug_869003_inspect_cross_domain_object.js
deleted file mode 100644
index 0f8778e81..000000000
--- a/browser/devtools/webconsole/test/browser_bug_869003_inspect_cross_domain_object.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that users can inspect objects logged from cross-domain iframes -
-// bug 869003.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-869003-top-window.html";
-
-let gWebConsole, gJSTerm, gVariablesView;
-
-function test()
-{
- // This test is slightly more involved: it opens the web console, then the
- // variables view for a given object, it updates a property in the view and
- // checks the result. We can get a timeout with debug builds on slower machines.
- requestLongerTimeout(2);
-
- addTab("data:text/html;charset=utf8,<p>hello");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
- content.location = TEST_URI;
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "console.log message",
- text: "foobar",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- objects: true,
- }],
- }).then(onConsoleMessage);
-}
-
-function onConsoleMessage(aResults)
-{
- let clickable = aResults[0].clickableElements[0];
- ok(clickable, "clickable object found");
- isnot(clickable.textContent.indexOf("[object Object]"), -1,
- "message text check");
-
- gJSTerm.once("variablesview-fetched", onObjFetch);
-
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, gWebConsole.iframeWindow)
-}
-
-function onObjFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "hello", value: "world!" },
- { name: "bug", value: 869003 },
- ], { webconsole: gWebConsole }).then(onPropFound);
-}
-
-function onPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the |hello| property in the variables view");
-
- // Check that property value updates work.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "'omgtest'",
- webconsole: gWebConsole,
- callback: onFetchAfterUpdate,
- });
-}
-
-function onFetchAfterUpdate(aEvent, aVar)
-{
- info("onFetchAfterUpdate");
-
- findVariableViewProperties(aVar, [
- { name: "hello", value: "omgtest" },
- { name: "bug", value: 869003 },
- ], { webconsole: gWebConsole }).then(() => {
- gWebConsole = gJSTerm = gVariablesView = null;
- finishTest();
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_bug_871156_ctrlw_close_tab.js b/browser/devtools/webconsole/test/browser_bug_871156_ctrlw_close_tab.js
deleted file mode 100644
index a76bf2bfe..000000000
--- a/browser/devtools/webconsole/test/browser_bug_871156_ctrlw_close_tab.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that Ctrl-W closes the Browser Console and that Ctrl-W closes the
-// current tab when using the Web Console - bug 871156.
-
-function test()
-{
- const TEST_URI = "data:text/html;charset=utf8,<title>bug871156</title>\n" +
- "<p>hello world";
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-
- function consoleOpened(hud)
- {
- ok(hud, "Web Console opened");
-
- let tabClosed = false, toolboxDestroyed = false;
-
- gBrowser.tabContainer.addEventListener("TabClose", function onTabClose() {
- gBrowser.tabContainer.removeEventListener("TabClose", onTabClose);
-
- ok(true, "tab closed");
-
- tabClosed = true;
- if (toolboxDestroyed) {
- testBrowserConsole();
- }
- });
-
- let toolbox = gDevTools.getToolbox(hud.target);
- toolbox.once("destroyed", () => {
- ok(true, "toolbox destroyed");
-
- toolboxDestroyed = true;
- if (tabClosed) {
- testBrowserConsole();
- }
- });
-
- EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow);
- }
-
- function testBrowserConsole()
- {
- info("test the Browser Console");
-
- HUDConsoleUI.toggleBrowserConsole().then((hud) => {
- ok(hud, "Browser Console opened");
-
- Services.obs.addObserver(function onDestroy() {
- Services.obs.removeObserver(onDestroy, "web-console-destroyed");
- ok(true, "the Browser Console closed");
-
- executeSoon(finishTest);
- }, "web-console-destroyed", false);
-
- EventUtils.synthesizeKey("w", { accelKey: true }, hud.iframeWindow);
- });
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_cached_messages.js b/browser/devtools/webconsole/test/browser_cached_messages.js
deleted file mode 100644
index aa28daaef..000000000
--- a/browser/devtools/webconsole/test/browser_cached_messages.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-webconsole-error-observer.html";
-
-function test()
-{
- waitForExplicitFinish();
-
- expectUncaughtException();
-
- addTab(TEST_URI);
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- testOpenUI(true);
- }, true);
-}
-
-function testOpenUI(aTestReopen)
-{
- // test to see if the messages are
- // displayed when the console UI is opened
-
- let messages = {
- "log Bazzle" : false,
- "error Bazzle" : false,
- "bazBug611032" : false,
- "cssColorBug611032" : false,
- };
-
- openConsole(null, function(hud) {
- waitForSuccess({
- name: "cached messages displayed",
- validatorFn: function()
- {
- let foundAll = true;
- for (let msg in messages) {
- let found = messages[msg];
- if (!found) {
- found = hud.outputNode.textContent.indexOf(msg) > -1;
- if (found) {
- info("found message '" + msg + "'");
- messages[msg] = found;
- }
- }
- foundAll = foundAll && found;
- }
- return foundAll;
- },
- successFn: function()
- {
- // Make sure the CSS warning is given the correct category - bug 768019.
- let cssNode = hud.outputNode.querySelector(".webconsole-msg-cssparser");
- ok(cssNode, "CSS warning message element");
- isnot(cssNode.textContent.indexOf("cssColorBug611032"), -1,
- "CSS warning message element content is correct");
-
- closeConsole(gBrowser.selectedTab, function() {
- aTestReopen && info("will reopen the Web Console");
- executeSoon(aTestReopen ? testOpenUI : finishTest);
- });
- },
- failureFn: function()
- {
- for (let msg in messages) {
- if (!messages[msg]) {
- ok(false, "failed to find '" + msg + "'");
- }
- }
- finishTest();
- },
- });
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_console.js b/browser/devtools/webconsole/test/browser_console.js
deleted file mode 100644
index d204c1b2b..000000000
--- a/browser/devtools/webconsole/test/browser_console.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test the basic features of the Browser Console, bug 587757.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html?" + Date.now();
-
-function test()
-{
- let oldFunction = HUDConsoleUI.toggleBrowserConsole;
- let functionExecuted = false;
- HUDConsoleUI.toggleBrowserConsole = () => functionExecuted = true;
- EventUtils.synthesizeKey("j", { accelKey: true, shiftKey: true }, content);
-
- ok(functionExecuted,
- "toggleBrowserConsole() was executed by the Ctrl-Shift-J key shortcut");
-
- HUDConsoleUI.toggleBrowserConsole = oldFunction;
- HUDConsoleUI.toggleBrowserConsole().then(consoleOpened);
-}
-
-function consoleOpened(hud)
-{
- hud.jsterm.clearOutput(true);
-
- expectUncaughtException();
- executeSoon(() => {
- foobarExceptionBug587757();
- });
-
- // Add a message from a chrome window.
- hud.iframeWindow.console.log("bug587757a");
-
- // Add a message from a content window.
- content.console.log("bug587757b");
-
- // Test eval.
- hud.jsterm.execute("document.location.href");
-
- // Check for network requests.
- let xhr = new XMLHttpRequest();
- xhr.onload = () => console.log("xhr loaded, status is: " + xhr.status);
- xhr.open("get", TEST_URI, true);
- xhr.send();
-
- let chromeConsole = -1;
- let contentConsole = -1;
- let execValue = -1;
- let exception = -1;
- let xhrRequest = false;
-
- let output = hud.outputNode;
- function performChecks()
- {
- let text = output.textContent;
- chromeConsole = text.indexOf("bug587757a");
- contentConsole = text.indexOf("bug587757b");
- execValue = text.indexOf("browser.xul");
- exception = text.indexOf("foobarExceptionBug587757");
-
- xhrRequest = false;
- let urls = output.querySelectorAll(".webconsole-msg-url");
- for (let url of urls) {
- if (url.value.indexOf(TEST_URI) > -1) {
- xhrRequest = true;
- break;
- }
- }
- }
-
- function showResults()
- {
- isnot(chromeConsole, -1, "chrome window console.log() is displayed");
- isnot(contentConsole, -1, "content window console.log() is displayed");
- isnot(execValue, -1, "jsterm eval result is displayed");
- isnot(exception, -1, "exception is displayed");
- ok(xhrRequest, "xhr request is displayed");
- }
-
- waitForSuccess({
- name: "messages displayed",
- validatorFn: () => {
- performChecks();
- return chromeConsole > -1 &&
- contentConsole > -1 &&
- execValue > -1 &&
- exception > -1 &&
- xhrRequest;
- },
- successFn: () => {
- showResults();
- executeSoon(finishTest);
- },
- failureFn: () => {
- showResults();
- info("output: " + output.textContent);
- executeSoon(finishTest);
- },
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_console_addonsdk_loader_exception.js b/browser/devtools/webconsole/test/browser_console_addonsdk_loader_exception.js
deleted file mode 100644
index 7a4186761..000000000
--- a/browser/devtools/webconsole/test/browser_console_addonsdk_loader_exception.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that exceptions from scripts loaded with the addon-sdk loader are
-// opened correctly in View Source from the Browser Console.
-// See bug 866950.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>hello world from bug 866950";
-
-function test()
-{
- let webconsole, browserconsole;
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, consoleOpened);
- }, true);
-
- function consoleOpened(hud)
- {
- ok(hud, "web console opened");
- webconsole = hud;
- HUDConsoleUI.toggleBrowserConsole().then(browserConsoleOpened);
- }
-
- function browserConsoleOpened(hud)
- {
- ok(hud, "browser console opened");
- browserconsole = hud;
-
- // Cause an exception in a script loaded with the addon-sdk loader.
- let toolbox = gDevTools.getToolbox(webconsole.target);
- let oldPanels = toolbox._toolPanels;
- toolbox._toolPanels = null;
- function fixToolbox()
- {
- toolbox._toolPanels = oldPanels;
- }
-
- info("generate exception and wait for message");
-
- executeSoon(() => {
- executeSoon(fixToolbox);
- expectUncaughtException();
- toolbox.getToolPanels();
- });
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- text: "TypeError: this._toolPanels is null",
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- },
- ],
- }).then((results) => {
- fixToolbox();
- onMessageFound(results);
- });
- }
-
- function onMessageFound(results)
- {
- let msg = [...results[0].matched][0];
- ok(msg, "message element found");
- let locationNode = msg.querySelector(".webconsole-location");
- ok(locationNode, "message location element found");
-
- let title = locationNode.getAttribute("title");
- info("location node title: " + title);
- isnot(title.indexOf(" -> "), -1, "error comes from a subscript");
-
- let viewSource = browserconsole.viewSource;
- let URL = null;
- browserconsole.viewSource = (aURL) => URL = aURL;
-
- EventUtils.synthesizeMouse(locationNode, 2, 2, {},
- browserconsole.iframeWindow);
-
- info("view-source url: " + URL);
- isnot(URL.indexOf("toolbox.js"), -1, "expected view source URL");
- is(URL.indexOf("->"), -1, "no -> in the URL given to view-source");
-
- browserconsole.viewSource = viewSource;
-
- finishTest();
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_clear_on_reload.js b/browser/devtools/webconsole/test/browser_console_clear_on_reload.js
deleted file mode 100644
index 63103c368..000000000
--- a/browser/devtools/webconsole/test/browser_console_clear_on_reload.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that clear output on page reload works - bug 705921.
-
-function test()
-{
- const PREF = "devtools.webconsole.persistlog";
- const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
- let hud = null;
-
- Services.prefs.setBoolPref(PREF, false);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- addTab(TEST_URI);
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-
- function consoleOpened(aHud)
- {
- hud = aHud;
- ok(hud, "Web Console opened");
-
- hud.jsterm.clearOutput();
- content.console.log("foobarz1");
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "foobarz1",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onConsoleMessage);
- }
-
- function onConsoleMessage()
- {
- browser.addEventListener("load", onReload, true);
- content.location.reload();
- }
-
- function onReload()
- {
- browser.removeEventListener("load", onReload, true);
-
- content.console.log("foobarz2");
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test-console.html",
- category: CATEGORY_NETWORK,
- },
- {
- text: "foobarz2",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onConsoleMessageAfterReload);
- }
-
- function onConsoleMessageAfterReload()
- {
- is(hud.outputNode.textContent.indexOf("foobarz1"), -1,
- "foobarz1 has been removed from output");
- finishTest();
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_consolejsm_output.js b/browser/devtools/webconsole/test/browser_console_consolejsm_output.js
deleted file mode 100644
index 96b8ff42e..000000000
--- a/browser/devtools/webconsole/test/browser_console_consolejsm_output.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that Console.jsm outputs messages to the Browser Console, bug 851231.
-
-function test()
-{
- let storage = Cu.import("resource://gre/modules/ConsoleAPIStorage.jsm", {}).ConsoleAPIStorage;
- storage.clearEvents();
-
- let console = Cu.import("resource://gre/modules/devtools/Console.jsm", {}).console;
- console.log("bug861338-log-cached");
-
- HUDConsoleUI.toggleBrowserConsole().then(consoleOpened);
- let hud = null;
-
- function consoleOpened(aHud)
- {
- hud = aHud;
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "cached console.log message",
- text: "bug861338-log-cached",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onCachedMessage);
- }
-
- function onCachedMessage()
- {
- hud.jsterm.clearOutput(true);
-
- console.time("foobarTimer");
- let foobar = { bug851231prop: "bug851231value" };
-
- console.log("bug851231-log");
- console.info("bug851231-info");
- console.warn("bug851231-warn");
- console.error("bug851231-error", foobar);
- console.debug("bug851231-debug");
- console.trace();
- console.dir(document);
- console.timeEnd("foobarTimer");
-
- info("wait for the Console.jsm messages");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "console.log output",
- text: "bug851231-log",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- },
- {
- name: "console.info output",
- text: "bug851231-info",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_INFO,
- },
- {
- name: "console.warn output",
- text: "bug851231-warn",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_WARNING,
- },
- {
- name: "console.error output",
- text: /\bbug851231-error\b.+\[object Object\]/,
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_ERROR,
- objects: true,
- },
- {
- name: "console.debug output",
- text: "bug851231-debug",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- },
- {
- name: "console.trace output",
- consoleTrace: {
- file: "browser_console_consolejsm_output.js",
- fn: "onCachedMessage",
- },
- },
- {
- name: "console.dir output",
- consoleDir: "[object XULDocument]",
- },
- {
- name: "console.time output",
- consoleTime: "foobarTimer",
- },
- {
- name: "console.timeEnd output",
- consoleTimeEnd: "foobarTimer",
- },
- ],
- }).then((aResults) => {
- let consoleErrorMsg = aResults[3];
- ok(consoleErrorMsg, "console.error message element found");
- let clickable = consoleErrorMsg.clickableElements[0];
- ok(clickable, "clickable object found for console.error");
-
- let onFetch = (aEvent, aVar) => {
- // Skip the notification from console.dir variablesview-fetched.
- if (aVar._variablesView != hud.jsterm._variablesView) {
- return;
- }
- hud.jsterm.off("variablesview-fetched", onFetch);
-
- ok(aVar, "object inspector opened on click");
-
- findVariableViewProperties(aVar, [{
- name: "bug851231prop",
- value: "bug851231value",
- }], { webconsole: hud }).then(finishTest);
- };
-
- hud.jsterm.on("variablesview-fetched", onFetch);
-
- scrollOutputToNode(clickable);
-
- info("wait for variablesview-fetched");
- executeSoon(() =>
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow));
- });
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_dead_objects.js b/browser/devtools/webconsole/test/browser_console_dead_objects.js
deleted file mode 100644
index 1d68df857..000000000
--- a/browser/devtools/webconsole/test/browser_console_dead_objects.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that Dead Objects do not break the Web/Browser Consoles. See bug 883649.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>dead objects!";
-
-function test()
-{
- let hud = null;
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- info("open the browser console");
- HUDConsoleUI.toggleBrowserConsole().then(onBrowserConsoleOpen);
- }, true);
-
- function onBrowserConsoleOpen(aHud)
- {
- hud = aHud;
- ok(hud, "browser console opened");
-
- hud.jsterm.clearOutput();
- hud.jsterm.execute("foobarzTezt = content.document", onAddVariable);
- }
-
- function onAddVariable()
- {
- gBrowser.removeCurrentTab();
-
- hud.jsterm.execute("foobarzTezt", onReadVariable);
- }
-
- function onReadVariable()
- {
- isnot(hud.outputNode.textContent.indexOf("[object DeadObject]"), -1,
- "dead object found");
-
- hud.jsterm.setInputValue("foobarzTezt");
-
- for (let c of ".hello") {
- EventUtils.synthesizeKey(c, {}, hud.iframeWindow);
- }
-
- hud.jsterm.execute(null, onReadProperty);
- }
-
- function onReadProperty()
- {
- isnot(hud.outputNode.textContent.indexOf("can't access dead object"), -1,
- "'cannot access dead object' message found");
-
- // Click the second execute output.
- let clickable = hud.outputNode.querySelectorAll(".webconsole-msg-output")[1]
- .querySelector(".hud-clickable");
- ok(clickable, "clickable object found");
- isnot(clickable.textContent.indexOf("[object DeadObject]"), -1,
- "message text check");
-
- hud.jsterm.once("variablesview-fetched", onFetched);
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
- }
-
- function onFetched()
- {
- hud.jsterm.execute("delete window.foobarzTezt; 2013-26", onCalcResult);
- }
-
- function onCalcResult()
- {
- isnot(hud.outputNode.textContent.indexOf("1987"), -1, "result message found");
-
- // executeSoon() is needed to get out of the execute() event loop.
- executeSoon(finishTest);
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_error_source_click.js b/browser/devtools/webconsole/test/browser_console_error_source_click.js
deleted file mode 100644
index 98fe93dbc..000000000
--- a/browser/devtools/webconsole/test/browser_console_error_source_click.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that JS errors and CSS warnings open view source when their source link
-// is clicked in the Browser Console. See bug 877778.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>hello world from bug 877778 " +
- "<button onclick='foobar.explode()' " +
- "style='test-color: green-please'>click!</button>";
-function test()
-{
- let hud;
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- HUDConsoleUI.toggleBrowserConsole().then(browserConsoleOpened);
- }, true);
-
- function browserConsoleOpened(aHud)
- {
- hud = aHud;
- ok(hud, "browser console opened");
-
- let button = content.document.querySelector("button");
- ok(button, "button element found");
-
- info("generate exception and wait for the message");
- executeSoon(() => {
- expectUncaughtException();
- button.click();
- });
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- text: "ReferenceError: foobar is not defined",
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- },
- {
- text: "Unknown property 'test-color'",
- category: CATEGORY_CSS,
- severity: SEVERITY_WARNING,
- },
- ],
- }).then(onMessageFound);
- }
-
- function onMessageFound(results)
- {
- let viewSource = hud.viewSource;
- let viewSourceCalled = false;
- hud.viewSource = () => viewSourceCalled = true;
-
- for (let result of results) {
- viewSourceCalled = false;
-
- let msg = [...results[0].matched][0];
- ok(msg, "message element found for: " + result.text);
- let locationNode = msg.querySelector(".webconsole-location");
- ok(locationNode, "message location element found");
-
- EventUtils.synthesizeMouse(locationNode, 2, 2, {}, hud.iframeWindow);
-
- ok(viewSourceCalled, "view source opened");
- }
-
- hud.viewSource = viewSource;
- finishTest();
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_filters.js b/browser/devtools/webconsole/test/browser_console_filters.js
deleted file mode 100644
index d9aa35c81..000000000
--- a/browser/devtools/webconsole/test/browser_console_filters.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that the Browser Console does not use the same filter prefs as the Web
-// Console. See bug 878186.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>browser console filters";
-const WEB_CONSOLE_PREFIX = "devtools.webconsole.filter.";
-const BROWSER_CONSOLE_PREFIX = "devtools.browserconsole.filter.";
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- info("open the web console");
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- ok(hud, "web console opened");
-
- is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (browser console)");
- is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (web console)");
-
- info("toggle 'exception' filter");
- hud.setFilterState("exception", false);
-
- is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (browser console)");
- is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), false,
- "'exception' filter is disabled (web console)");
-
- hud.setFilterState("exception", true);
-
- executeSoon(() => closeConsole(null, onWebConsoleClose));
-}
-
-function onWebConsoleClose()
-{
- info("web console closed");
- HUDConsoleUI.toggleBrowserConsole().then(onBrowserConsoleOpen);
-}
-
-function onBrowserConsoleOpen(hud)
-{
- ok(hud, "browser console opened");
-
- is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (browser console)");
- is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (web console)");
-
- info("toggle 'exception' filter");
- hud.setFilterState("exception", false);
-
- is(Services.prefs.getBoolPref(BROWSER_CONSOLE_PREFIX + "exception"), false,
- "'exception' filter is disabled (browser console)");
- is(Services.prefs.getBoolPref(WEB_CONSOLE_PREFIX + "exception"), true,
- "'exception' filter is enabled (web console)");
-
- hud.setFilterState("exception", true);
-
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_console_keyboard_accessibility.js b/browser/devtools/webconsole/test/browser_console_keyboard_accessibility.js
deleted file mode 100644
index aca00bd5a..000000000
--- a/browser/devtools/webconsole/test/browser_console_keyboard_accessibility.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that basic keyboard shortcuts work in the web console.
-
-function test()
-{
- const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
- let hud = null;
-
- addTab(TEST_URI);
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-
- function consoleOpened(aHud)
- {
- hud = aHud;
- ok(hud, "Web Console opened");
-
- content.console.log("foobarz1");
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "foobarz1",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onConsoleMessage);
- }
-
- function onConsoleMessage()
- {
- hud.jsterm.once("messages-cleared", onClear);
- info("try ctrl-k to clear output");
- EventUtils.synthesizeKey("K", { accelKey: true });
- }
-
- function onClear()
- {
- is(hud.outputNode.textContent.indexOf("foobarz1"), -1, "output cleared");
- is(hud.jsterm.inputNode.getAttribute("focused"), "true",
- "jsterm input is focused");
-
- info("try ctrl-f to focus filter");
- EventUtils.synthesizeKey("F", { accelKey: true });
- ok(!hud.jsterm.inputNode.getAttribute("focused"),
- "jsterm input is not focused");
- is(hud.ui.filterBox.getAttribute("focused"), "true",
- "filter input is focused");
-
- if (Services.appinfo.OS == "Darwin") {
- EventUtils.synthesizeKey("t", { ctrlKey: true });
- }
- else {
- EventUtils.synthesizeKey("N", { altKey: true });
- }
-
- let net = hud.ui.document.querySelector("toolbarbutton[category=net]");
- is(hud.ui.document.activeElement, net,
- "accesskey for Network category focuses the Net button");
-
- finishTest();
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_log_inspectable_object.js b/browser/devtools/webconsole/test/browser_console_log_inspectable_object.js
deleted file mode 100644
index 230805401..000000000
--- a/browser/devtools/webconsole/test/browser_console_log_inspectable_object.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that objects given to console.log() are inspectable.
-
-function test()
-{
- waitForExplicitFinish();
-
- addTab("data:text/html;charset=utf8,test for bug 676722 - inspectable objects for window.console");
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(null, performTest);
- }, true);
-}
-
-function performTest(hud)
-{
- hud.jsterm.clearOutput(true);
-
- hud.jsterm.execute("myObj = {abba: 'omgBug676722'}");
- hud.jsterm.execute("console.log('fooBug676722', myObj)");
- waitForSuccess({
- name: "eval results are shown",
- validatorFn: function()
- {
- return hud.outputNode.textContent.indexOf("fooBug676722") > -1 &&
- hud.outputNode.querySelector(".hud-clickable");
- },
- successFn: function()
- {
- isnot(hud.outputNode.textContent.indexOf("myObj = {"), -1,
- "myObj = ... is shown");
-
- let clickable = hud.outputNode.querySelector(".hud-clickable");
- ok(clickable, "the console.log() object .hud-clickable was found");
- isnot(clickable.textContent.indexOf("Object"), -1,
- "clickable node content is correct");
-
- hud.jsterm.once("variablesview-fetched",
- (aEvent, aVar) => {
- ok(aVar, "object inspector opened on click");
-
- findVariableViewProperties(aVar, [{
- name: "abba",
- value: "omgBug676722",
- }], { webconsole: hud }).then(finishTest);
- });
-
- executeSoon(function() {
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
- });
- },
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_console_native_getters.js b/browser/devtools/webconsole/test/browser_console_native_getters.js
deleted file mode 100644
index 3dd89d298..000000000
--- a/browser/devtools/webconsole/test/browser_console_native_getters.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that native getters and setters for DOM elements work as expected in
-// variables view - bug 870220.
-
-const TEST_URI = "data:text/html;charset=utf8,<title>bug870220</title>\n" +
- "<p>hello world\n<p>native getters!";
-
-let gWebConsole, gJSTerm, gVariablesView;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
-
- gJSTerm.execute("document");
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "[object HTMLDocument]",
- category: CATEGORY_OUTPUT,
- objects: true,
- }],
- }).then(onEvalResult);
-}
-
-function onEvalResult(aResults)
-{
- let clickable = aResults[0].clickableElements[0];
- ok(clickable, "clickable object found");
-
- gJSTerm.once("variablesview-fetched", onDocumentFetch);
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, gWebConsole.iframeWindow)
-}
-
-function onDocumentFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "title", value: "bug870220" },
- { name: "bgColor" },
- ], { webconsole: gWebConsole }).then(onDocumentPropsFound);
-}
-
-function onDocumentPropsFound(aResults)
-{
- let prop = aResults[1].matchedProp;
- ok(prop, "matched the |bgColor| property in the variables view");
-
- // Check that property value updates work.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "'red'",
- webconsole: gWebConsole,
- callback: onFetchAfterBackgroundUpdate,
- });
-}
-
-function onFetchAfterBackgroundUpdate(aEvent, aVar)
-{
- info("onFetchAfterBackgroundUpdate");
-
- is(content.document.bgColor, "red", "document background color changed");
-
- findVariableViewProperties(aVar, [
- { name: "bgColor", value: "red" },
- ], { webconsole: gWebConsole }).then(testParagraphs);
-}
-
-function testParagraphs()
-{
- gJSTerm.execute("$$('p')");
-
- waitForMessages({
- webconsole: gWebConsole,
- messages: [{
- text: "[object NodeList]",
- category: CATEGORY_OUTPUT,
- objects: true,
- }],
- }).then(onEvalNodeList);
-}
-
-function onEvalNodeList(aResults)
-{
- let clickable = aResults[0].clickableElements[0];
- ok(clickable, "clickable object found");
-
- gJSTerm.once("variablesview-fetched", onNodeListFetch);
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, gWebConsole.iframeWindow)
-}
-
-function onNodeListFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "0.textContent", value: /hello world/ },
- { name: "1.textContent", value: /native getters/ },
- ], { webconsole: gWebConsole }).then(() => {
- gWebConsole = gJSTerm = gVariablesView = null;
- finishTest();
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_console_nsiconsolemessage.js b/browser/devtools/webconsole/test/browser_console_nsiconsolemessage.js
deleted file mode 100644
index dcfc19fee..000000000
--- a/browser/devtools/webconsole/test/browser_console_nsiconsolemessage.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that nsIConsoleMessages are displayed in the Browser Console.
-// See bug 859756.
-
-const TEST_URI = "data:text/html;charset=utf8,<title>bug859756</title>\n" +
- "<p>hello world\n<p>nsIConsoleMessages ftw!";
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- // Test for cached nsIConsoleMessages.
- Services.console.logStringMessage("test1 for bug859756");
-
- info("open web console");
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- ok(hud, "web console opened");
- Services.console.logStringMessage("do-not-show-me");
- content.console.log("foobarz");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- text: "foobarz",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- },
- ],
- }).then(() => {
- let text = hud.outputNode.textContent;
- is(text.indexOf("do-not-show-me"), -1,
- "nsIConsoleMessages are not displayed");
- is(text.indexOf("test1 for bug859756"), -1,
- "nsIConsoleMessages are not displayed (confirmed)");
- closeConsole(null, onWebConsoleClose);
- });
-}
-
-function onWebConsoleClose()
-{
- info("web console closed");
- HUDConsoleUI.toggleBrowserConsole().then(onBrowserConsoleOpen);
-}
-
-function onBrowserConsoleOpen(hud)
-{
- ok(hud, "browser console opened");
- Services.console.logStringMessage("test2 for bug859756");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- text: "test1 for bug859756",
- category: CATEGORY_JS,
- },
- {
- text: "test2 for bug859756",
- category: CATEGORY_JS,
- },
- {
- text: "do-not-show-me",
- category: CATEGORY_JS,
- },
- ],
- }).then(testFiltering);
-
- function testFiltering(results)
- {
- let msg = [...results[2].matched][0];
- ok(msg, "message element for do-not-show-me (nsIConsoleMessage)");
- isnot(msg.textContent.indexOf("do-not-show"), -1, "element content is correct");
- ok(!msg.classList.contains("hud-filtered-by-type"), "element is not filtered");
-
- hud.setFilterState("jslog", false);
-
- ok(msg.classList.contains("hud-filtered-by-type"), "element is filtered");
-
- hud.setFilterState("jslog", true);
-
- finishTest();
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_private_browsing.js b/browser/devtools/webconsole/test/browser_console_private_browsing.js
deleted file mode 100644
index b2932e07b..000000000
--- a/browser/devtools/webconsole/test/browser_console_private_browsing.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Bug 874061: test for how the browser and web consoles display messages coming
-// from private windows. See bug for description of expected behavior.
-
-function test()
-{
- const TEST_URI = "data:text/html;charset=utf8,<p>hello world! bug 874061" +
- "<button onclick='console.log(\"foobar bug 874061\");" +
- "fooBazBaz.yummy()'>click</button>";
- let ConsoleAPIStorage = Cu.import("resource://gre/modules/ConsoleAPIStorage.jsm", {}).ConsoleAPIStorage;
- let privateWindow, privateBrowser, privateTab, privateContent;
- let hud, expectedMessages, nonPrivateMessage;
-
- // This test is slightly more involved: it opens the web console twice,
- // a new private window once, and the browser console twice. We can get
- // a timeout with debug builds on slower machines.
- requestLongerTimeout(2);
- start();
-
- function start()
- {
- gBrowser.selectedTab = gBrowser.addTab("data:text/html;charset=utf8," +
- "<p>hello world! I am not private!");
- gBrowser.selectedBrowser.addEventListener("load", onLoadTab, true);
- }
-
- function onLoadTab()
- {
- gBrowser.selectedBrowser.removeEventListener("load", onLoadTab, true);
- info("onLoadTab()");
-
- // Make sure we have a clean state to start with.
- Services.console.reset();
- ConsoleAPIStorage.clearEvents();
-
- // Add a non-private message to the browser console.
- content.console.log("bug874061-not-private");
-
- nonPrivateMessage = {
- name: "console message from a non-private window",
- text: "bug874061-not-private",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- };
-
- privateWindow = OpenBrowserWindow({ private: true });
- ok(privateWindow, "new private window");
- ok(PrivateBrowsingUtils.isWindowPrivate(privateWindow), "window is private");
-
- whenDelayedStartupFinished(privateWindow, onPrivateWindowReady);
- }
-
- function onPrivateWindowReady()
- {
- info("private browser window opened");
- privateBrowser = privateWindow.gBrowser;
-
- privateTab = privateBrowser.selectedTab = privateBrowser.addTab(TEST_URI);
- privateBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- info("private tab opened");
- privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- privateContent = privateBrowser.selectedBrowser.contentWindow;
- ok(PrivateBrowsingUtils.isWindowPrivate(privateContent), "tab window is private");
- openConsole(privateTab, consoleOpened);
- }, true);
- }
-
- function addMessages()
- {
- let button = privateContent.document.querySelector("button");
- ok(button, "button in page");
- EventUtils.synthesizeMouse(button, 2, 2, {}, privateContent);
- }
-
- function consoleOpened(aHud)
- {
- hud = aHud;
- ok(hud, "web console opened");
-
- addMessages();
- expectedMessages = [
- {
- name: "script error",
- text: "fooBazBaz is not defined",
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- },
- {
- name: "console message",
- text: "foobar bug 874061",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- },
- ];
-
- // Make sure messages are displayed in the web console as they happen, even
- // if this is a private tab.
- waitForMessages({
- webconsole: hud,
- messages: expectedMessages,
- }).then(testCachedMessages);
- }
-
- function testCachedMessages()
- {
- info("testCachedMessages()");
- closeConsole(privateTab, () => {
- info("web console closed");
- openConsole(privateTab, consoleReopened);
- });
- }
-
- function consoleReopened(aHud)
- {
- hud = aHud;
- ok(hud, "web console reopened");
-
- // Make sure that cached messages are displayed in the web console, even
- // if this is a private tab.
- waitForMessages({
- webconsole: hud,
- messages: expectedMessages,
- }).then(testBrowserConsole);
- }
-
- function testBrowserConsole()
- {
- info("testBrowserConsole()");
- closeConsole(privateTab, () => {
- info("web console closed");
- privateWindow.HUDConsoleUI.toggleBrowserConsole().then(onBrowserConsoleOpen);
- });
- }
-
- // Make sure that the cached messages from private tabs are not displayed in
- // the browser console.
- function checkNoPrivateMessages()
- {
- let text = hud.outputNode.textContent;
- is(text.indexOf("fooBazBaz"), -1, "no exception displayed");
- is(text.indexOf("bug 874061"), -1, "no console message displayed");
- }
-
- function onBrowserConsoleOpen(aHud)
- {
- hud = aHud;
- ok(hud, "browser console opened");
-
- checkNoPrivateMessages();
- addMessages();
- expectedMessages.push(nonPrivateMessage);
-
- // Make sure that live messages are displayed in the browser console, even
- // from private tabs.
- waitForMessages({
- webconsole: hud,
- messages: expectedMessages,
- }).then(testPrivateWindowClose);
- }
-
- function testPrivateWindowClose()
- {
- info("close the private window and check if the private messages are removed");
- hud.jsterm.once("private-messages-cleared", () => {
- isnot(hud.outputNode.textContent.indexOf("bug874061-not-private"), -1,
- "non-private messages are still shown after private window closed");
- checkNoPrivateMessages();
-
- info("close the browser console");
- privateWindow.HUDConsoleUI.toggleBrowserConsole().then(() => {
- info("reopen the browser console");
- executeSoon(() =>
- HUDConsoleUI.toggleBrowserConsole().then(onBrowserConsoleReopen));
- });
- });
- privateWindow.BrowserTryToCloseWindow();
- }
-
- function onBrowserConsoleReopen(aHud)
- {
- hud = aHud;
- ok(hud, "browser console reopened");
-
- // Make sure that the non-private message is still shown after reopen.
- waitForMessages({
- webconsole: hud,
- messages: [nonPrivateMessage],
- }).then(() => {
- // Make sure that no private message is displayed after closing the private
- // window and reopening the Browser Console.
- checkNoPrivateMessages();
- executeSoon(finishTest);
- });
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_console_variables_view.js b/browser/devtools/webconsole/test/browser_console_variables_view.js
deleted file mode 100644
index c1d08f653..000000000
--- a/browser/devtools/webconsole/test/browser_console_variables_view.js
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that variables view works as expected in the web console.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
-
-let gWebConsole, gJSTerm, gVariablesView;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
- gJSTerm.execute("fooObj", onExecuteFooObj);
-}
-
-function onExecuteFooObj()
-{
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output message found");
- isnot(msg.textContent.indexOf("[object Object]"), -1, "message text check");
-
- gJSTerm.once("variablesview-fetched", onFooObjFetch);
-
- executeSoon(() =>
- EventUtils.synthesizeMouse(msg, 2, 2, {}, gWebConsole.iframeWindow)
- );
-}
-
-function onFooObjFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "testProp", value: "testValue" },
- ], { webconsole: gWebConsole }).then(onTestPropFound);
-}
-
-function onTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the |testProp| property in the variables view");
-
- is(content.wrappedJSObject.fooObj.testProp, aResults[0].value,
- "|fooObj.testProp| value is correct");
-
- // Check that property value updates work and that jsterm functions can be
- // used.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "document.title + window.location + $('p')",
- webconsole: gWebConsole,
- callback: onFooObjFetchAfterUpdate,
- });
-}
-
-function onFooObjFetchAfterUpdate(aEvent, aVar)
-{
- info("onFooObjFetchAfterUpdate");
- let para = content.wrappedJSObject.document.querySelector("p");
- let expectedValue = content.document.title + content.location + para;
-
- findVariableViewProperties(aVar, [
- { name: "testProp", value: expectedValue },
- ], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
-}
-
-function onUpdatedTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the updated |testProp| property value");
-
- is(content.wrappedJSObject.fooObj.testProp, aResults[0].value,
- "|fooObj.testProp| value has been updated");
-
- // Check that property name updates work.
- updateVariablesViewProperty({
- property: prop,
- field: "name",
- string: "testUpdatedProp",
- webconsole: gWebConsole,
- callback: onFooObjFetchAfterPropRename,
- });
-}
-
-function onFooObjFetchAfterPropRename(aEvent, aVar)
-{
- info("onFooObjFetchAfterPropRename");
-
- let para = content.wrappedJSObject.document.querySelector("p");
- let expectedValue = content.document.title + content.location + para;
-
- // Check that the new value is in the variables view.
- findVariableViewProperties(aVar, [
- { name: "testUpdatedProp", value: expectedValue },
- ], { webconsole: gWebConsole }).then(onRenamedTestPropFound);
-}
-
-function onRenamedTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the renamed |testProp| property");
-
- ok(!content.wrappedJSObject.fooObj.testProp,
- "|fooObj.testProp| has been deleted");
- is(content.wrappedJSObject.fooObj.testUpdatedProp, aResults[0].value,
- "|fooObj.testUpdatedProp| is correct");
-
- // Check that property value updates that cause exceptions are reported in
- // the web console output.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "foobarzFailure()",
- webconsole: gWebConsole,
- callback: onPropUpdateError,
- });
-}
-
-function onPropUpdateError(aEvent, aVar)
-{
- info("onPropUpdateError");
-
- let para = content.wrappedJSObject.document.querySelector("p");
- let expectedValue = content.document.title + content.location + para;
-
- // Make sure the property did not change.
- findVariableViewProperties(aVar, [
- { name: "testUpdatedProp", value: expectedValue },
- ], { webconsole: gWebConsole }).then(onRenamedTestPropFoundAgain);
-}
-
-function onRenamedTestPropFoundAgain(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the renamed |testProp| property again");
-
- let outputNode = gWebConsole.outputNode;
-
- waitForSuccess({
- name: "exception in property update reported in the web console output",
- validatorFn: () => outputNode.textContent.indexOf("foobarzFailure") != -1,
- successFn: testPropDelete.bind(null, prop),
- failureFn: testPropDelete.bind(null, prop),
- });
-}
-
-function testPropDelete(aProp)
-{
- gVariablesView.window.focus();
- aProp.focus();
-
- executeSoon(() => {
- EventUtils.synthesizeKey("VK_DELETE", {}, gVariablesView.window);
- gWebConsole = gJSTerm = gVariablesView = null;
- });
-
- waitForSuccess({
- name: "property deleted",
- validatorFn: () => !("testUpdatedProp" in content.wrappedJSObject.fooObj),
- successFn: finishTest,
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging.js b/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging.js
deleted file mode 100644
index 1ff987c68..000000000
--- a/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that makes sure web console eval happens in the user-selected stackframe
-// from the js debugger, when changing the value of a property in the variables
-// view.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
-
-let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
- gStackframes, gVariablesView;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
-
- executeSoon(() => {
- info("openDebugger");
- openDebugger().then(debuggerOpened);
- });
-}
-
-function debuggerOpened(aResult)
-{
- gDebuggerWin = aResult.panelWin;
- gDebuggerController = gDebuggerWin.DebuggerController;
- gThread = gDebuggerController.activeThread;
- gStackframes = gDebuggerController.StackFrames;
-
- executeSoon(() => {
- gThread.addOneTimeListener("framesadded", onFramesAdded);
-
- info("firstCall()");
- content.wrappedJSObject.firstCall();
- });
-}
-
-function onFramesAdded()
-{
- info("onFramesAdded");
-
- executeSoon(() =>
- openConsole(null, () =>
- gJSTerm.execute("fooObj", onExecuteFooObj)
- )
- );
-}
-
-
-function onExecuteFooObj()
-{
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output message found");
- isnot(msg.textContent.indexOf("[object Object]"), -1, "message text check");
-
- gJSTerm.once("variablesview-fetched", onFooObjFetch);
-
- executeSoon(() => EventUtils.synthesizeMouse(msg, 2, 2, {},
- gWebConsole.iframeWindow));
-}
-
-function onFooObjFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "testProp2", value: "testValue2" },
- { name: "testProp", value: "testValue", dontMatch: true },
- ], { webconsole: gWebConsole }).then(onTestPropFound);
-}
-
-function onTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the |testProp2| property in the variables view");
-
- // Check that property value updates work and that jsterm functions can be
- // used.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "document.title + foo2 + $('p')",
- webconsole: gWebConsole,
- callback: onFooObjFetchAfterUpdate,
- });
-}
-
-function onFooObjFetchAfterUpdate(aEvent, aVar)
-{
- info("onFooObjFetchAfterUpdate");
- let para = content.wrappedJSObject.document.querySelector("p");
- let expectedValue = content.document.title + "foo2SecondCall" + para;
-
- findVariableViewProperties(aVar, [
- { name: "testProp2", value: expectedValue },
- ], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
-}
-
-function onUpdatedTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the updated |testProp2| property value");
-
- // Check that testProp2 was updated.
- executeSoon(() => gJSTerm.execute("fooObj.testProp2", onExecuteFooObjTestProp2));
-}
-
-function onExecuteFooObjTestProp2()
-{
- let para = content.wrappedJSObject.document.querySelector("p");
- let expected = content.document.title + "foo2SecondCall" + para;
-
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "fooObj.testProp2 is correct");
-
- gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController =
- gStackframes = gVariablesView = null;
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging_and_inspecting.js b/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging_and_inspecting.js
deleted file mode 100644
index cecc24b72..000000000
--- a/browser/devtools/webconsole/test/browser_console_variables_view_while_debugging_and_inspecting.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that makes sure web console eval works while the js debugger paused the
-// page, and while the inspector is active. See bug 886137.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
-
-let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController,
- gStackframes, gVariablesView;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
-
- info("openDebugger");
- openDebugger().then(debuggerOpened);
-}
-
-function debuggerOpened(aResult)
-{
- gDebuggerWin = aResult.panelWin;
- gDebuggerController = gDebuggerWin.DebuggerController;
- gThread = gDebuggerController.activeThread;
- gStackframes = gDebuggerController.StackFrames;
-
- openInspector(inspectorOpened);
-}
-
-function inspectorOpened(aPanel)
-{
- gThread.addOneTimeListener("framesadded", onFramesAdded);
-
- info("firstCall()");
- content.wrappedJSObject.firstCall();
-}
-
-function onFramesAdded()
-{
- info("onFramesAdded");
-
- openConsole(null, () => gJSTerm.execute("fooObj", onExecuteFooObj));
-}
-
-function onExecuteFooObj()
-{
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output message found");
- isnot(msg.textContent.indexOf("[object Object]"), -1, "message text check");
-
- gJSTerm.once("variablesview-fetched", onFooObjFetch);
-
- EventUtils.synthesizeMouse(msg, 2, 2, {}, gWebConsole.iframeWindow);
-}
-
-function onFooObjFetch(aEvent, aVar)
-{
- gVariablesView = aVar._variablesView;
- ok(gVariablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "testProp2", value: "testValue2" },
- { name: "testProp", value: "testValue", dontMatch: true },
- ], { webconsole: gWebConsole }).then(onTestPropFound);
-}
-
-function onTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the |testProp2| property in the variables view");
-
- // Check that property value updates work and that jsterm functions can be
- // used.
- updateVariablesViewProperty({
- property: prop,
- field: "value",
- string: "document.title + foo2 + $('p')",
- webconsole: gWebConsole,
- callback: onFooObjFetchAfterUpdate,
- });
-}
-
-function onFooObjFetchAfterUpdate(aEvent, aVar)
-{
- info("onFooObjFetchAfterUpdate");
- let para = content.wrappedJSObject.document.querySelector("p");
- let expectedValue = content.document.title + "foo2SecondCall" + para;
-
- findVariableViewProperties(aVar, [
- { name: "testProp2", value: expectedValue },
- ], { webconsole: gWebConsole }).then(onUpdatedTestPropFound);
-}
-
-function onUpdatedTestPropFound(aResults)
-{
- let prop = aResults[0].matchedProp;
- ok(prop, "matched the updated |testProp2| property value");
-
- // Check that testProp2 was updated.
- gJSTerm.execute("fooObj.testProp2", onExecuteFooObjTestProp2);
-}
-
-function onExecuteFooObjTestProp2()
-{
- let para = content.wrappedJSObject.document.querySelector("p");
- let expected = content.document.title + "foo2SecondCall" + para;
-
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "fooObj.testProp2 is correct");
-
- gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController =
- gStackframes = gVariablesView = null;
-
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_eval_in_debugger_stackframe.js b/browser/devtools/webconsole/test/browser_eval_in_debugger_stackframe.js
deleted file mode 100644
index 4dd3d6c76..000000000
--- a/browser/devtools/webconsole/test/browser_eval_in_debugger_stackframe.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Test that makes sure web console eval happens in the user-selected stackframe
-// from the js debugger.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-eval-in-stackframe.html";
-
-let gWebConsole, gJSTerm, gDebuggerWin, gThread, gDebuggerController, gStackframes;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud)
-{
- gWebConsole = hud;
- gJSTerm = hud.jsterm;
- gJSTerm.execute("foo", onExecuteFoo);
-}
-
-function onExecuteFoo()
-{
- isnot(gWebConsole.outputNode.textContent.indexOf("globalFooBug783499"), -1,
- "|foo| value is correct");
-
- gJSTerm.clearOutput();
-
- // Test for Bug 690529 - Web Console and Scratchpad should evaluate
- // expressions in the scope of the content window, not in a sandbox.
- executeSoon(() => gJSTerm.execute("foo2 = 'newFoo'; window.foo2", onNewFoo2));
-}
-
-function onNewFoo2()
-{
- is(gWebConsole.outputNode.textContent.indexOf("undefined"), -1,
- "|undefined| is not displayed after adding |foo2|");
-
- let msg = gWebConsole.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "output result found");
-
- isnot(msg.textContent.indexOf("newFoo"), -1,
- "'newFoo' is displayed after adding |foo2|");
-
- gJSTerm.clearOutput();
-
- info("openDebugger");
- executeSoon(() => openDebugger().then(debuggerOpened));
-}
-
-function debuggerOpened(aResult)
-{
- gDebuggerWin = aResult.panelWin;
- gDebuggerController = gDebuggerWin.DebuggerController;
- gThread = gDebuggerController.activeThread;
- gStackframes = gDebuggerController.StackFrames;
-
- info("openConsole");
- executeSoon(() =>
- openConsole(null, () =>
- gJSTerm.execute("foo + foo2", onExecuteFooAndFoo2)
- )
- );
-}
-
-function onExecuteFooAndFoo2()
-{
- let expected = "globalFooBug783499newFoo";
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "|foo + foo2| is displayed after starting the debugger");
-
- executeSoon(() => {
- gJSTerm.clearOutput();
-
- info("openDebugger");
- openDebugger().then(() => {
- gThread.addOneTimeListener("framesadded", onFramesAdded);
-
- info("firstCall()");
- content.wrappedJSObject.firstCall();
- });
- });
-}
-
-function onFramesAdded()
-{
- info("onFramesAdded, openConsole() now");
- executeSoon(() =>
- openConsole(null, () =>
- gJSTerm.execute("foo + foo2", onExecuteFooAndFoo2InSecondCall)
- )
- );
-}
-
-function onExecuteFooAndFoo2InSecondCall()
-{
- let expected = "globalFooBug783499foo2SecondCall";
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "|foo + foo2| from |secondCall()|");
-
- executeSoon(() => {
- gJSTerm.clearOutput();
-
- info("openDebugger and selectFrame(1)");
-
- openDebugger().then(() => {
- gStackframes.selectFrame(1);
-
- info("openConsole");
- executeSoon(() =>
- openConsole(null, () =>
- gJSTerm.execute("foo + foo2 + foo3", onExecuteFoo23InFirstCall)
- )
- );
- });
- });
-}
-
-function onExecuteFoo23InFirstCall()
-{
- let expected = "fooFirstCallnewFoofoo3FirstCall";
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "|foo + foo2 + foo3| from |firstCall()|");
-
- executeSoon(() =>
- gJSTerm.execute("foo = 'abba'; foo3 = 'bug783499'; foo + foo3",
- onExecuteFooAndFoo3ChangesInFirstCall));
-}
-
-function onExecuteFooAndFoo3ChangesInFirstCall()
-{
- let expected = "abbabug783499";
- isnot(gWebConsole.outputNode.textContent.indexOf(expected), -1,
- "|foo + foo3| updated in |firstCall()|");
-
- is(content.wrappedJSObject.foo, "globalFooBug783499", "|foo| in content window");
- is(content.wrappedJSObject.foo2, "newFoo", "|foo2| in content window");
- ok(!content.wrappedJSObject.foo3, "|foo3| was not added to the content window");
-
- gWebConsole = gJSTerm = gDebuggerWin = gThread = gDebuggerController =
- gStackframes = null;
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_jsterm_inspect.js b/browser/devtools/webconsole/test/browser_jsterm_inspect.js
deleted file mode 100644
index 4dac58b34..000000000
--- a/browser/devtools/webconsole/test/browser_jsterm_inspect.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Check that the inspect() jsterm helper function works.
-
-function test()
-{
- const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-
- function consoleOpened(hud)
- {
- content.wrappedJSObject.testProp = "testValue";
-
- hud.jsterm.once("variablesview-fetched", onObjFetch);
- hud.jsterm.execute("inspect(window)");
- }
-
- function onObjFetch(aEvent, aVar)
- {
- ok(aVar._variablesView, "variables view object");
-
- findVariableViewProperties(aVar, [
- { name: "testProp", value: "testValue" },
- { name: "document", value: "[object HTMLDocument]" },
- ], { webconsole: hud }).then(finishTest);
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_longstring_hang.js b/browser/devtools/webconsole/test/browser_longstring_hang.js
deleted file mode 100644
index 0a3600680..000000000
--- a/browser/devtools/webconsole/test/browser_longstring_hang.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that very long strings do not hang the browser.
-
-function test()
-{
- waitForExplicitFinish();
-
- let DebuggerServer = Cu.import("resource://gre/modules/devtools/dbg-server.jsm",
- {}).DebuggerServer;
-
- addTab("http://example.com/browser/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html");
-
- let hud = null;
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(null, performTest);
- }, true);
-
- function performTest(aHud)
- {
- hud = aHud;
-
- info("wait for the initial long string");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "find 'foobar', no 'foobaz', in long string output",
- text: "foobar",
- noText: "foobaz",
- category: CATEGORY_WEBDEV,
- longString: true,
- },
- ],
- }).then(onInitialString);
- }
-
- function onInitialString(aResults)
- {
- let clickable = aResults[0].longStrings[0];
- ok(clickable, "long string ellipsis is shown");
-
- scrollOutputToNode(clickable);
-
- executeSoon(() => {
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
-
- info("wait for long string expansion");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "find 'foobaz' after expand, but no 'boom!' at the end",
- text: "foobaz",
- noText: "boom!",
- category: CATEGORY_WEBDEV,
- longString: false,
- },
- {
- text: "too long to be displayed",
- longString: false,
- },
- ],
- }).then(finishTest);
- });
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_netpanel_longstring_expand.js b/browser/devtools/webconsole/test/browser_netpanel_longstring_expand.js
deleted file mode 100644
index 8488ad37e..000000000
--- a/browser/devtools/webconsole/test/browser_netpanel_longstring_expand.js
+++ /dev/null
@@ -1,309 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the network panel works with LongStringActors.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
-
-const TEST_IMG_BASE64 =
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
- "OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
- "FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
- "FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
- "BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
- "BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
- "A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
- "Dr4AAAAASUVORK5CYII=";
-
-let testDriver;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testNetworkPanel);
- }, true);
-}
-
-function testNetworkPanel() {
- testDriver = testGen();
- testDriver.next();
-}
-
-function checkIsVisible(aPanel, aList) {
- for (let id in aList) {
- let node = aPanel.document.getElementById(id);
- let isVisible = aList[id];
- is(node.style.display, (isVisible ? "block" : "none"), id + " isVisible=" + isVisible);
- }
-}
-
-function checkNodeContent(aPanel, aId, aContent) {
- let node = aPanel.document.getElementById(aId);
- if (node == null) {
- ok(false, "Tried to access node " + aId + " that doesn't exist!");
- }
- else if (node.textContent.indexOf(aContent) != -1) {
- ok(true, "checking content of " + aId);
- }
- else {
- ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
- }
-}
-
-function checkNodeKeyValue(aPanel, aId, aKey, aValue) {
- let node = aPanel.document.getElementById(aId);
-
- let headers = node.querySelectorAll("th");
- for (let i = 0; i < headers.length; i++) {
- if (headers[i].textContent == (aKey + ":")) {
- is(headers[i].nextElementSibling.textContent, aValue,
- "checking content of " + aId + " for key " + aKey);
- return;
- }
- }
-
- ok(false, "content check failed for " + aId + ", key " + aKey);
-}
-
-function testGen() {
- let hud = HUDService.getHudByWindow(content);
- let filterBox = hud.ui.filterBox;
-
- let headerValue = (new Array(456)).join("fooz bar");
- let headerValueGrip = {
- type: "longString",
- initial: headerValue.substr(0, 123),
- length: headerValue.length,
- actor: "faktor",
- _fullString: headerValue,
- };
-
- let imageContentGrip = {
- type: "longString",
- initial: TEST_IMG_BASE64.substr(0, 143),
- length: TEST_IMG_BASE64.length,
- actor: "faktor2",
- _fullString: TEST_IMG_BASE64,
- };
-
- let postDataValue = (new Array(123)).join("post me");
- let postDataGrip = {
- type: "longString",
- initial: postDataValue.substr(0, 172),
- length: postDataValue.length,
- actor: "faktor3",
- _fullString: postDataValue,
- };
-
- let httpActivity = {
- updates: ["responseContent", "eventTimings"],
- discardRequestBody: false,
- discardResponseBody: false,
- startedDateTime: (new Date()).toISOString(),
- request: {
- url: TEST_IMG,
- method: "GET",
- cookies: [],
- headers: [
- { name: "foo", value: "bar" },
- { name: "loongstring", value: headerValueGrip },
- ],
- postData: { text: postDataGrip },
- },
- response: {
- httpVersion: "HTTP/3.14",
- status: 2012,
- statusText: "ddahl likes tacos :)",
- headers: [
- { name: "Content-Type", value: "image/png" },
- ],
- content: { mimeType: "image/png", text: imageContentGrip },
- cookies: [],
- },
- timings: { wait: 15, receive: 23 },
- };
-
- let networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
-
- is(filterBox._netPanel, networkPanel,
- "Network panel stored on the anchor object");
-
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- info("test 1: check if a header value is expandable");
-
- checkIsVisible(networkPanel, {
- requestCookie: false,
- requestFormData: false,
- requestBody: false,
- requestBodyFetchLink: true,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: true,
- responseImageCached: false,
- responseBodyFetchLink: true,
- });
-
- checkNodeKeyValue(networkPanel, "requestHeadersContent", "foo", "bar");
- checkNodeKeyValue(networkPanel, "requestHeadersContent", "loongstring",
- headerValueGrip.initial + "[\u2026]");
-
- let webConsoleClient = networkPanel.webconsole.webConsoleClient;
- let longStringFn = webConsoleClient.longString;
-
- let expectedGrip = headerValueGrip;
-
- function longStringClientProvider(aLongString)
- {
- is(aLongString, expectedGrip,
- "longString grip is correct");
-
- return {
- initial: expectedGrip.initial,
- length: expectedGrip.length,
- substring: function(aStart, aEnd, aCallback) {
- is(aStart, expectedGrip.initial.length,
- "substring start is correct");
- is(aEnd, expectedGrip.length,
- "substring end is correct");
-
- executeSoon(function() {
- aCallback({
- substring: expectedGrip._fullString.substring(aStart, aEnd),
- });
-
- executeSoon(function() {
- testDriver.next();
- });
- });
- },
- };
- }
-
- webConsoleClient.longString = longStringClientProvider;
-
- let clickable = networkPanel.document
- .querySelector("#requestHeadersContent .longStringEllipsis");
- ok(clickable, "long string ellipsis is shown");
-
- EventUtils.sendMouseEvent({ type: "mousedown"}, clickable,
- networkPanel.document.defaultView);
-
- yield;
-
- clickable = networkPanel.document
- .querySelector("#requestHeadersContent .longStringEllipsis");
- ok(!clickable, "long string ellipsis is not shown");
-
- checkNodeKeyValue(networkPanel, "requestHeadersContent", "loongstring",
- expectedGrip._fullString);
-
- info("test 2: check that response body image fetching works");
- expectedGrip = imageContentGrip;
-
- let imgNode = networkPanel.document.getElementById("responseImageNode");
- ok(!imgNode.getAttribute("src"), "no image is displayed");
-
- clickable = networkPanel.document.querySelector("#responseBodyFetchLink");
- EventUtils.sendMouseEvent({ type: "mousedown"}, clickable,
- networkPanel.document.defaultView);
-
- yield;
-
- imgNode = networkPanel.document.getElementById("responseImageNode");
- is(imgNode.getAttribute("src"), "data:image/png;base64," + TEST_IMG_BASE64,
- "displayed image is correct");
- is(clickable.style.display, "none", "#responseBodyFetchLink is not visible");
-
- info("test 3: expand the request body");
-
- expectedGrip = postDataGrip;
-
- clickable = networkPanel.document.querySelector("#requestBodyFetchLink");
- EventUtils.sendMouseEvent({ type: "mousedown"}, clickable,
- networkPanel.document.defaultView);
- yield;
-
- is(clickable.style.display, "none", "#requestBodyFetchLink is not visible");
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestBodyFetchLink: false,
- });
-
- checkNodeContent(networkPanel, "requestBodyContent", expectedGrip._fullString);
-
- webConsoleClient.longString = longStringFn;
-
- networkPanel.panel.hidePopup();
-
- info("test 4: reponse body long text");
-
- httpActivity.response.content.mimeType = "text/plain";
- httpActivity.response.headers[0].value = "text/plain";
-
- expectedGrip = imageContentGrip;
-
- // Reset response.content.text to avoid caching of the full string.
- httpActivity.response.content.text = expectedGrip;
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- is(filterBox._netPanel, networkPanel,
- "Network panel stored on httpActivity object");
-
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestCookie: false,
- requestFormData: false,
- requestBody: true,
- requestBodyFetchLink: false,
- responseContainer: true,
- responseBody: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false,
- responseBodyFetchLink: true,
- });
-
- checkNodeContent(networkPanel, "responseBodyContent", expectedGrip.initial);
-
- webConsoleClient.longString = longStringClientProvider;
-
- clickable = networkPanel.document.querySelector("#responseBodyFetchLink");
- EventUtils.sendMouseEvent({ type: "mousedown"}, clickable,
- networkPanel.document.defaultView);
-
- yield;
-
- webConsoleClient.longString = longStringFn;
- is(clickable.style.display, "none", "#responseBodyFetchLink is not visible");
- checkNodeContent(networkPanel, "responseBodyContent", expectedGrip._fullString);
-
- networkPanel.panel.hidePopup();
-
- // All done!
- testDriver = null;
- executeSoon(finishTest);
-
- yield;
-}
diff --git a/browser/devtools/webconsole/test/browser_output_breaks_after_console_dir_uninspectable.js b/browser/devtools/webconsole/test/browser_output_breaks_after_console_dir_uninspectable.js
deleted file mode 100644
index 935a13932..000000000
--- a/browser/devtools/webconsole/test/browser_output_breaks_after_console_dir_uninspectable.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Make sure that the Web Console output does not break after we try to call
-// console.dir() for objects that are not inspectable.
-
-function test()
-{
- waitForExplicitFinish();
-
- addTab("data:text/html;charset=utf8,test for bug 773466");
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(null, performTest);
- }, true);
-}
-
-function performTest(hud)
-{
- hud.jsterm.clearOutput(true);
-
- hud.jsterm.execute("console.log('fooBug773466a')");
- hud.jsterm.execute("myObj = Object.create(null)");
- hud.jsterm.execute("console.dir(myObj)");
- waitForSuccess({
- name: "eval results are shown",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-msg-inspector");
- },
- successFn: function()
- {
- isnot(hud.outputNode.textContent.indexOf("fooBug773466a"), -1,
- "fooBug773466a shows");
- ok(hud.outputNode.querySelector(".webconsole-msg-inspector"),
- "the console.dir() tree shows");
-
- content.console.log("fooBug773466b");
-
- waitForSuccess(waitForAnotherConsoleLogCall);
- },
- failureFn: finishTest,
- });
-
- let waitForAnotherConsoleLogCall = {
- name: "eval result after console.dir()",
- validatorFn: function()
- {
- return hud.outputNode.textContent.indexOf("fooBug773466b") > -1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- };
-}
diff --git a/browser/devtools/webconsole/test/browser_output_longstring_expand.js b/browser/devtools/webconsole/test/browser_output_longstring_expand.js
deleted file mode 100644
index 014c6d2bd..000000000
--- a/browser/devtools/webconsole/test/browser_output_longstring_expand.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test that long strings can be expanded in the console output.
-
-function test()
-{
- waitForExplicitFinish();
-
- let tempScope = {};
- Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
- let DebuggerServer = tempScope.DebuggerServer;
-
- let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 4)).join("a") +
- "foobar";
- let initialString =
- longString.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
-
- addTab("data:text/html;charset=utf8,test for bug 787981 - check that long strings can be expanded in the output.");
-
- let hud = null;
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(null, performTest);
- }, true);
-
- function performTest(aHud)
- {
- hud = aHud;
-
- hud.jsterm.clearOutput(true);
- hud.jsterm.execute("console.log('bazbaz', '" + longString +"', 'boom')");
-
- waitForSuccess(waitForConsoleLog);
- }
-
- let waitForConsoleLog = {
- name: "console.log output shown",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-msg-console");
- },
- successFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-console");
- is(msg.textContent.indexOf("foobar"), -1,
- "foobar is not shown");
- isnot(msg.textContent.indexOf("bazbaz"), -1,
- "bazbaz is shown");
- isnot(msg.textContent.indexOf("boom"), -1,
- "boom is shown");
- isnot(msg.textContent.indexOf(initialString), -1,
- "initial string is shown");
-
- let clickable = msg.querySelector(".longStringEllipsis");
- ok(clickable, "long string ellipsis is shown");
-
- scrollToVisible(clickable);
-
- executeSoon(function() {
- EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
- waitForSuccess(waitForFullString);
- });
- },
- failureFn: finishTest,
- };
-
- let waitForFullString = {
- name: "full string shown",
- validatorFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-log");
- return msg.textContent.indexOf(longString) > -1;
- },
- successFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-log");
- isnot(msg.textContent.indexOf("bazbaz"), -1,
- "bazbaz is shown");
- isnot(msg.textContent.indexOf("boom"), -1,
- "boom is shown");
-
- let clickable = msg.querySelector(".longStringEllipsis");
- ok(!clickable, "long string ellipsis is not shown");
-
- executeSoon(function() {
- hud.jsterm.clearOutput(true);
- hud.jsterm.execute("'" + longString +"'");
- waitForSuccess(waitForExecute);
- });
- },
- failureFn: finishTest,
- };
-
- let waitForExecute = {
- name: "execute() output shown",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-output");
- isnot(msg.textContent.indexOf(initialString), -1,
- "initial string is shown");
- is(msg.textContent.indexOf(longString), -1,
- "full string is not shown");
-
- let clickable = msg.querySelector(".longStringEllipsis");
- ok(clickable, "long string ellipsis is shown");
-
- scrollToVisible(clickable);
-
- executeSoon(function() {
- EventUtils.synthesizeMouse(clickable, 3, 4, {}, hud.iframeWindow);
- waitForSuccess(waitForFullStringAfterExecute);
- });
- },
- failureFn: finishTest,
- };
-
- let waitForFullStringAfterExecute = {
- name: "full string shown again",
- validatorFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-output");
- return msg.textContent.indexOf(longString) > -1;
- },
- successFn: function()
- {
- let msg = hud.outputNode.querySelector(".webconsole-msg-output");
- let clickable = msg.querySelector(".longStringEllipsis");
- ok(!clickable, "long string ellipsis is not shown");
-
- executeSoon(finishTest);
- },
- failureFn: finishTest,
- };
-
- function scrollToVisible(aNode)
- {
- let richListBoxNode = aNode.parentNode;
- while (richListBoxNode.tagName != "richlistbox") {
- richListBoxNode = richListBoxNode.parentNode;
- }
-
- let boxObject = richListBoxNode.scrollBoxObject;
- let nsIScrollBoxObject = boxObject.QueryInterface(Ci.nsIScrollBoxObject);
- nsIScrollBoxObject.ensureElementIsVisible(aNode);
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_repeated_messages_accuracy.js b/browser/devtools/webconsole/test/browser_repeated_messages_accuracy.js
deleted file mode 100644
index 753257c19..000000000
--- a/browser/devtools/webconsole/test/browser_repeated_messages_accuracy.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that makes sure messages are not considered repeated when coming from
-// different lines of code, or from different severities, etc.
-// See bugs 720180 and 800510.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html";
-
-function test() {
- const PREF = "devtools.webconsole.persistlog";
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- // Check that css warnings are not coalesced if they come from different lines.
- info("waiting for 2 css warnings");
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "two css warnings",
- category: CATEGORY_CSS,
- count: 2,
- repeats: 1,
- }],
- }).then(testCSSRepeats.bind(null, hud));
-}
-
-function testCSSRepeats(hud) {
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- info("wait for repeats after page reload");
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "two css warnings, repeated twice",
- category: CATEGORY_CSS,
- repeats: 2,
- count: 2,
- }],
- }).then(testCSSRepeatsAfterReload.bind(null, hud));
- }, true);
- content.location.reload();
-}
-
-function testCSSRepeatsAfterReload(hud) {
- hud.jsterm.clearOutput(true);
- content.wrappedJSObject.testConsole();
-
- info("wait for repeats with the console API");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "console.log 'foo repeat' repeated twice",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- repeats: 2,
- },
- {
- name: "console.log 'foo repeat' repeated once",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- repeats: 1,
- },
- {
- name: "console.error 'foo repeat' repeated once",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_ERROR,
- repeats: 1,
- },
- ],
- }).then(testConsoleRepeats.bind(null, hud));
-}
-
-function testConsoleRepeats(hud) {
- hud.jsterm.clearOutput(true);
- hud.jsterm.execute("undefined");
- content.console.log("undefined");
-
- info("make sure console API messages are not coalesced with jsterm output");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "'undefined' jsterm input message",
- text: "undefined",
- category: CATEGORY_INPUT,
- repeats: 1,
- },
- {
- name: "'undefined' jsterm output message",
- text: "undefined",
- category: CATEGORY_OUTPUT,
- repeats: 1,
- },
- {
- name: "'undefined' console.log message",
- text: "undefined",
- category: CATEGORY_WEBDEV,
- repeats: 1,
- },
- ],
- }).then(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_result_format_as_string.js b/browser/devtools/webconsole/test/browser_result_format_as_string.js
deleted file mode 100644
index c887fb309..000000000
--- a/browser/devtools/webconsole/test/browser_result_format_as_string.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Make sure that JS eval result are properly formatted as strings.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-result-format-as-string.html";
-
-function test()
-{
- waitForExplicitFinish();
-
- addTab(TEST_URI);
-
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- openConsole(null, performTest);
- }, true);
-}
-
-function performTest(hud)
-{
- hud.jsterm.clearOutput(true);
-
- hud.jsterm.execute("document.querySelector('p')");
- waitForSuccess({
- name: "eval result shown",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- is(hud.outputNode.textContent.indexOf("bug772506_content"), -1,
- "no content element found");
- ok(!hud.outputNode.querySelector("div"), "no div element found");
-
- let msg = hud.outputNode.querySelector(".webconsole-msg-output");
- ok(msg, "eval output node found");
- is(msg.textContent.indexOf("HTMLDivElement"), -1,
- "HTMLDivElement string not displayed");
- EventUtils.synthesizeMouseAtCenter(msg, {type: "mousemove"});
- ok(!gBrowser._bug772506, "no content variable");
-
- finishTest();
- },
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_warn_user_about_replaced_api.js b/browser/devtools/webconsole/test/browser_warn_user_about_replaced_api.js
deleted file mode 100644
index 42e011339..000000000
--- a/browser/devtools/webconsole/test/browser_warn_user_about_replaced_api.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_REPLACED_API_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-replaced-api.html";
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/testscript.js";
-
-function test() {
- waitForExplicitFinish();
-
- const PREF = "devtools.webconsole.persistlog";
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- // First test that the warning does not appear on a page that doesn't override
- // the window.console object.
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testWarningNotPresent);
- }, true);
-
- function testWarningNotPresent(hud)
- {
- is(hud.outputNode.textContent.indexOf("logging API"), -1,
- "no warning displayed");
-
- // Bug 862024: make sure the warning doesn't show after page reload.
- info("reload " + TEST_URI);
- executeSoon(() => content.location.reload());
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "testscript.js",
- category: CATEGORY_NETWORK,
- }],
- }).then(() => executeSoon(() => {
- is(hud.outputNode.textContent.indexOf("logging API"), -1,
- "no warning displayed");
-
- closeConsole(null, loadTestPage);
- }));
- }
-
- function loadTestPage()
- {
- info("load test " + TEST_REPLACED_API_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testWarningPresent);
- }, true);
- content.location = TEST_REPLACED_API_URI;
- }
-
- function testWarningPresent(hud)
- {
- info("wait for the warning to show");
- let warning = {
- webconsole: hud,
- messages: [{
- text: /logging API .+ disabled by a script/,
- category: CATEGORY_JS,
- severity: SEVERITY_WARNING,
- }],
- };
-
- waitForMessages(warning).then(() => {
- hud.jsterm.clearOutput();
-
- executeSoon(() => {
- info("reload the test page and wait for the warning to show");
- waitForMessages(warning).then(finishTest);
- content.location.reload();
- });
- });
- }
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js b/browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js
deleted file mode 100644
index 1bc94b5d3..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_abbreviate_source_url.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that source URLs are abbreviated properly for display on the right-
-// hand side of the Web Console.
-
-function test() {
- testAbbreviation("http://example.com/x.js", "x.js");
- testAbbreviation("http://example.com/foo/bar/baz/boo.js", "boo.js");
- testAbbreviation("http://example.com/foo/bar/", "bar");
- testAbbreviation("http://example.com/foo.js?bar=1&baz=2", "foo.js");
- testAbbreviation("http://example.com/foo/?bar=1&baz=2", "foo");
-
- finishTest();
-}
-
-function testAbbreviation(aFullURL, aAbbreviatedURL) {
- is(WebConsoleUtils.abbreviateSourceURL(aFullURL), aAbbreviatedURL, aFullURL +
- " is abbreviated to " + aAbbreviatedURL);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_basic_net_logging.js b/browser/devtools/webconsole/test/browser_webconsole_basic_net_logging.js
deleted file mode 100644
index c35cbd7d5..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_basic_net_logging.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the page's resources are displayed in the console as they're
-// loaded
-
-const TEST_NETWORK_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html" + "?_date=" + Date.now();
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console basic network logging test");
- browser.addEventListener("load", onLoad, true);
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, function() {
- browser.addEventListener("load", testBasicNetLogging, true);
- content.location = TEST_NETWORK_URI;
- });
-}
-
-function testBasicNetLogging(aEvent) {
- browser.removeEventListener(aEvent.type, testBasicNetLogging, true);
-
- outputNode = HUDService.getHudByWindow(content).outputNode;
-
- waitForSuccess({
- name: "network console message",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("running network console") > -1;
- },
- successFn: function()
- {
- findLogEntry("test-network.html");
- findLogEntry("testscript.js");
- findLogEntry("test-image.png");
- finishTest();
- },
- failureFn: finishTest,
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js b/browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js
deleted file mode 100644
index 2c6e294fd..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_578437_page_reload.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the console object still exists after a page reload.
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("DOMContentLoaded", onLoad, false);
-}
-
-function onLoad() {
- browser.removeEventListener("DOMContentLoaded", onLoad, false);
-
- openConsole();
-
- browser.addEventListener("DOMContentLoaded", testPageReload, false);
- content.location.reload();
-}
-
-function testPageReload() {
-
- browser.removeEventListener("DOMContentLoaded", testPageReload, false);
-
- let console = browser.contentWindow.wrappedJSObject.console;
-
- is(typeof console, "object", "window.console is an object, after page reload");
- is(typeof console.log, "function", "console.log is a function");
- is(typeof console.info, "function", "console.info is a function");
- is(typeof console.warn, "function", "console.warn is a function");
- is(typeof console.error, "function", "console.error is a function");
- is(typeof console.exception, "function", "console.exception is a function");
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_579412_input_focus.js b/browser/devtools/webconsole/test/browser_webconsole_bug_579412_input_focus.js
deleted file mode 100644
index d13a97fe0..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_579412_input_focus.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the input field is focused when the console is opened.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("DOMContentLoaded", testInputFocus, false);
-}
-
-function testInputFocus() {
- browser.removeEventListener("DOMContentLoaded", testInputFocus, false);
-
- openConsole(null, function(hud) {
- let inputNode = hud.jsterm.inputNode;
- ok(inputNode.getAttribute("focused"), "input node is focused");
-
- finishTest();
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_580001_closing_after_completion.js b/browser/devtools/webconsole/test/browser_webconsole_bug_580001_closing_after_completion.js
deleted file mode 100644
index 86a9d8ff8..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_580001_closing_after_completion.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests to ensure that errors don't appear when the console is closed while a
-// completion is being performed.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testClosingAfterCompletion);
- }, true);
-}
-
-function testClosingAfterCompletion(hud) {
- let inputNode = hud.jsterm.inputNode;
-
- let errorWhileClosing = false;
- function errorListener(evt) {
- errorWhileClosing = true;
- }
-
- browser.addEventListener("error", errorListener, false);
-
- // Focus the inputNode and perform the keycombo to close the WebConsole.
- inputNode.focus();
-
- gDevTools.once("toolbox-destroyed", function() {
- browser.removeEventListener("error", errorListener, false);
- is(errorWhileClosing, false, "no error while closing the WebConsole");
- finishTest();
- });
-
- if (Services.appinfo.OS == "Darwin") {
- EventUtils.synthesizeKey("k", { accelKey: true, altKey: true });
- } else {
- EventUtils.synthesizeKey("k", { accelKey: true, shiftKey: true });
- }
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_580030_errors_after_page_reload.js b/browser/devtools/webconsole/test/browser_webconsole_bug_580030_errors_after_page_reload.js
deleted file mode 100644
index bc325d9ce..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_580030_errors_after_page_reload.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that errors still show up in the Web Console after a page reload.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html";
-
-function test() {
- expectUncaughtException();
- addTab(TEST_URI);
- browser.addEventListener("load", onLoad, true);
-}
-
-// see bug 580030: the error handler fails silently after page reload.
-// https://bugzilla.mozilla.org/show_bug.cgi?id=580030
-function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
-
- openConsole(null, function(hud) {
- hud.jsterm.clearOutput();
- browser.addEventListener("load", testErrorsAfterPageReload, true);
- content.location.reload();
- });
-}
-
-function testErrorsAfterPageReload(aEvent) {
- browser.removeEventListener(aEvent.type, testErrorsAfterPageReload, true);
-
- // dispatch a click event to the button in the test page and listen for
- // errors.
-
- Services.console.registerListener(consoleObserver);
-
- let button = content.document.querySelector("button").wrappedJSObject;
- ok(button, "button found");
- EventUtils.sendMouseEvent({type: "click"}, button, content.wrappedJSObject);
-}
-
-var consoleObserver = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function test_observe(aMessage)
- {
- // Ignore errors we don't care about.
- if (!(aMessage instanceof Ci.nsIScriptError) ||
- aMessage.category != "content javascript") {
- return;
- }
-
- Services.console.unregisterListener(this);
-
- let outputNode = HUDService.getHudByWindow(content).outputNode;
-
- waitForSuccess({
- name: "error message after page reload",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("fooBazBaz") > -1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
- }
-};
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_580400_groups.js b/browser/devtools/webconsole/test/browser_webconsole_bug_580400_groups.js
deleted file mode 100644
index 33fdc6e9e..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_580400_groups.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that console groups behave properly.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testGroups);
- }, true);
-}
-
-function testGroups(HUD) {
- let jsterm = HUD.jsterm;
- let outputNode = HUD.outputNode;
- jsterm.clearOutput();
-
- // We test for one group by testing for zero "new" groups. The
- // "webconsole-new-group" class creates a divider. Thus one group is
- // indicated by zero new groups, two groups are indicated by one new group,
- // and so on.
-
- let waitForSecondMessage = {
- name: "second console message",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".webconsole-msg-output").length == 2;
- },
- successFn: function()
- {
- let timestamp1 = Date.now();
- if (timestamp1 - timestamp0 < 5000) {
- is(outputNode.querySelectorAll(".webconsole-new-group").length, 0,
- "no group dividers exist after the second console message");
- }
-
- for (let i = 0; i < outputNode.itemCount; i++) {
- outputNode.getItemAtIndex(i).timestamp = 0; // a "far past" value
- }
-
- jsterm.execute("2");
- waitForSuccess(waitForThirdMessage);
- },
- failureFn: finishTest,
- };
-
- let waitForThirdMessage = {
- name: "one group divider exists after the third console message",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".webconsole-new-group").length == 1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- };
-
- let timestamp0 = Date.now();
- jsterm.execute("0");
-
- waitForSuccess({
- name: "no group dividers exist after the first console message",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".webconsole-new-group").length == 0;
- },
- successFn: function()
- {
- jsterm.execute("1");
- waitForSuccess(waitForSecondMessage);
- },
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js b/browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js
deleted file mode 100644
index d1c9487c3..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_580454_timestamp_l10n.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that appropriately-localized timestamps are printed.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("DOMContentLoaded", testTimestamp, false);
-
- function testTimestamp()
- {
- browser.removeEventListener("DOMContentLoaded", testTimestamp, false);
- const TEST_TIMESTAMP = 12345678;
- let date = new Date(TEST_TIMESTAMP);
- let localizedString = WCU_l10n.timestampString(TEST_TIMESTAMP);
- isnot(localizedString.indexOf(date.getHours()), -1, "the localized " +
- "timestamp contains the hours");
- isnot(localizedString.indexOf(date.getMinutes()), -1, "the localized " +
- "timestamp contains the minutes");
- isnot(localizedString.indexOf(date.getSeconds()), -1, "the localized " +
- "timestamp contains the seconds");
- isnot(localizedString.indexOf(date.getMilliseconds()), -1, "the localized " +
- "timestamp contains the milliseconds");
- finishTest();
- }
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js b/browser/devtools/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
deleted file mode 100644
index 154799370..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_582201_duplicate_errors.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that exceptions thrown by content don't show up twice in the Web
-// Console.
-
-const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-duplicate-error.html";
-
-function test() {
- expectUncaughtException();
- addTab(TEST_DUPLICATE_ERROR_URI);
- browser.addEventListener("DOMContentLoaded", testDuplicateErrors, false);
-}
-
-function testDuplicateErrors() {
- browser.removeEventListener("DOMContentLoaded", testDuplicateErrors,
- false);
- openConsole(null, function(hud) {
- hud.jsterm.clearOutput();
-
- Services.console.registerListener(consoleObserver);
-
- expectUncaughtException();
- content.location.reload();
- });
-}
-
-var consoleObserver = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function (aMessage)
- {
- // we ignore errors we don't care about
- if (!(aMessage instanceof Ci.nsIScriptError) ||
- aMessage.category != "content javascript") {
- return;
- }
-
- Services.console.unregisterListener(this);
-
- outputNode = HUDService.getHudByWindow(content).outputNode;
-
- waitForSuccess({
- name: "fooDuplicateError1 error displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("fooDuplicateError1") > -1;
- },
- successFn: function()
- {
- let text = outputNode.textContent;
- let error1pos = text.indexOf("fooDuplicateError1");
- ok(error1pos > -1, "found fooDuplicateError1");
- if (error1pos > -1) {
- ok(text.indexOf("fooDuplicateError1", error1pos + 1) == -1,
- "no duplicate for fooDuplicateError1");
- }
-
- findLogEntry("test-duplicate-error.html");
-
- finishTest();
- },
- failureFn: finishTest,
- });
- }
-};
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js b/browser/devtools/webconsole/test/browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js
deleted file mode 100644
index ceeac816d..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_583816_No_input_and_Tab_key_pressed.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testCompletion);
- }, true);
-}
-
-function testCompletion(hud) {
- var jsterm = hud.jsterm;
- var input = jsterm.inputNode;
-
- jsterm.setInputValue("");
- EventUtils.synthesizeKey("VK_TAB", {});
- is(jsterm.completeNode.value, "<- no result", "<- no result - matched");
- is(input.value, "", "inputnode is empty - matched")
- is(input.getAttribute("focused"), "true", "input is still focused");
-
- //Any thing which is not in property autocompleter
- jsterm.setInputValue("window.Bug583816");
- EventUtils.synthesizeKey("VK_TAB", {});
- is(jsterm.completeNode.value, " <- no result", "completenode content - matched");
- is(input.value, "window.Bug583816", "inputnode content - matched");
- is(input.getAttribute("focused"), "true", "input is still focused");
-
- jsterm = input = null;
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_585237_line_limit.js b/browser/devtools/webconsole/test/browser_webconsole_bug_585237_line_limit.js
deleted file mode 100644
index 1f142ce74..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_585237_line_limit.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console limits the number of lines displayed according to
-// the user's preferences.
-
-const TEST_URI = "data:text/html;charset=utf8,test for bug 585237";
-let hud, testDriver;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(aHud) {
- hud = aHud;
- testDriver = testGen();
- testNext();
- });
- }, true);
-}
-
-function testNext() {
- testDriver.next();
-}
-
-function testGen() {
- let console = content.console;
- outputNode = hud.outputNode;
-
- hud.jsterm.clearOutput();
-
- let prefBranch = Services.prefs.getBranch("devtools.hud.loglimit.");
- prefBranch.setIntPref("console", 20);
-
- for (let i = 0; i < 30; i++) {
- console.log("foo #" + i); // must change message to prevent repeats
- }
-
- waitForSuccess({
- name: "20 console.log messages displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("foo #29") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- is(countMessageNodes(), 20, "there are 20 message nodes in the output " +
- "when the log limit is set to 20");
-
- console.log("bar bug585237");
-
- waitForSuccess({
- name: "another console.log message displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bar bug585237") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- is(countMessageNodes(), 20, "there are still 20 message nodes in the " +
- "output when adding one more");
-
- prefBranch.setIntPref("console", 30);
- for (let i = 0; i < 20; i++) {
- console.log("boo #" + i); // must change message to prevent repeats
- }
-
- waitForSuccess({
- name: "another 20 console.log message displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("boo #19") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- is(countMessageNodes(), 30, "there are 30 message nodes in the output " +
- "when the log limit is set to 30");
-
- prefBranch.clearUserPref("console");
- hud = testDriver = prefBranch = console = outputNode = null;
- finishTest();
-
- yield;
-}
-
-function countMessageNodes() {
- return outputNode.querySelectorAll(".hud-msg-node").length;
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js b/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js
deleted file mode 100644
index a062ebd99..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_585956_console_trace.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-585956-console-trace.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", tabLoaded, true);
-}
-
-function tabLoaded() {
- browser.removeEventListener("load", tabLoaded, true);
-
- openConsole(null, function(hud) {
- content.location.reload();
-
- waitForSuccess({
- name: "stacktrace message",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".hud-log");
- },
- successFn: performChecks,
- failureFn: finishTest,
- });
- });
-}
-
-function performChecks() {
- // The expected stack trace object.
- let stacktrace = [
- { filename: TEST_URI, lineNumber: 9, functionName: "window.foobar585956c", language: 2 },
- { filename: TEST_URI, lineNumber: 14, functionName: "foobar585956b", language: 2 },
- { filename: TEST_URI, lineNumber: 18, functionName: "foobar585956a", language: 2 },
- { filename: TEST_URI, lineNumber: 21, functionName: null, language: 2 }
- ];
-
- let hudId = HUDService.getHudIdByWindow(content);
- let HUD = HUDService.hudReferences[hudId];
-
- let node = HUD.outputNode.querySelector(".hud-log");
- ok(node, "found trace log node");
- ok(node._stacktrace, "found stacktrace object");
- is(node._stacktrace.toSource(), stacktrace.toSource(), "stacktrace is correct");
- isnot(node.textContent.indexOf("bug-585956"), -1, "found file name");
-
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js b/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
deleted file mode 100644
index 21dcc603b..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_keys.js
+++ /dev/null
@@ -1,283 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete popup keyboard usage test";
-let HUD, popup, jsterm, inputNode, completeNode;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- HUD = aHud;
- info("web console opened");
-
- content.wrappedJSObject.foobarBug585991 = {
- "item0": "value0",
- "item1": "value1",
- "item2": "value2",
- "item3": "value3",
- };
-
- jsterm = HUD.jsterm;
- popup = jsterm.autocompletePopup;
- completeNode = jsterm.completeNode;
- inputNode = jsterm.inputNode;
-
- ok(!popup.isOpen, "popup is not open");
-
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown, false);
-
- ok(popup.isOpen, "popup is open");
-
- // 4 values, and the following properties:
- // __defineGetter__ __defineSetter__ __lookupGetter__ __lookupSetter__
- // hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString
- // toSource unwatch valueOf watch constructor.
- is(popup.itemCount, 18, "popup.itemCount is correct");
-
- let sameItems = popup.getItems().reverse().map(function(e) {return e.label;});
- ok(sameItems.every(function(prop, index) {
- return [
- "__defineGetter__",
- "__defineSetter__",
- "__lookupGetter__",
- "__lookupSetter__",
- "constructor",
- "hasOwnProperty",
- "isPrototypeOf",
- "item0",
- "item1",
- "item2",
- "item3",
- "propertyIsEnumerable",
- "toLocaleString",
- "toSource",
- "toString",
- "unwatch",
- "valueOf",
- "watch",
- ][index] === prop}), "getItems returns the items we expect");
-
- is(popup.selectedIndex, 17,
- "Index of the first item from bottom is selected.");
- EventUtils.synthesizeKey("VK_DOWN", {});
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- let prefix = jsterm.inputNode.value.replace(/[\S]/g, " ");
-
- is(popup.selectedIndex, 0, "index 0 is selected");
- is(popup.selectedItem.label, "watch", "watch is selected");
- is(completeNode.value, prefix + "watch",
- "completeNode.value holds watch");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(popup.selectedIndex, 1, "index 1 is selected");
- is(popup.selectedItem.label, "valueOf", "valueOf is selected");
- is(completeNode.value, prefix + "valueOf",
- "completeNode.value holds valueOf");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(popup.selectedIndex, 0, "index 0 is selected");
- is(popup.selectedItem.label, "watch", "watch is selected");
- is(completeNode.value, prefix + "watch",
- "completeNode.value holds watch");
-
- info("press Tab and wait for popup to hide");
- popup._panel.addEventListener("popuphidden", popupHideAfterTab, false);
- EventUtils.synthesizeKey("VK_TAB", {});
- }, false);
-
- info("wait for completion: window.foobarBug585991.");
- jsterm.setInputValue("window.foobarBug585991");
- EventUtils.synthesizeKey(".", {});
-}
-
-function popupHideAfterTab()
-{
- // At this point the completion suggestion should be accepted.
- popup._panel.removeEventListener("popuphidden", popupHideAfterTab, false);
-
- ok(!popup.isOpen, "popup is not open");
-
- is(inputNode.value, "window.foobarBug585991.watch",
- "completion was successful after VK_TAB");
-
- ok(!completeNode.value, "completeNode is empty");
-
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown, false);
-
- ok(popup.isOpen, "popup is open");
-
- is(popup.itemCount, 18, "popup.itemCount is correct");
-
- is(popup.selectedIndex, 17, "First index from bottom is selected");
- EventUtils.synthesizeKey("VK_DOWN", {});
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- let prefix = jsterm.inputNode.value.replace(/[\S]/g, " ");
-
- is(popup.selectedIndex, 0, "index 0 is selected");
- is(popup.selectedItem.label, "watch", "watch is selected");
- is(completeNode.value, prefix + "watch",
- "completeNode.value holds watch");
-
- popup._panel.addEventListener("popuphidden", function onHidden() {
- popup._panel.removeEventListener("popuphidden", onHidden, false);
-
- ok(!popup.isOpen, "popup is not open after VK_ESCAPE");
-
- is(inputNode.value, "window.foobarBug585991.",
- "completion was cancelled");
-
- ok(!completeNode.value, "completeNode is empty");
-
- executeSoon(testReturnKey);
- }, false);
-
- info("press Escape to close the popup");
- executeSoon(function() {
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- });
- }, false);
-
- info("wait for completion: window.foobarBug585991.");
- executeSoon(function() {
- jsterm.setInputValue("window.foobarBug585991");
- EventUtils.synthesizeKey(".", {});
- });
-}
-
-function testReturnKey()
-{
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown, false);
-
- ok(popup.isOpen, "popup is open");
-
- is(popup.itemCount, 18, "popup.itemCount is correct");
-
- is(popup.selectedIndex, 17, "First index from bottom is selected");
- EventUtils.synthesizeKey("VK_DOWN", {});
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- let prefix = jsterm.inputNode.value.replace(/[\S]/g, " ");
-
- is(popup.selectedIndex, 0, "index 0 is selected");
- is(popup.selectedItem.label, "watch", "watch is selected");
- is(completeNode.value, prefix + "watch",
- "completeNode.value holds watch");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(popup.selectedIndex, 1, "index 1 is selected");
- is(popup.selectedItem.label, "valueOf", "valueOf is selected");
- is(completeNode.value, prefix + "valueOf",
- "completeNode.value holds valueOf");
-
- popup._panel.addEventListener("popuphidden", function onHidden() {
- popup._panel.removeEventListener("popuphidden", onHidden, false);
-
- ok(!popup.isOpen, "popup is not open after VK_RETURN");
-
- is(inputNode.value, "window.foobarBug585991.valueOf",
- "completion was successful after VK_RETURN");
-
- ok(!completeNode.value, "completeNode is empty");
-
- dontShowArrayNumbers();
- }, false);
-
- info("press Return to accept suggestion. wait for popup to hide");
-
- executeSoon(() => EventUtils.synthesizeKey("VK_RETURN", {}));
- }, false);
-
- info("wait for completion suggestions: window.foobarBug585991.");
-
- executeSoon(function() {
- jsterm.setInputValue("window.foobarBug58599");
- EventUtils.synthesizeKey("1", {});
- EventUtils.synthesizeKey(".", {});
- });
-}
-
-function dontShowArrayNumbers()
-{
- info("dontShowArrayNumbers");
- content.wrappedJSObject.foobarBug585991 = ["Sherlock Holmes"];
-
- let jsterm = HUD.jsterm;
- let popup = jsterm.autocompletePopup;
- let completeNode = jsterm.completeNode;
-
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown, false);
-
- let sameItems = popup.getItems().map(function(e) {return e.label;});
- ok(!sameItems.some(function(prop, index) { prop === "0"; }),
- "Completing on an array doesn't show numbers.");
-
- popup._panel.addEventListener("popuphidden", testReturnWithNoSelection, false);
-
- info("wait for popup to hide");
- executeSoon(() => EventUtils.synthesizeKey("VK_ESCAPE", {}));
- }, false);
-
- info("wait for popup to show");
- executeSoon(() => {
- jsterm.setInputValue("window.foobarBug585991");
- EventUtils.synthesizeKey(".", {});
- });
-}
-
-function testReturnWithNoSelection()
-{
- popup._panel.removeEventListener("popuphidden", testReturnWithNoSelection, false);
-
- info("test pressing return with open popup, but no selection, see bug 873250");
- content.wrappedJSObject.testBug873250a = "hello world";
- content.wrappedJSObject.testBug873250b = "hello world 2";
-
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown);
-
- ok(popup.isOpen, "popup is open");
- is(popup.itemCount, 2, "popup.itemCount is correct");
- isnot(popup.selectedIndex, -1, "popup.selectedIndex is correct");
-
- info("press Return and wait for popup to hide");
- popup._panel.addEventListener("popuphidden", popupHideAfterReturnWithNoSelection);
- executeSoon(() => EventUtils.synthesizeKey("VK_RETURN", {}));
- });
-
- executeSoon(() => {
- info("wait for popup to show");
- jsterm.setInputValue("window.testBu");
- EventUtils.synthesizeKey("g", {});
- });
-}
-
-function popupHideAfterReturnWithNoSelection()
-{
- popup._panel.removeEventListener("popuphidden", popupHideAfterReturnWithNoSelection);
-
- ok(!popup.isOpen, "popup is not open after VK_RETURN");
-
- is(inputNode.value, "", "inputNode is empty after VK_RETURN");
- is(completeNode.value, "", "completeNode is empty");
- is(jsterm.history[jsterm.history.length-1], "window.testBug",
- "jsterm history is correct");
-
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_popup.js b/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_popup.js
deleted file mode 100644
index eb9134b4a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_585991_autocomplete_popup.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>bug 585991 - autocomplete popup test";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(HUD) {
- let items = [
- {label: "item0", value: "value0"},
- {label: "item1", value: "value1"},
- {label: "item2", value: "value2"},
- ];
-
- let popup = HUD.jsterm.autocompletePopup;
-
- ok(!popup.isOpen, "popup is not open");
-
- popup._panel.addEventListener("popupshown", function() {
- popup._panel.removeEventListener("popupshown", arguments.callee, false);
-
- ok(popup.isOpen, "popup is open");
-
- is(popup.itemCount, 0, "no items");
-
- popup.setItems(items);
-
- is(popup.itemCount, items.length, "items added");
-
- let sameItems = popup.getItems();
- is(sameItems.every(function(aItem, aIndex) {
- return aItem === items[aIndex];
- }), true, "getItems returns back the same items");
-
- is(popup.selectedIndex, 2,
- "Index of the first item from bottom is selected.");
- is(popup.selectedItem, items[2], "First item from bottom is selected");
-
- popup.selectedIndex = 1;
-
- is(popup.selectedIndex, 1, "index 1 is selected");
- is(popup.selectedItem, items[1], "item1 is selected");
-
- popup.selectedItem = items[2];
-
- is(popup.selectedIndex, 2, "index 2 is selected");
- is(popup.selectedItem, items[2], "item2 is selected");
-
- is(popup.selectPreviousItem(), items[1], "selectPreviousItem() works");
-
- is(popup.selectedIndex, 1, "index 1 is selected");
- is(popup.selectedItem, items[1], "item1 is selected");
-
- is(popup.selectNextItem(), items[2], "selectPreviousItem() works");
-
- is(popup.selectedIndex, 2, "index 2 is selected");
- is(popup.selectedItem, items[2], "item2 is selected");
-
- ok(!popup.selectNextItem(), "selectPreviousItem() works");
-
- is(popup.selectedIndex, -1, "no index is selected");
- ok(!popup.selectedItem, "no item is selected");
-
- items.push({label: "label3", value: "value3"});
- popup.appendItem(items[3]);
-
- is(popup.itemCount, items.length, "item3 appended");
-
- popup.selectedIndex = 3;
- is(popup.selectedItem, items[3], "item3 is selected");
-
- popup.removeItem(items[2]);
-
- is(popup.selectedIndex, 2, "index2 is selected");
- is(popup.selectedItem, items[3], "item3 is still selected");
- is(popup.itemCount, items.length - 1, "item2 removed");
-
- popup.clearItems();
- is(popup.itemCount, 0, "items cleared");
-
- popup.hidePopup();
- finishTest();
- }, false);
-
- popup.openPopup();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_586388_select_all.js b/browser/devtools/webconsole/test/browser_webconsole_bug_586388_select_all.js
deleted file mode 100644
index b5bba5003..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_586388_select_all.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testSelectionWhenMovingBetweenBoxes);
- }, true);
-}
-
-function testSelectionWhenMovingBetweenBoxes(hud) {
- let jsterm = hud.jsterm;
-
- // Fill the console with some output.
- jsterm.clearOutput();
- jsterm.execute("1 + 2");
- jsterm.execute("3 + 4");
- jsterm.execute("5 + 6");
-
- waitForSuccess({
- name: "execution results displayed",
- validatorFn: function()
- {
- return hud.outputNode.textContent.indexOf("5 + 6") > -1 &&
- hud.outputNode.textContent.indexOf("11") > -1;
- },
- successFn: performTestsAfterOutput.bind(null, hud),
- failureFn: finishTest,
- });
-}
-
-function performTestsAfterOutput(hud) {
- let outputNode = hud.outputNode;
-
- ok(outputNode.childNodes.length >= 3, "the output node has children after " +
- "executing some JavaScript");
-
- // Test that the global Firefox "Select All" functionality (e.g. Edit >
- // Select All) works properly in the Web Console.
- let commandController = hud.ui._commandController;
- ok(commandController != null, "the window has a command controller object");
-
- commandController.selectAll(outputNode);
- is(outputNode.selectedCount, outputNode.childNodes.length, "all console " +
- "messages are selected after performing a regular browser select-all " +
- "operation");
-
- outputNode.selectedIndex = -1;
-
- // Test the context menu "Select All" (which has a different code path) works
- // properly as well.
- let contextMenuId = outputNode.getAttribute("context");
- let contextMenu = hud.ui.document.getElementById(contextMenuId);
- ok(contextMenu != null, "the output node has a context menu");
-
- let selectAllItem = contextMenu.querySelector("*[command='cmd_selectAll']");
- ok(selectAllItem != null,
- "the context menu on the output node has a \"Select All\" item");
-
- outputNode.focus();
-
- selectAllItem.doCommand();
-
- is(outputNode.selectedCount, outputNode.childNodes.length, "all console " +
- "messages are selected after performing a select-all operation from " +
- "the context menu");
-
- outputNode.selectedIndex = -1;
-
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_587617_output_copy.js b/browser/devtools/webconsole/test/browser_webconsole_bug_587617_output_copy.js
deleted file mode 100644
index 8ad4a4b70..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_587617_output_copy.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let HUD, outputNode;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- HUD = aHud;
-
- // See bugs 574036, 586386 and 587617.
- outputNode = HUD.outputNode;
- let selection = getSelection();
- let jstermInput = HUD.jsterm.inputNode;
- let console = content.wrappedJSObject.console;
- let contentSelection = content.wrappedJSObject.getSelection();
-
- HUD.jsterm.clearOutput();
-
- let controller = top.document.commandDispatcher.
- getControllerForCommand("cmd_copy");
- is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled");
-
- console.log("Hello world! bug587617");
-
- waitForSuccess({
- name: "console log 'Hello world!' message",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug587617") > -1;
- },
- successFn: function()
- {
- outputNode.selectedIndex = 0;
- outputNode.focus();
-
- goUpdateCommand("cmd_copy");
- controller = top.document.commandDispatcher.
- getControllerForCommand("cmd_copy");
- is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
- let selectedNode = outputNode.getItemAtIndex(0);
- waitForClipboard(getExpectedClipboardText(selectedNode), clipboardSetup,
- testContextMenuCopy, testContextMenuCopy);
- },
- failureFn: finishTest,
- });
-}
-
-// Test that the context menu "Copy" (which has a different code path) works
-// properly as well.
-function testContextMenuCopy() {
- let contextMenuId = outputNode.getAttribute("context");
- let contextMenu = HUD.ui.document.getElementById(contextMenuId);
- ok(contextMenu, "the output node has a context menu");
-
- let copyItem = contextMenu.querySelector("*[command='cmd_copy']");
- ok(copyItem, "the context menu on the output node has a \"Copy\" item");
-
- copyItem.doCommand();
-
- let selectedNode = outputNode.getItemAtIndex(0);
-
- HUD = outputNode = null;
- waitForClipboard(getExpectedClipboardText(selectedNode), clipboardSetup,
- finishTest, finishTest);
-}
-
-function getExpectedClipboardText(aItem) {
- return "[" + WCU_l10n.timestampString(aItem.timestamp) + "] " +
- aItem.clipboardText;
-}
-
-function clipboardSetup() {
- goDoCommand("cmd_copy");
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js b/browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js
deleted file mode 100644
index a27c64b02..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_588342_document_focus.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 588342";
-let fm;
-
-function test() {
- fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- waitForFocus(function() {
- is(hud.jsterm.inputNode.getAttribute("focused"), "true",
- "jsterm input is focused on web console open");
- isnot(fm.focusedWindow, content, "content document has no focus");
- closeConsole(null, consoleClosed);
- }, hud.iframeWindow);
-}
-
-function consoleClosed() {
- is(fm.focusedWindow, browser.contentWindow,
- "content document has focus");
-
- fm = null;
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_588730_text_node_insertion.js b/browser/devtools/webconsole/test/browser_webconsole_bug_588730_text_node_insertion.js
deleted file mode 100644
index 74f56aa77..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_588730_text_node_insertion.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that adding text to one of the output labels doesn't cause errors.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testTextNodeInsertion);
- }, true);
-}
-
-// Test for bug 588730: Adding a text node to an existing label element causes
-// warnings
-function testTextNodeInsertion(hud) {
- let outputNode = hud.outputNode;
-
- let label = document.createElementNS(
- "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "label");
- outputNode.appendChild(label);
-
- let error = false;
- let listener = {
- observe: function(aMessage) {
- let messageText = aMessage.message;
- if (messageText.indexOf("JavaScript Warning") !== -1) {
- error = true;
- }
- }
- };
-
- Services.console.registerListener(listener);
-
- // This shouldn't fail.
- label.appendChild(document.createTextNode("foo"));
-
- executeSoon(function() {
- Services.console.unregisterListener(listener);
- ok(!error, "no error when adding text nodes as children of labels");
-
- finishTest();
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_588967_input_expansion.js b/browser/devtools/webconsole/test/browser_webconsole_bug_588967_input_expansion.js
deleted file mode 100644
index c22894924..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_588967_input_expansion.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testInputExpansion);
- }, true);
-}
-
-function testInputExpansion(hud) {
- let input = hud.jsterm.inputNode;
-
- input.focus();
-
- is(input.getAttribute("multiline"), "true", "multiline is enabled");
-
- let ordinaryHeight = input.clientHeight;
-
- // Tests if the inputNode expands.
- input.value = "hello\nworld\n";
- let length = input.value.length;
- input.selectionEnd = length;
- input.selectionStart = length;
- // Performs an "d". This will trigger/test for the input event that should
- // change the height of the inputNode.
- EventUtils.synthesizeKey("d", {});
- ok(input.clientHeight > ordinaryHeight, "the input expanded");
-
- // Test if the inputNode shrinks again.
- input.value = "";
- EventUtils.synthesizeKey("d", {});
- is(input.clientHeight, ordinaryHeight, "the input's height is normal again");
-
- input = length = null;
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_589162_css_filter.js b/browser/devtools/webconsole/test/browser_webconsole_bug_589162_css_filter.js
deleted file mode 100644
index 95e032f99..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_589162_css_filter.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "data:text/html;charset=utf-8,<div style='font-size:3em;" +
- "foobarCssParser:baz'>test CSS parser filter</div>";
-
-function onContentLoaded()
-{
- browser.removeEventListener("load", onContentLoaded, true);
-
- let HUD = HUDService.getHudByWindow(content);
- let hudId = HUD.hudId;
- let outputNode = HUD.outputNode;
-
- HUD.jsterm.clearOutput();
-
- waitForSuccess({
- name: "css error displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("foobarCssParser") > -1;
- },
- successFn: function()
- {
- HUD.setFilterState("cssparser", false);
-
- let msg = "the unknown CSS property warning is not displayed, " +
- "after filtering";
- testLogEntry(outputNode, "foobarCssParser", msg, true, true);
-
- HUD.setFilterState("cssparser", true);
- finishTest();
- },
- failureFn: finishTest,
- });
-}
-
-/**
- * Unit test for bug 589162:
- * CSS filtering on the console does not work
- */
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function() {
- browser.addEventListener("load", onContentLoaded, true);
- content.location.reload();
- });
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js b/browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js
deleted file mode 100644
index fbea54e9d..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_592442_closing_brackets.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Julian Viereck <jviereck@mozilla.com>
- * Patrick Walton <pcwalton@mozilla.com>
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that, when the user types an extraneous closing bracket, no error
-// appears.
-
-function test() {
- addTab("data:text/html;charset=utf-8,test for bug 592442");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testExtraneousClosingBrackets);
- }, true);
-}
-
-function testExtraneousClosingBrackets(hud) {
- let jsterm = hud.jsterm;
-
- jsterm.setInputValue("document.getElementById)");
-
- let error = false;
- try {
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY);
- }
- catch (ex) {
- error = true;
- }
-
- ok(!error, "no error was thrown when an extraneous bracket was inserted");
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_593003_iframe_wrong_hud.js b/browser/devtools/webconsole/test/browser_webconsole_bug_593003_iframe_wrong_hud.js
deleted file mode 100644
index 9fe88e128..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_593003_iframe_wrong_hud.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html";
-
-const TEST_IFRAME_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html";
-
-const TEST_DUMMY_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let tab1, tab2;
-
-function test() {
- addTab(TEST_URI);
- tab1 = tab;
- browser.addEventListener("load", tab1Loaded, true);
-}
-
-function tab1Loaded(aEvent) {
- browser.removeEventListener(aEvent.type, tab1Loaded, true);
- content.console.log("FOO");
- openConsole(null, function() {
- tab2 = gBrowser.addTab(TEST_DUMMY_URI);
- gBrowser.selectedTab = tab2;
- gBrowser.selectedBrowser.addEventListener("load", tab2Loaded, true);
- });
-}
-
-function tab2Loaded(aEvent) {
- tab2.linkedBrowser.removeEventListener(aEvent.type, tab2Loaded, true);
-
- openConsole(gBrowser.selectedTab, function() {
- tab1.linkedBrowser.addEventListener("load", tab1Reloaded, true);
- tab1.linkedBrowser.contentWindow.location.reload();
- });
-}
-
-function tab1Reloaded(aEvent) {
- tab1.linkedBrowser.removeEventListener(aEvent.type, tab1Reloaded, true);
-
- let hud1 = HUDService.getHudByWindow(tab1.linkedBrowser.contentWindow);
- let outputNode1 = hud1.outputNode;
-
- waitForSuccess({
- name: "iframe network request displayed in tab1",
- validatorFn: function()
- {
- let selector = ".webconsole-msg-url[value='" + TEST_IFRAME_URI +"']";
- return outputNode1.querySelector(selector);
- },
- successFn: function()
- {
- let hud2 = HUDService.getHudByWindow(tab2.linkedBrowser.contentWindow);
- let outputNode2 = hud2.outputNode;
-
- isnot(outputNode1, outputNode2,
- "the two HUD outputNodes must be different");
-
- let msg = "Didn't find the iframe network request in tab2";
- testLogEntry(outputNode2, TEST_IFRAME_URI, msg, true, true);
-
- testEnd();
- },
- failureFn: testEnd,
- });
-}
-
-function testEnd() {
- closeConsole(tab2, function() {
- gBrowser.removeTab(tab2);
- tab1 = tab2 = null;
- executeSoon(finishTest);
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_594477_clickable_output.js b/browser/devtools/webconsole/test/browser_webconsole_bug_594477_clickable_output.js
deleted file mode 100644
index c2dc7f753..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_594477_clickable_output.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-let HUD;
-
-let outputItem;
-
-function consoleOpened(aHud) {
- HUD = aHud;
-
- outputNode = HUD.outputNode;
-
- browser.addEventListener("load", tabLoad2, true);
-
- // Reload so we get some output in the console.
- browser.contentWindow.location.reload();
-}
-
-function tabLoad2(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad2, true);
-
- waitForMessages({
- webconsole: HUD,
- messages: [{
- text: "test-console.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- }],
- }).then(([result]) => {
- let msg = [...result.matched][0];
- outputItem = msg.querySelector(".hud-clickable");
- ok(outputItem, "found a network message");
- document.addEventListener("popupshown", networkPanelShown, false);
-
- // Send the mousedown and click events such that the network panel opens.
- EventUtils.sendMouseEvent({type: "mousedown"}, outputItem);
- EventUtils.sendMouseEvent({type: "click"}, outputItem);
- });
-}
-
-function networkPanelShown(aEvent) {
- document.removeEventListener(aEvent.type, networkPanelShown, false);
-
- info("networkPanelShown");
-
- document.addEventListener("popupshown", networkPanelShowFailure, false);
-
- // The network panel should not open for the second time.
- EventUtils.sendMouseEvent({type: "mousedown"}, outputItem);
- EventUtils.sendMouseEvent({type: "click"}, outputItem);
-
- executeSoon(function() {
- aEvent.target.addEventListener("popuphidden", networkPanelHidden, false);
- aEvent.target.hidePopup();
- });
-}
-
-function networkPanelShowFailure(aEvent) {
- document.removeEventListener(aEvent.type, networkPanelShowFailure, false);
-
- ok(false, "the network panel should not show");
-}
-
-function networkPanelHidden(aEvent) {
- this.removeEventListener(aEvent.type, networkPanelHidden, false);
-
- info("networkPanelHidden");
-
- // The network panel should not show because this is a mouse event that starts
- // in a position and ends in another.
- EventUtils.sendMouseEvent({type: "mousedown", clientX: 3, clientY: 4},
- outputItem);
- EventUtils.sendMouseEvent({type: "click", clientX: 5, clientY: 6},
- outputItem);
-
- // The network panel should not show because this is a middle-click.
- EventUtils.sendMouseEvent({type: "mousedown", button: 1},
- outputItem);
- EventUtils.sendMouseEvent({type: "click", button: 1},
- outputItem);
-
- // The network panel should not show because this is a right-click.
- EventUtils.sendMouseEvent({type: "mousedown", button: 2},
- outputItem);
- EventUtils.sendMouseEvent({type: "click", button: 2},
- outputItem);
-
- executeSoon(function() {
- document.removeEventListener("popupshown", networkPanelShowFailure, false);
-
- // Done with the network output. Now test the jsterm output and the property
- // panel.
- HUD.jsterm.execute("document", () => {
- info("jsterm execute 'document' callback");
-
- HUD.jsterm.once("variablesview-open", onVariablesViewOpen);
- let outputItem = outputNode
- .querySelector(".webconsole-msg-output .hud-clickable");
- ok(outputItem, "jsterm output message found");
-
- // Send the mousedown and click events such that the property panel opens.
- EventUtils.sendMouseEvent({type: "mousedown"}, outputItem);
- EventUtils.sendMouseEvent({type: "click"}, outputItem);
- });
- });
-}
-
-function onVariablesViewOpen() {
- info("onVariablesViewOpen");
-
- executeSoon(function() {
- HUD = outputItem = null;
- executeSoon(finishTest);
- });
-}
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_594497_history_arrow_keys.js b/browser/devtools/webconsole/test/browser_webconsole_bug_594497_history_arrow_keys.js
deleted file mode 100644
index 2cdf52bc9..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_594497_history_arrow_keys.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-let inputNode, values;
-
-function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
-
- openConsole(null, function(HUD) {
- inputNode = HUD.jsterm.inputNode;
-
- inputNode.focus();
-
- ok(!inputNode.value, "inputNode.value is empty");
-
- values = ["document", "window", "document.body"];
- values.push(values.join(";\n"), "document.location");
-
- // Execute each of the values;
- for (let i = 0; i < values.length; i++) {
- HUD.jsterm.setInputValue(values[i]);
- HUD.jsterm.execute();
- }
-
- performTests();
- });
-}
-
-function performTests() {
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[4],
- "VK_UP: inputNode.value #4 is correct");
-
- ok(inputNode.selectionStart == values[4].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[3],
- "VK_UP: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart == values[3].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- inputNode.setSelectionRange(values[3].length - 2, values[3].length - 2);
-
- EventUtils.synthesizeKey("VK_UP", {});
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[3],
- "VK_UP two times: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart == inputNode.value.indexOf("\n") &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[3],
- "VK_UP again: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart == 0 &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[2],
- "VK_UP: inputNode.value #2 is correct");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[1],
- "VK_UP: inputNode.value #1 is correct");
-
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(inputNode.value, values[0],
- "VK_UP: inputNode.value #0 is correct");
-
- ok(inputNode.selectionStart == values[0].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[1],
- "VK_DOWN: inputNode.value #1 is correct");
-
- ok(inputNode.selectionStart == values[1].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[2],
- "VK_DOWN: inputNode.value #2 is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[3],
- "VK_DOWN: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart == values[3].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- inputNode.setSelectionRange(2, 2);
-
- EventUtils.synthesizeKey("VK_DOWN", {});
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[3],
- "VK_DOWN two times: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart > inputNode.value.lastIndexOf("\n") &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[3],
- "VK_DOWN again: inputNode.value #3 is correct");
-
- ok(inputNode.selectionStart == values[3].length &&
- inputNode.selectionStart == inputNode.selectionEnd,
- "caret location is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- is(inputNode.value, values[4],
- "VK_DOWN: inputNode.value #4 is correct");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- ok(!inputNode.value,
- "VK_DOWN: inputNode.value is empty");
-
- inputNode = values = null;
- executeSoon(finishTest);
-}
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 594497 and bug 619598");
- browser.addEventListener("load", tabLoad, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js b/browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js
deleted file mode 100644
index 7fe96922e..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_FILE = "test-network.html";
-
-function tabReload(aEvent) {
- browser.removeEventListener(aEvent.type, tabReload, true);
-
- outputNode = hud.outputNode;
-
- waitForSuccess({
- name: "console.log() message displayed",
- validatorFn: function()
- {
- return outputNode.textContent
- .indexOf("running network console logging tests") > -1;
- },
- successFn: function()
- {
- findLogEntry("test-network.html");
- findLogEntry("test-image.png");
- findLogEntry("testscript.js");
- finishTest();
- },
- failureFn: finishTest,
- });
-}
-
-function test() {
- let jar = getJar(getRootDirectory(gTestPath));
- let dir = jar ?
- extractJarToTmp(jar) :
- getChromeDir(getResolvedURI(gTestPath));
- dir.append(TEST_FILE);
-
- let uri = Services.io.newFileURI(dir);
-
- const PREF = "devtools.webconsole.persistlog";
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- addTab("data:text/html;charset=utf8,<p>test file URI");
- browser.addEventListener("load", function tabLoad() {
- browser.removeEventListener("load", tabLoad, true);
- openConsole(null, function(aHud) {
- hud = aHud;
- hud.jsterm.clearOutput();
- browser.addEventListener("load", tabReload, true);
- content.location = uri.spec;
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_595350_multiple_windows_and_tabs.js b/browser/devtools/webconsole/test/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
deleted file mode 100644
index a1c96b9c1..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console doesn't leak when multiple tabs and windows are
-// opened and then closed.
-
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 595350";
-
-let win1 = window, win2;
-let openTabs = [];
-let loadedTabCount = 0;
-
-function test() {
- requestLongerTimeout(3);
-
- // Add two tabs in the main window.
- addTabs(win1);
-
- // Open a new window.
- win2 = OpenBrowserWindow();
- win2.addEventListener("load", onWindowLoad, true);
-}
-
-function onWindowLoad(aEvent) {
- win2.removeEventListener(aEvent.type, onWindowLoad, true);
-
- // Add two tabs in the new window.
- addTabs(win2);
-}
-
-function addTabs(aWindow) {
- for (let i = 0; i < 2; i++) {
- let tab = aWindow.gBrowser.addTab(TEST_URI);
- openTabs.push(tab);
-
- tab.linkedBrowser.addEventListener("load", function onLoad(aEvent) {
- tab.linkedBrowser.removeEventListener(aEvent.type, onLoad, true);
-
- loadedTabCount++;
- info("tabs loaded: " + loadedTabCount);
- if (loadedTabCount >= 4) {
- executeSoon(openConsoles);
- }
- }, true);
- }
-}
-
-function openConsoles() {
- // open the Web Console for each of the four tabs and log a message.
- let consolesOpen = 0;
- for (let i = 0; i < openTabs.length; i++) {
- let tab = openTabs[i];
- openConsole(tab, function(index, hud) {
- ok(hud, "HUD is open for tab " + index);
- let window = hud.target.tab.linkedBrowser.contentWindow;
- window.console.log("message for tab " + index);
- consolesOpen++;
- if (consolesOpen == 4) {
- // Use executeSoon() to allow the promise to resolve.
- executeSoon(closeConsoles);
- }
- }.bind(null, i));
- }
-}
-
-function closeConsoles() {
- let consolesClosed = 0;
-
- function onWebConsoleClose(aSubject, aTopic) {
- if (aTopic == "web-console-destroyed") {
- consolesClosed++;
- info("consoles destroyed: " + consolesClosed);
- if (consolesClosed == 4) {
- // Use executeSoon() to allow all the observers to execute.
- executeSoon(finishTest);
- }
- }
- }
-
- Services.obs.addObserver(onWebConsoleClose, "web-console-destroyed", false);
-
- registerCleanupFunction(() => {
- Services.obs.removeObserver(onWebConsoleClose, "web-console-destroyed");
- });
-
- win2.close();
-
- win1.gBrowser.removeTab(openTabs[0]);
- win1.gBrowser.removeTab(openTabs[1]);
-
- openTabs = win1 = win2 = null;
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js b/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js
deleted file mode 100644
index 8e00c27ed..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TESTS_PATH = "http://example.com/browser/browser/devtools/webconsole/test/";
-const TESTS = [
- { // #0
- file: "test-bug-595934-css-loader.html",
- category: "CSS Loader",
- matchString: "text/css",
- },
- { // #1
- file: "test-bug-595934-imagemap.html",
- category: "ImageMap",
- matchString: "shape=\"rect\"",
- },
- { // #2
- file: "test-bug-595934-html.html",
- category: "HTML",
- matchString: "multipart/form-data",
- onload: function() {
- let form = content.document.querySelector("form");
- form.submit();
- },
- },
- { // #3
- file: "test-bug-595934-workers.html",
- category: "Web Worker",
- matchString: "fooBarWorker",
- expectError: true,
- },
- { // #4
- file: "test-bug-595934-malformedxml.xhtml",
- category: "malformed-xml",
- matchString: "no element found",
- },
- { // #5
- file: "test-bug-595934-svg.xhtml",
- category: "SVG",
- matchString: "fooBarSVG",
- },
- { // #6
- file: "test-bug-595934-canvas.html",
- category: "Canvas",
- matchString: "strokeStyle",
- },
- { // #7
- file: "test-bug-595934-css-parser.html",
- category: "CSS Parser",
- matchString: "foobarCssParser",
- },
- { // #8
- file: "test-bug-595934-malformedxml-external.html",
- category: "malformed-xml",
- matchString: "</html>",
- },
- { // #9
- file: "test-bug-595934-empty-getelementbyid.html",
- category: "DOM",
- matchString: "getElementById",
- },
- { // #10
- file: "test-bug-595934-canvas-css.html",
- category: "CSS Parser",
- matchString: "foobarCanvasCssParser",
- },
- { // #11
- file: "test-bug-595934-image.html",
- category: "Image",
- matchString: "corrupt",
- },
-];
-
-let pos = -1;
-
-let foundCategory = false;
-let foundText = false;
-let pageLoaded = false;
-let pageError = false;
-let output = null;
-let jsterm = null;
-let hud = null;
-let testEnded = false;
-
-let TestObserver = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function test_observe(aSubject)
- {
- if (testEnded || !(aSubject instanceof Ci.nsIScriptError)) {
- return;
- }
-
- var expectedCategory = TESTS[pos].category;
-
- info("test #" + pos + " console observer got " + aSubject.category +
- ", is expecting " + expectedCategory);
-
- if (aSubject.category == expectedCategory) {
- foundCategory = true;
- startNextTest();
- }
- else {
- info("unexpected message was: " + aSubject.sourceName + ":" +
- aSubject.lineNumber + "; " + aSubject.errorMessage);
- }
- }
-};
-
-function consoleOpened(aHud) {
- hud = aHud;
- output = hud.outputNode;
- jsterm = hud.jsterm;
-
- Services.console.registerListener(TestObserver);
-
- registerCleanupFunction(testEnd);
-
- testNext();
-}
-
-function testNext() {
- jsterm.clearOutput();
- foundCategory = false;
- foundText = false;
- pageLoaded = false;
- pageError = false;
-
- pos++;
- info("testNext: #" + pos);
- if (pos < TESTS.length) {
- let test = TESTS[pos];
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "message for test #" + pos + ": '" + test.matchString +"'",
- text: test.matchString,
- }],
- }).then(() => {
- foundText = true;
- startNextTest();
- });
-
- let testLocation = TESTS_PATH + test.file;
- gBrowser.selectedBrowser.addEventListener("load", function onLoad(aEvent) {
- if (content.location.href != testLocation) {
- return;
- }
- gBrowser.selectedBrowser.removeEventListener(aEvent.type, onLoad, true);
-
- pageLoaded = true;
- test.onload && test.onload(aEvent);
-
- if (test.expectError) {
- content.addEventListener("error", function _onError() {
- content.removeEventListener("error", _onError);
- pageError = true;
- startNextTest();
- });
- expectUncaughtException();
- }
- else {
- pageError = true;
- }
-
- startNextTest();
- }, true);
-
- content.location = testLocation;
- }
- else {
- testEnded = true;
- finishTest();
- }
-}
-
-function testEnd() {
- if (!testEnded) {
- info("foundCategory " + foundCategory + " foundText " + foundText +
- " pageLoaded " + pageLoaded + " pageError " + pageError);
- }
-
- Services.console.unregisterListener(TestObserver);
- hud = TestObserver = output = jsterm = null;
-}
-
-function startNextTest() {
- if (!testEnded && foundCategory && foundText && pageLoaded && pageError) {
- testNext();
- }
-}
-
-function test() {
- requestLongerTimeout(2);
-
- addTab("data:text/html;charset=utf-8,Web Console test for bug 595934 - message categories coverage.");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js b/browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
deleted file mode 100644
index aab5058c9..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let tab1, tab2, win1, win2;
-let noErrors = true;
-
-function tab1Loaded(aEvent) {
- browser.removeEventListener(aEvent.type, tab1Loaded, true);
-
- win2 = OpenBrowserWindow();
- whenDelayedStartupFinished(win2, win2Loaded);
-}
-
-function win2Loaded() {
- tab2 = win2.gBrowser.addTab(TEST_URI);
- win2.gBrowser.selectedTab = tab2;
- tab2.linkedBrowser.addEventListener("load", tab2Loaded, true);
-}
-
-function tab2Loaded(aEvent) {
- tab2.linkedBrowser.removeEventListener(aEvent.type, tab2Loaded, true);
-
- let consolesOpened = 0;
- function onWebConsoleOpen() {
- consolesOpened++;
- if (consolesOpened == 2) {
- executeSoon(closeConsoles);
- }
- }
-
- function openConsoles() {
- try {
- let target1 = TargetFactory.forTab(tab1);
- gDevTools.showToolbox(target1, "webconsole").then(onWebConsoleOpen);
- }
- catch (ex) {
- ok(false, "gDevTools.showToolbox(target1) exception: " + ex);
- noErrors = false;
- }
-
- try {
- let target2 = TargetFactory.forTab(tab2);
- gDevTools.showToolbox(target2, "webconsole").then(onWebConsoleOpen);
- }
- catch (ex) {
- ok(false, "gDevTools.showToolbox(target2) exception: " + ex);
- noErrors = false;
- }
- }
-
- function closeConsoles() {
- try {
- let target1 = TargetFactory.forTab(tab1);
- gDevTools.closeToolbox(target1).then(function() {
- try {
- let target2 = TargetFactory.forTab(tab2);
- gDevTools.closeToolbox(target2).then(testEnd);
- }
- catch (ex) {
- ok(false, "gDevTools.closeToolbox(target2) exception: " + ex);
- noErrors = false;
- }
- });
- }
- catch (ex) {
- ok(false, "gDevTools.closeToolbox(target1) exception: " + ex);
- noErrors = false;
- }
- }
-
- function testEnd() {
- ok(noErrors, "there were no errors");
-
- Array.forEach(win1.gBrowser.tabs, function(aTab) {
- win1.gBrowser.removeTab(aTab);
- });
- Array.forEach(win2.gBrowser.tabs, function(aTab) {
- win2.gBrowser.removeTab(aTab);
- });
-
- executeSoon(function() {
- win2.close();
- tab1 = tab2 = win1 = win2 = null;
- finishTest();
- });
- }
-
- waitForFocus(openConsoles, tab2.linkedBrowser.contentWindow);
-}
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", tab1Loaded, true);
- tab1 = gBrowser.selectedTab;
- win1 = window;
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_597136_external_script_errors.js b/browser/devtools/webconsole/test/browser_webconsole_bug_597136_external_script_errors.js
deleted file mode 100644
index c634b11bd..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597136_external_script_errors.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/" +
- "webconsole/test/test-bug-597136-external-script-" +
- "errors.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(hud) {
- executeSoon(function() {
- consoleOpened(hud);
- });
- });
- }, true);
-}
-
-function consoleOpened(hud) {
- let button = content.document.querySelector("button");
- let outputNode = hud.outputNode;
-
- expectUncaughtException();
- EventUtils.sendMouseEvent({ type: "click" }, button, content);
-
- waitForSuccess({
- name: "external script error message",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bogus is not defined") > -1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_597136_network_requests_from_chrome.js b/browser/devtools/webconsole/test/browser_webconsole_bug_597136_network_requests_from_chrome.js
deleted file mode 100644
index 3aa0f5399..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597136_network_requests_from_chrome.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that network requests from chrome don't cause the Web Console to
-// throw exceptions.
-
-const TEST_URI = "http://example.com/";
-
-let good = true;
-let listener = {
- QueryInterface: XPCOMUtils.generateQI([ Ci.nsIObserver ]),
- observe: function(aSubject, aTopic, aData) {
- if (aSubject instanceof Ci.nsIScriptError &&
- aSubject.category === "XPConnect JavaScript") {
- good = false;
- }
- }
-};
-
-let xhr;
-
-function test() {
- Services.console.registerListener(listener);
-
- HUDService; // trigger a lazy-load of the HUD Service
-
- xhr = new XMLHttpRequest();
- xhr.addEventListener("load", xhrComplete, false);
- xhr.open("GET", TEST_URI, true);
- xhr.send(null);
-}
-
-function xhrComplete() {
- xhr.removeEventListener("load", xhrComplete, false);
- window.setTimeout(checkForException, 0);
-}
-
-function checkForException() {
- ok(good, "no exception was thrown when sending a network request from a " +
- "chrome window");
-
- Services.console.unregisterListener(listener);
- listener = null;
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_597460_filter_scroll.js b/browser/devtools/webconsole/test/browser_webconsole_bug_597460_filter_scroll.js
deleted file mode 100644
index 7f55cb0fc..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597460_filter_scroll.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network.html";
-
-function consoleOpened(aHud) {
- hud = aHud;
-
- for (let i = 0; i < 200; i++) {
- content.console.log("test message " + i);
- }
-
- hud.setFilterState("network", false);
- hud.setFilterState("networkinfo", false);
-
- hud.ui.filterBox.value = "test message";
- hud.ui.adjustVisibilityOnSearchStringChange();
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- name: "console messages displayed",
- text: "test message 199",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(() => {
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test-network.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- successFn: testScroll,
- failureFn: finishTest,
- }],
- }).then(testScroll);
- content.location.reload();
- });
-}
-
-function testScroll() {
- let msgNode = hud.outputNode.querySelector(".webconsole-msg-network");
- ok(msgNode.classList.contains("hud-filtered-by-type"),
- "network message is filtered by type");
- ok(msgNode.classList.contains("hud-filtered-by-string"),
- "network message is filtered by string");
-
- let scrollBox = hud.outputNode.scrollBoxObject.element;
- ok(scrollBox.scrollTop > 0, "scroll location is not at the top");
-
- // Make sure the Web Console output is scrolled as near as possible to the
- // bottom.
- let nodeHeight = hud.outputNode.querySelector(".hud-log").clientHeight;
- ok(scrollBox.scrollTop >= scrollBox.scrollHeight - scrollBox.clientHeight -
- nodeHeight * 2, "scroll location is correct");
-
- hud.setFilterState("network", true);
- hud.setFilterState("networkinfo", true);
-
- executeSoon(finishTest);
-}
-
-function test() {
- const PREF = "devtools.webconsole.persistlog";
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_597756_reopen_closed_tab.js b/browser/devtools/webconsole/test/browser_webconsole_bug_597756_reopen_closed_tab.js
deleted file mode 100644
index b6636a079..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_597756_reopen_closed_tab.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html";
-
-let newTabIsOpen = false;
-
-function tabLoaded(aEvent) {
- gBrowser.selectedBrowser.removeEventListener(aEvent.type, tabLoaded, true);
-
- openConsole(gBrowser.selectedTab, function() {
- gBrowser.selectedBrowser.addEventListener("load", tabReloaded, true);
- expectUncaughtException();
- content.location.reload();
- });
-}
-
-function tabReloaded(aEvent) {
- gBrowser.selectedBrowser.removeEventListener(aEvent.type, tabReloaded, true);
-
- let hudId = HUDService.getHudIdByWindow(content);
- let HUD = HUDService.hudReferences[hudId];
- ok(HUD, "Web Console is open");
-
- waitForSuccess({
- name: "error message displayed",
- validatorFn: function() {
- return HUD.outputNode.textContent.indexOf("fooBug597756_error") > -1;
- },
- successFn: function() {
- if (newTabIsOpen) {
- finishTest();
- return;
- }
- closeConsole(gBrowser.selectedTab, function() {
- gBrowser.removeCurrentTab();
-
- let newTab = gBrowser.addTab();
- gBrowser.selectedTab = newTab;
-
- newTabIsOpen = true;
- gBrowser.selectedBrowser.addEventListener("load", tabLoaded, true);
- expectUncaughtException();
- content.location = TEST_URI;
- });
- },
- failureFn: finishTest,
- });
-}
-
-function test() {
- expectUncaughtException();
- addTab(TEST_URI);
- browser.addEventListener("load", tabLoaded, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_598357_jsterm_output.js b/browser/devtools/webconsole/test/browser_webconsole_bug_598357_jsterm_output.js
deleted file mode 100644
index 1737b2275..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_598357_jsterm_output.js
+++ /dev/null
@@ -1,275 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let testEnded = false;
-let pos = -1;
-
-let dateNow = Date.now();
-
-let tempScope = {};
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm", tempScope);
-
-let longString = (new Array(tempScope.DebuggerServer.LONG_STRING_LENGTH + 4)).join("a");
-let initialString = longString.substring(0,
- tempScope.DebuggerServer.LONG_STRING_INITIAL_LENGTH);
-
-let inputValues = [
- // [showsVariablesView?, input value, expected output format,
- // print() output, console API output, optional console API test]
-
- // 0
- [false, "'hello \\nfrom \\rthe \\\"string world!'",
- '"hello \nfrom \rthe "string world!"',
- "hello \nfrom \rthe \"string world!"],
-
- // 1
- [false, "'\xFA\u1E47\u0129\xE7\xF6d\xEA \u021B\u0115\u0219\u0165'",
- "\"\xFA\u1E47\u0129\xE7\xF6d\xEA \u021B\u0115\u0219\u0165\"",
- "\xFA\u1E47\u0129\xE7\xF6d\xEA \u021B\u0115\u0219\u0165"],
-
- // 2
- [false, "window.location.href", '"' + TEST_URI + '"', TEST_URI],
-
- // 3
- [false, "0", "0"],
-
- // 4
- [false, "'0'", '"0"', "0"],
-
- // 5
- [false, "42", "42"],
-
- // 6
- [false, "'42'", '"42"', "42"],
-
- // 7
- [true, "/foobar/", "[object RegExp]", '"/foobar/"', "[object RegExp]"],
-
- // 8
- [false, "null", "null"],
-
- // 9
- [false, "undefined", "undefined"],
-
- // 10
- [false, "true", "true"],
-
- // 11
- [true, "document.getElementById", "[object Function]",
- "function getElementById() {\n [native code]\n}",
- "[object Function]"],
-
- // 12
- [true, "(function() { return 42; })", "[object Function]",
- "function () { return 42; }", "[object Function]"],
-
- // 13
- [true, "new Date(" + dateNow + ")", "[object Date]", (new Date(dateNow)).toString(), "[object Date]"],
-
- // 14
- [true, "document.body", "[object HTMLBodyElement]"],
-
- // 15
- [true, "window.location", "[object Location]", TEST_URI, "[object Location]"],
-
- // 16
- [true, "[1,2,3,'a','b','c','4','5']", '[object Array]',
- '1,2,3,a,b,c,4,5',
- "[object Array]"],
-
- // 17
- [true, "({a:'b', c:'d', e:1, f:'2'})", "[object Object]"],
-
- // 18
- [false, "'" + longString + "'",
- '"' + initialString + "\"[\u2026]", initialString],
-];
-
-longString = null;
-initialString = null;
-tempScope = null;
-
-let eventHandlers = [];
-let popupShown = [];
-let HUD;
-let testDriver;
-
-function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
-
- waitForFocus(function () {
- openConsole(null, function(aHud) {
- HUD = aHud;
- testNext();
- });
- }, content);
-}
-
-function subtestNext() {
- testDriver.next();
-}
-
-function testNext() {
- pos++;
- if (pos == inputValues.length) {
- testEnd();
- return;
- }
-
- testDriver = testGen();
- testDriver.next();
-}
-
-function testGen() {
- let cpos = pos;
-
- let showsVariablesView = inputValues[cpos][0];
- let inputValue = inputValues[cpos][1];
- let expectedOutput = inputValues[cpos][2];
-
- let printOutput = inputValues[cpos].length >= 4 ?
- inputValues[cpos][3] : expectedOutput;
-
- let consoleOutput = inputValues[cpos].length >= 5 ?
- inputValues[cpos][4] : printOutput;
-
- let consoleTest = inputValues[cpos][5] || inputValue;
-
- HUD.jsterm.clearOutput();
-
- // Test the console.log() output.
-
- HUD.jsterm.execute("console.log(" + consoleTest + ")");
-
- waitForMessages({
- webconsole: HUD,
- messages: [{
- name: "console API output is correct for inputValues[" + cpos + "]",
- text: consoleOutput,
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(subtestNext);
-
- yield undefined;
-
- HUD.jsterm.clearOutput();
-
- // Test jsterm print() output.
-
- HUD.jsterm.setInputValue("print(" + inputValue + ")");
- HUD.jsterm.execute();
-
- waitForMessages({
- webconsole: HUD,
- messages: [{
- name: "jsterm print() output is correct for inputValues[" + cpos + "]",
- text: printOutput,
- category: CATEGORY_OUTPUT,
- }],
- }).then(subtestNext);
-
- yield undefined;
-
- // Test jsterm execution output.
-
- HUD.jsterm.clearOutput();
- HUD.jsterm.setInputValue(inputValue);
- HUD.jsterm.execute();
-
- let outputItem;
- waitForMessages({
- webconsole: HUD,
- messages: [{
- name: "jsterm output is correct for inputValues[" + cpos + "]",
- text: expectedOutput,
- category: CATEGORY_OUTPUT,
- }],
- }).then(([result]) => {
- outputItem = [...result.matched][0];
- ok(outputItem, "found message element");
- subtestNext();
- });
-
- yield undefined;
-
- let messageBody = outputItem.querySelector(".webconsole-msg-body");
- ok(messageBody, "we have the message body for inputValues[" + cpos + "]");
-
- // Test click on output.
- let eventHandlerID = eventHandlers.length + 1;
-
- let variablesViewShown = function(aEvent, aView, aOptions) {
- if (aOptions.label.indexOf(expectedOutput) == -1) {
- return;
- }
-
- HUD.jsterm.off("variablesview-open", variablesViewShown);
-
- eventHandlers[eventHandlerID] = null;
-
- ok(showsVariablesView,
- "the variables view shown for inputValues[" + cpos + "]");
-
- popupShown[cpos] = true;
-
- if (showsVariablesView) {
- executeSoon(subtestNext);
- }
- };
-
- HUD.jsterm.on("variablesview-open", variablesViewShown);
-
- eventHandlers.push(variablesViewShown);
-
- // Send the mousedown, mouseup and click events to check if the variables
- // view opens.
- EventUtils.sendMouseEvent({ type: "mousedown" }, messageBody, window);
- EventUtils.sendMouseEvent({ type: "click" }, messageBody, window);
-
- if (showsVariablesView) {
- yield undefined; // wait for the panel to open if we need to.
- }
-
- testNext();
-
- yield undefined;
-}
-
-function testEnd() {
- if (testEnded) {
- return;
- }
-
- testEnded = true;
-
- for (let i = 0; i < eventHandlers.length; i++) {
- if (eventHandlers[i]) {
- HUD.jsterm.off("variablesview-open", eventHandlers[i]);
- }
- }
-
- for (let i = 0; i < inputValues.length; i++) {
- if (inputValues[i][0] && !popupShown[i]) {
- ok(false, "the variables view failed to show for inputValues[" + i + "]");
- }
- }
-
- HUD = inputValues = testDriver = null;
- executeSoon(finishTest);
-}
-
-function test() {
- requestLongerTimeout(2);
- addTab(TEST_URI);
- browser.addEventListener("load", tabLoad, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js b/browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
deleted file mode 100644
index a913f5e0c..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_599725_response_headers.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs";
-
-let loads = 0;
-function performTest(aRequest, aConsole)
-{
- loads++;
- ok(aRequest, "page load was logged");
- if (loads != 2) {
- return;
- }
-
- let headers = null;
-
- function readHeader(aName)
- {
- for (let header of headers) {
- if (header.name == aName) {
- return header.value;
- }
- }
- return null;
- }
-
- aConsole.webConsoleClient.getResponseHeaders(aRequest.actor,
- function (aResponse) {
- headers = aResponse.headers;
- ok(headers, "we have the response headers for reload");
-
- let contentType = readHeader("Content-Type");
- let contentLength = readHeader("Content-Length");
-
- ok(!contentType, "we do not have the Content-Type header");
- isnot(contentLength, 60, "Content-Length != 60");
-
- if (contentType || contentLength == 60) {
- console.debug("lastFinishedRequest", lastFinishedRequest,
- "request", lastFinishedRequest.request,
- "response", lastFinishedRequest.response,
- "updates", lastFinishedRequest.updates,
- "response headers", headers);
- }
-
- executeSoon(finishTest);
- });
-
- HUDService.lastFinishedRequestCallback = null;
-}
-
-function test()
-{
- addTab("data:text/plain;charset=utf8,hello world");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, () => {
- HUDService.lastFinishedRequestCallback = performTest;
-
- browser.addEventListener("load", function onReload() {
- browser.removeEventListener("load", onReload, true);
- executeSoon(() => content.location.reload());
- }, true);
-
- executeSoon(() => content.location = TEST_URI);
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js b/browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js
deleted file mode 100644
index 3dd67379d..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html";
-
-function performTest(lastFinishedRequest, aConsole)
-{
- ok(lastFinishedRequest, "charset test page was loaded and logged");
- HUDService.lastFinishedRequestCallback = null;
-
- executeSoon(() => {
- aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor,
- (aResponse) => {
- ok(!aResponse.contentDiscarded, "response body was not discarded");
-
- let body = aResponse.content.text;
- ok(body, "we have the response body");
-
- let chars = "\u7684\u95ee\u5019!"; // 的问候!
- isnot(body.indexOf("<p>" + chars + "</p>"), -1,
- "found the chinese simplified string");
-
- HUDService.lastFinishedRequestCallback = null;
- executeSoon(finishTest);
- });
- });
-}
-
-function test()
-{
- addTab("data:text/html;charset=utf-8,Web Console - bug 600183 test");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(hud) {
- hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
- ok(hud.ui._saveRequestAndResponseBodies,
- "The saveRequestAndResponseBodies property was successfully set.");
-
- HUDService.lastFinishedRequestCallback = performTest;
- content.location = TEST_URI;
- });
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_601177_log_levels.js b/browser/devtools/webconsole/test/browser_webconsole_bug_601177_log_levels.js
deleted file mode 100644
index 5a3566a3e..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_601177_log_levels.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-601177-log-levels.html";
-
-function performTest()
-{
- let hudId = HUDService.getHudIdByWindow(content);
- let HUD = HUDService.hudReferences[hudId];
-
- findEntry(HUD, "hud-networkinfo", "test-bug-601177-log-levels.html",
- "found test-bug-601177-log-levels.html");
-
- findEntry(HUD, "hud-networkinfo", "test-bug-601177-log-levels.js",
- "found test-bug-601177-log-levels.js");
-
- findEntry(HUD, "hud-networkinfo", "test-image.png", "found test-image.png");
-
- findEntry(HUD, "hud-network", "foobar-known-to-fail.png",
- "found foobar-known-to-fail.png");
-
- findEntry(HUD, "hud-exception", "foobarBug601177exception",
- "found exception");
-
- findEntry(HUD, "hud-jswarn", "undefinedPropertyBug601177",
- "found strict warning");
-
- findEntry(HUD, "hud-jswarn", "foobarBug601177strictError",
- "found strict error");
-
- executeSoon(finishTest);
-}
-
-function findEntry(aHUD, aClass, aString, aMessage)
-{
- return testLogEntry(aHUD.outputNode, aString, aMessage, false, false,
- aClass);
-}
-
-function test()
-{
- Services.prefs.setBoolPref("javascript.options.strict", true);
-
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("javascript.options.strict");
- });
-
- addTab("data:text/html;charset=utf-8,Web Console test for bug 601177: log levels");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(hud) {
- browser.addEventListener("load", function onLoad2() {
- browser.removeEventListener("load", onLoad2, true);
- waitForSuccess({
- name: "all messages displayed",
- validatorFn: function()
- {
- return hud.outputNode.itemCount >= 7;
- },
- successFn: performTest,
- failureFn: function() {
- info("itemCount: " + hud.outputNode.itemCount);
- finishTest();
- },
- });
- }, true);
-
- expectUncaughtException();
- content.location = TEST_URI;
- });
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_601352_scroll.js b/browser/devtools/webconsole/test/browser_webconsole_bug_601352_scroll.js
deleted file mode 100644
index 2ff469db2..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_601352_scroll.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-function consoleOpened(HUD) {
- HUD.jsterm.clearOutput();
-
- let longMessage = "";
- for (let i = 0; i < 50; i++) {
- longMessage += "LongNonwrappingMessage";
- }
-
- for (let i = 0; i < 50; i++) {
- content.console.log("test message " + i);
- }
-
- content.console.log(longMessage);
-
- for (let i = 0; i < 50; i++) {
- content.console.log("test message " + i);
- }
-
- HUD.jsterm.execute("1+1");
-
- function performTest() {
- let scrollBox = HUD.outputNode.scrollBoxObject.element;
- isnot(scrollBox.scrollTop, 0, "scroll location is not at the top");
-
- let node = HUD.outputNode.getItemAtIndex(HUD.outputNode.itemCount - 1);
- let rectNode = node.getBoundingClientRect();
- let rectOutput = HUD.outputNode.getBoundingClientRect();
-
- // Visible scroll viewport.
- let height = scrollBox.scrollHeight - scrollBox.scrollTop;
-
- // Top position of the last message node, relative to the outputNode.
- let top = rectNode.top - rectOutput.top;
-
- // Bottom position of the last message node, relative to the outputNode.
- let bottom = rectNode.bottom - rectOutput.top;
-
- ok(top >= 0 && Math.floor(bottom) <= height + 1,
- "last message is visible");
-
- finishTest();
- };
-
- waitForSuccess({
- name: "console output displayed",
- validatorFn: function()
- {
- return HUD.outputNode.itemCount >= 103;
- },
- successFn: performTest,
- failureFn: function() {
- info("itemCount: " + HUD.outputNode.itemCount);
- finishTest();
- },
- });
-}
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 601352");
- browser.addEventListener("load", function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_601667_filter_buttons.js b/browser/devtools/webconsole/test/browser_webconsole_bug_601667_filter_buttons.js
deleted file mode 100644
index 6872ffc0d..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_601667_filter_buttons.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that the filter button UI logic works correctly.
-
-const TEST_URI = "http://example.com/";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testFilterButtons);
- }, true);
-}
-
-function testFilterButtons(aHud) {
- hud = aHud;
- hudId = hud.hudId;
- hudBox = hud.ui.rootElement;
-
- testMenuFilterButton("net");
- testMenuFilterButton("css");
- testMenuFilterButton("js");
- testMenuFilterButton("logging");
-
- finishTest();
-}
-
-function testMenuFilterButton(aCategory) {
- let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]";
- let button = hudBox.querySelector(selector);
- ok(button, "we have the \"" + aCategory + "\" button");
-
- let firstMenuItem = button.querySelector("menuitem");
- ok(firstMenuItem, "we have the first menu item for the \"" + aCategory +
- "\" button");
-
- // Turn all the filters off, if they were on.
- let menuItem = firstMenuItem;
- while (menuItem != null) {
- if (isChecked(menuItem)) {
- chooseMenuItem(menuItem);
- }
- menuItem = menuItem.nextSibling;
- }
-
- // Turn all the filters on; make sure the button gets checked.
- menuItem = firstMenuItem;
- let prefKey;
- while (menuItem) {
- if (menuItem.hasAttribute("prefKey")) {
- prefKey = menuItem.getAttribute("prefKey");
- chooseMenuItem(menuItem);
- ok(isChecked(menuItem), "menu item " + prefKey + " for category " +
- aCategory + " is checked after clicking it");
- ok(hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
- "on after clicking the appropriate menu item");
- }
- menuItem = menuItem.nextSibling;
- }
- ok(isChecked(button), "the button for category " + aCategory + " is " +
- "checked after turning on all its menu items");
-
- // Turn one filter off; make sure the button is still checked.
- prefKey = firstMenuItem.getAttribute("prefKey");
- chooseMenuItem(firstMenuItem);
- ok(!isChecked(firstMenuItem), "the first menu item for category " +
- aCategory + " is no longer checked after clicking it");
- ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
- "turned off after clicking the appropriate menu item");
- ok(isChecked(button), "the button for category " + aCategory + " is still " +
- "checked after turning off its first menu item");
-
- // Turn all the filters off by clicking the main part of the button.
- let anonymousNodes = hud.ui.document.getAnonymousNodes(button);
- let subbutton;
- for (let i = 0; i < anonymousNodes.length; i++) {
- let node = anonymousNodes[i];
- if (node.classList.contains("toolbarbutton-menubutton-button")) {
- subbutton = node;
- break;
- }
- }
- ok(subbutton, "we have the subbutton for category " + aCategory);
-
- clickButton(subbutton);
- ok(!isChecked(button), "the button for category " + aCategory + " is " +
- "no longer checked after clicking its main part");
-
- menuItem = firstMenuItem;
- while (menuItem) {
- let prefKey = menuItem.getAttribute("prefKey");
- ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
- aCategory + " is no longer checked after clicking the button");
- ok(!hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
- "off after clicking the button");
- menuItem = menuItem.nextSibling;
- }
-
- // Turn all the filters on by clicking the main part of the button.
- clickButton(subbutton);
-
- ok(isChecked(button), "the button for category " + aCategory + " is " +
- "checked after clicking its main part");
-
- menuItem = firstMenuItem;
- while (menuItem) {
- if (menuItem.hasAttribute("prefKey")) {
- let prefKey = menuItem.getAttribute("prefKey");
- ok(isChecked(menuItem), "menu item " + prefKey + " for category " +
- aCategory + " is checked after clicking the button");
- ok(hud.ui.filterPrefs[prefKey], prefKey + " messages are " +
- "on after clicking the button");
- }
- menuItem = menuItem.nextSibling;
- }
-
- // Uncheck the main button by unchecking all the filters
- menuItem = firstMenuItem;
- while (menuItem) {
- chooseMenuItem(menuItem);
- menuItem = menuItem.nextSibling;
- }
-
- ok(!isChecked(button), "the button for category " + aCategory + " is " +
- "unchecked after unchecking all its filters");
-
- // Turn all the filters on again by clicking the button.
- clickButton(subbutton);
-}
-
-function clickButton(aNode) {
- EventUtils.sendMouseEvent({ type: "click" }, aNode);
-}
-
-function chooseMenuItem(aNode) {
- let event = document.createEvent("XULCommandEvent");
- event.initCommandEvent("command", true, true, window, 0, false, false, false,
- false, null);
- aNode.dispatchEvent(event);
-}
-
-function isChecked(aNode) {
- return aNode.getAttribute("checked") === "true";
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_602572_log_bodies_checkbox.js b/browser/devtools/webconsole/test/browser_webconsole_bug_602572_log_bodies_checkbox.js
deleted file mode 100644
index d4ed63916..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_602572_log_bodies_checkbox.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-let menuitems = [], menupopups = [], huds = [], tabs = [], runCount = 0;
-
-function test()
-{
- if (runCount == 0) {
- requestLongerTimeout(2);
- }
-
- // open tab 1
- addTab("data:text/html;charset=utf-8,Web Console test for bug 602572: log bodies checkbox. tab 1");
- tabs.push(tab);
-
- browser.addEventListener("load", function onLoad1(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad1, true);
-
- openConsole(null, (hud) => hud.iframeWindow.mozRequestAnimationFrame(() => {
- info("iframe1 root height " + hud.ui.rootElement.clientHeight);
-
- // open tab 2
- addTab("data:text/html;charset=utf-8,Web Console test for bug 602572: log bodies checkbox. tab 2");
- tabs.push(tab);
-
- browser.addEventListener("load", function onLoad2(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad2, true);
-
- openConsole(null, (hud) => hud.iframeWindow.mozRequestAnimationFrame(startTest));
- }, true);
- }));
- }, true);
-}
-
-function startTest()
-{
- // Find the relevant elements in the Web Console of tab 2.
- let win2 = tabs[runCount*2 + 1].linkedBrowser.contentWindow;
- let hudId2 = HUDService.getHudIdByWindow(win2);
- huds[1] = HUDService.hudReferences[hudId2];
- info("startTest: iframe2 root height " + huds[1].ui.rootElement.clientHeight);
-
- if (runCount == 0) {
- menuitems[1] = huds[1].ui.rootElement.querySelector("#saveBodies");
- }
- else {
- menuitems[1] = huds[1].ui.rootElement.querySelector("#saveBodiesContextMenu");
- }
- menupopups[1] = menuitems[1].parentNode;
-
- // Open the context menu from tab 2.
- menupopups[1].addEventListener("popupshown", onpopupshown2, false);
- executeSoon(function() {
- menupopups[1].openPopup();
- });
-}
-
-function onpopupshown2(aEvent)
-{
- menupopups[1].removeEventListener(aEvent.type, onpopupshown2, false);
-
- // By default bodies are not logged.
- isnot(menuitems[1].getAttribute("checked"), "true",
- "menuitems[1] is not checked");
-
- ok(!huds[1].ui._saveRequestAndResponseBodies, "bodies are not logged");
-
- // Enable body logging.
- huds[1].ui.setSaveRequestAndResponseBodies(true).then(() => {
- menupopups[1].hidePopup();
- });
-
- menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
- menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
-
- info("menupopups[1] hidden");
-
- // Reopen the context menu.
- huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2b(aEvent));
- menupopups[1].openPopup();
- }, false);
-}
-
-function testpopup2b(aEvent) {
- is(menuitems[1].getAttribute("checked"), "true", "menuitems[1] is checked");
-
- menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
- menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
-
- info("menupopups[1] hidden");
-
- // Switch to tab 1 and open the Web Console context menu from there.
- gBrowser.selectedTab = tabs[runCount*2];
- waitForFocus(function() {
- // Find the relevant elements in the Web Console of tab 1.
- let win1 = tabs[runCount*2].linkedBrowser.contentWindow;
- let hudId1 = HUDService.getHudIdByWindow(win1);
- huds[0] = HUDService.hudReferences[hudId1];
-
- info("iframe1 root height " + huds[0].ui.rootElement.clientHeight);
-
- menuitems[0] = huds[0].ui.rootElement.querySelector("#saveBodies");
- menupopups[0] = huds[0].ui.rootElement.querySelector("menupopup");
-
- menupopups[0].addEventListener("popupshown", onpopupshown1, false);
- executeSoon(() => menupopups[0].openPopup());
- }, tabs[runCount*2].linkedBrowser.contentWindow);
- }, false);
-
- executeSoon(function() {
- menupopups[1].hidePopup();
- });
-}
-
-function onpopupshown1(aEvent)
-{
- menupopups[0].removeEventListener(aEvent.type, onpopupshown1, false);
-
- // The menuitem checkbox must not be in sync with the other tabs.
- isnot(menuitems[0].getAttribute("checked"), "true",
- "menuitems[0] is not checked");
-
- // Enable body logging for tab 1 as well.
- huds[0].ui.setSaveRequestAndResponseBodies(true).then(() => {
- menupopups[0].hidePopup();
- });
-
- // Close the menu, and switch back to tab 2.
- menupopups[0].addEventListener("popuphidden", function _onhidden(aEvent) {
- menupopups[0].removeEventListener(aEvent.type, _onhidden, false);
-
- info("menupopups[0] hidden");
-
- gBrowser.selectedTab = tabs[runCount*2 + 1];
- waitForFocus(function() {
- // Reopen the context menu from tab 2.
- huds[1].ui.once("save-bodies-ui-toggled", () => testpopup2c(aEvent));
- menupopups[1].openPopup();
- }, tabs[runCount*2 + 1].linkedBrowser.contentWindow);
- }, false);
-}
-
-function testpopup2c(aEvent) {
- is(menuitems[1].getAttribute("checked"), "true", "menuitems[1] is checked");
-
- menupopups[1].addEventListener("popuphidden", function _onhidden(aEvent) {
- menupopups[1].removeEventListener(aEvent.type, _onhidden, false);
-
- info("menupopups[1] hidden");
-
- // Done if on second run
- closeConsole(gBrowser.selectedTab, function() {
- if (runCount == 0) {
- runCount++;
- info("start second run");
- executeSoon(test);
- }
- else {
- gBrowser.removeCurrentTab();
- gBrowser.selectedTab = tabs[2];
- gBrowser.removeCurrentTab();
- gBrowser.selectedTab = tabs[1];
- gBrowser.removeCurrentTab();
- gBrowser.selectedTab = tabs[0];
- gBrowser.removeCurrentTab();
- huds = menuitems = menupopups = tabs = null;
- executeSoon(finishTest);
- }
- });
- }, false);
-
- executeSoon(function() {
- menupopups[1].hidePopup();
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_603750_websocket.js b/browser/devtools/webconsole/test/browser_webconsole_bug_603750_websocket.js
deleted file mode 100644
index 323340f7a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_603750_websocket.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-603750-websocket.html";
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 603750: Web Socket errors");
- browser.addEventListener("load", function tabLoad() {
- browser.removeEventListener("load", tabLoad, true);
- openConsole(null, (hud) => {
- content.location = TEST_URI;
- info("waiting for websocket errors");
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- text: "ws://0.0.0.0:81",
- source: { url: "test-bug-603750-websocket.js" },
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- },
- {
- text: "ws://0.0.0.0:82",
- source: { url: "test-bug-603750-websocket.js" },
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- },
- ]}).then(finishTest);
- });
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js b/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
deleted file mode 100644
index 6eb5177e5..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">test repeated' +
- ' css warnings</div><p style="-moz-opacity:0">hi</p>';
-
-function onContentLoaded()
-{
- browser.removeEventListener("load", onContentLoaded, true);
-
- let HUD = HUDService.getHudByWindow(content);
- let jsterm = HUD.jsterm;
- let outputNode = HUD.outputNode;
-
- let cssWarning = "Unknown property '-moz-opacity'. Declaration dropped.";
- let textFound = false;
- let repeats = 0;
-
- function displayResults()
- {
- ok(textFound, "css warning was found");
- is(repeats, 2, "The unknown CSS property warning is displayed only once");
- }
-
- waitForSuccess({
- name: "2 repeated CSS warnings",
- validatorFn: () => {
- let node = outputNode.querySelector(".webconsole-msg-cssparser");
- if (!node) {
- return false;
- }
-
- textFound = node.textContent.indexOf(cssWarning) > -1;
- repeats = node.querySelector(".webconsole-msg-repeat")
- .getAttribute("value");
- return textFound && repeats == 2;
- },
- successFn: () => {
- displayResults();
- testConsoleLogRepeats();
- },
- failureFn: () => {
- displayResults();
- finishTest();
- },
- });
-}
-
-function testConsoleLogRepeats()
-{
- let HUD = HUDService.getHudByWindow(content);
- let jsterm = HUD.jsterm;
- let outputNode = HUD.outputNode;
-
- jsterm.clearOutput();
-
- jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a line of reasonably long text that I will use to verify that the repeated text node is of an appropriate size.');");
- jsterm.execute();
-
- waitForSuccess({
- timeout: 10000,
- name: "10 repeated console.log messages",
- validatorFn: function()
- {
- let node = outputNode.querySelector(".webconsole-msg-console");
- return node && node.childNodes[3].firstChild.getAttribute("value") == 10;
- },
- successFn: finishTest,
- failureFn: function() {
- info("output content: " + outputNode.textContent);
- finishTest();
- },
- });
-}
-
-/**
- * Unit test for bug 611795:
- * Repeated CSS messages get collapsed into one.
- */
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(aHud) {
- // Clear cached messages that are shown once the Web Console opens.
- aHud.jsterm.clearOutput(true);
- browser.addEventListener("load", onContentLoaded, true);
- content.location.reload();
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_613013_console_api_iframe.js b/browser/devtools/webconsole/test/browser_webconsole_bug_613013_console_api_iframe.js
deleted file mode 100644
index 7e0fe28e1..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_613013_console_api_iframe.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html";
-
-let TestObserver = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function test_observe(aMessage, aTopic, aData)
- {
- if (aTopic == "console-api-log-event") {
- executeSoon(performTest);
- }
- }
-};
-
-function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
-
- openConsole(null, function(aHud) {
- hud = aHud;
- Services.obs.addObserver(TestObserver, "console-api-log-event", false);
- content.location.reload();
- });
-}
-
-function performTest() {
- Services.obs.removeObserver(TestObserver, "console-api-log-event");
- TestObserver = null;
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "foobarBug613013",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(finishTest);
-}
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", tabLoad, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_613280_jsterm_copy.js b/browser/devtools/webconsole/test/browser_webconsole_bug_613280_jsterm_copy.js
deleted file mode 100644
index 8748b0aa7..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_613280_jsterm_copy.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- */
-
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 613280";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(HUD) {
- content.console.log("foobarBazBug613280");
- waitForSuccess({
- name: "a message is displayed",
- validatorFn: function()
- {
- return HUD.outputNode.itemCount > 0;
- },
- successFn: performTest.bind(null, HUD),
- failureFn: finishTest,
- });
- });
- }, true);
-}
-
-function performTest(HUD) {
- let input = HUD.jsterm.inputNode;
- let selection = getSelection();
- let contentSelection = browser.contentWindow.wrappedJSObject.getSelection();
-
- let clipboard_setup = function() {
- goDoCommand("cmd_copy");
- };
-
- let clipboard_copy_done = function() {
- finishTest();
- };
-
- // Check if we first need to clear any existing selections.
- if (selection.rangeCount > 0 || contentSelection.rangeCount > 0 ||
- input.selectionStart != input.selectionEnd) {
- if (input.selectionStart != input.selectionEnd) {
- input.selectionStart = input.selectionEnd = 0;
- }
-
- if (selection.rangeCount > 0) {
- selection.removeAllRanges();
- }
-
- if (contentSelection.rangeCount > 0) {
- contentSelection.removeAllRanges();
- }
-
- goUpdateCommand("cmd_copy");
- }
-
- let controller = top.document.commandDispatcher.
- getControllerForCommand("cmd_copy");
- is(controller.isCommandEnabled("cmd_copy"), false, "cmd_copy is disabled");
-
- HUD.jsterm.execute("'bug613280: hello world!'");
-
- HUD.outputNode.selectedIndex = HUD.outputNode.itemCount - 1;
- HUD.outputNode.focus();
-
- goUpdateCommand("cmd_copy");
-
- controller = top.document.commandDispatcher.
- getControllerForCommand("cmd_copy");
- is(controller.isCommandEnabled("cmd_copy"), true, "cmd_copy is enabled");
-
- ok(HUD.outputNode.selectedItem, "we have a selected message");
-
- waitForClipboard(getExpectedClipboardText(HUD.outputNode.selectedItem),
- clipboard_setup, clipboard_copy_done, clipboard_copy_done);
-}
-
-function getExpectedClipboardText(aItem) {
- return "[" + WCU_l10n.timestampString(aItem.timestamp) + "] " +
- aItem.clipboardText;
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_613642_maintain_scroll.js b/browser/devtools/webconsole/test/browser_webconsole_bug_613642_maintain_scroll.js
deleted file mode 100644
index b3317a669..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_613642_maintain_scroll.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- */
-
-let hud, testDriver;
-
-function testNext() {
- testDriver.next();
-}
-
-function testGen() {
- hud.jsterm.clearOutput();
- let outputNode = hud.outputNode;
- let scrollBox = outputNode.scrollBoxObject.element;
-
- for (let i = 0; i < 150; i++) {
- content.console.log("test message " + i);
- }
-
- waitForSuccess({
- name: "150 console.log messages displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-log").length == 150;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- let oldScrollTop = scrollBox.scrollTop;
- ok(oldScrollTop > 0, "scroll location is not at the top");
-
- // scroll to the first node
- outputNode.focus();
-
- EventUtils.synthesizeKey("VK_HOME", {});
-
- let topPosition = scrollBox.scrollTop;
- isnot(topPosition, oldScrollTop, "scroll location updated (moved to top)");
-
- // add a message and make sure scroll doesn't change
- content.console.log("test message 150");
-
- waitForSuccess({
- name: "console.log message no. 151 displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-log").length == 151;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- is(scrollBox.scrollTop, topPosition, "scroll location is still at the top");
-
- // scroll back to the bottom
- outputNode.lastChild.focus();
- EventUtils.synthesizeKey("VK_END", {});
-
- oldScrollTop = outputNode.scrollTop;
-
- content.console.log("test message 151");
-
- waitForSuccess({
- name: "console.log message no. 152 displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-log").length == 152;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- isnot(scrollBox.scrollTop, oldScrollTop,
- "scroll location updated (moved to bottom)");
-
- hud = testDriver = null;
- finishTest();
-
- yield;
-}
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 613642: remember scroll location");
- browser.addEventListener("load", function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
- openConsole(null, function(aHud) {
- hud = aHud;
- testDriver = testGen();
- testDriver.next();
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_613642_prune_scroll.js b/browser/devtools/webconsole/test/browser_webconsole_bug_613642_prune_scroll.js
deleted file mode 100644
index 5bde49602..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_613642_prune_scroll.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- */
-
-let hud, testDriver;
-
-function testNext() {
- testDriver.next();
-}
-
-function testGen() {
- hud.jsterm.clearOutput();
-
- let outputNode = hud.outputNode;
- let oldPref = Services.prefs.getIntPref("devtools.hud.loglimit.console");
-
- Services.prefs.setIntPref("devtools.hud.loglimit.console", 140);
- let scrollBoxElement = outputNode.scrollBoxObject.element;
- let boxObject = outputNode.scrollBoxObject;
-
- for (let i = 0; i < 150; i++) {
- content.console.log("test message " + i);
- }
-
- waitForSuccess({
- name: "150 console.log messages displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-log").length == 140;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- let oldScrollTop = scrollBoxElement.scrollTop;
- ok(oldScrollTop > 0, "scroll location is not at the top");
-
- let firstNode = outputNode.firstChild;
- ok(firstNode, "found the first message");
-
- let msgNode = outputNode.querySelectorAll("richlistitem")[80];
- ok(msgNode, "found the 80th message");
-
- // scroll to the middle message node
- boxObject.ensureElementIsVisible(msgNode);
-
- isnot(scrollBoxElement.scrollTop, oldScrollTop,
- "scroll location updated (scrolled to message)");
-
- oldScrollTop = scrollBoxElement.scrollTop;
-
- // add a message
- content.console.log("hello world");
-
- waitForSuccess({
- name: "console.log message #151 displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("hello world") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- // Scroll location needs to change, because one message is also removed, and
- // we need to scroll a bit towards the top, to keep the current view in sync.
- isnot(scrollBoxElement.scrollTop, oldScrollTop,
- "scroll location updated (added a message)");
-
- isnot(outputNode.firstChild, firstNode,
- "first message removed");
-
- Services.prefs.setIntPref("devtools.hud.loglimit.console", oldPref);
-
- hud = testDriver = null;
- finishTest();
-
- yield;
-}
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 613642: maintain scroll with pruning of old messages");
- browser.addEventListener("load", function tabLoad(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoad, true);
-
- openConsole(null, function(aHud) {
- hud = aHud;
- testDriver = testGen();
- testDriver.next();
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js b/browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js
deleted file mode 100644
index 279fc2967..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_614793_jsterm_scroll.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Șucan <mihai.sucan@gmail.com>
- */
-
-function consoleOpened(hud) {
- hud.jsterm.clearOutput();
-
- let outputNode = hud.outputNode;
- let boxObject = outputNode.scrollBoxObject.element;
-
- for (let i = 0; i < 150; i++) {
- content.console.log("test message " + i);
- }
-
- let oldScrollTop = -1;
-
- waitForSuccess({
- name: "console.log messages displayed",
- validatorFn: function()
- {
- return outputNode.itemCount == 150;
- },
- successFn: function()
- {
- oldScrollTop = boxObject.scrollTop;
- ok(oldScrollTop > 0, "scroll location is not at the top");
-
- hud.jsterm.execute("'hello world'");
-
- waitForSuccess(waitForExecute);
- },
- failureFn: finishTest,
- });
-
- let waitForExecute = {
- name: "jsterm output displayed",
- validatorFn: function()
- {
- return outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- isnot(boxObject.scrollTop, oldScrollTop, "scroll location updated");
-
- oldScrollTop = boxObject.scrollTop;
- outputNode.scrollBoxObject.ensureElementIsVisible(outputNode.lastChild);
-
- is(boxObject.scrollTop, oldScrollTop, "scroll location is the same");
-
- finishTest();
- },
- failureFn: finishTest,
- };
-}
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 614793: jsterm result scroll");
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_618078_network_exceptions.js b/browser/devtools/webconsole/test/browser_webconsole_bug_618078_network_exceptions.js
deleted file mode 100644
index 62085dd50..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_618078_network_exceptions.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that network log messages bring up the network panel.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html";
-
-let testEnded = false;
-
-let TestObserver = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function test_observe(aSubject)
- {
- if (testEnded || !(aSubject instanceof Ci.nsIScriptError)) {
- return;
- }
-
- is(aSubject.category, "content javascript", "error category");
-
- testEnded = true;
- if (aSubject.category == "content javascript") {
- executeSoon(checkOutput);
- }
- else {
- executeSoon(finishTest);
- }
- }
-};
-
-function checkOutput()
-{
- waitForSuccess({
- name: "exception message",
- validatorFn: function()
- {
- return hud.outputNode.textContent.indexOf("bug618078exception") > -1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
-}
-
-function testEnd()
-{
- Services.console.unregisterListener(TestObserver);
-}
-
-function test()
-{
- addTab("data:text/html;charset=utf-8,Web Console test for bug 618078");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(aHud) {
- hud = aHud;
- Services.console.registerListener(TestObserver);
- registerCleanupFunction(testEnd);
-
- executeSoon(function() {
- expectUncaughtException();
- content.location = TEST_URI;
- });
- });
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_618311_close_panels.js b/browser/devtools/webconsole/test/browser_webconsole_bug_618311_close_panels.js
deleted file mode 100644
index b1bd90ffe..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_618311_close_panels.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(hud) {
- content.location.reload();
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test-console.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- }],
- }).then(performTest);
- });
- }, true);
-}
-
-function performTest() {
- let hudId = HUDService.getHudIdByWindow(content);
- let HUD = HUDService.hudReferences[hudId];
-
- let networkMessage = HUD.outputNode.querySelector(".webconsole-msg-network");
- ok(networkMessage, "found network message");
-
- let networkLink = networkMessage.querySelector(".webconsole-msg-link");
- ok(networkLink, "found network message link");
-
- let popupset = document.getElementById("mainPopupSet");
- ok(popupset, "found #mainPopupSet");
-
- let popupsShown = 0;
- let hiddenPopups = 0;
-
- let onpopupshown = function() {
- document.removeEventListener("popupshown", onpopupshown, false);
- popupsShown++;
-
- executeSoon(function() {
- let popups = popupset.querySelectorAll("panel[hudId=" + hudId + "]");
- is(popups.length, 1, "found one popup");
-
- document.addEventListener("popuphidden", onpopuphidden, false);
-
- registerCleanupFunction(function() {
- is(hiddenPopups, 1, "correct number of popups hidden");
- if (hiddenPopups != 1) {
- document.removeEventListener("popuphidden", onpopuphidden, false);
- }
- });
-
- executeSoon(closeConsole);
- });
- };
-
- let onpopuphidden = function() {
- document.removeEventListener("popuphidden", onpopuphidden, false);
- hiddenPopups++;
-
- executeSoon(function() {
- let popups = popupset.querySelectorAll("panel[hudId=" + hudId + "]");
- is(popups.length, 0, "no popups found");
-
- executeSoon(finishTest);
- });
- };
-
- document.addEventListener("popupshown", onpopupshown, false);
-
- registerCleanupFunction(function() {
- is(popupsShown, 1, "correct number of popups shown");
- if (popupsShown != 1) {
- document.removeEventListener("popupshown", onpopupshown, false);
- }
- });
-
- EventUtils.sendMouseEvent({ type: "mousedown" }, networkLink, HUD.iframeWindow);
- EventUtils.sendMouseEvent({ type: "mouseup" }, networkLink, HUD.iframeWindow);
- EventUtils.sendMouseEvent({ type: "click" }, networkLink, HUD.iframeWindow);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_621644_jsterm_dollar.js b/browser/devtools/webconsole/test/browser_webconsole_bug_621644_jsterm_dollar.js
deleted file mode 100644
index 03b362057..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_621644_jsterm_dollar.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Sucan <mihai.sucan@gmail.com>
- */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html";
-
-function test$(HUD) {
- HUD.jsterm.clearOutput();
-
- HUD.jsterm.setInputValue("$(document.body)");
- HUD.jsterm.execute();
-
- waitForSuccess({
- name: "jsterm output for $()",
- validatorFn: function()
- {
- return HUD.outputNode.querySelector(".webconsole-msg-output:last-child");
- },
- successFn: function()
- {
- let outputItem = HUD.outputNode.
- querySelector(".webconsole-msg-output:last-child");
- ok(outputItem.textContent.indexOf("<p>") > -1,
- "jsterm output is correct for $()");
-
- test$$(HUD);
- },
- failureFn: test$$.bind(null, HUD),
- });
-}
-
-function test$$(HUD) {
- HUD.jsterm.clearOutput();
-
- HUD.jsterm.setInputValue("$$(document)");
- HUD.jsterm.execute();
-
- waitForSuccess({
- name: "jsterm output for $$()",
- validatorFn: function()
- {
- return HUD.outputNode.querySelector(".webconsole-msg-output:last-child");
- },
- successFn: function()
- {
- let outputItem = HUD.outputNode.
- querySelector(".webconsole-msg-output:last-child");
- ok(outputItem.textContent.indexOf("621644") > -1,
- "jsterm output is correct for $$()");
-
- executeSoon(finishTest);
- },
- failureFn: finishTest,
- });
-}
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, test$);
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_622303_persistent_filters.js b/browser/devtools/webconsole/test/browser_webconsole_bug_622303_persistent_filters.js
deleted file mode 100644
index 0aa95af84..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_622303_persistent_filters.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-let prefs = {
- "net": [
- "network",
- "networkinfo"
- ],
- "css": [
- "csserror",
- "cssparser"
- ],
- "js": [
- "exception",
- "jswarn",
- "jslog",
- ],
- "logging": [
- "error",
- "warn",
- "info",
- "log"
- ]
-};
-
-function test() {
- // Set all prefs to true
- for (let category in prefs) {
- prefs[category].forEach(function(pref) {
- Services.prefs.setBoolPref("devtools.webconsole.filter." + pref, true);
- });
- }
-
- addTab("about:blank");
- openConsole(null, onConsoleOpen);
-}
-
-function onConsoleOpen(hud) {
- let hudBox = hud.ui.rootElement;
-
- // Check if the filters menuitems exists and are checked
- for (let category in prefs) {
- let button = hudBox.querySelector(".webconsole-filter-button[category=\""
- + category + "\"]");
- ok(isChecked(button), "main button for " + category + " category is checked");
-
- prefs[category].forEach(function(pref) {
- let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
- ok(isChecked(menuitem), "menuitem for " + pref + " is checked");
- });
- }
-
- // Set all prefs to false
- for (let category in prefs) {
- prefs[category].forEach(function(pref) {
- hud.setFilterState(pref, false);
- });
- }
-
- //Re-init the console
- closeConsole(null, function() {
- openConsole(null, onConsoleReopen1);
- });
-}
-
-function onConsoleReopen1(hud) {
- let hudBox = hud.ui.rootElement;
-
- // Check if the filter button and menuitems are unchecked
- for (let category in prefs) {
- let button = hudBox.querySelector(".webconsole-filter-button[category=\""
- + category + "\"]");
- ok(isUnchecked(button), "main button for " + category + " category is not checked");
-
- prefs[category].forEach(function(pref) {
- let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
- ok(isUnchecked(menuitem), "menuitem for " + pref + " is not checked");
- });
- }
-
- // Set first pref in each category to true
- for (let category in prefs) {
- hud.setFilterState(prefs[category][0], true);
- }
-
- // Re-init the console
- closeConsole(null, function() {
- openConsole(null, onConsoleReopen2);
- });
-}
-
-function onConsoleReopen2(hud) {
- let hudBox = hud.ui.rootElement;
-
- // Check the main category button is checked and first menuitem is checked
- for (let category in prefs) {
- let button = hudBox.querySelector(".webconsole-filter-button[category=\""
- + category + "\"]");
- ok(isChecked(button), category + " button is checked when first pref is true");
-
- let pref = prefs[category][0];
- let menuitem = hudBox.querySelector("menuitem[prefKey=" + pref + "]");
- ok(isChecked(menuitem), "first " + category + " menuitem is checked");
- }
-
- // Clear prefs
- for (let category in prefs) {
- prefs[category].forEach(function(pref) {
- Services.prefs.clearUserPref("devtools.webconsole.filter." + pref);
- });
- }
-
- prefs = null;
- finishTest();
-}
-
-function isChecked(aNode) {
- return aNode.getAttribute("checked") === "true";
-}
-
-function isUnchecked(aNode) {
- return aNode.getAttribute("checked") === "false";
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_623749_ctrl_a_select_all_winnt.js b/browser/devtools/webconsole/test/browser_webconsole_bug_623749_ctrl_a_select_all_winnt.js
deleted file mode 100644
index 6e93ce523..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_623749_ctrl_a_select_all_winnt.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Test for https://bugzilla.mozilla.org/show_bug.cgi?id=623749
-// Map Control + A to Select All, In the web console input, on Windows
-
-function test() {
- addTab("data:text/html;charset=utf-8,Test console for bug 623749");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, runTest);
- }, true);
-}
-
-function runTest(HUD) {
- let jsterm = HUD.jsterm;
- jsterm.setInputValue("Ignore These Four Words");
- let inputNode = jsterm.inputNode;
-
- // Test select all with Control + A.
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- let inputLength = inputNode.selectionEnd - inputNode.selectionStart;
- is(inputLength, inputNode.value.length, "Select all of input");
-
- // Test do nothing on Control + E.
- jsterm.setInputValue("Ignore These Four Words");
- inputNode.selectionStart = 0;
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "Control + E does not move to end of input");
-
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_626484_output_copy_order.js b/browser/devtools/webconsole/test/browser_webconsole_bug_626484_output_copy_order.js
deleted file mode 100644
index 5b5193922..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_626484_output_copy_order.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-let itemsSet, HUD, outputNode;
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 626484");
- browser.addEventListener("load", function tabLoaded(aEvent) {
- browser.removeEventListener(aEvent.type, tabLoaded, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-
-function consoleOpened(aHud) {
- HUD = aHud;
- outputNode = HUD.outputNode;
- HUD.jsterm.clearOutput();
-
- let console = content.wrappedJSObject.console;
- console.log("The first line.");
- console.log("The second line.");
- console.log("The last line.");
- itemsSet = [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1],
- [2, 1, 0]];
-
- waitForSuccess({
- name: "console.log messages displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-log").length == 3;
- },
- successFn: nextTest,
- failureFn: finishTest,
- });
-}
-
-function nextTest() {
- if (itemsSet.length === 0) {
- outputNode.clearSelection();
- HUD.jsterm.clearOutput();
- HUD = outputNode = null;
- executeSoon(finishTest);
- }
- else {
- outputNode.clearSelection();
- let items = itemsSet.shift();
- items.forEach(function (index) {
- outputNode.addItemToSelection(outputNode.getItemAtIndex(index));
- });
- outputNode.focus();
- waitForClipboard(getExpectedClipboardText(items.length),
- clipboardSetup, nextTest, nextTest);
- }
-}
-
-function getExpectedClipboardText(aItemCount) {
- let expectedClipboardText = [];
- for (let i = 0; i < aItemCount; i++) {
- let item = outputNode.getItemAtIndex(i);
- expectedClipboardText.push("[" +
- WCU_l10n.timestampString(item.timestamp) + "] " +
- item.clipboardText);
- }
- return expectedClipboardText.join("\n");
-}
-
-function clipboardSetup() {
- goDoCommand("cmd_copy");
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js b/browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
deleted file mode 100644
index 73870efab..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_630733_response_redirect_headers.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Mihai Sucan <mihai.sucan@gmail.com>
- */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs";
-
-let lastFinishedRequests = {};
-let webConsoleClient;
-
-function requestDoneCallback(aHttpRequest )
-{
- let status = aHttpRequest.response.status;
- lastFinishedRequests[status] = aHttpRequest;
-}
-
-function consoleOpened(hud)
-{
- webConsoleClient = hud.ui.webConsoleClient;
- hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
- ok(hud.ui._saveRequestAndResponseBodies,
- "The saveRequestAndResponseBodies property was successfully set.");
-
- HUDService.lastFinishedRequestCallback = requestDoneCallback;
- waitForSuccess(waitForResponses);
- content.location = TEST_URI;
- });
-
- let waitForResponses = {
- name: "301 and 404 responses",
- validatorFn: function()
- {
- return "301" in lastFinishedRequests &&
- "404" in lastFinishedRequests;
- },
- successFn: getHeaders,
- failureFn: finishTest,
- };
-}
-
-function getHeaders()
-{
- HUDService.lastFinishedRequestCallback = null;
-
- ok("301" in lastFinishedRequests, "request 1: 301 Moved Permanently");
- ok("404" in lastFinishedRequests, "request 2: 404 Not found");
-
- webConsoleClient.getResponseHeaders(lastFinishedRequests["301"].actor,
- function (aResponse) {
- lastFinishedRequests["301"].response.headers = aResponse.headers;
-
- webConsoleClient.getResponseHeaders(lastFinishedRequests["404"].actor,
- function (aResponse) {
- lastFinishedRequests["404"].response.headers = aResponse.headers;
- executeSoon(getContent);
- });
- });
-}
-
-function getContent()
-{
- webConsoleClient.getResponseContent(lastFinishedRequests["301"].actor,
- function (aResponse) {
- lastFinishedRequests["301"].response.content = aResponse.content;
- lastFinishedRequests["301"].discardResponseBody = aResponse.contentDiscarded;
-
- webConsoleClient.getResponseContent(lastFinishedRequests["404"].actor,
- function (aResponse) {
- lastFinishedRequests["404"].response.content = aResponse.content;
- lastFinishedRequests["404"].discardResponseBody =
- aResponse.contentDiscarded;
-
- webConsoleClient = null;
- executeSoon(performTest);
- });
- });
-}
-
-function performTest()
-{
- function readHeader(aName)
- {
- for (let header of headers) {
- if (header.name == aName) {
- return header.value;
- }
- }
- return null;
- }
-
- let headers = lastFinishedRequests["301"].response.headers;
- is(readHeader("Content-Type"), "text/html",
- "we do have the Content-Type header");
- is(readHeader("Content-Length"), 71, "Content-Length is correct");
- is(readHeader("Location"), "/redirect-from-bug-630733",
- "Content-Length is correct");
- is(readHeader("x-foobar-bug630733"), "bazbaz",
- "X-Foobar-bug630733 is correct");
-
- let body = lastFinishedRequests["301"].response.content;
- ok(!body.text, "body discarded for request 1");
- ok(lastFinishedRequests["301"].discardResponseBody,
- "body discarded for request 1 (confirmed)");
-
- headers = lastFinishedRequests["404"].response.headers;
- ok(!readHeader("Location"), "no Location header");
- ok(!readHeader("x-foobar-bug630733"), "no X-Foobar-bug630733 header");
-
- body = lastFinishedRequests["404"].response.content.text;
- isnot(body.indexOf("404"), -1,
- "body is correct for request 2");
-
- lastFinishedRequests = null;
- executeSoon(finishTest);
-}
-
-function test()
-{
- addTab("data:text/html;charset=utf-8,<p>Web Console test for bug 630733");
-
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_632275_getters_document_width.js b/browser/devtools/webconsole/test/browser_webconsole_bug_632275_getters_document_width.js
deleted file mode 100644
index 322eabd18..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_632275_getters_document_width.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632275-getters.html";
-
-let getterValue = null;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- let doc = content.wrappedJSObject.document;
- getterValue = doc.foobar._val;
- hud.jsterm.execute("console.dir(document)");
-
- let onOpen = onViewOpened.bind(null, hud);
- hud.jsterm.once("variablesview-fetched", onOpen);
-}
-
-function onViewOpened(hud, event, view)
-{
- let doc = content.wrappedJSObject.document;
-
- findVariableViewProperties(view, [
- { name: /^(width|height)$/, dontMatch: 1 },
- { name: "foobar._val", value: getterValue },
- { name: "foobar.val", isGetter: true },
- ], { webconsole: hud }).then(function() {
- is(doc.foobar._val, getterValue, "getter did not execute");
- is(doc.foobar.val, getterValue+1, "getter executed");
- is(doc.foobar._val, getterValue+1, "getter executed (recheck)");
-
- let textContent = hud.outputNode.textContent;
- is(textContent.indexOf("document.body.client"), -1,
- "no document.width/height warning displayed");
-
- finishTest();
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_632347_iterators_generators.js b/browser/devtools/webconsole/test/browser_webconsole_bug_632347_iterators_generators.js
deleted file mode 100644
index b14470aa7..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_632347_iterators_generators.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(HUD) {
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm", tmp);
- let WCU = tmp.WebConsoleUtils;
- let JSPropertyProvider = tmp.JSPropertyProvider;
- tmp = null;
-
- let jsterm = HUD.jsterm;
- let win = content.wrappedJSObject;
-
- // Make sure autocomplete does not walk through iterators and generators.
- let result = win.gen1.next();
- let completion = JSPropertyProvider(win, "gen1.");
- is(completion, null, "no matches for gen1");
-
- is(result+1, win.gen1.next(), "gen1.next() did not execute");
-
- result = win.gen2.next();
-
- completion = JSPropertyProvider(win, "gen2.");
- is(completion, null, "no matches for gen2");
-
- is((result/2+1)*2, win.gen2.next(),
- "gen2.next() did not execute");
-
- result = win.iter1.next();
- is(result[0], "foo", "iter1.next() [0] is correct");
- is(result[1], "bar", "iter1.next() [1] is correct");
-
- completion = JSPropertyProvider(win, "iter1.");
- is(completion, null, "no matches for iter1");
-
- result = win.iter1.next();
- is(result[0], "baz", "iter1.next() [0] is correct");
- is(result[1], "baaz", "iter1.next() [1] is correct");
-
- completion = JSPropertyProvider(content, "iter2.");
- is(completion, null, "no matches for iter2");
-
- completion = JSPropertyProvider(win, "window.");
- ok(completion, "matches available for window");
- ok(completion.matches.length, "matches available for window (length)");
-
- jsterm.clearOutput();
-
- jsterm.execute("window");
-
- waitForSuccess({
- name: "jsterm window object output",
- validatorFn: function()
- {
- return HUD.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- jsterm.once("variablesview-fetched", testVariablesView.bind(null, HUD));
- let node = HUD.outputNode.querySelector(".webconsole-msg-output");
- EventUtils.synthesizeMouse(node, 2, 2, {}, HUD.iframeWindow);
- },
- failureFn: finishTest,
- });
-}
-
-function testVariablesView(aWebconsole, aEvent, aView) {
- findVariableViewProperties(aView, [
- { name: "gen1", isGenerator: true },
- { name: "gen2", isGenerator: true },
- { name: "iter1", isIterator: true },
- { name: "iter2", isIterator: true },
- ], { webconsole: aWebconsole }).then(function() {
- executeSoon(finishTest);
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_632817.js b/browser/devtools/webconsole/test/browser_webconsole_bug_632817.js
deleted file mode 100644
index e8b20cde7..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_632817.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that network log messages bring up the network panel.
-
-const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html";
-
-const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
-
-const TEST_DATA_JSON_CONTENT =
- '{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] }';
-
-let lastRequest = null;
-let requestCallback = null;
-
-function test()
-{
- const PREF = "devtools.webconsole.persistlog";
- Services.prefs.setBoolPref(PREF, true);
- registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
-
- addTab("data:text/html;charset=utf-8,Web Console network logging tests");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(aHud) {
- hud = aHud;
-
- HUDService.lastFinishedRequestCallback = function(aRequest) {
- lastRequest = aRequest;
- if (requestCallback) {
- requestCallback();
- }
- };
-
- executeSoon(testPageLoad);
- });
- }, true);
-}
-
-function testPageLoad()
-{
- requestCallback = function() {
- // Check if page load was logged correctly.
- ok(lastRequest, "Page load was logged");
- is(lastRequest.request.url, TEST_NETWORK_REQUEST_URI,
- "Logged network entry is page load");
- is(lastRequest.request.method, "GET", "Method is correct");
- lastRequest = null;
- requestCallback = null;
- executeSoon(testPageLoadBody);
- };
-
- content.location = TEST_NETWORK_REQUEST_URI;
-}
-
-function testPageLoadBody()
-{
- let loaded = false;
- let requestCallbackInvoked = false;
-
- // Turn off logging of request bodies and check again.
- requestCallback = function() {
- ok(lastRequest, "Page load was logged again");
- lastRequest = null;
- requestCallback = null;
- requestCallbackInvoked = true;
-
- if (loaded) {
- executeSoon(testXhrGet);
- }
- };
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- loaded = true;
-
- if (requestCallbackInvoked) {
- executeSoon(testXhrGet);
- }
- }, true);
-
- content.location.reload();
-}
-
-function testXhrGet()
-{
- requestCallback = function() {
- ok(lastRequest, "testXhrGet() was logged");
- is(lastRequest.request.method, "GET", "Method is correct");
- lastRequest = null;
- requestCallback = null;
- executeSoon(testXhrPost);
- };
-
- // Start the XMLHttpRequest() GET test.
- content.wrappedJSObject.testXhrGet();
-}
-
-function testXhrPost()
-{
- requestCallback = function() {
- ok(lastRequest, "testXhrPost() was logged");
- is(lastRequest.request.method, "POST", "Method is correct");
- lastRequest = null;
- requestCallback = null;
- executeSoon(testFormSubmission);
- };
-
- // Start the XMLHttpRequest() POST test.
- content.wrappedJSObject.testXhrPost();
-}
-
-function testFormSubmission()
-{
- // Start the form submission test. As the form is submitted, the page is
- // loaded again. Bind to the load event to catch when this is done.
- requestCallback = function() {
- ok(lastRequest, "testFormSubmission() was logged");
- is(lastRequest.request.method, "POST", "Method is correct");
-
- // There should be 3 network requests pointing to the HTML file.
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test-network-request.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- count: 3,
- }],
- }).then(testLiveFilteringOnSearchStrings);
- };
-
- let form = content.document.querySelector("form");
- ok(form, "we have the HTML form");
- form.submit();
-}
-
-function testLiveFilteringOnSearchStrings() {
- setStringFilter("http");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is set to \"http\"");
-
- setStringFilter("HTTP");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is set to \"HTTP\"");
-
- setStringFilter("hxxp");
- is(countMessageNodes(), 0, "the log nodes are hidden when the search " +
- "string is set to \"hxxp\"");
-
- setStringFilter("ht tp");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is set to \"ht tp\"");
-
- setStringFilter("");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is removed");
-
- setStringFilter("json");
- is(countMessageNodes(), 2, "the log nodes show only the nodes with \"json\"");
-
- setStringFilter("'foo'");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- "the string 'foo'");
-
- setStringFilter("foo\"bar'baz\"boo'");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- "the string \"foo\"bar'baz\"boo'\"");
-
- HUDService.lastFinishedRequestCallback = null;
- lastRequest = null;
- requestCallback = null;
- finishTest();
-}
-
-function countMessageNodes() {
- let messageNodes = hud.outputNode.querySelectorAll(".hud-msg-node");
- let displayedMessageNodes = 0;
- let view = hud.iframeWindow;
- for (let i = 0; i < messageNodes.length; i++) {
- let computedStyle = view.getComputedStyle(messageNodes[i], null);
- if (computedStyle.display !== "none")
- displayedMessageNodes++;
- }
-
- return displayedMessageNodes;
-}
-
-function setStringFilter(aValue)
-{
- hud.ui.filterBox.value = aValue;
- hud.ui.adjustVisibilityOnSearchStringChange();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_642108_pruneTest.js b/browser/devtools/webconsole/test/browser_webconsole_bug_642108_pruneTest.js
deleted file mode 100644
index af54ee7bf..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_642108_pruneTest.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console limits the number of lines displayed according to
-// the user's preferences.
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642108.";
-const LOG_LIMIT = 20;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad(){
- browser.removeEventListener("load", onLoad, false);
-
- Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", LOG_LIMIT);
-
- registerCleanupFunction(function() {
- Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
- });
-
- openConsole(null, testCSSPruning);
- }, true);
-}
-
-function populateConsoleRepeats(aHudRef) {
- for (let i = 0; i < 5; i++) {
- let node = aHudRef.ui.createMessageNode(CATEGORY_CSS, SEVERITY_WARNING,
- "css log x");
- aHudRef.ui.outputMessage(CATEGORY_CSS, node);
- }
-}
-
-function populateConsole(aHudRef) {
- for (let i = 0; i < LOG_LIMIT + 5; i++) {
- let node = aHudRef.ui.createMessageNode(CATEGORY_CSS, SEVERITY_WARNING,
- "css log " + i);
- aHudRef.ui.outputMessage(CATEGORY_CSS, node);
- }
-}
-
-function testCSSPruning(hudRef) {
- populateConsoleRepeats(hudRef);
-
- let waitForNoRepeatedNodes = {
- name: "number of nodes is LOG_LIMIT",
- validatorFn: function()
- {
- return countMessageNodes() == LOG_LIMIT;
- },
- successFn: function()
- {
- is(Object.keys(hudRef.ui._repeatNodes).length, LOG_LIMIT,
- "repeated nodes pruned from repeatNodes");
-
- let msg = hudRef.outputNode.querySelector(".webconsole-msg-cssparser " +
- ".webconsole-msg-repeat");
- is(msg.getAttribute("value"), 1,
- "repeated nodes pruned from repeatNodes (confirmed)");
-
- finishTest();
- },
- failureFn: finishTest,
- };
-
- waitForSuccess({
- name: "repeated nodes in cssNodes",
- validatorFn: function()
- {
- let msg = hudRef.outputNode.querySelector(".webconsole-msg-cssparser " +
- ".webconsole-msg-repeat");
- return msg && msg.getAttribute("value") == 5;
- },
- successFn: function()
- {
- populateConsole(hudRef);
- waitForSuccess(waitForNoRepeatedNodes);
- },
- failureFn: finishTest,
- });
-}
-
-function countMessageNodes() {
- let outputNode = HUDService.getHudByWindow(content).outputNode;
- return outputNode.querySelectorAll(".hud-msg-node").length;
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_642615_autocomplete.js b/browser/devtools/webconsole/test/browser_webconsole_bug_642615_autocomplete.js
deleted file mode 100644
index 1db6ab68f..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_642615_autocomplete.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642615";
-
-XPCOMUtils.defineLazyServiceGetter(this, "clipboardHelper",
- "@mozilla.org/widget/clipboardhelper;1",
- "nsIClipboardHelper");
-
-function consoleOpened(HUD) {
- let jsterm = HUD.jsterm;
- let stringToCopy = "foobazbarBug642615";
-
- jsterm.clearOutput();
-
- ok(!jsterm.completeNode.value, "no completeNode.value");
-
- jsterm.setInputValue("doc");
-
- let completionValue;
-
- // wait for key "u"
- function onCompletionValue() {
- completionValue = jsterm.completeNode.value;
-
- // Arguments: expected, setup, success, failure.
- waitForClipboard(
- stringToCopy,
- function() {
- clipboardHelper.copyString(stringToCopy, document);
- },
- onClipboardCopy,
- finishTest);
- }
-
- function onClipboardCopy() {
- updateEditUIVisibility();
- goDoCommand("cmd_paste");
-
- waitForSuccess(waitForPaste);
- }
-
- let waitForPaste = {
- name: "no completion value after paste",
- validatorFn: function()
- {
- return !jsterm.completeNode.value;
- },
- successFn: onClipboardPaste,
- failureFn: finishTest,
- };
-
- function onClipboardPaste() {
- goDoCommand("cmd_undo");
- waitForSuccess({
- name: "completion value for 'docu' after undo",
- validatorFn: function()
- {
- return !!jsterm.completeNode.value;
- },
- successFn: onCompletionValueAfterUndo,
- failureFn: finishTest,
- });
- }
-
- function onCompletionValueAfterUndo() {
- is(jsterm.completeNode.value, completionValue,
- "same completeNode.value after undo");
-
- EventUtils.synthesizeKey("v", {accelKey: true});
- waitForSuccess({
- name: "no completion after ctrl-v (paste)",
- validatorFn: function()
- {
- return !jsterm.completeNode.value;
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
- }
-
- EventUtils.synthesizeKey("u", {});
-
- waitForSuccess({
- name: "completion value for 'docu'",
- validatorFn: function()
- {
- return !!jsterm.completeNode.value;
- },
- successFn: onCompletionValue,
- failureFn: finishTest,
- });
-}
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_644419_log_limits.js b/browser/devtools/webconsole/test/browser_webconsole_bug_644419_log_limits.js
deleted file mode 100644
index d72a61611..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_644419_log_limits.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that the Web Console limits the number of lines displayed according to
-// the limit set for each category.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/" +
- "webconsole/test/test-bug-644419-log-limits.html";
-
-let hud, outputNode;
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 644419: Console should " +
- "have user-settable log limits for each message category");
- browser.addEventListener("load", onLoad, true);
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
-
- openConsole(null, function(aHud) {
- aHud.jsterm.clearOutput();
- hud = aHud;
- outputNode = aHud.outputNode;
-
- browser.addEventListener("load", testWebDevLimits, true);
- expectUncaughtException();
- content.location = TEST_URI;
- });
-}
-
-function testWebDevLimits(aEvent) {
- browser.removeEventListener(aEvent.type, testWebDevLimits, true);
- Services.prefs.setIntPref("devtools.hud.loglimit.console", 10);
-
- // Find the sentinel entry.
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "bar is not defined",
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- }],
- }).then(testWebDevLimits2);
-}
-
-function testWebDevLimits2() {
- // Fill the log with Web Developer errors.
- for (let i = 0; i < 11; i++) {
- content.console.log("test message " + i);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test message 10",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(() => {
- testLogEntry(outputNode, "test message 0", "first message is pruned", false, true);
- findLogEntry("test message 1");
- // Check if the sentinel entry is still there.
- findLogEntry("bar is not defined");
-
- Services.prefs.clearUserPref("devtools.hud.loglimit.console");
- testJsLimits();
- });
-}
-
-function testJsLimits() {
- Services.prefs.setIntPref("devtools.hud.loglimit.exception", 10);
-
- hud.jsterm.clearOutput();
- content.console.log("testing JS limits");
-
- // Find the sentinel entry.
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "testing JS limits",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(testJsLimits2);
-}
-
-function testJsLimits2() {
- // Fill the log with JS errors.
- let head = content.document.getElementsByTagName("head")[0];
- for (let i = 0; i < 11; i++) {
- var script = content.document.createElement("script");
- script.text = "fubar" + i + ".bogus(6);";
- expectUncaughtException();
- head.insertBefore(script, head.firstChild);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "fubar10 is not defined",
- category: CATEGORY_JS,
- severity: SEVERITY_ERROR,
- }],
- }).then(() => {
- testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned", false, true);
- findLogEntry("fubar1 is not defined");
- // Check if the sentinel entry is still there.
- findLogEntry("testing JS limits");
-
- Services.prefs.clearUserPref("devtools.hud.loglimit.exception");
- testNetLimits();
- });
-}
-
-var gCounter, gImage;
-
-function testNetLimits() {
- Services.prefs.setIntPref("devtools.hud.loglimit.network", 10);
-
- hud.jsterm.clearOutput();
- content.console.log("testing Net limits");
-
- // Find the sentinel entry.
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "testing Net limits",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(() => {
- // Fill the log with network messages.
- gCounter = 0;
- loadImage();
- });
-}
-
-function loadImage() {
- if (gCounter < 11) {
- let body = content.document.getElementsByTagName("body")[0];
- gImage && gImage.removeEventListener("load", loadImage, true);
- gImage = content.document.createElement("img");
- gImage.src = "test-image.png?_fubar=" + gCounter;
- body.insertBefore(gImage, body.firstChild);
- gImage.addEventListener("load", loadImage, true);
- gCounter++;
- return;
- }
-
- is(gCounter, 11, "loaded 11 files");
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "test-image.png?_fubar=10",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- }],
- }).then(() => {
- testLogEntry(outputNode, "test-image.png?_fubar=0", "first message is pruned", false, true);
- findLogEntry("test-image.png?_fubar=1");
- // Check if the sentinel entry is still there.
- findLogEntry("testing Net limits");
-
- Services.prefs.clearUserPref("devtools.hud.loglimit.network");
- testCssLimits();
- });
-}
-
-function testCssLimits() {
- Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", 10);
-
- hud.jsterm.clearOutput();
- content.console.log("testing CSS limits");
-
- // Find the sentinel entry.
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "testing CSS limits",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(testCssLimits2);
-}
-
-function testCssLimits2() {
- // Fill the log with CSS errors.
- let body = content.document.getElementsByTagName("body")[0];
- for (let i = 0; i < 11; i++) {
- var div = content.document.createElement("div");
- div.setAttribute("style", "-moz-foobar" + i + ": 42;");
- body.insertBefore(div, body.firstChild);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "-moz-foobar10",
- category: CATEGORY_CSS,
- severity: SEVERITY_WARNING,
- }],
- }).then(() => {
- testLogEntry(outputNode, "Unknown property '-moz-foobar0'",
- "first message is pruned", false, true);
- findLogEntry("Unknown property '-moz-foobar1'");
- // Check if the sentinel entry is still there.
- findLogEntry("testing CSS limits");
-
- Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
- finishTest();
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_646025_console_file_location.js b/browser/devtools/webconsole/test/browser_webconsole_bug_646025_console_file_location.js
deleted file mode 100644
index aeca2751a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_646025_console_file_location.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that console logging methods display the method location along with
-// the output in the console.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/" +
- "webconsole/test/" +
- "test-bug-646025-console-file-location.html";
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console file location display test");
- browser.addEventListener("load", onLoad, true);
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, function(hud) {
- content.location = TEST_URI;
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "message for level log",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- source: { url: "test-file-location.js", line: 5 },
- },
- {
- text: "message for level info",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_INFO,
- source: { url: "test-file-location.js", line: 6 },
- },
- {
- text: "message for level warn",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_WARNING,
- source: { url: "test-file-location.js", line: 7 },
- },
- {
- text: "message for level error",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_ERROR,
- source: { url: "test-file-location.js", line: 8 },
- },
- {
- text: "message for level debug",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- source: { url: "test-file-location.js", line: 9 },
- }],
- }).then(finishTest);
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_651501_document_body_autocomplete.js b/browser/devtools/webconsole/test/browser_webconsole_bug_651501_document_body_autocomplete.js
deleted file mode 100644
index 6b2152637..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_651501_document_body_autocomplete.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that document.body autocompletes in the web console.
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console autocompletion bug in document.body");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-let gHUD;
-
-function consoleOpened(aHud) {
- gHUD = aHud;
- let jsterm = gHUD.jsterm;
- let popup = jsterm.autocompletePopup;
- let completeNode = jsterm.completeNode;
-
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm", tmp);
- let WCU = tmp.WebConsoleUtils;
- tmp = null;
-
- ok(!popup.isOpen, "popup is not open");
-
- popup._panel.addEventListener("popupshown", function onShown() {
- popup._panel.removeEventListener("popupshown", onShown, false);
-
- ok(popup.isOpen, "popup is open");
-
- // expected properties:
- // __defineGetter__ __defineSetter__ __lookupGetter__ __lookupSetter__
- // constructor hasOwnProperty isPrototypeOf propertyIsEnumerable
- // toLocaleString toSource toString unwatch valueOf watch.
- ok(popup.itemCount >= 14, "popup.itemCount is correct");
-
- popup._panel.addEventListener("popuphidden", autocompletePopupHidden, false);
-
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- }, false);
-
- jsterm.setInputValue("document.body");
- EventUtils.synthesizeKey(".", {});
-}
-
-function autocompletePopupHidden()
-{
- let jsterm = gHUD.jsterm;
- let popup = jsterm.autocompletePopup;
- let completeNode = jsterm.completeNode;
- let inputNode = jsterm.inputNode;
-
- popup._panel.removeEventListener("popuphidden", autocompletePopupHidden, false);
-
- ok(!popup.isOpen, "popup is not open");
- let inputStr = "document.b";
- jsterm.setInputValue(inputStr);
- EventUtils.synthesizeKey("o", {});
- let testStr = inputStr.replace(/./g, " ") + " ";
-
- waitForSuccess({
- name: "autocomplete shows document.body",
- validatorFn: function()
- {
- return completeNode.value == testStr + "dy";
- },
- successFn: testPropertyPanel,
- failureFn: finishTest,
- });
-}
-
-function testPropertyPanel()
-{
- let jsterm = gHUD.jsterm;
- jsterm.clearOutput();
- jsterm.execute("document");
-
- waitForSuccess({
- name: "jsterm document object output",
- validatorFn: function()
- {
- return gHUD.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- jsterm.once("variablesview-fetched", onVariablesViewReady);
- let node = gHUD.outputNode.querySelector(".webconsole-msg-output");
- EventUtils.synthesizeMouse(node, 2, 2, {}, gHUD.iframeWindow);
- },
- failureFn: finishTest,
- });
-}
-
-function onVariablesViewReady(aEvent, aView)
-{
- findVariableViewProperties(aView, [
- { name: "body", value: "[object HTMLBodyElement]" },
- ], { webconsole: gHUD }).then(finishTest);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js b/browser/devtools/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
deleted file mode 100644
index c95163e6b..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_653531_highlighter_console_helper.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the $0 console helper works as intended.
-
-function createDocument()
-{
- let doc = content.document;
- let div = doc.createElement("div");
- let h1 = doc.createElement("h1");
- let p1 = doc.createElement("p");
- let p2 = doc.createElement("p");
- let div2 = doc.createElement("div");
- let p3 = doc.createElement("p");
- doc.title = "Inspector Tree Selection Test";
- h1.textContent = "Inspector Tree Selection Test";
- p1.textContent = "This is some example text";
- p2.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
- "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
- "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
- "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
- "dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
- "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
- "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- p3.textContent = "Lorem ipsum dolor sit amet, consectetur adipisicing " +
- "elit, sed do eiusmod tempor incididunt ut labore et dolore magna " +
- "aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco " +
- "laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
- "dolor in reprehenderit in voluptate velit esse cillum dolore eu " +
- "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non " +
- "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
- div.appendChild(h1);
- div.appendChild(p1);
- div.appendChild(p2);
- div2.appendChild(p3);
- doc.body.appendChild(div);
- doc.body.appendChild(div2);
- setupHighlighterTests();
-}
-
-function setupHighlighterTests()
-{
- let h1 = content.document.querySelector("h1");
- ok(h1, "we have the header node");
-
- openInspector(runSelectionTests);
-}
-
-function runSelectionTests(aInspector)
-{
- aInspector.highlighter.unlockAndFocus();
- aInspector.highlighter.outline.setAttribute("disable-transitions", "true");
-
- executeSoon(function() {
- aInspector.selection.once("new-node", performTestComparisons);
- let h1 = content.document.querySelector("h1");
- EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
- });
-}
-
-function performTestComparisons()
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let inspector = gDevTools.getToolbox(target).getPanel("inspector");
- inspector.highlighter.lock();
-
- let isHighlighting =
- !(inspector.highlighter.outline.getAttribute("hidden") == "true");
-
- ok(isHighlighting, "inspector is highlighting");
-
- let h1 = content.document.querySelector("h1");
- is(inspector.selection.node, h1, "selection matches node");
-
- openConsole(gBrowser.selectedTab, performWebConsoleTests);
-}
-
-function performWebConsoleTests(hud)
-{
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let jsterm = hud.jsterm;
- outputNode = hud.outputNode;
-
- jsterm.clearOutput();
- jsterm.execute("$0");
-
- waitForSuccess({
- name: "$0 output",
- validatorFn: function()
- {
- return outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- let node = outputNode.querySelector(".webconsole-msg-output");
- isnot(node.textContent.indexOf("[object HTMLHeadingElement"), -1,
- "correct output for $0");
-
- jsterm.clearOutput();
- jsterm.execute("$0.textContent = 'bug653531'");
- waitForSuccess(waitForNodeUpdate);
- },
- failureFn: finishUp,
- });
-
- let waitForNodeUpdate = {
- name: "$0.textContent update",
- validatorFn: function()
- {
- return outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- let node = outputNode.querySelector(".webconsole-msg-output");
- isnot(node.textContent.indexOf("bug653531"), -1,
- "correct output for $0.textContent");
- let inspector = gDevTools.getToolbox(target).getPanel("inspector");
- is(inspector.selection.node.textContent, "bug653531",
- "node successfully updated");
-
- executeSoon(finishUp);
- },
- failureFn: finishUp,
- };
-}
-
-function finishUp() {
- finishTest();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
- gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html;charset=utf-8,test for highlighter helper in web console";
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js b/browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
deleted file mode 100644
index fac1f3896..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_658368_time_methods.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that the Console API implements the time() and timeEnd() methods.
-
-function test() {
- addTab("http://example.com/browser/browser/devtools/webconsole/" +
- "test/test-bug-658368-time-methods.html");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- outputNode = hud.outputNode;
-
- waitForSuccess({
- name: "aTimer started",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("aTimer: timer started") > -1;
- },
- successFn: function()
- {
- findLogEntry("ms");
- // The next test makes sure that timers with the same name but in separate
- // tabs, do not contain the same value.
- addTab("data:text/html;charset=utf-8,<script type='text/javascript'>" +
- "console.timeEnd('bTimer');</script>");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testTimerIndependenceInTabs);
- }, true);
- },
- failureFn: finishTest,
- });
-}
-
-function testTimerIndependenceInTabs(hud) {
- outputNode = hud.outputNode;
-
- executeSoon(function() {
- testLogEntry(outputNode, "bTimer: timer started", "bTimer was not started",
- false, true);
-
- // The next test makes sure that timers with the same name but in separate
- // pages, do not contain the same value.
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- executeSoon(testTimerIndependenceInSameTab);
- }, true);
- content.location = "data:text/html;charset=utf-8,<script type='text/javascript'>" +
- "console.time('bTimer');</script>";
- });
-}
-
-function testTimerIndependenceInSameTab() {
- let hudId = HUDService.getHudIdByWindow(content);
- let hud = HUDService.hudReferences[hudId];
- outputNode = hud.outputNode;
-
- waitForSuccess({
- name: "bTimer started",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bTimer: timer started") > -1;
- },
- successFn: function() {
- hud.jsterm.clearOutput();
-
- // Now the following console.timeEnd() call shouldn't display anything,
- // if the timers in different pages are not related.
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- executeSoon(testTimerIndependenceInSameTabAgain);
- }, true);
- content.location = "data:text/html;charset=utf-8," +
- "<script type='text/javascript'>" +
- "console.timeEnd('bTimer');</script>";
- },
- failureFn: finishTest,
- });
-}
-
-function testTimerIndependenceInSameTabAgain() {
- let hudId = HUDService.getHudIdByWindow(content);
- let hud = HUDService.hudReferences[hudId];
- outputNode = hud.outputNode;
-
- executeSoon(function() {
- testLogEntry(outputNode, "bTimer: timer started", "bTimer was not started",
- false, true);
-
- closeConsole(gBrowser.selectedTab, function() {
- gBrowser.removeCurrentTab();
- executeSoon(finishTest);
- });
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js b/browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js
deleted file mode 100644
index 50fc7ce77..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that console.dir works as intended.
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 659907: Expand console " +
- "object with a dir method");
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- hud.jsterm.execute("console.dir(document)");
- hud.jsterm.once("variablesview-fetched", testConsoleDir.bind(null, hud));
-}
-
-function testConsoleDir(hud, ev, view) {
- findVariableViewProperties(view, [
- { name: "__proto__.__proto__.querySelectorAll", value: "[object Function]" },
- { name: "location", value: "[object Location]" },
- { name: "__proto__.write", value: "[object Function]" },
- ], { webconsole: hud }).then(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_660806_history_nav.js b/browser/devtools/webconsole/test/browser_webconsole_bug_660806_history_nav.js
deleted file mode 100644
index ade0c0936..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_660806_history_nav.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>bug 660806 - history navigation must not show the autocomplete popup";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(HUD)
-{
- content.wrappedJSObject.foobarBug660806 = {
- "location": "value0",
- "locationbar": "value1",
- };
-
- let jsterm = HUD.jsterm;
- let popup = jsterm.autocompletePopup;
- let onShown = function() {
- ok(false, "popup shown");
- };
-
- popup._panel.addEventListener("popupshown", onShown, false);
-
- ok(!popup.isOpen, "popup is not open");
-
- ok(!jsterm.lastInputValue, "no lastInputValue");
- jsterm.setInputValue("window.foobarBug660806.location");
- is(jsterm.lastInputValue, "window.foobarBug660806.location",
- "lastInputValue is correct");
-
- EventUtils.synthesizeKey("VK_RETURN", {});
- EventUtils.synthesizeKey("VK_UP", {});
-
- is(jsterm.lastInputValue, "window.foobarBug660806.location",
- "lastInputValue is correct, again");
-
- executeSoon(function() {
- ok(!popup.isOpen, "popup is not open");
- popup._panel.removeEventListener("popupshown", onShown, false);
- executeSoon(finishTest);
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js b/browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js
deleted file mode 100644
index 7f8d568fc..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_664131_console_group.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests that console.group/groupEnd works as intended.
-const GROUP_INDENT = 12;
-
-let testDriver, hud;
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 664131: Expand console " +
- "object with group methods");
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, function(aHud) {
- hud = aHud;
- testDriver = testGen();
- testNext();
- });
- }, true);
-}
-
-function testNext() {
- testDriver.next();
-}
-
-function testGen() {
- outputNode = hud.outputNode;
-
- hud.jsterm.clearOutput();
-
- content.console.group("bug664131a");
-
- waitForSuccess({
- name: "console.group displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug664131a") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- let msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
- is(msg.length, 1, "one message node displayed");
- is(msg[0].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
-
- content.console.log("bug664131a-inside");
-
- waitForSuccess({
- name: "console.log message displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug664131a-inside") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
- is(msg.length, 2, "two message nodes displayed");
- is(msg[1].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
-
- content.console.groupEnd("bug664131a");
- content.console.log("bug664131-outside");
-
- waitForSuccess({
- name: "console.log message displayed after groupEnd()",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug664131-outside") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
- is(msg.length, 3, "three message nodes displayed");
- is(msg[2].style.marginLeft, "0px", "correct group indent found");
-
- content.console.groupCollapsed("bug664131b");
-
- waitForSuccess({
- name: "console.groupCollapsed displayed",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug664131b") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
- is(msg.length, 4, "four message nodes displayed");
- is(msg[3].style.marginLeft, GROUP_INDENT + "px", "correct group indent found");
-
-
- // Test that clearing the console removes the indentation.
- hud.jsterm.clearOutput();
- content.console.log("bug664131-cleared");
-
- waitForSuccess({
- name: "console.log displayed after clearOutput",
- validatorFn: function()
- {
- return outputNode.textContent.indexOf("bug664131-cleared") > -1;
- },
- successFn: testNext,
- failureFn: finishTest,
- });
-
- yield;
-
- msg = outputNode.querySelectorAll(".webconsole-msg-icon-container");
- is(msg.length, 1, "one message node displayed");
- is(msg[0].style.marginLeft, "0px", "correct group indent found");
-
- testDriver = hud = null;
- finishTest();
-
- yield;
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_704295.js b/browser/devtools/webconsole/test/browser_webconsole_bug_704295.js
deleted file mode 100644
index c85c52d13..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_704295.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests for bug 704295
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testCompletion);
- }, true);
-}
-
-function testCompletion(hud) {
- var jsterm = hud.jsterm;
- var input = jsterm.inputNode;
-
- // Test typing 'var d = 5;' and press RETURN
- jsterm.setInputValue("var d = ");
- EventUtils.synthesizeKey("5", {});
- EventUtils.synthesizeKey(";", {});
- is(input.value, "var d = 5;", "var d = 5;");
- is(jsterm.completeNode.value, "", "no completion");
- EventUtils.synthesizeKey("VK_ENTER", {});
- is(jsterm.completeNode.value, "", "clear completion on execute()");
-
- // Test typing 'var a = d' and press RETURN
- jsterm.setInputValue("var a = ");
- EventUtils.synthesizeKey("d", {});
- is(input.value, "var a = d", "var a = d");
- is(jsterm.completeNode.value, "", "no completion");
- EventUtils.synthesizeKey("VK_ENTER", {});
- is(jsterm.completeNode.value, "", "clear completion on execute()");
-
- jsterm = input = null;
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_734061_No_input_change_and_Tab_key_pressed.js b/browser/devtools/webconsole/test/browser_webconsole_bug_734061_No_input_change_and_Tab_key_pressed.js
deleted file mode 100644
index 6433e0f71..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_734061_No_input_change_and_Tab_key_pressed.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testInputChange);
- }, true);
-}
-
-function testInputChange(hud) {
- var jsterm = hud.jsterm;
- var input = jsterm.inputNode;
-
- is(input.getAttribute("focused"), "true", "input has focus");
- EventUtils.synthesizeKey("VK_TAB", {});
- is(input.getAttribute("focused"), "", "focus moved away");
-
- // Test user changed something
- input.focus();
- EventUtils.synthesizeKey("A", {});
- EventUtils.synthesizeKey("VK_TAB", {});
- is(input.getAttribute("focused"), "true", "input is still focused");
-
- // Test non empty input but not changed since last focus
- input.blur();
- input.focus();
- EventUtils.synthesizeKey("VK_RIGHT", {});
- EventUtils.synthesizeKey("VK_TAB", {});
- is(input.getAttribute("focused"), "", "input moved away");
-
- jsterm = input = null;
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js b/browser/devtools/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js
deleted file mode 100644
index 14c9714f3..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_737873_mixedcontent.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Tanvi Vyas <tanvi@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console Mixed Content messages are displayed
-
-const TEST_HTTPS_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html";
-
-var origBlockDisplay;
-var origBlockActive;
-
-function test() {
- addTab("data:text/html;charset=utf8,Web Console mixed content test");
- browser.addEventListener("load", onLoad, true);
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener("load", onLoad, true);
- origBlockDisplay = Services.prefs.getBoolPref("security.mixed_content.block_display_content");
- origBlockActive = Services.prefs.getBoolPref("security.mixed_content.block_active_content")
- Services.prefs.setBoolPref("security.mixed_content.block_display_content", false);
- Services.prefs.setBoolPref("security.mixed_content.block_active_content", false);
- openConsole(null, testMixedContent);
-}
-
-function testMixedContent(hud) {
- content.location = TEST_HTTPS_URI;
- var aOutputNode = hud.outputNode;
-
- waitForSuccess(
- {
- name: "mixed content warning displayed successfully",
- timeout: 20000,
- validatorFn: function() {
- return ( aOutputNode.querySelector(".webconsole-mixed-content") );
- },
-
- successFn: function() {
-
- //tests on the urlnode
- let node = aOutputNode.querySelector(".webconsole-mixed-content");
- ok(testSeverity(node), "Severity type is SEVERITY_WARNING.");
-
- //tests on the warningNode
- let warningNode = aOutputNode.querySelector(".webconsole-mixed-content-link");
- is(warningNode.value, "[Mixed Content]", "Message text is accurate." );
- testClickOpenNewTab(warningNode);
-
- endTest();
- },
-
- failureFn: endTest,
- }
- );
-
-}
-
-function testSeverity(node) {
- let linkNode = node.parentNode;
- let msgNode = linkNode.parentNode;
- let bodyNode = msgNode.parentNode;
- let finalNode = bodyNode.parentNode;
-
- return finalNode.classList.contains("webconsole-msg-warn");
-}
-
-function testClickOpenNewTab(warningNode) {
- /* Invoke the click event and check if a new tab would open to the correct page */
- let linkOpened = false;
- let oldOpenUILinkIn = window.openUILinkIn;
-
- window.openUILinkIn = function(aLink) {
- if (aLink == "https://developer.mozilla.org/en/Security/MixedContent") {
- linkOpened = true;
- }
- }
-
- EventUtils.synthesizeMouse(warningNode, 2, 2, {},
- warningNode.ownerDocument.defaultView);
-
- ok(linkOpened, "Clicking the Mixed Content Warning node opens the desired page");
-
- window.openUILinkIn = oldOpenUILinkIn;
-}
-
-function endTest() {
- Services.prefs.setBoolPref("security.mixed_content.block_display_content", origBlockDisplay);
- Services.prefs.setBoolPref("security.mixed_content.block_active_content", origBlockActive);
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_764572_output_open_url.js b/browser/devtools/webconsole/test/browser_webconsole_bug_764572_output_open_url.js
deleted file mode 100644
index a87066dd6..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_764572_output_open_url.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This is a test for the Open URL context menu item
-// that is shown for network requests
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"
-const COMMAND_NAME = "consoleCmd_openURL";
-const CONTEXT_MENU_ID = "#menu_openURL";
-
-let HUD = null, outputNode = null, contextMenu = null;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- HUD = aHud;
- outputNode = aHud.outputNode;
- contextMenu = HUD.iframeWindow.document.getElementById("output-contextmenu");
-
- registerCleanupFunction(() => {
- HUD = outputNode = contextMenu = null;
- });
-
- HUD.jsterm.clearOutput();
-
- content.console.log("bug 764572");
-
- waitForMessages({
- webconsole: HUD,
- messages: [{
- text: "bug 764572",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(onConsoleMessage);
-}
-
-function onConsoleMessage(aResults) {
- outputNode.focus();
- outputNode.selectedItem = [...aResults[0].matched][0];
-
- // Check if the command is disabled non-network messages.
- goUpdateCommand(COMMAND_NAME);
- let controller = top.document.commandDispatcher
- .getControllerForCommand(COMMAND_NAME);
-
- let isDisabled = !controller || !controller.isCommandEnabled(COMMAND_NAME);
- ok(isDisabled, COMMAND_NAME + " should be disabled.");
-
- waitForContextMenu(contextMenu, outputNode.selectedItem, () => {
- let isHidden = contextMenu.querySelector(CONTEXT_MENU_ID).hidden;
- ok(isHidden, CONTEXT_MENU_ID + " should be hidden.");
- }, testOnNetActivity);
-}
-
-function testOnNetActivity() {
- HUD.jsterm.clearOutput();
-
- // Reload the url to show net activity in console.
- content.location.reload();
-
- waitForMessages({
- webconsole: HUD,
- messages: [{
- text: "test-console.html",
- category: CATEGORY_NETWORK,
- severity: SEVERITY_LOG,
- }],
- }).then(onNetworkMessage);
-}
-
-function onNetworkMessage(aResults) {
- outputNode.focus();
- outputNode.selectedItem = [...aResults[0].matched][0];
-
- let currentTab = gBrowser.selectedTab;
- let newTab = null;
-
- gBrowser.tabContainer.addEventListener("TabOpen", function onOpen(aEvent) {
- gBrowser.tabContainer.removeEventListener("TabOpen", onOpen, true);
- newTab = aEvent.target;
- newTab.linkedBrowser.addEventListener("load", onTabLoaded, true);
- }, true);
-
- function onTabLoaded() {
- newTab.linkedBrowser.removeEventListener("load", onTabLoaded, true);
- gBrowser.removeTab(newTab);
- gBrowser.selectedTab = currentTab;
- executeSoon(testOnNetActivity_contextmenu);
- }
-
- // Check if the command is enabled for a network message.
- goUpdateCommand(COMMAND_NAME);
- let controller = top.document.commandDispatcher
- .getControllerForCommand(COMMAND_NAME);
- ok(controller.isCommandEnabled(COMMAND_NAME),
- COMMAND_NAME + " should be enabled.");
-
- // Try to open the URL.
- goDoCommand(COMMAND_NAME);
-}
-
-function testOnNetActivity_contextmenu() {
- let target = outputNode.querySelector(".webconsole-msg-network");
-
- outputNode.focus();
- outputNode.selectedItem = target;
-
- waitForContextMenu(contextMenu, target, () => {
- let isShown = !contextMenu.querySelector(CONTEXT_MENU_ID).hidden;
- ok(isShown, CONTEXT_MENU_ID + " should be shown.");
- }, finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js b/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js
deleted file mode 100644
index b60fb70bf..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_766001_JS_Console_in_Debugger.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test" +
- "/test-bug-766001-js-console-links.html";
-
-let nodes, dbg, toolbox, target, index = 0, src, line;
-
-function test()
-{
- expectUncaughtException();
- requestLongerTimeout(2);
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testViewSource);
- }, true);
-}
-
-function testViewSource(aHud)
-{
- registerCleanupFunction(function() {
- nodes = dbg = toolbox = target = index = src = line = null;
- });
-
- let JSSelector = ".webconsole-msg-exception .webconsole-location";
- let consoleSelector = ".webconsole-msg-console .webconsole-location";
-
- waitForSuccess({
- name: "find the location node",
- validatorFn: function()
- {
- return aHud.outputNode.querySelector(JSSelector) &&
- aHud.outputNode.querySelector(consoleSelector);
- },
- successFn: function()
- {
- nodes = [aHud.outputNode.querySelector(JSSelector),
- aHud.outputNode.querySelector(consoleSelector)];
-
- target = TargetFactory.forTab(gBrowser.selectedTab);
- toolbox = gDevTools.getToolbox(target);
- toolbox.once("jsdebugger-selected", checkLineAndClickNext);
-
- EventUtils.sendMouseEvent({ type: "click" }, nodes[index%2]);
- },
- failureFn: finishTest,
- });
-}
-
-function checkLineAndClickNext(aEvent, aPanel)
-{
- if (index == 3) {
- finishTest();
- return;
- }
- info(aEvent + " event fired for index " + index);
-
- dbg = aPanel;
-
- src = nodes[index%2].getAttribute("title");
- ok(src, "source url found for index " + index);
- line = nodes[index%2].sourceLine;
- ok(line, "found source line for index " + index);
-
- info("Waiting for the correct script to be selected for index " + index);
- dbg.panelWin.addEventListener("Debugger:SourceShown", onSource, false);
-}
-
-function onSource(aEvent) {
- if (aEvent.detail.url != src) {
- return;
- }
- dbg.panelWin.removeEventListener("Debugger:SourceShown", onSource, false);
-
- ok(true, "Correct script is selected for index " + index);
-
- checkCorrectLine(function() {
- gDevTools.showToolbox(target, "webconsole").then(function() {
- index++;
- info("webconsole selected for index " + index);
-
- toolbox.once("jsdebugger-selected", checkLineAndClickNext);
-
- EventUtils.sendMouseEvent({ type: "click" }, nodes[index%2]);
- });
- });
-}
-
-function checkCorrectLine(aCallback)
-{
- waitForSuccess({
- name: "correct source and line test for debugger for index " + index,
- validatorFn: function()
- {
- let debuggerView = dbg.panelWin.DebuggerView;
- if (debuggerView.editor &&
- debuggerView.editor.getCaretPosition().line == line - 1) {
- return true;
- }
- return false;
- },
- successFn: function()
- {
- aCallback && executeSoon(aCallback);
- },
- failureFn: finishTest,
- timeout: 10000,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.js b/browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.js
deleted file mode 100644
index cd9c0fcc8..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_770099_bad_policyuri.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console CSP messages are displayed
-
-const TEST_BAD_POLICY_URI = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html";
-
-let hud = undefined;
-
-function test() {
- addTab("data:text/html;charset=utf8,Web Console CSP bad policy URI test");
- browser.addEventListener("load", function _onLoad() {
- browser.removeEventListener("load", _onLoad, true);
- openConsole(null, loadDocument);
- }, true);
-}
-
-function loadDocument(theHud) {
- hud = theHud;
- hud.jsterm.clearOutput();
- browser.addEventListener("load", onLoad, true);
- content.location = TEST_BAD_POLICY_URI;
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener("load", onLoad, true);
- testPolicyURIMessage();
-}
-
-function testPolicyURIMessage() {
- let aOutputNode = hud.outputNode;
-
- waitForSuccess(
- {
- name: "CSP policy URI warning displayed successfully",
- validatorFn: function() {
- return aOutputNode.querySelector(".webconsole-msg-error");
- },
-
- successFn: function() {
- //tests on the urlnode
- let node = aOutputNode.querySelector(".webconsole-msg-error");
- isnot(node.textContent.indexOf("can't fetch policy"), -1,
- "CSP Policy URI message found");
- finishTest();
- },
-
- failureFn: finishTest,
- }
- );
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_770099_violation.js b/browser/devtools/webconsole/test/browser_webconsole_bug_770099_violation.js
deleted file mode 100644
index 893401be6..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_770099_violation.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that the Web Console CSP messages are displayed
-
-const TEST_VIOLATION = "https://example.com/browser/browser/devtools/webconsole/test/test_bug_770099_violation.html";
-const CSP_VIOLATION_MSG = "Content Security Policy: Directive default-src https://example.com:443 violated by http://some.example.com/test.png"
-
-let hud = undefined;
-
-function test() {
- addTab("data:text/html;charset=utf8,Web Console CSP violation test");
- browser.addEventListener("load", function _onLoad() {
- browser.removeEventListener("load", _onLoad, true);
- openConsole(null, loadDocument);
- }, true);
-}
-
-function loadDocument(theHud){
- hud = theHud;
- hud.jsterm.clearOutput()
- browser.addEventListener("load", onLoad, true);
- content.location = TEST_VIOLATION;
-}
-
-function onLoad(aEvent) {
- browser.removeEventListener("load", onLoad, true);
- testViolationMessage();
-}
-
-function testViolationMessage(){
- let aOutputNode = hud.outputNode;
-
- waitForSuccess({
- name: "CSP policy URI warning displayed successfully",
- validatorFn: function() {
- return hud.outputNode.textContent.indexOf(CSP_VIOLATION_MSG) > -1;
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js b/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
deleted file mode 100644
index a8e7ed87a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_782653_CSS_links_in_Style_Editor.js
+++ /dev/null
@@ -1,150 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test" +
- "/test-bug-782653-css-errors.html";
-
-let nodes, hud, StyleEditorUI;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testViewSource);
- }, true);
-}
-
-function testViewSource(aHud)
-{
- hud = aHud;
-
- registerCleanupFunction(function() {
- nodes = hud = StyleEditorUI = null;
- });
-
- let selector = ".webconsole-msg-cssparser .webconsole-location";
-
- waitForSuccess({
- name: "find the location node",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(selector);
- },
- successFn: function()
- {
- nodes = hud.outputNode.querySelectorAll(selector);
- is(nodes.length, 2, "correct number of css messages");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.getToolbox(target);
- toolbox.once("styleeditor-selected", (event, panel) => {
- StyleEditorUI = panel.UI;
-
- let count = 0;
- StyleEditorUI.on("editor-added", function() {
- if (++count == 2) {
- onStyleEditorReady(panel);
- }
- });
- });
-
- EventUtils.sendMouseEvent({ type: "click" }, nodes[0]);
- },
- failureFn: finishTest,
- });
-}
-
-function onStyleEditorReady(aPanel)
-{
- let win = aPanel.panelWindow;
- ok(win, "Style Editor Window is defined");
- ok(StyleEditorUI, "Style Editor UI is defined");
-
- waitForFocus(function() {
- info("style editor window focused");
-
- let href = nodes[0].getAttribute("title");
- let line = nodes[0].sourceLine;
- ok(line, "found source line");
-
- checkStyleEditorForSheetAndLine(href, line - 1, function() {
- info("first check done");
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- let toolbox = gDevTools.getToolbox(target);
-
- let href = nodes[1].getAttribute("title");
- let line = nodes[1].sourceLine;
- ok(line, "found source line");
-
- toolbox.selectTool("webconsole").then(function() {
- info("webconsole selected");
-
- toolbox.once("styleeditor-selected", function(aEvent) {
- info(aEvent + " event fired");
-
- checkStyleEditorForSheetAndLine(href, line - 1, function() {
- info("second check done");
- finishTest();
- });
- });
-
- EventUtils.sendMouseEvent({ type: "click" }, nodes[1]);
- });
- });
- }, win);
-}
-
-function checkStyleEditorForSheetAndLine(aHref, aLine, aCallback)
-{
- let foundEditor = null;
- waitForSuccess({
- name: "style editor for stylesheet",
- validatorFn: function()
- {
- for (let editor of StyleEditorUI.editors) {
- if (editor.styleSheet.href == aHref) {
- foundEditor = editor;
- return true;
- }
- }
- return false;
- },
- successFn: function()
- {
- performLineCheck(foundEditor, aLine, aCallback);
- },
- failureFn: finishTest,
- });
-}
-
-function performLineCheck(aEditor, aLine, aCallback)
-{
- function checkForCorrectState()
- {
- is(aEditor.sourceEditor.getCaretPosition().line, aLine,
- "correct line is selected");
- is(StyleEditorUI.selectedStyleSheetIndex, aEditor.styleSheet.styleSheetIndex,
- "correct stylesheet is selected in the editor");
-
- aCallback && executeSoon(aCallback);
- }
-
- waitForSuccess({
- name: "source editor load",
- validatorFn: function()
- {
- return aEditor.sourceEditor;
- },
- successFn: checkForCorrectState,
- failureFn: function() {
- info("selectedStyleSheetIndex " + StyleEditorUI.selectedStyleSheetIndex
- + " expected " + aEditor.styleSheet.styleSheetIndex);
- finishTest();
- },
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_804845_ctrl_key_nav.js b/browser/devtools/webconsole/test/browser_webconsole_bug_804845_ctrl_key_nav.js
deleted file mode 100644
index 1efd9c141..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_804845_ctrl_key_nav.js
+++ /dev/null
@@ -1,214 +0,0 @@
-/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * zmgmoz <zmgmoz@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Test navigation of webconsole contents via ctrl-a, ctrl-e, ctrl-p, ctrl-n
-// see https://bugzilla.mozilla.org/show_bug.cgi?id=804845
-
-let jsterm, inputNode;
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 804845 and bug 619598");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, doTests);
- }, true);
-}
-
-function doTests(HUD) {
- jsterm = HUD.jsterm;
- inputNode = jsterm.inputNode;
- ok(!jsterm.inputNode.value, "inputNode.value is empty");
- is(jsterm.inputNode.selectionStart, 0);
- is(jsterm.inputNode.selectionEnd, 0);
-
- testSingleLineInputNavNoHistory();
- testMultiLineInputNavNoHistory();
- testNavWithHistory();
-
- jsterm = inputNode = null;
- executeSoon(finishTest);
-}
-
-function testSingleLineInputNavNoHistory() {
- // Single char input
- EventUtils.synthesizeKey("1", {});
- is(inputNode.selectionStart, 1, "caret location after single char input");
-
- // nav to start/end with ctrl-a and ctrl-e;
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "caret location after single char input and ctrl-a");
-
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- is(inputNode.selectionStart, 1, "caret location after single char input and ctrl-e");
-
- // Second char input
- EventUtils.synthesizeKey("2", {});
- // nav to start/end with up/down keys; verify behaviour using ctrl-p/ctrl-n
- EventUtils.synthesizeKey("VK_UP", {});
- is(inputNode.selectionStart, 0, "caret location after two char input and VK_UP");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.selectionStart, 2, "caret location after two char input and VK_DOWN");
-
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "move caret to beginning of 2 char input with ctrl-a");
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "no change of caret location on repeat ctrl-a");
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "no change of caret location on ctrl-p from beginning of line");
-
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- is(inputNode.selectionStart, 2, "move caret to end of 2 char input with ctrl-e");
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- is(inputNode.selectionStart, 2, "no change of caret location on repeat ctrl-e");
- EventUtils.synthesizeKey("n", { ctrlKey: true });
- is(inputNode.selectionStart, 2, "no change of caret location on ctrl-n from end of line");
-
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "ctrl-p moves to start of line");
-
- EventUtils.synthesizeKey("n", { ctrlKey: true });
- is(inputNode.selectionStart, 2, "ctrl-n moves to end of line");
-}
-
-function testMultiLineInputNavNoHistory() {
- let lineValues = ["one", "2", "something longer", "", "", "three!"];
- jsterm.setInputValue("");
- // simulate shift-return
- for (let i = 0; i < lineValues.length; i++) {
- jsterm.setInputValue(inputNode.value + lineValues[i]);
- EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
- }
- let inputValue = inputNode.value;
- is(inputNode.selectionStart, inputNode.selectionEnd);
- is(inputNode.selectionStart, inputValue.length, "caret at end of multiline input");
-
- // possibility newline is represented by one ('\r', '\n') or two ('\r\n') chars
- let newlineString = inputValue.match(/(\r\n?|\n\r?)$/)[0];
-
- // Ok, test navigating within the multi-line string!
- EventUtils.synthesizeKey("VK_UP", {});
- let expectedStringAfterCarat = lineValues[5]+newlineString;
- is(inputNode.value.slice(inputNode.selectionStart), expectedStringAfterCarat,
- "up arrow from end of multiline");
-
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.value.slice(inputNode.selectionStart), "",
- "down arrow from within multiline");
-
- // navigate up through input lines
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.value.slice(inputNode.selectionStart), expectedStringAfterCarat,
- "ctrl-p from end of multiline");
-
- for (let i = 4; i >= 0; i--) {
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- expectedStringAfterCarat = lineValues[i] + newlineString + expectedStringAfterCarat;
- is(inputNode.value.slice(inputNode.selectionStart), expectedStringAfterCarat,
- "ctrl-p from within line " + i + " of multiline input");
- }
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.selectionStart, 0, "reached start of input");
- is(inputNode.value, inputValue,
- "no change to multiline input on ctrl-p from beginning of multiline");
-
- // navigate to end of first line
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- let caretPos = inputNode.selectionStart;
- let expectedStringBeforeCarat = lineValues[0];
- is(inputNode.value.slice(0, caretPos), expectedStringBeforeCarat,
- "ctrl-e into multiline input");
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- is(inputNode.selectionStart, caretPos,
- "repeat ctrl-e doesn't change caret position in multiline input");
-
- // navigate down one line; ctrl-a to the beginning; ctrl-e to end
- for (let i = 1; i < lineValues.length; i++) {
- EventUtils.synthesizeKey("n", { ctrlKey: true });
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- caretPos = inputNode.selectionStart;
- expectedStringBeforeCarat += newlineString;
- is(inputNode.value.slice(0, caretPos), expectedStringBeforeCarat,
- "ctrl-a to beginning of line " + (i+1) + " in multiline input");
-
- EventUtils.synthesizeKey("e", { ctrlKey: true });
- caretPos = inputNode.selectionStart;
- expectedStringBeforeCarat += lineValues[i];
- is(inputNode.value.slice(0, caretPos), expectedStringBeforeCarat,
- "ctrl-e to end of line " + (i+1) + "in multiline input");
- }
-}
-
-function testNavWithHistory() {
- // NOTE: Tests does NOT currently define behaviour for ctrl-p/ctrl-n with
- // caret placed _within_ single line input
- let values = ['"single line input"',
- '"a longer single-line input to check caret repositioning"',
- ['"multi-line"', '"input"', '"here!"'].join("\n"),
- ];
- // submit to history
- for (let i = 0; i < values.length; i++) {
- jsterm.setInputValue(values[i]);
- jsterm.execute();
- }
- is(inputNode.selectionStart, 0, "caret location at start of empty line");
-
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.selectionStart, values[values.length-1].length,
- "caret location correct at end of last history input");
-
- // Navigate backwards history with ctrl-p
- for (let i = values.length-1; i > 0; i--) {
- let match = values[i].match(/(\n)/g);
- if (match) {
- // multi-line inputs won't update from history unless caret at beginning
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- for (let i = 0; i < match.length; i++) {
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- }
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- } else {
- // single-line inputs will update from history from end of line
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- }
- is(inputNode.value, values[i-1],
- "ctrl-p updates inputNode from backwards history values[" + i-1 + "]");
- }
- let inputValue = inputNode.value;
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.selectionStart, 0,
- "ctrl-p at beginning of history moves caret location to beginning of line");
- is(inputNode.value, inputValue,
- "no change to input value on ctrl-p from beginning of line");
-
- // Navigate forwards history with ctrl-n
- for (let i = 1; i<values.length; i++) {
- EventUtils.synthesizeKey("n", { ctrlKey: true });
- is(inputNode.value, values[i],
- "ctrl-n updates inputNode from forwards history values[" + i + "]");
- is(inputNode.selectionStart, values[i].length,
- "caret location correct at end of history input for values[" + i + "]");
- }
- EventUtils.synthesizeKey("n", { ctrlKey: true });
- ok(!inputNode.value, "ctrl-n at end of history updates to empty input");
-
- // Simulate editing multi-line
- inputValue = "one\nlinebreak";
- jsterm.setInputValue(inputValue);
-
- // Attempt nav within input
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.value, inputValue,
- "ctrl-p from end of multi-line does not trigger history");
-
- EventUtils.synthesizeKey("a", { ctrlKey: true });
- EventUtils.synthesizeKey("p", { ctrlKey: true });
- is(inputNode.value, values[values.length-1],
- "ctrl-p from start of multi-line triggers history");
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_817834_add_edited_input_to_history.js b/browser/devtools/webconsole/test/browser_webconsole_bug_817834_add_edited_input_to_history.js
deleted file mode 100644
index 2f075a3a4..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_817834_add_edited_input_to_history.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: js2; js2-basic-offset: 2; indent-tabs-mode: nil; -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * zmgmoz <zmgmoz@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Test that user input that is not submitted in the command line input is not
-// lost after navigating in history.
-// See https://bugzilla.mozilla.org/show_bug.cgi?id=817834
-
-function test() {
- addTab("data:text/html;charset=utf-8,Web Console test for bug 817834");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testEditedInputHistory);
- }, true);
-}
-
-function testEditedInputHistory(HUD) {
- let jsterm = HUD.jsterm;
- let inputNode = jsterm.inputNode;
- ok(!inputNode.value, "inputNode.value is empty");
- is(inputNode.selectionStart, 0);
- is(inputNode.selectionEnd, 0);
-
- jsterm.setInputValue('"first item"');
- EventUtils.synthesizeKey("VK_UP", {});
- is(inputNode.value, '"first item"', "null test history up");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.value, '"first item"', "null test history down");
-
- jsterm.execute();
- is(inputNode.value, "", "cleared input line after submit");
-
- jsterm.setInputValue('"editing input 1"');
- EventUtils.synthesizeKey("VK_UP", {});
- is(inputNode.value, '"first item"', "test history up");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.value, '"editing input 1"',
- "test history down restores in-progress input");
-
- jsterm.setInputValue('"second item"');
- jsterm.execute();
- jsterm.setInputValue('"editing input 2"');
- EventUtils.synthesizeKey("VK_UP", {});
- is(inputNode.value, '"second item"', "test history up");
- EventUtils.synthesizeKey("VK_UP", {});
- is(inputNode.value, '"first item"', "test history up");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.value, '"second item"', "test history down");
- EventUtils.synthesizeKey("VK_DOWN", {});
- is(inputNode.value, '"editing input 2"',
- "test history down restores new in-progress input again");
-
- executeSoon(finishTest);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_821877_csp_errors.js b/browser/devtools/webconsole/test/browser_webconsole_bug_821877_csp_errors.js
deleted file mode 100644
index dae8f4d8b..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_821877_csp_errors.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Tests that CSP errors from nsDocument::InitCSP are logged to the Web Console
-
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-821877-csperrors.html";
-const CSP_DEPRECATED_HEADER_MSG = "The X-Content-Security-Policy and X-Content-Security-Report-Only headers will be deprecated in the future. Please use the Content-Security-Policy and Content-Security-Report-Only headers with CSP spec compliant syntax instead.";
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, function testCSPErrorLogged (hud) {
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "Deprecated CSP header error displayed successfully",
- text: CSP_DEPRECATED_HEADER_MSG,
- category: CATEGORY_SECURITY,
- severity: SEVERITY_WARNING
- },
- ],
- }).then(finishTest);
- });
- }, true);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_837351_securityerrors.js b/browser/devtools/webconsole/test/browser_webconsole_bug_837351_securityerrors.js
deleted file mode 100644
index 19705326d..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_837351_securityerrors.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-837351-security-errors.html";
-
-function run_test()
-{
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad(aEvent) {
- browser.removeEventListener(aEvent.type, onLoad, true);
- openConsole(null, function testSecurityErrorLogged (hud) {
- let button = hud.ui.rootElement.querySelector(".webconsole-filter-button[category=\"security\"]");
- ok(button, "Found security button in the web console");
-
- waitForMessages({
- webconsole: hud,
- messages: [
- {
- name: "Logged blocking mixed active content",
- text: "Blocked loading mixed active content \"http://example.com/\"",
- category: CATEGORY_SECURITY,
- severity: SEVERITY_ERROR
- },
- ],
- }).then(finishTest);
- });
- }, true);
-}
-
-function test()
-{
- SpecialPowers.pushPrefEnv({'set': [["security.mixed_content.block_active_content", true]]}, run_test);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_change_font_size.js b/browser/devtools/webconsole/test/browser_webconsole_change_font_size.js
deleted file mode 100644
index babfddabb..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_change_font_size.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Jennifer Fong <jfong@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-const TEST_URI = "http://example.com/";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- Services.prefs.setIntPref("devtools.webconsole.fontSize", 10);
- openConsole(null, testFontSizeChange);
- }, true);
-}
-
-function testFontSizeChange(hud) {
- let inputNode = hud.jsterm.inputNode;
- let outputNode = hud.jsterm.outputNode;
- outputNode.focus();
-
- EventUtils.synthesizeKey("-", { accelKey: true });
- is(inputNode.style.fontSize, "10px", "input font stays at same size with ctrl+-");
- is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
-
- EventUtils.synthesizeKey("=", { accelKey: true });
- is(inputNode.style.fontSize, "11px", "input font increased with ctrl+=");
- is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+=");
-
- EventUtils.synthesizeKey("-", { accelKey: true });
- is(inputNode.style.fontSize, "10px", "font decreased with ctrl+-");
- is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
-
- EventUtils.synthesizeKey("0", { accelKey: true });
- is(inputNode.style.fontSize, "", "font reset with ctrl+0");
- is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+0");
-
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_chrome.js b/browser/devtools/webconsole/test/browser_webconsole_chrome.js
deleted file mode 100644
index a04a011a7..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_chrome.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that code completion works properly.
-
-function test() {
- addTab("about:config");
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testChrome);
- }, true);
-}
-
-function testChrome(hud) {
- ok(hud, "we have a console");
-
- ok(hud.iframeWindow, "we have the console UI window");
-
- let jsterm = hud.jsterm;
- ok(jsterm, "we have a jsterm");
-
- let input = jsterm.inputNode;
- ok(hud.outputNode, "we have an output node");
-
- // Test typing 'docu'.
- input.value = "docu";
- input.setSelectionRange(4, 4);
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function() {
- is(jsterm.completeNode.value, " ment", "'docu' completion");
- executeSoon(finishTest);
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_completion.js b/browser/devtools/webconsole/test/browser_webconsole_completion.js
deleted file mode 100644
index fc27c7397..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_completion.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that code completion works properly.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>test code completion";
-
-let testDriver;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(hud) {
- testDriver = testCompletion(hud);
- testDriver.next();
- });
- }, true);
-}
-
-function testNext() {
- executeSoon(function() {
- testDriver.next();
- });
-}
-
-function testCompletion(hud) {
- let jsterm = hud.jsterm;
- let input = jsterm.inputNode;
-
- // Test typing 'docu'.
- input.value = "docu";
- input.setSelectionRange(4, 4);
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
- yield;
-
- is(input.value, "docu", "'docu' completion (input.value)");
- is(jsterm.completeNode.value, " ment", "'docu' completion (completeNode)");
-
- // Test typing 'docu' and press tab.
- input.value = "docu";
- input.setSelectionRange(4, 4);
- jsterm.complete(jsterm.COMPLETE_FORWARD, testNext);
- yield;
-
- is(input.value, "document", "'docu' tab completion");
- is(input.selectionStart, 8, "start selection is alright");
- is(input.selectionEnd, 8, "end selection is alright");
- is(jsterm.completeNode.value.replace(/ /g, ""), "", "'docu' completed");
-
- // Test typing 'window.Ob' and press tab. Just 'window.O' is
- // ambiguous: could be window.Object, window.Option, etc.
- input.value = "window.Ob";
- input.setSelectionRange(9, 9);
- jsterm.complete(jsterm.COMPLETE_FORWARD, testNext);
- yield;
-
- is(input.value, "window.Object", "'window.Ob' tab completion");
-
- // Test typing 'document.getElem'.
- input.value = "document.getElem";
- input.setSelectionRange(16, 16);
- jsterm.complete(jsterm.COMPLETE_FORWARD, testNext);
- yield;
-
- is(input.value, "document.getElem", "'document.getElem' completion");
- is(jsterm.completeNode.value, "", "'document.getElem' completion");
-
- // Test pressing tab another time.
- jsterm.complete(jsterm.COMPLETE_FORWARD, testNext);
- yield;
-
- is(input.value, "document.getElem", "'document.getElem' completion");
- is(jsterm.completeNode.value, " entsByTagNameNS", "'document.getElem' another tab completion");
-
- // Test pressing shift_tab.
- jsterm.complete(jsterm.COMPLETE_BACKWARD, testNext);
- yield;
-
- is(input.value, "document.getElem", "'document.getElem' untab completion");
- is(jsterm.completeNode.value, "", "'document.getElem' completion");
-
- jsterm.clearOutput();
-
- input.value = "docu";
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
- yield;
-
- is(jsterm.completeNode.value, " ment", "'docu' completion");
- jsterm.execute();
- is(jsterm.completeNode.value, "", "clear completion on execute()");
-
- // Test multi-line completion works
- input.value = "console.log('one');\nconsol";
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
- yield;
-
- is(jsterm.completeNode.value, " \n e", "multi-line completion");
-
- // Test non-object autocompletion.
- input.value = "Object.name.sl";
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
- yield;
-
- is(jsterm.completeNode.value, " ice", "non-object completion");
-
- // Test string literal autocompletion.
- input.value = "'Asimov'.sl";
- jsterm.complete(jsterm.COMPLETE_HINT_ONLY, testNext);
- yield;
-
- is(jsterm.completeNode.value, " ice", "string literal completion");
-
- testDriver = jsterm = input = null;
- executeSoon(finishTest);
- yield;
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_console_extras.js b/browser/devtools/webconsole/test/browser_webconsole_console_extras.js
deleted file mode 100644
index 4e0fa63d8..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_console_extras.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the basic console.log()-style APIs and filtering work.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-extras.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(hud) {
- waitForSuccess({
- name: "two nodes displayed",
- validatorFn: function()
- {
- return hud.outputNode.querySelectorAll(".hud-msg-node").length == 2;
- },
- successFn: function()
- {
- let nodes = hud.outputNode.querySelectorAll(".hud-msg-node");
- ok(/start/.test(nodes[0].textContent), "start found");
- ok(/end/.test(nodes[1].textContent), "end found - complete!");
-
- finishTest();
- },
- failureFn: finishTest,
- });
-
- let button = content.document.querySelector("button");
- ok(button, "we have the button");
- EventUtils.sendMouseEvent({ type: "click" }, button, content);
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_console_logging_api.js b/browser/devtools/webconsole/test/browser_webconsole_console_logging_api.js
deleted file mode 100644
index 4d8a1d492..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_console_logging_api.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the basic console.log()-style APIs and filtering work.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let testDriver = null;
-let subtestDriver = null;
-
-function test() {
- addTab(TEST_URI);
-
- browser.addEventListener("DOMContentLoaded", onLoad, false);
-}
-
-function onLoad() {
- browser.removeEventListener("DOMContentLoaded", onLoad, false);
-
- openConsole(null, function(aHud) {
- hud = aHud;
- hudId = hud.hudId;
- outputNode = hud.outputNode;
- testDriver = testGen();
- testDriver.next();
- });
-}
-
-function testGen() {
- subtestGen("log");
- yield;
-
- subtestGen("info");
- yield;
-
- subtestGen("warn");
- yield;
-
- subtestGen("error");
- yield;
-
- subtestGen("debug"); // bug 616742
- yield;
-
- testDriver = subtestDriver = null;
- finishTest();
-
- yield;
-}
-
-function subtestGen(aMethod) {
- subtestDriver = testConsoleLoggingAPI(aMethod);
- subtestDriver.next();
-}
-
-function testConsoleLoggingAPI(aMethod) {
- let console = content.wrappedJSObject.console;
-
- hud.jsterm.clearOutput();
-
- setStringFilter("foo");
- console[aMethod]("foo-bar-baz");
- console[aMethod]("bar-baz");
-
- function nextTest() {
- subtestDriver.next();
- }
-
- waitForSuccess({
- name: "1 hidden " + aMethod + " node via string filtering",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-filtered-by-string").length == 1;
- },
- successFn: nextTest,
- failureFn: nextTest,
- });
-
- yield;
-
- hud.jsterm.clearOutput();
-
- // now toggle the current method off - make sure no visible message
-
- // TODO: move all filtering tests into a separate test file: see bug 608135
- setStringFilter("");
- hud.setFilterState(aMethod, false);
- console[aMethod]("foo-bar-baz");
-
- waitForSuccess({
- name: "1 message hidden for " + aMethod + " (logging turned off)",
- validatorFn: function()
- {
- return outputNode.querySelectorAll("description").length == 1;
- },
- successFn: nextTest,
- failureFn: nextTest,
- });
-
- yield;
-
- hud.jsterm.clearOutput();
- hud.setFilterState(aMethod, true);
- console[aMethod]("foo-bar-baz");
-
- waitForSuccess({
- name: "1 message shown for " + aMethod + " (logging turned on)",
- validatorFn: function()
- {
- return outputNode.querySelectorAll("description").length == 1;
- },
- successFn: nextTest,
- failureFn: nextTest,
- });
-
- yield;
-
- hud.jsterm.clearOutput();
- setStringFilter("");
-
- // test for multiple arguments.
- console[aMethod]("foo", "bar");
-
- waitForSuccess({
- name: "show both console arguments for " + aMethod,
- validatorFn: function()
- {
- let node = outputNode.querySelector(".hud-msg-node");
- return node && /"foo" "bar"/.test(node.textContent);
- },
- successFn: nextTest,
- failureFn: nextTest,
- });
-
- yield;
- testDriver.next();
- yield;
-}
-
-function setStringFilter(aValue) {
- hud.ui.filterBox.value = aValue;
- hud.ui.adjustVisibilityOnSearchStringChange();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js b/browser/devtools/webconsole/test/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js
deleted file mode 100644
index 85f2ce847..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that copying multiple messages inserts newlines in between.
-
-const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 586142";
-
-let hud;
-
-function test()
-{
- addTab(TEST_URI);
- browser.addEventListener("DOMContentLoaded", onLoad, false);
-}
-
-function onLoad() {
- browser.removeEventListener("DOMContentLoaded", onLoad, false);
- openConsole(null, testNewlines);
-}
-
-function testNewlines(aHud) {
- hud = aHud;
- hud.jsterm.clearOutput();
-
- for (let i = 0; i < 20; i++) {
- content.console.log("Hello world #" + i);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "Hello world #19",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(testClipboard);
-}
-
-function testClipboard() {
- let outputNode = hud.outputNode;
-
- info("messages in output: " + outputNode.itemCount);
- ok(outputNode.itemCount >= 20, "expected number of messages");
-
- outputNode.selectAll();
- outputNode.focus();
-
- let clipboardTexts = [];
- for (let i = 0; i < outputNode.itemCount; i++) {
- let item = outputNode.getItemAtIndex(i);
- clipboardTexts.push("[" +
- WCU_l10n.timestampString(item.timestamp) +
- "] " + item.clipboardText);
- }
-
- waitForClipboard(clipboardTexts.join("\n"),
- function() { goDoCommand("cmd_copy"); },
- finishTest, finishTest);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_execution_scope.js b/browser/devtools/webconsole/test/browser_webconsole_execution_scope.js
deleted file mode 100644
index 23c4cd8f3..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_execution_scope.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that commands run by the user are executed in content space.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testExecutionScope);
- }, true);
-}
-
-function testExecutionScope(hud) {
- let jsterm = hud.jsterm;
-
- jsterm.clearOutput();
- jsterm.execute("window.location.href;");
-
- waitForSuccess({
- name: "jsterm execution output (two nodes)",
- validatorFn: function()
- {
- return jsterm.outputNode.querySelectorAll(".hud-msg-node").length == 2;
- },
- successFn: function()
- {
- let nodes = jsterm.outputNode.querySelectorAll(".hud-msg-node");
-
- is(/window.location.href;/.test(nodes[0].textContent), true,
- "'window.location.href;' written to output");
-
- isnot(nodes[1].textContent.indexOf(TEST_URI), -1,
- "command was executed in the window scope");
-
- executeSoon(finishTest);
- },
- failureFn: finishTest,
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_for_of.js b/browser/devtools/webconsole/test/browser_webconsole_for_of.js
deleted file mode 100644
index fc925535b..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_for_of.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// A for-of loop in Web Console code can loop over a content NodeList.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-for-of.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testForOf);
- }, true);
-}
-
-function testForOf(hud) {
- var jsterm = hud.jsterm;
- jsterm.execute("{ [x.tagName for (x of document.body.childNodes) if (x.nodeType === 1)].join(' '); }");
-
- waitForSuccess({
- name: "jsterm output displayed",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- let node = hud.outputNode.querySelector(".webconsole-msg-output");
- ok(/H1 DIV H2 P/.test(node.textContent),
- "for-of loop should find all top-level nodes");
- finishTest();
- },
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_history.js b/browser/devtools/webconsole/test/browser_webconsole_history.js
deleted file mode 100644
index bb39cd60f..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_history.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests the console history feature accessed via the up and down arrow keys.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-// Constants used for defining the direction of JSTerm input history navigation.
-const HISTORY_BACK = -1;
-const HISTORY_FORWARD = 1;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testHistory);
- }, true);
-}
-
-function testHistory(hud) {
- let jsterm = hud.jsterm;
- let input = jsterm.inputNode;
-
- let executeList = ["document", "window", "window.location"];
-
- for each (var item in executeList) {
- input.value = item;
- jsterm.execute();
- }
-
- for (var i = executeList.length - 1; i != -1; i--) {
- jsterm.historyPeruse(HISTORY_BACK);
- is (input.value, executeList[i], "check history previous idx:" + i);
- }
-
- jsterm.historyPeruse(HISTORY_BACK);
- is (input.value, executeList[0], "test that item is still index 0");
-
- jsterm.historyPeruse(HISTORY_BACK);
- is (input.value, executeList[0], "test that item is still still index 0");
-
- for (var i = 1; i < executeList.length; i++) {
- jsterm.historyPeruse(HISTORY_FORWARD);
- is (input.value, executeList[i], "check history next idx:" + i);
- }
-
- jsterm.historyPeruse(HISTORY_FORWARD);
- is (input.value, "", "check input is empty again");
-
- // Simulate pressing Arrow_Down a few times and then if Arrow_Up shows
- // the previous item from history again.
- jsterm.historyPeruse(HISTORY_FORWARD);
- jsterm.historyPeruse(HISTORY_FORWARD);
- jsterm.historyPeruse(HISTORY_FORWARD);
-
- is (input.value, "", "check input is still empty");
-
- let idxLast = executeList.length - 1;
- jsterm.historyPeruse(HISTORY_BACK);
- is (input.value, executeList[idxLast], "check history next idx:" + idxLast);
-
- executeSoon(finishTest);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_js_input_and_output_styling.js b/browser/devtools/webconsole/test/browser_webconsole_js_input_and_output_styling.js
deleted file mode 100644
index b888b0f5c..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_js_input_and_output_styling.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the correct CSS styles are applied to the lines of console
-// output.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testJSInputAndOutputStyling);
- }, true);
-}
-
-function testJSInputAndOutputStyling(hud) {
- let jsterm = hud.jsterm;
-
- jsterm.clearOutput();
- jsterm.execute("2 + 2");
-
- waitForSuccess({
- name: "jsterm output is displayed",
- validatorFn: function()
- {
- return jsterm.outputNode.querySelector(".webconsole-msg-output");
- },
- successFn: function()
- {
- let jsInputNode = jsterm.outputNode.querySelector(".hud-msg-node");
- isnot(jsInputNode.textContent.indexOf("2 + 2"), -1,
- "JS input node contains '2 + 2'");
- ok(jsInputNode.classList.contains("webconsole-msg-input"),
- "JS input node is of the CSS class 'webconsole-msg-input'");
-
- let output = jsterm.outputNode.querySelector(".webconsole-msg-output");
- isnot(output.textContent.indexOf("4"), -1,
- "JS output node contains '4'");
-
- finishTest();
- },
- failureFn: finishTest,
- });
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_js_input_expansion.js b/browser/devtools/webconsole/test/browser_webconsole_js_input_expansion.js
deleted file mode 100644
index 2dce91293..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_js_input_expansion.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the input box expands as the user types long lines.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testJSInputExpansion);
- }, true);
-}
-
-function testJSInputExpansion(hud) {
- let jsterm = hud.jsterm;
- let input = jsterm.inputNode;
- input.focus();
-
- is(input.getAttribute("multiline"), "true", "multiline is enabled");
- // Tests if the inputNode expands.
- input.value = "hello\nworld\n";
- let length = input.value.length;
- input.selectionEnd = length;
- input.selectionStart = length;
- function getHeight()
- {
- return input.clientHeight;
- }
- let initialHeight = getHeight();
- // Performs an "d". This will trigger/test for the input event that should
- // change the "row" attribute of the inputNode.
- EventUtils.synthesizeKey("d", {});
- let newHeight = getHeight();
- ok(initialHeight < newHeight, "Height changed: " + newHeight);
-
- // Add some more rows. Tests for the 8 row limit.
- input.value = "row1\nrow2\nrow3\nrow4\nrow5\nrow6\nrow7\nrow8\nrow9\nrow10\n";
- length = input.value.length;
- input.selectionEnd = length;
- input.selectionStart = length;
- EventUtils.synthesizeKey("d", {});
- let newerHeight = getHeight();
-
- ok(newerHeight > newHeight, "height changed: " + newerHeight);
-
- // Test if the inputNode shrinks again.
- input.value = "";
- EventUtils.synthesizeKey("d", {});
- let height = getHeight();
- info("height: " + height);
- info("initialHeight: " + initialHeight);
- let finalHeightDifference = Math.abs(initialHeight - height);
- ok(finalHeightDifference <= 1, "height shrank to original size within 1px");
-
- finishTest();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_jsterm.js b/browser/devtools/webconsole/test/browser_webconsole_jsterm.js
deleted file mode 100644
index bf0ea3ba5..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_jsterm.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let jsterm, testDriver;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(hud) {
- testDriver = testJSTerm(hud);
- testDriver.next();
- });
- }, true);
-}
-
-function nextTest() {
- testDriver.next();
-}
-
-function checkResult(msg, desc, lines) {
- waitForSuccess({
- name: "correct number of results shown for " + desc,
- validatorFn: function()
- {
- let nodes = jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
- return nodes.length == lines;
- },
- successFn: function()
- {
- let labels = jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
- if (typeof msg == "string") {
- is(labels[lines-1].textContent.trim(), msg,
- "correct message shown for " + desc);
- }
- else if (typeof msg == "function") {
- ok(msg(labels), "correct message shown for " + desc);
- }
-
- nextTest();
- },
- failureFn: nextTest,
- });
-}
-
-function testJSTerm(hud)
-{
- jsterm = hud.jsterm;
-
- jsterm.clearOutput();
- jsterm.execute("'id=' + $('#header').getAttribute('id')");
- checkResult('"id=header"', "$() worked", 1);
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("headerQuery = $$('h1')");
- jsterm.execute("'length=' + headerQuery.length");
- checkResult('"length=1"', "$$() worked", 2);
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("xpathQuery = $x('.//*', document.body);");
- jsterm.execute("'headerFound=' + (xpathQuery[0] == headerQuery[0])");
- checkResult('"headerFound=true"', "$x() worked", 2);
- yield;
-
- // no jsterm.clearOutput() here as we clear the output using the clear() fn.
- jsterm.execute("clear()");
-
- waitForSuccess({
- name: "clear() worked",
- validatorFn: function()
- {
- return jsterm.outputNode.childNodes.length == 0;
- },
- successFn: nextTest,
- failureFn: nextTest,
- });
-
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("'keysResult=' + (keys({b:1})[0] == 'b')");
- checkResult('"keysResult=true"', "keys() worked", 1);
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("'valuesResult=' + (values({b:1})[0] == 1)");
- checkResult('"valuesResult=true"', "values() worked", 1);
- yield;
-
- jsterm.clearOutput();
-
- let tabs = gBrowser.tabs.length;
-
- jsterm.execute("help()");
- let output = jsterm.outputNode.querySelector(".webconsole-msg-output");
- ok(!output, "help() worked");
-
- jsterm.execute("help");
- output = jsterm.outputNode.querySelector(".webconsole-msg-output");
- ok(!output, "help worked");
-
- jsterm.execute("?");
- output = jsterm.outputNode.querySelector(".webconsole-msg-output");
- ok(!output, "? worked");
-
- let foundTab = null;
- waitForSuccess({
- name: "help tabs opened",
- validatorFn: function()
- {
- let newTabOpen = gBrowser.tabs.length == tabs + 3;
- if (!newTabOpen) {
- return false;
- }
-
- foundTab = gBrowser.tabs[tabs];
- return true;
- },
- successFn: function()
- {
- gBrowser.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
- gBrowser.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
- gBrowser.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]);
- nextTest();
- },
- failureFn: nextTest,
- });
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("pprint({b:2, a:1})");
- checkResult('" b: 2\n a: 1"', "pprint()", 1);
- yield;
-
- // check instanceof correctness, bug 599940
- jsterm.clearOutput();
- jsterm.execute("[] instanceof Array");
- checkResult("true", "[] instanceof Array == true", 1);
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("({}) instanceof Object");
- checkResult("true", "({}) instanceof Object == true", 1);
- yield;
-
- // check for occurrences of Object XRayWrapper, bug 604430
- jsterm.clearOutput();
- jsterm.execute("document");
- checkResult(function(nodes) {
- return nodes[0].textContent.search(/\[object xraywrapper/i) == -1;
- }, "document - no XrayWrapper", 1);
- yield;
-
- // check that pprint(window) and keys(window) don't throw, bug 608358
- jsterm.clearOutput();
- jsterm.execute("pprint(window)");
- checkResult(null, "pprint(window)", 1);
- yield;
-
- jsterm.clearOutput();
- jsterm.execute("keys(window)");
- checkResult(null, "keys(window)", 1);
- yield;
-
- // bug 614561
- jsterm.clearOutput();
- jsterm.execute("pprint('hi')");
- checkResult('" 0: "h"\n 1: "i""', "pprint('hi')", 1);
- yield;
-
- // check that pprint(function) shows function source, bug 618344
- jsterm.clearOutput();
- jsterm.execute("pprint(print)");
- checkResult(function(nodes) {
- return nodes[0].textContent.indexOf("aOwner.helperResult") > -1;
- }, "pprint(function) shows source", 1);
- yield;
-
- // check that an evaluated null produces "null", bug 650780
- jsterm.clearOutput();
- jsterm.execute("null");
- checkResult("null", "null is null", 1);
- yield;
-
- jsterm = testDriver = null;
- executeSoon(finishTest);
- yield;
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_live_filtering_of_message_types.js b/browser/devtools/webconsole/test/browser_webconsole_live_filtering_of_message_types.js
deleted file mode 100644
index eaba9f1e5..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_live_filtering_of_message_types.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the message type filter checkboxes work.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let hud;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- hud = aHud;
- hud.jsterm.clearOutput();
-
- let console = content.console;
-
- for (let i = 0; i < 50; i++) {
- console.log("foobarz #" + i);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "foobarz #49",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(testLiveFilteringOfMessageTypes);
-}
-
-function testLiveFilteringOfMessageTypes() {
- is(hud.outputNode.itemCount, 50, "number of messages");
-
- hud.setFilterState("log", false);
- is(countMessageNodes(), 0, "the log nodes are hidden when the " +
- "corresponding filter is switched off");
-
- hud.setFilterState("log", true);
- is(countMessageNodes(), 50, "the log nodes reappear when the " +
- "corresponding filter is switched on");
-
- finishTest();
-}
-
-function countMessageNodes() {
- let messageNodes = hud.outputNode.querySelectorAll(".hud-log");
- let displayedMessageNodes = 0;
- let view = hud.iframeWindow;
- for (let i = 0; i < messageNodes.length; i++) {
- let computedStyle = view.getComputedStyle(messageNodes[i], null);
- if (computedStyle.display !== "none") {
- displayedMessageNodes++;
- }
- }
-
- return displayedMessageNodes;
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_live_filtering_on_search_strings.js b/browser/devtools/webconsole/test/browser_webconsole_live_filtering_on_search_strings.js
deleted file mode 100644
index e66e66fe3..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_live_filtering_on_search_strings.js
+++ /dev/null
@@ -1,106 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the text filter box works.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-let hud;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- hud = aHud;
- hud.jsterm.clearOutput();
- let console = content.console;
-
- for (let i = 0; i < 50; i++) {
- console.log("http://www.example.com/ " + i);
- }
-
- waitForMessages({
- webconsole: hud,
- messages: [{
- text: "http://www.example.com/ 49",
- category: CATEGORY_WEBDEV,
- severity: SEVERITY_LOG,
- }],
- }).then(testLiveFilteringOnSearchStrings);
-}
-
-function testLiveFilteringOnSearchStrings() {
- is(hud.outputNode.itemCount, 50, "number of messages");
-
- setStringFilter("http");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is set to \"http\"");
-
- setStringFilter("hxxp");
- is(countMessageNodes(), 0, "the log nodes are hidden when the search " +
- "string is set to \"hxxp\"");
-
- setStringFilter("ht tp");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is set to \"ht tp\"");
-
- setStringFilter(" zzzz zzzz ");
- is(countMessageNodes(), 0, "the log nodes are hidden when the search " +
- "string is set to \" zzzz zzzz \"");
-
- setStringFilter("");
- isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
- "search string is removed");
-
- setStringFilter("\u9f2c");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching " +
- "for weasels");
-
- setStringFilter("\u0007");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- "the bell character");
-
- setStringFilter('"foo"');
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- 'the string "foo"');
-
- setStringFilter("'foo'");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- "the string 'foo'");
-
- setStringFilter("foo\"bar'baz\"boo'");
- is(countMessageNodes(), 0, "the log nodes are hidden when searching for " +
- "the string \"foo\"bar'baz\"boo'\"");
-
- finishTest();
-}
-
-function countMessageNodes() {
- let outputNode = hud.outputNode;
-
- let messageNodes = outputNode.querySelectorAll(".hud-log");
- let displayedMessageNodes = 0;
- let view = hud.iframeWindow;
- for (let i = 0; i < messageNodes.length; i++) {
- let computedStyle = view.getComputedStyle(messageNodes[i], null);
- if (computedStyle.display !== "none") {
- displayedMessageNodes++;
- }
- }
-
- return displayedMessageNodes;
-}
-
-function setStringFilter(aValue)
-{
- hud.ui.filterBox.value = aValue;
- hud.ui.adjustVisibilityOnSearchStringChange();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_log_node_classes.js b/browser/devtools/webconsole/test/browser_webconsole_log_node_classes.js
deleted file mode 100644
index cc030f8f5..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_log_node_classes.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that console logging via the console API produces nodes of the correct
-// CSS classes.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, consoleOpened);
- }, true);
-}
-
-function consoleOpened(aHud) {
- let console = content.console;
- outputNode = aHud.outputNode;
-
- ok(console, "console exists");
- console.log("I am a log message");
- console.error("I am an error");
- console.info("I am an info message");
- console.warn("I am a warning message");
-
- waitForSuccess({
- name: "console.warn displayed",
- validatorFn: function()
- {
- return aHud.outputNode.textContent.indexOf("a warning") > -1;
- },
- successFn: testLogNodeClasses,
- failureFn: finishTest,
- });
-}
-
-function testLogNodeClasses() {
- let domLogEntries = outputNode.childNodes;
-
- let count = outputNode.childNodes.length;
- ok(count > 0, "LogCount: " + count);
-
- let klasses = ["hud-log",
- "hud-warn",
- "hud-info",
- "hud-error",
- "hud-exception",
- "hud-network"];
-
- function verifyClass(classList) {
- let len = klasses.length;
- for (var i = 0; i < len; i++) {
- if (classList.contains(klasses[i])) {
- return true;
- }
- }
- return false;
- }
-
- for (var i = 0; i < count; i++) {
- let classList = domLogEntries[i].classList;
- ok(verifyClass(classList),
- "Log Node class verified: " + domLogEntries[i].getAttribute("class"));
- }
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_message_node_id.js b/browser/devtools/webconsole/test/browser_webconsole_message_node_id.js
deleted file mode 100644
index 77c560ca8..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_message_node_id.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("DOMContentLoaded", onLoad, false);
-}
-
-function onLoad() {
- browser.removeEventListener("DOMContentLoaded", onLoad, false);
- openConsole(null, function(hud) {
- content.console.log("a log message");
-
- waitForSuccess({
- name: "console.log message shown with an ID attribute",
- validatorFn: function()
- {
- let node = hud.outputNode.querySelector(".hud-msg-node");
- return node && node.getAttribute("id");
- },
- successFn: finishTest,
- failureFn: finishTest,
- });
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_netlogging.js b/browser/devtools/webconsole/test/browser_webconsole_netlogging.js
deleted file mode 100644
index 8bc835fa1..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_netlogging.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Julian Viereck <jviereck@mozilla.com>
- * Patrick Walton <pcwalton@mozilla.com>
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-// Tests that network log messages bring up the network panel.
-
-const TEST_NETWORK_REQUEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html";
-
-const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
-
-const TEST_DATA_JSON_CONTENT =
- '{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] }';
-
-let lastRequest = null;
-let requestCallback = null;
-
-function test()
-{
- addTab("data:text/html;charset=utf-8,Web Console network logging tests");
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
-
- openConsole(null, function(aHud) {
- hud = aHud;
-
- HUDService.lastFinishedRequestCallback = requestCallbackWrapper;
-
- executeSoon(testPageLoad);
- });
- }, true);
-}
-
-function requestCallbackWrapper(aRequest)
-{
- lastRequest = aRequest;
-
- hud.ui.webConsoleClient.getResponseContent(lastRequest.actor,
- function(aResponse) {
- lastRequest.response.content = aResponse.content;
- lastRequest.discardResponseBody = aResponse.contentDiscarded;
-
- hud.ui.webConsoleClient.getRequestPostData(lastRequest.actor,
- function(aResponse) {
- lastRequest.request.postData = aResponse.postData;
- lastRequest.discardRequestBody = aResponse.postDataDiscarded;
-
- if (requestCallback) {
- requestCallback();
- }
- });
- });
-}
-
-function testPageLoad()
-{
- requestCallback = function() {
- // Check if page load was logged correctly.
- ok(lastRequest, "Page load was logged");
-
- is(lastRequest.request.url, TEST_NETWORK_REQUEST_URI,
- "Logged network entry is page load");
- is(lastRequest.request.method, "GET", "Method is correct");
- ok(!lastRequest.request.postData.text, "No request body was stored");
- ok(lastRequest.discardRequestBody, "Request body was discarded");
- ok(!lastRequest.response.content.text, "No response body was stored");
- ok(lastRequest.discardResponseBody, "Response body was discarded");
-
- lastRequest = null;
- requestCallback = null;
- executeSoon(testPageLoadBody);
- };
-
- content.location = TEST_NETWORK_REQUEST_URI;
-}
-
-function testPageLoadBody()
-{
- // Turn on logging of request bodies and check again.
- hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
- ok(hud.ui._saveRequestAndResponseBodies,
- "The saveRequestAndResponseBodies property was successfully set.");
-
- testPageLoadBodyAfterSettingUpdate();
- });
-}
-
-function testPageLoadBodyAfterSettingUpdate()
-{
- let loaded = false;
- let requestCallbackInvoked = false;
-
- requestCallback = function() {
- ok(lastRequest, "Page load was logged again");
- ok(!lastRequest.discardResponseBody, "Response body was not discarded");
- is(lastRequest.response.content.text.indexOf("<!DOCTYPE HTML>"), 0,
- "Response body's beginning is okay");
-
- lastRequest = null;
- requestCallback = null;
- requestCallbackInvoked = true;
-
- if (loaded) {
- executeSoon(testXhrGet);
- }
- };
-
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- loaded = true;
-
- if (requestCallbackInvoked) {
- executeSoon(testXhrGet);
- }
- }, true);
-
- content.location.reload();
-}
-
-function testXhrGet()
-{
- requestCallback = function() {
- ok(lastRequest, "testXhrGet() was logged");
- is(lastRequest.request.method, "GET", "Method is correct");
- ok(!lastRequest.request.postData.text, "No request body was sent");
- ok(!lastRequest.discardRequestBody, "Request body was not discarded");
- is(lastRequest.response.content.text, TEST_DATA_JSON_CONTENT,
- "Response is correct");
-
- lastRequest = null;
- requestCallback = null;
- executeSoon(testXhrPost);
- };
-
- // Start the XMLHttpRequest() GET test.
- content.wrappedJSObject.testXhrGet();
-}
-
-function testXhrPost()
-{
- requestCallback = function() {
- ok(lastRequest, "testXhrPost() was logged");
- is(lastRequest.request.method, "POST", "Method is correct");
- is(lastRequest.request.postData.text, "Hello world!",
- "Request body was logged");
- is(lastRequest.response.content.text, TEST_DATA_JSON_CONTENT,
- "Response is correct");
-
- lastRequest = null;
- requestCallback = null;
- executeSoon(testFormSubmission);
- };
-
- // Start the XMLHttpRequest() POST test.
- content.wrappedJSObject.testXhrPost();
-}
-
-function testFormSubmission()
-{
- // Start the form submission test. As the form is submitted, the page is
- // loaded again. Bind to the load event to catch when this is done.
- requestCallback = function() {
- ok(lastRequest, "testFormSubmission() was logged");
- is(lastRequest.request.method, "POST", "Method is correct");
- isnot(lastRequest.request.postData.text.
- indexOf("Content-Type: application/x-www-form-urlencoded"), -1,
- "Content-Type is correct");
- isnot(lastRequest.request.postData.text.
- indexOf("Content-Length: 20"), -1, "Content-length is correct");
- isnot(lastRequest.request.postData.text.
- indexOf("name=foo+bar&age=144"), -1, "Form data is correct");
- is(lastRequest.response.content.text.indexOf("<!DOCTYPE HTML>"), 0,
- "Response body's beginning is okay");
-
- executeSoon(testNetworkPanel);
- };
-
- let form = content.document.querySelector("form");
- ok(form, "we have the HTML form");
- form.submit();
-}
-
-function testNetworkPanel()
-{
- // Open the NetworkPanel. The functionality of the NetworkPanel is tested
- // within separate test files.
- let networkPanel = hud.ui.openNetworkPanel(hud.ui.filterBox, lastRequest);
-
- networkPanel.panel.addEventListener("popupshown", function onPopupShown() {
- networkPanel.panel.removeEventListener("popupshown", onPopupShown, true);
-
- is(hud.ui.filterBox._netPanel, networkPanel,
- "Network panel stored on anchor node");
- ok(true, "NetworkPanel was opened");
-
- // All tests are done. Shutdown.
- networkPanel.panel.hidePopup();
- lastRequest = null;
- HUDService.lastFinishedRequestCallback = null;
- executeSoon(finishTest);
- }, true);
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_network_panel.js b/browser/devtools/webconsole/test/browser_webconsole_network_panel.js
deleted file mode 100644
index 678597224..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_network_panel.js
+++ /dev/null
@@ -1,543 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that the network panel works.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-const TEST_IMG = "http://example.com/browser/browser/devtools/webconsole/test/test-image.png";
-const TEST_ENCODING_ISO_8859_1 = "http://example.com/browser/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html";
-
-const TEST_IMG_BASE64 =
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVRJREFU" +
- "OI2lk7FLw0AUxr+YpC1CBqcMWfsvCCLdXFzqEJCgDl1EQRGxg9AhSBEJONhFhG52UCuFDjq5dxD8" +
- "FwoO0qGDOBQkl7vLOeWa2EQDffDBvTu+373Hu1OEEJgntGgxGD6J+7fLXKbt5VNUyhsKAChRBQcP" +
- "FVFeWskFGH694mZroCQqCLlAwPxcgJBP254CmAD5B7C7dgHLMLF3uzoL4DQEod+Z5sP1FizDxGgy" +
- "BqfhLID9AahX29J89bwPFgMsSEAQglAf9WobhPpScbPXr4FQHyzIADTsDizDRMPuIOC+zEeTMZo9" +
- "BwH3EfAMACccbtfGaDKGZZg423yUZrdrg3EqxQlPr0BTdTR7joREN2uqnlBmCwW1hIJagtev4f3z" +
- "A16/JvfiigMSYyzqJXlw/XKUyOORMUaBor6YavgdjKa8xGOnidadmwtwsnMu18q83/kHSou+bFND" +
- "Dr4AAAAASUVORK5CYII=";
-
-let testDriver;
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testNetworkPanel);
- }, true);
-}
-
-function testNetworkPanel() {
- testDriver = testGen();
- testDriver.next();
-}
-
-function checkIsVisible(aPanel, aList) {
- for (let id in aList) {
- let node = aPanel.document.getElementById(id);
- let isVisible = aList[id];
- is(node.style.display, (isVisible ? "block" : "none"), id + " isVisible=" + isVisible);
- }
-}
-
-function checkNodeContent(aPanel, aId, aContent) {
- let node = aPanel.document.getElementById(aId);
- if (node == null) {
- ok(false, "Tried to access node " + aId + " that doesn't exist!");
- }
- else if (node.textContent.indexOf(aContent) != -1) {
- ok(true, "checking content of " + aId);
- }
- else {
- ok(false, "Got false value for " + aId + ": " + node.textContent + " doesn't have " + aContent);
- }
-}
-
-function checkNodeKeyValue(aPanel, aId, aKey, aValue) {
- let node = aPanel.document.getElementById(aId);
-
- let headers = node.querySelectorAll("th");
- for (let i = 0; i < headers.length; i++) {
- if (headers[i].textContent == (aKey + ":")) {
- is(headers[i].nextElementSibling.textContent, aValue,
- "checking content of " + aId + " for key " + aKey);
- return;
- }
- }
-
- ok(false, "content check failed for " + aId + ", key " + aKey);
-}
-
-function testGen() {
- let hud = HUDService.getHudByWindow(content);
- let filterBox = hud.ui.filterBox;
-
- let httpActivity = {
- updates: [],
- discardRequestBody: true,
- discardResponseBody: true,
- startedDateTime: (new Date()).toISOString(),
- request: {
- url: "http://www.testpage.com",
- method: "GET",
- cookies: [],
- headers: [
- { name: "foo", value: "bar" },
- ],
- },
- response: {
- headers: [],
- content: {},
- cookies: [],
- },
- timings: {},
- };
-
- let networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
-
- is(filterBox._netPanel, networkPanel,
- "Network panel stored on the anchor object");
-
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- info("test 1");
-
- checkIsVisible(networkPanel, {
- requestCookie: false,
- requestFormData: false,
- requestBody: false,
- responseContainer: false,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- checkNodeContent(networkPanel, "header", "http://www.testpage.com");
- checkNodeContent(networkPanel, "header", "GET");
- checkNodeKeyValue(networkPanel, "requestHeadersContent", "foo", "bar");
-
- // Test request body.
- info("test 2: request body");
- httpActivity.discardRequestBody = false;
- httpActivity.request.postData = { text: "hello world" };
- networkPanel.update();
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: false,
- responseContainer: false,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
- checkNodeContent(networkPanel, "requestBodyContent", "hello world");
-
- // Test response header.
- info("test 3: response header");
- httpActivity.timings.wait = 10;
- httpActivity.response.httpVersion = "HTTP/3.14";
- httpActivity.response.status = 999;
- httpActivity.response.statusText = "earthquake win";
- httpActivity.response.content.mimeType = "text/html";
- httpActivity.response.headers.push(
- { name: "Content-Type", value: "text/html" },
- { name: "leaveHouses", value: "true" }
- );
-
- networkPanel.update();
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: false,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- checkNodeContent(networkPanel, "header", "HTTP/3.14 999 earthquake win");
- checkNodeKeyValue(networkPanel, "responseHeadersContent", "leaveHouses", "true");
- checkNodeContent(networkPanel, "responseHeadersInfo", "10ms");
-
- info("test 4");
-
- httpActivity.discardResponseBody = false;
- httpActivity.timings.receive = 2;
- networkPanel.update();
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestCookie: false,
- requestFormData: false,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- info("test 5");
-
- httpActivity.updates.push("responseContent", "eventTimings");
- networkPanel.update();
-
- checkNodeContent(networkPanel, "responseNoBodyInfo", "2ms");
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestCookie: false,
- responseContainer: true,
- responseBody: false,
- responseNoBody: true,
- responseImage: false,
- responseImageCached: false
- });
-
- networkPanel.panel.hidePopup();
-
- // Second run: Test for cookies and response body.
- info("test 6: cookies and response body");
- httpActivity.request.cookies.push(
- { name: "foo", value: "bar" },
- { name: "hello", value: "world" }
- );
- httpActivity.response.content.text = "get out here";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- is(filterBox._netPanel, networkPanel,
- "Network panel stored on httpActivity object");
-
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: true,
- responseContainer: true,
- responseCookie: false,
- responseBody: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- checkNodeKeyValue(networkPanel, "requestCookieContent", "foo", "bar");
- checkNodeKeyValue(networkPanel, "requestCookieContent", "hello", "world");
- checkNodeContent(networkPanel, "responseBodyContent", "get out here");
- checkNodeContent(networkPanel, "responseBodyInfo", "2ms");
-
- networkPanel.panel.hidePopup();
-
- // Third run: Test for response cookies.
- info("test 6b: response cookies");
- httpActivity.response.cookies.push(
- { name: "foobar", value: "boom" },
- { name: "foobaz", value: "omg" }
- );
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- is(filterBox._netPanel, networkPanel,
- "Network panel stored on httpActivity object");
-
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: true,
- responseContainer: true,
- responseCookie: true,
- responseBody: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false,
- responseBodyFetchLink: false,
- });
-
- checkNodeKeyValue(networkPanel, "responseCookieContent", "foobar", "boom");
- checkNodeKeyValue(networkPanel, "responseCookieContent", "foobaz", "omg");
-
- networkPanel.panel.hidePopup();
-
- // Check image request.
- info("test 7: image request");
- httpActivity.response.headers[1].value = "image/png";
- httpActivity.response.content.mimeType = "image/png";
- httpActivity.response.content.text = TEST_IMG_BASE64;
- httpActivity.request.url = TEST_IMG;
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: true,
- responseImageCached: false,
- responseBodyFetchLink: false,
- });
-
- let imgNode = networkPanel.document.getElementById("responseImageNode");
- is(imgNode.getAttribute("src"), "data:image/png;base64," + TEST_IMG_BASE64,
- "Displayed image is correct");
-
- function checkImageResponseInfo() {
- checkNodeContent(networkPanel, "responseImageInfo", "2ms");
- checkNodeContent(networkPanel, "responseImageInfo", "16x16px");
- }
-
- // Check if the image is loaded already.
- imgNode.addEventListener("load", function onLoad() {
- imgNode.removeEventListener("load", onLoad, false);
- checkImageResponseInfo();
- networkPanel.panel.hidePopup();
- testDriver.next();
- }, false);
- yield;
-
- // Check cached image request.
- info("test 8: cached image request");
- httpActivity.response.httpVersion = "HTTP/1.1";
- httpActivity.response.status = 304;
- httpActivity.response.statusText = "Not Modified";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: true,
- requestFormData: false,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: true
- });
-
- let imgNode = networkPanel.document.getElementById("responseImageCachedNode");
- is(imgNode.getAttribute("src"), "data:image/png;base64," + TEST_IMG_BASE64,
- "Displayed image is correct");
-
- networkPanel.panel.hidePopup();
-
- // Test sent form data.
- info("test 9: sent form data");
- httpActivity.request.postData.text = [
- "Content-Type: application/x-www-form-urlencoded",
- "Content-Length: 59",
- "name=rob&age=20"
- ].join("\n");
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: false,
- requestFormData: true,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: true
- });
-
- checkNodeKeyValue(networkPanel, "requestFormDataContent", "name", "rob");
- checkNodeKeyValue(networkPanel, "requestFormDataContent", "age", "20");
- networkPanel.panel.hidePopup();
-
- // Test no space after Content-Type:
- info("test 10: no space after Content-Type header in post data");
- httpActivity.request.postData.text = "Content-Type:application/x-www-form-urlencoded\n";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: false,
- requestFormData: true,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: true
- });
-
- networkPanel.panel.hidePopup();
-
- // Test cached data.
-
- info("test 11: cached data");
-
- httpActivity.request.url = TEST_ENCODING_ISO_8859_1;
- httpActivity.response.headers[1].value = "application/json";
- httpActivity.response.content.mimeType = "application/json";
- httpActivity.response.content.text = "my cached data is here!";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: false,
- requestFormData: true,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseBodyCached: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- checkNodeContent(networkPanel, "responseBodyCachedContent",
- "my cached data is here!");
-
- networkPanel.panel.hidePopup();
-
- // Test a response with a content type that can't be displayed in the
- // NetworkPanel.
- info("test 12: unknown content type");
- httpActivity.response.headers[1].value = "application/x-shockwave-flash";
- httpActivity.response.content.mimeType = "application/x-shockwave-flash";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel._onUpdate = function() {
- networkPanel._onUpdate = null;
- executeSoon(function() {
- testDriver.next();
- });
- };
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: false,
- requestFormData: true,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseBodyCached: false,
- responseBodyUnknownType: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- let responseString =
- WCU_l10n.getFormatStr("NetworkPanel.responseBodyUnableToDisplay.content",
- ["application/x-shockwave-flash"]);
- checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString);
- networkPanel.panel.hidePopup();
-
- /*
-
- // This test disabled. See bug 603620.
-
- // Test if the NetworkPanel figures out the content type based on an URL as
- // well.
- delete httpActivity.response.header["Content-Type"];
- httpActivity.url = "http://www.test.com/someCrazyFile.swf?done=right&ending=txt";
-
- networkPanel = hud.ui.openNetworkPanel(filterBox, httpActivity);
- networkPanel.isDoneCallback = function NP_doneCallback() {
- networkPanel.isDoneCallback = null;
- testDriver.next();
- }
-
- yield;
-
- checkIsVisible(networkPanel, {
- requestBody: false,
- requestFormData: true,
- requestCookie: true,
- responseContainer: true,
- responseBody: false,
- responseBodyCached: false,
- responseBodyUnknownType: true,
- responseNoBody: false,
- responseImage: false,
- responseImageCached: false
- });
-
- // Systems without Flash installed will return an empty string here. Ignore.
- if (networkPanel.document.getElementById("responseBodyUnknownTypeContent").textContent !== "")
- checkNodeContent(networkPanel, "responseBodyUnknownTypeContent", responseString);
- else
- ok(true, "Flash not installed");
-
- networkPanel.panel.hidePopup(); */
-
- // All done!
- testDriver = null;
- executeSoon(finishTest);
-
- yield;
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_notifications.js b/browser/devtools/webconsole/test/browser_webconsole_notifications.js
deleted file mode 100644
index c70605635..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_notifications.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for notifications";
-
-function test() {
- observer.init();
- addTab(TEST_URI);
- browser.addEventListener("load", onLoad, true);
-}
-
-function webConsoleCreated(aID)
-{
- Services.obs.removeObserver(observer, "web-console-created");
- ok(HUDService.hudReferences[aID], "We have a hud reference");
- content.wrappedJSObject.console.log("adding a log message");
-}
-
-function webConsoleDestroyed(aID)
-{
- Services.obs.removeObserver(observer, "web-console-destroyed");
- ok(!HUDService.hudReferences[aID], "We do not have a hud reference");
- executeSoon(finishTest);
-}
-
-function webConsoleMessage(aID, aNodeID)
-{
- Services.obs.removeObserver(observer, "web-console-message-created");
- ok(aID, "we have a console ID");
- is(typeof aNodeID, "string", "message node id is a string");
- executeSoon(closeConsole);
-}
-
-let observer = {
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- observe: function observe(aSubject, aTopic, aData)
- {
- aSubject = aSubject.QueryInterface(Ci.nsISupportsString);
-
- switch(aTopic) {
- case "web-console-created":
- webConsoleCreated(aSubject);
- break;
- case "web-console-destroyed":
- webConsoleDestroyed(aSubject);
- break;
- case "web-console-message-created":
- webConsoleMessage(aSubject, aData);
- break;
- default:
- break;
- }
- },
-
- init: function init()
- {
- Services.obs.addObserver(this, "web-console-created", false);
- Services.obs.addObserver(this, "web-console-destroyed", false);
- Services.obs.addObserver(this, "web-console-message-created", false);
- }
-};
-
-function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole();
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_null_and_undefined_output.js b/browser/devtools/webconsole/test/browser_webconsole_null_and_undefined_output.js
deleted file mode 100644
index fff74534a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_null_and_undefined_output.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Test that JavaScript expressions that evaluate to null or undefined produce
-// meaningful output.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testNullAndUndefinedOutput);
- }, true);
-}
-
-function testNullAndUndefinedOutput(hud) {
- let jsterm = hud.jsterm;
- let outputNode = jsterm.outputNode;
-
- jsterm.clearOutput();
- jsterm.execute("null;");
-
- waitForSuccess({
- name: "null displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-msg-node").length == 2;
- },
- successFn: function()
- {
- let nodes = outputNode.querySelectorAll(".hud-msg-node");
- isnot(nodes[1].textContent.indexOf("null"), -1,
- "'null' printed to output");
-
- jsterm.clearOutput();
- jsterm.execute("undefined;");
- waitForSuccess(waitForUndefined);
- },
- failureFn: finishTest,
- });
-
- let waitForUndefined = {
- name: "undefined displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-msg-node").length == 2;
- },
- successFn: function()
- {
- let nodes = outputNode.querySelectorAll(".hud-msg-node");
- isnot(nodes[1].textContent.indexOf("undefined"), -1,
- "'undefined' printed to output");
-
- finishTest();
- },
- failureFn: finishTest,
- };
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_output_order.js b/browser/devtools/webconsole/test/browser_webconsole_output_order.js
deleted file mode 100644
index 63e9ecd6a..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_output_order.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests that any output created from calls to the console API comes after the
-// echoed JavaScript.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, testOutputOrder);
- }, true);
-}
-
-function testOutputOrder(hud) {
- let jsterm = hud.jsterm;
- let outputNode = jsterm.outputNode;
-
- jsterm.clearOutput();
- jsterm.execute("console.log('foo', 'bar');");
-
- waitForSuccess({
- name: "console.log message displayed",
- validatorFn: function()
- {
- return outputNode.querySelectorAll(".hud-msg-node").length == 3;
- },
- successFn: function()
- {
- let nodes = outputNode.querySelectorAll(".hud-msg-node");
- let executedStringFirst =
- /console\.log\('foo', 'bar'\);/.test(nodes[0].textContent);
- let outputSecond = /"foo" "bar"/.test(nodes[2].textContent);
- ok(executedStringFirst && outputSecond, "executed string comes first");
-
- finishTest();
- },
- failureFn: finishTest,
- });
-}
diff --git a/browser/devtools/webconsole/test/browser_webconsole_property_provider.js b/browser/devtools/webconsole/test/browser_webconsole_property_provider.js
deleted file mode 100644
index 9d36a98ba..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_property_provider.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Tests the property provider, which is part of the code completion
-// infrastructure.
-
-const TEST_URI = "data:text/html;charset=utf8,<p>test the JS property provider";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", testPropertyProvider, true);
-}
-
-function testPropertyProvider() {
- browser.removeEventListener("load", testPropertyProvider, true);
-
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm", tmp);
- let JSPropertyProvider = tmp.JSPropertyProvider;
- tmp = null;
-
- let completion = JSPropertyProvider(content, "thisIsNotDefined");
- is (completion.matches.length, 0, "no match for 'thisIsNotDefined");
-
- // This is a case the PropertyProvider can't handle. Should return null.
- completion = JSPropertyProvider(content, "window[1].acb");
- is (completion, null, "no match for 'window[1].acb");
-
- // A very advanced completion case.
- var strComplete =
- 'function a() { }document;document.getElementById(window.locatio';
- completion = JSPropertyProvider(content, strComplete);
- ok(completion.matches.length == 2, "two matches found");
- ok(completion.matchProp == "locatio", "matching part is 'test'");
- ok(completion.matches[0] == "location", "the first match is 'location'");
- ok(completion.matches[1] == "locationbar", "the second match is 'locationbar'");
-
- finishTest();
-}
-
diff --git a/browser/devtools/webconsole/test/browser_webconsole_view_source.js b/browser/devtools/webconsole/test/browser_webconsole_view_source.js
deleted file mode 100644
index b4fe223be..000000000
--- a/browser/devtools/webconsole/test/browser_webconsole_view_source.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests that source URLs in the Web Console can be clicked to display the
-// standard View Source window.
-
-const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-error.html";
-
-function test() {
- addTab(TEST_URI);
- browser.addEventListener("load", function onLoad() {
- browser.removeEventListener("load", onLoad, true);
- openConsole(null, function(hud) {
- executeSoon(function() {
- testViewSource(hud);
- });
- });
- }, true);
-}
-
-function testViewSource(hud) {
- let button = content.document.querySelector("button");
- button = XPCNativeWrapper.unwrap(button);
- ok(button, "we have the button on the page");
-
- expectUncaughtException();
- EventUtils.sendMouseEvent({ type: "click" }, button, XPCNativeWrapper.unwrap(content));
-
- waitForSuccess({
- name: "find the location node",
- validatorFn: function()
- {
- return hud.outputNode.querySelector(".webconsole-location");
- },
- successFn: function()
- {
- let locationNode = hud.outputNode.querySelector(".webconsole-location");
-
- Services.ww.registerNotification(observer);
-
- EventUtils.sendMouseEvent({ type: "click" }, locationNode);
- },
- failureFn: finishTest,
- });
-}
-
-let observer = {
- observe: function(aSubject, aTopic, aData) {
- if (aTopic != "domwindowopened") {
- return;
- }
-
- ok(true, "the view source window was opened in response to clicking " +
- "the location node");
-
- // executeSoon() is necessary to avoid crashing Firefox. See bug 611543.
- executeSoon(function() {
- aSubject.close();
- finishTest();
- });
- }
-};
-
-registerCleanupFunction(function() {
- Services.ww.unregisterNotification(observer);
-});
diff --git a/browser/devtools/webconsole/test/head.js b/browser/devtools/webconsole/test/head.js
deleted file mode 100644
index 0f90d37fb..000000000
--- a/browser/devtools/webconsole/test/head.js
+++ /dev/null
@@ -1,1247 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-let tempScope = {};
-Cu.import("resource:///modules/HUDService.jsm", tempScope);
-let HUDService = tempScope.HUDService;
-Cu.import("resource://gre/modules/devtools/WebConsoleUtils.jsm", tempScope);
-let WebConsoleUtils = tempScope.WebConsoleUtils;
-Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
-let gDevTools = tempScope.gDevTools;
-Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
-let TargetFactory = tempScope.devtools.TargetFactory;
-Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
-let console = tempScope.console;
-let Promise = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}).Promise;
-
-let gPendingOutputTest = 0;
-
-// The various categories of messages.
-const CATEGORY_NETWORK = 0;
-const CATEGORY_CSS = 1;
-const CATEGORY_JS = 2;
-const CATEGORY_WEBDEV = 3;
-const CATEGORY_INPUT = 4;
-const CATEGORY_OUTPUT = 5;
-const CATEGORY_SECURITY = 6;
-
-// The possible message severities.
-const SEVERITY_ERROR = 0;
-const SEVERITY_WARNING = 1;
-const SEVERITY_INFO = 2;
-const SEVERITY_LOG = 3;
-
-const WEBCONSOLE_STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
-let WCU_l10n = new WebConsoleUtils.l10n(WEBCONSOLE_STRINGS_URI);
-
-function log(aMsg)
-{
- dump("*** WebConsoleTest: " + aMsg + "\n");
-}
-
-function pprint(aObj)
-{
- for (let prop in aObj) {
- if (typeof aObj[prop] == "function") {
- log("function " + prop);
- }
- else {
- log(prop + ": " + aObj[prop]);
- }
- }
-}
-
-let tab, browser, hudId, hud, hudBox, filterBox, outputNode, cs;
-
-function addTab(aURL)
-{
- gBrowser.selectedTab = gBrowser.addTab(aURL);
- tab = gBrowser.selectedTab;
- browser = gBrowser.getBrowserForTab(tab);
-}
-
-function afterAllTabsLoaded(callback, win) {
- win = win || window;
-
- let stillToLoad = 0;
-
- function onLoad() {
- this.removeEventListener("load", onLoad, true);
- stillToLoad--;
- if (!stillToLoad)
- callback();
- }
-
- for (let a = 0; a < win.gBrowser.tabs.length; a++) {
- let browser = win.gBrowser.tabs[a].linkedBrowser;
- if (browser.contentDocument.readyState != "complete") {
- stillToLoad++;
- browser.addEventListener("load", onLoad, true);
- }
- }
-
- if (!stillToLoad)
- callback();
-}
-
-/**
- * Check if a log entry exists in the HUD output node.
- *
- * @param {Element} aOutputNode
- * the HUD output node.
- * @param {string} aMatchString
- * the string you want to check if it exists in the output node.
- * @param {string} aMsg
- * the message describing the test
- * @param {boolean} [aOnlyVisible=false]
- * find only messages that are visible, not hidden by the filter.
- * @param {boolean} [aFailIfFound=false]
- * fail the test if the string is found in the output node.
- * @param {string} aClass [optional]
- * find only messages with the given CSS class.
- */
-function testLogEntry(aOutputNode, aMatchString, aMsg, aOnlyVisible,
- aFailIfFound, aClass)
-{
- let selector = ".hud-msg-node";
- // Skip entries that are hidden by the filter.
- if (aOnlyVisible) {
- selector += ":not(.hud-filtered-by-type)";
- }
- if (aClass) {
- selector += "." + aClass;
- }
-
- let msgs = aOutputNode.querySelectorAll(selector);
- let found = false;
- for (let i = 0, n = msgs.length; i < n; i++) {
- let message = msgs[i].textContent.indexOf(aMatchString);
- if (message > -1) {
- found = true;
- break;
- }
-
- // Search the labels too.
- let labels = msgs[i].querySelectorAll("label");
- for (let j = 0; j < labels.length; j++) {
- if (labels[j].getAttribute("value").indexOf(aMatchString) > -1) {
- found = true;
- break;
- }
- }
- }
-
- is(found, !aFailIfFound, aMsg);
-}
-
-/**
- * A convenience method to call testLogEntry().
- *
- * @param string aString
- * The string to find.
- */
-function findLogEntry(aString)
-{
- testLogEntry(outputNode, aString, "found " + aString);
-}
-
-/**
- * Open the Web Console for the given tab.
- *
- * @param nsIDOMElement [aTab]
- * Optional tab element for which you want open the Web Console. The
- * default tab is taken from the global variable |tab|.
- * @param function [aCallback]
- * Optional function to invoke after the Web Console completes
- * initialization (web-console-created).
- */
-function openConsole(aTab, aCallback = function() { })
-{
- let target = TargetFactory.forTab(aTab || tab);
- gDevTools.showToolbox(target, "webconsole").then(function(toolbox) {
- let hud = toolbox.getCurrentPanel().hud;
- hud.jsterm._lazyVariablesView = false;
- aCallback(hud);
- });
-}
-
-/**
- * Close the Web Console for the given tab.
- *
- * @param nsIDOMElement [aTab]
- * Optional tab element for which you want close the Web Console. The
- * default tab is taken from the global variable |tab|.
- * @param function [aCallback]
- * Optional function to invoke after the Web Console completes
- * closing (web-console-destroyed).
- */
-function closeConsole(aTab, aCallback = function() { })
-{
- let target = TargetFactory.forTab(aTab || tab);
- let toolbox = gDevTools.getToolbox(target);
- if (toolbox) {
- let panel = toolbox.getPanel("webconsole");
- if (panel) {
- let hudId = panel.hud.hudId;
- toolbox.destroy().then(aCallback.bind(null, hudId)).then(null, console.debug);
- }
- else {
- toolbox.destroy().then(aCallback.bind(null));
- }
- }
- else {
- aCallback();
- }
-}
-
-/**
- * Wait for a context menu popup to open.
- *
- * @param nsIDOMElement aPopup
- * The XUL popup you expect to open.
- * @param nsIDOMElement aButton
- * The button/element that receives the contextmenu event. This is
- * expected to open the popup.
- * @param function aOnShown
- * Function to invoke on popupshown event.
- * @param function aOnHidden
- * Function to invoke on popuphidden event.
- */
-function waitForContextMenu(aPopup, aButton, aOnShown, aOnHidden)
-{
- function onPopupShown() {
- info("onPopupShown");
- aPopup.removeEventListener("popupshown", onPopupShown);
-
- aOnShown();
-
- // Use executeSoon() to get out of the popupshown event.
- aPopup.addEventListener("popuphidden", onPopupHidden);
- executeSoon(() => aPopup.hidePopup());
- }
- function onPopupHidden() {
- info("onPopupHidden");
- aPopup.removeEventListener("popuphidden", onPopupHidden);
- aOnHidden();
- }
-
- aPopup.addEventListener("popupshown", onPopupShown);
-
- info("wait for the context menu to open");
- let eventDetails = { type: "contextmenu", button: 2};
- EventUtils.synthesizeMouse(aButton, 2, 2, eventDetails,
- aButton.ownerDocument.defaultView);
-}
-
-/**
- * Dump the output of all open Web Consoles - used only for debugging purposes.
- */
-function dumpConsoles()
-{
- if (gPendingOutputTest) {
- console.log("dumpConsoles start");
- for each (let hud in HUDService.hudReferences) {
- if (!hud.outputNode) {
- console.debug("no output content for", hud.hudId);
- continue;
- }
-
- console.debug("output content for", hud.hudId);
- for (let elem of hud.outputNode.childNodes) {
- dumpMessageElement(elem);
- }
- }
- console.log("dumpConsoles end");
-
- gPendingOutputTest = 0;
- }
-}
-
-/**
- * Dump to output debug information for the given webconsole message.
- *
- * @param nsIDOMNode aMessage
- * The message element you want to display.
- */
-function dumpMessageElement(aMessage)
-{
- let text = getMessageElementText(aMessage);
- let repeats = aMessage.querySelector(".webconsole-msg-repeat");
- if (repeats) {
- repeats = repeats.getAttribute("value");
- }
- console.debug("id", aMessage.getAttribute("id"),
- "date", aMessage.timestamp,
- "class", aMessage.className,
- "category", aMessage.category,
- "severity", aMessage.severity,
- "repeats", repeats,
- "clipboardText", aMessage.clipboardText,
- "text", text);
-}
-
-function finishTest()
-{
- browser = hudId = hud = filterBox = outputNode = cs = null;
-
- dumpConsoles();
-
- if (HUDConsoleUI.browserConsole) {
- let hud = HUDConsoleUI.browserConsole;
-
- if (hud.jsterm) {
- hud.jsterm.clearOutput(true);
- }
-
- HUDConsoleUI.toggleBrowserConsole().then(finishTest);
- return;
- }
-
- let hud = HUDService.getHudByWindow(content);
- if (!hud) {
- finish();
- return;
- }
-
- if (hud.jsterm) {
- hud.jsterm.clearOutput(true);
- }
-
- closeConsole(hud.target.tab, finish);
-
- hud = null;
-}
-
-function tearDown()
-{
- dumpConsoles();
-
- if (HUDConsoleUI.browserConsole) {
- HUDConsoleUI.toggleBrowserConsole();
- }
-
- let target = TargetFactory.forTab(gBrowser.selectedTab);
- gDevTools.closeToolbox(target);
- while (gBrowser.tabs.length > 1) {
- gBrowser.removeCurrentTab();
- }
- WCU_l10n = tab = browser = hudId = hud = filterBox = outputNode = cs = null;
-}
-
-registerCleanupFunction(tearDown);
-
-waitForExplicitFinish();
-
-/**
- * Polls a given function waiting for it to become true.
- *
- * @param object aOptions
- * Options object with the following properties:
- * - validatorFn
- * A validator function that returns a boolean. This is called every few
- * milliseconds to check if the result is true. When it is true, succesFn
- * is called and polling stops. If validatorFn never returns true, then
- * polling timeouts after several tries and a failure is recorded.
- * - successFn
- * A function called when the validator function returns true.
- * - failureFn
- * A function called if the validator function timeouts - fails to return
- * true in the given time.
- * - name
- * Name of test. This is used to generate the success and failure
- * messages.
- * - timeout
- * Timeout for validator function, in milliseconds. Default is 5000.
- */
-function waitForSuccess(aOptions)
-{
- let start = Date.now();
- let timeout = aOptions.timeout || 5000;
-
- function wait(validatorFn, successFn, failureFn)
- {
- if ((Date.now() - start) > timeout) {
- // Log the failure.
- ok(false, "Timed out while waiting for: " + aOptions.name);
- failureFn(aOptions);
- return;
- }
-
- if (validatorFn(aOptions)) {
- ok(true, aOptions.name);
- successFn();
- }
- else {
- setTimeout(function() wait(validatorFn, successFn, failureFn), 100);
- }
- }
-
- wait(aOptions.validatorFn, aOptions.successFn, aOptions.failureFn);
-}
-
-function openInspector(aCallback, aTab = gBrowser.selectedTab)
-{
- let target = TargetFactory.forTab(aTab);
- gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
- aCallback(toolbox.getCurrentPanel());
- });
-}
-
-/**
- * Find variables or properties in a VariablesView instance.
- *
- * @param object aView
- * The VariablesView instance.
- * @param array aRules
- * The array of rules you want to match. Each rule is an object with:
- * - name (string|regexp): property name to match.
- * - value (string|regexp): property value to match.
- * - isIterator (boolean): check if the property is an iterator.
- * - isGetter (boolean): check if the property is a getter.
- * - isGenerator (boolean): check if the property is a generator.
- * - dontMatch (boolean): make sure the rule doesn't match any property.
- * @param object aOptions
- * Options for matching:
- * - webconsole: the WebConsole instance we work with.
- * @return object
- * A Promise object that is resolved when all the rules complete
- * matching. The resolved callback is given an array of all the rules
- * you wanted to check. Each rule has a new property: |matchedProp|
- * which holds a reference to the Property object instance from the
- * VariablesView. If the rule did not match, then |matchedProp| is
- * undefined.
- */
-function findVariableViewProperties(aView, aRules, aOptions)
-{
- // Initialize the search.
- function init()
- {
- // Separate out the rules that require expanding properties throughout the
- // view.
- let expandRules = [];
- let rules = aRules.filter((aRule) => {
- if (typeof aRule.name == "string" && aRule.name.indexOf(".") > -1) {
- expandRules.push(aRule);
- return false;
- }
- return true;
- });
-
- // Search through the view those rules that do not require any properties to
- // be expanded. Build the array of matchers, outstanding promises to be
- // resolved.
- let outstanding = [];
- finder(rules, aView, outstanding);
-
- // Process the rules that need to expand properties.
- let lastStep = processExpandRules.bind(null, expandRules);
-
- // Return the results - a Promise resolved to hold the updated aRules array.
- let returnResults = onAllRulesMatched.bind(null, aRules);
-
- return Promise.all(outstanding).then(lastStep).then(returnResults);
- }
-
- function onMatch(aProp, aRule, aMatched)
- {
- if (aMatched && !aRule.matchedProp) {
- aRule.matchedProp = aProp;
- }
- }
-
- function finder(aRules, aVar, aPromises)
- {
- for (let [id, prop] in aVar) {
- for (let rule of aRules) {
- let matcher = matchVariablesViewProperty(prop, rule, aOptions);
- aPromises.push(matcher.then(onMatch.bind(null, prop, rule)));
- }
- }
- }
-
- function processExpandRules(aRules)
- {
- let rule = aRules.shift();
- if (!rule) {
- return Promise.resolve(null);
- }
-
- let deferred = Promise.defer();
- let expandOptions = {
- rootVariable: aView,
- expandTo: rule.name,
- webconsole: aOptions.webconsole,
- };
-
- variablesViewExpandTo(expandOptions).then(function onSuccess(aProp) {
- let name = rule.name;
- let lastName = name.split(".").pop();
- rule.name = lastName;
-
- let matched = matchVariablesViewProperty(aProp, rule, aOptions);
- return matched.then(onMatch.bind(null, aProp, rule)).then(function() {
- rule.name = name;
- });
- }, function onFailure() {
- return Promise.resolve(null);
- }).then(processExpandRules.bind(null, aRules)).then(function() {
- deferred.resolve(null);
- });
-
- return deferred.promise;
- }
-
- function onAllRulesMatched(aRules)
- {
- for (let rule of aRules) {
- let matched = rule.matchedProp;
- if (matched && !rule.dontMatch) {
- ok(true, "rule " + rule.name + " matched for property " + matched.name);
- }
- else if (matched && rule.dontMatch) {
- ok(false, "rule " + rule.name + " should not match property " +
- matched.name);
- }
- else {
- ok(rule.dontMatch, "rule " + rule.name + " did not match any property");
- }
- }
- return aRules;
- }
-
- return init();
-}
-
-/**
- * Check if a given Property object from the variables view matches the given
- * rule.
- *
- * @param object aProp
- * The variable's view Property instance.
- * @param object aRule
- * Rules for matching the property. See findVariableViewProperties() for
- * details.
- * @param object aOptions
- * Options for matching. See findVariableViewProperties().
- * @return object
- * A Promise that is resolved when all the checks complete. Resolution
- * result is a boolean that tells your promise callback the match
- * result: true or false.
- */
-function matchVariablesViewProperty(aProp, aRule, aOptions)
-{
- function resolve(aResult) {
- return Promise.resolve(aResult);
- }
-
- if (aRule.name) {
- let match = aRule.name instanceof RegExp ?
- aRule.name.test(aProp.name) :
- aProp.name == aRule.name;
- if (!match) {
- return resolve(false);
- }
- }
-
- if (aRule.value) {
- let displayValue = aProp.displayValue;
- if (aProp.displayValueClassName == "token-string") {
- displayValue = displayValue.substring(1, displayValue.length - 1);
- }
-
- let match = aRule.value instanceof RegExp ?
- aRule.value.test(displayValue) :
- displayValue == aRule.value;
- if (!match) {
- info("rule " + aRule.name + " did not match value, expected '" +
- aRule.value + "', found '" + displayValue + "'");
- return resolve(false);
- }
- }
-
- if ("isGetter" in aRule) {
- let isGetter = !!(aProp.getter && aProp.get("get"));
- if (aRule.isGetter != isGetter) {
- info("rule " + aRule.name + " getter test failed");
- return resolve(false);
- }
- }
-
- if ("isGenerator" in aRule) {
- let isGenerator = aProp.displayValue == "[object Generator]";
- if (aRule.isGenerator != isGenerator) {
- info("rule " + aRule.name + " generator test failed");
- return resolve(false);
- }
- }
-
- let outstanding = [];
-
- if ("isIterator" in aRule) {
- let isIterator = isVariableViewPropertyIterator(aProp, aOptions.webconsole);
- outstanding.push(isIterator.then((aResult) => {
- if (aResult != aRule.isIterator) {
- info("rule " + aRule.name + " iterator test failed");
- }
- return aResult == aRule.isIterator;
- }));
- }
-
- outstanding.push(Promise.resolve(true));
-
- return Promise.all(outstanding).then(function _onMatchDone(aResults) {
- let ruleMatched = aResults.indexOf(false) == -1;
- return resolve(ruleMatched);
- });
-}
-
-/**
- * Check if the given variables view property is an iterator.
- *
- * @param object aProp
- * The Property instance you want to check.
- * @param object aWebConsole
- * The WebConsole instance to work with.
- * @return object
- * A Promise that is resolved when the check completes. The resolved
- * callback is given a boolean: true if the property is an iterator, or
- * false otherwise.
- */
-function isVariableViewPropertyIterator(aProp, aWebConsole)
-{
- if (aProp.displayValue == "[object Iterator]") {
- return Promise.resolve(true);
- }
-
- let deferred = Promise.defer();
-
- variablesViewExpandTo({
- rootVariable: aProp,
- expandTo: "__proto__.__iterator__",
- webconsole: aWebConsole,
- }).then(function onSuccess(aProp) {
- deferred.resolve(true);
- }, function onFailure() {
- deferred.resolve(false);
- });
-
- return deferred.promise;
-}
-
-
-/**
- * Recursively expand the variables view up to a given property.
- *
- * @param aOptions
- * Options for view expansion:
- * - rootVariable: start from the given scope/variable/property.
- * - expandTo: string made up of property names you want to expand.
- * For example: "body.firstChild.nextSibling" given |rootVariable:
- * document|.
- * - webconsole: a WebConsole instance. If this is not provided all
- * property expand() calls will be considered sync. Things may fail!
- * @return object
- * A Promise that is resolved only when the last property in |expandTo|
- * is found, and rejected otherwise. Resolution reason is always the
- * last property - |nextSibling| in the example above. Rejection is
- * always the last property that was found.
- */
-function variablesViewExpandTo(aOptions)
-{
- let root = aOptions.rootVariable;
- let expandTo = aOptions.expandTo.split(".");
- let jsterm = (aOptions.webconsole || {}).jsterm;
- let lastDeferred = Promise.defer();
-
- function fetch(aProp)
- {
- if (!aProp.onexpand) {
- ok(false, "property " + aProp.name + " cannot be expanded: !onexpand");
- return Promise.reject(aProp);
- }
-
- let deferred = Promise.defer();
-
- if (aProp._fetched || !jsterm) {
- executeSoon(function() {
- deferred.resolve(aProp);
- });
- }
- else {
- jsterm.once("variablesview-fetched", function _onFetchProp() {
- executeSoon(() => deferred.resolve(aProp));
- });
- }
-
- aProp.expand();
-
- return deferred.promise;
- }
-
- function getNext(aProp)
- {
- let name = expandTo.shift();
- let newProp = aProp.get(name);
-
- if (expandTo.length > 0) {
- ok(newProp, "found property " + name);
- if (newProp) {
- fetch(newProp).then(getNext, fetchError);
- }
- else {
- lastDeferred.reject(aProp);
- }
- }
- else {
- if (newProp) {
- lastDeferred.resolve(newProp);
- }
- else {
- lastDeferred.reject(aProp);
- }
- }
- }
-
- function fetchError(aProp)
- {
- lastDeferred.reject(aProp);
- }
-
- if (!root._fetched) {
- fetch(root).then(getNext, fetchError);
- }
- else {
- getNext(root);
- }
-
- return lastDeferred.promise;
-}
-
-
-/**
- * Update the content of a property in the variables view.
- *
- * @param object aOptions
- * Options for the property update:
- * - property: the property you want to change.
- * - field: string that tells what you want to change:
- * - use "name" to change the property name,
- * - or "value" to change the property value.
- * - string: the new string to write into the field.
- * - webconsole: reference to the Web Console instance we work with.
- * - callback: function to invoke after the property is updated.
- */
-function updateVariablesViewProperty(aOptions)
-{
- let view = aOptions.property._variablesView;
- view.window.focus();
- aOptions.property.focus();
-
- switch (aOptions.field) {
- case "name":
- EventUtils.synthesizeKey("VK_ENTER", { shiftKey: true }, view.window);
- break;
- case "value":
- EventUtils.synthesizeKey("VK_ENTER", {}, view.window);
- break;
- default:
- throw new Error("options.field is incorrect");
- return;
- }
-
- executeSoon(() => {
- EventUtils.synthesizeKey("A", { accelKey: true }, view.window);
-
- for (let c of aOptions.string) {
- EventUtils.synthesizeKey(c, {}, gVariablesView.window);
- }
-
- if (aOptions.webconsole) {
- aOptions.webconsole.jsterm.once("variablesview-fetched", aOptions.callback);
- }
-
- EventUtils.synthesizeKey("VK_ENTER", {}, view.window);
-
- if (!aOptions.webconsole) {
- executeSoon(aOptions.callback);
- }
- });
-}
-
-/**
- * Open the JavaScript debugger.
- *
- * @param object aOptions
- * Options for opening the debugger:
- * - tab: the tab you want to open the debugger for.
- * @return object
- * A Promise that is resolved once the debugger opens, or rejected if
- * the open fails. The resolution callback is given one argument, an
- * object that holds the following properties:
- * - target: the Target object for the Tab.
- * - toolbox: the Toolbox instance.
- * - panel: the jsdebugger panel instance.
- * - panelWin: the window object of the panel iframe.
- */
-function openDebugger(aOptions = {})
-{
- if (!aOptions.tab) {
- aOptions.tab = gBrowser.selectedTab;
- }
-
- let deferred = Promise.defer();
-
- let target = TargetFactory.forTab(aOptions.tab);
- let toolbox = gDevTools.getToolbox(target);
- let dbgPanelAlreadyOpen = toolbox.getPanel("jsdebugger");
-
- gDevTools.showToolbox(target, "jsdebugger").then(function onSuccess(aToolbox) {
- let panel = aToolbox.getCurrentPanel();
- let panelWin = panel.panelWin;
-
- panel._view.Variables.lazyEmpty = false;
- panel._view.Variables.lazyAppend = false;
-
- let resolveObject = {
- target: target,
- toolbox: aToolbox,
- panel: panel,
- panelWin: panelWin,
- };
-
- if (dbgPanelAlreadyOpen) {
- deferred.resolve(resolveObject);
- }
- else {
- panelWin.addEventListener("Debugger:AfterSourcesAdded",
- function onAfterSourcesAdded() {
- panelWin.removeEventListener("Debugger:AfterSourcesAdded",
- onAfterSourcesAdded);
- deferred.resolve(resolveObject);
- });
- }
- }, function onFailure(aReason) {
- console.debug("failed to open the toolbox for 'jsdebugger'", aReason);
- deferred.reject(aReason);
- });
-
- return deferred.promise;
-}
-
-/**
- * Get the full text displayed by a Web Console message.
- *
- * @param nsIDOMElement aElement
- * The message element from the Web Console output.
- * @return string
- * The full text displayed by the given message element.
- */
-function getMessageElementText(aElement)
-{
- let text = aElement.textContent;
- let labels = aElement.querySelectorAll("label");
- for (let label of labels) {
- text += " " + label.getAttribute("value");
- }
- return text;
-}
-
-/**
- * Wait for messages in the Web Console output.
- *
- * @param object aOptions
- * Options for what you want to wait for:
- * - webconsole: the webconsole instance you work with.
- * - messages: an array of objects that tells which messages to wait for.
- * Properties:
- * - text: string or RegExp to match the textContent of each new
- * message.
- * - noText: string or RegExp that must not match in the message
- * textContent.
- * - repeats: the number of message repeats, as displayed by the Web
- * Console.
- * - category: match message category. See CATEGORY_* constants at
- * the top of this file.
- * - severity: match message severity. See SEVERITY_* constants at
- * the top of this file.
- * - count: how many unique web console messages should be matched by
- * this rule.
- * - consoleTrace: boolean, set to |true| to match a console.trace()
- * message. Optionally this can be an object of the form
- * { file, fn, line } that can match the specified file, function
- * and/or line number in the trace message.
- * - consoleTime: string that matches a console.time() timer name.
- * Provide this if you want to match a console.time() message.
- * - consoleTimeEnd: same as above, but for console.timeEnd().
- * - consoleDir: boolean, set to |true| to match a console.dir()
- * message.
- * - longString: boolean, set to |true} to match long strings in the
- * message.
- * - objects: boolean, set to |true| if you expect inspectable
- * objects in the message.
- * - source: object of the shape { url, line }. This is used to
- * match the source URL and line number of the error message or
- * console API call.
- * @return object
- * A Promise object is returned once the messages you want are found.
- * The promise is resolved with the array of rule objects you give in
- * the |messages| property. Each objects is the same as provided, with
- * additional properties:
- * - matched: a Set of web console messages that matched the rule.
- * - clickableElements: a list of inspectable objects. This is available
- * if any of the following properties are present in the rule:
- * |consoleTrace| or |objects|.
- * - longStrings: a list of long string ellipsis elements you can click
- * in the message element, to expand a long string. This is available
- * only if |longString| is present in the matching rule.
- */
-function waitForMessages(aOptions)
-{
- gPendingOutputTest++;
- let webconsole = aOptions.webconsole;
- let rules = WebConsoleUtils.cloneObject(aOptions.messages, true);
- let rulesMatched = 0;
- let listenerAdded = false;
- let deferred = Promise.defer();
-
- function checkText(aRule, aText)
- {
- let result;
- if (typeof aRule == "string") {
- result = aText.indexOf(aRule) > -1;
- }
- else if (aRule instanceof RegExp) {
- result = aRule.test(aText);
- }
- return result;
- }
-
- function checkConsoleTrace(aRule, aElement)
- {
- let elemText = getMessageElementText(aElement);
- let trace = aRule.consoleTrace;
-
- if (!checkText("Stack trace from ", elemText)) {
- return false;
- }
-
- let clickable = aElement.querySelector(".hud-clickable");
- if (!clickable) {
- ok(false, "console.trace() message is missing .hud-clickable");
- displayErrorContext(aRule, aElement);
- return false;
- }
- aRule.clickableElements = [clickable];
-
- if (trace.file &&
- !checkText("from " + trace.file + ", ", elemText)) {
- ok(false, "console.trace() message is missing the file name: " +
- trace.file);
- displayErrorContext(aRule, aElement);
- return false;
- }
-
- if (trace.fn &&
- !checkText(", function " + trace.fn + ", ", elemText)) {
- ok(false, "console.trace() message is missing the function name: " +
- trace.fn);
- displayErrorContext(aRule, aElement);
- return false;
- }
-
- if (trace.line &&
- !checkText(", line " + trace.line + ".", elemText)) {
- ok(false, "console.trace() message is missing the line number: " +
- trace.line);
- displayErrorContext(aRule, aElement);
- return false;
- }
-
- aRule.category = CATEGORY_WEBDEV;
- aRule.severity = SEVERITY_LOG;
-
- return true;
- }
-
- function checkConsoleTime(aRule, aElement)
- {
- let elemText = getMessageElementText(aElement);
- let time = aRule.consoleTime;
-
- if (!checkText(time + ": timer started", elemText)) {
- return false;
- }
-
- aRule.category = CATEGORY_WEBDEV;
- aRule.severity = SEVERITY_LOG;
-
- return true;
- }
-
- function checkConsoleTimeEnd(aRule, aElement)
- {
- let elemText = getMessageElementText(aElement);
- let time = aRule.consoleTimeEnd;
- let regex = new RegExp(time + ": -?\\d+ms");
-
- if (!checkText(regex, elemText)) {
- return false;
- }
-
- aRule.category = CATEGORY_WEBDEV;
- aRule.severity = SEVERITY_LOG;
-
- return true;
- }
-
- function checkConsoleDir(aRule, aElement)
- {
- if (!aElement.classList.contains("webconsole-msg-inspector")) {
- return false;
- }
-
- let elemText = getMessageElementText(aElement);
- if (!checkText(aRule.consoleDir, elemText)) {
- return false;
- }
-
- let iframe = aElement.querySelector("iframe");
- if (!iframe) {
- ok(false, "console.dir message has no iframe");
- return false;
- }
-
- return true;
- }
-
- function checkSource(aRule, aElement)
- {
- let location = aElement.querySelector(".webconsole-location");
- if (!location) {
- return false;
- }
-
- if (!checkText(aRule.source.url, location.getAttribute("title"))) {
- return false;
- }
-
- if ("line" in aRule.source && location.sourceLine != aRule.source.line) {
- return false;
- }
-
- return true;
- }
-
- function checkMessage(aRule, aElement)
- {
- let elemText = getMessageElementText(aElement);
-
- if (aRule.text && !checkText(aRule.text, elemText)) {
- return false;
- }
-
- if (aRule.noText && checkText(aRule.noText, elemText)) {
- return false;
- }
-
- if (aRule.consoleTrace && !checkConsoleTrace(aRule, aElement)) {
- return false;
- }
-
- if (aRule.consoleTime && !checkConsoleTime(aRule, aElement)) {
- return false;
- }
-
- if (aRule.consoleTimeEnd && !checkConsoleTimeEnd(aRule, aElement)) {
- return false;
- }
-
- if (aRule.consoleDir && !checkConsoleDir(aRule, aElement)) {
- return false;
- }
-
- if (aRule.source && !checkSource(aRule, aElement)) {
- return false;
- }
-
- let partialMatch = !!(aRule.consoleTrace || aRule.consoleTime ||
- aRule.consoleTimeEnd);
-
- if (aRule.category && aElement.category != aRule.category) {
- if (partialMatch) {
- is(aElement.category, aRule.category,
- "message category for rule: " + displayRule(aRule));
- displayErrorContext(aRule, aElement);
- }
- return false;
- }
-
- if (aRule.severity && aElement.severity != aRule.severity) {
- if (partialMatch) {
- is(aElement.severity, aRule.severity,
- "message severity for rule: " + displayRule(aRule));
- displayErrorContext(aRule, aElement);
- }
- return false;
- }
-
- if (aRule.repeats) {
- let repeats = aElement.querySelector(".webconsole-msg-repeat");
- if (!repeats || repeats.getAttribute("value") != aRule.repeats) {
- return false;
- }
- }
-
- if ("longString" in aRule) {
- let longStrings = aElement.querySelectorAll(".longStringEllipsis");
- if (aRule.longString != !!longStrings[0]) {
- if (partialMatch) {
- is(!!longStrings[0], aRule.longString,
- "long string existence check failed for message rule: " +
- displayRule(aRule));
- displayErrorContext(aRule, aElement);
- }
- return false;
- }
- aRule.longStrings = longStrings;
- }
-
- if ("objects" in aRule) {
- let clickables = aElement.querySelectorAll(".hud-clickable");
- if (aRule.objects != !!clickables[0]) {
- if (partialMatch) {
- is(!!clickables[0], aRule.objects,
- "objects existence check failed for message rule: " +
- displayRule(aRule));
- displayErrorContext(aRule, aElement);
- }
- return false;
- }
- aRule.clickableElements = clickables;
- }
-
- let count = aRule.count || 1;
- if (!aRule.matched) {
- aRule.matched = new Set();
- }
- aRule.matched.add(aElement);
-
- return aRule.matched.size == count;
- }
-
- function onMessagesAdded(aEvent, aNewElements)
- {
- for (let elem of aNewElements) {
- let location = elem.querySelector(".webconsole-location");
- if (location) {
- let url = location.getAttribute("title");
- // Prevent recursion with the browser console and any potential
- // messages coming from head.js.
- if (url.indexOf("browser/devtools/webconsole/test/head.js") != -1) {
- continue;
- }
- }
-
- for (let rule of rules) {
- if (rule._ruleMatched) {
- continue;
- }
-
- let matched = checkMessage(rule, elem);
- if (matched) {
- rule._ruleMatched = true;
- rulesMatched++;
- ok(1, "matched rule: " + displayRule(rule));
- if (maybeDone()) {
- return;
- }
- }
- }
- }
- }
-
- function maybeDone()
- {
- if (rulesMatched == rules.length) {
- if (listenerAdded) {
- webconsole.ui.off("messages-added", onMessagesAdded);
- webconsole.ui.off("messages-updated", onMessagesAdded);
- }
- gPendingOutputTest--;
- deferred.resolve(rules);
- return true;
- }
- return false;
- }
-
- function testCleanup() {
- if (rulesMatched == rules.length) {
- return;
- }
-
- if (webconsole.ui) {
- webconsole.ui.off("messages-added", onMessagesAdded);
- }
-
- for (let rule of rules) {
- if (!rule._ruleMatched) {
- ok(false, "failed to match rule: " + displayRule(rule));
- }
- }
- }
-
- function displayRule(aRule)
- {
- return aRule.name || aRule.text;
- }
-
- function displayErrorContext(aRule, aElement)
- {
- console.log("error occured during rule " + displayRule(aRule));
- console.log("while checking the following message");
- dumpMessageElement(aElement);
- }
-
- executeSoon(() => {
- onMessagesAdded("messages-added", webconsole.outputNode.childNodes);
- if (rulesMatched != rules.length) {
- listenerAdded = true;
- registerCleanupFunction(testCleanup);
- webconsole.ui.on("messages-added", onMessagesAdded);
- webconsole.ui.on("messages-updated", onMessagesAdded);
- }
- });
-
- return deferred.promise;
-}
-
-
-/**
- * Scroll the Web Console output to the given node.
- *
- * @param nsIDOMNode aNode
- * The node to scroll to.
- */
-function scrollOutputToNode(aNode)
-{
- let richListBoxNode = aNode.parentNode;
- while (richListBoxNode.tagName != "richlistbox") {
- richListBoxNode = richListBoxNode.parentNode;
- }
-
- let boxObject = richListBoxNode.scrollBoxObject;
- let nsIScrollBoxObject = boxObject.QueryInterface(Ci.nsIScrollBoxObject);
- nsIScrollBoxObject.ensureElementIsVisible(aNode);
-}
-
-function whenDelayedStartupFinished(aWindow, aCallback)
-{
- Services.obs.addObserver(function observer(aSubject, aTopic) {
- if (aWindow == aSubject) {
- Services.obs.removeObserver(observer, aTopic);
- executeSoon(aCallback);
- }
- }, "browser-delayed-startup-finished", false);
-}
diff --git a/browser/devtools/webconsole/test/moz.build b/browser/devtools/webconsole/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/devtools/webconsole/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/devtools/webconsole/test/test-bug-585956-console-trace.html b/browser/devtools/webconsole/test/test-bug-585956-console-trace.html
deleted file mode 100644
index e658ba633..000000000
--- a/browser/devtools/webconsole/test/test-bug-585956-console-trace.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head><meta charset="utf-8">
- <title>Web Console test for bug 585956 - console.trace()</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="application/javascript">
-window.foobar585956c = function(a) {
- console.trace();
- return a+"c";
-};
-
-function foobar585956b(a) {
- return foobar585956c(a+"b");
-}
-
-function foobar585956a(omg) {
- return foobar585956b(omg + "a");
-}
-
-foobar585956a("omg");
-</script>
- </head>
- <body>
- <p>Web Console test for bug 585956 - console.trace().</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html b/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html
deleted file mode 100644
index ebf9c515f..000000000
--- a/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>WebConsole test: iframe associated to the wrong HUD</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>WebConsole test: iframe associated to the wrong HUD.</p>
- <p>This is the iframe!</p>
- </body>
- </html>
diff --git a/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html b/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html
deleted file mode 100644
index 5b12278d1..000000000
--- a/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>WebConsole test: iframe associated to the wrong HUD</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>WebConsole test: iframe associated to the wrong HUD.</p>
- <iframe
- src="http://example.com/browser/browser/devtools/webconsole/test/test-bug-593003-iframe-wrong-hud-iframe.html"></iframe>
- </body>
- </html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas-css.html b/browser/devtools/webconsole/test/test-bug-595934-canvas-css.html
deleted file mode 100644
index 3c9cf03a5..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-canvas-css.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: CSS Parser (with
- Canvas)</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript"
- src="test-bug-595934-canvas-css.js"></script>
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "CSS Parser" (with
- Canvas).</p>
- <p><canvas width="200" height="200">Canvas support is required!</canvas></p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas-css.js b/browser/devtools/webconsole/test/test-bug-595934-canvas-css.js
deleted file mode 100644
index cc364d6a3..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-canvas-css.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-window.addEventListener("DOMContentLoaded", function() {
- var canvas = document.querySelector("canvas");
- var context = canvas.getContext("2d");
- context.strokeStyle = "foobarCanvasCssParser";
-}, false);
diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas.html b/browser/devtools/webconsole/test/test-bug-595934-canvas.html
deleted file mode 100644
index 399b62098..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-canvas.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: Canvas</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript"
- src="test-bug-595934-canvas.js"></script>
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "Canvas".</p>
- <p><canvas width="200" height="200">Canvas support is required!</canvas></p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas.js b/browser/devtools/webconsole/test/test-bug-595934-canvas.js
deleted file mode 100644
index 7d77d7696..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-canvas.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-window.addEventListener("DOMContentLoaded", function() {
- var canvas = document.querySelector("canvas");
- var context = canvas.getContext("2d");
- context.strokeStyle = document;
-}, false);
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-css-loader.css b/browser/devtools/webconsole/test/test-bug-595934-css-loader.css
deleted file mode 100644
index b4224430f..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-css-loader.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-body {
- color: #0f0;
- font-weight: bold;
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-css-loader.css^headers^ b/browser/devtools/webconsole/test/test-bug-595934-css-loader.css^headers^
deleted file mode 100644
index e7be84a71..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-css-loader.css^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: image/png
diff --git a/browser/devtools/webconsole/test/test-bug-595934-css-loader.html b/browser/devtools/webconsole/test/test-bug-595934-css-loader.html
deleted file mode 100644
index 6bb0d54c5..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-css-loader.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: CSS Loader</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <link rel="stylesheet" href="test-bug-595934-css-loader.css">
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "CSS Loader".</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-css-parser.css b/browser/devtools/webconsole/test/test-bug-595934-css-parser.css
deleted file mode 100644
index f6db82398..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-css-parser.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-p {
- color: #0f0;
- foobarCssParser: failure;
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-css-parser.html b/browser/devtools/webconsole/test/test-bug-595934-css-parser.html
deleted file mode 100644
index a4ea74ba3..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-css-parser.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: CSS Parser</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <link rel="stylesheet" type="text/css"
- href="test-bug-595934-css-parser.css">
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "CSS Parser".</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.html b/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.html
deleted file mode 100644
index a70f9011b..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: DOM.
- (empty getElementById())</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript"
- src="test-bug-595934-empty-getelementbyid.js"></script>
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "DOM"
- (empty getElementById()).</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.js b/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.js
deleted file mode 100644
index dd94d716d..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-empty-getelementbyid.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-window.addEventListener("load", function() {
- document.getElementById("");
-}, false);
diff --git a/browser/devtools/webconsole/test/test-bug-595934-html.html b/browser/devtools/webconsole/test/test-bug-595934-html.html
deleted file mode 100644
index fe35afef6..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-html.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: HTML</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "HTML".</p>
- <form action="?" enctype="multipart/form-data">
- <p><label>Input <input type="text" value="test value"></label></p>
- </form>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-image.html b/browser/devtools/webconsole/test/test-bug-595934-image.html
deleted file mode 100644
index 312ecd49f..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-image.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: Image</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category Image.</p>
- <p><img src="test-bug-595934-image.jpg" alt="corrupted image"></p>
- </body>
-</html>
-
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-image.jpg b/browser/devtools/webconsole/test/test-bug-595934-image.jpg
deleted file mode 100644
index 947e5f11b..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-image.jpg
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/webconsole/test/test-bug-595934-imagemap.html b/browser/devtools/webconsole/test/test-bug-595934-imagemap.html
deleted file mode 100644
index 007c3c01b..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-imagemap.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: ImageMap</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "ImageMap".</p>
- <p><img src="test-image.png" usemap="#testMap" alt="Test image"></p>
- <map name="testMap">
- <area shape="rect" coords="0,0,10,10,5" href="#" alt="Test area" />
- </map>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.html b/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.html
deleted file mode 100644
index 2fd8beac5..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: malformed-xml.
- (external file)</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript"><!--
- var req = new XMLHttpRequest();
- req.open("GET", "test-bug-595934-malformedxml-external.xml", true);
- req.send(null);
- // --></script>
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "malformed-xml"
- (external file).</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.xml b/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.xml
deleted file mode 100644
index 4812786f1..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-malformedxml-external.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "malformed-xml".</p>
- </body>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-malformedxml.xhtml b/browser/devtools/webconsole/test/test-bug-595934-malformedxml.xhtml
deleted file mode 100644
index 62689c567..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-malformedxml.xhtml
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>Web Console test for bug 595934 - category: malformed-xml</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "malformed-xml".</p>
- </body>
diff --git a/browser/devtools/webconsole/test/test-bug-595934-svg.xhtml b/browser/devtools/webconsole/test/test-bug-595934-svg.xhtml
deleted file mode 100644
index 572382c64..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-svg.xhtml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>Web Console test for bug 595934 - category: SVG</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - category "SVG".</p>
- <svg version="1.1" width="120" height="fooBarSVG"
- xmlns="http://www.w3.org/2000/svg">
- <ellipse fill="#0f0" stroke="#000" cx="50%"
- cy="50%" rx="50%" ry="50%" />
- </svg>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-workers.html b/browser/devtools/webconsole/test/test-bug-595934-workers.html
deleted file mode 100644
index baf5a6215..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-workers.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 595934 - category: DOM Worker
- javascript</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p id="foobar">Web Console test for bug 595934 - category "DOM Worker
- javascript".</p>
- <script type="text/javascript">
- var myWorker = new Worker("test-bug-595934-workers.js");
- myWorker.postMessage("hello world");
- </script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-595934-workers.js b/browser/devtools/webconsole/test/test-bug-595934-workers.js
deleted file mode 100644
index 4e93c967b..000000000
--- a/browser/devtools/webconsole/test/test-bug-595934-workers.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-onmessage = function() {
- fooBarWorker();
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.html b/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.html
deleted file mode 100644
index 25bdeecc5..000000000
--- a/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
-<!--
- ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK *****
- -->
- <title>Test for bug 597136: external script errors</title>
- </head>
- <body>
- <h1>Test for bug 597136: external script errors</h1>
- <p><button onclick="f()">Click me</button</p>
-
- <script type="text/javascript"
- src="test-bug-597136-external-script-errors.js"></script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.js b/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.js
deleted file mode 100644
index 87c0aff8e..000000000
--- a/browser/devtools/webconsole/test/test-bug-597136-external-script-errors.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- *
- * Contributor(s):
- * Patrick Walton <pcwalton@mozilla.com>
- *
- * ***** END LICENSE BLOCK ***** */
-
-function f() {
- bogus.g();
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html b/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html
deleted file mode 100644
index 68e19e677..000000000
--- a/browser/devtools/webconsole/test/test-bug-597756-reopen-closed-tab.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Bug 597756: test error logging after tab close and reopen</title>
- <!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <h1>Bug 597756: test error logging after tab close and reopen.</h1>
-
- <script type="text/javascript"><!--
- fooBug597756_error.bar();
- // --></script>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs b/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs
deleted file mode 100644
index 2e78d6b7b..000000000
--- a/browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function handleRequest(request, response)
-{
- var Etag = '"4c881ab-b03-435f0a0f9ef00"';
- var IfNoneMatch = request.hasHeader("If-None-Match")
- ? request.getHeader("If-None-Match")
- : "";
-
- var page = "<!DOCTYPE html><html><body><p>hello world!</p></body></html>";
-
- response.setHeader("Etag", Etag, false);
-
- if (IfNoneMatch == Etag) {
- response.setStatusLine(request.httpVersion, "304", "Not Modified");
- }
- else {
- response.setHeader("Content-Type", "text/html", false);
- response.setHeader("Content-Length", page.length + "", false);
- response.write(page);
- }
-}
diff --git a/browser/devtools/webconsole/test/test-bug-600183-charset.html b/browser/devtools/webconsole/test/test-bug-600183-charset.html
deleted file mode 100644
index 040490a6b..000000000
--- a/browser/devtools/webconsole/test/test-bug-600183-charset.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="gb2312">
- <title>Console HTTP test page (chinese)</title>
- </head>
- <body>
- <p>µÄÎʺò!</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-600183-charset.html^headers^ b/browser/devtools/webconsole/test/test-bug-600183-charset.html^headers^
deleted file mode 100644
index 9f3e2302f..000000000
--- a/browser/devtools/webconsole/test/test-bug-600183-charset.html^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: text/html; charset=gb2312
diff --git a/browser/devtools/webconsole/test/test-bug-601177-log-levels.html b/browser/devtools/webconsole/test/test-bug-601177-log-levels.html
deleted file mode 100644
index a59213907..000000000
--- a/browser/devtools/webconsole/test/test-bug-601177-log-levels.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 601177: log levels</title>
- <script src="test-bug-601177-log-levels.js" type="text/javascript"></script>
- <script type="text/javascript"><!--
- window.undefinedPropertyBug601177;
- // --></script>
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <h1>Web Console test for bug 601177: log levels</h1>
- <img src="test-image.png?bug601177">
- <img src="foobar-known-to-fail.png?bug601177">
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-601177-log-levels.js b/browser/devtools/webconsole/test/test-bug-601177-log-levels.js
deleted file mode 100644
index ea37f533d..000000000
--- a/browser/devtools/webconsole/test/test-bug-601177-log-levels.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-foobarBug601177strictError = "strict error";
-
-window.foobarBug601177exception();
diff --git a/browser/devtools/webconsole/test/test-bug-603750-websocket.html b/browser/devtools/webconsole/test/test-bug-603750-websocket.html
deleted file mode 100644
index f0097dd77..000000000
--- a/browser/devtools/webconsole/test/test-bug-603750-websocket.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 603750 - Web Socket errors</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Web Console test for bug 595934 - Web Socket errors.</p>
- <iframe src="data:text/html;charset=utf-8,hello world!"></iframe>
- <script type="text/javascript" src="test-bug-603750-websocket.js"></script>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-603750-websocket.js b/browser/devtools/webconsole/test/test-bug-603750-websocket.js
deleted file mode 100644
index 3746424cc..000000000
--- a/browser/devtools/webconsole/test/test-bug-603750-websocket.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-window.addEventListener("load", function () {
- var ws1 = new WebSocket("ws://0.0.0.0:81");
- ws1.onopen = function() {
- ws1.send("test 1");
- ws1.close();
- };
-
- var ws2 = new window.frames[0].WebSocket("ws://0.0.0.0:82");
- ws2.onopen = function() {
- ws2.send("test 2");
- ws2.close();
- };
-}, false);
diff --git a/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html b/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html
deleted file mode 100644
index edf40e80e..000000000
--- a/browser/devtools/webconsole/test/test-bug-613013-console-api-iframe.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>test for bug 613013</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>test for bug 613013</p>
- <script type="text/javascript"><!--
- (function () {
- var iframe = document.createElement('iframe');
- iframe.src = 'data:text/html;charset=utf-8,little iframe';
- document.body.appendChild(iframe);
-
- console.log("foobarBug613013");
- })();
- // --></script>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html b/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html
deleted file mode 100644
index ac755e1b9..000000000
--- a/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 618078 - exception in async network request
- callback</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- var req = new XMLHttpRequest();
- req.open('GET', 'http://example.com', true);
- req.onreadystatechange = function() {
- if (req.readyState == 4) {
- bug618078exception();
- }
- };
- req.send(null);
- </script>
- </head>
- <body>
- <p>Web Console test for bug 618078 - exception in async network request
- callback.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html b/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html
deleted file mode 100644
index 09c986703..000000000
--- a/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 621644</title>
- <script>
- function $(elem) {
- return elem.innerHTML;
- }
- function $$(doc) {
- return doc.title;
- }
- </script>
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <h1>Web Console test for bug 621644</h1>
- <p>hello world!</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs b/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs
deleted file mode 100644
index f92e0fe65..000000000
--- a/browser/devtools/webconsole/test/test-bug-630733-response-redirect-headers.sjs
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-function handleRequest(request, response)
-{
- var page = "<!DOCTYPE html><html><body><p>hello world! bug 630733</p></body></html>";
-
- response.setStatusLine(request.httpVersion, "301", "Moved Permanently");
- response.setHeader("Content-Type", "text/html", false);
- response.setHeader("Content-Length", page.length + "", false);
- response.setHeader("x-foobar-bug630733", "bazbaz", false);
- response.setHeader("Location", "/redirect-from-bug-630733", false);
- response.write(page);
-}
diff --git a/browser/devtools/webconsole/test/test-bug-632275-getters.html b/browser/devtools/webconsole/test/test-bug-632275-getters.html
deleted file mode 100644
index 349c301f3..000000000
--- a/browser/devtools/webconsole/test/test-bug-632275-getters.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 632275 - getters</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<script type="application/javascript;version=1.8">
- document.foobar = {
- _val: 5,
- get val() { return ++this._val; }
- };
-</script>
-
- </head>
- <body>
- <p>Web Console test for bug 632275 - getters.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html b/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html
deleted file mode 100644
index ae6e5201c..000000000
--- a/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 632347 - iterators and generators</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="application/javascript;version=1.8">
-(function(){
-function genFunc() {
- var a = 5;
- while (a < 10) {
- yield a++;
- }
-}
-
-window.gen1 = genFunc();
-gen1.next();
-
-var obj = { foo: "bar", baz: "baaz", hay: "stack" };
-window.iter1 = Iterator(obj);
-
-function Range(low, high) {
- this.low = low;
- this.high = high;
-}
-
-function RangeIterator(range) {
- this.range = range;
- this.current = this.range.low;
-}
-
-RangeIterator.prototype.next = function() {
- if (this.current > this.range.high) {
- throw StopIteration;
- } else {
- return this.current++;
- }
-}
-
-Range.prototype.__iterator__ = function() {
- return new RangeIterator(this);
-}
-
-window.iter2 = new Range(3, 15);
-
-window.gen2 = (i * 2 for (i in iter2));
-})();
-</script>
- </head>
- <body>
- <p>Web Console test for bug 632347 - iterators and generators.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-644419-log-limits.html b/browser/devtools/webconsole/test/test-bug-644419-log-limits.html
deleted file mode 100644
index 21d99ba14..000000000
--- a/browser/devtools/webconsole/test/test-bug-644419-log-limits.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <head>
- <meta charset="utf-8">
- <title>Test for bug 644419: console log limits</title>
- </head>
- <body>
- <h1>Test for bug 644419: Console should have user-settable log limits for
- each message category</h1>
-
- <script type="text/javascript">
- function foo() {
- bar.baz();
- }
- foo();
- </script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-646025-console-file-location.html b/browser/devtools/webconsole/test/test-bug-646025-console-file-location.html
deleted file mode 100644
index 7c80f1446..000000000
--- a/browser/devtools/webconsole/test/test-bug-646025-console-file-location.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console file location test</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script src="test-file-location.js"></script>
- </head>
- <body>
- <h1>Web Console File Location Test Page</h1>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-658368-time-methods.html b/browser/devtools/webconsole/test/test-bug-658368-time-methods.html
deleted file mode 100644
index cc50b6313..000000000
--- a/browser/devtools/webconsole/test/test-bug-658368-time-methods.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <head>
- <meta charset="utf-8">
- <title>Test for bug 658368: Expand console object with time and timeEnd
- methods</title>
- </head>
- <body>
- <h1>Test for bug 658368: Expand console object with time and timeEnd
- methods</h1>
-
- <script type="text/javascript">
- function foo() {
- console.timeEnd("aTimer");
- }
- console.time("aTimer");
- foo();
- console.time("bTimer");
- </script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html b/browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html
deleted file mode 100644
index db83274f0..000000000
--- a/browser/devtools/webconsole/test/test-bug-737873-mixedcontent.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf8">
- <title>Mixed Content test - http on https</title>
- <script src="testscript.js"></script>
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <iframe src = "http://example.com"></iframe>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-766001-console-log.js b/browser/devtools/webconsole/test/test-bug-766001-console-log.js
deleted file mode 100644
index 41594d76a..000000000
--- a/browser/devtools/webconsole/test/test-bug-766001-console-log.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-window.addEventListener("load", function() {
- console.log("Blah Blah");
-}, false);
diff --git a/browser/devtools/webconsole/test/test-bug-766001-js-console-links.html b/browser/devtools/webconsole/test/test-bug-766001-js-console-links.html
deleted file mode 100644
index 6a6ac6008..000000000
--- a/browser/devtools/webconsole/test/test-bug-766001-js-console-links.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 766001 : Open JS/Console call Links in Debugger</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript" src="test-bug-766001-js-errors.js"></script>
- <script type="text/javascript" src="test-bug-766001-console-log.js"></script>
- </head>
- <body>
- <p>Web Console test for bug 766001 : Open JS/Console call Links in Debugger.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-766001-js-errors.js b/browser/devtools/webconsole/test/test-bug-766001-js-errors.js
deleted file mode 100644
index 932204395..000000000
--- a/browser/devtools/webconsole/test/test-bug-766001-js-errors.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-window.addEventListener("load", function() {
- document.bar();
-}, false);
diff --git a/browser/devtools/webconsole/test/test-bug-782653-css-errors-1.css b/browser/devtools/webconsole/test/test-bug-782653-css-errors-1.css
deleted file mode 100644
index ad7fd1999..000000000
--- a/browser/devtools/webconsole/test/test-bug-782653-css-errors-1.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-body {
- color: #0f0;
- font-weight: green;
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-782653-css-errors-2.css b/browser/devtools/webconsole/test/test-bug-782653-css-errors-2.css
deleted file mode 100644
index 91b14137a..000000000
--- a/browser/devtools/webconsole/test/test-bug-782653-css-errors-2.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-body {
- color: #0fl;
- font-weight: bold;
-}
-
diff --git a/browser/devtools/webconsole/test/test-bug-782653-css-errors.html b/browser/devtools/webconsole/test/test-bug-782653-css-errors.html
deleted file mode 100644
index 7ca11fc34..000000000
--- a/browser/devtools/webconsole/test/test-bug-782653-css-errors.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 782653 : Open CSS Links in Style Editor</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <link rel="stylesheet" href="test-bug-782653-css-errors-1.css">
- <link rel="stylesheet" href="test-bug-782653-css-errors-2.css">
- </head>
- <body>
- <p>Web Console test for bug 782653 : Open CSS Links in Style Editor.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-821877-csperrors.html b/browser/devtools/webconsole/test/test-bug-821877-csperrors.html
deleted file mode 100644
index 25d9da1c0..000000000
--- a/browser/devtools/webconsole/test/test-bug-821877-csperrors.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <meta charset="utf8">
- <title>Bug 821877 - Log CSP Errors to Web Console</title>
- <!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>This page is served with a deprecated CSP header.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-821877-csperrors.html^headers^ b/browser/devtools/webconsole/test/test-bug-821877-csperrors.html^headers^
deleted file mode 100644
index 426d8738c..000000000
--- a/browser/devtools/webconsole/test/test-bug-821877-csperrors.html^headers^
+++ /dev/null
@@ -1 +0,0 @@
-X-Content-Security-Policy: default-src *; options inline-script
diff --git a/browser/devtools/webconsole/test/test-bug-837351-security-errors.html b/browser/devtools/webconsole/test/test-bug-837351-security-errors.html
deleted file mode 100644
index db83274f0..000000000
--- a/browser/devtools/webconsole/test/test-bug-837351-security-errors.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf8">
- <title>Mixed Content test - http on https</title>
- <script src="testscript.js"></script>
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <iframe src = "http://example.com"></iframe>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html b/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html
deleted file mode 100644
index 509e424d0..000000000
--- a/browser/devtools/webconsole/test/test-bug-859170-longstring-hang.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head><meta charset="utf-8">
- <title>Web Console test for bug 859170 - very long strings hang the browser</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-<script type="application/javascript">
-(function() {
-var longString = "abbababazomglolztest";
-for (var i = 0; i < 10; i++) {
- longString += longString + longString;
-}
-
-longString = "foobar" + (new Array(20000)).join("a") + "foobaz" +
- longString + "boom!";
-console.log(longString);
-})();
-</script>
- </head>
- <body>
- <p>Web Console test for bug 859170 - very long strings hang the browser.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-869003-iframe.html b/browser/devtools/webconsole/test/test-bug-869003-iframe.html
deleted file mode 100644
index 5a29728e5..000000000
--- a/browser/devtools/webconsole/test/test-bug-869003-iframe.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 869003</title>
- <!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript"><!--
- window.onload = function testConsoleLogging()
- {
- var o = { hello: "world!", bug: 869003 };
- console.log("foobar", o);
- };
- // --></script>
- </head>
- <body>
- <p>Make sure users can inspect objects from cross-domain iframes.</p>
- <p>Iframe window.</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-bug-869003-top-window.html b/browser/devtools/webconsole/test/test-bug-869003-top-window.html
deleted file mode 100644
index ab3b87542..000000000
--- a/browser/devtools/webconsole/test/test-bug-869003-top-window.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test for bug 869003</title>
- <!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Make sure users can inspect objects from cross-domain iframes.</p>
- <p>Top window.</p>
- <iframe src="http://example.org/browser/browser/devtools/webconsole/test/test-bug-869003-iframe.html"></iframe>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-console-extras.html b/browser/devtools/webconsole/test/test-console-extras.html
deleted file mode 100644
index 6e05a96eb..000000000
--- a/browser/devtools/webconsole/test/test-console-extras.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console extended API test</title>
- <script type="text/javascript">
- function test() {
- console.log("start");
- console.exception()
- console.assert()
- console.clear()
- console.dirxml()
- console.profile()
- console.profileEnd()
- console.count()
- console.table()
- console.log("end");
- }
- </script>
- </head>
- <body>
- <h1 id="header">Heads Up Display Demo</h1>
- <button onclick="test();">Test Extended API</button>
- <div id="myDiv"></div>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-console-replaced-api.html b/browser/devtools/webconsole/test/test-console-replaced-api.html
deleted file mode 100644
index 2b05d023a..000000000
--- a/browser/devtools/webconsole/test/test-console-replaced-api.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console test replaced API</title>
- </head>
- <body>
- <h1 id="header">Web Console Replace API Test</h1>
- <script type="text/javascript">
- window.console = {log: function (msg){}, info: function (msg){}, warn: function (msg){}, error: function (msg){}};
- </script>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-console.html b/browser/devtools/webconsole/test/test-console.html
deleted file mode 100644
index 23126642a..000000000
--- a/browser/devtools/webconsole/test/test-console.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console test</title>
- <script type="text/javascript">
- function test() {
- var str = "Dolske Digs Bacon, Now and Forevermore."
- for (var i=0; i < 5; i++) {
- console.log(str);
- }
- }
- console.info("INLINE SCRIPT:");
- test();
- console.warn("I'm warning you, he will eat up all yr bacon.");
- console.error("Error Message");
- </script>
- </head>
- <body>
- <h1 id="header">Heads Up Display Demo</h1>
- <button onclick="test();">Log stuff about Dolske</button>
- <div id="myDiv"></div>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-data.json b/browser/devtools/webconsole/test/test-data.json
deleted file mode 100644
index 471d240b5..000000000
--- a/browser/devtools/webconsole/test/test-data.json
+++ /dev/null
@@ -1 +0,0 @@
-{ id: "test JSON data", myArray: [ "foo", "bar", "baz", "biff" ] } \ No newline at end of file
diff --git a/browser/devtools/webconsole/test/test-data.json^headers^ b/browser/devtools/webconsole/test/test-data.json^headers^
deleted file mode 100644
index 7b5e82d4b..000000000
--- a/browser/devtools/webconsole/test/test-data.json^headers^
+++ /dev/null
@@ -1 +0,0 @@
-Content-Type: application/json
diff --git a/browser/devtools/webconsole/test/test-duplicate-error.html b/browser/devtools/webconsole/test/test-duplicate-error.html
deleted file mode 100644
index 1b2691672..000000000
--- a/browser/devtools/webconsole/test/test-duplicate-error.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Console duplicate error test</title>
- <!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
-
- See https://bugzilla.mozilla.org/show_bug.cgi?id=582201
- -->
- </head>
- <body>
- <h1>Heads Up Display - duplicate error test</h1>
-
- <script type="text/javascript"><!--
- fooDuplicateError1.bar();
- // --></script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html b/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html
deleted file mode 100644
index cf19629f4..000000000
--- a/browser/devtools/webconsole/test/test-encoding-ISO-8859-1.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="ISO-8859-1">
-</head>
-<body>üöä</body>
-</html> \ No newline at end of file
diff --git a/browser/devtools/webconsole/test/test-error.html b/browser/devtools/webconsole/test/test-error.html
deleted file mode 100644
index abf62a3f1..000000000
--- a/browser/devtools/webconsole/test/test-error.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Console error test</title>
- </head>
- <body>
- <h1>Heads Up Display - error test</h1>
- <p><button>generate error</button></p>
-
- <script type="text/javascript"><!--
- var button = document.getElementsByTagName("button")[0];
-
- button.addEventListener("click", function clicker () {
- button.removeEventListener("click", clicker, false);
- fooBazBaz.bar();
- }, false);
- // --></script>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-eval-in-stackframe.html b/browser/devtools/webconsole/test/test-eval-in-stackframe.html
deleted file mode 100644
index ec1bf3f30..000000000
--- a/browser/devtools/webconsole/test/test-eval-in-stackframe.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" lang="en">
- <head>
- <meta charset="utf8">
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- <title>Test for bug 783499 - use the debugger API in the web console</title>
- <script>
- var foo = "globalFooBug783499";
- var fooObj = {
- testProp: "testValue",
- };
-
- function firstCall()
- {
- var foo = "fooFirstCall";
- var foo3 = "foo3FirstCall";
- secondCall();
- }
-
- function secondCall()
- {
- var foo2 = "foo2SecondCall";
- var fooObj = {
- testProp2: "testValue2",
- };
- var fooObj2 = {
- testProp22: "testValue22",
- };
- debugger;
- }
- </script>
- </head>
- <body>
- <p>Hello world!</p>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-file-location.js b/browser/devtools/webconsole/test/test-file-location.js
deleted file mode 100644
index f97ce5725..000000000
--- a/browser/devtools/webconsole/test/test-file-location.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-console.log("message for level log");
-console.info("message for level info");
-console.warn("message for level warn");
-console.error("message for level error");
-console.debug("message for level debug");
diff --git a/browser/devtools/webconsole/test/test-filter.html b/browser/devtools/webconsole/test/test-filter.html
deleted file mode 100644
index 219177bb2..000000000
--- a/browser/devtools/webconsole/test/test-filter.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console test</title>
- <script type="text/javascript">
- </script>
- </head>
- <body>
- <h1>Heads Up Display Filter Test Page</h1>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-for-of.html b/browser/devtools/webconsole/test/test-for-of.html
deleted file mode 100644
index 876010c9e..000000000
--- a/browser/devtools/webconsole/test/test-for-of.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<meta charset="utf-8">
-<body>
-<h1>a</h1>
-<div><p>b</p></div>
-<h2>c</h2>
-<p>d</p>
diff --git a/browser/devtools/webconsole/test/test-image.png b/browser/devtools/webconsole/test/test-image.png
deleted file mode 100644
index 769c63634..000000000
--- a/browser/devtools/webconsole/test/test-image.png
+++ /dev/null
Binary files differ
diff --git a/browser/devtools/webconsole/test/test-mutation.html b/browser/devtools/webconsole/test/test-mutation.html
deleted file mode 100644
index e80933b06..000000000
--- a/browser/devtools/webconsole/test/test-mutation.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Console mutation test</title>
- <script>
- window.onload = function (){
- var node = document.createElement("div");
- document.body.appendChild(node);
- };
- </script>
- </head>
- <body>
- <h1>Heads Up Display DOM Mutation Test Page</h1>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-network-request.html b/browser/devtools/webconsole/test/test-network-request.html
deleted file mode 100644
index 3cb699865..000000000
--- a/browser/devtools/webconsole/test/test-network-request.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>Console HTTP test page</title>
- <script type="text/javascript"><!--
- function makeXhr(aMethod, aUrl, aRequestBody, aCallback) {
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open(aMethod, aUrl, true);
- xmlhttp.onreadystatechange = function() {
- if (aCallback && xmlhttp.readyState == 4) {
- aCallback();
- }
- };
- xmlhttp.send(aRequestBody);
- }
-
- function testXhrGet(aCallback) {
- makeXhr('get', 'test-data.json', null, aCallback);
- }
-
- function testXhrPost(aCallback) {
- makeXhr('post', 'test-data.json', "Hello world!", aCallback);
- }
- // --></script>
- </head>
- <body>
- <h1>Heads Up Display HTTP Logging Testpage</h1>
- <h2>This page is used to test the HTTP logging.</h2>
-
- <form action="http://example.com/browser/browser/devtools/webconsole/test/test-network-request.html" method="post">
- <input name="name" type="text" value="foo bar"><br>
- <input name="age" type="text" value="144"><br>
- </form>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-network.html b/browser/devtools/webconsole/test/test-network.html
deleted file mode 100644
index 9c591479e..000000000
--- a/browser/devtools/webconsole/test/test-network.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console network test</title>
- <script src="testscript.js"></script>
- </head>
- <body>
- <h1>Heads Up Display Network Test Page</h1>
- <img src="test-image.png"></img>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-observe-http-ajax.html b/browser/devtools/webconsole/test/test-observe-http-ajax.html
deleted file mode 100644
index 5abcefdad..000000000
--- a/browser/devtools/webconsole/test/test-observe-http-ajax.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Console HTTP test page</title>
- <script type="text/javascript">
- function test() {
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open('get', 'test-data.json', false);
- xmlhttp.send(null);
- }
- </script>
- </head>
- <body onload="test();">
- <h1>Heads Up Display HTTP & AJAX Test Page</h1>
- <h2>This page fires an ajax request so we can see the http logging of the console</h2>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-own-console.html b/browser/devtools/webconsole/test/test-own-console.html
deleted file mode 100644
index d1d18ebc2..000000000
--- a/browser/devtools/webconsole/test/test-own-console.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
-<head>
-<meta charset="utf-8">
-<script>
- var _console = {
- foo: "bar"
- }
-
- window.console = _console;
-
- function loadIFrame() {
- var iframe = document.body.querySelector("iframe");
- iframe.addEventListener("load", function() {
- iframe.removeEventListener("load", arguments.callee, true);
- }, true);
-
- iframe.setAttribute("src", "test-console.html");
- }
-</script>
-</head>
-<body>
- <iframe></iframe>
-</body>
diff --git a/browser/devtools/webconsole/test/test-property-provider.html b/browser/devtools/webconsole/test/test-property-provider.html
deleted file mode 100644
index 532b00f44..000000000
--- a/browser/devtools/webconsole/test/test-property-provider.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
- <meta charset="utf-8">
- <title>Property provider test</title>
- <script>
- var testObj = {
- testProp: 'testValue'
- };
- </script>
- </head>
- <body>
- <h1>Heads Up Property Provider Test Page</h1>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-repeated-messages.html b/browser/devtools/webconsole/test/test-repeated-messages.html
deleted file mode 100644
index 5bbc8fd5a..000000000
--- a/browser/devtools/webconsole/test/test-repeated-messages.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf8">
- <title>Test for bugs 720180, 800510 and 865288</title>
- <script>
- function testConsole() {
- console.log("foo repeat"); console.log("foo repeat");
- console.log("foo repeat"); console.error("foo repeat");
- }
- function testConsoleObjects() {
- for (var i = 0; i < 3; i++) {
- var o = { id: "abba" + i };
- console.log("abba", o);
- }
- }
- </script>
- <style>
- body {
- background-image: foobarz;
- }
- p {
- background-image: foobarz;
- }
- </style>
- <!--
- - Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/
- -->
- </head>
- <body>
- <p>Hello world!</p>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test-result-format-as-string.html b/browser/devtools/webconsole/test/test-result-format-as-string.html
deleted file mode 100644
index 73b7b8be5..000000000
--- a/browser/devtools/webconsole/test/test-result-format-as-string.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Web Console test: jsterm eval format as a string</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- </head>
- <body>
- <p>Make sure js eval results are formatted as strings.</p>
- <script>
- document.querySelector("p").toSource = function() {
- var element = document.createElement("div");
- element.textContent = "bug772506_content";
- element.setAttribute("onmousemove",
- "(function () {" +
- " gBrowser._bug772506 = 'foobar';" +
- "})();"
- );
- return element;
- };
- </script>
- </body>
-</html>
diff --git a/browser/devtools/webconsole/test/test-webconsole-error-observer.html b/browser/devtools/webconsole/test/test-webconsole-error-observer.html
deleted file mode 100644
index 8466bc6f2..000000000
--- a/browser/devtools/webconsole/test/test-webconsole-error-observer.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML>
-<html dir="ltr" xml:lang="en-US" lang="en-US">
- <head>
- <meta charset="utf-8">
- <title>WebConsoleErrorObserver test - bug 611032</title>
- <!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
- <script type="text/javascript">
- console.log("log Bazzle");
- console.info("info Bazzle");
- console.warn("warn Bazzle");
- console.error("error Bazzle");
-
- var foo = {};
- foo.bazBug611032();
- </script>
- <style type="text/css">
- .foo { color: cssColorBug611032; }
- </style>
- </head>
- <body>
- <h1>WebConsoleErrorObserver test</h1>
- </body>
-</html>
-
diff --git a/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html b/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html
deleted file mode 100644
index eb0c52c3a..000000000
--- a/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Test for Bug 770099 - bad policy-uri</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=770099">Mozilla Bug 770099</a>
-</body>
-</html>
diff --git a/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html^headers^ b/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html^headers^
deleted file mode 100644
index b64692028..000000000
--- a/browser/devtools/webconsole/test/test_bug_770099_bad_policy_uri.html^headers^
+++ /dev/null
@@ -1,2 +0,0 @@
-X-Content-Security-Policy: policy-uri http://example.com/some_policy
-Content-type: text/html; charset=utf-8
diff --git a/browser/devtools/webconsole/test/test_bug_770099_violation.html b/browser/devtools/webconsole/test/test_bug_770099_violation.html
deleted file mode 100644
index ccbded87a..000000000
--- a/browser/devtools/webconsole/test/test_bug_770099_violation.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>Test for Bug 770099 - policy violation</title>
-<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=770099">Mozilla Bug 770099</a>
-<img src="http://some.example.com/test.png">
-</body>
-</html>
diff --git a/browser/devtools/webconsole/test/test_bug_770099_violation.html^headers^ b/browser/devtools/webconsole/test/test_bug_770099_violation.html^headers^
deleted file mode 100644
index 5374efd3e..000000000
--- a/browser/devtools/webconsole/test/test_bug_770099_violation.html^headers^
+++ /dev/null
@@ -1 +0,0 @@
-X-Content-Security-Policy: default-src 'self'
diff --git a/browser/devtools/webconsole/test/testscript.js b/browser/devtools/webconsole/test/testscript.js
deleted file mode 100644
index c69919df4..000000000
--- a/browser/devtools/webconsole/test/testscript.js
+++ /dev/null
@@ -1 +0,0 @@
-console.log("running network console logging tests");
diff --git a/browser/extensions/moz.build b/browser/extensions/moz.build
index b5152edf4..6ecebe123 100644
--- a/browser/extensions/moz.build
+++ b/browser/extensions/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['pdfjs/test']
+
diff --git a/browser/extensions/pdfjs/test/Makefile.in b/browser/extensions/pdfjs/test/Makefile.in
deleted file mode 100644
index 98ba859d2..000000000
--- a/browser/extensions/pdfjs/test/Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES = \
- browser_pdfjs_main.js \
- browser_pdfjs_savedialog.js \
- browser_pdfjs_views.js \
- file_pdfjs_test.pdf \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/extensions/pdfjs/test/browser_pdfjs_main.js b/browser/extensions/pdfjs/test/browser_pdfjs_main.js
deleted file mode 100644
index e3d7c8bab..000000000
--- a/browser/extensions/pdfjs/test/browser_pdfjs_main.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
-const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
-
-function test() {
- var tab;
-
- let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
- let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
- let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
-
- // Make sure pdf.js is the default handler.
- is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
- is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
-
- info('Pref action: ' + handlerInfo.preferredAction);
-
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- gBrowser.removeTab(tab);
- });
-
- tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
- var newTabBrowser = gBrowser.getBrowserForTab(tab);
- newTabBrowser.addEventListener("load", function eventHandler() {
- newTabBrowser.removeEventListener("load", eventHandler, true);
-
- var document = newTabBrowser.contentDocument,
- window = newTabBrowser.contentWindow;
-
- // Runs tests after all 'load' event handlers have fired off
- setTimeout(function() {
- runTests(document, window, finish);
- }, 0);
- }, true);
-}
-
-
-function runTests(document, window, callback) {
-
- //
- // Overall sanity tests
- //
- ok(document.querySelector('div#viewer'), "document content has viewer UI");
- ok('PDFJS' in window.wrappedJSObject, "window content has PDFJS object");
-
- //
- // Sidebar: open
- //
- var sidebar = document.querySelector('button#sidebarToggle'),
- outerContainer = document.querySelector('div#outerContainer');
-
- sidebar.click();
- ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
-
- //
- // Sidebar: close
- //
- sidebar.click();
- ok(!outerContainer.classList.contains('sidebarOpen'), 'sidebar closes on click');
-
- //
- // Page change from prev/next buttons
- //
- var prevPage = document.querySelector('button#previous'),
- nextPage = document.querySelector('button#next');
-
- var pageNumber = document.querySelector('input#pageNumber');
- is(parseInt(pageNumber.value), 1, 'initial page is 1');
-
- //
- // Bookmark button
- //
- var viewBookmark = document.querySelector('a#viewBookmark');
- viewBookmark.click();
- ok(viewBookmark.href.length > 0, 'viewBookmark button has href');
-
- callback();
-}
diff --git a/browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js b/browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js
deleted file mode 100644
index a6564e591..000000000
--- a/browser/extensions/pdfjs/test/browser_pdfjs_savedialog.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
-const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
-
-function test() {
- var oldAction = changeMimeHandler(Ci.nsIHandlerInfo.useSystemDefault, true);
- var tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
- //
- // Test: "Open with" dialog comes up when pdf.js is not selected as the default
- // handler.
- //
- addWindowListener('chrome://mozapps/content/downloads/unknownContentType.xul', finish);
-
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- changeMimeHandler(oldAction[0], oldAction[1]);
- gBrowser.removeTab(tab);
- });
-}
-
-function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
- let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
- let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
- let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
- var oldAction = [handlerInfo.preferredAction, handlerInfo.alwaysAskBeforeHandling];
-
- // Change and save mime handler settings
- handlerInfo.alwaysAskBeforeHandling = alwaysAskBeforeHandling;
- handlerInfo.preferredAction = preferredAction;
- handlerService.store(handlerInfo);
-
- Services.obs.notifyObservers(null, 'pdfjs:handlerChanged', null);
-
- // Refresh data
- handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
-
- //
- // Test: Mime handler was updated
- //
- is(handlerInfo.alwaysAskBeforeHandling, alwaysAskBeforeHandling, 'always-ask prompt change successful');
- is(handlerInfo.preferredAction, preferredAction, 'mime handler change successful');
-
- return oldAction;
-}
-
-function addWindowListener(aURL, aCallback) {
- Services.wm.addListener({
- onOpenWindow: function(aXULWindow) {
- info("window opened, waiting for focus");
- Services.wm.removeListener(this);
-
- var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- waitForFocus(function() {
- is(domwindow.document.location.href, aURL, "should have seen the right window open");
- domwindow.close();
- aCallback();
- }, domwindow);
- },
- onCloseWindow: function(aXULWindow) { },
- onWindowTitleChange: function(aXULWindow, aNewTitle) { }
- });
-}
diff --git a/browser/extensions/pdfjs/test/browser_pdfjs_views.js b/browser/extensions/pdfjs/test/browser_pdfjs_views.js
deleted file mode 100644
index c83878e73..000000000
--- a/browser/extensions/pdfjs/test/browser_pdfjs_views.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
-const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
-
-function test() {
- var tab;
-
- let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
- let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
- let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
-
- // Make sure pdf.js is the default handler.
- is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
- is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
-
- info('Pref action: ' + handlerInfo.preferredAction);
-
- waitForExplicitFinish();
- registerCleanupFunction(function() {
- gBrowser.removeTab(tab);
- });
-
- tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
- var newTabBrowser = gBrowser.getBrowserForTab(tab);
- newTabBrowser.addEventListener("load", function eventHandler() {
- newTabBrowser.removeEventListener("load", eventHandler, true);
-
- var document = newTabBrowser.contentDocument,
- window = newTabBrowser.contentWindow;
-
- // Runs tests after all 'load' event handlers have fired off
- window.addEventListener("documentload", function() {runTests(document, window, finish);}, false, true);
- }, true);
-}
-
-function runTests(document, window, callback) {
- // check that PDF is opened with internal viewer
- ok(document.querySelector('div#viewer'), "document content has viewer UI");
- ok('PDFJS' in window.wrappedJSObject, "window content has PDFJS object");
-
- //open sidebar
- var sidebar = document.querySelector('button#sidebarToggle');
- var outerContainer = document.querySelector('div#outerContainer');
-
- sidebar.click();
- ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
-
- // check that thumbnail view is open
- var thumbnailView = document.querySelector('div#thumbnailView');
- var outlineView = document.querySelector('div#outlineView');
-
- is(thumbnailView.getAttribute('class'), null, 'Initial view is thumbnail view');
- is(outlineView.getAttribute('class'), 'hidden', 'Outline view is hidden initially');
-
- //switch to outline view
- var viewOutlineButton = document.querySelector('button#viewOutline');
- viewOutlineButton.click();
-
- is(outlineView.getAttribute('class'), '', 'Outline view is visible when selected');
- is(thumbnailView.getAttribute('class'), 'hidden', 'Thumbnail view is hidden when outline is selected');
-
- //switch back to thumbnail view
- var viewThumbnailButton = document.querySelector('button#viewThumbnail');
- viewThumbnailButton.click();
-
- is(thumbnailView.getAttribute('class'), '', 'Thumbnail view is visible when selected');
- is(outlineView.getAttribute('class'), 'hidden', 'Outline view is hidden when thumbnail is selected');
-
- sidebar.click();
-
- callback();
-}
diff --git a/browser/extensions/pdfjs/test/file_pdfjs_test.pdf b/browser/extensions/pdfjs/test/file_pdfjs_test.pdf
deleted file mode 100644
index 7ad87e3c2..000000000
--- a/browser/extensions/pdfjs/test/file_pdfjs_test.pdf
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pdfjs/test/moz.build b/browser/extensions/pdfjs/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/extensions/pdfjs/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/fuel/moz.build b/browser/fuel/moz.build
index 92950f537..76218104c 100644
--- a/browser/fuel/moz.build
+++ b/browser/fuel/moz.build
@@ -5,4 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']
-TEST_DIRS += ['test']
+
diff --git a/browser/fuel/test/ContentA.html b/browser/fuel/test/ContentA.html
deleted file mode 100644
index 67cbadf47..000000000
--- a/browser/fuel/test/ContentA.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" >
-<head>
- <title>Content Page A</title>
-</head>
-<body>
-<h1>Content Page A</h1>
-<div id="desc">This is a simple content page used for testing FUEL Browser API</div>
-<div id="test1">A</div>
-<div id="test2">B</div>
-</body>
-</html>
diff --git a/browser/fuel/test/ContentB.html b/browser/fuel/test/ContentB.html
deleted file mode 100644
index c5d3b37eb..000000000
--- a/browser/fuel/test/ContentB.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" >
-<head>
- <title>Content Page B</title>
-</head>
-<body>
-<h1>Content Page B</h1>
-<div id="desc">This is a simple content page used for testing FUEL Browser API</div>
-<div id="test1">1</div>
-<div id="test2">2</div>
-</body>
-</html>
diff --git a/browser/fuel/test/ContentWithFrames.html b/browser/fuel/test/ContentWithFrames.html
deleted file mode 100644
index a66873ad8..000000000
--- a/browser/fuel/test/ContentWithFrames.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" >
-<head>
- <title>Content Page with Frames</title>
-</head>
-<body>
-<h1>Content Page with Frames</h1>
-<div id="desc">This is a simple framed content page used for testing FUEL Browser API</div>
-<iframe src="ContentA.html"></iframe>
-<iframe src="ContentB.html"></iframe>
-</body>
-</html>
diff --git a/browser/fuel/test/Makefile.in b/browser/fuel/test/Makefile.in
deleted file mode 100644
index 79e82030d..000000000
--- a/browser/fuel/test/Makefile.in
+++ /dev/null
@@ -1,25 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_Application.js \
- browser_ApplicationPrefs.js \
- browser_ApplicationStorage.js \
- browser_ApplicationQuitting.js \
- browser_Bookmarks.js \
- browser_Browser.js \
- ContentA.html \
- ContentB.html \
- ContentWithFrames.html \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/fuel/test/browser_Application.js b/browser/fuel/test/browser_Application.js
deleted file mode 100644
index b2590d6a7..000000000
--- a/browser/fuel/test/browser_Application.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// This listens for the next opened window and checks it is of the right url.
-// opencallback is called when the new window is fully loaded
-// closecallback is called when the window is closed
-function WindowOpenListener(url, opencallback, closecallback) {
- this.url = url;
- this.opencallback = opencallback;
- this.closecallback = closecallback;
-
- Services.wm.addListener(this);
-}
-
-WindowOpenListener.prototype = {
- url: null,
- opencallback: null,
- closecallback: null,
- window: null,
- domwindow: null,
-
- handleEvent: function(event) {
- is(this.domwindow.document.location.href, this.url, "Should have opened the correct window");
-
- this.domwindow.removeEventListener("load", this, false);
- // Allow any other load handlers to execute
- var self = this;
- executeSoon(function() { self.opencallback(self.domwindow); } );
- },
-
- onWindowTitleChange: function(window, title) {
- },
-
- onOpenWindow: function(window) {
- if (this.window)
- return;
-
- this.window = window;
- this.domwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindow);
- this.domwindow.addEventListener("load", this, false);
- },
-
- onCloseWindow: function(window) {
- if (this.window != window)
- return;
-
- Services.wm.removeListener(this);
- this.opencallback = null;
- this.window = null;
- this.domwindow = null;
-
- // Let the window close complete
- executeSoon(this.closecallback);
- this.closecallback = null;
- }
-};
-
-function test() {
- ok(Application, "Check global access to Application");
-
- // I'd test these against a specific value, but that is bound to flucuate
- ok(Application.id, "Check to see if an ID exists for the Application");
- ok(Application.name, "Check to see if a name exists for the Application");
- ok(Application.version, "Check to see if a version exists for the Application");
-
- var wMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
- var console = wMediator.getMostRecentWindow("global:console");
- waitForExplicitFinish();
- ok(!console, "Console should not already be open");
-
- new WindowOpenListener("chrome://global/content/console.xul", consoleOpened, consoleClosed);
- Application.console.open();
-}
-
-function consoleOpened(win) {
- win.close();
-}
-
-function consoleClosed() {
- finish();
-}
diff --git a/browser/fuel/test/browser_ApplicationPrefs.js b/browser/fuel/test/browser_ApplicationPrefs.js
deleted file mode 100644
index 23ac5dc48..000000000
--- a/browser/fuel/test/browser_ApplicationPrefs.js
+++ /dev/null
@@ -1,179 +0,0 @@
-// The various properties that we'll be testing
-var testdata = {
- missing: "fuel.fuel-test-missing",
- dummy: "fuel.fuel-test",
- string: "browser.active_color",
- integer: "permissions.default.image",
- boolean: "browser.underline_anchors"
-};
-
-function test() {
- // test getting nonexistent values
- var itemValue = Application.prefs.getValue(testdata.missing, "default");
- is(itemValue, "default", "Check 'Application.prefs.getValue' for nonexistent item");
-
- is(Application.prefs.get(testdata.missing), null, "Check 'Application.prefs.get' for nonexistent item");
-
- // test setting and getting a value
- Application.prefs.setValue(testdata.dummy, "dummy");
- itemValue = Application.prefs.getValue(testdata.dummy, "default");
- is(itemValue, "dummy", "Check 'Application.prefs.getValue' for existing item");
-
- // test for overwriting an existing value
- Application.prefs.setValue(testdata.dummy, "smarty");
- itemValue = Application.prefs.getValue(testdata.dummy, "default");
- is(itemValue, "smarty", "Check 'Application.prefs.getValue' for overwritten item");
-
- // test setting and getting a value
- Application.prefs.get(testdata.dummy).value = "dummy2";
- itemValue = Application.prefs.get(testdata.dummy).value;
- is(itemValue, "dummy2", "Check 'Application.prefs.get().value' for existing item");
-
- // test resetting a pref [since there is no default value, the pref should disappear]
- Application.prefs.get(testdata.dummy).reset();
- itemValue = Application.prefs.getValue(testdata.dummy, "default");
- is(itemValue, "default", "Check 'Application.prefs.getValue' for reset pref");
-
- // test to see if a non-existant property exists
- ok(!Application.prefs.has(testdata.dummy), "Check non-existant property for existence");
-
- // PREF: string browser.active_color == #EE0000
-
- // test to see if an existing string property exists
- ok(Application.prefs.has(testdata.string), "Check existing string property for existence");
-
- // test accessing a non-existant string property
- var val = Application.prefs.getValue(testdata.dummy, "default");
- is(val, "default", "Check non-existant string property for expected value");
-
- // test accessing an existing string property
- var val = Application.prefs.getValue(testdata.string, "default");
- is(val, "#EE0000", "Check existing string property for expected value");
-
- // test manipulating an existing string property
- Application.prefs.setValue(testdata.string, "#EF0000");
- var val = Application.prefs.getValue(testdata.string, "default");
- is(val, "#EF0000", "Set existing string property");
-
- // test getting the type of an existing string property
- var type = Application.prefs.get(testdata.string).type;
- is(type, "String", "Check 'Application.prefs.get().type' for string pref");
-
- // test resetting an existing string property
- Application.prefs.get(testdata.string).reset();
- var val = Application.prefs.getValue(testdata.string, "default");
- is(val, "#EE0000", "Reset existing string property");
-
- // PREF: integer permissions.default.image == 1
-
- // test to see if an existing integer property exists
- ok(Application.prefs.has(testdata.integer), "Check existing integer property for existence");
-
- // test accessing a non-existant integer property
- var val = Application.prefs.getValue(testdata.dummy, 0);
- is(val, 0, "Check non-existant integer property for expected value");
-
- // test accessing an existing integer property
- var val = Application.prefs.getValue(testdata.integer, 0);
- is(val, 1, "Check existing integer property for expected value");
-
- // test manipulating an existing integer property
- Application.prefs.setValue(testdata.integer, 0);
- var val = Application.prefs.getValue(testdata.integer, 1);
- is(val, 0, "Set existing integer property");
-
- // test getting the type of an existing integer property
- var type = Application.prefs.get(testdata.integer).type;
- is(type, "Number", "Check 'Application.prefs.get().type' for integer pref");
-
- // test resetting an existing integer property
- Application.prefs.get(testdata.integer).reset();
- var val = Application.prefs.getValue(testdata.integer, 0);
- is(val, 1, "Reset existing integer property");
-
- // PREF: boolean browser.underline_anchors == true
-
- // test to see if an existing boolean property exists
- ok(Application.prefs.has(testdata.boolean), "Check existing boolean property for existence");
-
- // test accessing a non-existant boolean property
- var val = Application.prefs.getValue(testdata.dummy, true);
- ok(val, "Check non-existant boolean property for expected value");
-
- // test accessing an existing boolean property
- var val = Application.prefs.getValue(testdata.boolean, false);
- ok(val, "Check existing boolean property for expected value");
-
- // test manipulating an existing boolean property
- Application.prefs.setValue(testdata.boolean, false);
- var val = Application.prefs.getValue(testdata.boolean, true);
- ok(!val, "Set existing boolean property");
-
- // test getting the type of an existing boolean property
- var type = Application.prefs.get(testdata.boolean).type;
- is(type, "Boolean", "Check 'Application.prefs.get().type' for boolean pref");
-
- // test resetting an existing boolean property
- Application.prefs.get(testdata.boolean).reset();
- var val = Application.prefs.getValue(testdata.boolean, false);
- ok(val, "Reset existing string property for expected value");
-
- // test getting all preferences
- var allPrefs = Application.prefs.all;
- ok(allPrefs.length >= 800, "Check 'Application.prefs.all' for the right number of preferences");
- ok(allPrefs[0].name.length > 0, "Check 'Application.prefs.all' for a valid name in the starting preference");
-
- // test the value of the preference root
- is(Application.prefs.root, "", "Check the Application preference root");
-
- // test for user changed preferences
- ok(Application.prefs.get("browser.shell.checkDefaultBrowser").modified, "A single preference is marked as modified.");
- ok(!Application.prefs.get(testdata.string).modified, "A single preference is marked as not modified.");
-
- // test for a locked preference
- var pref = Application.prefs.get(testdata.string);
- ok(!pref.locked, "A single preference should not be locked.");
-
- pref.locked = true;
- ok(pref.locked, "A single preference should be locked.");
-
- try {
- prev.value = "test value";
-
- ok(false, "A locked preference could be modified.");
- } catch(e){
- ok(true, "A locked preference should not be able to be modified.");
- }
-
- pref.locked = false;
- ok(!pref.locked, "A single preference is unlocked.");
-
- // check for change event when setting a value
- waitForExplicitFinish();
- Application.prefs.events.addListener("change", onPrefChange);
- Application.prefs.setValue("fuel.fuel-test", "change event");
-}
-
-function onPrefChange(evt) {
- is(evt.data, testdata.dummy, "Check 'Application.prefs.setValue' fired a change event");
- Application.prefs.events.removeListener("change", onPrefChange);
-
- // We are removing the old listener after adding the new listener so we can test that
- // removing a listener does not remove all listeners
- Application.prefs.get("fuel.fuel-test").events.addListener("change", onPrefChangeDummy);
- Application.prefs.get("fuel.fuel-test").events.addListener("change", onPrefChange2);
- Application.prefs.get("fuel.fuel-test").events.removeListener("change", onPrefChangeDummy);
-
- Application.prefs.setValue("fuel.fuel-test", "change event2");
-}
-
-function onPrefChange2(evt) {
- is(evt.data, testdata.dummy, "Check 'Application.prefs.setValue' fired a change event for a single preference");
- Application.prefs.events.removeListener("change", onPrefChange2);
-
- finish();
-}
-
-function onPrefChangeDummy(evt) {
- ok(false, "onPrefChangeDummy shouldn't be invoked!");
-}
diff --git a/browser/fuel/test/browser_ApplicationQuitting.js b/browser/fuel/test/browser_ApplicationQuitting.js
deleted file mode 100644
index 2a3535fc9..000000000
--- a/browser/fuel/test/browser_ApplicationQuitting.js
+++ /dev/null
@@ -1,17 +0,0 @@
-function test() {
- function quitRequestObserver(aSubject, aTopic, aData) {
- ok(aTopic == "quit-application-requested" &&
- aSubject instanceof Components.interfaces.nsISupportsPRBool,
- "Received a quit request we're going to deny");
- aSubject.data = true;
- }
-
- // ensure that we don't accidentally quit
- Services.obs.addObserver(quitRequestObserver, "quit-application-requested", false);
-
- ok(!Application.quit(), "Tried to quit - and didn't succeed");
- ok(!Application.restart(), "Tried to restart - and didn't succeed");
-
- // clean up
- Services.obs.removeObserver(quitRequestObserver, "quit-application-requested");
-}
diff --git a/browser/fuel/test/browser_ApplicationStorage.js b/browser/fuel/test/browser_ApplicationStorage.js
deleted file mode 100644
index ab19f7839..000000000
--- a/browser/fuel/test/browser_ApplicationStorage.js
+++ /dev/null
@@ -1,30 +0,0 @@
-function test() {
- // test for existence of values
- var hasItem = Application.storage.has("fuel-test-missing");
- is(hasItem, false, "Check 'Application.storage.has' for nonexistent item");
- Application.storage.set("fuel-test", "dummy");
- hasItem = Application.storage.has("fuel-test");
- is(hasItem, true, "Check 'Application.storage.has' for existing item");
-
- // test getting nonexistent and existing values
- var itemValue = Application.storage.get("fuel-test-missing", "default");
- is(itemValue, "default", "Check 'Application.storage.get' for nonexistent item");
- itemValue = Application.storage.get("fuel-test", "default");
- is(itemValue, "dummy", "Check 'Application.storage.get' for existing item");
-
- // test for overwriting an existing value
- Application.storage.set("fuel-test", "smarty");
- itemValue = Application.storage.get("fuel-test", "default");
- is(itemValue, "smarty", "Check 'Application.storage.get' for overwritten item");
-
- // check for change event when setting a value
- waitForExplicitFinish();
- Application.storage.events.addListener("change", onStorageChange);
- Application.storage.set("fuel-test", "change event");
-}
-
-function onStorageChange(evt) {
- is(evt.data, "fuel-test", "Check 'Application.storage.set' fired a change event");
- Application.storage.events.removeListener("change", onStorageChange);
- finish();
-}
diff --git a/browser/fuel/test/browser_Bookmarks.js b/browser/fuel/test/browser_Bookmarks.js
deleted file mode 100644
index c9af43f61..000000000
--- a/browser/fuel/test/browser_Bookmarks.js
+++ /dev/null
@@ -1,253 +0,0 @@
-var gLastFolderAction = "";
-var gLastBookmarkAction = "";
-var gLastRootAction = "";
-
-function url(spec) {
- return Services.io.newURI(spec, null, null);
-}
-
-function test() {
- // Some very basic tests on the tags root
- var tags = Application.bookmarks.tags;
- ok(tags, "Check access to bookmark tags root");
- ok(!tags.parent, "Check tags parent (should be null)");
-
- //----------------------------------------------
-
- // Some very basic tests on the unfiled root
- var unfiled = Application.bookmarks.unfiled;
- ok(unfiled, "Check access to bookmark unfiled root");
- ok(!unfiled.parent, "Check unfiled parent (should be null)");
-
- //----------------------------------------------
-
- // Some basic tests on the toolbar root
- var toolbar = Application.bookmarks.toolbar;
- ok(toolbar, "Check access to bookmark toolbar root");
- ok(!toolbar.parent, "Check toolbar parent (should be null)");
-
- var toolbarKidCount = toolbar.children.length;
-
- // test adding folders
- var testFolderToolbar = toolbar.addFolder("FUEL in Toolbar");
- ok(testFolderToolbar, "Check folder creation");
- is(testFolderToolbar.type, "folder", "Check 'folder.type' after creation");
- ok(testFolderToolbar.parent, "Check parent after folder creation");
-
- toolbarKidCount++;
- is(toolbar.children.length, toolbarKidCount, "Check toolbar folder child count after adding a child folder");
-
- //----------------------------------------------
-
- // Main testing is done on the bookmarks menu root
- var root = Application.bookmarks.menu;
- ok(root, "Check access to bookmark root");
- ok(!root.parent, "Check root parent (should be null)");
-
- var rootKidCount = root.children.length;
-
- // test adding folders
- var testFolder = root.addFolder("FUEL");
- ok(testFolder, "Check folder creation");
- is(testFolder.type, "folder", "Check 'folder.type' after creation");
- ok(testFolder.parent, "Check parent after folder creation");
-
- rootKidCount++;
- is(root.children.length, rootKidCount, "Check root folder child count after adding a child folder");
-
- // test modifying a folder
- testFolder.events.addListener("change", onFolderChange);
- testFolder.description = "FUEL folder";
- is(testFolder.description, "FUEL folder", "Check setting 'folder.description'");
- is(gLastFolderAction, "bookmarkProperties/description", "Check event handler for setting 'folder.description'");
-
- testFolder.title = "fuel-is-cool";
- is(testFolder.title, "fuel-is-cool", "Check setting 'folder.title'");
- is(gLastFolderAction, "title", "Check event handler for setting 'folder.title'");
-
- testFolder.annotations.set("testing/folder", "annotate-this", 0);
- ok(testFolder.annotations.has("testing/folder"), "Checking existence of added annotation");
- is(gLastFolderAction, "testing/folder", "Check event handler for setting annotation");
- gLastFolderAction = "";
- is(testFolder.annotations.get("testing/folder"), "annotate-this", "Checking existence of added annotation");
- testFolder.annotations.remove("testing/folder");
- ok(!testFolder.annotations.has("testing/folder"), "Checking existence of removed annotation");
- is(gLastFolderAction, "testing/folder", "Check event handler for removing annotation");
-
- testFolder.events.addListener("addchild", onFolderAddChild);
- testFolder.events.addListener("removechild", onFolderRemoveChild);
-
- // test adding a bookmark
- var testBookmark = testFolder.addBookmark("Mozilla", url("https://www.mozilla.org/"));
- ok(testBookmark, "Check bookmark creation");
- ok(testBookmark.parent, "Check parent after bookmark creation");
- is(gLastFolderAction, "addchild", "Check event handler for adding a child to a folder");
- is(testBookmark.type, "bookmark", "Check 'bookmark.type' after creation");
- is(testBookmark.title, "Mozilla", "Check 'bookmark.title' after creation");
- is(testBookmark.uri.spec, "https://www.mozilla.org/", "Check 'bookmark.uri' after creation");
-
- is(testFolder.children.length, 1, "Check test folder child count after adding a child bookmark");
-
- // test modifying a bookmark
- testBookmark.events.addListener("change", onBookmarkChange);
- testBookmark.description = "mozcorp";
- is(testBookmark.description, "mozcorp", "Check setting 'bookmark.description'");
- is(gLastBookmarkAction, "bookmarkProperties/description", "Check event handler for setting 'bookmark.description'");
-
- testBookmark.keyword = "moz"
- is(testBookmark.keyword, "moz", "Check setting 'bookmark.keyword'");
- is(gLastBookmarkAction, "keyword", "Check event handler for setting 'bookmark.keyword'");
-
- testBookmark.title = "MozCorp"
- is(testBookmark.title, "MozCorp", "Check setting 'bookmark.title'");
- is(gLastBookmarkAction, "title", "Check event handler for setting 'bookmark.title'");
-
- testBookmark.uri = url("http://www.mozilla.org/");
- is(testBookmark.uri.spec, "http://www.mozilla.org/", "Check setting 'bookmark.uri'");
- is(gLastBookmarkAction, "uri", "Check event handler for setting 'bookmark.uri'");
-
- // test adding and removing a bookmark annotation
- testBookmark.annotations.set("testing/bookmark", "annotate-this", 0);
- ok(testBookmark.annotations.has("testing/bookmark"), "Checking existence of added annotation");
- is(gLastBookmarkAction, "testing/bookmark", "Check event handler for setting annotation");
- gLastBookmarkAction = "";
- is(testBookmark.annotations.get("testing/bookmark"), "annotate-this", "Checking existence of added annotation");
- testBookmark.annotations.remove("testing/bookmark");
- ok(!testBookmark.annotations.has("testing/bookmark"), "Checking existence of removed annotation");
- is(gLastBookmarkAction, "testing/bookmark", "Check event handler for removing annotation");
- is(testBookmark.annotations.get("testing/bookmark"), null, "Check existence of a missing annotation");
-
- // quick annotation type tests
- testBookmark.annotations.set("testing/bookmark/string", "annotate-this", 0);
- ok(testBookmark.annotations.has("testing/bookmark/string"), "Checking existence of added string annotation");
- is(testBookmark.annotations.get("testing/bookmark/string"), "annotate-this", "Checking value of added string annotation");
- is(gLastBookmarkAction, "testing/bookmark/string", "Check event handler for setting annotation");
- gLastBookmarkAction = "";
- testBookmark.annotations.set("testing/bookmark/int", 100, 0);
- ok(testBookmark.annotations.has("testing/bookmark/int"), "Checking existence of added integer annotation");
- is(testBookmark.annotations.get("testing/bookmark/int"), 100, "Checking value of added integer annotation");
- is(gLastBookmarkAction, "testing/bookmark/int", "Check event handler for setting annotation");
- gLastBookmarkAction = "";
- testBookmark.annotations.set("testing/bookmark/double", 3.333, 0);
- ok(testBookmark.annotations.has("testing/bookmark/double"), "Checking existence of added double annotation");
- is(testBookmark.annotations.get("testing/bookmark/double"), 3.333, "Checking value of added double annotation");
- is(gLastBookmarkAction, "testing/bookmark/double", "Check event handler for setting annotation");
- gLastBookmarkAction = "";
-
- // test names array - NOTE: "bookmarkProperties/description" is an annotation too
- var names = testBookmark.annotations.names;
- ok(names.some(function (f) f == "bookmarkProperties/description"), "Checking for description annotation");
- ok(names.some(function (f) f == "testing/bookmark/string"), "Checking for string test annotation");
- ok(names.some(function (f) f == "testing/bookmark/int"), "Checking for int test annotation");
- ok(names.some(function (f) f == "testing/bookmark/double"), "Checking for double test annotation");
-
- // test adding a separator
- var testSeparator = testFolder.addSeparator();
- ok(testSeparator, "Check bookmark creation");
- ok(testSeparator.parent, "Check parent after separator creation");
- is(gLastFolderAction, "addchild", "Check event handler for adding a child separator to a folder");
- is(testSeparator.type, "separator", "Check 'bookmark.type' after separator creation");
-
- is(testFolder.children.length, 2, "Check test folder child count after adding a child separator");
-
- // test removing separator
- testSeparator.events.addListener("remove", onBookmarkRemove);
- testSeparator.remove();
- is(gLastBookmarkAction, "remove", "Check event handler for removing separator");
- is(gLastFolderAction, "removechild", "Check event handler for removing a child separator from a folder");
- is(testFolder.children.length, 1, "Check test folder child count after removing a child separator");
-
- // test removing bookmark
- testBookmark.events.addListener("remove", onBookmarkRemove);
- testBookmark.remove();
- is(gLastBookmarkAction, "remove", "Check event handler for removing bookmark");
- is(gLastFolderAction, "removechild", "Check event handler for removing a child from a folder");
- is(testFolder.children.length, 0, "Check test folder child count after removing a child bookmark");
-
- // test removing a folder
- testFolder.events.addListener("remove", onFolderRemove);
- testFolder.remove();
- is(gLastFolderAction, "remove", "Check event handler for removing child folder");
- rootKidCount--;
- is(root.children.length, rootKidCount, "Check root folder child count after removing a child folder");
-
- // test moving between folders
- var testFolderA = root.addFolder("folder-a");
- var testFolderB = root.addFolder("folder-b");
-
- var testMove = testFolderA.addBookmark("Mozilla", url("https://www.mozilla.org/"));
- testMove.events.addListener("move", onBookmarkMove);
- is(testMove.parent.title, "folder-a", "Checking for new parent before moving bookmark");
-
- testMove.parent = testFolderB;
- is(testMove.parent.title, "folder-b", "Checking for new parent after moving bookmark");
- is(gLastBookmarkAction, "move", "Checking for event handler after moving bookmark");
-
- // test moving a folder
- testFolderA.events.addListener("move", onFolderMove);
- testFolderA.parent = testFolderB;
- is(testFolderA.parent.title, "folder-b", "Checking for new parent after moving folder");
- is(gLastFolderAction, "move", "Checking for event handler after moving folder");
-
- // test events on the root
- root.events.addListener("add", onRootAdd);
- root.events.addListener("remove", onRootRemove);
- root.events.addListener("change", onRootChange);
- var testFolderC = root.addFolder("folder-c");
- is(gLastRootAction, "add");
-
- root.events.removeListener("add", onRootAdd);
- gLastRootAction = "";
- var testFolderD = root.addFolder("folder-d");
- is(gLastRootAction, "");
-
- testFolderC.remove();
- is(gLastRootAction, "remove");
-
- testFolderD.description = "Foo";
- is(gLastRootAction, "bookmarkProperties/description");
-}
-
-function onFolderChange(evt) {
- gLastFolderAction = evt.data;
-}
-
-function onFolderRemove(evt) {
- gLastFolderAction = evt.type;
-}
-
-function onFolderAddChild(evt) {
- gLastFolderAction = evt.type;
-}
-
-function onFolderRemoveChild(evt) {
- gLastFolderAction = evt.type;
-}
-
-function onFolderMove(evt) {
- gLastFolderAction = evt.type;
-}
-
-function onBookmarkChange(evt) {
- gLastBookmarkAction = evt.data;
-}
-
-function onBookmarkRemove(evt) {
- gLastBookmarkAction = evt.type;
-}
-
-function onBookmarkMove(evt) {
- gLastBookmarkAction = evt.type;
-}
-
-function onRootAdd(evt) {
- gLastRootAction = evt.type;
-}
-
-function onRootRemove(evt) {
- gLastRootAction = evt.type;
-}
-
-function onRootChange(evt) {
- gLastRootAction = evt.data;
-}
diff --git a/browser/fuel/test/browser_Browser.js b/browser/fuel/test/browser_Browser.js
deleted file mode 100644
index d5e64129e..000000000
--- a/browser/fuel/test/browser_Browser.js
+++ /dev/null
@@ -1,148 +0,0 @@
-var gPageA = null;
-var gPageB = null;
-
-// cached data from events
-var gTabOpenPageA = null;
-var gTabOpenPageB = null;
-var gTabOpenCount = 0;
-var gTabCloseCount = 0;
-var gTabMoveCount = 0;
-var gPageLoadCount = 0;
-
-var rootDir = getRootDirectory(gTestPath);
-const CHROMEROOT = rootDir;
-
-function test() {
- waitForExplicitFinish();
-
- var windows = Application.windows;
- ok(windows, "Check access to browser windows");
- is(windows.length, 1, "There should be one browser window open");
-
- var activeWin = Application.activeWindow;
- activeWin.events.addListener("TabOpen", onTabOpen);
- activeWin.events.addListener("TabClose", onTabClose);
- activeWin.events.addListener("TabMove", onTabMove);
-
- gPageA = activeWin.open(makeURI(CHROMEROOT + "ContentA.html"));
- gPageA.events.addListener("load", onPageAFirstLoad);
-
- is(activeWin.tabs.length, 2, "Checking length of 'Browser.tabs' after opening 1 additional tab");
-
- function onPageAFirstLoad(event) {
- gPageA.events.removeListener("load", onPageAFirstLoad);
- is(gPageA.uri.spec, event.data.uri.spec, "Checking event browser tab is equal to page A");
-
- gPageB = activeWin.open(makeURI(CHROMEROOT + "ContentB.html"));
- gPageB.events.addListener("load", delayAfterOpen);
- gPageB.focus();
-
- is(activeWin.tabs.length, 3, "Checking length of 'Browser.tabs' after opening a second additional tab");
- is(activeWin.activeTab.index, gPageB.index, "Checking 'Browser.activeTab' after setting focus");
- }
-
- function delayAfterOpen() {
- executeSoon(afterOpen);
- }
-
- // need to wait for the url's to be refreshed during the load
- function afterOpen(event) {
- gPageB.events.removeListener("load", delayAfterOpen);
- // check actuals
- is(gPageA.uri.spec, CHROMEROOT + "ContentA.html", "Checking 'BrowserTab.uri' after opening");
- is(gPageB.uri.spec, CHROMEROOT + "ContentB.html", "Checking 'BrowserTab.uri' after opening");
-
- // check event
- is(gTabOpenCount, 2, "Checking event handler for tab open");
- // check cached values from TabOpen event
- is(gPageA.uri.spec, gTabOpenPageA.uri.spec, "Checking first browser tab open is equal to page A");
- is(gPageB.uri.spec, gTabOpenPageB.uri.spec, "Checking second browser tab open is equal to page B");
-
- // test document access
- var test1 = gPageA.document.getElementById("test1");
- ok(test1, "Checking existence of element in content DOM");
- is(test1.innerHTML, "A", "Checking content of element in content DOM");
-
- // test moving tab
- is(gTabMoveCount, 0, "Checking initial tab move count");
-
- // move the tab
- gPageA.moveToEnd();
- is(gPageA.index, 2, "Checking index after moving tab");
-
- // check event
- is(gTabMoveCount, 1, "Checking event handler for tab move");
-
- gBrowser.addProgressListener({
- onStateChange: function (webProgress, request, stateFlags, status) {
- info("onStateChange: " + stateFlags);
-
- const complete = Ci.nsIWebProgressListener.STATE_IS_WINDOW +
- Ci.nsIWebProgressListener.STATE_IS_NETWORK +
- Ci.nsIWebProgressListener.STATE_STOP;
- if ((stateFlags & complete) == complete) {
- gBrowser.removeProgressListener(this);
- onPageBLoadComplete();
- }
- },
- onLocationChange: function () 0,
- onProgressChange: function () 0,
- onStatusChange: function () 0,
- onSecurityChange: function () 0
- });
-
- // test loading new content with a frame into a tab
- // the event will be checked in onPageBLoadComplete
- gPageB.events.addListener("load", onPageBLoadWithFrames);
- gPageB.load(makeURI(CHROMEROOT + "ContentWithFrames.html"));
- }
-
- function onPageBLoadWithFrames(event) {
- gPageLoadCount++;
- info("onPageBLoadWithFrames: " + gPageLoadCount);
- }
-
- function onPageBLoadComplete() {
- gPageB.events.removeListener("load", onPageBLoadWithFrames);
- // check page load with frame event
- is(gPageLoadCount, 1, "Checking load count after loading new content with a frame");
-
- // test loading new content into a tab
- // the event will be checked in onPageASecondLoad
- gPageA.events.addListener("load", onPageASecondLoad);
- gPageA.load(makeURI(CHROMEROOT + "ContentB.html"));
- }
-
- function onPageASecondLoad(event) {
- gPageA.events.removeListener("load", onPageASecondLoad);
- is(gPageA.uri.spec, CHROMEROOT + "ContentB.html", "Checking 'BrowserTab.uri' after loading new content");
-
- // start testing closing tabs
- // the event will be checked in afterClose
- // use executeSoon so the onPageASecondLoad
- // has a chance to finish first
- gPageA.close();
- gPageB.close();
-
- is(gTabCloseCount, 2, "Checking that tabs closed");
- is(activeWin.tabs.length, 1, "Checking length of 'Browser.tabs' after closing 2 tabs");
- finish();
- }
-}
-function onTabOpen(event) {
- gTabOpenCount++;
-
- // cache these values so we can check them later (after loading completes)
- if (gTabOpenCount == 1)
- gTabOpenPageA = event.data;
-
- if (gTabOpenCount == 2)
- gTabOpenPageB = event.data;
-}
-function onTabClose(event) {
- gTabCloseCount++;
-}
-
-function onTabMove(event) {
- gTabMoveCount++;
-}
diff --git a/browser/fuel/test/moz.build b/browser/fuel/test/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/fuel/test/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/modules/moz.build b/browser/modules/moz.build
index 5abe8b3be..6ecebe123 100644
--- a/browser/modules/moz.build
+++ b/browser/modules/moz.build
@@ -4,5 +4,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-TEST_DIRS += ['test']
+
diff --git a/browser/modules/test/Makefile.in b/browser/modules/test/Makefile.in
deleted file mode 100644
index 00066aaee..000000000
--- a/browser/modules/test/Makefile.in
+++ /dev/null
@@ -1,26 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_BROWSER_FILES := \
- browser_NetworkPrioritizer.js \
- $(NULL)
-
-ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-MOCHITEST_BROWSER_FILES += \
- browser_taskbar_preview.js \
- $(NULL)
-endif
-
-# bug 793906 - temporarily disabling desktop UI while working on b2g
-# browser_SignInToWebsite.js
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/modules/test/browser_NetworkPrioritizer.js b/browser/modules/test/browser_NetworkPrioritizer.js
deleted file mode 100644
index 51449318e..000000000
--- a/browser/modules/test/browser_NetworkPrioritizer.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-function test() {
- /** Tests for NetworkPrioritizer.jsm (Bug 514490) **/
-
- waitForExplicitFinish();
-
- const PRIORITY_DELTA = -10; // same as in NetworkPrioritizer
-
- // Test helper functions.
- // getPriority and setPriority can take a Tab or a Browser
- function getPriority(aBrowser) {
- // Assume we were passed a tab if it's not a browser
- if (!aBrowser.webNavigation)
- aBrowser = aBrowser.linkedBrowser;
- return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
- .loadGroup.QueryInterface(Ci.nsISupportsPriority).priority;
- }
- function setPriority(aBrowser, aPriority) {
- if (!aBrowser.webNavigation)
- aBrowser = aBrowser.linkedBrowser;
- aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
- .loadGroup.QueryInterface(Ci.nsISupportsPriority).priority = aPriority;
- }
-
- function isWindowState(aWindow, aTabPriorities) {
- let browsers = aWindow.gBrowser.browsers;
- // Make sure we have the right number of tabs & priorities
- is(browsers.length, aTabPriorities.length,
- "Window has expected number of tabs");
- // aState should be in format [ priority, priority, priority ]
- for (let i = 0; i < browsers.length; i++) {
- is(getPriority(browsers[i]), aTabPriorities[i],
- "Tab had expected priority");
- }
- }
-
-
- // This is the real test. It creates multiple tabs & windows, changes focus,
- // closes windows/tabs to make sure we behave correctly.
- // This test assumes that no priorities have been adjusted and the loadgroup
- // priority starts at 0.
- function test_behavior() {
-
- // Call window "window_A" to make the test easier to follow
- let window_A = window;
-
- // Test 1 window, 1 tab case.
- isWindowState(window_A, [-10]);
-
- // Exising tab is tab_A1
- let tab_A2 = window_A.gBrowser.addTab("http://example.com");
- let tab_A3 = window_A.gBrowser.addTab("about:config");
- tab_A3.linkedBrowser.addEventListener("load", function(aEvent) {
- tab_A3.linkedBrowser.removeEventListener("load", arguments.callee, true);
-
- // tab_A2 isn't focused yet
- isWindowState(window_A, [-10, 0, 0]);
-
- // focus tab_A2 & make sure priority got updated
- window_A.gBrowser.selectedTab = tab_A2;
- isWindowState(window_A, [0, -10, 0]);
-
- window_A.gBrowser.removeTab(tab_A2);
- // Next tab is auto selected
- isWindowState(window_A, [0, -10]);
-
- // Open another window then play with focus
- let window_B = openDialog(location, "_blank", "chrome,all,dialog=no", "http://example.com");
- window_B.addEventListener("load", function(aEvent) {
- window_B.removeEventListener("load", arguments.callee, false);
- window_B.gBrowser.addEventListener("load", function(aEvent) {
- // waitForFocus can attach to the wrong "window" with about:blank loading first
- // So just ensure that we're getting the load event for the right URI
- if (window_B.gBrowser.currentURI.spec == "about:blank")
- return;
- window_B.gBrowser.removeEventListener("load", arguments.callee, true);
-
- waitForFocus(function() {
- isWindowState(window_A, [10, 0]);
- isWindowState(window_B, [-10]);
-
- waitForFocus(function() {
- isWindowState(window_A, [0, -10]);
- isWindowState(window_B, [0]);
-
- waitForFocus(function() {
- isWindowState(window_A, [10, 0]);
- isWindowState(window_B, [-10]);
-
- // And we're done. Cleanup & run the next test
- window_B.close();
- window_A.gBrowser.removeTab(tab_A3);
- executeSoon(runNextTest);
- }, window_B);
- }, window_A);
- }, window_B);
- }, true);
- }, false);
- }, true);
-
- }
-
-
- // This is more a test of nsLoadGroup and how it handles priorities. But since
- // we depend on its behavior, it's good to test it. This is testing that there
- // are no errors if we adjust beyond nsISupportsPriority's bounds.
- function test_extremePriorities() {
- let tab_A1 = gBrowser.tabContainer.getItemAtIndex(0);
- let oldPriority = getPriority(tab_A1);
-
- // Set the priority of tab_A1 to the lowest possible. Selecting the other tab
- // will try to lower it
- setPriority(tab_A1, Ci.nsISupportsPriority.PRIORITY_LOWEST);
-
- let tab_A2 = gBrowser.addTab("http://example.com");
- tab_A2.linkedBrowser.addEventListener("load", function(aEvent) {
- tab_A2.linkedBrowser.removeEventListener("load", arguments.callee, true);
- gBrowser.selectedTab = tab_A2;
- is(getPriority(tab_A1), Ci.nsISupportsPriority.PRIORITY_LOWEST - PRIORITY_DELTA,
- "Can adjust priority beyond 'lowest'");
-
- // Now set priority to "highest" and make sure that no errors occur.
- setPriority(tab_A1, Ci.nsISupportsPriority.PRIORITY_HIGHEST);
- gBrowser.selectedTab = tab_A1;
-
- is(getPriority(tab_A1), Ci.nsISupportsPriority.PRIORITY_HIGHEST + PRIORITY_DELTA,
- "Can adjust priority beyond 'highest'");
-
- // Cleanup, run next test
- gBrowser.removeTab(tab_A2);
- executeSoon(function() {
- setPriority(tab_A1, oldPriority);
- runNextTest();
- });
-
- }, true);
- }
-
-
- let tests = [test_behavior, test_extremePriorities];
- function runNextTest() {
- if (tests.length) {
- // Linux has problems if window isn't focused. Should help prevent [orange].
- waitForFocus(tests.shift());
- } else {
- finish();
- }
- }
-
- runNextTest();
-}
diff --git a/browser/modules/test/browser_SignInToWebsite.js b/browser/modules/test/browser_SignInToWebsite.js
deleted file mode 100644
index 65dd304f3..000000000
--- a/browser/modules/test/browser_SignInToWebsite.js
+++ /dev/null
@@ -1,549 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * TO TEST:
- * - test state saved on doorhanger dismissal
- * - links to switch steps
- * - TOS and PP link clicks
- * - identityList is populated correctly
- */
-
-Services.prefs.setBoolPref("toolkit.identity.debug", true);
-
-XPCOMUtils.defineLazyModuleGetter(this, "IdentityService",
- "resource://gre/modules/identity/Identity.jsm");
-
-const TEST_ORIGIN = "https://example.com";
-const TEST_EMAIL = "user@example.com";
-
-let gTestIndex = 0;
-let outerWinId = gBrowser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
-
-function NotificationBase(aNotId) {
- this.id = aNotId;
-}
-NotificationBase.prototype = {
- message: TEST_ORIGIN,
- mainAction: {
- label: "",
- callback: function() {
- this.mainActionClicked = true;
- }.bind(this),
- },
- secondaryActions: [],
- options: {
- "identity": {
- origin: TEST_ORIGIN,
- rpId: outerWinId,
- },
- },
-};
-
-let tests = [
- {
- name: "test_request_required_typed",
-
- run: function() {
- setupRPFlow();
- this.notifyOptions = {
- rpId: outerWinId,
- origin: TEST_ORIGIN,
- };
- this.notifyObj = new NotificationBase("identity-request");
- Services.obs.notifyObservers({wrappedJSObject: this.notifyOptions},
- "identity-request", null);
- },
-
- onShown: function(popup) {
- checkPopup(popup, this.notifyObj);
- let notification = popup.childNodes[0];
-
- // Check identity popup state
- let state = notification.identity;
- ok(!state.typedEmail, "Nothing should be typed yet");
- ok(!state.selected, "Identity should not be selected yet");
- ok(!state.termsOfService, "No TOS specified");
- ok(!state.privacyPolicy, "No PP specified");
- is(state.step, 0, "Step should be persisted with default value");
- is(state.rpId, outerWinId, "Check rpId");
- is(state.origin, TEST_ORIGIN, "Check origin");
-
- is(notification.step, 0, "Should be on the new email step");
- is(notification.chooseEmailLink.hidden, true, "Identity list is empty so link to list view should be hidden");
- is(notification.addEmailLink.parentElement.hidden, true, "We are already on the email input step so choose email pane should be hidden");
- is(notification.emailField.value, "", "Email field should default to empty on a new notification");
- let notifDoc = notification.ownerDocument;
- ok(notifDoc.getAnonymousElementByAttribute(notification, "anonid", "tos").hidden,
- "TOS link should be hidden");
- ok(notifDoc.getAnonymousElementByAttribute(notification, "anonid", "privacypolicy").hidden,
- "PP link should be hidden");
-
- // Try to continue with a missing email address
- triggerMainCommand(popup);
- is(notification.throbber.style.visibility, "hidden", "is throbber visible");
- ok(!notification.button.disabled, "Button should not be disabled");
- is(window.gIdentitySelected, null, "Check no identity selected");
-
- // Fill in an invalid email address and try again
- notification.emailField.value = "foo";
- triggerMainCommand(popup);
- is(notification.throbber.style.visibility, "hidden", "is throbber visible");
- ok(!notification.button.disabled, "Button should not be disabled");
- is(window.gIdentitySelected, null, "Check no identity selected");
-
- // Fill in an email address and try again
- notification.emailField.value = TEST_EMAIL;
- triggerMainCommand(popup);
- is(window.gIdentitySelected.rpId, outerWinId, "Check identity selected rpId");
- is(window.gIdentitySelected.identity, TEST_EMAIL, "Check identity selected email");
- is(notification.identity.selected, TEST_EMAIL, "Check persisted email");
- is(notification.throbber.style.visibility, "visible", "is throbber visible");
- ok(notification.button.disabled, "Button should be disabled");
- ok(notification.emailField.disabled, "Email field should be disabled");
- ok(notification.identityList.disabled, "Identity list should be disabled");
-
- PopupNotifications.getNotification("identity-request").remove();
- },
-
- onHidden: function(popup) { },
- },
- {
- name: "test_request_optional",
-
- run: function() {
- this.notifyOptions = {
- rpId: outerWinId,
- origin: TEST_ORIGIN,
- privacyPolicy: TEST_ORIGIN + "/pp.txt",
- termsOfService: TEST_ORIGIN + "/tos.tzt",
- };
- this.notifyObj = new NotificationBase("identity-request");
- Services.obs.notifyObservers({ wrappedJSObject: this.notifyOptions },
- "identity-request", null);
- },
-
- onShown: function(popup) {
- checkPopup(popup, this.notifyObj);
- let notification = popup.childNodes[0];
-
- // Check identity popup state
- let state = notification.identity;
- ok(!state.typedEmail, "Nothing should be typed yet");
- ok(!state.selected, "Identity should not be selected yet");
- is(state.termsOfService, this.notifyOptions.termsOfService, "Check TOS URL");
- is(state.privacyPolicy, this.notifyOptions.privacyPolicy, "Check PP URL");
- is(state.step, 0, "Step should be persisted with default value");
- is(state.rpId, outerWinId, "Check rpId");
- is(state.origin, TEST_ORIGIN, "Check origin");
-
- is(notification.step, 0, "Should be on the new email step");
- is(notification.chooseEmailLink.hidden, true, "Identity list is empty so link to list view should be hidden");
- is(notification.addEmailLink.parentElement.hidden, true, "We are already on the email input step so choose email pane should be hidden");
- is(notification.emailField.value, "", "Email field should default to empty on a new notification");
- let notifDoc = notification.ownerDocument;
- let tosLink = notifDoc.getAnonymousElementByAttribute(notification, "anonid", "tos");
- ok(!tosLink.hidden, "TOS link should be visible");
- is(tosLink.href, this.notifyOptions.termsOfService, "Check TOS link URL");
- let ppLink = notifDoc.getAnonymousElementByAttribute(notification, "anonid", "privacypolicy");
- ok(!ppLink.hidden, "PP link should be visible");
- is(ppLink.href, this.notifyOptions.privacyPolicy, "Check PP link URL");
-
- // Try to continue with a missing email address
- triggerMainCommand(popup);
- is(notification.throbber.style.visibility, "hidden", "is throbber visible");
- ok(!notification.button.disabled, "Button should not be disabled");
- is(window.gIdentitySelected, null, "Check no identity selected");
-
- // Fill in an invalid email address and try again
- notification.emailField.value = "foo";
- triggerMainCommand(popup);
- is(notification.throbber.style.visibility, "hidden", "is throbber visible");
- ok(!notification.button.disabled, "Button should not be disabled");
- is(window.gIdentitySelected, null, "Check no identity selected");
-
- // Fill in an email address and try again
- notification.emailField.value = TEST_EMAIL;
- triggerMainCommand(popup);
- is(window.gIdentitySelected.rpId, outerWinId, "Check identity selected rpId");
- is(window.gIdentitySelected.identity, TEST_EMAIL, "Check identity selected email");
- is(notification.identity.selected, TEST_EMAIL, "Check persisted email");
- is(notification.throbber.style.visibility, "visible", "is throbber visible");
- ok(notification.button.disabled, "Button should be disabled");
- ok(notification.emailField.disabled, "Email field should be disabled");
- ok(notification.identityList.disabled, "Identity list should be disabled");
-
- PopupNotifications.getNotification("identity-request").remove();
- },
-
- onHidden: function(popup) {},
- },
- {
- name: "test_login_state_changed",
- run: function () {
- this.notifyOptions = {
- rpId: outerWinId,
- };
- this.notifyObj = new NotificationBase("identity-logged-in");
- this.notifyObj.message = "Signed in as: user@example.com";
- this.notifyObj.mainAction.label = "Sign Out";
- this.notifyObj.mainAction.accessKey = "O";
- Services.obs.notifyObservers({ wrappedJSObject: this.notifyOptions },
- "identity-login-state-changed", TEST_EMAIL);
- executeSoon(function() {
- PopupNotifications.getNotification("identity-logged-in").anchorElement.click();
- });
- },
-
- onShown: function(popup) {
- checkPopup(popup, this.notifyObj);
-
- // Fire the notification that the user is no longer logged-in to close the UI.
- Services.obs.notifyObservers({ wrappedJSObject: this.notifyOptions },
- "identity-login-state-changed", null);
- },
-
- onHidden: function(popup) {},
- },
- {
- name: "test_login_state_changed_logout",
- run: function () {
- this.notifyOptions = {
- rpId: outerWinId,
- };
- this.notifyObj = new NotificationBase("identity-logged-in");
- this.notifyObj.message = "Signed in as: user@example.com";
- this.notifyObj.mainAction.label = "Sign Out";
- this.notifyObj.mainAction.accessKey = "O";
- Services.obs.notifyObservers({ wrappedJSObject: this.notifyOptions },
- "identity-login-state-changed", TEST_EMAIL);
- executeSoon(function() {
- PopupNotifications.getNotification("identity-logged-in").anchorElement.click();
- });
- },
-
- onShown: function(popup) {
- checkPopup(popup, this.notifyObj);
-
- // This time trigger the Sign Out button and make sure the UI goes away.
- triggerMainCommand(popup);
- },
-
- onHidden: function(popup) {},
- },
-];
-
-function test_auth() {
- let notifyOptions = {
- provId: outerWinId,
- origin: TEST_ORIGIN,
- };
-
- Services.obs.addObserver(function() {
- // prepare to send auth-complete and close the window
- let winCloseObs = new WindowObserver(function(closedWin) {
- info("closed window");
- finish();
- }, "domwindowclosed");
- Services.ww.registerNotification(winCloseObs);
- Services.obs.notifyObservers(null, "identity-auth-complete", IdentityService.IDP.authenticationFlowSet.authId);
-
- }, "test-identity-auth-window", false);
-
- let winObs = new WindowObserver(function(authWin) {
- ok(authWin, "Authentication window opened");
- ok(authWin.contentWindow.location);
- });
-
- Services.ww.registerNotification(winObs);
-
- Services.obs.notifyObservers({ wrappedJSObject: notifyOptions },
- "identity-auth", TEST_ORIGIN + "/auth");
-}
-
-function test() {
- waitForExplicitFinish();
-
- registerCleanupFunction(cleanUp);
-
- let sitw = {};
- Components.utils.import("resource:///modules/SignInToWebsite.jsm", sitw);
-
- ok(sitw.SignInToWebsiteUX, "SignInToWebsiteUX object exists");
-
- // Replace implementation of ID Service functions for testing
- window.selectIdentity = sitw.SignInToWebsiteUX.selectIdentity;
- sitw.SignInToWebsiteUX.selectIdentity = function(aRpId, aIdentity) {
- info("Identity selected: " + aIdentity);
- window.gIdentitySelected = {rpId: aRpId, identity: aIdentity};
- };
-
- window.setAuthenticationFlow = IdentityService.IDP.setAuthenticationFlow;
- IdentityService.IDP.setAuthenticationFlow = function(aAuthId, aProvId) {
- info("setAuthenticationFlow: " + aAuthId + " : " + aProvId);
- this.authenticationFlowSet = { authId: aAuthId, provId: aProvId };
- Services.obs.notifyObservers(null, "test-identity-auth-window", aAuthId);
- };
-
- runNextTest();
-}
-
-// Cleanup between tests
-function resetState() {
- delete window.gIdentitySelected;
- delete IdentityService.IDP.authenticationFlowSet;
- IdentityService.reset();
-}
-
-// Cleanup after all tests
-function cleanUp() {
- info("cleanup");
- resetState();
-
- for (let topic in gActiveObservers)
- Services.obs.removeObserver(gActiveObservers[topic], topic);
- for (let eventName in gActiveListeners)
- PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
- delete IdentityService.RP._rpFlows[outerWinId];
-
- // Put the JSM functions back to how they were
- IdentityService.IDP.setAuthenticationFlow = window.setAuthenticationFlow;
- delete window.setAuthenticationFlow;
-
- let sitw = {};
- Components.utils.import("resource:///modules/SignInToWebsite.jsm", sitw);
- sitw.SignInToWebsiteUX.selectIdentity = window.selectIdentity;
- delete window.selectIdentity;
-
- Services.prefs.clearUserPref("toolkit.identity.debug");
-}
-
-let gActiveListeners = {};
-let gActiveObservers = {};
-let gShownState = {};
-
-function runNextTest() {
- let nextTest = tests[gTestIndex];
-
- function goNext() {
- resetState();
- if (++gTestIndex == tests.length)
- executeSoon(test_auth);
- else
- executeSoon(runNextTest);
- }
-
- function addObserver(topic) {
- function observer() {
- Services.obs.removeObserver(observer, "PopupNotifications-" + topic);
- delete gActiveObservers["PopupNotifications-" + topic];
-
- info("[Test #" + gTestIndex + "] observer for " + topic + " called");
- nextTest[topic]();
- goNext();
- }
- Services.obs.addObserver(observer, "PopupNotifications-" + topic, false);
- gActiveObservers["PopupNotifications-" + topic] = observer;
- }
-
- if (nextTest.backgroundShow) {
- addObserver("backgroundShow");
- } else if (nextTest.updateNotShowing) {
- addObserver("updateNotShowing");
- } else {
- doOnPopupEvent("popupshowing", function () {
- info("[Test #" + gTestIndex + "] popup showing");
- });
- doOnPopupEvent("popupshown", function () {
- gShownState[gTestIndex] = true;
- info("[Test #" + gTestIndex + "] popup shown");
- nextTest.onShown(this);
- });
-
- // We allow multiple onHidden functions to be defined in an array. They're
- // called in the order they appear.
- let onHiddenArray = nextTest.onHidden instanceof Array ?
- nextTest.onHidden :
- [nextTest.onHidden];
- doOnPopupEvent("popuphidden", function () {
- if (!gShownState[gTestIndex]) {
- // TODO: needed?
- info("Popup from test " + gTestIndex + " was hidden before its popupshown fired");
- }
-
- let onHidden = onHiddenArray.shift();
- info("[Test #" + gTestIndex + "] popup hidden (" + onHiddenArray.length + " hides remaining)");
- executeSoon(function () {
- onHidden.call(nextTest, this);
- if (!onHiddenArray.length)
- goNext();
- }.bind(this));
- }, onHiddenArray.length);
- info("[Test #" + gTestIndex + "] added listeners; panel state: " + PopupNotifications.isPanelOpen);
- }
-
- info("[Test #" + gTestIndex + "] running test");
- nextTest.run();
-}
-
-function doOnPopupEvent(eventName, callback, numExpected) {
- gActiveListeners[eventName] = function (event) {
- if (event.target != PopupNotifications.panel)
- return;
- if (typeof(numExpected) === "number")
- numExpected--;
- if (!numExpected) {
- PopupNotifications.panel.removeEventListener(eventName, gActiveListeners[eventName], false);
- delete gActiveListeners[eventName];
- }
-
- callback.call(PopupNotifications.panel);
- };
- PopupNotifications.panel.addEventListener(eventName, gActiveListeners[eventName], false);
-}
-
-function checkPopup(popup, notificationObj) {
- info("[Test #" + gTestIndex + "] checking popup");
-
- let notifications = popup.childNodes;
- is(notifications.length, 1, "only one notification displayed");
- let notification = notifications[0];
- let icon = document.getAnonymousElementByAttribute(notification, "class", "popup-notification-icon");
- is(notification.getAttribute("label"), notificationObj.message, "message matches");
- is(notification.id, notificationObj.id + "-notification", "id matches");
- if (notificationObj.id != "identity-request" && notificationObj.mainAction) {
- is(notification.getAttribute("buttonlabel"), notificationObj.mainAction.label, "main action label matches");
- is(notification.getAttribute("buttonaccesskey"), notificationObj.mainAction.accessKey, "main action accesskey matches");
- }
- let actualSecondaryActions = notification.childNodes;
- let secondaryActions = notificationObj.secondaryActions || [];
- let actualSecondaryActionsCount = actualSecondaryActions.length;
- if (secondaryActions.length) {
- let lastChild = actualSecondaryActions.item(actualSecondaryActions.length - 1);
- is(lastChild.tagName, "menuseparator", "menuseparator exists");
- actualSecondaryActionsCount--;
- }
- is(actualSecondaryActionsCount, secondaryActions.length, actualSecondaryActions.length + " secondary actions");
- secondaryActions.forEach(function (a, i) {
- is(actualSecondaryActions[i].getAttribute("label"), a.label, "label for secondary action " + i + " matches");
- is(actualSecondaryActions[i].getAttribute("accesskey"), a.accessKey, "accessKey for secondary action " + i + " matches");
- });
-}
-
-function triggerMainCommand(popup) {
- info("[Test #" + gTestIndex + "] triggering main command");
- let notifications = popup.childNodes;
- ok(notifications.length > 0, "at least one notification displayed");
- let notification = notifications[0];
-
- // 20, 10 so that the inner button is hit
- EventUtils.synthesizeMouse(notification.button, 20, 10, {});
-}
-
-function triggerSecondaryCommand(popup, index) {
- info("[Test #" + gTestIndex + "] triggering secondary command");
- let notifications = popup.childNodes;
- ok(notifications.length > 0, "at least one notification displayed");
- let notification = notifications[0];
-
- notification.button.focus();
-
- popup.addEventListener("popupshown", function () {
- popup.removeEventListener("popupshown", arguments.callee, false);
-
- // Press down until the desired command is selected
- for (let i = 0; i <= index; i++)
- EventUtils.synthesizeKey("VK_DOWN", {});
-
- // Activate
- EventUtils.synthesizeKey("VK_ENTER", {});
- }, false);
-
- // One down event to open the popup
- EventUtils.synthesizeKey("VK_DOWN", { altKey: (navigator.platform.indexOf("Mac") == -1) });
-}
-
-function dismissNotification(popup) {
- info("[Test #" + gTestIndex + "] dismissing notification");
- executeSoon(function () {
- EventUtils.synthesizeKey("VK_ESCAPE", {});
- });
-}
-
-function partial(fn) {
- let args = Array.prototype.slice.call(arguments, 1);
- return function() {
- return fn.apply(this, args.concat(Array.prototype.slice.call(arguments)));
- };
-}
-
-// create a mock "doc" object, which the Identity Service
-// uses as a pointer back into the doc object
-function mock_doc(aIdentity, aOrigin, aDoFunc) {
- let mockedDoc = {};
- mockedDoc.id = outerWinId;
- mockedDoc.loggedInEmail = aIdentity;
- mockedDoc.origin = aOrigin;
- mockedDoc['do'] = aDoFunc;
- mockedDoc.doReady = partial(aDoFunc, 'ready');
- mockedDoc.doLogin = partial(aDoFunc, 'login');
- mockedDoc.doLogout = partial(aDoFunc, 'logout');
- mockedDoc.doError = partial(aDoFunc, 'error');
- mockedDoc.doCancel = partial(aDoFunc, 'cancel');
- mockedDoc.doCoffee = partial(aDoFunc, 'coffee');
-
- return mockedDoc;
-}
-
-// takes a list of functions and returns a function that
-// when called the first time, calls the first func,
-// then the next time the second, etc.
-function call_sequentially() {
- let numCalls = 0;
- let funcs = arguments;
-
- return function() {
- if (!funcs[numCalls]) {
- let argString = Array.prototype.slice.call(arguments).join(",");
- ok(false, "Too many calls: " + argString);
- return;
- }
- funcs[numCalls].apply(funcs[numCalls], arguments);
- numCalls += 1;
- };
-}
-
-function setupRPFlow(aIdentity) {
- IdentityService.RP.watch(mock_doc(aIdentity, TEST_ORIGIN, call_sequentially(
- function(action, params) {
- is(action, "ready", "1st callback");
- is(params, null);
- },
- function(action, params) {
- is(action, "logout", "2nd callback");
- is(params, null);
- },
- function(action, params) {
- is(action, "ready", "3rd callback");
- is(params, null);
- }
- )));
-}
-
-function WindowObserver(aCallback, aObserveTopic = "domwindowopened") {
- this.observe = function(aSubject, aTopic, aData) {
- if (aTopic != aObserveTopic) {
- return;
- }
- info(aObserveTopic);
- Services.ww.unregisterNotification(this);
-
- SimpleTest.executeSoon(function() {
- let domWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
- aCallback(domWin);
- });
- };
-}
diff --git a/browser/modules/test/browser_taskbar_preview.js b/browser/modules/test/browser_taskbar_preview.js
deleted file mode 100644
index ad5ec020d..000000000
--- a/browser/modules/test/browser_taskbar_preview.js
+++ /dev/null
@@ -1,139 +0,0 @@
-function test() {
- var isWin7OrHigher = false;
- try {
- let version = Cc["@mozilla.org/system-info;1"]
- .getService(Ci.nsIPropertyBag2)
- .getProperty("version");
- isWin7OrHigher = (parseFloat(version) >= 6.1);
- } catch (ex) { }
-
- is(!!Win7Features, isWin7OrHigher, "Win7Features available when it should be");
- if (!isWin7OrHigher)
- return;
-
- const ENABLE_PREF_NAME = "browser.taskbar.previews.enable";
-
- let temp = {};
- Cu.import("resource:///modules/WindowsPreviewPerTab.jsm", temp);
- let AeroPeek = temp.AeroPeek;
-
- waitForExplicitFinish();
-
- gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
-
- is(1, AeroPeek.windows.length, "Got the expected number of windows");
-
- checkPreviews(1, "Browser starts with one preview");
-
- gBrowser.addTab();
- gBrowser.addTab();
- gBrowser.addTab();
-
- checkPreviews(4, "Correct number of previews after adding");
-
- for each (let preview in AeroPeek.previews)
- ok(preview.visible, "Preview is shown as expected");
-
- gPrefService.setBoolPref(ENABLE_PREF_NAME, false);
- checkPreviews(4, "Previews are unchanged when disabling");
-
- for each (let preview in AeroPeek.previews)
- ok(!preview.visible, "Preview is not shown as expected after disabling");
-
- gPrefService.setBoolPref(ENABLE_PREF_NAME, true);
- checkPreviews(4, "Previews are unchanged when re-enabling");
- for each (let preview in AeroPeek.previews)
- ok(preview.visible, "Preview is shown as expected after re-enabling");
-
- [1,2,3,4].forEach(function (idx) {
- gBrowser.selectedTab = gBrowser.tabs[idx];
- ok(checkSelectedTab(), "Current tab is correctly selected");
- });
-
- let currentSelectedTab = gBrowser.selectedTab;
- for each (let idx in [1,2,3,4]) {
- let preview = getPreviewForTab(gBrowser.tabs[0]);
- let canvas = createThumbnailSurface(preview);
- let ctx = canvas.getContext("2d");
- preview.controller.drawThumbnail(ctx, canvas.width, canvas.height);
- ok(currentSelectedTab.selected, "Drawing thumbnail does not change selection");
- canvas = getCanvas(preview.controller.width, preview.controller.height);
- ctx = canvas.getContext("2d");
- preview.controller.drawPreview(ctx);
- ok(currentSelectedTab.selected, "Drawing preview does not change selection");
- }
-
- // Close #4
- getPreviewForTab(gBrowser.selectedTab).controller.onClose();
- checkPreviews(3, "Expected number of previews after closing selected tab via controller");
- ok(gBrowser.tabs.length == 3, "Successfully closed a tab");
-
- // Select #1
- ok(getPreviewForTab(gBrowser.tabs[0]).controller.onActivate(), "Activation was accepted");
- ok(gBrowser.tabs[0].selected, "Correct tab was selected");
- checkSelectedTab();
-
- // Remove #3 (non active)
- gBrowser.removeTab(gBrowser.tabContainer.lastChild);
- checkPreviews(2, "Expected number of previews after closing unselected via browser");
-
- // Remove #1 (active)
- gBrowser.removeTab(gBrowser.tabContainer.firstChild);
- checkPreviews(1, "Expected number of previews after closing selected tab via browser");
-
- // Add a new tab
- gBrowser.addTab();
- checkPreviews(2);
- // Check default selection
- checkSelectedTab();
-
- // Change selection
- gBrowser.selectedTab = gBrowser.tabs[0];
- checkSelectedTab();
- // Close nonselected tab via controller
- getPreviewForTab(gBrowser.tabs[1]).controller.onClose();
- checkPreviews(1);
-
- if (gPrefService.prefHasUserValue(ENABLE_PREF_NAME))
- gPrefService.clearUserPref(ENABLE_PREF_NAME);
-
- finish();
-
- function checkPreviews(aPreviews, msg) {
- let nPreviews = AeroPeek.previews.length;
- is(aPreviews, gBrowser.tabs.length, "Browser has expected number of tabs");
- is(nPreviews, gBrowser.tabs.length, "Browser has one preview per tab");
- is(nPreviews, aPreviews, msg || "Got expected number of previews");
- }
-
- function getPreviewForTab(tab)
- window.gTaskbarTabGroup.previewFromTab(tab);
-
- function checkSelectedTab()
- getPreviewForTab(gBrowser.selectedTab).active;
-
- function isTabSelected(idx)
- gBrowser.tabs[idx].selected;
-
- function createThumbnailSurface(p) {
- let thumbnailWidth = 200,
- thumbnailHeight = 120;
- let ratio = p.controller.thumbnailAspectRatio;
-
- if (thumbnailWidth/thumbnailHeight > ratio)
- thumbnailWidth = thumbnailHeight * ratio;
- else
- thumbnailHeight = thumbnailWidth / ratio;
-
- return getCanvas(thumbnailWidth, thumbnailHeight);
- }
-
- function getCanvas(width, height) {
- let win = window.QueryInterface(Ci.nsIDOMWindow);
- let doc = win.document;
- let canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
- canvas.width = width;
- canvas.height = height;
- return canvas;
- }
-}
diff --git a/browser/modules/test/chrome/Makefile.in b/browser/modules/test/chrome/Makefile.in
deleted file mode 100644
index b5f4e371a..000000000
--- a/browser/modules/test/chrome/Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEPTH = @DEPTH@
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-relativesrcdir = @relativesrcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MOCHITEST_CHROME_FILES = \
- test_sharedframe.xul \
- sharedframe.xul \
- $(NULL)
-
-include $(topsrcdir)/config/rules.mk
diff --git a/browser/modules/test/chrome/moz.build b/browser/modules/test/chrome/moz.build
deleted file mode 100644
index 895d11993..000000000
--- a/browser/modules/test/chrome/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
diff --git a/browser/modules/test/chrome/sharedframe.xul b/browser/modules/test/chrome/sharedframe.xul
deleted file mode 100644
index 6f63c8682..000000000
--- a/browser/modules/test/chrome/sharedframe.xul
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<window title="Test SharedFrame - Bug 811247"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="runTest();">
-
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
- <script type="application/javascript">
- <![CDATA[
-
- function is(a,b,c) opener.wrappedJSObject.is(a,b,c);
- function ok(a,b) opener.wrappedJSObject.ok(a,b);
- function done() opener.wrappedJSObject.done();
-
- Components.utils.import("resource:///modules/SharedFrame.jsm");
- ok(SharedFrame, "SharedFrame module exists");
-
- let box, gGen;
- function runTest() {
- box = document.getElementById("frames-container");
- gGen = test_module();
- gGen.next();
- }
-
- function test_module() {
- // note: no 'src' attribute means aPreload = false;
- let frame1 = SharedFrame.createFrame("group1", box, {id: "group1-frame1", type: "content"});
- let frame2 = SharedFrame.createFrame("group1", box, {id: "group1-frame2", type: "content"});
- let frame3 = SharedFrame.createFrame("group1", box, {id: "group1-frame3", type: "content"});
-
- // Check proper attribute assignment
- is(frame1.id, "group1-frame1", "correct id");
- is(frame2.id, "group1-frame2", "correct id");
- is(frame3.id, "group1-frame3", "correct id");
-
- is(frame1.getAttribute("type"), "content", "correct type");
- is(frame2.getAttribute("type"), "content", "correct type");
- is(frame3.getAttribute("type"), "content", "correct type");
-
- //--------------------------
- yield waitForLoad([frame1, frame2, frame3]);
-
- // Check for unloaded in the src URL
- ok(/Unloaded/.test(frame1.contentDocument.location), "frame 1 is unloaded");
- ok(/Unloaded/.test(frame2.contentDocument.location), "frame 2 is unloaded");
- ok(/Unloaded/.test(frame3.contentDocument.location), "frame 3 is unloaded");
-
- // Check that there is no frame alive in the group
- ok(!SharedFrame.isGroupAlive("group1"), "group 1 is not alive");
-
- // Set the URL and load the group
- SharedFrame.updateURL("group1", "http://www.example.com");
- SharedFrame.preload("group1", frame1);
-
- //--------------------------
- yield waitForLoad([frame1]);
-
- // Check that frame 1 was properly loaded and the group is alive
- ok(SharedFrame.isGroupAlive("group1"), "group 1 is now alive");
- ok(!/Unloaded/.test(frame1.contentDocument.location), "frame 1 is now loaded");
- ok(/Unloaded/.test(frame2.contentDocument.location), "frame 2 is unloaded");
- ok(/Unloaded/.test(frame3.contentDocument.location), "frame 3 is unloaded");
-
- // Move content to frame 2
- SharedFrame.setOwner("group1", frame2);
-
- ok(/Unloaded/.test(frame1.contentDocument.location), "frame 1 is unloaded");
- ok(!/Unloaded/.test(frame2.contentDocument.location), "content was transfered to frame 2");
- ok(/Unloaded/.test(frame3.contentDocument.location), "frame 3 is unloaded");
-
- // Update URL and check that new content got loaded
- SharedFrame.updateURL("group1", "http://www.example.com/new");
-
- //--------------------------
- yield waitForLoad([frame2]);
-
- ok(/new$/.test(frame2.contentDocument.location), "new url loaded");
-
- // Now remove the loaded content and check if the group is properly reported as unloaded
- box.removeChild(frame2);
- ok(!SharedFrame.isGroupAlive("group1"), "group 1 is not alive");
-
- // And see if setOwnering will reload the group
- SharedFrame.setOwner("group1", frame3);
-
- //--------------------------
- yield waitForLoad([frame3]);
-
- ok(SharedFrame.isGroupAlive("group1"), "group 1 is alive");
- ok(/new$/.test(frame3.contentDocument.location), "content was transfered to frame 3");
-
- // Create a second group to verify it doesn't interact with the first one. Also test
- // that preloading works
- let frame4 = SharedFrame.createFrame("group2", box, {src: "http://www.example.com/group2", type: "content"});
- let frame5 = SharedFrame.createFrame("group2", box, {src: "http://www.example.com/group2", type: "content"});
-
- //--------------------------
- yield waitForLoad([frame4, frame5]);
-
- ok(SharedFrame.isGroupAlive("group2"), "group 2 was preloaded due to the src attribute");
-
- // Check for unloaded in the src URL
- ok(/group2$/.test(frame4.contentDocument.location), "frame 4 is loaded");
- ok(/Unloaded/.test(frame5.contentDocument.location), "frame 5 is unloaded");
-
- SharedFrame.setOwner("group2", frame5);
-
- ok(/Unloaded/.test(frame4.contentDocument.location), "frame 4 is unloaded");
- ok(/group2$/.test(frame5.contentDocument.location), "frame 5 is loaded");
-
- SharedFrame.updateURL("group2", "http://www.example.com/new2");
-
- //--------------------------
- yield waitForLoad([frame5]);
-
- ok(/new2$/.test(frame5.contentDocument.location), "frame 5 changed");
- ok(/Unloaded/.test(frame1.contentDocument.location), "frame 1 still has its previous value");
- ok(/new$/.test(frame3.contentDocument.location), "frame 3 still has its previous value");
-
- //And now check that aPreload parameter works
- let frame7 = SharedFrame.createFrame("group3", box, {src: "http://www.example.com/group3", type: "content"}, false);
-
- //--------------------------
- yield waitForLoad([frame7]);
-
- ok(!SharedFrame.isGroupAlive("group3"), "aPreload = false works");
- ok(/Unloaded/.test(frame7.contentDocument.location), "frame 7 is unloaded");
-
- let frame8 = SharedFrame.createFrame("group3", box, {src: "http://www.example.com/group3", type: "content"});
-
- //--------------------------
- yield waitForLoad([frame8]);
-
- ok(SharedFrame.isGroupAlive("group3"), "aPreload defauls to true");
- ok(/group3/.test(frame8.contentDocument.location), "aPreload + src loads/reloads group");
-
- done();
- }
-
-
- function waitForLoad(frames) {
- let count = frames.length;
- for (let frame of frames) {
- let f = frame;
- f.addEventListener("DOMContentLoaded", function frameloaded(event) {
- f.removeEventListener("DOMContentLoaded", frameloaded, false);
- if (--count == 0) {
- try { gGen.next() } catch (ex if ex instanceof StopIteration) { }
- }
- }, false);
- }
- }
- ]]>
- </script>
-
- <box id="frames-container"/>
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <p id="display"></p>
- <div id="content" style="display:none;"></div>
- <pre id="test"></pre>
- </body>
- <label id="test-result"/>
-</window>
diff --git a/browser/modules/test/chrome/test_sharedframe.xul b/browser/modules/test/chrome/test_sharedframe.xul
deleted file mode 100644
index 793cf0420..000000000
--- a/browser/modules/test/chrome/test_sharedframe.xul
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=811247
--->
-<window title="Mozilla Bug 811247"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
- <!-- test results are displayed in the html:body -->
- <body xmlns="http://www.w3.org/1999/xhtml">
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=811247"
- target="_blank">Mozilla Bug 811247</a>
- </body>
-
- <script type="application/javascript"><![CDATA[
-
- /* Test for Bug 811247
- *
- * The test must run on a separate window becase .swapFrameLoaders currently won't swap
- * iframes that are inside frames with history enabled, which is the case of the test running
- * in the content area of a regular browser window; so we need a blank xul window for that
- */
- SimpleTest.waitForExplicitFinish();
-
- let testWin;
-
- function done() {
- testWin.close();
- SimpleTest.finish();
- }
-
- addLoadEvent(function() {
- testWin = window.open("sharedframe.xul", "", "chrome,dialog,width=400,height=400");
- });
- ]]></script>
-</window>
diff --git a/browser/modules/test/moz.build b/browser/modules/test/moz.build
deleted file mode 100644
index 5cfff8ca7..000000000
--- a/browser/modules/test/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['chrome']