From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- docshell/base/IHistory.h | 144 + docshell/base/LoadContext.cpp | 229 + docshell/base/LoadContext.h | 123 + docshell/base/SerializedLoadContext.cpp | 77 + docshell/base/SerializedLoadContext.h | 92 + docshell/base/crashtests/1257730-1.html | 25 + docshell/base/crashtests/1331295.html | 25 + docshell/base/crashtests/1341657.html | 14 + docshell/base/crashtests/369126-1.html | 16 + docshell/base/crashtests/403574-1.xhtml | 23 + docshell/base/crashtests/40929-1-inner.html | 14 + docshell/base/crashtests/40929-1.html | 6 + docshell/base/crashtests/430124-1.html | 5 + docshell/base/crashtests/430628-1.html | 8 + docshell/base/crashtests/432114-1.html | 8 + docshell/base/crashtests/432114-2.html | 16 + docshell/base/crashtests/436900-1-inner.html | 21 + docshell/base/crashtests/436900-1.html | 8 + docshell/base/crashtests/436900-2-inner.html | 21 + docshell/base/crashtests/436900-2.html | 8 + docshell/base/crashtests/500328-1.html | 17 + docshell/base/crashtests/514779-1.xhtml | 9 + docshell/base/crashtests/614499-1.html | 20 + docshell/base/crashtests/678872-1.html | 36 + docshell/base/crashtests/914521.html | 33 + docshell/base/crashtests/crashtests.list | 16 + docshell/base/moz.build | 88 + docshell/base/nsAboutRedirector.cpp | 224 + docshell/base/nsAboutRedirector.h | 32 + docshell/base/nsCDefaultURIFixup.idl | 13 + docshell/base/nsDSURIContentListener.cpp | 539 + docshell/base/nsDSURIContentListener.h | 74 + docshell/base/nsDefaultURIFixup.cpp | 1152 ++ docshell/base/nsDefaultURIFixup.h | 69 + docshell/base/nsDocShell.cpp | 14853 +++++++++++++++++++ docshell/base/nsDocShell.h | 1083 ++ docshell/base/nsDocShellEditorData.cpp | 192 + docshell/base/nsDocShellEditorData.h | 63 + docshell/base/nsDocShellEnumerator.cpp | 205 + docshell/base/nsDocShellEnumerator.h | 107 + docshell/base/nsDocShellLoadInfo.cpp | 297 + docshell/base/nsDocShellLoadInfo.h | 53 + docshell/base/nsDocShellLoadTypes.h | 117 + docshell/base/nsDocShellTransferableHooks.cpp | 54 + docshell/base/nsDocShellTransferableHooks.h | 28 + docshell/base/nsDownloadHistory.cpp | 52 + docshell/base/nsDownloadHistory.h | 28 + docshell/base/nsIClipboardCommands.idl | 111 + docshell/base/nsIContentViewer.idl | 280 + docshell/base/nsIContentViewerContainer.idl | 20 + docshell/base/nsIContentViewerEdit.idl | 36 + docshell/base/nsIContentViewerFile.idl | 31 + docshell/base/nsIDocCharset.idl | 19 + docshell/base/nsIDocShell.idl | 1186 ++ docshell/base/nsIDocShellLoadInfo.idl | 125 + docshell/base/nsIDocShellTreeItem.idl | 184 + docshell/base/nsIDocShellTreeOwner.idl | 109 + docshell/base/nsIDocumentLoaderFactory.idl | 46 + docshell/base/nsIDownloadHistory.idl | 58 + docshell/base/nsIGlobalHistory2.idl | 59 + docshell/base/nsILinkHandler.h | 94 + docshell/base/nsILoadContext.idl | 155 + docshell/base/nsIPrivacyTransitionObserver.idl | 11 + docshell/base/nsIReflowObserver.idl | 31 + docshell/base/nsIRefreshURI.idl | 91 + docshell/base/nsIScrollObserver.h | 42 + docshell/base/nsIScrollable.idl | 55 + docshell/base/nsITextScroll.idl | 33 + docshell/base/nsIURIFixup.idl | 166 + docshell/base/nsIWebNavigation.idl | 367 + docshell/base/nsIWebNavigationInfo.idl | 63 + docshell/base/nsIWebPageDescriptor.idl | 30 + docshell/base/nsIWebShellServices.h | 34 + docshell/base/nsWebNavigationInfo.cpp | 134 + docshell/base/nsWebNavigationInfo.h | 42 + docshell/base/timeline/AbstractTimelineMarker.cpp | 90 + docshell/base/timeline/AbstractTimelineMarker.h | 73 + .../base/timeline/AutoGlobalTimelineMarker.cpp | 43 + docshell/base/timeline/AutoGlobalTimelineMarker.h | 51 + docshell/base/timeline/AutoTimelineMarker.cpp | 51 + docshell/base/timeline/AutoTimelineMarker.h | 51 + docshell/base/timeline/CompositeTimelineMarker.h | 33 + docshell/base/timeline/ConsoleTimelineMarker.h | 58 + docshell/base/timeline/DocLoadingTimelineMarker.h | 40 + docshell/base/timeline/EventTimelineMarker.h | 43 + docshell/base/timeline/JavascriptTimelineMarker.h | 95 + docshell/base/timeline/LayerTimelineMarker.h | 43 + docshell/base/timeline/MarkersStorage.cpp | 29 + docshell/base/timeline/MarkersStorage.h | 48 + docshell/base/timeline/MessagePortTimelineMarker.h | 47 + docshell/base/timeline/ObservedDocShell.cpp | 171 + docshell/base/timeline/ObservedDocShell.h | 52 + docshell/base/timeline/RestyleTimelineMarker.h | 42 + docshell/base/timeline/TimelineConsumers.cpp | 312 + docshell/base/timeline/TimelineConsumers.h | 135 + docshell/base/timeline/TimelineMarker.cpp | 71 + docshell/base/timeline/TimelineMarker.h | 49 + docshell/base/timeline/TimelineMarkerEnums.h | 26 + docshell/base/timeline/TimestampTimelineMarker.h | 38 + docshell/base/timeline/WorkerTimelineMarker.h | 46 + docshell/base/timeline/moz.build | 42 + docshell/base/timeline/readme.md | 97 + docshell/build/moz.build | 28 + docshell/build/nsDocShellCID.h | 90 + docshell/build/nsDocShellModule.cpp | 228 + docshell/moz.build | 50 + docshell/resources/content/jar.mn | 6 + docshell/resources/content/moz.build | 7 + docshell/resources/content/netError.xhtml | 397 + docshell/shistory/moz.build | 40 + docshell/shistory/nsIBFCacheEntry.idl | 18 + docshell/shistory/nsIGroupedSHistory.idl | 47 + docshell/shistory/nsIPartialSHistory.idl | 62 + docshell/shistory/nsIPartialSHistoryListener.idl | 24 + docshell/shistory/nsISHContainer.idl | 49 + docshell/shistory/nsISHEntry.idl | 352 + docshell/shistory/nsISHTransaction.idl | 56 + docshell/shistory/nsISHistory.idl | 221 + docshell/shistory/nsISHistoryInternal.idl | 104 + docshell/shistory/nsISHistoryListener.idl | 108 + docshell/shistory/nsSHEntry.cpp | 944 ++ docshell/shistory/nsSHEntry.h | 71 + docshell/shistory/nsSHEntryShared.cpp | 385 + docshell/shistory/nsSHEntryShared.h | 97 + docshell/shistory/nsSHTransaction.cpp | 107 + docshell/shistory/nsSHTransaction.h | 37 + docshell/shistory/nsSHistory.cpp | 1932 +++ docshell/shistory/nsSHistory.h | 133 + docshell/test/browser/browser.ini | 93 + docshell/test/browser/browser_bug1206879.js | 31 + ...ser_bug1309900_crossProcessHistoryNavigation.js | 35 + docshell/test/browser/browser_bug134911.js | 41 + docshell/test/browser/browser_bug234628-1.js | 18 + docshell/test/browser/browser_bug234628-10.js | 18 + docshell/test/browser/browser_bug234628-11.js | 18 + docshell/test/browser/browser_bug234628-2.js | 18 + docshell/test/browser/browser_bug234628-3.js | 18 + docshell/test/browser/browser_bug234628-4.js | 18 + docshell/test/browser/browser_bug234628-5.js | 18 + docshell/test/browser/browser_bug234628-6.js | 18 + docshell/test/browser/browser_bug234628-7.js | 18 + docshell/test/browser/browser_bug234628-8.js | 11 + docshell/test/browser/browser_bug234628-9.js | 11 + docshell/test/browser/browser_bug349769.js | 47 + docshell/test/browser/browser_bug388121-1.js | 15 + docshell/test/browser/browser_bug388121-2.js | 58 + docshell/test/browser/browser_bug420605.js | 122 + docshell/test/browser/browser_bug422543.js | 116 + docshell/test/browser/browser_bug441169.js | 37 + docshell/test/browser/browser_bug503832.js | 87 + docshell/test/browser/browser_bug554155.js | 26 + docshell/test/browser/browser_bug655270.js | 60 + docshell/test/browser/browser_bug655273.js | 30 + docshell/test/browser/browser_bug670318.js | 70 + docshell/test/browser/browser_bug673467.js | 51 + docshell/test/browser/browser_bug852909.js | 23 + docshell/test/browser/browser_bug92473.js | 54 + .../test/browser/browser_loadDisallowInherit.js | 65 + docshell/test/browser/browser_loadURI.js | 34 + .../test/browser/browser_multiple_pushState.js | 15 + .../browser/browser_onbeforeunload_navigation.js | 176 + .../test/browser/browser_search_notification.js | 51 + docshell/test/browser/browser_tab_touch_events.js | 49 + .../test/browser/browser_timelineMarkers-01.js | 32 + .../test/browser/browser_timelineMarkers-02.js | 15 + .../test/browser/browser_timelineMarkers-03.js | 8 + .../test/browser/browser_timelineMarkers-04.js | 8 + .../test/browser/browser_timelineMarkers-05.js | 15 + .../browser/browser_timelineMarkers-frame-02.js | 133 + .../browser/browser_timelineMarkers-frame-03.js | 91 + .../browser/browser_timelineMarkers-frame-04.js | 88 + .../browser/browser_timelineMarkers-frame-05.js | 117 + docshell/test/browser/browser_ua_emulation.js | 36 + .../browser/browser_uriFixupAlternateRedirects.js | 24 + .../test/browser/browser_uriFixupIntegration.js | 51 + docshell/test/browser/favicon_bug655270.ico | Bin 0 -> 1406 bytes docshell/test/browser/file_bug1046022.html | 50 + docshell/test/browser/file_bug1206879.html | 9 + docshell/test/browser/file_bug234628-1-child.html | 12 + docshell/test/browser/file_bug234628-1.html | 17 + .../test/browser/file_bug234628-10-child.xhtml | 4 + docshell/test/browser/file_bug234628-10.html | 17 + .../test/browser/file_bug234628-11-child.xhtml | 4 + .../browser/file_bug234628-11-child.xhtml^headers^ | 1 + docshell/test/browser/file_bug234628-11.html | 17 + docshell/test/browser/file_bug234628-2-child.html | 12 + docshell/test/browser/file_bug234628-2.html | 17 + docshell/test/browser/file_bug234628-3-child.html | 13 + docshell/test/browser/file_bug234628-3.html | 18 + docshell/test/browser/file_bug234628-4-child.html | 12 + docshell/test/browser/file_bug234628-4.html | 18 + docshell/test/browser/file_bug234628-5-child.html | Bin 0 -> 498 bytes docshell/test/browser/file_bug234628-5.html | 18 + docshell/test/browser/file_bug234628-6-child.html | Bin 0 -> 540 bytes .../browser/file_bug234628-6-child.html^headers^ | 1 + docshell/test/browser/file_bug234628-6.html | 18 + docshell/test/browser/file_bug234628-7-child.html | 12 + .../browser/file_bug234628-7-child.html^headers^ | 1 + docshell/test/browser/file_bug234628-7.html | 18 + docshell/test/browser/file_bug234628-8-child.html | 12 + docshell/test/browser/file_bug234628-8.html | 17 + docshell/test/browser/file_bug234628-9-child.html | 12 + docshell/test/browser/file_bug234628-9.html | Bin 0 -> 740 bytes docshell/test/browser/file_bug420605.html | 31 + docshell/test/browser/file_bug422543_script.js | 98 + docshell/test/browser/file_bug503832.html | 35 + docshell/test/browser/file_bug655270.html | 11 + docshell/test/browser/file_bug670318.html | 23 + docshell/test/browser/file_bug852909.pdf | Bin 0 -> 1568 bytes docshell/test/browser/file_bug852909.png | Bin 0 -> 94 bytes docshell/test/browser/file_multiple_pushState.html | 14 + docshell/test/browser/frame-head.js | 113 + docshell/test/browser/head.js | 99 + docshell/test/browser/print_postdata.sjs | 22 + docshell/test/browser/redirect_to_example.sjs | 4 + docshell/test/browser/test-form_sjis.html | 24 + docshell/test/browser/timelineMarkers-04.html | 55 + docshell/test/bug123696-subframe.html | 16 + docshell/test/bug369814.jar | Bin 0 -> 1311 bytes docshell/test/bug369814.zip | Bin 0 -> 1000 bytes docshell/test/bug404548-subframe.html | 7 + docshell/test/bug413310-post.sjs | 7 + docshell/test/bug413310-subframe.html | 7 + docshell/test/bug529119-window.html | 7 + docshell/test/bug530396-noref.sjs | 20 + docshell/test/bug530396-subframe.html | 7 + docshell/test/bug570341_recordevents.html | 21 + docshell/test/bug668513_redirect.html | 1 + docshell/test/bug668513_redirect.html^headers^ | 2 + docshell/test/bug691547_frame.html | 12 + docshell/test/chrome/112564_nocache.html | 10 + docshell/test/chrome/112564_nocache.html^headers^ | 1 + docshell/test/chrome/215405_nocache.html | 14 + docshell/test/chrome/215405_nocache.html^headers^ | 1 + docshell/test/chrome/215405_nostore.html | 14 + docshell/test/chrome/215405_nostore.html^headers^ | 1 + docshell/test/chrome/582176_dummy.html | 1 + docshell/test/chrome/582176_xml.xml | 2 + docshell/test/chrome/582176_xslt.xsl | 8 + docshell/test/chrome/662200a.html | 8 + docshell/test/chrome/662200b.html | 8 + docshell/test/chrome/662200c.html | 7 + docshell/test/chrome/89419.html | 7 + docshell/test/chrome/92598_nostore.html | 10 + docshell/test/chrome/92598_nostore.html^headers^ | 1 + docshell/test/chrome/allowContentRetargeting.sjs | 7 + docshell/test/chrome/blue.png | Bin 0 -> 2745 bytes docshell/test/chrome/bug112564_window.xul | 117 + docshell/test/chrome/bug113934_window.xul | 161 + docshell/test/chrome/bug215405_window.xul | 167 + docshell/test/chrome/bug293235.html | 13 + docshell/test/chrome/bug293235_p2.html | 8 + docshell/test/chrome/bug293235_window.xul | 162 + docshell/test/chrome/bug294258_testcase.html | 43 + docshell/test/chrome/bug294258_window.xul | 76 + docshell/test/chrome/bug298622_window.xul | 148 + docshell/test/chrome/bug301397_1.html | 9 + docshell/test/chrome/bug301397_2.html | 10 + docshell/test/chrome/bug301397_3.html | 10 + docshell/test/chrome/bug301397_4.html | 9 + docshell/test/chrome/bug301397_window.xul | 250 + docshell/test/chrome/bug303267.html | 25 + docshell/test/chrome/bug303267_window.xul | 101 + docshell/test/chrome/bug311007_window.xul | 199 + docshell/test/chrome/bug321671_window.xul | 133 + docshell/test/chrome/bug360511_case1.html | 15 + docshell/test/chrome/bug360511_case2.html | 15 + docshell/test/chrome/bug360511_window.xul | 134 + docshell/test/chrome/bug364461_window.xul | 277 + docshell/test/chrome/bug396519_window.xul | 169 + docshell/test/chrome/bug396649_window.xul | 122 + docshell/test/chrome/bug449778_window.xul | 106 + docshell/test/chrome/bug449780_window.xul | 77 + docshell/test/chrome/bug454235-subframe.xul | 7 + docshell/test/chrome/bug582176_window.xul | 88 + docshell/test/chrome/bug608669.xul | 6 + docshell/test/chrome/bug662200_window.xul | 129 + docshell/test/chrome/bug690056_window.xul | 176 + docshell/test/chrome/bug846906.html | 10 + docshell/test/chrome/bug89419.sjs | 13 + docshell/test/chrome/bug89419_window.xul | 82 + docshell/test/chrome/bug909218.html | 11 + docshell/test/chrome/bug909218.js | 2 + docshell/test/chrome/bug92598_window.xul | 118 + docshell/test/chrome/chrome.ini | 88 + docshell/test/chrome/docshell_helpers.js | 496 + .../file_viewsource_forbidden_in_iframe.html | 11 + docshell/test/chrome/gen_template.pl | 39 + docshell/test/chrome/generic.html | 12 + docshell/test/chrome/mozFrameType_window.xul | 57 + docshell/test/chrome/red.png | Bin 0 -> 82 bytes docshell/test/chrome/test.template.txt | 41 + .../test/chrome/test_allowContentRetargeting.html | 94 + docshell/test/chrome/test_bug112564.xul | 38 + docshell/test/chrome/test_bug113934.xul | 31 + docshell/test/chrome/test_bug215405.xul | 38 + docshell/test/chrome/test_bug293235.xul | 39 + docshell/test/chrome/test_bug294258.xul | 39 + docshell/test/chrome/test_bug298622.xul | 39 + docshell/test/chrome/test_bug301397.xul | 39 + docshell/test/chrome/test_bug303267.xul | 40 + docshell/test/chrome/test_bug311007.xul | 45 + docshell/test/chrome/test_bug321671.xul | 39 + docshell/test/chrome/test_bug360511.xul | 40 + docshell/test/chrome/test_bug364461.xul | 38 + docshell/test/chrome/test_bug396519.xul | 29 + docshell/test/chrome/test_bug396649.xul | 41 + docshell/test/chrome/test_bug428288.html | 37 + docshell/test/chrome/test_bug449778.xul | 31 + docshell/test/chrome/test_bug449780.xul | 31 + docshell/test/chrome/test_bug453650.xul | 115 + docshell/test/chrome/test_bug454235.xul | 56 + docshell/test/chrome/test_bug456980.xul | 31 + docshell/test/chrome/test_bug565388.xul | 83 + docshell/test/chrome/test_bug582176.xul | 39 + docshell/test/chrome/test_bug608669.xul | 117 + docshell/test/chrome/test_bug662200.xul | 39 + docshell/test/chrome/test_bug690056.xul | 26 + docshell/test/chrome/test_bug789773.xul | 71 + docshell/test/chrome/test_bug846906.xul | 96 + docshell/test/chrome/test_bug89419.xul | 39 + docshell/test/chrome/test_bug909218.html | 127 + docshell/test/chrome/test_bug92598.xul | 38 + docshell/test/chrome/test_mozFrameType.xul | 43 + docshell/test/chrome/test_principalInherit.xul | 108 + .../test/chrome/test_private_hidden_window.html | 56 + .../chrome/test_viewsource_forbidden_in_iframe.xul | 180 + docshell/test/chrome/window.template.txt | 44 + .../file_anchor_scroll_after_document_open.html | 15 + docshell/test/file_bug385434_1.html | 29 + docshell/test/file_bug385434_2.html | 26 + docshell/test/file_bug385434_3.html | 22 + docshell/test/file_bug475636.sjs | 90 + docshell/test/file_bug509055.html | 9 + docshell/test/file_bug511449.html | 6 + docshell/test/file_bug540462.html | 16 + docshell/test/file_bug580069_1.html | 8 + docshell/test/file_bug580069_2.sjs | 5 + docshell/test/file_bug590573_1.html | 8 + docshell/test/file_bug590573_2.html | 8 + docshell/test/file_bug634834.html | 5 + docshell/test/file_bug640387.html | 26 + docshell/test/file_bug653741.html | 13 + docshell/test/file_bug660404 | 5 + docshell/test/file_bug660404^headers^ | 1 + docshell/test/file_bug662170.html | 13 + docshell/test/file_bug668513.html | 107 + docshell/test/file_bug669671.sjs | 14 + docshell/test/file_bug680257.html | 16 + docshell/test/file_bug703855.html | 2 + docshell/test/file_bug728939.html | 3 + docshell/test/file_framedhistoryframes.html | 16 + .../test/file_pushState_after_document_open.html | 11 + docshell/test/historyframes.html | 150 + .../iframesandbox/file_marquee_event_handlers.html | 17 + ...ile_other_auxiliary_navigation_by_location.html | 15 + .../file_our_auxiliary_navigation_by_location.html | 15 + .../file_parent_navigation_by_location.html | 18 + .../file_sibling_navigation_by_location.html | 15 + .../file_top_navigation_by_location.html | 20 + .../file_top_navigation_by_location_exotic.html | 26 + docshell/test/iframesandbox/mochitest.ini | 24 + .../test_child_navigation_by_location.html | 92 + .../iframesandbox/test_marquee_event_handlers.html | 95 + ...est_other_auxiliary_navigation_by_location.html | 80 + .../test_our_auxiliary_navigation_by_location.html | 84 + .../test_parent_navigation_by_location.html | 75 + .../test_sibling_navigation_by_location.html | 78 + .../test_top_navigation_by_location.html | 167 + .../test_top_navigation_by_location_exotic.html | 204 + docshell/test/mochitest.ini | 94 + docshell/test/navigation/NavigationUtils.js | 213 + docshell/test/navigation/blank.html | 1 + docshell/test/navigation/browser.ini | 12 + docshell/test/navigation/browser_bug343515.js | 262 + .../navigation/browser_test-content-chromeflags.js | 45 + docshell/test/navigation/bug343515_pg1.html | 5 + docshell/test/navigation/bug343515_pg2.html | 7 + docshell/test/navigation/bug343515_pg3.html | 7 + docshell/test/navigation/bug343515_pg3_1.html | 6 + docshell/test/navigation/bug343515_pg3_1_1.html | 1 + docshell/test/navigation/bug343515_pg3_2.html | 1 + docshell/test/navigation/file_bug1300461.html | 63 + docshell/test/navigation/file_bug1300461_back.html | 31 + .../test/navigation/file_bug1300461_redirect.html | 10 + .../file_bug1300461_redirect.html^headers^ | 2 + docshell/test/navigation/file_bug462076_1.html | 55 + docshell/test/navigation/file_bug462076_2.html | 52 + docshell/test/navigation/file_bug462076_3.html | 52 + docshell/test/navigation/file_bug508537_1.html | 34 + docshell/test/navigation/file_bug534178.html | 31 + .../test/navigation/file_document_write_1.html | 30 + .../file_fragment_handling_during_load.html | 24 + docshell/test/navigation/file_nested_frames.html | 28 + .../test/navigation/file_scrollRestoration.html | 137 + .../navigation/file_shiftReload_and_pushState.html | 29 + .../test/navigation/file_static_and_dynamic_1.html | 32 + .../file_triggeringprincipal_frame_1.html | 27 + .../file_triggeringprincipal_frame_2.html | 8 + ...rincipal_iframe_iframe_window_open_frame_a.html | 6 + ...ipal_iframe_iframe_window_open_frame_a_nav.html | 6 + ...rincipal_iframe_iframe_window_open_frame_b.html | 15 + ...ngprincipal_parent_iframe_window_open_base.html | 6 + ...ingprincipal_parent_iframe_window_open_nav.html | 6 + .../file_triggeringprincipal_subframe.html | 15 + .../file_triggeringprincipal_subframe_nav.html | 21 + .../file_triggeringprincipal_window_open.html | 6 + docshell/test/navigation/frame0.html | 3 + docshell/test/navigation/frame1.html | 3 + docshell/test/navigation/frame2.html | 3 + docshell/test/navigation/frame3.html | 3 + docshell/test/navigation/goback.html | 5 + docshell/test/navigation/iframe.html | 8 + docshell/test/navigation/mochitest.ini | 64 + docshell/test/navigation/navigate.html | 36 + docshell/test/navigation/open.html | 9 + docshell/test/navigation/parent.html | 14 + docshell/test/navigation/test_bug13871.html | 81 + docshell/test/navigation/test_bug270414.html | 93 + docshell/test/navigation/test_bug278916.html | 37 + docshell/test/navigation/test_bug279495.html | 48 + docshell/test/navigation/test_bug344861.html | 35 + docshell/test/navigation/test_bug386782.html | 137 + docshell/test/navigation/test_bug430624.html | 56 + docshell/test/navigation/test_bug430723.html | 138 + docshell/test/navigation/test_child.html | 48 + docshell/test/navigation/test_grandchild.html | 48 + docshell/test/navigation/test_not-opener.html | 51 + docshell/test/navigation/test_opener.html | 52 + .../navigation/test_popup-navigates-children.html | 62 + docshell/test/navigation/test_reserved.html | 100 + docshell/test/navigation/test_sessionhistory.html | 68 + .../navigation/test_sibling-matching-parent.html | 46 + .../test/navigation/test_sibling-off-domain.html | 46 + .../test_triggeringprincipal_frame_nav.html | 69 + ...ggeringprincipal_iframe_iframe_window_open.html | 87 + ...ggeringprincipal_parent_iframe_window_open.html | 70 + .../test_triggeringprincipal_window_open.html | 101 + .../test_anchor_scroll_after_document_open.html | 55 + docshell/test/test_bfcache_plus_hash.html | 120 + docshell/test/test_bug1045096.html | 29 + docshell/test/test_bug1121701.html | 71 + docshell/test/test_bug1186774.html | 51 + docshell/test/test_bug123696.html | 46 + docshell/test/test_bug369814.html | 211 + docshell/test/test_bug384014.html | 41 + docshell/test/test_bug385434.html | 209 + docshell/test/test_bug387979.html | 54 + docshell/test/test_bug402210.html | 50 + docshell/test/test_bug404548.html | 39 + docshell/test/test_bug413310.html | 106 + docshell/test/test_bug475636.html | 52 + docshell/test/test_bug509055.html | 98 + docshell/test/test_bug511449.html | 56 + docshell/test/test_bug529119-1.html | 95 + docshell/test/test_bug529119-2.html | 90 + docshell/test/test_bug530396.html | 57 + docshell/test/test_bug540462.html | 44 + docshell/test/test_bug551225.html | 32 + docshell/test/test_bug570341.html | 142 + docshell/test/test_bug580069.html | 61 + docshell/test/test_bug590573.html | 232 + docshell/test/test_bug598895.html | 53 + docshell/test/test_bug634834.html | 53 + docshell/test/test_bug637644.html | 53 + docshell/test/test_bug640387_1.html | 109 + docshell/test/test_bug640387_2.html | 90 + docshell/test/test_bug653741.html | 49 + docshell/test/test_bug660404.html | 48 + docshell/test/test_bug662170.html | 51 + docshell/test/test_bug668513.html | 28 + docshell/test/test_bug669671.html | 146 + docshell/test/test_bug675587.html | 34 + docshell/test/test_bug680257.html | 59 + docshell/test/test_bug691547.html | 60 + docshell/test/test_bug694612.html | 27 + docshell/test/test_bug703855.html | 79 + docshell/test/test_bug713825.html | 42 + docshell/test/test_bug728939.html | 37 + docshell/test/test_bug797909.html | 66 + .../test_forceinheritprincipal_overrule_owner.html | 51 + docshell/test/test_framedhistoryframes.html | 32 + .../test/test_pushState_after_document_open.html | 37 + docshell/test/test_windowedhistoryframes.html | 32 + docshell/test/unit/head_docshell.js | 11 + docshell/test/unit/test_bug414201_jfif.js | 27 + docshell/test/unit/test_bug442584.js | 30 + docshell/test/unit/test_nsDefaultURIFixup.js | 93 + docshell/test/unit/test_nsDefaultURIFixup_info.js | 620 + .../test/unit/test_nsDefaultURIFixup_search.js | 117 + docshell/test/unit/test_nsIDownloadHistory.js | 68 + docshell/test/unit/test_pb_notification.js | 23 + docshell/test/unit/test_privacy_transition.js | 23 + docshell/test/unit/test_setUsePrivateBrowsing.js | 65 + docshell/test/unit/xpcshell.ini | 17 + docshell/test/unit_ipc/test_pb_notification_ipc.js | 20 + docshell/test/unit_ipc/xpcshell.ini | 8 + 497 files changed, 49699 insertions(+) create mode 100644 docshell/base/IHistory.h create mode 100644 docshell/base/LoadContext.cpp create mode 100644 docshell/base/LoadContext.h create mode 100644 docshell/base/SerializedLoadContext.cpp create mode 100644 docshell/base/SerializedLoadContext.h create mode 100644 docshell/base/crashtests/1257730-1.html create mode 100644 docshell/base/crashtests/1331295.html create mode 100644 docshell/base/crashtests/1341657.html create mode 100644 docshell/base/crashtests/369126-1.html create mode 100644 docshell/base/crashtests/403574-1.xhtml create mode 100644 docshell/base/crashtests/40929-1-inner.html create mode 100644 docshell/base/crashtests/40929-1.html create mode 100644 docshell/base/crashtests/430124-1.html create mode 100644 docshell/base/crashtests/430628-1.html create mode 100644 docshell/base/crashtests/432114-1.html create mode 100644 docshell/base/crashtests/432114-2.html create mode 100644 docshell/base/crashtests/436900-1-inner.html create mode 100644 docshell/base/crashtests/436900-1.html create mode 100644 docshell/base/crashtests/436900-2-inner.html create mode 100644 docshell/base/crashtests/436900-2.html create mode 100644 docshell/base/crashtests/500328-1.html create mode 100644 docshell/base/crashtests/514779-1.xhtml create mode 100644 docshell/base/crashtests/614499-1.html create mode 100644 docshell/base/crashtests/678872-1.html create mode 100644 docshell/base/crashtests/914521.html create mode 100644 docshell/base/crashtests/crashtests.list create mode 100644 docshell/base/moz.build create mode 100644 docshell/base/nsAboutRedirector.cpp create mode 100644 docshell/base/nsAboutRedirector.h create mode 100644 docshell/base/nsCDefaultURIFixup.idl create mode 100644 docshell/base/nsDSURIContentListener.cpp create mode 100644 docshell/base/nsDSURIContentListener.h create mode 100644 docshell/base/nsDefaultURIFixup.cpp create mode 100644 docshell/base/nsDefaultURIFixup.h create mode 100644 docshell/base/nsDocShell.cpp create mode 100644 docshell/base/nsDocShell.h create mode 100644 docshell/base/nsDocShellEditorData.cpp create mode 100644 docshell/base/nsDocShellEditorData.h create mode 100644 docshell/base/nsDocShellEnumerator.cpp create mode 100644 docshell/base/nsDocShellEnumerator.h create mode 100644 docshell/base/nsDocShellLoadInfo.cpp create mode 100644 docshell/base/nsDocShellLoadInfo.h create mode 100644 docshell/base/nsDocShellLoadTypes.h create mode 100644 docshell/base/nsDocShellTransferableHooks.cpp create mode 100644 docshell/base/nsDocShellTransferableHooks.h create mode 100644 docshell/base/nsDownloadHistory.cpp create mode 100644 docshell/base/nsDownloadHistory.h create mode 100644 docshell/base/nsIClipboardCommands.idl create mode 100644 docshell/base/nsIContentViewer.idl create mode 100644 docshell/base/nsIContentViewerContainer.idl create mode 100644 docshell/base/nsIContentViewerEdit.idl create mode 100644 docshell/base/nsIContentViewerFile.idl create mode 100644 docshell/base/nsIDocCharset.idl create mode 100644 docshell/base/nsIDocShell.idl create mode 100644 docshell/base/nsIDocShellLoadInfo.idl create mode 100644 docshell/base/nsIDocShellTreeItem.idl create mode 100644 docshell/base/nsIDocShellTreeOwner.idl create mode 100644 docshell/base/nsIDocumentLoaderFactory.idl create mode 100644 docshell/base/nsIDownloadHistory.idl create mode 100644 docshell/base/nsIGlobalHistory2.idl create mode 100644 docshell/base/nsILinkHandler.h create mode 100644 docshell/base/nsILoadContext.idl create mode 100644 docshell/base/nsIPrivacyTransitionObserver.idl create mode 100644 docshell/base/nsIReflowObserver.idl create mode 100644 docshell/base/nsIRefreshURI.idl create mode 100644 docshell/base/nsIScrollObserver.h create mode 100644 docshell/base/nsIScrollable.idl create mode 100644 docshell/base/nsITextScroll.idl create mode 100644 docshell/base/nsIURIFixup.idl create mode 100644 docshell/base/nsIWebNavigation.idl create mode 100644 docshell/base/nsIWebNavigationInfo.idl create mode 100644 docshell/base/nsIWebPageDescriptor.idl create mode 100644 docshell/base/nsIWebShellServices.h create mode 100644 docshell/base/nsWebNavigationInfo.cpp create mode 100644 docshell/base/nsWebNavigationInfo.h create mode 100644 docshell/base/timeline/AbstractTimelineMarker.cpp create mode 100644 docshell/base/timeline/AbstractTimelineMarker.h create mode 100644 docshell/base/timeline/AutoGlobalTimelineMarker.cpp create mode 100644 docshell/base/timeline/AutoGlobalTimelineMarker.h create mode 100644 docshell/base/timeline/AutoTimelineMarker.cpp create mode 100644 docshell/base/timeline/AutoTimelineMarker.h create mode 100644 docshell/base/timeline/CompositeTimelineMarker.h create mode 100644 docshell/base/timeline/ConsoleTimelineMarker.h create mode 100644 docshell/base/timeline/DocLoadingTimelineMarker.h create mode 100644 docshell/base/timeline/EventTimelineMarker.h create mode 100644 docshell/base/timeline/JavascriptTimelineMarker.h create mode 100644 docshell/base/timeline/LayerTimelineMarker.h create mode 100644 docshell/base/timeline/MarkersStorage.cpp create mode 100644 docshell/base/timeline/MarkersStorage.h create mode 100644 docshell/base/timeline/MessagePortTimelineMarker.h create mode 100644 docshell/base/timeline/ObservedDocShell.cpp create mode 100644 docshell/base/timeline/ObservedDocShell.h create mode 100644 docshell/base/timeline/RestyleTimelineMarker.h create mode 100644 docshell/base/timeline/TimelineConsumers.cpp create mode 100644 docshell/base/timeline/TimelineConsumers.h create mode 100644 docshell/base/timeline/TimelineMarker.cpp create mode 100644 docshell/base/timeline/TimelineMarker.h create mode 100644 docshell/base/timeline/TimelineMarkerEnums.h create mode 100644 docshell/base/timeline/TimestampTimelineMarker.h create mode 100644 docshell/base/timeline/WorkerTimelineMarker.h create mode 100644 docshell/base/timeline/moz.build create mode 100644 docshell/base/timeline/readme.md create mode 100644 docshell/build/moz.build create mode 100644 docshell/build/nsDocShellCID.h create mode 100644 docshell/build/nsDocShellModule.cpp create mode 100644 docshell/moz.build create mode 100644 docshell/resources/content/jar.mn create mode 100644 docshell/resources/content/moz.build create mode 100644 docshell/resources/content/netError.xhtml create mode 100644 docshell/shistory/moz.build create mode 100644 docshell/shistory/nsIBFCacheEntry.idl create mode 100644 docshell/shistory/nsIGroupedSHistory.idl create mode 100644 docshell/shistory/nsIPartialSHistory.idl create mode 100644 docshell/shistory/nsIPartialSHistoryListener.idl create mode 100644 docshell/shistory/nsISHContainer.idl create mode 100644 docshell/shistory/nsISHEntry.idl create mode 100644 docshell/shistory/nsISHTransaction.idl create mode 100644 docshell/shistory/nsISHistory.idl create mode 100644 docshell/shistory/nsISHistoryInternal.idl create mode 100644 docshell/shistory/nsISHistoryListener.idl create mode 100644 docshell/shistory/nsSHEntry.cpp create mode 100644 docshell/shistory/nsSHEntry.h create mode 100644 docshell/shistory/nsSHEntryShared.cpp create mode 100644 docshell/shistory/nsSHEntryShared.h create mode 100644 docshell/shistory/nsSHTransaction.cpp create mode 100644 docshell/shistory/nsSHTransaction.h create mode 100644 docshell/shistory/nsSHistory.cpp create mode 100644 docshell/shistory/nsSHistory.h create mode 100644 docshell/test/browser/browser.ini create mode 100644 docshell/test/browser/browser_bug1206879.js create mode 100644 docshell/test/browser/browser_bug1309900_crossProcessHistoryNavigation.js create mode 100644 docshell/test/browser/browser_bug134911.js create mode 100644 docshell/test/browser/browser_bug234628-1.js create mode 100644 docshell/test/browser/browser_bug234628-10.js create mode 100644 docshell/test/browser/browser_bug234628-11.js create mode 100644 docshell/test/browser/browser_bug234628-2.js create mode 100644 docshell/test/browser/browser_bug234628-3.js create mode 100644 docshell/test/browser/browser_bug234628-4.js create mode 100644 docshell/test/browser/browser_bug234628-5.js create mode 100644 docshell/test/browser/browser_bug234628-6.js create mode 100644 docshell/test/browser/browser_bug234628-7.js create mode 100644 docshell/test/browser/browser_bug234628-8.js create mode 100644 docshell/test/browser/browser_bug234628-9.js create mode 100644 docshell/test/browser/browser_bug349769.js create mode 100644 docshell/test/browser/browser_bug388121-1.js create mode 100644 docshell/test/browser/browser_bug388121-2.js create mode 100644 docshell/test/browser/browser_bug420605.js create mode 100644 docshell/test/browser/browser_bug422543.js create mode 100644 docshell/test/browser/browser_bug441169.js create mode 100644 docshell/test/browser/browser_bug503832.js create mode 100644 docshell/test/browser/browser_bug554155.js create mode 100644 docshell/test/browser/browser_bug655270.js create mode 100644 docshell/test/browser/browser_bug655273.js create mode 100644 docshell/test/browser/browser_bug670318.js create mode 100644 docshell/test/browser/browser_bug673467.js create mode 100644 docshell/test/browser/browser_bug852909.js create mode 100644 docshell/test/browser/browser_bug92473.js create mode 100644 docshell/test/browser/browser_loadDisallowInherit.js create mode 100644 docshell/test/browser/browser_loadURI.js create mode 100644 docshell/test/browser/browser_multiple_pushState.js create mode 100644 docshell/test/browser/browser_onbeforeunload_navigation.js create mode 100644 docshell/test/browser/browser_search_notification.js create mode 100644 docshell/test/browser/browser_tab_touch_events.js create mode 100644 docshell/test/browser/browser_timelineMarkers-01.js create mode 100644 docshell/test/browser/browser_timelineMarkers-02.js create mode 100644 docshell/test/browser/browser_timelineMarkers-03.js create mode 100644 docshell/test/browser/browser_timelineMarkers-04.js create mode 100644 docshell/test/browser/browser_timelineMarkers-05.js create mode 100644 docshell/test/browser/browser_timelineMarkers-frame-02.js create mode 100644 docshell/test/browser/browser_timelineMarkers-frame-03.js create mode 100644 docshell/test/browser/browser_timelineMarkers-frame-04.js create mode 100644 docshell/test/browser/browser_timelineMarkers-frame-05.js create mode 100644 docshell/test/browser/browser_ua_emulation.js create mode 100644 docshell/test/browser/browser_uriFixupAlternateRedirects.js create mode 100644 docshell/test/browser/browser_uriFixupIntegration.js create mode 100644 docshell/test/browser/favicon_bug655270.ico create mode 100644 docshell/test/browser/file_bug1046022.html create mode 100644 docshell/test/browser/file_bug1206879.html create mode 100644 docshell/test/browser/file_bug234628-1-child.html create mode 100644 docshell/test/browser/file_bug234628-1.html create mode 100644 docshell/test/browser/file_bug234628-10-child.xhtml create mode 100644 docshell/test/browser/file_bug234628-10.html create mode 100644 docshell/test/browser/file_bug234628-11-child.xhtml create mode 100644 docshell/test/browser/file_bug234628-11-child.xhtml^headers^ create mode 100644 docshell/test/browser/file_bug234628-11.html create mode 100644 docshell/test/browser/file_bug234628-2-child.html create mode 100644 docshell/test/browser/file_bug234628-2.html create mode 100644 docshell/test/browser/file_bug234628-3-child.html create mode 100644 docshell/test/browser/file_bug234628-3.html create mode 100644 docshell/test/browser/file_bug234628-4-child.html create mode 100644 docshell/test/browser/file_bug234628-4.html create mode 100644 docshell/test/browser/file_bug234628-5-child.html create mode 100644 docshell/test/browser/file_bug234628-5.html create mode 100644 docshell/test/browser/file_bug234628-6-child.html create mode 100644 docshell/test/browser/file_bug234628-6-child.html^headers^ create mode 100644 docshell/test/browser/file_bug234628-6.html create mode 100644 docshell/test/browser/file_bug234628-7-child.html create mode 100644 docshell/test/browser/file_bug234628-7-child.html^headers^ create mode 100644 docshell/test/browser/file_bug234628-7.html create mode 100644 docshell/test/browser/file_bug234628-8-child.html create mode 100644 docshell/test/browser/file_bug234628-8.html create mode 100644 docshell/test/browser/file_bug234628-9-child.html create mode 100644 docshell/test/browser/file_bug234628-9.html create mode 100644 docshell/test/browser/file_bug420605.html create mode 100644 docshell/test/browser/file_bug422543_script.js create mode 100644 docshell/test/browser/file_bug503832.html create mode 100644 docshell/test/browser/file_bug655270.html create mode 100644 docshell/test/browser/file_bug670318.html create mode 100644 docshell/test/browser/file_bug852909.pdf create mode 100644 docshell/test/browser/file_bug852909.png create mode 100644 docshell/test/browser/file_multiple_pushState.html create mode 100644 docshell/test/browser/frame-head.js create mode 100644 docshell/test/browser/head.js create mode 100644 docshell/test/browser/print_postdata.sjs create mode 100644 docshell/test/browser/redirect_to_example.sjs create mode 100644 docshell/test/browser/test-form_sjis.html create mode 100644 docshell/test/browser/timelineMarkers-04.html create mode 100644 docshell/test/bug123696-subframe.html create mode 100644 docshell/test/bug369814.jar create mode 100644 docshell/test/bug369814.zip create mode 100644 docshell/test/bug404548-subframe.html create mode 100644 docshell/test/bug413310-post.sjs create mode 100644 docshell/test/bug413310-subframe.html create mode 100644 docshell/test/bug529119-window.html create mode 100644 docshell/test/bug530396-noref.sjs create mode 100644 docshell/test/bug530396-subframe.html create mode 100644 docshell/test/bug570341_recordevents.html create mode 100644 docshell/test/bug668513_redirect.html create mode 100644 docshell/test/bug668513_redirect.html^headers^ create mode 100644 docshell/test/bug691547_frame.html create mode 100644 docshell/test/chrome/112564_nocache.html create mode 100644 docshell/test/chrome/112564_nocache.html^headers^ create mode 100644 docshell/test/chrome/215405_nocache.html create mode 100644 docshell/test/chrome/215405_nocache.html^headers^ create mode 100644 docshell/test/chrome/215405_nostore.html create mode 100644 docshell/test/chrome/215405_nostore.html^headers^ create mode 100644 docshell/test/chrome/582176_dummy.html create mode 100644 docshell/test/chrome/582176_xml.xml create mode 100644 docshell/test/chrome/582176_xslt.xsl create mode 100644 docshell/test/chrome/662200a.html create mode 100644 docshell/test/chrome/662200b.html create mode 100644 docshell/test/chrome/662200c.html create mode 100644 docshell/test/chrome/89419.html create mode 100644 docshell/test/chrome/92598_nostore.html create mode 100644 docshell/test/chrome/92598_nostore.html^headers^ create mode 100644 docshell/test/chrome/allowContentRetargeting.sjs create mode 100644 docshell/test/chrome/blue.png create mode 100644 docshell/test/chrome/bug112564_window.xul create mode 100644 docshell/test/chrome/bug113934_window.xul create mode 100644 docshell/test/chrome/bug215405_window.xul create mode 100644 docshell/test/chrome/bug293235.html create mode 100644 docshell/test/chrome/bug293235_p2.html create mode 100644 docshell/test/chrome/bug293235_window.xul create mode 100644 docshell/test/chrome/bug294258_testcase.html create mode 100644 docshell/test/chrome/bug294258_window.xul create mode 100755 docshell/test/chrome/bug298622_window.xul create mode 100644 docshell/test/chrome/bug301397_1.html create mode 100644 docshell/test/chrome/bug301397_2.html create mode 100644 docshell/test/chrome/bug301397_3.html create mode 100644 docshell/test/chrome/bug301397_4.html create mode 100644 docshell/test/chrome/bug301397_window.xul create mode 100644 docshell/test/chrome/bug303267.html create mode 100755 docshell/test/chrome/bug303267_window.xul create mode 100644 docshell/test/chrome/bug311007_window.xul create mode 100755 docshell/test/chrome/bug321671_window.xul create mode 100644 docshell/test/chrome/bug360511_case1.html create mode 100644 docshell/test/chrome/bug360511_case2.html create mode 100755 docshell/test/chrome/bug360511_window.xul create mode 100644 docshell/test/chrome/bug364461_window.xul create mode 100644 docshell/test/chrome/bug396519_window.xul create mode 100755 docshell/test/chrome/bug396649_window.xul create mode 100644 docshell/test/chrome/bug449778_window.xul create mode 100644 docshell/test/chrome/bug449780_window.xul create mode 100644 docshell/test/chrome/bug454235-subframe.xul create mode 100644 docshell/test/chrome/bug582176_window.xul create mode 100644 docshell/test/chrome/bug608669.xul create mode 100644 docshell/test/chrome/bug662200_window.xul create mode 100644 docshell/test/chrome/bug690056_window.xul create mode 100644 docshell/test/chrome/bug846906.html create mode 100644 docshell/test/chrome/bug89419.sjs create mode 100644 docshell/test/chrome/bug89419_window.xul create mode 100644 docshell/test/chrome/bug909218.html create mode 100644 docshell/test/chrome/bug909218.js create mode 100644 docshell/test/chrome/bug92598_window.xul create mode 100644 docshell/test/chrome/chrome.ini create mode 100755 docshell/test/chrome/docshell_helpers.js create mode 100644 docshell/test/chrome/file_viewsource_forbidden_in_iframe.html create mode 100644 docshell/test/chrome/gen_template.pl create mode 100644 docshell/test/chrome/generic.html create mode 100644 docshell/test/chrome/mozFrameType_window.xul create mode 100644 docshell/test/chrome/red.png create mode 100644 docshell/test/chrome/test.template.txt create mode 100644 docshell/test/chrome/test_allowContentRetargeting.html create mode 100644 docshell/test/chrome/test_bug112564.xul create mode 100644 docshell/test/chrome/test_bug113934.xul create mode 100644 docshell/test/chrome/test_bug215405.xul create mode 100644 docshell/test/chrome/test_bug293235.xul create mode 100644 docshell/test/chrome/test_bug294258.xul create mode 100644 docshell/test/chrome/test_bug298622.xul create mode 100644 docshell/test/chrome/test_bug301397.xul create mode 100644 docshell/test/chrome/test_bug303267.xul create mode 100644 docshell/test/chrome/test_bug311007.xul create mode 100644 docshell/test/chrome/test_bug321671.xul create mode 100644 docshell/test/chrome/test_bug360511.xul create mode 100644 docshell/test/chrome/test_bug364461.xul create mode 100644 docshell/test/chrome/test_bug396519.xul create mode 100644 docshell/test/chrome/test_bug396649.xul create mode 100644 docshell/test/chrome/test_bug428288.html create mode 100644 docshell/test/chrome/test_bug449778.xul create mode 100644 docshell/test/chrome/test_bug449780.xul create mode 100644 docshell/test/chrome/test_bug453650.xul create mode 100644 docshell/test/chrome/test_bug454235.xul create mode 100644 docshell/test/chrome/test_bug456980.xul create mode 100644 docshell/test/chrome/test_bug565388.xul create mode 100644 docshell/test/chrome/test_bug582176.xul create mode 100644 docshell/test/chrome/test_bug608669.xul create mode 100644 docshell/test/chrome/test_bug662200.xul create mode 100644 docshell/test/chrome/test_bug690056.xul create mode 100644 docshell/test/chrome/test_bug789773.xul create mode 100644 docshell/test/chrome/test_bug846906.xul create mode 100644 docshell/test/chrome/test_bug89419.xul create mode 100644 docshell/test/chrome/test_bug909218.html create mode 100644 docshell/test/chrome/test_bug92598.xul create mode 100644 docshell/test/chrome/test_mozFrameType.xul create mode 100644 docshell/test/chrome/test_principalInherit.xul create mode 100644 docshell/test/chrome/test_private_hidden_window.html create mode 100644 docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul create mode 100644 docshell/test/chrome/window.template.txt create mode 100644 docshell/test/file_anchor_scroll_after_document_open.html create mode 100644 docshell/test/file_bug385434_1.html create mode 100644 docshell/test/file_bug385434_2.html create mode 100644 docshell/test/file_bug385434_3.html create mode 100644 docshell/test/file_bug475636.sjs create mode 100644 docshell/test/file_bug509055.html create mode 100644 docshell/test/file_bug511449.html create mode 100644 docshell/test/file_bug540462.html create mode 100644 docshell/test/file_bug580069_1.html create mode 100644 docshell/test/file_bug580069_2.sjs create mode 100644 docshell/test/file_bug590573_1.html create mode 100644 docshell/test/file_bug590573_2.html create mode 100644 docshell/test/file_bug634834.html create mode 100644 docshell/test/file_bug640387.html create mode 100644 docshell/test/file_bug653741.html create mode 100644 docshell/test/file_bug660404 create mode 100644 docshell/test/file_bug660404^headers^ create mode 100644 docshell/test/file_bug662170.html create mode 100644 docshell/test/file_bug668513.html create mode 100644 docshell/test/file_bug669671.sjs create mode 100644 docshell/test/file_bug680257.html create mode 100644 docshell/test/file_bug703855.html create mode 100644 docshell/test/file_bug728939.html create mode 100644 docshell/test/file_framedhistoryframes.html create mode 100644 docshell/test/file_pushState_after_document_open.html create mode 100644 docshell/test/historyframes.html create mode 100644 docshell/test/iframesandbox/file_marquee_event_handlers.html create mode 100644 docshell/test/iframesandbox/file_other_auxiliary_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/file_our_auxiliary_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/file_parent_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/file_sibling_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/file_top_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/file_top_navigation_by_location_exotic.html create mode 100644 docshell/test/iframesandbox/mochitest.ini create mode 100644 docshell/test/iframesandbox/test_child_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_marquee_event_handlers.html create mode 100644 docshell/test/iframesandbox/test_other_auxiliary_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_our_auxiliary_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_parent_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_sibling_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_top_navigation_by_location.html create mode 100644 docshell/test/iframesandbox/test_top_navigation_by_location_exotic.html create mode 100644 docshell/test/mochitest.ini create mode 100644 docshell/test/navigation/NavigationUtils.js create mode 100644 docshell/test/navigation/blank.html create mode 100644 docshell/test/navigation/browser.ini create mode 100644 docshell/test/navigation/browser_bug343515.js create mode 100644 docshell/test/navigation/browser_test-content-chromeflags.js create mode 100644 docshell/test/navigation/bug343515_pg1.html create mode 100644 docshell/test/navigation/bug343515_pg2.html create mode 100644 docshell/test/navigation/bug343515_pg3.html create mode 100644 docshell/test/navigation/bug343515_pg3_1.html create mode 100644 docshell/test/navigation/bug343515_pg3_1_1.html create mode 100644 docshell/test/navigation/bug343515_pg3_2.html create mode 100644 docshell/test/navigation/file_bug1300461.html create mode 100644 docshell/test/navigation/file_bug1300461_back.html create mode 100644 docshell/test/navigation/file_bug1300461_redirect.html create mode 100644 docshell/test/navigation/file_bug1300461_redirect.html^headers^ create mode 100644 docshell/test/navigation/file_bug462076_1.html create mode 100644 docshell/test/navigation/file_bug462076_2.html create mode 100644 docshell/test/navigation/file_bug462076_3.html create mode 100644 docshell/test/navigation/file_bug508537_1.html create mode 100644 docshell/test/navigation/file_bug534178.html create mode 100644 docshell/test/navigation/file_document_write_1.html create mode 100644 docshell/test/navigation/file_fragment_handling_during_load.html create mode 100644 docshell/test/navigation/file_nested_frames.html create mode 100644 docshell/test/navigation/file_scrollRestoration.html create mode 100644 docshell/test/navigation/file_shiftReload_and_pushState.html create mode 100644 docshell/test/navigation/file_static_and_dynamic_1.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_frame_1.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_frame_2.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_b.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_base.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_nav.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_subframe.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_subframe_nav.html create mode 100644 docshell/test/navigation/file_triggeringprincipal_window_open.html create mode 100644 docshell/test/navigation/frame0.html create mode 100644 docshell/test/navigation/frame1.html create mode 100644 docshell/test/navigation/frame2.html create mode 100644 docshell/test/navigation/frame3.html create mode 100644 docshell/test/navigation/goback.html create mode 100644 docshell/test/navigation/iframe.html create mode 100644 docshell/test/navigation/mochitest.ini create mode 100644 docshell/test/navigation/navigate.html create mode 100644 docshell/test/navigation/open.html create mode 100644 docshell/test/navigation/parent.html create mode 100644 docshell/test/navigation/test_bug13871.html create mode 100644 docshell/test/navigation/test_bug270414.html create mode 100644 docshell/test/navigation/test_bug278916.html create mode 100644 docshell/test/navigation/test_bug279495.html create mode 100644 docshell/test/navigation/test_bug344861.html create mode 100644 docshell/test/navigation/test_bug386782.html create mode 100644 docshell/test/navigation/test_bug430624.html create mode 100644 docshell/test/navigation/test_bug430723.html create mode 100644 docshell/test/navigation/test_child.html create mode 100644 docshell/test/navigation/test_grandchild.html create mode 100644 docshell/test/navigation/test_not-opener.html create mode 100644 docshell/test/navigation/test_opener.html create mode 100644 docshell/test/navigation/test_popup-navigates-children.html create mode 100644 docshell/test/navigation/test_reserved.html create mode 100644 docshell/test/navigation/test_sessionhistory.html create mode 100644 docshell/test/navigation/test_sibling-matching-parent.html create mode 100644 docshell/test/navigation/test_sibling-off-domain.html create mode 100644 docshell/test/navigation/test_triggeringprincipal_frame_nav.html create mode 100644 docshell/test/navigation/test_triggeringprincipal_iframe_iframe_window_open.html create mode 100644 docshell/test/navigation/test_triggeringprincipal_parent_iframe_window_open.html create mode 100644 docshell/test/navigation/test_triggeringprincipal_window_open.html create mode 100644 docshell/test/test_anchor_scroll_after_document_open.html create mode 100644 docshell/test/test_bfcache_plus_hash.html create mode 100644 docshell/test/test_bug1045096.html create mode 100644 docshell/test/test_bug1121701.html create mode 100644 docshell/test/test_bug1186774.html create mode 100644 docshell/test/test_bug123696.html create mode 100644 docshell/test/test_bug369814.html create mode 100644 docshell/test/test_bug384014.html create mode 100644 docshell/test/test_bug385434.html create mode 100644 docshell/test/test_bug387979.html create mode 100644 docshell/test/test_bug402210.html create mode 100644 docshell/test/test_bug404548.html create mode 100644 docshell/test/test_bug413310.html create mode 100644 docshell/test/test_bug475636.html create mode 100644 docshell/test/test_bug509055.html create mode 100644 docshell/test/test_bug511449.html create mode 100644 docshell/test/test_bug529119-1.html create mode 100644 docshell/test/test_bug529119-2.html create mode 100644 docshell/test/test_bug530396.html create mode 100644 docshell/test/test_bug540462.html create mode 100644 docshell/test/test_bug551225.html create mode 100644 docshell/test/test_bug570341.html create mode 100644 docshell/test/test_bug580069.html create mode 100644 docshell/test/test_bug590573.html create mode 100644 docshell/test/test_bug598895.html create mode 100644 docshell/test/test_bug634834.html create mode 100644 docshell/test/test_bug637644.html create mode 100644 docshell/test/test_bug640387_1.html create mode 100644 docshell/test/test_bug640387_2.html create mode 100644 docshell/test/test_bug653741.html create mode 100644 docshell/test/test_bug660404.html create mode 100644 docshell/test/test_bug662170.html create mode 100644 docshell/test/test_bug668513.html create mode 100644 docshell/test/test_bug669671.html create mode 100644 docshell/test/test_bug675587.html create mode 100644 docshell/test/test_bug680257.html create mode 100644 docshell/test/test_bug691547.html create mode 100644 docshell/test/test_bug694612.html create mode 100644 docshell/test/test_bug703855.html create mode 100644 docshell/test/test_bug713825.html create mode 100644 docshell/test/test_bug728939.html create mode 100644 docshell/test/test_bug797909.html create mode 100644 docshell/test/test_forceinheritprincipal_overrule_owner.html create mode 100644 docshell/test/test_framedhistoryframes.html create mode 100644 docshell/test/test_pushState_after_document_open.html create mode 100644 docshell/test/test_windowedhistoryframes.html create mode 100644 docshell/test/unit/head_docshell.js create mode 100644 docshell/test/unit/test_bug414201_jfif.js create mode 100644 docshell/test/unit/test_bug442584.js create mode 100644 docshell/test/unit/test_nsDefaultURIFixup.js create mode 100644 docshell/test/unit/test_nsDefaultURIFixup_info.js create mode 100644 docshell/test/unit/test_nsDefaultURIFixup_search.js create mode 100644 docshell/test/unit/test_nsIDownloadHistory.js create mode 100644 docshell/test/unit/test_pb_notification.js create mode 100644 docshell/test/unit/test_privacy_transition.js create mode 100644 docshell/test/unit/test_setUsePrivateBrowsing.js create mode 100644 docshell/test/unit/xpcshell.ini create mode 100644 docshell/test/unit_ipc/test_pb_notification_ipc.js create mode 100644 docshell/test/unit_ipc/xpcshell.ini (limited to 'docshell') diff --git a/docshell/base/IHistory.h b/docshell/base/IHistory.h new file mode 100644 index 000000000..b1f5bb983 --- /dev/null +++ b/docshell/base/IHistory.h @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#ifndef mozilla_IHistory_h_ +#define mozilla_IHistory_h_ + +#include "nsISupports.h" + +class nsIURI; + +namespace mozilla { + +namespace dom { +class Link; +} // namespace dom + +// 0057c9d3-b98e-4933-bdc5-0275d06705e1 +#define IHISTORY_IID \ + {0x0057c9d3, 0xb98e, 0x4933, {0xbd, 0xc5, 0x02, 0x75, 0xd0, 0x67, 0x05, 0xe1}} + +class IHistory : public nsISupports +{ +public: + NS_DECLARE_STATIC_IID_ACCESSOR(IHISTORY_IID) + + /** + * Registers the Link for notifications about the visited-ness of aURI. + * Consumers should assume that the URI is unvisited after calling this, and + * they will be notified if that state (unvisited) changes by having + * SetLinkState called on themselves. This function is guaranteed to run to + * completion before aLink is notified. After the node is notified, it will + * be unregistered. + * + * @note SetLinkState must not call RegisterVisitedCallback or + * UnregisterVisitedCallback. + * + * @pre aURI must not be null. + * @pre aLink may be null only in the parent (chrome) process. + * + * @param aURI + * The URI to check. + * @param aLink + * The link to update whenever the history status changes. The + * implementation will only hold onto a raw pointer, so if this + * object should be destroyed, be sure to call + * UnregisterVistedCallback first. + */ + NS_IMETHOD RegisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0; + + /** + * Unregisters a previously registered Link object. This must be called + * before destroying the registered object. + * + * @pre aURI must not be null. + * @pre aLink must not be null. + * + * @param aURI + * The URI that aLink was registered for. + * @param aLink + * The link object to unregister for aURI. + */ + NS_IMETHOD UnregisterVisitedCallback(nsIURI* aURI, dom::Link* aLink) = 0; + + enum VisitFlags + { + /** + * Indicates whether the URI was loaded in a top-level window. + */ + TOP_LEVEL = 1 << 0, + /** + * Indicates whether the URI was loaded as part of a permanent redirect. + */ + REDIRECT_PERMANENT = 1 << 1, + /** + * Indicates whether the URI was loaded as part of a temporary redirect. + */ + REDIRECT_TEMPORARY = 1 << 2, + /** + * Indicates the URI is redirecting (Response code 3xx). + */ + REDIRECT_SOURCE = 1 << 3, + /** + * Indicates the URI caused an error that is unlikely fixable by a + * retry, like a not found or unfetchable page. + */ + UNRECOVERABLE_ERROR = 1 << 4 + }; + + /** + * Adds a history visit for the URI. + * + * @pre aURI must not be null. + * + * @param aURI + * The URI of the page being visited. + * @param aLastVisitedURI + * The URI of the last visit in the chain. + * @param aFlags + * The VisitFlags describing this visit. + */ + NS_IMETHOD VisitURI(nsIURI* aURI, + nsIURI* aLastVisitedURI, + uint32_t aFlags) = 0; + + /** + * Set the title of the URI. + * + * @pre aURI must not be null. + * + * @param aURI + * The URI to set the title for. + * @param aTitle + * The title string. + */ + NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle) = 0; + + /** + * Notifies about the visited status of a given URI. + * + * @param aURI + * The URI to notify about. + */ + NS_IMETHOD NotifyVisited(nsIURI* aURI) = 0; +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(IHistory, IHISTORY_IID) + +#define NS_DECL_IHISTORY \ + NS_IMETHOD RegisterVisitedCallback(nsIURI* aURI, \ + mozilla::dom::Link* aContent) override; \ + NS_IMETHOD UnregisterVisitedCallback(nsIURI* aURI, \ + mozilla::dom::Link* aContent) override; \ + NS_IMETHOD VisitURI(nsIURI* aURI, \ + nsIURI* aLastVisitedURI, \ + uint32_t aFlags) override; \ + NS_IMETHOD SetURITitle(nsIURI* aURI, const nsAString& aTitle) override; \ + NS_IMETHOD NotifyVisited(nsIURI* aURI) override; + +} // namespace mozilla + +#endif // mozilla_IHistory_h_ diff --git a/docshell/base/LoadContext.cpp b/docshell/base/LoadContext.cpp new file mode 100644 index 000000000..c4095a951 --- /dev/null +++ b/docshell/base/LoadContext.cpp @@ -0,0 +1,229 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#include "mozilla/Assertions.h" +#include "mozilla/BasePrincipal.h" +#include "mozilla/LoadContext.h" +#include "mozilla/Preferences.h" +#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI +#include "nsContentUtils.h" +#include "xpcpublic.h" + +bool +nsILoadContext::GetOriginAttributes(mozilla::DocShellOriginAttributes& aAttrs) +{ + mozilla::dom::AutoJSAPI jsapi; + bool ok = jsapi.Init(xpc::PrivilegedJunkScope()); + NS_ENSURE_TRUE(ok, false); + JS::Rooted v(jsapi.cx()); + nsresult rv = GetOriginAttributes(&v); + NS_ENSURE_SUCCESS(rv, false); + NS_ENSURE_TRUE(v.isObject(), false); + JS::Rooted obj(jsapi.cx(), &v.toObject()); + + // If we're JS-implemented, the object will be left in a different (System-Principaled) + // scope, so we may need to enter its compartment. + MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj))); + JSAutoCompartment ac(jsapi.cx(), obj); + + mozilla::DocShellOriginAttributes attrs; + ok = attrs.Init(jsapi.cx(), v); + NS_ENSURE_TRUE(ok, false); + aAttrs = attrs; + return true; +} + +namespace mozilla { + +NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) + +LoadContext::LoadContext(nsIPrincipal* aPrincipal, + nsILoadContext* aOptionalBase) + : mTopFrameElement(nullptr) + , mNestedFrameId(0) + , mIsContent(true) + , mUseRemoteTabs(false) +#ifdef DEBUG + , mIsNotNull(true) +#endif +{ + PrincipalOriginAttributes poa = BasePrincipal::Cast(aPrincipal)->OriginAttributesRef(); + mOriginAttributes.InheritFromDocToChildDocShell(poa); + if (!aOptionalBase) { + return; + } + + MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetIsContent(&mIsContent)); + MOZ_ALWAYS_SUCCEEDS(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs)); +} + +//----------------------------------------------------------------------------- +// LoadContext::nsILoadContext +//----------------------------------------------------------------------------- + +NS_IMETHODIMP +LoadContext::GetAssociatedWindow(mozIDOMWindowProxy**) +{ + MOZ_ASSERT(mIsNotNull); + + // can't support this in the parent process + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +LoadContext::GetTopWindow(mozIDOMWindowProxy**) +{ + MOZ_ASSERT(mIsNotNull); + + // can't support this in the parent process + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +LoadContext::GetTopFrameElement(nsIDOMElement** aElement) +{ + nsCOMPtr element = do_QueryReferent(mTopFrameElement); + element.forget(aElement); + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::GetNestedFrameId(uint64_t* aId) +{ + NS_ENSURE_ARG(aId); + *aId = mNestedFrameId; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::GetIsContent(bool* aIsContent) +{ + MOZ_ASSERT(mIsNotNull); + + NS_ENSURE_ARG_POINTER(aIsContent); + + *aIsContent = mIsContent; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) +{ + MOZ_ASSERT(mIsNotNull); + + NS_ENSURE_ARG_POINTER(aUsePrivateBrowsing); + + *aUsePrivateBrowsing = mOriginAttributes.mPrivateBrowsingId > 0; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing) +{ + MOZ_ASSERT(mIsNotNull); + + // We shouldn't need this on parent... + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +LoadContext::SetPrivateBrowsing(bool aUsePrivateBrowsing) +{ + MOZ_ASSERT(mIsNotNull); + + // We shouldn't need this on parent... + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +LoadContext::GetUseRemoteTabs(bool* aUseRemoteTabs) +{ + MOZ_ASSERT(mIsNotNull); + + NS_ENSURE_ARG_POINTER(aUseRemoteTabs); + + *aUseRemoteTabs = mUseRemoteTabs; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::SetRemoteTabs(bool aUseRemoteTabs) +{ + MOZ_ASSERT(mIsNotNull); + + // We shouldn't need this on parent... + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +LoadContext::GetIsInIsolatedMozBrowserElement(bool* aIsInIsolatedMozBrowserElement) +{ + MOZ_ASSERT(mIsNotNull); + + NS_ENSURE_ARG_POINTER(aIsInIsolatedMozBrowserElement); + + *aIsInIsolatedMozBrowserElement = mOriginAttributes.mInIsolatedMozBrowser; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::GetAppId(uint32_t* aAppId) +{ + MOZ_ASSERT(mIsNotNull); + + NS_ENSURE_ARG_POINTER(aAppId); + + *aAppId = mOriginAttributes.mAppId; + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs) +{ + JSContext* cx = nsContentUtils::GetCurrentJSContext(); + MOZ_ASSERT(cx); + + bool ok = ToJSValue(cx, mOriginAttributes, aAttrs); + NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE); + return NS_OK; +} + +NS_IMETHODIMP +LoadContext::IsTrackingProtectionOn(bool* aIsTrackingProtectionOn) +{ + MOZ_ASSERT(mIsNotNull); + + if (Preferences::GetBool("privacy.trackingprotection.enabled", false)) { + *aIsTrackingProtectionOn = true; + } else if ((mOriginAttributes.mPrivateBrowsingId > 0) && + Preferences::GetBool("privacy.trackingprotection.pbmode.enabled", false)) { + *aIsTrackingProtectionOn = true; + } else { + *aIsTrackingProtectionOn = false; + } + + return NS_OK; +} + +//----------------------------------------------------------------------------- +// LoadContext::nsIInterfaceRequestor +//----------------------------------------------------------------------------- +NS_IMETHODIMP +LoadContext::GetInterface(const nsIID& aIID, void** aResult) +{ + NS_ENSURE_ARG_POINTER(aResult); + *aResult = nullptr; + + if (aIID.Equals(NS_GET_IID(nsILoadContext))) { + *aResult = static_cast(this); + NS_ADDREF_THIS(); + return NS_OK; + } + + return NS_NOINTERFACE; +} + +} // namespace mozilla diff --git a/docshell/base/LoadContext.h b/docshell/base/LoadContext.h new file mode 100644 index 000000000..966e7b47f --- /dev/null +++ b/docshell/base/LoadContext.h @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#ifndef LoadContext_h +#define LoadContext_h + +#include "SerializedLoadContext.h" +#include "mozilla/Attributes.h" +#include "mozilla/BasePrincipal.h" +#include "nsIWeakReferenceUtils.h" +#include "mozilla/dom/Element.h" +#include "nsIInterfaceRequestor.h" +#include "nsILoadContext.h" + +namespace mozilla { + +/** + * Class that provides nsILoadContext info in Parent process. Typically copied + * from Child via SerializedLoadContext. + * + * Note: this is not the "normal" or "original" nsILoadContext. That is + * typically provided by nsDocShell. This is only used when the original + * docshell is in a different process and we need to copy certain values from + * it. + * + * Note: we also generate a new nsILoadContext using LoadContext(uint32_t aAppId) + * to separate the safebrowsing cookie. + */ + +class LoadContext final + : public nsILoadContext + , public nsIInterfaceRequestor +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSILOADCONTEXT + NS_DECL_NSIINTERFACEREQUESTOR + + // appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext + // provided by child process. + LoadContext(const IPC::SerializedLoadContext& aToCopy, + dom::Element* aTopFrameElement, + DocShellOriginAttributes& aAttrs) + : mTopFrameElement(do_GetWeakReference(aTopFrameElement)) + , mNestedFrameId(0) + , mIsContent(aToCopy.mIsContent) + , mUseRemoteTabs(aToCopy.mUseRemoteTabs) + , mOriginAttributes(aAttrs) +#ifdef DEBUG + , mIsNotNull(aToCopy.mIsNotNull) +#endif + { + } + + // appId/inIsolatedMozBrowser arguments override those in SerializedLoadContext + // provided by child process. + LoadContext(const IPC::SerializedLoadContext& aToCopy, + uint64_t aNestedFrameId, + DocShellOriginAttributes& aAttrs) + : mTopFrameElement(nullptr) + , mNestedFrameId(aNestedFrameId) + , mIsContent(aToCopy.mIsContent) + , mUseRemoteTabs(aToCopy.mUseRemoteTabs) + , mOriginAttributes(aAttrs) +#ifdef DEBUG + , mIsNotNull(aToCopy.mIsNotNull) +#endif + { + } + + LoadContext(dom::Element* aTopFrameElement, + bool aIsContent, + bool aUsePrivateBrowsing, + bool aUseRemoteTabs, + const DocShellOriginAttributes& aAttrs) + : mTopFrameElement(do_GetWeakReference(aTopFrameElement)) + , mNestedFrameId(0) + , mIsContent(aIsContent) + , mUseRemoteTabs(aUseRemoteTabs) + , mOriginAttributes(aAttrs) +#ifdef DEBUG + , mIsNotNull(true) +#endif + { + } + + // Constructor taking reserved origin attributes. + explicit LoadContext(DocShellOriginAttributes& aAttrs) + : mTopFrameElement(nullptr) + , mNestedFrameId(0) + , mIsContent(false) + , mUseRemoteTabs(false) + , mOriginAttributes(aAttrs) +#ifdef DEBUG + , mIsNotNull(true) +#endif + { + } + + // Constructor for creating a LoadContext with a given principal's appId and + // browser flag. + explicit LoadContext(nsIPrincipal* aPrincipal, + nsILoadContext* aOptionalBase = nullptr); + +private: + ~LoadContext() {} + + nsWeakPtr mTopFrameElement; + uint64_t mNestedFrameId; + bool mIsContent; + bool mUseRemoteTabs; + DocShellOriginAttributes mOriginAttributes; +#ifdef DEBUG + bool mIsNotNull; +#endif +}; + +} // namespace mozilla + +#endif // LoadContext_h diff --git a/docshell/base/SerializedLoadContext.cpp b/docshell/base/SerializedLoadContext.cpp new file mode 100644 index 000000000..b8e3eb929 --- /dev/null +++ b/docshell/base/SerializedLoadContext.cpp @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#include "SerializedLoadContext.h" +#include "nsNetUtil.h" +#include "nsIChannel.h" +#include "nsIPrivateBrowsingChannel.h" +#include "nsIWebSocketChannel.h" + +namespace IPC { + +SerializedLoadContext::SerializedLoadContext(nsILoadContext* aLoadContext) +{ + Init(aLoadContext); +} + +SerializedLoadContext::SerializedLoadContext(nsIChannel* aChannel) +{ + if (!aChannel) { + Init(nullptr); + return; + } + + nsCOMPtr loadContext; + NS_QueryNotificationCallbacks(aChannel, loadContext); + Init(loadContext); + + if (!loadContext) { + // Attempt to retrieve the private bit from the channel if it has been + // overriden. + bool isPrivate = false; + bool isOverriden = false; + nsCOMPtr pbChannel = do_QueryInterface(aChannel); + if (pbChannel && + NS_SUCCEEDED(pbChannel->IsPrivateModeOverriden(&isPrivate, + &isOverriden)) && + isOverriden) { + mIsPrivateBitValid = true; + } + mOriginAttributes.SyncAttributesWithPrivateBrowsing(isPrivate); + } +} + +SerializedLoadContext::SerializedLoadContext(nsIWebSocketChannel* aChannel) +{ + nsCOMPtr loadContext; + if (aChannel) { + NS_QueryNotificationCallbacks(aChannel, loadContext); + } + Init(loadContext); +} + +void +SerializedLoadContext::Init(nsILoadContext* aLoadContext) +{ + if (aLoadContext) { + mIsNotNull = true; + mIsPrivateBitValid = true; + aLoadContext->GetIsContent(&mIsContent); + aLoadContext->GetUseRemoteTabs(&mUseRemoteTabs); + if (!aLoadContext->GetOriginAttributes(mOriginAttributes)) { + NS_WARNING("GetOriginAttributes failed"); + } + } else { + mIsNotNull = false; + mIsPrivateBitValid = false; + // none of below values really matter when mIsNotNull == false: + // we won't be GetInterfaced to nsILoadContext + mIsContent = true; + mUseRemoteTabs = false; + } +} + +} // namespace IPC diff --git a/docshell/base/SerializedLoadContext.h b/docshell/base/SerializedLoadContext.h new file mode 100644 index 000000000..c81b39853 --- /dev/null +++ b/docshell/base/SerializedLoadContext.h @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#ifndef SerializedLoadContext_h +#define SerializedLoadContext_h + +#include "base/basictypes.h" +#include "ipc/IPCMessageUtils.h" +#include "mozilla/BasePrincipal.h" + +class nsILoadContext; + +/* + * This file contains the IPC::SerializedLoadContext class, which is used to + * copy data across IPDL from Child process contexts so it is available in the + * Parent. + */ + +class nsIChannel; +class nsIWebSocketChannel; + +namespace IPC { + +class SerializedLoadContext +{ +public: + SerializedLoadContext() + : mIsNotNull(false) + , mIsPrivateBitValid(false) + , mIsContent(false) + , mUseRemoteTabs(false) + { + Init(nullptr); + } + + explicit SerializedLoadContext(nsILoadContext* aLoadContext); + explicit SerializedLoadContext(nsIChannel* aChannel); + explicit SerializedLoadContext(nsIWebSocketChannel* aChannel); + + void Init(nsILoadContext* aLoadContext); + + bool IsNotNull() const { return mIsNotNull; } + bool IsPrivateBitValid() const { return mIsPrivateBitValid; } + + // used to indicate if child-side LoadContext * was null. + bool mIsNotNull; + // used to indicate if child-side mUsePrivateBrowsing flag is valid, even if + // mIsNotNull is false, i.e., child LoadContext was null. + bool mIsPrivateBitValid; + bool mIsContent; + bool mUseRemoteTabs; + mozilla::DocShellOriginAttributes mOriginAttributes; +}; + +// Function to serialize over IPDL +template<> +struct ParamTraits +{ + typedef SerializedLoadContext paramType; + + static void Write(Message* aMsg, const paramType& aParam) + { + nsAutoCString suffix; + aParam.mOriginAttributes.CreateSuffix(suffix); + + WriteParam(aMsg, aParam.mIsNotNull); + WriteParam(aMsg, aParam.mIsContent); + WriteParam(aMsg, aParam.mIsPrivateBitValid); + WriteParam(aMsg, aParam.mUseRemoteTabs); + WriteParam(aMsg, suffix); + } + + static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) + { + nsAutoCString suffix; + if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) || + !ReadParam(aMsg, aIter, &aResult->mIsContent) || + !ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) || + !ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) || + !ReadParam(aMsg, aIter, &suffix)) { + return false; + } + return aResult->mOriginAttributes.PopulateFromSuffix(suffix); + } +}; + +} // namespace IPC + +#endif // SerializedLoadContext_h diff --git a/docshell/base/crashtests/1257730-1.html b/docshell/base/crashtests/1257730-1.html new file mode 100644 index 000000000..028a1adb8 --- /dev/null +++ b/docshell/base/crashtests/1257730-1.html @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/docshell/base/crashtests/1331295.html b/docshell/base/crashtests/1331295.html new file mode 100644 index 000000000..cdcb29e7f --- /dev/null +++ b/docshell/base/crashtests/1331295.html @@ -0,0 +1,25 @@ + + + + + + + +
+ + + + diff --git a/docshell/base/crashtests/1341657.html b/docshell/base/crashtests/1341657.html new file mode 100644 index 000000000..852b8cc80 --- /dev/null +++ b/docshell/base/crashtests/1341657.html @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/docshell/base/crashtests/369126-1.html b/docshell/base/crashtests/369126-1.html new file mode 100644 index 000000000..e9dacec30 --- /dev/null +++ b/docshell/base/crashtests/369126-1.html @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/docshell/base/crashtests/403574-1.xhtml b/docshell/base/crashtests/403574-1.xhtml new file mode 100644 index 000000000..cdf7d43a4 --- /dev/null +++ b/docshell/base/crashtests/403574-1.xhtml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/docshell/base/crashtests/40929-1-inner.html b/docshell/base/crashtests/40929-1-inner.html new file mode 100644 index 000000000..313046a34 --- /dev/null +++ b/docshell/base/crashtests/40929-1-inner.html @@ -0,0 +1,14 @@ +Infinite Loop + + + + + diff --git a/docshell/base/crashtests/40929-1.html b/docshell/base/crashtests/40929-1.html new file mode 100644 index 000000000..90685d9f1 --- /dev/null +++ b/docshell/base/crashtests/40929-1.html @@ -0,0 +1,6 @@ + +Infinite Loop + + + + diff --git a/docshell/base/crashtests/430124-1.html b/docshell/base/crashtests/430124-1.html new file mode 100644 index 000000000..8cdbc1d07 --- /dev/null +++ b/docshell/base/crashtests/430124-1.html @@ -0,0 +1,5 @@ + + + +
+ diff --git a/docshell/base/crashtests/430628-1.html b/docshell/base/crashtests/430628-1.html new file mode 100644 index 000000000..4a68a5a01 --- /dev/null +++ b/docshell/base/crashtests/430628-1.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/docshell/base/crashtests/432114-1.html b/docshell/base/crashtests/432114-1.html new file mode 100644 index 000000000..8878d6605 --- /dev/null +++ b/docshell/base/crashtests/432114-1.html @@ -0,0 +1,8 @@ + + +Bug - Crash [@ PL_DHashTableOperate] with DOMNodeInserted event listener removing window and frameset contenteditable + + + + + diff --git a/docshell/base/crashtests/432114-2.html b/docshell/base/crashtests/432114-2.html new file mode 100644 index 000000000..f8a101946 --- /dev/null +++ b/docshell/base/crashtests/432114-2.html @@ -0,0 +1,16 @@ + + +testcase2 Bug 432114 Crash [@ PL_DHashTableOperate] with DOMNodeInserted event listener removing window and frameset contenteditable + + + + + + + diff --git a/docshell/base/crashtests/436900-1-inner.html b/docshell/base/crashtests/436900-1-inner.html new file mode 100644 index 000000000..6fe35ccb1 --- /dev/null +++ b/docshell/base/crashtests/436900-1-inner.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/docshell/base/crashtests/436900-1.html b/docshell/base/crashtests/436900-1.html new file mode 100644 index 000000000..582d1919d --- /dev/null +++ b/docshell/base/crashtests/436900-1.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/docshell/base/crashtests/436900-2-inner.html b/docshell/base/crashtests/436900-2-inner.html new file mode 100644 index 000000000..ea79f75e8 --- /dev/null +++ b/docshell/base/crashtests/436900-2-inner.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/docshell/base/crashtests/436900-2.html b/docshell/base/crashtests/436900-2.html new file mode 100644 index 000000000..2e1f0c1de --- /dev/null +++ b/docshell/base/crashtests/436900-2.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/docshell/base/crashtests/500328-1.html b/docshell/base/crashtests/500328-1.html new file mode 100644 index 000000000..fd97f84ae --- /dev/null +++ b/docshell/base/crashtests/500328-1.html @@ -0,0 +1,17 @@ + + + + + + diff --git a/docshell/base/crashtests/514779-1.xhtml b/docshell/base/crashtests/514779-1.xhtml new file mode 100644 index 000000000..16ac3d9d6 --- /dev/null +++ b/docshell/base/crashtests/514779-1.xhtml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/docshell/base/crashtests/678872-1.html b/docshell/base/crashtests/678872-1.html new file mode 100644 index 000000000..9853bbdae --- /dev/null +++ b/docshell/base/crashtests/678872-1.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/docshell/base/crashtests/914521.html b/docshell/base/crashtests/914521.html new file mode 100644 index 000000000..9ae18b860 --- /dev/null +++ b/docshell/base/crashtests/914521.html @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/docshell/base/crashtests/crashtests.list b/docshell/base/crashtests/crashtests.list new file mode 100644 index 000000000..bb3a709b9 --- /dev/null +++ b/docshell/base/crashtests/crashtests.list @@ -0,0 +1,16 @@ +load 40929-1.html +load 369126-1.html +load 403574-1.xhtml +load 430124-1.html +load 430628-1.html +load 432114-1.html +load 432114-2.html +load 436900-1.html +asserts(0-1) load 436900-2.html # bug 566159 +load 500328-1.html +load 514779-1.xhtml +load 614499-1.html +load 678872-1.html +skip-if(Android) pref(dom.disable_open_during_load,false) load 914521.html +pref(browser.send_pings,true) load 1257730-1.html +load 1341657.html diff --git a/docshell/base/moz.build b/docshell/base/moz.build new file mode 100644 index 000000000..1eb04c227 --- /dev/null +++ b/docshell/base/moz.build @@ -0,0 +1,88 @@ +# -*- Mode: python; 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 += [ + 'timeline', +] + +XPIDL_SOURCES += [ + 'nsCDefaultURIFixup.idl', + 'nsIClipboardCommands.idl', + 'nsIContentViewer.idl', + 'nsIContentViewerContainer.idl', + 'nsIContentViewerEdit.idl', + 'nsIContentViewerFile.idl', + 'nsIDocCharset.idl', + 'nsIDocShell.idl', + 'nsIDocShellLoadInfo.idl', + 'nsIDocShellTreeItem.idl', + 'nsIDocShellTreeOwner.idl', + 'nsIDocumentLoaderFactory.idl', + 'nsIDownloadHistory.idl', + 'nsIGlobalHistory2.idl', + 'nsILoadContext.idl', + 'nsIPrivacyTransitionObserver.idl', + 'nsIReflowObserver.idl', + 'nsIRefreshURI.idl', + 'nsIScrollable.idl', + 'nsITextScroll.idl', + 'nsIURIFixup.idl', + 'nsIWebNavigation.idl', + 'nsIWebNavigationInfo.idl', + 'nsIWebPageDescriptor.idl', +] + +XPIDL_MODULE = 'docshell' + +EXPORTS += [ + 'nsDocShellLoadTypes.h', + 'nsILinkHandler.h', + 'nsIScrollObserver.h', + 'nsIWebShellServices.h', + 'SerializedLoadContext.h', +] + +EXPORTS.mozilla += [ + 'IHistory.h', + 'LoadContext.h', +] + +UNIFIED_SOURCES += [ + 'LoadContext.cpp', + 'nsAboutRedirector.cpp', + 'nsDefaultURIFixup.cpp', + 'nsDocShell.cpp', + 'nsDocShellEditorData.cpp', + 'nsDocShellEnumerator.cpp', + 'nsDocShellLoadInfo.cpp', + 'nsDocShellTransferableHooks.cpp', + 'nsDownloadHistory.cpp', + 'nsDSURIContentListener.cpp', + 'nsWebNavigationInfo.cpp', + 'SerializedLoadContext.cpp', +] + +include('/ipc/chromium/chromium-config.mozbuild') + +FINAL_LIBRARY = 'xul' +LOCAL_INCLUDES += [ + '/docshell/shistory', + '/dom/base', + '/layout/base', + '/layout/generic', + '/layout/xul', + '/netwerk/protocol/viewsource', + '/tools/profiler', +] + +if CONFIG['MOZ_TOOLKIT_SEARCH']: + DEFINES['MOZ_TOOLKIT_SEARCH'] = True + +if CONFIG['MOZ_DEVTOOLS'] == 'all': + DEFINES['MOZ_DEVTOOLS_ALL'] = True + +if CONFIG['GNU_CXX']: + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp new file mode 100644 index 000000000..f300e0ce2 --- /dev/null +++ b/docshell/base/nsAboutRedirector.cpp @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#include "nsAboutRedirector.h" +#include "nsNetUtil.h" +#include "nsAboutProtocolUtils.h" +#include "mozilla/ArrayUtils.h" +#include "nsIProtocolHandler.h" + +NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule) + +struct RedirEntry +{ + const char* id; + const char* url; + uint32_t flags; +}; + +/* + Entries which do not have URI_SAFE_FOR_UNTRUSTED_CONTENT will run with chrome + privileges. This is potentially dangerous. Please use + URI_SAFE_FOR_UNTRUSTED_CONTENT in the third argument to each map item below + unless your about: page really needs chrome privileges. Security review is + required before adding new map entries without + URI_SAFE_FOR_UNTRUSTED_CONTENT. Also note, however, that adding + URI_SAFE_FOR_UNTRUSTED_CONTENT will allow random web sites to link to that + URI. Perhaps we should separate the two concepts out... + */ +static RedirEntry kRedirMap[] = { + { + "", "chrome://global/content/about.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { "about", "chrome://global/content/aboutAbout.xhtml", 0 }, + { + "addons", "chrome://mozapps/content/extensions/extensions.xul", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "buildconfig", "chrome://global/content/buildconfig.html", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT + }, + { + "checkerboard", "chrome://global/content/aboutCheckerboard.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::ALLOW_SCRIPT + }, + { "config", "chrome://global/content/config.xul", 0 }, +#ifdef MOZ_CRASHREPORTER + { "crashes", "chrome://global/content/crashes.xhtml", 0 }, +#endif + { + "credits", "https://www.mozilla.org/credits/", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT + }, +#ifdef MOZ_DEVTOOLS_ALL + { + "debugging", "chrome://devtools/content/aboutdebugging/aboutdebugging.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, +#endif + { + "license", "chrome://global/content/license.html", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::MAKE_LINKABLE + }, + { + "logo", "chrome://branding/content/about.png", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + // Linkable for testing reasons. + nsIAboutModule::MAKE_LINKABLE + }, + { + "memory", "chrome://global/content/aboutMemory.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "mozilla", "chrome://global/content/mozilla.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT + }, + { + "neterror", "chrome://global/content/netError.xhtml", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::URI_CAN_LOAD_IN_CHILD | + nsIAboutModule::ALLOW_SCRIPT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "networking", "chrome://global/content/aboutNetworking.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "newaddon", "chrome://mozapps/content/extensions/newaddon.xul", + nsIAboutModule::ALLOW_SCRIPT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT + }, + { + "performance", "chrome://global/content/aboutPerformance.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "plugins", "chrome://global/content/plugins.html", + nsIAboutModule::URI_MUST_LOAD_IN_CHILD + }, + { + "serviceworkers", "chrome://global/content/aboutServiceWorkers.xhtml", + nsIAboutModule::URI_CAN_LOAD_IN_CHILD | + nsIAboutModule::URI_MUST_LOAD_IN_CHILD | + nsIAboutModule::ALLOW_SCRIPT + }, +#ifndef ANDROID + { + "profiles", "chrome://global/content/aboutProfiles.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, +#endif + // about:srcdoc is unresolvable by specification. It is included here + // because the security manager would disallow srcdoc iframes otherwise. + { + "srcdoc", "about:blank", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::HIDE_FROM_ABOUTABOUT | + // Needs to be linkable so content can touch its own srcdoc frames + nsIAboutModule::MAKE_LINKABLE | + nsIAboutModule::URI_CAN_LOAD_IN_CHILD + }, + { + "support", "chrome://global/content/aboutSupport.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "telemetry", "chrome://global/content/aboutTelemetry.xhtml", + nsIAboutModule::ALLOW_SCRIPT + }, + { + "webrtc", "chrome://global/content/aboutwebrtc/aboutWebrtc.html", + nsIAboutModule::ALLOW_SCRIPT + } +}; +static const int kRedirTotal = mozilla::ArrayLength(kRedirMap); + +NS_IMETHODIMP +nsAboutRedirector::NewChannel(nsIURI* aURI, + nsILoadInfo* aLoadInfo, + nsIChannel** aResult) +{ + NS_ENSURE_ARG_POINTER(aURI); + NS_ASSERTION(aResult, "must not be null"); + + nsAutoCString path; + nsresult rv = NS_GetAboutModuleName(aURI, path); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr ioService = do_GetIOService(&rv); + NS_ENSURE_SUCCESS(rv, rv); + + for (int i = 0; i < kRedirTotal; i++) { + if (!strcmp(path.get(), kRedirMap[i].id)) { + nsCOMPtr tempChannel; + nsCOMPtr tempURI; + rv = NS_NewURI(getter_AddRefs(tempURI), kRedirMap[i].url); + NS_ENSURE_SUCCESS(rv, rv); + + // If tempURI links to an external URI (i.e. something other than + // chrome:// or resource://) then set the LOAD_REPLACE flag on the + // channel which forces the channel owner to reflect the displayed + // URL rather then being the systemPrincipal. + bool isUIResource = false; + rv = NS_URIChainHasFlags(tempURI, nsIProtocolHandler::URI_IS_UI_RESOURCE, + &isUIResource); + NS_ENSURE_SUCCESS(rv, rv); + + nsLoadFlags loadFlags = + isUIResource ? static_cast(nsIChannel::LOAD_NORMAL) + : static_cast(nsIChannel::LOAD_REPLACE); + + rv = NS_NewChannelInternal(getter_AddRefs(tempChannel), + tempURI, + aLoadInfo, + nullptr, // aLoadGroup + nullptr, // aCallbacks + loadFlags); + NS_ENSURE_SUCCESS(rv, rv); + + tempChannel->SetOriginalURI(aURI); + + tempChannel.forget(aResult); + return rv; + } + } + + NS_ERROR("nsAboutRedirector called for unknown case"); + return NS_ERROR_ILLEGAL_VALUE; +} + +NS_IMETHODIMP +nsAboutRedirector::GetURIFlags(nsIURI* aURI, uint32_t* aResult) +{ + NS_ENSURE_ARG_POINTER(aURI); + + nsAutoCString name; + nsresult rv = NS_GetAboutModuleName(aURI, name); + NS_ENSURE_SUCCESS(rv, rv); + + for (int i = 0; i < kRedirTotal; i++) { + if (name.EqualsASCII(kRedirMap[i].id)) { + *aResult = kRedirMap[i].flags; + return NS_OK; + } + } + + NS_ERROR("nsAboutRedirector called for unknown case"); + return NS_ERROR_ILLEGAL_VALUE; +} + +nsresult +nsAboutRedirector::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult) +{ + RefPtr about = new nsAboutRedirector(); + return about->QueryInterface(aIID, aResult); +} diff --git a/docshell/base/nsAboutRedirector.h b/docshell/base/nsAboutRedirector.h new file mode 100644 index 000000000..f8e6b2558 --- /dev/null +++ b/docshell/base/nsAboutRedirector.h @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#ifndef nsAboutRedirector_h__ +#define nsAboutRedirector_h__ + +#include "nsIAboutModule.h" + +class nsAboutRedirector : public nsIAboutModule +{ +public: + NS_DECL_ISUPPORTS + + NS_DECL_NSIABOUTMODULE + + nsAboutRedirector() {} + + static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult); + +protected: + virtual ~nsAboutRedirector() {} +}; + +/* 56ebedd4-6ccf-48e8-bdae-adc77f044567 */ +#define NS_ABOUT_REDIRECTOR_MODULE_CID \ +{ 0x56ebedd4, 0x6ccf, 0x48e8, \ + { 0xbd, 0xae, 0xad, 0xc7, 0x7f, 0x04, 0x45, 0x67 } } + +#endif // nsAboutRedirector_h__ diff --git a/docshell/base/nsCDefaultURIFixup.idl b/docshell/base/nsCDefaultURIFixup.idl new file mode 100644 index 000000000..60fffdf21 --- /dev/null +++ b/docshell/base/nsCDefaultURIFixup.idl @@ -0,0 +1,13 @@ +/* -*- Mode: IDL; tab-width: 4; 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/. */ + +%{ C++ +// {214C48A0-B57F-11d4-959C-0020183BF181} +#define NS_DEFAULTURIFIXUP_CID \ +{ 0x214c48a0, 0xb57f, 0x11d4, { 0x95, 0x9c, 0x0, 0x20, 0x18, 0x3b, 0xf1, 0x81 } } +#define NS_URIFIXUP_CONTRACTID \ +"@mozilla.org/docshell/urifixup;1" +%} diff --git a/docshell/base/nsDSURIContentListener.cpp b/docshell/base/nsDSURIContentListener.cpp new file mode 100644 index 000000000..cfac54f7f --- /dev/null +++ b/docshell/base/nsDSURIContentListener.cpp @@ -0,0 +1,539 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=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/. */ + +#include "nsDocShell.h" +#include "nsDSURIContentListener.h" +#include "nsIChannel.h" +#include "nsServiceManagerUtils.h" +#include "nsDocShellCID.h" +#include "nsIWebNavigationInfo.h" +#include "nsIDocument.h" +#include "nsIDOMWindow.h" +#include "nsNetUtil.h" +#include "nsQueryObject.h" +#include "nsIHttpChannel.h" +#include "nsIScriptSecurityManager.h" +#include "nsError.h" +#include "nsCharSeparatedTokenizer.h" +#include "nsIConsoleService.h" +#include "nsIScriptError.h" +#include "nsDocShellLoadTypes.h" +#include "nsIMultiPartChannel.h" + +using namespace mozilla; + +nsDSURIContentListener::nsDSURIContentListener(nsDocShell* aDocShell) + : mDocShell(aDocShell) + , mExistingJPEGRequest(nullptr) + , mParentContentListener(nullptr) +{ +} + +nsDSURIContentListener::~nsDSURIContentListener() +{ +} + +nsresult +nsDSURIContentListener::Init() +{ + nsresult rv; + mNavInfo = do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID, &rv); + NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get webnav info"); + return rv; +} + +NS_IMPL_ADDREF(nsDSURIContentListener) +NS_IMPL_RELEASE(nsDSURIContentListener) + +NS_INTERFACE_MAP_BEGIN(nsDSURIContentListener) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIContentListener) + NS_INTERFACE_MAP_ENTRY(nsIURIContentListener) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) +NS_INTERFACE_MAP_END + +NS_IMETHODIMP +nsDSURIContentListener::OnStartURIOpen(nsIURI* aURI, bool* aAbortOpen) +{ + // If mDocShell is null here, that means someone's starting a load in our + // docshell after it's already been destroyed. Don't let that happen. + if (!mDocShell) { + *aAbortOpen = true; + return NS_OK; + } + + nsCOMPtr parentListener; + GetParentContentListener(getter_AddRefs(parentListener)); + if (parentListener) { + return parentListener->OnStartURIOpen(aURI, aAbortOpen); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::DoContent(const nsACString& aContentType, + bool aIsContentPreferred, + nsIRequest* aRequest, + nsIStreamListener** aContentHandler, + bool* aAbortProcess) +{ + nsresult rv; + NS_ENSURE_ARG_POINTER(aContentHandler); + NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); + + // Check whether X-Frame-Options permits us to load this content in an + // iframe and abort the load (unless we've disabled x-frame-options + // checking). + if (!CheckFrameOptions(aRequest)) { + *aAbortProcess = true; + return NS_OK; + } + + *aAbortProcess = false; + + // determine if the channel has just been retargeted to us... + nsLoadFlags loadFlags = 0; + nsCOMPtr aOpenedChannel = do_QueryInterface(aRequest); + + if (aOpenedChannel) { + aOpenedChannel->GetLoadFlags(&loadFlags); + } + + if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) { + // XXX: Why does this not stop the content too? + mDocShell->Stop(nsIWebNavigation::STOP_NETWORK); + + mDocShell->SetLoadType(aIsContentPreferred ? LOAD_LINK : LOAD_NORMAL); + } + + // In case of multipart jpeg request (mjpeg) we don't really want to + // create new viewer since the one we already have is capable of + // rendering multipart jpeg correctly (see bug 625012) + nsCOMPtr baseChannel; + if (nsCOMPtr mpchan = do_QueryInterface(aRequest)) { + mpchan->GetBaseChannel(getter_AddRefs(baseChannel)); + } + + bool reuseCV = baseChannel && baseChannel == mExistingJPEGRequest && + aContentType.EqualsLiteral("image/jpeg"); + + if (mExistingJPEGStreamListener && reuseCV) { + RefPtr copy(mExistingJPEGStreamListener); + copy.forget(aContentHandler); + rv = NS_OK; + } else { + rv = mDocShell->CreateContentViewer(aContentType, aRequest, aContentHandler); + if (NS_SUCCEEDED(rv) && reuseCV) { + mExistingJPEGStreamListener = *aContentHandler; + } else { + mExistingJPEGStreamListener = nullptr; + } + mExistingJPEGRequest = baseChannel; + } + + if (rv == NS_ERROR_REMOTE_XUL) { + aRequest->Cancel(rv); + *aAbortProcess = true; + return NS_OK; + } + + if (NS_FAILED(rv)) { + // we don't know how to handle the content + *aContentHandler = nullptr; + return rv; + } + + if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) { + nsCOMPtr domWindow = + mDocShell ? mDocShell->GetWindow() : nullptr; + NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE); + domWindow->Focus(); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::IsPreferred(const char* aContentType, + char** aDesiredContentType, + bool* aCanHandle) +{ + NS_ENSURE_ARG_POINTER(aCanHandle); + NS_ENSURE_ARG_POINTER(aDesiredContentType); + + // the docshell has no idea if it is the preferred content provider or not. + // It needs to ask its parent if it is the preferred content handler or not... + + nsCOMPtr parentListener; + GetParentContentListener(getter_AddRefs(parentListener)); + if (parentListener) { + return parentListener->IsPreferred(aContentType, + aDesiredContentType, + aCanHandle); + } + // we used to return false here if we didn't have a parent properly registered + // at the top of the docshell hierarchy to dictate what content types this + // docshell should be a preferred handler for. But this really makes it hard + // for developers using iframe or browser tags because then they need to make + // sure they implement nsIURIContentListener otherwise all link clicks would + // get sent to another window because we said we weren't the preferred handler + // type. I'm going to change the default now... if we can handle the content, + // and someone didn't EXPLICITLY set a nsIURIContentListener at the top of our + // docshell chain, then we'll now always attempt to process the content + // ourselves... + return CanHandleContent(aContentType, true, aDesiredContentType, aCanHandle); +} + +NS_IMETHODIMP +nsDSURIContentListener::CanHandleContent(const char* aContentType, + bool aIsContentPreferred, + char** aDesiredContentType, + bool* aCanHandleContent) +{ + NS_PRECONDITION(aCanHandleContent, "Null out param?"); + NS_ENSURE_ARG_POINTER(aDesiredContentType); + + *aCanHandleContent = false; + *aDesiredContentType = nullptr; + + nsresult rv = NS_OK; + if (aContentType) { + uint32_t canHandle = nsIWebNavigationInfo::UNSUPPORTED; + rv = mNavInfo->IsTypeSupported(nsDependentCString(aContentType), + mDocShell, + &canHandle); + *aCanHandleContent = (canHandle != nsIWebNavigationInfo::UNSUPPORTED); + } + + return rv; +} + +NS_IMETHODIMP +nsDSURIContentListener::GetLoadCookie(nsISupports** aLoadCookie) +{ + NS_IF_ADDREF(*aLoadCookie = nsDocShell::GetAsSupports(mDocShell)); + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::SetLoadCookie(nsISupports* aLoadCookie) +{ +#ifdef DEBUG + RefPtr cookieAsDocLoader = + nsDocLoader::GetAsDocLoader(aLoadCookie); + NS_ASSERTION(cookieAsDocLoader && cookieAsDocLoader == mDocShell, + "Invalid load cookie being set!"); +#endif + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::GetParentContentListener( + nsIURIContentListener** aParentListener) +{ + if (mWeakParentContentListener) { + nsCOMPtr tempListener = + do_QueryReferent(mWeakParentContentListener); + *aParentListener = tempListener; + NS_IF_ADDREF(*aParentListener); + } else { + *aParentListener = mParentContentListener; + NS_IF_ADDREF(*aParentListener); + } + return NS_OK; +} + +NS_IMETHODIMP +nsDSURIContentListener::SetParentContentListener( + nsIURIContentListener* aParentListener) +{ + if (aParentListener) { + // Store the parent listener as a weak ref. Parents not supporting + // nsISupportsWeakReference assert but may still be used. + mParentContentListener = nullptr; + mWeakParentContentListener = do_GetWeakReference(aParentListener); + if (!mWeakParentContentListener) { + mParentContentListener = aParentListener; + } + } else { + mWeakParentContentListener = nullptr; + mParentContentListener = nullptr; + } + return NS_OK; +} + +bool +nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel, + const nsAString& aPolicy) +{ + static const char allowFrom[] = "allow-from"; + const uint32_t allowFromLen = ArrayLength(allowFrom) - 1; + bool isAllowFrom = + StringHead(aPolicy, allowFromLen).LowerCaseEqualsLiteral(allowFrom); + + // return early if header does not have one of the values with meaning + if (!aPolicy.LowerCaseEqualsLiteral("deny") && + !aPolicy.LowerCaseEqualsLiteral("sameorigin") && + !isAllowFrom) { + return true; + } + + nsCOMPtr uri; + aHttpChannel->GetURI(getter_AddRefs(uri)); + + // XXXkhuey when does this happen? Is returning true safe here? + if (!mDocShell) { + return true; + } + + // We need to check the location of this window and the location of the top + // window, if we're not the top. X-F-O: SAMEORIGIN requires that the + // document must be same-origin with top window. X-F-O: DENY requires that + // the document must never be framed. + nsCOMPtr thisWindow = mDocShell->GetWindow(); + // If we don't have DOMWindow there is no risk of clickjacking + if (!thisWindow) { + return true; + } + + // GetScriptableTop, not GetTop, because we want this to respect + // "); + href = yield BrowserTestUtils.browserLoaded(browser); + is(href, "data:text/html,", + "Check data URL loaded"); + + browser.goBack(); + href = yield BrowserTestUtils.browserLoaded(browser); + is(href, "about:accounts", "Check we've gone back to about:accounts"); + + browser.goForward(); + href = yield BrowserTestUtils.browserLoaded(browser); + is(href, "data:text/html,", + "Check we've gone forward to data URL"); +}); diff --git a/docshell/test/browser/browser_bug134911.js b/docshell/test/browser/browser_bug134911.js new file mode 100644 index 000000000..aa54cfd1a --- /dev/null +++ b/docshell/test/browser/browser_bug134911.js @@ -0,0 +1,41 @@ +const TEXT = { + /* The test text decoded correctly as Shift_JIS */ + rightText: "\u30E6\u30CB\u30B3\u30FC\u30C9\u306F\u3001\u3059\u3079\u3066\u306E\u6587\u5B57\u306B\u56FA\u6709\u306E\u756A\u53F7\u3092\u4ED8\u4E0E\u3057\u307E\u3059", + + enteredText1: "The quick brown fox jumps over the lazy dog", + enteredText2: "\u03BE\u03B5\u03C3\u03BA\u03B5\u03C0\u03AC\u03B6\u03C9\u0020\u03C4\u1F74\u03BD\u0020\u03C8\u03C5\u03C7\u03BF\u03C6\u03B8\u03CC\u03C1\u03B1\u0020\u03B2\u03B4\u03B5\u03BB\u03C5\u03B3\u03BC\u03AF\u03B1", +}; + +function test() { + waitForExplicitFinish(); + + var rootDir = "http://mochi.test:8888/browser/docshell/test/browser/"; + gBrowser.selectedTab = gBrowser.addTab(rootDir + "test-form_sjis.html"); + BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(afterOpen); +} + +function afterOpen() { + BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(afterChangeCharset); + + ContentTask.spawn(gBrowser.selectedBrowser, TEXT, function(TEXT) { + content.document.getElementById("testtextarea").value = TEXT.enteredText1; + content.document.getElementById("testinput").value = TEXT.enteredText2; + }).then(() => { + /* Force the page encoding to Shift_JIS */ + BrowserSetForcedCharacterSet("Shift_JIS"); + }); +} + +function afterChangeCharset() { + ContentTask.spawn(gBrowser.selectedBrowser, TEXT, function(TEXT) { + is(content.document.getElementById("testpar").innerHTML, TEXT.rightText, + "encoding successfully changed"); + is(content.document.getElementById("testtextarea").value, TEXT.enteredText1, + "text preserved in + +

+ +

Expected text on load:

+

ѓ†ѓjѓRЃ[ѓh‚НЃA‚·‚Ч‚Д‚М•¶Ћљ‚ЙЊЕ—L‚М”ФЌ†‚р•t—^‚µ‚Ь‚·

+

Expected text on resetting the encoding to Shift_JIS:

+

ユニコードは、すべての文字に固有の番号を付与します

+ + diff --git a/docshell/test/browser/timelineMarkers-04.html b/docshell/test/browser/timelineMarkers-04.html new file mode 100644 index 000000000..829998387 --- /dev/null +++ b/docshell/test/browser/timelineMarkers-04.html @@ -0,0 +1,55 @@ + + + + + markers test + + + +

Test page

+ + + + + + diff --git a/docshell/test/bug123696-subframe.html b/docshell/test/bug123696-subframe.html new file mode 100644 index 000000000..136d0a184 --- /dev/null +++ b/docshell/test/bug123696-subframe.html @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/docshell/test/bug369814.jar b/docshell/test/bug369814.jar new file mode 100644 index 000000000..86b9c8c09 Binary files /dev/null and b/docshell/test/bug369814.jar differ diff --git a/docshell/test/bug369814.zip b/docshell/test/bug369814.zip new file mode 100644 index 000000000..ed8234dbc Binary files /dev/null and b/docshell/test/bug369814.zip differ diff --git a/docshell/test/bug404548-subframe.html b/docshell/test/bug404548-subframe.html new file mode 100644 index 000000000..0afd17544 --- /dev/null +++ b/docshell/test/bug404548-subframe.html @@ -0,0 +1,7 @@ + + + + + diff --git a/docshell/test/bug413310-post.sjs b/docshell/test/bug413310-post.sjs new file mode 100644 index 000000000..b8d85dd3c --- /dev/null +++ b/docshell/test/bug413310-post.sjs @@ -0,0 +1,7 @@ +function handleRequest(request, response) { + response.setHeader("Content-Type", "text/html"); + response.write("" + + request.method + " " + + Date.now() + + ""); +} diff --git a/docshell/test/bug413310-subframe.html b/docshell/test/bug413310-subframe.html new file mode 100644 index 000000000..bcff1886f --- /dev/null +++ b/docshell/test/bug413310-subframe.html @@ -0,0 +1,7 @@ + + + +
+
+ + diff --git a/docshell/test/bug529119-window.html b/docshell/test/bug529119-window.html new file mode 100644 index 000000000..f1908835a --- /dev/null +++ b/docshell/test/bug529119-window.html @@ -0,0 +1,7 @@ + + + +Test bug 529119, sub-window + + + diff --git a/docshell/test/bug530396-noref.sjs b/docshell/test/bug530396-noref.sjs new file mode 100644 index 000000000..1ed5f7aa2 --- /dev/null +++ b/docshell/test/bug530396-noref.sjs @@ -0,0 +1,20 @@ +function handleRequest(request, response) { + response.setHeader("Content-Type", "text/html"); + response.setHeader("Cache-Control", "no-cache"); + response.write(""); + } else { + response.write("window.parent.doNextStep();'>"); + } + + response.write(request.method + " " + Date.now()); + response.write(""); +} diff --git a/docshell/test/bug530396-subframe.html b/docshell/test/bug530396-subframe.html new file mode 100644 index 000000000..be81b9f14 --- /dev/null +++ b/docshell/test/bug530396-subframe.html @@ -0,0 +1,7 @@ + + + + bug530396-noref.sjs + bug530396-noref.sjs with new window + + diff --git a/docshell/test/bug570341_recordevents.html b/docshell/test/bug570341_recordevents.html new file mode 100644 index 000000000..51fc1cd76 --- /dev/null +++ b/docshell/test/bug570341_recordevents.html @@ -0,0 +1,21 @@ + + + + +This document collects time +for events related to the page load progress. + diff --git a/docshell/test/bug668513_redirect.html b/docshell/test/bug668513_redirect.html new file mode 100644 index 000000000..1b8f66c63 --- /dev/null +++ b/docshell/test/bug668513_redirect.html @@ -0,0 +1 @@ +This document is redirected to a blank document. diff --git a/docshell/test/bug668513_redirect.html^headers^ b/docshell/test/bug668513_redirect.html^headers^ new file mode 100644 index 000000000..0e785833c --- /dev/null +++ b/docshell/test/bug668513_redirect.html^headers^ @@ -0,0 +1,2 @@ +HTTP 302 Moved Temporarily +Location: navigation/blank.html diff --git a/docshell/test/bug691547_frame.html b/docshell/test/bug691547_frame.html new file mode 100644 index 000000000..00172f711 --- /dev/null +++ b/docshell/test/bug691547_frame.html @@ -0,0 +1,12 @@ + + + + + Test for Bug 691547 + + + + + diff --git a/docshell/test/chrome/112564_nocache.html b/docshell/test/chrome/112564_nocache.html new file mode 100644 index 000000000..29fb990b8 --- /dev/null +++ b/docshell/test/chrome/112564_nocache.html @@ -0,0 +1,10 @@ + + +test1 + + +

+This document will be sent with a no-cache cache-control header. When sent over a secure connection, it should not be stored in bfcache. +

+ + diff --git a/docshell/test/chrome/112564_nocache.html^headers^ b/docshell/test/chrome/112564_nocache.html^headers^ new file mode 100644 index 000000000..c829a41ae --- /dev/null +++ b/docshell/test/chrome/112564_nocache.html^headers^ @@ -0,0 +1 @@ +Cache-control: no-cache diff --git a/docshell/test/chrome/215405_nocache.html b/docshell/test/chrome/215405_nocache.html new file mode 100644 index 000000000..c7d48c4eb --- /dev/null +++ b/docshell/test/chrome/215405_nocache.html @@ -0,0 +1,14 @@ + + + + test1 + + + + +
Some text
+
Some text
+
Some text
+
Some more text
+ + diff --git a/docshell/test/chrome/215405_nocache.html^headers^ b/docshell/test/chrome/215405_nocache.html^headers^ new file mode 100644 index 000000000..c829a41ae --- /dev/null +++ b/docshell/test/chrome/215405_nocache.html^headers^ @@ -0,0 +1 @@ +Cache-control: no-cache diff --git a/docshell/test/chrome/215405_nostore.html b/docshell/test/chrome/215405_nostore.html new file mode 100644 index 000000000..4f5bd0f4f --- /dev/null +++ b/docshell/test/chrome/215405_nostore.html @@ -0,0 +1,14 @@ + + + + test1 + + + + +
Some text
+
Some text
+
Some text
+
Some more text
+ + diff --git a/docshell/test/chrome/215405_nostore.html^headers^ b/docshell/test/chrome/215405_nostore.html^headers^ new file mode 100644 index 000000000..59ba29610 --- /dev/null +++ b/docshell/test/chrome/215405_nostore.html^headers^ @@ -0,0 +1 @@ +Cache-control: no-store diff --git a/docshell/test/chrome/582176_dummy.html b/docshell/test/chrome/582176_dummy.html new file mode 100644 index 000000000..3b18e512d --- /dev/null +++ b/docshell/test/chrome/582176_dummy.html @@ -0,0 +1 @@ +hello world diff --git a/docshell/test/chrome/582176_xml.xml b/docshell/test/chrome/582176_xml.xml new file mode 100644 index 000000000..d3dd576df --- /dev/null +++ b/docshell/test/chrome/582176_xml.xml @@ -0,0 +1,2 @@ + + diff --git a/docshell/test/chrome/582176_xslt.xsl b/docshell/test/chrome/582176_xslt.xsl new file mode 100644 index 000000000..595741689 --- /dev/null +++ b/docshell/test/chrome/582176_xslt.xsl @@ -0,0 +1,8 @@ + + + + XSLT result doc +

xslt result

+ +
+
diff --git a/docshell/test/chrome/662200a.html b/docshell/test/chrome/662200a.html new file mode 100644 index 000000000..0b9ead6f3 --- /dev/null +++ b/docshell/test/chrome/662200a.html @@ -0,0 +1,8 @@ + + + A + + + Next + + diff --git a/docshell/test/chrome/662200b.html b/docshell/test/chrome/662200b.html new file mode 100644 index 000000000..91e6b971d --- /dev/null +++ b/docshell/test/chrome/662200b.html @@ -0,0 +1,8 @@ + + + B + + + Next + + diff --git a/docshell/test/chrome/662200c.html b/docshell/test/chrome/662200c.html new file mode 100644 index 000000000..bc00e6b14 --- /dev/null +++ b/docshell/test/chrome/662200c.html @@ -0,0 +1,7 @@ + + + C + + + + diff --git a/docshell/test/chrome/89419.html b/docshell/test/chrome/89419.html new file mode 100644 index 000000000..b36b8d788 --- /dev/null +++ b/docshell/test/chrome/89419.html @@ -0,0 +1,7 @@ + + +Bug 89419 + + + + diff --git a/docshell/test/chrome/92598_nostore.html b/docshell/test/chrome/92598_nostore.html new file mode 100644 index 000000000..47bb90441 --- /dev/null +++ b/docshell/test/chrome/92598_nostore.html @@ -0,0 +1,10 @@ + + +test1 + + +

+This document will be sent with a no-store cache-control header. It should not be stored in bfcache. +

+ + diff --git a/docshell/test/chrome/92598_nostore.html^headers^ b/docshell/test/chrome/92598_nostore.html^headers^ new file mode 100644 index 000000000..59ba29610 --- /dev/null +++ b/docshell/test/chrome/92598_nostore.html^headers^ @@ -0,0 +1 @@ +Cache-control: no-store diff --git a/docshell/test/chrome/allowContentRetargeting.sjs b/docshell/test/chrome/allowContentRetargeting.sjs new file mode 100644 index 000000000..96e467ef6 --- /dev/null +++ b/docshell/test/chrome/allowContentRetargeting.sjs @@ -0,0 +1,7 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +function handleRequest(req, resp) { + resp.setHeader("Content-Type", "application/octet-stream", false); + resp.write("hi"); +} diff --git a/docshell/test/chrome/blue.png b/docshell/test/chrome/blue.png new file mode 100644 index 000000000..8df58f3a5 Binary files /dev/null and b/docshell/test/chrome/blue.png differ diff --git a/docshell/test/chrome/bug112564_window.xul b/docshell/test/chrome/bug112564_window.xul new file mode 100644 index 000000000..e9c05ca9f --- /dev/null +++ b/docshell/test/chrome/bug112564_window.xul @@ -0,0 +1,117 @@ + + + + + + + + + + + + diff --git a/docshell/test/chrome/bug113934_window.xul b/docshell/test/chrome/bug113934_window.xul new file mode 100644 index 000000000..9dbfc3b8f --- /dev/null +++ b/docshell/test/chrome/bug113934_window.xul @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + diff --git a/docshell/test/chrome/bug215405_window.xul b/docshell/test/chrome/bug215405_window.xul new file mode 100644 index 000000000..1935eddee --- /dev/null +++ b/docshell/test/chrome/bug215405_window.xul @@ -0,0 +1,167 @@ + + + + + + + + + + + + diff --git a/docshell/test/chrome/bug293235.html b/docshell/test/chrome/bug293235.html new file mode 100644 index 000000000..458f88431 --- /dev/null +++ b/docshell/test/chrome/bug293235.html @@ -0,0 +1,13 @@ + + + Bug 293235 page1 + + + + This is a test link. + + diff --git a/docshell/test/chrome/bug293235_p2.html b/docshell/test/chrome/bug293235_p2.html new file mode 100644 index 000000000..2de067b80 --- /dev/null +++ b/docshell/test/chrome/bug293235_p2.html @@ -0,0 +1,8 @@ + + + Bug 293235 page2 + + + Nothing to see here, move along. + + diff --git a/docshell/test/chrome/bug293235_window.xul b/docshell/test/chrome/bug293235_window.xul new file mode 100644 index 000000000..b5b359d48 --- /dev/null +++ b/docshell/test/chrome/bug293235_window.xul @@ -0,0 +1,162 @@ + + + + + + + + + + + diff --git a/docshell/test/chrome/bug294258_testcase.html b/docshell/test/chrome/bug294258_testcase.html new file mode 100644 index 000000000..cd80fefd0 --- /dev/null +++ b/docshell/test/chrome/bug294258_testcase.html @@ -0,0 +1,43 @@ + + + + + Bug 294258 Testcase + + + + +
+

+ input type="text": +

+

+ input type="checkbox": +

+

+ input type="file": +

+

+ input type="radio": + + +

+

+ textarea: +

+

+ select -> option: +

+
+ + diff --git a/docshell/test/chrome/bug294258_window.xul b/docshell/test/chrome/bug294258_window.xul new file mode 100644 index 000000000..f25097eab --- /dev/null +++ b/docshell/test/chrome/bug294258_window.xul @@ -0,0 +1,76 @@ + + + + + + + + + diff --git a/docshell/test/chrome/bug298622_window.xul b/docshell/test/chrome/bug298622_window.xul new file mode 100755 index 000000000..2773f3420 --- /dev/null +++ b/docshell/test/chrome/bug298622_window.xul @@ -0,0 +1,148 @@ + + + + + + + + + + + + + diff --git a/docshell/test/chrome/bug301397_1.html b/docshell/test/chrome/bug301397_1.html new file mode 100644 index 000000000..9943c2efe --- /dev/null +++ b/docshell/test/chrome/bug301397_1.html @@ -0,0 +1,9 @@ + + + + iframe parent + + + " + + "'>" + + "" + + ""; + + gExpected = [{type: "pagehide", title: "test2", persisted: true}, + {type: "load", title: "test3-nested2"}, + {type: "pageshow", title: "test3-nested2", persisted: false}, + {type: "load", title: "test3-nested1"}, + {type: "pageshow", title: "test3-nested1", persisted: false}, + {type: "load", title: "test3"}, + {type: "pageshow", title: "test3", persisted: false}]; + gBrowser.loadURI(test3Doc); + yield undefined; + + var test4Doc = "data:text/html,test4" + + "test4"; + + gExpected = [{type: "pagehide", title: "test3", persisted: true}, + {type: "pagehide", title: "test3-nested1", persisted: true}, + {type: "pagehide", title: "test3-nested2", persisted: true}, + {type: "load", title: "test4"}, + {type: "pageshow", title: "test4", persisted: false}]; + gBrowser.loadURI(test4Doc); + yield undefined; + + gExpected = [{type: "pagehide", title: "test4", persisted: true}, + {type: "pageshow", title: "test3-nested2", persisted: true}, + {type: "pageshow", title: "test3-nested1", persisted: true}, + {type: "pageshow", title: "test3", persisted: true}]; + gBrowser.goBack(); + yield undefined; + + // This is where the two nested pagehide are not dispatched in bug 364461 + gExpected = [{type: "pagehide", title: "test3", persisted: true}, + {type: "pagehide", title: "test3-nested1", persisted: true}, + {type: "pagehide", title: "test3-nested2", persisted: true}, + {type: "pageshow", title: "test4", persisted: true}]; + gBrowser.goForward(); + yield undefined; + + // Tests 5 + 6: + // Back/forward between a document containing an unload handler and a + // a simple document. Bfcache won't be used for the first one (see + // http://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching). + + var test5Doc = "data:text/html,test5" + + "" + + "test5"; + + gExpected = [{type: "pagehide", title: "test4", persisted: true}, + {type: "load", title: "test5"}, + {type: "pageshow", title: "test5", persisted: false}]; + gBrowser.loadURI(test5Doc); + yield undefined; + + var test6Doc = "data:text/html,test6" + + "test6"; + + gExpected = [{type: "pagehide", title: "test5", persisted: false}, + {type: "unload", title: "test5"}, + {type: "load", title: "test6"}, + {type: "pageshow", title: "test6", persisted: false}]; + gBrowser.loadURI(test6Doc); + yield undefined; + + gExpected = [{type: "pagehide", title: "test6", persisted: true}, + {type: "load", title: "test5"}, + {type: "pageshow", title: "test5", persisted: false}]; + gBrowser.goBack(); + yield undefined; + + gExpected = [{type: "pagehide", title: "test5", persisted: false}, + {type: "unload", title: "test5"}, + {type: "pageshow", title: "test6", persisted: true}]; + gBrowser.goForward(); + yield undefined; + + // Test 7: + // Testcase from https://bugzilla.mozilla.org/show_bug.cgi?id=384977#c10 + // Check that navigation is not blocked after a document is restored + // from bfcache + + var test7Doc = "data:text/html,test7" + + "" + + "" + + ""; + + gExpected = [{type: "pagehide", title: "test6", persisted: true}, + {type: "load", title: "test7-nested1"}, + {type: "pageshow", title: "test7-nested1", persisted: false}, + {type: "load", title: "test7"}, + {type: "pageshow", title: "test7", persisted: false}]; + gBrowser.loadURI(test7Doc); + yield undefined; + + // Simulates a click on the link inside the iframe + function clickIframeLink() { + var iframe = gBrowser.contentDocument.getElementsByTagName("iframe")[0]; + var w = iframe.contentWindow; + var d = iframe.contentDocument; + + var evt = d.createEvent("MouseEvents"); + evt.initMouseEvent("click", true, true, w, + 0, 0, 0, 0, 0, false, false, false, false, 0, null); + d.getElementsByTagName("a")[0].dispatchEvent(evt); + } + + gExpected = [{type: "pagehide", title: "test7", persisted: true}, + {type: "pagehide", title: "test7-nested1", persisted: true}, + {type: "load"}, + {type: "pageshow", persisted: false}]; + clickIframeLink(); + yield undefined; + + is(gBrowser.currentURI.spec, "data:text/plain,aaa", + "Navigation is blocked when clicking link"); + + gExpected = [{type: "pagehide", persisted: true}, + {type: "pageshow", title: "test7-nested1", persisted: true}, + {type: "pageshow", title: "test7", persisted: true}]; + gBrowser.goBack(); + yield undefined; + + gExpected = [{type: "pagehide", title: "test7", persisted: true}, + {type: "pagehide", title: "test7-nested1", persisted: true}, + {type: "load"}, + {type: "pageshow", persisted: false}]; + clickIframeLink(); + yield undefined; + + is(gBrowser.currentURI.spec, "data:text/plain,aaa", + "Navigation is blocked when clicking link"); + + // nextTest has to be called from here, as no events are fired in this + // step + setTimeout(nextTest, 0); + yield undefined; + } + ]]> + + + diff --git a/docshell/test/chrome/bug396519_window.xul b/docshell/test/chrome/bug396519_window.xul new file mode 100644 index 000000000..32497b163 --- /dev/null +++ b/docshell/test/chrome/bug396519_window.xul @@ -0,0 +1,169 @@ + + + + + + + + + + + + diff --git a/docshell/test/chrome/bug396649_window.xul b/docshell/test/chrome/bug396649_window.xul new file mode 100755 index 000000000..c94d8b78e --- /dev/null +++ b/docshell/test/chrome/bug396649_window.xul @@ -0,0 +1,122 @@ + + + + + + + + + diff --git a/docshell/test/chrome/bug449778_window.xul b/docshell/test/chrome/bug449778_window.xul new file mode 100644 index 000000000..b4fc5e2ba --- /dev/null +++ b/docshell/test/chrome/bug449778_window.xul @@ -0,0 +1,106 @@ + + + + + + + + + third test"; + + + $("f1").setAttribute("src", doc1); + $("f2").setAttribute("src", doc2); + + function doTheTest() { + var strs = { "f1": "", "f2" : "" }; + function attachListener(node, type) { + var listener = function(e) { + if (strs[node.id]) strs[node.id] += " "; + strs[node.id] += node.id + ".page" + type; + } + node.addEventListener("page" + type, listener, false); + + listener.detach = function() { + node.removeEventListener("page" + type, listener, false); + } + return listener; + } + + var l1 = attachListener($("f1"), "show"); + var l2 = attachListener($("f1"), "hide"); + var l3 = attachListener($("f2"), "show"); + var l4 = attachListener($("f2"), "hide"); + + $("f1").swapDocShells($("f2")); + + is(strs["f1"], "f1.pagehide f1.pageshow", + "Expected hide then show on first loaded page"); + is(strs["f2"], "f2.pagehide f2.pageshow", + "Expected hide then show on second loaded page"); + + function listener2() { + $("f2").removeEventListener("testEvt", listener2, false); + + strs = { "f1": "", "f2" : "" }; + + $("f1").swapDocShells($("f2")); + is(strs["f1"], "f1.pagehide", + "Expected hide on already-loaded page, then nothing"); + is(strs["f2"], "f2.pageshow f2.pagehide f2.pageshow", + "Expected show on still-loading page, then hide on it, then show " + + "on already-loaded page"); + + strs = { "f1": "", "f2" : "" }; + + $("f1").addEventListener("pageshow", listener3, false); + } + + function listener3() { + $("f1").removeEventListener("pageshow", listener3, false); + + is(strs["f1"], "f1.pageshow", + "Expected show as our page finishes loading"); + is(strs["f2"], "", "Expected no more events here."); + + l1.detach(); + l2.detach(); + l3.detach(); + l4.detach(); + + window.close(); + SimpleTest.finish(); + } + + $("f2").addEventListener("testEvt", listener2, false, true); + $("f2").setAttribute("src", doc3); + } + + ]]> + diff --git a/docshell/test/chrome/bug449780_window.xul b/docshell/test/chrome/bug449780_window.xul new file mode 100644 index 000000000..38633c00f --- /dev/null +++ b/docshell/test/chrome/bug449780_window.xul @@ -0,0 +1,77 @@ + + + + + + + + + + diff --git a/docshell/test/chrome/bug454235-subframe.xul b/docshell/test/chrome/bug454235-subframe.xul new file mode 100644 index 000000000..a8b6178e6 --- /dev/null +++ b/docshell/test/chrome/bug454235-subframe.xul @@ -0,0 +1,7 @@ + + + + + + diff --git a/docshell/test/chrome/bug582176_window.xul b/docshell/test/chrome/bug582176_window.xul new file mode 100644 index 000000000..ad594ee0c --- /dev/null +++ b/docshell/test/chrome/bug582176_window.xul @@ -0,0 +1,88 @@ + + + + + + + + diff --git a/docshell/test/chrome/bug608669.xul b/docshell/test/chrome/bug608669.xul new file mode 100644 index 000000000..1ab012c14 --- /dev/null +++ b/docshell/test/chrome/bug608669.xul @@ -0,0 +1,6 @@ + + + + + diff --git a/docshell/test/chrome/bug662200_window.xul b/docshell/test/chrome/bug662200_window.xul new file mode 100644 index 000000000..a73e2d296 --- /dev/null +++ b/docshell/test/chrome/bug662200_window.xul @@ -0,0 +1,129 @@ + + + + + + + + + + diff --git a/docshell/test/chrome/bug690056_window.xul b/docshell/test/chrome/bug690056_window.xul new file mode 100644 index 000000000..ce5700e39 --- /dev/null +++ b/docshell/test/chrome/bug690056_window.xul @@ -0,0 +1,176 @@ + + + + + + + + + diff --git a/docshell/test/chrome/bug846906.html b/docshell/test/chrome/bug846906.html new file mode 100644 index 000000000..a289417ea --- /dev/null +++ b/docshell/test/chrome/bug846906.html @@ -0,0 +1,10 @@ + + + + + + +
+
+ + diff --git a/docshell/test/chrome/bug89419.sjs b/docshell/test/chrome/bug89419.sjs new file mode 100644 index 000000000..c075b1e50 --- /dev/null +++ b/docshell/test/chrome/bug89419.sjs @@ -0,0 +1,13 @@ +function handleRequest(request, response) +{ + var redirectstate = "/docshell/test/chrome/bug89419.sjs"; + response.setStatusLine("1.1", 302, "Found"); + if (getState(redirectstate) == "") { + response.setHeader("Location", "red.png", false); + setState(redirectstate, "red"); + } else { + response.setHeader("Location", "blue.png", false); + setState(redirectstate, ""); + } + response.setHeader("Cache-Control", "no-cache", false); +} diff --git a/docshell/test/chrome/bug89419_window.xul b/docshell/test/chrome/bug89419_window.xul new file mode 100644 index 000000000..923378ea0 --- /dev/null +++ b/docshell/test/chrome/bug89419_window.xul @@ -0,0 +1,82 @@ + + + + + + + + + + + diff --git a/docshell/test/chrome/bug909218.html b/docshell/test/chrome/bug909218.html new file mode 100644 index 000000000..a11fa6000 --- /dev/null +++ b/docshell/test/chrome/bug909218.html @@ -0,0 +1,11 @@ + + + + + + + + + + + + diff --git a/docshell/test/chrome/gen_template.pl b/docshell/test/chrome/gen_template.pl new file mode 100644 index 000000000..5fe9e9ea4 --- /dev/null +++ b/docshell/test/chrome/gen_template.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +# This script makes docshell test case templates. It takes one argument: +# +# -b: a bugnumber +# +# For example, this command: +# +# perl gen_template.pl -b 303267 +# +# Writes test case template files test_bug303267.xul and bug303267_window.xul +# to the current directory. + +use FindBin; +use Getopt::Long; +GetOptions("b=i"=> \$bug_number); + +$template = "$FindBin::RealBin/test.template.txt"; + +open(IN,$template) or die("Failed to open input file for reading."); +open(OUT, ">>test_bug" . $bug_number . ".xul") or die("Failed to open output file for appending."); +while((defined(IN)) && ($line = )) { + $line =~ s/{BUGNUMBER}/$bug_number/g; + print OUT $line; +} +close(IN); +close(OUT); + +$template = "$FindBin::RealBin/window.template.txt"; + +open(IN,$template) or die("Failed to open input file for reading."); +open(OUT, ">>bug" . $bug_number . "_window.xul") or die("Failed to open output file for appending."); +while((defined(IN)) && ($line = )) { + $line =~ s/{BUGNUMBER}/$bug_number/g; + print OUT $line; +} +close(IN); +close(OUT); + diff --git a/docshell/test/chrome/generic.html b/docshell/test/chrome/generic.html new file mode 100644 index 000000000..569a78c05 --- /dev/null +++ b/docshell/test/chrome/generic.html @@ -0,0 +1,12 @@ + + + + generic page + + + +
+ A generic page which can be used any time a test needs to load an arbitrary page via http. +
+ + diff --git a/docshell/test/chrome/mozFrameType_window.xul b/docshell/test/chrome/mozFrameType_window.xul new file mode 100644 index 000000000..aa811c333 --- /dev/null +++ b/docshell/test/chrome/mozFrameType_window.xul @@ -0,0 +1,57 @@ + + + + + + + + + + diff --git a/docshell/test/chrome/red.png b/docshell/test/chrome/red.png new file mode 100644 index 000000000..aa9ce2526 Binary files /dev/null and b/docshell/test/chrome/red.png differ diff --git a/docshell/test/chrome/test.template.txt b/docshell/test/chrome/test.template.txt new file mode 100644 index 000000000..b7dd5e5c2 --- /dev/null +++ b/docshell/test/chrome/test.template.txt @@ -0,0 +1,41 @@ + + + + + + + Test for Bug {BUGNUMBER} + + + + + Mozilla Bug {BUGNUMBER} +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_allowContentRetargeting.html b/docshell/test/chrome/test_allowContentRetargeting.html new file mode 100644 index 000000000..58e838ca0 --- /dev/null +++ b/docshell/test/chrome/test_allowContentRetargeting.html @@ -0,0 +1,94 @@ + + + + + + + + + +

+

+ + diff --git a/docshell/test/chrome/test_bug112564.xul b/docshell/test/chrome/test_bug112564.xul new file mode 100644 index 000000000..0706595d0 --- /dev/null +++ b/docshell/test/chrome/test_bug112564.xul @@ -0,0 +1,38 @@ + + + + + + + + + +Mozilla Bug 112564 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug113934.xul b/docshell/test/chrome/test_bug113934.xul new file mode 100644 index 000000000..ba297e035 --- /dev/null +++ b/docshell/test/chrome/test_bug113934.xul @@ -0,0 +1,31 @@ + + + + + + + + + + + Mozilla Bug 396519 + + + + + diff --git a/docshell/test/chrome/test_bug215405.xul b/docshell/test/chrome/test_bug215405.xul new file mode 100644 index 000000000..e934d76ca --- /dev/null +++ b/docshell/test/chrome/test_bug215405.xul @@ -0,0 +1,38 @@ + + + + + + + + + +Mozilla Bug 215405 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug293235.xul b/docshell/test/chrome/test_bug293235.xul new file mode 100644 index 000000000..8a42c0a6e --- /dev/null +++ b/docshell/test/chrome/test_bug293235.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 293235 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug294258.xul b/docshell/test/chrome/test_bug294258.xul new file mode 100644 index 000000000..4658a82de --- /dev/null +++ b/docshell/test/chrome/test_bug294258.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 294258 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug298622.xul b/docshell/test/chrome/test_bug298622.xul new file mode 100644 index 000000000..c3217c7e5 --- /dev/null +++ b/docshell/test/chrome/test_bug298622.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 298622 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug301397.xul b/docshell/test/chrome/test_bug301397.xul new file mode 100644 index 000000000..37fe47993 --- /dev/null +++ b/docshell/test/chrome/test_bug301397.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 301397 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug303267.xul b/docshell/test/chrome/test_bug303267.xul new file mode 100644 index 000000000..f68dbdcd2 --- /dev/null +++ b/docshell/test/chrome/test_bug303267.xul @@ -0,0 +1,40 @@ + + + + + + + + + +Mozilla Bug 303267 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug311007.xul b/docshell/test/chrome/test_bug311007.xul new file mode 100644 index 000000000..32f1085f0 --- /dev/null +++ b/docshell/test/chrome/test_bug311007.xul @@ -0,0 +1,45 @@ + + + + + + + + + + + + Mozilla Bug 311007 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug321671.xul b/docshell/test/chrome/test_bug321671.xul new file mode 100644 index 000000000..46164018b --- /dev/null +++ b/docshell/test/chrome/test_bug321671.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 321671 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug360511.xul b/docshell/test/chrome/test_bug360511.xul new file mode 100644 index 000000000..ffa47fa27 --- /dev/null +++ b/docshell/test/chrome/test_bug360511.xul @@ -0,0 +1,40 @@ + + + + + + + + + + + Mozilla Bug 360511 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug364461.xul b/docshell/test/chrome/test_bug364461.xul new file mode 100644 index 000000000..85154f9d7 --- /dev/null +++ b/docshell/test/chrome/test_bug364461.xul @@ -0,0 +1,38 @@ + + + + + + + + + +Mozilla Bug 364461 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug396519.xul b/docshell/test/chrome/test_bug396519.xul new file mode 100644 index 000000000..be1d148b7 --- /dev/null +++ b/docshell/test/chrome/test_bug396519.xul @@ -0,0 +1,29 @@ + + + + + + + + + + Mozilla Bug 396519 + + + + + diff --git a/docshell/test/chrome/test_bug396649.xul b/docshell/test/chrome/test_bug396649.xul new file mode 100644 index 000000000..3554c2f98 --- /dev/null +++ b/docshell/test/chrome/test_bug396649.xul @@ -0,0 +1,41 @@ + + + + + + + + + + + Mozilla Bug 396649 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug428288.html b/docshell/test/chrome/test_bug428288.html new file mode 100644 index 000000000..83fcd20c6 --- /dev/null +++ b/docshell/test/chrome/test_bug428288.html @@ -0,0 +1,37 @@ + + + + + Test for Bug 428288 + + + + +Mozilla Bug 428288 +

+ +
+
+
+ + + diff --git a/docshell/test/chrome/test_bug449778.xul b/docshell/test/chrome/test_bug449778.xul new file mode 100644 index 000000000..48c76c2e2 --- /dev/null +++ b/docshell/test/chrome/test_bug449778.xul @@ -0,0 +1,31 @@ + + + + + + + + + + + Mozilla Bug 396519 + + + + + diff --git a/docshell/test/chrome/test_bug449780.xul b/docshell/test/chrome/test_bug449780.xul new file mode 100644 index 000000000..fc5231d6b --- /dev/null +++ b/docshell/test/chrome/test_bug449780.xul @@ -0,0 +1,31 @@ + + + + + + + + + + + Mozilla Bug 396519 + + + + + diff --git a/docshell/test/chrome/test_bug453650.xul b/docshell/test/chrome/test_bug453650.xul new file mode 100644 index 000000000..2837e56d8 --- /dev/null +++ b/docshell/test/chrome/test_bug453650.xul @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + Mozilla Bug 453650 + + diff --git a/docshell/test/chrome/test_bug454235.xul b/docshell/test/chrome/test_bug454235.xul new file mode 100644 index 000000000..f9107a186 --- /dev/null +++ b/docshell/test/chrome/test_bug454235.xul @@ -0,0 +1,56 @@ + + + + + + + + + + Mozilla Bug 454235 + + + + + + + + + diff --git a/docshell/test/chrome/test_bug456980.xul b/docshell/test/chrome/test_bug456980.xul new file mode 100644 index 000000000..9f4f97209 --- /dev/null +++ b/docshell/test/chrome/test_bug456980.xul @@ -0,0 +1,31 @@ + + + + + + + + + + + Mozilla Bug 396519 + + + + + diff --git a/docshell/test/chrome/test_bug565388.xul b/docshell/test/chrome/test_bug565388.xul new file mode 100644 index 000000000..47b5c07e4 --- /dev/null +++ b/docshell/test/chrome/test_bug565388.xul @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + Mozilla Bug 565388 + + diff --git a/docshell/test/chrome/test_bug582176.xul b/docshell/test/chrome/test_bug582176.xul new file mode 100644 index 000000000..98053b009 --- /dev/null +++ b/docshell/test/chrome/test_bug582176.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 582176 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug608669.xul b/docshell/test/chrome/test_bug608669.xul new file mode 100644 index 000000000..51d6a3b7d --- /dev/null +++ b/docshell/test/chrome/test_bug608669.xul @@ -0,0 +1,117 @@ + + + + + + + + + + Mozilla Bug 608669 + + + + + + Below will an iframe be added + + diff --git a/docshell/test/chrome/test_bug662200.xul b/docshell/test/chrome/test_bug662200.xul new file mode 100644 index 000000000..8b864c8af --- /dev/null +++ b/docshell/test/chrome/test_bug662200.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 662200 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug690056.xul b/docshell/test/chrome/test_bug690056.xul new file mode 100644 index 000000000..caeed09d3 --- /dev/null +++ b/docshell/test/chrome/test_bug690056.xul @@ -0,0 +1,26 @@ + + + + + + + diff --git a/docshell/test/chrome/test_bug789773.xul b/docshell/test/chrome/test_bug789773.xul new file mode 100644 index 000000000..b7a2b3d1c --- /dev/null +++ b/docshell/test/chrome/test_bug789773.xul @@ -0,0 +1,71 @@ + + + + + + + diff --git a/docshell/test/chrome/test_bug846906.xul b/docshell/test/chrome/test_bug846906.xul new file mode 100644 index 000000000..2003384f0 --- /dev/null +++ b/docshell/test/chrome/test_bug846906.xul @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + Mozilla Bug 846906 + + diff --git a/docshell/test/chrome/test_bug89419.xul b/docshell/test/chrome/test_bug89419.xul new file mode 100644 index 000000000..26194c49b --- /dev/null +++ b/docshell/test/chrome/test_bug89419.xul @@ -0,0 +1,39 @@ + + + + + + + + + + + Mozilla Bug 89419 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_bug909218.html b/docshell/test/chrome/test_bug909218.html new file mode 100644 index 000000000..e635fdb11 --- /dev/null +++ b/docshell/test/chrome/test_bug909218.html @@ -0,0 +1,127 @@ + + + + + + + + + diff --git a/docshell/test/chrome/test_bug92598.xul b/docshell/test/chrome/test_bug92598.xul new file mode 100644 index 000000000..8e81463be --- /dev/null +++ b/docshell/test/chrome/test_bug92598.xul @@ -0,0 +1,38 @@ + + + + + + + + + +Mozilla Bug 92598 +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_mozFrameType.xul b/docshell/test/chrome/test_mozFrameType.xul new file mode 100644 index 000000000..225cd16cc --- /dev/null +++ b/docshell/test/chrome/test_mozFrameType.xul @@ -0,0 +1,43 @@ + + + + + + + + + + +

+ +
+
+ + + + +
diff --git a/docshell/test/chrome/test_principalInherit.xul b/docshell/test/chrome/test_principalInherit.xul new file mode 100644 index 000000000..87056c63d --- /dev/null +++ b/docshell/test/chrome/test_principalInherit.xul @@ -0,0 +1,108 @@ + + + + + + + + + + +

+ +
+
+ + +"); + document.documentElement.appendChild(gFrame); + }, + function testInheritFromCurrent_system(cb) { + loadListener(gFrame, function () { + is(window.inheritedSystem, undefined, "load in type=content iframe shouldn't inherit system principal from current document"); + cb(); + }, true); + gFrame.setAttribute("src", "data:text/html,"); + }, + function testInheritFromCreated(cb) { + // Open a new chrome window with a type="content" iframe, so that it has no + // same-type parent. + // Load a javascript: URI in it to ensure that GetInheritedPrincipal will + // force creation of a content viewer. + let xulWinURL = 'data:application/vnd.mozilla.xul+xml,' + + ''; + let newWin = window.openDialog(xulWinURL, "chrome_window", "chrome"); + loadListener(newWin, function () { + let frame = newWin.document.createElement("iframe"); + frame.setAttribute("type", "content"); + frame.setAttribute("src", "javascript:'1';"); + loadListener(frame, function () { + is(frame.contentWindow.document.body.textContent, "1", "content viewer was created"); + SimpleTest.executeSoon(function () { + newWin.close(); + cb(); + }) + }); + newWin.document.documentElement.appendChild(frame); + }); + } +]; + +addLoadEvent(function onLoad() { + ok(Components.stack, "this test must be run with the system principal"); + SimpleTest.executeSoon(nextTest); +}); + +function loadListener(target, func) { + target.addEventListener("load", function lis() { + target.removeEventListener("load", lis, true); + func(); + }, true); +} + +function nextTest() { + if (tests.length) { + let test = tests.shift(); + SimpleTest.executeSoon(function () { + info("running " + test.name); + test(nextTest); + }); + } else + SimpleTest.executeSoon(SimpleTest.finish); +} + +]]> + + + diff --git a/docshell/test/chrome/test_private_hidden_window.html b/docshell/test/chrome/test_private_hidden_window.html new file mode 100644 index 000000000..3907e5de8 --- /dev/null +++ b/docshell/test/chrome/test_private_hidden_window.html @@ -0,0 +1,56 @@ + + + + + Test for Bug 829383 + + + + +Mozilla Bug 829383 +

+ +
+
+
+ + + diff --git a/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul new file mode 100644 index 000000000..536ca4d03 --- /dev/null +++ b/docshell/test/chrome/test_viewsource_forbidden_in_iframe.xul @@ -0,0 +1,180 @@ + + + + + + + diff --git a/docshell/test/chrome/window.template.txt b/docshell/test/chrome/window.template.txt new file mode 100644 index 000000000..a7fb0fac7 --- /dev/null +++ b/docshell/test/chrome/window.template.txt @@ -0,0 +1,44 @@ + + + + + + + + + + + diff --git a/docshell/test/file_anchor_scroll_after_document_open.html b/docshell/test/file_anchor_scroll_after_document_open.html new file mode 100644 index 000000000..7903380ea --- /dev/null +++ b/docshell/test/file_anchor_scroll_after_document_open.html @@ -0,0 +1,15 @@ + + diff --git a/docshell/test/file_bug385434_1.html b/docshell/test/file_bug385434_1.html new file mode 100644 index 000000000..5c951f1fa --- /dev/null +++ b/docshell/test/file_bug385434_1.html @@ -0,0 +1,29 @@ + + + + + + + +link1 + +
+link2 + + diff --git a/docshell/test/file_bug385434_2.html b/docshell/test/file_bug385434_2.html new file mode 100644 index 000000000..4aa5ef82b --- /dev/null +++ b/docshell/test/file_bug385434_2.html @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/docshell/test/file_bug385434_3.html b/docshell/test/file_bug385434_3.html new file mode 100644 index 000000000..984b85f1f --- /dev/null +++ b/docshell/test/file_bug385434_3.html @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/docshell/test/file_bug475636.sjs b/docshell/test/file_bug475636.sjs new file mode 100644 index 000000000..38da6a6a5 --- /dev/null +++ b/docshell/test/file_bug475636.sjs @@ -0,0 +1,90 @@ +jsURL = "javascript:" + escape('window.parent.postMessage("JS uri ran", "*");\ +return \'\ +\''); +dataURL = "data:text/html," + escape('\ +'); + +tests = [ +// Plain document should work as normal +'\ +', + +// refresh to plain doc +{ refresh: "file_bug475636.sjs?1", + doc: '' }, + +// meta-refresh to plain doc +'\ +\ + \ +', + +// refresh to data url +{ refresh: dataURL, + doc: '' }, + +// meta-refresh to data url +'\ +\ + \ +', + +// refresh to js url should not be followed +{ refresh: jsURL, + doc: +'\ +' }, + +// meta refresh to js url should not be followed +'\ +\ + \ +\ +' +]; + + +function handleRequest(request, response) +{ + dump("@@@@@@@@@hi there: " + request.queryString + "\n"); + test = tests[parseInt(request.queryString, 10) - 1]; + response.setHeader("Content-Type", "text/html"); + + if (!test) { + response.write(''); + } + else if (typeof test == "string") { + response.write(test); + } + else if (test.refresh) { + response.setHeader("Refresh", "0; url=" + test.refresh); + response.write(test.doc); + } +} diff --git a/docshell/test/file_bug509055.html b/docshell/test/file_bug509055.html new file mode 100644 index 000000000..ac30876bb --- /dev/null +++ b/docshell/test/file_bug509055.html @@ -0,0 +1,9 @@ + + + + Test inner frame for bug 509055 + + + file_bug509055.html + + diff --git a/docshell/test/file_bug511449.html b/docshell/test/file_bug511449.html new file mode 100644 index 000000000..637732dbb --- /dev/null +++ b/docshell/test/file_bug511449.html @@ -0,0 +1,6 @@ + +Used in test for bug 511449 + + diff --git a/docshell/test/file_bug540462.html b/docshell/test/file_bug540462.html new file mode 100644 index 000000000..52d1580c7 --- /dev/null +++ b/docshell/test/file_bug540462.html @@ -0,0 +1,16 @@ + + + + + + Test for bug 540462 + + diff --git a/docshell/test/file_bug580069_1.html b/docshell/test/file_bug580069_1.html new file mode 100644 index 000000000..7ab461033 --- /dev/null +++ b/docshell/test/file_bug580069_1.html @@ -0,0 +1,8 @@ + + +file_bug580069_1.html + +
+ + + diff --git a/docshell/test/file_bug580069_2.sjs b/docshell/test/file_bug580069_2.sjs new file mode 100644 index 000000000..0c76c1f16 --- /dev/null +++ b/docshell/test/file_bug580069_2.sjs @@ -0,0 +1,5 @@ +function handleRequest(request, response) +{ + response.setHeader("Content-Type", "text/html", false); + response.write('file_bug580069_2.sjs'); +} diff --git a/docshell/test/file_bug590573_1.html b/docshell/test/file_bug590573_1.html new file mode 100644 index 000000000..850d418bd --- /dev/null +++ b/docshell/test/file_bug590573_1.html @@ -0,0 +1,8 @@ + + + +
This is a very tall div.
+ + + diff --git a/docshell/test/file_bug590573_2.html b/docshell/test/file_bug590573_2.html new file mode 100644 index 000000000..5f9ca22be --- /dev/null +++ b/docshell/test/file_bug590573_2.html @@ -0,0 +1,8 @@ + + + +
The second page also has a big div.
+ + + diff --git a/docshell/test/file_bug634834.html b/docshell/test/file_bug634834.html new file mode 100644 index 000000000..3ff089745 --- /dev/null +++ b/docshell/test/file_bug634834.html @@ -0,0 +1,5 @@ + + +Nothing to see here; just an empty page. + + diff --git a/docshell/test/file_bug640387.html b/docshell/test/file_bug640387.html new file mode 100644 index 000000000..3a939fb41 --- /dev/null +++ b/docshell/test/file_bug640387.html @@ -0,0 +1,26 @@ + + + + + +Not much to see here... + + diff --git a/docshell/test/file_bug653741.html b/docshell/test/file_bug653741.html new file mode 100644 index 000000000..3202b5257 --- /dev/null +++ b/docshell/test/file_bug653741.html @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/docshell/test/file_bug660404 b/docshell/test/file_bug660404 new file mode 100644 index 000000000..0737a5c4d --- /dev/null +++ b/docshell/test/file_bug660404 @@ -0,0 +1,5 @@ +--testingtesting +Content-Type: text/html + + +--testingtesting-- diff --git a/docshell/test/file_bug660404^headers^ b/docshell/test/file_bug660404^headers^ new file mode 100644 index 000000000..5c821f3f4 --- /dev/null +++ b/docshell/test/file_bug660404^headers^ @@ -0,0 +1 @@ +Content-Type: multipart/x-mixed-replace; boundary="testingtesting" diff --git a/docshell/test/file_bug662170.html b/docshell/test/file_bug662170.html new file mode 100644 index 000000000..3202b5257 --- /dev/null +++ b/docshell/test/file_bug662170.html @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/docshell/test/file_bug668513.html b/docshell/test/file_bug668513.html new file mode 100644 index 000000000..1e43a51e0 --- /dev/null +++ b/docshell/test/file_bug668513.html @@ -0,0 +1,107 @@ + + + + Test file for Bug 668513 + + + +
+ +
+ + diff --git a/docshell/test/file_bug669671.sjs b/docshell/test/file_bug669671.sjs new file mode 100644 index 000000000..b6fd1ec7c --- /dev/null +++ b/docshell/test/file_bug669671.sjs @@ -0,0 +1,14 @@ +function handleRequest(request, response) +{ + var count = parseInt(getState('count')); + if (!count || request.queryString == 'countreset') + count = 0; + + setState('count', count + 1 + ''); + + response.setHeader('Content-Type', 'text/html', false); + response.setHeader('Cache-Control', 'max-age=0'); + response.write('' + + count + ''); +} diff --git a/docshell/test/file_bug680257.html b/docshell/test/file_bug680257.html new file mode 100644 index 000000000..ff480e96a --- /dev/null +++ b/docshell/test/file_bug680257.html @@ -0,0 +1,16 @@ + + + + + + + + +link +link2 + + + diff --git a/docshell/test/file_bug703855.html b/docshell/test/file_bug703855.html new file mode 100644 index 000000000..fe15b6e3d --- /dev/null +++ b/docshell/test/file_bug703855.html @@ -0,0 +1,2 @@ + + diff --git a/docshell/test/file_bug728939.html b/docshell/test/file_bug728939.html new file mode 100644 index 000000000..1cd52a44e --- /dev/null +++ b/docshell/test/file_bug728939.html @@ -0,0 +1,3 @@ + +file_bug728939 + diff --git a/docshell/test/file_framedhistoryframes.html b/docshell/test/file_framedhistoryframes.html new file mode 100644 index 000000000..314f9c72d --- /dev/null +++ b/docshell/test/file_framedhistoryframes.html @@ -0,0 +1,16 @@ + + + + + + + diff --git a/docshell/test/file_pushState_after_document_open.html b/docshell/test/file_pushState_after_document_open.html new file mode 100644 index 000000000..97a6954f2 --- /dev/null +++ b/docshell/test/file_pushState_after_document_open.html @@ -0,0 +1,11 @@ + + diff --git a/docshell/test/historyframes.html b/docshell/test/historyframes.html new file mode 100644 index 000000000..30fca2c0a --- /dev/null +++ b/docshell/test/historyframes.html @@ -0,0 +1,150 @@ + + + + + Test for Bug 602256 + + +Mozilla Bug 602256 +
+ +
+
+
+
+ + diff --git a/docshell/test/iframesandbox/file_marquee_event_handlers.html b/docshell/test/iframesandbox/file_marquee_event_handlers.html new file mode 100644 index 000000000..13ee31ddb --- /dev/null +++ b/docshell/test/iframesandbox/file_marquee_event_handlers.html @@ -0,0 +1,17 @@ + + + + +Test marquee attribute event handlers in iframe sandbox + + + + + Will bounce and finish + + + diff --git a/docshell/test/iframesandbox/file_other_auxiliary_navigation_by_location.html b/docshell/test/iframesandbox/file_other_auxiliary_navigation_by_location.html new file mode 100644 index 000000000..ad24c0f24 --- /dev/null +++ b/docshell/test/iframesandbox/file_other_auxiliary_navigation_by_location.html @@ -0,0 +1,15 @@ + + + + +Test window for other auxiliary navigation by location tests + + + diff --git a/docshell/test/iframesandbox/file_our_auxiliary_navigation_by_location.html b/docshell/test/iframesandbox/file_our_auxiliary_navigation_by_location.html new file mode 100644 index 000000000..978980df2 --- /dev/null +++ b/docshell/test/iframesandbox/file_our_auxiliary_navigation_by_location.html @@ -0,0 +1,15 @@ + + + + +Test window for our auxiliary navigation by location tests + + + diff --git a/docshell/test/iframesandbox/file_parent_navigation_by_location.html b/docshell/test/iframesandbox/file_parent_navigation_by_location.html new file mode 100644 index 000000000..9a2e95fad --- /dev/null +++ b/docshell/test/iframesandbox/file_parent_navigation_by_location.html @@ -0,0 +1,18 @@ + + + + +Test window for parent navigation by location tests + + + + + + diff --git a/docshell/test/iframesandbox/file_sibling_navigation_by_location.html b/docshell/test/iframesandbox/file_sibling_navigation_by_location.html new file mode 100644 index 000000000..51a52bb8e --- /dev/null +++ b/docshell/test/iframesandbox/file_sibling_navigation_by_location.html @@ -0,0 +1,15 @@ + + + + +Test window for sibling navigation by location tests + + + diff --git a/docshell/test/iframesandbox/file_top_navigation_by_location.html b/docshell/test/iframesandbox/file_top_navigation_by_location.html new file mode 100644 index 000000000..194430f38 --- /dev/null +++ b/docshell/test/iframesandbox/file_top_navigation_by_location.html @@ -0,0 +1,20 @@ + + + + +Test window for top navigation by location tests + + + + + + + + diff --git a/docshell/test/iframesandbox/file_top_navigation_by_location_exotic.html b/docshell/test/iframesandbox/file_top_navigation_by_location_exotic.html new file mode 100644 index 000000000..1c7c6ce29 --- /dev/null +++ b/docshell/test/iframesandbox/file_top_navigation_by_location_exotic.html @@ -0,0 +1,26 @@ + + + + +Test window for top navigation by location tests + + + + + + + diff --git a/docshell/test/iframesandbox/mochitest.ini b/docshell/test/iframesandbox/mochitest.ini new file mode 100644 index 000000000..5f6b570e9 --- /dev/null +++ b/docshell/test/iframesandbox/mochitest.ini @@ -0,0 +1,24 @@ +[DEFAULT] +support-files = + file_marquee_event_handlers.html + file_other_auxiliary_navigation_by_location.html + file_our_auxiliary_navigation_by_location.html + file_parent_navigation_by_location.html + file_sibling_navigation_by_location.html + file_top_navigation_by_location.html + file_top_navigation_by_location_exotic.html + +[test_child_navigation_by_location.html] +[test_marquee_event_handlers.html] +[test_other_auxiliary_navigation_by_location.html] +tags = openwindow +[test_our_auxiliary_navigation_by_location.html] +tags = openwindow +[test_parent_navigation_by_location.html] +tags = openwindow +[test_sibling_navigation_by_location.html] +tags = openwindow +[test_top_navigation_by_location_exotic.html] +skip-if = android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt +[test_top_navigation_by_location.html] +skip-if = android_version == '18' #bug 948948, NS_ERROR_FAILURE from nsWindowWatcher::GetPrompt diff --git a/docshell/test/iframesandbox/test_child_navigation_by_location.html b/docshell/test/iframesandbox/test_child_navigation_by_location.html new file mode 100644 index 000000000..06605e3cd --- /dev/null +++ b/docshell/test/iframesandbox/test_child_navigation_by_location.html @@ -0,0 +1,92 @@ + + + + + +Test for Bug 785310 - iframe sandbox child navigation by location tests + + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + + + + + + + diff --git a/docshell/test/iframesandbox/test_other_auxiliary_navigation_by_location.html b/docshell/test/iframesandbox/test_other_auxiliary_navigation_by_location.html new file mode 100644 index 000000000..05c86f0cc --- /dev/null +++ b/docshell/test/iframesandbox/test_other_auxiliary_navigation_by_location.html @@ -0,0 +1,80 @@ + + + + + +Test for Bug 785310 - iframe sandbox other auxiliary navigation by location tests + + + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + + + diff --git a/docshell/test/iframesandbox/test_our_auxiliary_navigation_by_location.html b/docshell/test/iframesandbox/test_our_auxiliary_navigation_by_location.html new file mode 100644 index 000000000..01b371545 --- /dev/null +++ b/docshell/test/iframesandbox/test_our_auxiliary_navigation_by_location.html @@ -0,0 +1,84 @@ + + + + + +Test for Bug 785310 - iframe sandbox our auxiliary navigation by location tests + + + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + + + diff --git a/docshell/test/iframesandbox/test_parent_navigation_by_location.html b/docshell/test/iframesandbox/test_parent_navigation_by_location.html new file mode 100644 index 000000000..06335cdec --- /dev/null +++ b/docshell/test/iframesandbox/test_parent_navigation_by_location.html @@ -0,0 +1,75 @@ + + + + + +Test for Bug 785310 - iframe sandbox parent navigation by location tests + + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + + + + diff --git a/docshell/test/iframesandbox/test_sibling_navigation_by_location.html b/docshell/test/iframesandbox/test_sibling_navigation_by_location.html new file mode 100644 index 000000000..a93c1ae0d --- /dev/null +++ b/docshell/test/iframesandbox/test_sibling_navigation_by_location.html @@ -0,0 +1,78 @@ + + + + + +Test for Bug 785310 - iframe sandbox sibling navigation by location tests + + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + + + + + diff --git a/docshell/test/iframesandbox/test_top_navigation_by_location.html b/docshell/test/iframesandbox/test_top_navigation_by_location.html new file mode 100644 index 000000000..3191539a2 --- /dev/null +++ b/docshell/test/iframesandbox/test_top_navigation_by_location.html @@ -0,0 +1,167 @@ + + + + + +Test for Bug 785310 - iframe sandbox top navigation by location tests + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + diff --git a/docshell/test/iframesandbox/test_top_navigation_by_location_exotic.html b/docshell/test/iframesandbox/test_top_navigation_by_location_exotic.html new file mode 100644 index 000000000..fcc1f8659 --- /dev/null +++ b/docshell/test/iframesandbox/test_top_navigation_by_location_exotic.html @@ -0,0 +1,204 @@ + + + + + +Test for Bug 785310 - iframe sandbox top navigation by location via exotic means tests + + + + + +Mozilla Bug 785310 +

+
+Tests for Bug 785310 +
+ + diff --git a/docshell/test/mochitest.ini b/docshell/test/mochitest.ini new file mode 100644 index 000000000..725486b77 --- /dev/null +++ b/docshell/test/mochitest.ini @@ -0,0 +1,94 @@ +[DEFAULT] +support-files = + bug123696-subframe.html + bug369814.jar + bug369814.zip + bug404548-subframe.html + bug413310-post.sjs + bug413310-subframe.html + bug529119-window.html + bug570341_recordevents.html + bug668513_redirect.html + bug668513_redirect.html^headers^ + bug691547_frame.html + file_anchor_scroll_after_document_open.html + file_bug385434_1.html + file_bug385434_2.html + file_bug385434_3.html + file_bug475636.sjs + file_bug509055.html + file_bug540462.html + file_bug580069_1.html + file_bug580069_2.sjs + file_bug590573_1.html + file_bug590573_2.html + file_bug634834.html + file_bug640387.html + file_bug653741.html + file_bug660404 + file_bug660404^headers^ + file_bug662170.html + file_bug669671.sjs + file_bug680257.html + file_bug703855.html + file_bug728939.html + file_pushState_after_document_open.html + historyframes.html + +[test_anchor_scroll_after_document_open.html] +[test_bfcache_plus_hash.html] +[test_bug123696.html] +[test_bug369814.html] +[test_bug384014.html] +[test_bug385434.html] +[test_bug387979.html] +[test_bug402210.html] +[test_bug404548.html] +[test_bug413310.html] +skip-if = true +# Disabled for too many intermittent failures (bug 719186) +[test_bug475636.html] +[test_bug509055.html] +[test_bug511449.html] +skip-if = toolkit != "cocoa" +support-files = file_bug511449.html +[test_bug529119-1.html] +[test_bug529119-2.html] +[test_bug530396.html] +support-files = bug530396-noref.sjs bug530396-subframe.html +[test_bug540462.html] +[test_bug551225.html] +[test_bug570341.html] +[test_bug580069.html] +[test_bug590573.html] +[test_bug598895.html] +skip-if = toolkit == 'android' +[test_bug634834.html] +[test_bug637644.html] +skip-if = toolkit == 'android' +[test_bug640387_1.html] +[test_bug640387_2.html] +[test_bug653741.html] +[test_bug660404.html] +[test_bug662170.html] +[test_bug668513.html] +skip-if = toolkit == 'android' +support-files = file_bug668513.html +[test_bug669671.html] +[test_bug675587.html] +[test_bug680257.html] +[test_bug691547.html] +[test_bug694612.html] +[test_bug703855.html] +[test_bug713825.html] +[test_bug728939.html] +[test_bug797909.html] +[test_bug1045096.html] +[test_bug1121701.html] +[test_bug1186774.html] +[test_forceinheritprincipal_overrule_owner.html] +[test_framedhistoryframes.html] +skip-if = toolkit == 'android' # bug 784321 +support-files = file_framedhistoryframes.html +[test_pushState_after_document_open.html] +[test_windowedhistoryframes.html] diff --git a/docshell/test/navigation/NavigationUtils.js b/docshell/test/navigation/NavigationUtils.js new file mode 100644 index 000000000..c90ea74d5 --- /dev/null +++ b/docshell/test/navigation/NavigationUtils.js @@ -0,0 +1,213 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/////////////////////////////////////////////////////////////////////////// +// +// Utilities for navigation tests +// +/////////////////////////////////////////////////////////////////////////// + +var body = "This frame was navigated."; +var target_url = "data:text/html," + body + ""; + +var popup_body = "This is a popup"; +var target_popup_url = "data:text/html," + popup_body + ""; + +/////////////////////////////////////////////////////////////////////////// +// Functions that navigate frames +/////////////////////////////////////////////////////////////////////////// + +function navigateByLocation(wnd) { + try { + wnd.location = target_url; + } catch(ex) { + // We need to keep our finished frames count consistent. + // Oddly, this ends up simulating the behavior of IE7. + window.open(target_url, "_blank", "width=10,height=10"); + } +} + +function navigateByOpen(name) { + window.open(target_url, name, "width=10,height=10"); +} + +function navigateByForm(name) { + var form = document.createElement("form"); + form.action = target_url; + form.method = "POST"; + form.target = name; document.body.appendChild(form); + form.submit(); +} + +var hyperlink_count = 0; + +function navigateByHyperlink(name) { + var link = document.createElement("a"); + link.href = target_url; + link.target = name; + link.id = "navigation_hyperlink_" + hyperlink_count++; + document.body.appendChild(link); + sendMouseEvent({type:"click"}, link.id); +} + +/////////////////////////////////////////////////////////////////////////// +// Functions that call into Mochitest framework +/////////////////////////////////////////////////////////////////////////// + +function isNavigated(wnd, message) { + var result = null; + try { + result = SpecialPowers.wrap(wnd).document.body.innerHTML; + } catch(ex) { + result = ex; + } + is(result, body, message); +} + +function isBlank(wnd, message) { + var result = null; + try { + result = wnd.document.body.innerHTML; + } catch(ex) { + result = ex; + } + is(result, "This is a blank document.", message); +} + +function isAccessible(wnd, message) { + try { + wnd.document.body.innerHTML; + ok(true, message); + } catch(ex) { + ok(false, message); + } +} + +function isInaccessible(wnd, message) { + try { + wnd.document.body.innerHTML; + ok(false, message); + } catch(ex) { + ok(true, message); + } +} + +/////////////////////////////////////////////////////////////////////////// +// Functions that require UniversalXPConnect privilege +/////////////////////////////////////////////////////////////////////////// + +function xpcEnumerateContentWindows(callback) { + + var Ci = SpecialPowers.Ci; + var ww = SpecialPowers.Cc["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Ci.nsIWindowWatcher); + var enumerator = ww.getWindowEnumerator(); + + var contentWindows = []; + + while (enumerator.hasMoreElements()) { + var win = enumerator.getNext(); + if (/ChromeWindow/.exec(win)) { + var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem); + var childCount = docshellTreeNode.childCount; + for (var i = 0; i < childCount; ++i) { + var childTreeNode = docshellTreeNode.getChildAt(i); + + // we're only interested in content docshells + if (SpecialPowers.unwrap(childTreeNode.itemType) != Ci.nsIDocShellTreeItem.typeContent) + continue; + + var webNav = childTreeNode.QueryInterface(Ci.nsIWebNavigation); + contentWindows.push(webNav.document.defaultView); + } + } else { + contentWindows.push(win); + } + } + + while (contentWindows.length > 0) + callback(contentWindows.pop()); +} + +// Note: This only searches for top-level frames with this name. +function xpcGetFramesByName(name) { + var results = []; + + xpcEnumerateContentWindows(function(win) { + if (win.name == name) + results.push(win); + }); + + return results; +} + +function xpcCleanupWindows() { + xpcEnumerateContentWindows(function(win) { + if (win.location && win.location.protocol == "data:") + win.close(); + }); +} + +function xpcWaitForFinishedFrames(callback, numFrames) { + var finishedFrameCount = 0; + function frameFinished() { + finishedFrameCount++; + + if (finishedFrameCount == numFrames) { + clearInterval(frameWaitInterval); + setTimeout(callback, 0); + return; + } + + if (finishedFrameCount > numFrames) + throw "Too many frames loaded."; + } + + var finishedWindows = []; + + function contains(obj, arr) { + for (var i = 0; i < arr.length; i++) { + if (obj === arr[i]) + return true; + } + return false; + } + + function searchForFinishedFrames(win) { + if ((escape(unescape(win.location)) == escape(target_url) || + escape(unescape(win.location)) == escape(target_popup_url)) && + win.document && + win.document.body && + (win.document.body.textContent == body || + win.document.body.textContent == popup_body) && + win.document.readyState == "complete") { + + var util = win.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) + .getInterface(SpecialPowers.Ci.nsIDOMWindowUtils); + var windowId = util.outerWindowID; + if (!contains(windowId, finishedWindows)) { + finishedWindows.push(windowId); + frameFinished(); + } + } + for (var i = 0; i < win.frames.length; i++) + searchForFinishedFrames(win.frames[i]); + } + + function poll() { + try { + // This only gives us UniversalXPConnect for the current stack frame + // We're using setInterval, so the main page's privileges are still normal + xpcEnumerateContentWindows(searchForFinishedFrames); + } catch(ex) { + // We might be accessing windows before they are fully constructed, + // which can throw. We'll find those frames on our next poll(). + } + } + + var frameWaitInterval = setInterval(poll, 500); +} + diff --git a/docshell/test/navigation/blank.html b/docshell/test/navigation/blank.html new file mode 100644 index 000000000..5360333f1 --- /dev/null +++ b/docshell/test/navigation/blank.html @@ -0,0 +1 @@ +This is a blank document. \ No newline at end of file diff --git a/docshell/test/navigation/browser.ini b/docshell/test/navigation/browser.ini new file mode 100644 index 000000000..f25853f89 --- /dev/null +++ b/docshell/test/navigation/browser.ini @@ -0,0 +1,12 @@ +[DEFAULT] +support-files = + bug343515_pg1.html + bug343515_pg2.html + bug343515_pg3.html + bug343515_pg3_1.html + bug343515_pg3_1_1.html + bug343515_pg3_2.html + +[browser_bug343515.js] +[browser_test-content-chromeflags.js] +tags = openwindow \ No newline at end of file diff --git a/docshell/test/navigation/browser_bug343515.js b/docshell/test/navigation/browser_bug343515.js new file mode 100644 index 000000000..74152b493 --- /dev/null +++ b/docshell/test/navigation/browser_bug343515.js @@ -0,0 +1,262 @@ +// Test for bug 343515 - Need API for tabbrowsers to tell docshells they're visible/hidden + +// Globals +var testPath = "http://mochi.test:8888/browser/docshell/test/navigation/"; +var ctx = {}; + +// We need to wait until the page from each testcase is fully loaded, +// including all of its descendant iframes. To do that we manually count +// how many load events should happen on that page (one for the toplevel doc +// and one for each subframe) and wait until we receive the expected number +// of events. +function nShotsListener(aElem, aType, aCallback, aCount) { + let count = aCount; + aElem.addEventListener(aType, function listenerCallback() { + if (--count == 0) { + aElem.removeEventListener(aType, listenerCallback, true); + + // aCallback is executed asynchronously, which is handy because load + // events fire before mIsDocumentLoaded is actually set to true. :( + executeSoon(aCallback); + } + }, true); +} + +function oneShotListener(aElem, aType, aCallback) { + nShotsListener(aElem, aType, aCallback, 1); +} + +function waitForPageshow(aBrowser, callback) { + return ContentTask.spawn(aBrowser, null, function* () { + yield ContentTaskUtils.waitForEvent(this, "pageshow"); + }).then(callback); +} + +// Entry point from Mochikit +function test() { + + // Lots of callbacks going on here + waitForExplicitFinish(); + + // Begin the test + step1(); +} + +function step1() { + + // Get a handle on the initial tab + ctx.tab0 = gBrowser.selectedTab; + ctx.tab0Browser = gBrowser.getBrowserForTab(ctx.tab0); + + // Our current tab should be active + ok(ctx.tab0Browser.docShellIsActive, "Tab 0 should be active at test start"); + + // Open a New Tab + ctx.tab1 = gBrowser.addTab(testPath + "bug343515_pg1.html"); + ctx.tab1Browser = gBrowser.getBrowserForTab(ctx.tab1); + oneShotListener(ctx.tab1Browser, "load", step2); +} + +function step2() { + is(testPath + "bug343515_pg1.html", ctx.tab1Browser.currentURI.spec, + "Got expected tab 1 url in step 2"); + + // Our current tab should still be active + ok(ctx.tab0Browser.docShellIsActive, "Tab 0 should still be active"); + ok(!ctx.tab1Browser.docShellIsActive, "Tab 1 should not be active"); + + // Switch to tab 1 + BrowserTestUtils.switchTab(gBrowser, ctx.tab1).then(() => { + // Tab 1 should now be active + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active"); + + // Open another tab + ctx.tab2 = gBrowser.addTab(testPath + "bug343515_pg2.html"); + ctx.tab2Browser = gBrowser.getBrowserForTab(ctx.tab2); + + // bug343515_pg2.html consists of a page with two iframes, + // which will therefore generate 3 load events. + nShotsListener(ctx.tab2Browser, "load", step3, 3); + }); +} + +function step3() { + is(testPath + "bug343515_pg2.html", ctx.tab2Browser.currentURI.spec, + "Got expected tab 2 url in step 3"); + + // Tab 0 should be inactive, Tab 1 should be active + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active"); + + // Tab 2's window _and_ its iframes should be inactive + ok(!ctx.tab2Browser.docShellIsActive, "Tab 2 should be inactive"); + ContentTask.spawn(ctx.tab2Browser, null, function* () { + Assert.equal(content.frames.length, 2, "Tab 2 should have 2 iframes"); + for (var i = 0; i < content.frames.length; i++) { + info("step 3, frame " + i + " info: " + content.frames[i].location); + let docshell = content.frames[i].QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + + Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`); + } + }).then(() => { + // Navigate tab 2 to a different page + ctx.tab2Browser.loadURI(testPath + "bug343515_pg3.html"); + + // bug343515_pg3.html consists of a page with two iframes, one of which + // contains another iframe, so there'll be a total of 4 load events + nShotsListener(ctx.tab2Browser, "load", step4, 4); + }); +} + +function step4() { + function checkTab2Active(expected) { + return ContentTask.spawn(ctx.tab2Browser, expected, function* (expected) { + function isActive(aWindow) { + var docshell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + return docshell.isActive; + } + + let active = expected ? "active" : "inactive"; + Assert.equal(content.frames.length, 2, "Tab 2 should have 2 iframes"); + for (var i = 0; i < content.frames.length; i++) + info("step 4, frame " + i + " info: " + content.frames[i].location); + Assert.equal(content.frames[0].frames.length, 1, "Tab 2 iframe 0 should have 1 iframes"); + Assert.equal(isActive(content.frames[0]), expected, `Tab2 iframe 0 should be ${active}`); + Assert.equal(isActive(content.frames[0].frames[0]), expected, + `Tab2 iframe 0 subiframe 0 should be ${active}`); + Assert.equal(isActive(content.frames[1]), expected, `Tab2 iframe 1 should be ${active}`); + }); + } + + is(testPath + "bug343515_pg3.html", ctx.tab2Browser.currentURI.spec, + "Got expected tab 2 url in step 4"); + + // Tab 0 should be inactive, Tab 1 should be active + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active"); + + // Tab2 and all descendants should be inactive + checkTab2Active(false).then(() => { + // Switch to Tab 2 + return BrowserTestUtils.switchTab(gBrowser, ctx.tab2); + }).then(() => { + // Check everything + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(!ctx.tab1Browser.docShellIsActive, "Tab 1 should be inactive"); + ok(ctx.tab2Browser.docShellIsActive, "Tab 2 should be active"); + + return checkTab2Active(true); + }).then(() => { + // Go back + waitForPageshow(ctx.tab2Browser, step5); + ctx.tab2Browser.goBack(); + }); +} + +function step5() { + // Check everything + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(!ctx.tab1Browser.docShellIsActive, "Tab 1 should be inactive"); + ok(ctx.tab2Browser.docShellIsActive, "Tab 2 should be active"); + ContentTask.spawn(ctx.tab2Browser, null, function* () { + for (var i = 0; i < content.frames.length; i++) { + let docshell = content.frames[i].QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + + Assert.ok(docShell.isActive, `Tab2 iframe ${i} should be active`); + } + }).then(() => { + // Switch to tab 1 + return BrowserTestUtils.switchTab(gBrowser, ctx.tab1); + }).then(() => { + // Navigate to page 3 + ctx.tab1Browser.loadURI(testPath + "bug343515_pg3.html"); + + // bug343515_pg3.html consists of a page with two iframes, one of which + // contains another iframe, so there'll be a total of 4 load events + nShotsListener(ctx.tab1Browser, "load", step6, 4); + }); +} + +function step6() { + + // Check everything + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active"); + ContentTask.spawn(ctx.tab1Browser, null, function* () { + function isActive(aWindow) { + var docshell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + return docshell.isActive; + } + + Assert.ok(isActive(content.frames[0]), "Tab1 iframe 0 should be active"); + Assert.ok(isActive(content.frames[0].frames[0]), "Tab1 iframe 0 subiframe 0 should be active"); + Assert.ok(isActive(content.frames[1]), "Tab1 iframe 1 should be active"); + }).then(() => { + ok(!ctx.tab2Browser.docShellIsActive, "Tab 2 should be inactive"); + return ContentTask.spawn(ctx.tab2Browser, null, function* () { + for (var i = 0; i < content.frames.length; i++) { + let docshell = content.frames[i].QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + + Assert.ok(!docShell.isActive, `Tab2 iframe ${i} should be inactive`); + } + }); + }).then(() => { + // Go forward on tab 2 + waitForPageshow(ctx.tab2Browser, step7); + ctx.tab2Browser.goForward(); + }); +} + +function step7() { + function checkBrowser(browser, tabNum, active) { + return ContentTask.spawn(browser, { tabNum, active }, + function* ({ tabNum, active }) { + function isActive(aWindow) { + var docshell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell); + return docshell.isActive; + } + + let activestr = active ? "active" : "inactive"; + Assert.equal(isActive(content.frames[0]), active, + `Tab${tabNum} iframe 0 should be ${activestr}`); + Assert.equal(isActive(content.frames[0].frames[0]), active, + `Tab${tabNum} iframe 0 subiframe 0 should be ${activestr}`); + Assert.equal(isActive(content.frames[1]), active, + `Tab${tabNum} iframe 1 should be ${activestr}`); + }); + } + + // Check everything + ok(!ctx.tab0Browser.docShellIsActive, "Tab 0 should be inactive"); + ok(ctx.tab1Browser.docShellIsActive, "Tab 1 should be active"); + checkBrowser(ctx.tab1Browser, 1, true).then(() => { + ok(!ctx.tab2Browser.docShellIsActive, "Tab 2 should be inactive"); + return checkBrowser(ctx.tab2Browser, 2, false); + }).then(() => { + // That's probably enough + allDone(); + }); +} + +function allDone() { + + // Close the tabs we made + gBrowser.removeTab(ctx.tab1); + gBrowser.removeTab(ctx.tab2); + + // Tell the framework we're done + finish(); +} diff --git a/docshell/test/navigation/browser_test-content-chromeflags.js b/docshell/test/navigation/browser_test-content-chromeflags.js new file mode 100644 index 000000000..64559897c --- /dev/null +++ b/docshell/test/navigation/browser_test-content-chromeflags.js @@ -0,0 +1,45 @@ +const TEST_PAGE = `data:text/html,Test`; +const CHROME_ALL = Ci.nsIWebBrowserChrome.CHROME_ALL; +const CHROME_REMOTE_WINDOW = Ci.nsIWebBrowserChrome.CHROME_REMOTE_WINDOW; + +/** + * Tests that when we open new browser windows from content they + * get the full browser chrome. + */ +add_task(function* () { + // Make sure that the window.open call will open a new + // window instead of a new tab. + yield new Promise(resolve => { + SpecialPowers.pushPrefEnv({ + "set": [ + ["browser.link.open_newwindow", 2], + ] + }, resolve); + }); + + yield BrowserTestUtils.withNewTab({ + gBrowser, + url: TEST_PAGE + }, function*(browser) { + let openedPromise = BrowserTestUtils.waitForNewWindow(); + BrowserTestUtils.synthesizeMouse("a", 0, 0, {}, browser); + let win = yield openedPromise; + + let chromeFlags = win.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShellTreeItem) + .treeOwner + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIXULWindow) + .chromeFlags; + + // In the multi-process case, the new window will have the + // CHROME_REMOTE_WINDOW flag set. + const EXPECTED = gMultiProcessBrowser ? CHROME_ALL | CHROME_REMOTE_WINDOW + : CHROME_ALL; + + is(chromeFlags, EXPECTED, "Window should have opened with all chrome"); + + BrowserTestUtils.closeWindow(win); + }); +}); diff --git a/docshell/test/navigation/bug343515_pg1.html b/docshell/test/navigation/bug343515_pg1.html new file mode 100644 index 000000000..a8337c7f7 --- /dev/null +++ b/docshell/test/navigation/bug343515_pg1.html @@ -0,0 +1,5 @@ + + + Page 1 + + diff --git a/docshell/test/navigation/bug343515_pg2.html b/docshell/test/navigation/bug343515_pg2.html new file mode 100644 index 000000000..c5f5665de --- /dev/null +++ b/docshell/test/navigation/bug343515_pg2.html @@ -0,0 +1,7 @@ + + + Page 2 + + + + diff --git a/docshell/test/navigation/bug343515_pg3.html b/docshell/test/navigation/bug343515_pg3.html new file mode 100644 index 000000000..fdc79fbf7 --- /dev/null +++ b/docshell/test/navigation/bug343515_pg3.html @@ -0,0 +1,7 @@ + + + Page 3 + + + + diff --git a/docshell/test/navigation/bug343515_pg3_1.html b/docshell/test/navigation/bug343515_pg3_1.html new file mode 100644 index 000000000..254164c9f --- /dev/null +++ b/docshell/test/navigation/bug343515_pg3_1.html @@ -0,0 +1,6 @@ + + + pg3 - iframe 0 + + + diff --git a/docshell/test/navigation/bug343515_pg3_1_1.html b/docshell/test/navigation/bug343515_pg3_1_1.html new file mode 100644 index 000000000..be05b7488 --- /dev/null +++ b/docshell/test/navigation/bug343515_pg3_1_1.html @@ -0,0 +1 @@ +How far does the rabbit hole go? diff --git a/docshell/test/navigation/bug343515_pg3_2.html b/docshell/test/navigation/bug343515_pg3_2.html new file mode 100644 index 000000000..7655eb526 --- /dev/null +++ b/docshell/test/navigation/bug343515_pg3_2.html @@ -0,0 +1 @@ +pg3 iframe 1 diff --git a/docshell/test/navigation/file_bug1300461.html b/docshell/test/navigation/file_bug1300461.html new file mode 100644 index 000000000..1ba935046 --- /dev/null +++ b/docshell/test/navigation/file_bug1300461.html @@ -0,0 +1,63 @@ + + + + + Bug 1300461 + + + + + diff --git a/docshell/test/navigation/file_bug1300461_back.html b/docshell/test/navigation/file_bug1300461_back.html new file mode 100644 index 000000000..7b187742f --- /dev/null +++ b/docshell/test/navigation/file_bug1300461_back.html @@ -0,0 +1,31 @@ + + + + + Bug 1300461 + + + + + + diff --git a/docshell/test/navigation/file_bug1300461_redirect.html b/docshell/test/navigation/file_bug1300461_redirect.html new file mode 100644 index 000000000..979530c5c --- /dev/null +++ b/docshell/test/navigation/file_bug1300461_redirect.html @@ -0,0 +1,10 @@ + + + + + Bug 1300461 + + + Redirect to file_bug1300461_back.html. + + diff --git a/docshell/test/navigation/file_bug1300461_redirect.html^headers^ b/docshell/test/navigation/file_bug1300461_redirect.html^headers^ new file mode 100644 index 000000000..241b89182 --- /dev/null +++ b/docshell/test/navigation/file_bug1300461_redirect.html^headers^ @@ -0,0 +1,2 @@ +HTTP 301 Moved Permanently +Location: file_bug1300461_back.html diff --git a/docshell/test/navigation/file_bug462076_1.html b/docshell/test/navigation/file_bug462076_1.html new file mode 100644 index 000000000..5b7bf2b11 --- /dev/null +++ b/docshell/test/navigation/file_bug462076_1.html @@ -0,0 +1,55 @@ + + + Bug 462076 + + + +
+
+
+
+ + + diff --git a/docshell/test/navigation/file_bug462076_2.html b/docshell/test/navigation/file_bug462076_2.html new file mode 100644 index 000000000..813a6d840 --- /dev/null +++ b/docshell/test/navigation/file_bug462076_2.html @@ -0,0 +1,52 @@ + + + Bug 462076 + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/file_bug462076_3.html b/docshell/test/navigation/file_bug462076_3.html new file mode 100644 index 000000000..0079b9cdf --- /dev/null +++ b/docshell/test/navigation/file_bug462076_3.html @@ -0,0 +1,52 @@ + + + Bug 462076 + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/file_bug508537_1.html b/docshell/test/navigation/file_bug508537_1.html new file mode 100644 index 000000000..194165f43 --- /dev/null +++ b/docshell/test/navigation/file_bug508537_1.html @@ -0,0 +1,34 @@ + + + + + +
Container:
+
+
Original frames:
+ + + + + diff --git a/docshell/test/navigation/file_bug534178.html b/docshell/test/navigation/file_bug534178.html new file mode 100644 index 000000000..8bcedb6fb --- /dev/null +++ b/docshell/test/navigation/file_bug534178.html @@ -0,0 +1,31 @@ + + + + + + + diff --git a/docshell/test/navigation/file_document_write_1.html b/docshell/test/navigation/file_document_write_1.html new file mode 100644 index 000000000..e0281f7cd --- /dev/null +++ b/docshell/test/navigation/file_document_write_1.html @@ -0,0 +1,30 @@ + + + + + +
static content
+ + diff --git a/docshell/test/navigation/file_fragment_handling_during_load.html b/docshell/test/navigation/file_fragment_handling_during_load.html new file mode 100644 index 000000000..fbfa0cb38 --- /dev/null +++ b/docshell/test/navigation/file_fragment_handling_during_load.html @@ -0,0 +1,24 @@ + + + + + + + diff --git a/docshell/test/navigation/file_nested_frames.html b/docshell/test/navigation/file_nested_frames.html new file mode 100644 index 000000000..f65d8e01b --- /dev/null +++ b/docshell/test/navigation/file_nested_frames.html @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/docshell/test/navigation/file_scrollRestoration.html b/docshell/test/navigation/file_scrollRestoration.html new file mode 100644 index 000000000..5450c2724 --- /dev/null +++ b/docshell/test/navigation/file_scrollRestoration.html @@ -0,0 +1,137 @@ + + + + + +
+  
+
Hello world
+ hash + + diff --git a/docshell/test/navigation/file_shiftReload_and_pushState.html b/docshell/test/navigation/file_shiftReload_and_pushState.html new file mode 100644 index 000000000..5a777894b --- /dev/null +++ b/docshell/test/navigation/file_shiftReload_and_pushState.html @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/docshell/test/navigation/file_static_and_dynamic_1.html b/docshell/test/navigation/file_static_and_dynamic_1.html new file mode 100644 index 000000000..692a5a9ab --- /dev/null +++ b/docshell/test/navigation/file_static_and_dynamic_1.html @@ -0,0 +1,32 @@ + + + + + +
Dynamic
+
+
Static
+
+ + diff --git a/docshell/test/navigation/file_triggeringprincipal_frame_1.html b/docshell/test/navigation/file_triggeringprincipal_frame_1.html new file mode 100644 index 000000000..1e21e6421 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_frame_1.html @@ -0,0 +1,27 @@ + + + + +Frame 1
+click me + + + + + diff --git a/docshell/test/navigation/file_triggeringprincipal_frame_2.html b/docshell/test/navigation/file_triggeringprincipal_frame_2.html new file mode 100644 index 000000000..ef7cdfc17 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_frame_2.html @@ -0,0 +1,8 @@ + + + + +Frame 2
+ + + diff --git a/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a.html b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a.html new file mode 100644 index 000000000..75b2933c1 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a.html @@ -0,0 +1,6 @@ + + + +Frame A + + diff --git a/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html new file mode 100644 index 000000000..0479f5e1e --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html @@ -0,0 +1,6 @@ + + + +Frame A navigated by Frame B + + diff --git a/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_b.html b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_b.html new file mode 100644 index 000000000..e5d40b267 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_iframe_iframe_window_open_frame_b.html @@ -0,0 +1,15 @@ + + + +Frame B navigating Frame A + + + + + + + diff --git a/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_base.html b/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_base.html new file mode 100644 index 000000000..caa6b275b --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_base.html @@ -0,0 +1,6 @@ + + + +base test frame + + diff --git a/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_nav.html b/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_nav.html new file mode 100644 index 000000000..f4a4d0e63 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_parent_iframe_window_open_nav.html @@ -0,0 +1,6 @@ + + + +navigated by window.open() + + diff --git a/docshell/test/navigation/file_triggeringprincipal_subframe.html b/docshell/test/navigation/file_triggeringprincipal_subframe.html new file mode 100644 index 000000000..0db1349f2 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_subframe.html @@ -0,0 +1,15 @@ + + + + +Sub Frame 2
+ + + diff --git a/docshell/test/navigation/file_triggeringprincipal_subframe_nav.html b/docshell/test/navigation/file_triggeringprincipal_subframe_nav.html new file mode 100644 index 000000000..3bf7097a6 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_subframe_nav.html @@ -0,0 +1,21 @@ + + + + +Sub Frame 2 Navigated
+ + + + diff --git a/docshell/test/navigation/file_triggeringprincipal_window_open.html b/docshell/test/navigation/file_triggeringprincipal_window_open.html new file mode 100644 index 000000000..d0644a4d5 --- /dev/null +++ b/docshell/test/navigation/file_triggeringprincipal_window_open.html @@ -0,0 +1,6 @@ + + + +http + + diff --git a/docshell/test/navigation/frame0.html b/docshell/test/navigation/frame0.html new file mode 100644 index 000000000..93d1c9c82 --- /dev/null +++ b/docshell/test/navigation/frame0.html @@ -0,0 +1,3 @@ + + Frame 0 + diff --git a/docshell/test/navigation/frame1.html b/docshell/test/navigation/frame1.html new file mode 100644 index 000000000..4d06c09d1 --- /dev/null +++ b/docshell/test/navigation/frame1.html @@ -0,0 +1,3 @@ + + Frame 1 + diff --git a/docshell/test/navigation/frame2.html b/docshell/test/navigation/frame2.html new file mode 100644 index 000000000..7a3b5e0b9 --- /dev/null +++ b/docshell/test/navigation/frame2.html @@ -0,0 +1,3 @@ + + Frame 2 + diff --git a/docshell/test/navigation/frame3.html b/docshell/test/navigation/frame3.html new file mode 100644 index 000000000..fd2429387 --- /dev/null +++ b/docshell/test/navigation/frame3.html @@ -0,0 +1,3 @@ + + Frame 3 + diff --git a/docshell/test/navigation/goback.html b/docshell/test/navigation/goback.html new file mode 100644 index 000000000..ce2968374 --- /dev/null +++ b/docshell/test/navigation/goback.html @@ -0,0 +1,5 @@ + + + window.history.go(-1); + + diff --git a/docshell/test/navigation/iframe.html b/docshell/test/navigation/iframe.html new file mode 100644 index 000000000..4685fea7b --- /dev/null +++ b/docshell/test/navigation/iframe.html @@ -0,0 +1,8 @@ + + + + + diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini new file mode 100644 index 000000000..0c35cf352 --- /dev/null +++ b/docshell/test/navigation/mochitest.ini @@ -0,0 +1,64 @@ +[DEFAULT] +support-files = + NavigationUtils.js + blank.html + file_bug462076_1.html + file_bug462076_2.html + file_bug462076_3.html + file_bug508537_1.html + file_bug534178.html + file_document_write_1.html + file_fragment_handling_during_load.html + file_nested_frames.html + file_scrollRestoration.html + file_shiftReload_and_pushState.html + file_static_and_dynamic_1.html + frame0.html + frame1.html + frame2.html + frame3.html + goback.html + iframe.html + navigate.html + open.html + parent.html + file_triggeringprincipal_frame_1.html + file_triggeringprincipal_frame_2.html + file_triggeringprincipal_subframe.html + file_triggeringprincipal_subframe_nav.html + file_triggeringprincipal_window_open.html + file_triggeringprincipal_parent_iframe_window_open_base.html + file_triggeringprincipal_parent_iframe_window_open_nav.html + file_triggeringprincipal_iframe_iframe_window_open_frame_a.html + file_triggeringprincipal_iframe_iframe_window_open_frame_b.html + file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html + file_bug1300461.html + file_bug1300461_redirect.html + file_bug1300461_redirect.html^headers^ + file_bug1300461_back.html + +[test_bug13871.html] +[test_bug270414.html] +[test_bug278916.html] +[test_bug279495.html] +[test_bug344861.html] +skip-if = toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520 +[test_bug386782.html] +[test_bug430624.html] +[test_bug430723.html] +skip-if = (toolkit == 'android') || (!debug && (os == 'mac' || os == 'win')) # Bug 874423 +[test_child.html] +[test_grandchild.html] +[test_not-opener.html] +[test_opener.html] +[test_popup-navigates-children.html] +[test_reserved.html] +skip-if = (toolkit == 'android') || (debug && e10s) #too slow on Android 4.3 aws only; bug 1030403; bug 1263213 for debug e10s +[test_sessionhistory.html] +skip-if = toolkit == 'android' #RANDOM +[test_sibling-matching-parent.html] +[test_sibling-off-domain.html] +[test_triggeringprincipal_frame_nav.html] +[test_triggeringprincipal_window_open.html] +[test_triggeringprincipal_parent_iframe_window_open.html] +[test_triggeringprincipal_iframe_iframe_window_open.html] diff --git a/docshell/test/navigation/navigate.html b/docshell/test/navigation/navigate.html new file mode 100644 index 000000000..e686da423 --- /dev/null +++ b/docshell/test/navigation/navigate.html @@ -0,0 +1,36 @@ + + + + + + + + + + diff --git a/docshell/test/navigation/open.html b/docshell/test/navigation/open.html new file mode 100644 index 000000000..1bb70f865 --- /dev/null +++ b/docshell/test/navigation/open.html @@ -0,0 +1,9 @@ + + + + + diff --git a/docshell/test/navigation/parent.html b/docshell/test/navigation/parent.html new file mode 100644 index 000000000..74722b8bd --- /dev/null +++ b/docshell/test/navigation/parent.html @@ -0,0 +1,14 @@ + + + +This document contains a frame. +
+ + + + diff --git a/docshell/test/navigation/test_bug13871.html b/docshell/test/navigation/test_bug13871.html new file mode 100644 index 000000000..e0b563a4a --- /dev/null +++ b/docshell/test/navigation/test_bug13871.html @@ -0,0 +1,81 @@ + + + + + + + + + + + +Mozilla Bug 13871 +
+
+
+ + diff --git a/docshell/test/navigation/test_bug270414.html b/docshell/test/navigation/test_bug270414.html new file mode 100644 index 000000000..98dcf42f8 --- /dev/null +++ b/docshell/test/navigation/test_bug270414.html @@ -0,0 +1,93 @@ + + + + + + + + + + + +Mozilla Bug 270414 +
+ + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/test_bug278916.html b/docshell/test/navigation/test_bug278916.html new file mode 100644 index 000000000..3ad6a9666 --- /dev/null +++ b/docshell/test/navigation/test_bug278916.html @@ -0,0 +1,37 @@ + + + + + + + + + + +Mozilla Bug 278916 + +
+
+
+ + diff --git a/docshell/test/navigation/test_bug279495.html b/docshell/test/navigation/test_bug279495.html new file mode 100644 index 000000000..79a169567 --- /dev/null +++ b/docshell/test/navigation/test_bug279495.html @@ -0,0 +1,48 @@ + + + + + + + + + + +Mozilla Bug 279495 + +
+
+
+ + diff --git a/docshell/test/navigation/test_bug344861.html b/docshell/test/navigation/test_bug344861.html new file mode 100644 index 000000000..f9759751c --- /dev/null +++ b/docshell/test/navigation/test_bug344861.html @@ -0,0 +1,35 @@ + + + + + Test for Bug 344861 + + + + +Mozilla Bug 344861 +

+ +
+
+
+ + + + diff --git a/docshell/test/navigation/test_bug386782.html b/docshell/test/navigation/test_bug386782.html new file mode 100644 index 000000000..2434963f1 --- /dev/null +++ b/docshell/test/navigation/test_bug386782.html @@ -0,0 +1,137 @@ + + + + + Test for Bug 386782 + + + + + + + + +Mozilla Bug 386782 +

+ +
+
+
+ + + diff --git a/docshell/test/navigation/test_bug430624.html b/docshell/test/navigation/test_bug430624.html new file mode 100644 index 000000000..9fc92e4cd --- /dev/null +++ b/docshell/test/navigation/test_bug430624.html @@ -0,0 +1,56 @@ + + + + + Test for Bug 430624 + + + + + +Mozilla Bug 430624 +

+ + + + +
+
+
+ + + + + + diff --git a/docshell/test/navigation/test_bug430723.html b/docshell/test/navigation/test_bug430723.html new file mode 100644 index 000000000..eb53e0d22 --- /dev/null +++ b/docshell/test/navigation/test_bug430723.html @@ -0,0 +1,138 @@ + + + + + Test for Bug 430723 + + + + + +Mozilla Bug 430723 +

+ +
+
+
+ + diff --git a/docshell/test/navigation/test_child.html b/docshell/test/navigation/test_child.html new file mode 100644 index 000000000..c43e1a6cf --- /dev/null +++ b/docshell/test/navigation/test_child.html @@ -0,0 +1,48 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+ + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/test_grandchild.html b/docshell/test/navigation/test_grandchild.html new file mode 100644 index 000000000..439145b3e --- /dev/null +++ b/docshell/test/navigation/test_grandchild.html @@ -0,0 +1,48 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+ + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/test_not-opener.html b/docshell/test/navigation/test_not-opener.html new file mode 100644 index 000000000..d778f71d9 --- /dev/null +++ b/docshell/test/navigation/test_not-opener.html @@ -0,0 +1,51 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+
+
+ + diff --git a/docshell/test/navigation/test_opener.html b/docshell/test/navigation/test_opener.html new file mode 100644 index 000000000..bfb1dde9f --- /dev/null +++ b/docshell/test/navigation/test_opener.html @@ -0,0 +1,52 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+
+
+ + diff --git a/docshell/test/navigation/test_popup-navigates-children.html b/docshell/test/navigation/test_popup-navigates-children.html new file mode 100644 index 000000000..692f35713 --- /dev/null +++ b/docshell/test/navigation/test_popup-navigates-children.html @@ -0,0 +1,62 @@ + + + + + + + + + + + +
+ + + + +
+
+
+
+ + diff --git a/docshell/test/navigation/test_reserved.html b/docshell/test/navigation/test_reserved.html new file mode 100644 index 000000000..b2389078c --- /dev/null +++ b/docshell/test/navigation/test_reserved.html @@ -0,0 +1,100 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+
+
+
+
+ + diff --git a/docshell/test/navigation/test_sessionhistory.html b/docshell/test/navigation/test_sessionhistory.html new file mode 100644 index 000000000..452271a41 --- /dev/null +++ b/docshell/test/navigation/test_sessionhistory.html @@ -0,0 +1,68 @@ + + + + + Test for Bug + + + + +Mozilla Bug +

+ +
+
+
+ + diff --git a/docshell/test/navigation/test_sibling-matching-parent.html b/docshell/test/navigation/test_sibling-matching-parent.html new file mode 100644 index 000000000..dc8ec2f90 --- /dev/null +++ b/docshell/test/navigation/test_sibling-matching-parent.html @@ -0,0 +1,46 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+ + + + +
+
+
+
+
+ + diff --git a/docshell/test/navigation/test_sibling-off-domain.html b/docshell/test/navigation/test_sibling-off-domain.html new file mode 100644 index 000000000..ba7942798 --- /dev/null +++ b/docshell/test/navigation/test_sibling-off-domain.html @@ -0,0 +1,46 @@ + + + + + + + + + + + +Mozilla Bug 408052 +
+ + + + +
+
+
+
+
+ + diff --git a/docshell/test/navigation/test_triggeringprincipal_frame_nav.html b/docshell/test/navigation/test_triggeringprincipal_frame_nav.html new file mode 100644 index 000000000..f8f97c678 --- /dev/null +++ b/docshell/test/navigation/test_triggeringprincipal_frame_nav.html @@ -0,0 +1,69 @@ + + + + + Bug 1181370 - Test triggeringPrincipal for iframe navigations + + + + + + + + + + + diff --git a/docshell/test/navigation/test_triggeringprincipal_iframe_iframe_window_open.html b/docshell/test/navigation/test_triggeringprincipal_iframe_iframe_window_open.html new file mode 100644 index 000000000..cd6a9c056 --- /dev/null +++ b/docshell/test/navigation/test_triggeringprincipal_iframe_iframe_window_open.html @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + diff --git a/docshell/test/navigation/test_triggeringprincipal_parent_iframe_window_open.html b/docshell/test/navigation/test_triggeringprincipal_parent_iframe_window_open.html new file mode 100644 index 000000000..7cc6ee97d --- /dev/null +++ b/docshell/test/navigation/test_triggeringprincipal_parent_iframe_window_open.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + diff --git a/docshell/test/navigation/test_triggeringprincipal_window_open.html b/docshell/test/navigation/test_triggeringprincipal_window_open.html new file mode 100644 index 000000000..d5d7f210b --- /dev/null +++ b/docshell/test/navigation/test_triggeringprincipal_window_open.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + diff --git a/docshell/test/test_anchor_scroll_after_document_open.html b/docshell/test/test_anchor_scroll_after_document_open.html new file mode 100644 index 000000000..93fa4615b --- /dev/null +++ b/docshell/test/test_anchor_scroll_after_document_open.html @@ -0,0 +1,55 @@ + + + + + + Test for Bug 881487 + + + + + +Mozilla Bug 881487 +

+ + +

+ +
+
+ + diff --git a/docshell/test/test_bfcache_plus_hash.html b/docshell/test/test_bfcache_plus_hash.html new file mode 100644 index 000000000..30c0b6b50 --- /dev/null +++ b/docshell/test/test_bfcache_plus_hash.html @@ -0,0 +1,120 @@ + + + + + Test for Bug 646641 + + + + + +Mozilla Bug 646641 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug1045096.html b/docshell/test/test_bug1045096.html new file mode 100644 index 000000000..8a0b4a223 --- /dev/null +++ b/docshell/test/test_bug1045096.html @@ -0,0 +1,29 @@ + + + + + + Test for Bug 1045096 + + + + +Mozilla Bug 1045096 +

+ +
+
+ + + diff --git a/docshell/test/test_bug1121701.html b/docshell/test/test_bug1121701.html new file mode 100644 index 000000000..8beb2d8d0 --- /dev/null +++ b/docshell/test/test_bug1121701.html @@ -0,0 +1,71 @@ + + + + + + Test for Bug 1121701 + + + + + +Mozilla Bug 1121701 +

+ +
+
+ + diff --git a/docshell/test/test_bug1186774.html b/docshell/test/test_bug1186774.html new file mode 100644 index 000000000..52ef5f62c --- /dev/null +++ b/docshell/test/test_bug1186774.html @@ -0,0 +1,51 @@ + + + + + + Test for Bug 1186774 + + + + + +Mozilla Bug 1186774 +

+ +
+
+ + diff --git a/docshell/test/test_bug123696.html b/docshell/test/test_bug123696.html new file mode 100644 index 000000000..11d14e807 --- /dev/null +++ b/docshell/test/test_bug123696.html @@ -0,0 +1,46 @@ + + + + + Test for Bug 123696 + + + + +Mozilla Bug 123696 +

+ +

+ +
+
+
+ + diff --git a/docshell/test/test_bug369814.html b/docshell/test/test_bug369814.html new file mode 100644 index 000000000..866771055 --- /dev/null +++ b/docshell/test/test_bug369814.html @@ -0,0 +1,211 @@ + + + + + Test for Bug 369814 + + + + + +Mozilla Bug 369814 + +

+ +

+
+
+ + diff --git a/docshell/test/test_bug384014.html b/docshell/test/test_bug384014.html new file mode 100644 index 000000000..1f115a6ec --- /dev/null +++ b/docshell/test/test_bug384014.html @@ -0,0 +1,41 @@ + + + + + Test for Bug 384014 + + + + +Mozilla Bug 384014 +

+ +

+ +
+
+
+ + + diff --git a/docshell/test/test_bug385434.html b/docshell/test/test_bug385434.html new file mode 100644 index 000000000..660f522e8 --- /dev/null +++ b/docshell/test/test_bug385434.html @@ -0,0 +1,209 @@ + + + + + Test for Bug 385434 + + + + + +Mozilla Bug 385434 +

+
+ + +
+
+
+
+ + diff --git a/docshell/test/test_bug387979.html b/docshell/test/test_bug387979.html new file mode 100644 index 000000000..9e337e2c2 --- /dev/null +++ b/docshell/test/test_bug387979.html @@ -0,0 +1,54 @@ + + + + + Test for Bug 387979 + + + + +Mozilla Bug 387979 + +
+
+
+

+ +

-
+

+ + + diff --git a/docshell/test/test_bug402210.html b/docshell/test/test_bug402210.html new file mode 100644 index 000000000..78fa025e0 --- /dev/null +++ b/docshell/test/test_bug402210.html @@ -0,0 +1,50 @@ + + + + + Test for Bug 402210 + + + + +Mozilla Bug 402210 +

+ Test Link +

+ +
+
+
+ + + diff --git a/docshell/test/test_bug404548.html b/docshell/test/test_bug404548.html new file mode 100644 index 000000000..edde15c9d --- /dev/null +++ b/docshell/test/test_bug404548.html @@ -0,0 +1,39 @@ + + + + + Test for Bug 404548 + + + + +Mozilla Bug 404548 +

+

+ +
+
+
+ + + diff --git a/docshell/test/test_bug413310.html b/docshell/test/test_bug413310.html new file mode 100644 index 000000000..e030c99d8 --- /dev/null +++ b/docshell/test/test_bug413310.html @@ -0,0 +1,106 @@ + + + + + Test for Bug 413310 + + + + +Mozilla Bug 413310 +

+ + + +

+ +
+
+ + + diff --git a/docshell/test/test_bug475636.html b/docshell/test/test_bug475636.html new file mode 100644 index 000000000..eaea3bcb8 --- /dev/null +++ b/docshell/test/test_bug475636.html @@ -0,0 +1,52 @@ + + + + + Test for Bug 475636 + + + + + +Mozilla Bug 475636 + + + +
+
+
+ + diff --git a/docshell/test/test_bug509055.html b/docshell/test/test_bug509055.html new file mode 100644 index 000000000..be163cafa --- /dev/null +++ b/docshell/test/test_bug509055.html @@ -0,0 +1,98 @@ + + + + + Test for Bug 509055 + + + + + +Mozilla Bug 509055 +

+
+
+
+
+
+
+
+
+
diff --git a/docshell/test/test_bug511449.html b/docshell/test/test_bug511449.html
new file mode 100644
index 000000000..dcea4cf3d
--- /dev/null
+++ b/docshell/test/test_bug511449.html
@@ -0,0 +1,56 @@
+
+
+
+
+  Test for Bug 511449
+  
+  
+  
+  
+
+
+Mozilla Bug 511449
+

+
+
+
+ +
+
+
+
+
diff --git a/docshell/test/test_bug529119-1.html b/docshell/test/test_bug529119-1.html
new file mode 100644
index 000000000..573885dc0
--- /dev/null
+++ b/docshell/test/test_bug529119-1.html
@@ -0,0 +1,95 @@
+
+
+
+Test bug 529119
+        
+
+
+
+
+
+
+
diff --git a/docshell/test/test_bug529119-2.html b/docshell/test/test_bug529119-2.html
new file mode 100644
index 000000000..fb3d19119
--- /dev/null
+++ b/docshell/test/test_bug529119-2.html
@@ -0,0 +1,90 @@
+
+
+
+Test bug 529119
+        
+
+
+
+
+
+
+
diff --git a/docshell/test/test_bug530396.html b/docshell/test/test_bug530396.html
new file mode 100644
index 000000000..f9fb79b4b
--- /dev/null
+++ b/docshell/test/test_bug530396.html
@@ -0,0 +1,57 @@
+
+
+
+
+  Test for Bug 530396
+  
+  
+  
+  
+
+
+Mozilla Bug 530396
+
+

+ + + +

+
+
+ diff --git a/docshell/test/test_bug540462.html b/docshell/test/test_bug540462.html new file mode 100644 index 000000000..65447114f --- /dev/null +++ b/docshell/test/test_bug540462.html @@ -0,0 +1,44 @@ + + + + + Test for Bug 540462 + + + + +Mozilla Bug 540462 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug551225.html b/docshell/test/test_bug551225.html new file mode 100644 index 000000000..00dc5e076 --- /dev/null +++ b/docshell/test/test_bug551225.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 551225 + + + + + +Mozilla Bug 551225 + + + + diff --git a/docshell/test/test_bug570341.html b/docshell/test/test_bug570341.html new file mode 100644 index 000000000..d09afa4bd --- /dev/null +++ b/docshell/test/test_bug570341.html @@ -0,0 +1,142 @@ + + + + + Test for Bug 570341 + + + + + +Mozilla Bug 570341 +
+ +
+ +

+ +
+
+
+ + diff --git a/docshell/test/test_bug580069.html b/docshell/test/test_bug580069.html new file mode 100644 index 000000000..70d3b4a3e --- /dev/null +++ b/docshell/test/test_bug580069.html @@ -0,0 +1,61 @@ + + + + + Test for Bug 580069 + + + + + +Mozilla Bug 580069 + + + + + + + diff --git a/docshell/test/test_bug590573.html b/docshell/test/test_bug590573.html new file mode 100644 index 000000000..aa6d3bd79 --- /dev/null +++ b/docshell/test/test_bug590573.html @@ -0,0 +1,232 @@ + + + + + Test for Bug 590573 + + + + + +Mozilla Bug 590573 + + + + + diff --git a/docshell/test/test_bug598895.html b/docshell/test/test_bug598895.html new file mode 100644 index 000000000..52b9537be --- /dev/null +++ b/docshell/test/test_bug598895.html @@ -0,0 +1,53 @@ + + + + + Test for Bug 598895 + + + + + +Mozilla Bug 598895 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug634834.html b/docshell/test/test_bug634834.html new file mode 100644 index 000000000..88f068518 --- /dev/null +++ b/docshell/test/test_bug634834.html @@ -0,0 +1,53 @@ + + + + + Test for Bug 634834 + + + + + +Mozilla Bug 634834 + + + + + + + diff --git a/docshell/test/test_bug637644.html b/docshell/test/test_bug637644.html new file mode 100644 index 000000000..d172ada4a --- /dev/null +++ b/docshell/test/test_bug637644.html @@ -0,0 +1,53 @@ + + + + + Test for Bug 637644 + + + + + +Mozilla Bug 637644 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug640387_1.html b/docshell/test/test_bug640387_1.html new file mode 100644 index 000000000..e324787d4 --- /dev/null +++ b/docshell/test/test_bug640387_1.html @@ -0,0 +1,109 @@ + + + + + Test for Bug 640387 + + + + + +Mozilla Bug 640387 + + + + + diff --git a/docshell/test/test_bug640387_2.html b/docshell/test/test_bug640387_2.html new file mode 100644 index 000000000..00c27fdda --- /dev/null +++ b/docshell/test/test_bug640387_2.html @@ -0,0 +1,90 @@ + + + + + Test for Bug 640387 + + + + + +Mozilla Bug 640387 + + + + + + + + + diff --git a/docshell/test/test_bug653741.html b/docshell/test/test_bug653741.html new file mode 100644 index 000000000..f4d4587b8 --- /dev/null +++ b/docshell/test/test_bug653741.html @@ -0,0 +1,49 @@ + + + + + Test for Bug 653741 + + + + + +Mozilla Bug 653741 + + + + + + + diff --git a/docshell/test/test_bug660404.html b/docshell/test/test_bug660404.html new file mode 100644 index 000000000..df45793a9 --- /dev/null +++ b/docshell/test/test_bug660404.html @@ -0,0 +1,48 @@ + + + + + Test for Bug 660404 + + + + +Mozilla Bug 660404 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug662170.html b/docshell/test/test_bug662170.html new file mode 100644 index 000000000..514bb55b1 --- /dev/null +++ b/docshell/test/test_bug662170.html @@ -0,0 +1,51 @@ + + + + + Test for Bug 662170 + + + + + +Mozilla Bug 662170 + + + + + + + + diff --git a/docshell/test/test_bug668513.html b/docshell/test/test_bug668513.html new file mode 100644 index 000000000..78df4b135 --- /dev/null +++ b/docshell/test/test_bug668513.html @@ -0,0 +1,28 @@ + + + + + Test for Bug 668513 + + + + +Mozilla Bug 668513 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug669671.html b/docshell/test/test_bug669671.html new file mode 100644 index 000000000..6070ecc82 --- /dev/null +++ b/docshell/test/test_bug669671.html @@ -0,0 +1,146 @@ + + + + + Test for Bug 669671 + + + + +Mozilla Bug 669671 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug675587.html b/docshell/test/test_bug675587.html new file mode 100644 index 000000000..9a283d3ac --- /dev/null +++ b/docshell/test/test_bug675587.html @@ -0,0 +1,34 @@ + + + + + Test for Bug 675587 + + + + +Mozilla Bug 675587 +

+ +

+ +
+
+
+ + diff --git a/docshell/test/test_bug680257.html b/docshell/test/test_bug680257.html new file mode 100644 index 000000000..bf7c32d11 --- /dev/null +++ b/docshell/test/test_bug680257.html @@ -0,0 +1,59 @@ + + + + + Test for Bug 680257 + + + + +Mozilla Bug 680257 + + + + diff --git a/docshell/test/test_bug691547.html b/docshell/test/test_bug691547.html new file mode 100644 index 000000000..9bf4f1004 --- /dev/null +++ b/docshell/test/test_bug691547.html @@ -0,0 +1,60 @@ + + + + + Test for Bug 691547 + + + + + +Mozilla Bug 570341 +
+ +
+ +
+
+
+ + diff --git a/docshell/test/test_bug694612.html b/docshell/test/test_bug694612.html new file mode 100644 index 000000000..85c240146 --- /dev/null +++ b/docshell/test/test_bug694612.html @@ -0,0 +1,27 @@ + + + + + Test for Bug 694612 + + + + +Mozilla Bug 694612 +

+ +
+
+
+
+
+ + diff --git a/docshell/test/test_bug703855.html b/docshell/test/test_bug703855.html new file mode 100644 index 000000000..0804f70bc --- /dev/null +++ b/docshell/test/test_bug703855.html @@ -0,0 +1,79 @@ + + + + + + Test for Bug 703855 + + + + +Mozilla Bug 703855 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug713825.html b/docshell/test/test_bug713825.html new file mode 100644 index 000000000..5f30dd0b6 --- /dev/null +++ b/docshell/test/test_bug713825.html @@ -0,0 +1,42 @@ + + + + + + Test for Bug 713825 + + + + +Mozilla Bug 713825 +

+ +
+
+
+ + diff --git a/docshell/test/test_bug728939.html b/docshell/test/test_bug728939.html new file mode 100644 index 000000000..c29f18668 --- /dev/null +++ b/docshell/test/test_bug728939.html @@ -0,0 +1,37 @@ + + + + + Test for Bug 728939 + + + + +Mozilla Bug 728939 + + + + diff --git a/docshell/test/test_bug797909.html b/docshell/test/test_bug797909.html new file mode 100644 index 000000000..a47aa0c6d --- /dev/null +++ b/docshell/test/test_bug797909.html @@ -0,0 +1,66 @@ + + + + + + Test for Bug 797909 + + + + +Mozilla Bug 797909 +

+ +
+
+
+ + + diff --git a/docshell/test/test_forceinheritprincipal_overrule_owner.html b/docshell/test/test_forceinheritprincipal_overrule_owner.html new file mode 100644 index 000000000..b3a48d7ea --- /dev/null +++ b/docshell/test/test_forceinheritprincipal_overrule_owner.html @@ -0,0 +1,51 @@ + + + + + + + + + +
+ + diff --git a/docshell/test/test_framedhistoryframes.html b/docshell/test/test_framedhistoryframes.html new file mode 100644 index 000000000..916a6229d --- /dev/null +++ b/docshell/test/test_framedhistoryframes.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 602256 + + + + +Mozilla Bug 602256 +

+
+
+
+
+
+ + diff --git a/docshell/test/test_pushState_after_document_open.html b/docshell/test/test_pushState_after_document_open.html new file mode 100644 index 000000000..51ba1050c --- /dev/null +++ b/docshell/test/test_pushState_after_document_open.html @@ -0,0 +1,37 @@ + + + + + + Test for Bug 957479 + + + + + +Mozilla Bug 957479 +

+ +
+
+ + diff --git a/docshell/test/test_windowedhistoryframes.html b/docshell/test/test_windowedhistoryframes.html new file mode 100644 index 000000000..d27987beb --- /dev/null +++ b/docshell/test/test_windowedhistoryframes.html @@ -0,0 +1,32 @@ + + + + + Test for Bug 602256 + + + + +Mozilla Bug 602256 +

+ +
+
+
+ + diff --git a/docshell/test/unit/head_docshell.js b/docshell/test/unit/head_docshell.js new file mode 100644 index 000000000..a5c7546c0 --- /dev/null +++ b/docshell/test/unit/head_docshell.js @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 Cc = Components.classes; +var Ci = Components.interfaces; +var Cr = Components.results; + +var dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); +var profileDir = do_get_profile(); diff --git a/docshell/test/unit/test_bug414201_jfif.js b/docshell/test/unit/test_bug414201_jfif.js new file mode 100644 index 000000000..6a689ec08 --- /dev/null +++ b/docshell/test/unit/test_bug414201_jfif.js @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 414201 + */ + +function run_test() +{ + var ms = Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService); + + /* Test a few common image types to make sure that they get the right extension */ + var types = { + "image/jpeg": ["jpg", "jpeg"], /* accept either */ + "image/gif": ["gif"], + "image/png": ["png"] + }; + + /* Check whether the primary extension is what we'd expect */ + for (var mimetype in types) { + var exts = types[mimetype]; + var primary = ms.getFromTypeAndExtension(mimetype, null).primaryExtension.toLowerCase(); + + do_check_true (exts.indexOf(primary) != -1); + } +} diff --git a/docshell/test/unit/test_bug442584.js b/docshell/test/unit/test_bug442584.js new file mode 100644 index 000000000..174bdb7e3 --- /dev/null +++ b/docshell/test/unit/test_bug442584.js @@ -0,0 +1,30 @@ +var prefetch = Cc["@mozilla.org/prefetch-service;1"]. + getService(Ci.nsIPrefetchService); +var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); +var prefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + +function run_test() { + // Fill up the queue + prefs.setBoolPref("network.prefetch-next", true); + for (var i = 0; i < 5; i++) { + var uri = ios.newURI("http://localhost/" + i, null, null); + prefetch.prefetchURI(uri, uri, null, true); + } + + // Make sure the queue has items in it... + do_check_true(prefetch.hasMoreElements()); + + // Now disable the pref to force the queue to empty... + prefs.setBoolPref("network.prefetch-next", false); + do_check_false(prefetch.hasMoreElements()); + + // Now reenable the pref, and add more items to the queue. + prefs.setBoolPref("network.prefetch-next", true); + for (var i = 0; i < 5; i++) { + var uri = ios.newURI("http://localhost/" + i, null, null); + prefetch.prefetchURI(uri, uri, null, true); + } + do_check_true(prefetch.hasMoreElements()); +} diff --git a/docshell/test/unit/test_nsDefaultURIFixup.js b/docshell/test/unit/test_nsDefaultURIFixup.js new file mode 100644 index 000000000..371bdea17 --- /dev/null +++ b/docshell/test/unit/test_nsDefaultURIFixup.js @@ -0,0 +1,93 @@ +var urifixup = Cc["@mozilla.org/docshell/urifixup;1"]. + getService(Ci.nsIURIFixup); +var prefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + +var pref = "browser.fixup.typo.scheme"; + +var data = [ + { + // ttp -> http. + wrong: 'ttp://www.example.com/', + fixed: 'http://www.example.com/', + }, + { + // ttps -> https. + wrong: 'ttps://www.example.com/', + fixed: 'https://www.example.com/', + }, + { + // tps -> https. + wrong: 'tps://www.example.com/', + fixed: 'https://www.example.com/', + }, + { + // ps -> https. + wrong: 'ps://www.example.com/', + fixed: 'https://www.example.com/', + }, + { + // ile -> file. + wrong: 'ile:///this/is/a/test.html', + fixed: 'file:///this/is/a/test.html', + }, + { + // le -> file. + wrong: 'le:///this/is/a/test.html', + fixed: 'file:///this/is/a/test.html', + }, + { + // Valid should not be changed. + wrong: 'https://example.com/this/is/a/test.html', + fixed: 'https://example.com/this/is/a/test.html', + }, + { + // Unmatched should not be changed. + wrong: 'whatever://this/is/a/test.html', + fixed: 'whatever://this/is/a/test.html', + }, +]; + +var len = data.length; + +function run_test() { + run_next_test(); +} + +// Make sure we fix what needs fixing when there is no pref set. +add_task(function test_unset_pref_fixes_typos() { + prefs.clearUserPref(pref); + for (let i = 0; i < len; ++i) { + let item = data[i]; + let result = + urifixup.createFixupURI(item.wrong, + urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec; + do_check_eq(result, item.fixed); + } +}); + +// Make sure we don't do anything when the pref is explicitly +// set to false. +add_task(function test_false_pref_keeps_typos() { + prefs.setBoolPref(pref, false); + for (let i = 0; i < len; ++i) { + let item = data[i]; + let result = + urifixup.createFixupURI(item.wrong, + urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec; + do_check_eq(result, item.wrong); + } +}); + +// Finally, make sure we still fix what needs fixing if the pref is +// explicitly set to true. +add_task(function test_true_pref_fixes_typos() { + prefs.setBoolPref(pref, true); + for (let i = 0; i < len; ++i) { + let item = data[i]; + let result = + urifixup.createFixupURI(item.wrong, + urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec; + do_check_eq(result, item.fixed); + } +}); diff --git a/docshell/test/unit/test_nsDefaultURIFixup_info.js b/docshell/test/unit/test_nsDefaultURIFixup_info.js new file mode 100644 index 000000000..9e33ea484 --- /dev/null +++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js @@ -0,0 +1,620 @@ +var urifixup = Cc["@mozilla.org/docshell/urifixup;1"]. + getService(Ci.nsIURIFixup); + +Components.utils.import("resource://gre/modules/Services.jsm"); + +var prefList = ["browser.fixup.typo.scheme", "keyword.enabled", + "browser.fixup.domainwhitelist.whitelisted"]; +for (let pref of prefList) { + Services.prefs.setBoolPref(pref, true); +} + +const kSearchEngineID = "test_urifixup_search_engine"; +const kSearchEngineURL = "http://www.example.org/?search={searchTerms}"; +Services.search.addEngineWithDetails(kSearchEngineID, "", "", "", "get", + kSearchEngineURL); + +var oldDefaultEngine = Services.search.defaultEngine; +Services.search.defaultEngine = Services.search.getEngineByName(kSearchEngineID); + +var selectedName = Services.search.defaultEngine.name; +do_check_eq(selectedName, kSearchEngineID); + +const kForceHostLookup = "browser.fixup.dns_first_for_single_words"; +do_register_cleanup(function() { + if (oldDefaultEngine) { + Services.search.defaultEngine = oldDefaultEngine; + } + let engine = Services.search.getEngineByName(kSearchEngineID); + if (engine) { + Services.search.removeEngine(engine); + } + Services.prefs.clearUserPref("keyword.enabled"); + Services.prefs.clearUserPref("browser.fixup.typo.scheme"); + Services.prefs.clearUserPref(kForceHostLookup); +}); + +var flagInputs = [ + urifixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP, + urifixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI, + urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS, +]; + +flagInputs.concat([ + flagInputs[0] | flagInputs[1], + flagInputs[1] | flagInputs[2], + flagInputs[0] | flagInputs[2], + flagInputs[0] | flagInputs[1] | flagInputs[2] +]); + +/* + The following properties are supported for these test cases: + { + input: "", // Input string, required + fixedURI: "", // Expected fixedURI + alternateURI: "", // Expected alternateURI + keywordLookup: false, // Whether a keyword lookup is expected + protocolChange: false, // Whether a protocol change is expected + inWhitelist: false, // Whether the input host is in the whitelist + affectedByDNSForSingleHosts: false, // Whether the input host could be a host, but is normally assumed to be a keyword query + } +*/ +var testcases = [ { + input: "http://www.mozilla.org", + fixedURI: "http://www.mozilla.org/", + }, { + input: "http://127.0.0.1/", + fixedURI: "http://127.0.0.1/", + }, { + input: "file:///foo/bar", + fixedURI: "file:///foo/bar", + }, { + input: "://www.mozilla.org", + fixedURI: "http://www.mozilla.org/", + protocolChange: true, + }, { + input: "www.mozilla.org", + fixedURI: "http://www.mozilla.org/", + protocolChange: true, + }, { + input: "http://mozilla/", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + }, { + input: "http://test./", + fixedURI: "http://test./", + alternateURI: "http://www.test./", + }, { + input: "127.0.0.1", + fixedURI: "http://127.0.0.1/", + protocolChange: true, + }, { + input: "1.2.3.4/", + fixedURI: "http://1.2.3.4/", + protocolChange: true, + }, { + input: "1.2.3.4/foo", + fixedURI: "http://1.2.3.4/foo", + protocolChange: true, + }, { + input: "1.2.3.4:8000", + fixedURI: "http://1.2.3.4:8000/", + protocolChange: true, + }, { + input: "1.2.3.4:8000/", + fixedURI: "http://1.2.3.4:8000/", + protocolChange: true, + }, { + input: "1.2.3.4:8000/foo", + fixedURI: "http://1.2.3.4:8000/foo", + protocolChange: true, + }, { + input: "192.168.10.110", + fixedURI: "http://192.168.10.110/", + protocolChange: true, + }, { + input: "192.168.10.110/123", + fixedURI: "http://192.168.10.110/123", + protocolChange: true, + }, { + input: "192.168.10.110/123foo", + fixedURI: "http://192.168.10.110/123foo", + protocolChange: true, + }, { + input: "192.168.10.110:1234/123", + fixedURI: "http://192.168.10.110:1234/123", + protocolChange: true, + }, { + input: "192.168.10.110:1234/123foo", + fixedURI: "http://192.168.10.110:1234/123foo", + protocolChange: true, + }, { + input: "1.2.3", + fixedURI: "http://1.2.0.3/", + protocolChange: true, + }, { + input: "1.2.3/", + fixedURI: "http://1.2.0.3/", + protocolChange: true, + }, { + input: "1.2.3/foo", + fixedURI: "http://1.2.0.3/foo", + protocolChange: true, + }, { + input: "1.2.3/123", + fixedURI: "http://1.2.0.3/123", + protocolChange: true, + }, { + input: "1.2.3:8000", + fixedURI: "http://1.2.0.3:8000/", + protocolChange: true, + }, { + input: "1.2.3:8000/", + fixedURI: "http://1.2.0.3:8000/", + protocolChange: true, + }, { + input: "1.2.3:8000/foo", + fixedURI: "http://1.2.0.3:8000/foo", + protocolChange: true, + }, { + input: "1.2.3:8000/123", + fixedURI: "http://1.2.0.3:8000/123", + protocolChange: true, + }, { + input: "http://1.2.3", + fixedURI: "http://1.2.0.3/", + }, { + input: "http://1.2.3/", + fixedURI: "http://1.2.0.3/", + }, { + input: "http://1.2.3/foo", + fixedURI: "http://1.2.0.3/foo", + }, { + input: "[::1]", + fixedURI: "http://[::1]/", + alternateURI: "http://[::1]/", + protocolChange: true, + }, { + input: "[::1]/", + fixedURI: "http://[::1]/", + alternateURI: "http://[::1]/", + protocolChange: true, + }, { + input: "[::1]:8000", + fixedURI: "http://[::1]:8000/", + alternateURI: "http://[::1]:8000/", + protocolChange: true, + }, { + input: "[::1]:8000/", + fixedURI: "http://[::1]:8000/", + alternateURI: "http://[::1]:8000/", + protocolChange: true, + }, { + input: "[[::1]]/", + keywordLookup: true, + protocolChange: true, + }, { + input: "[fe80:cd00:0:cde:1257:0:211e:729c]", + fixedURI: "http://[fe80:cd00:0:cde:1257:0:211e:729c]/", + alternateURI: "http://[fe80:cd00:0:cde:1257:0:211e:729c]/", + protocolChange: true, + }, { + input: "[64:ff9b::8.8.8.8]", + fixedURI: "http://[64:ff9b::8.8.8.8]/", + protocolChange: true + }, { + input: "[64:ff9b::8.8.8.8]/~moz", + fixedURI: "http://[64:ff9b::8.8.8.8]/~moz", + protocolChange: true + }, { + input: "[::1][::1]", + keywordLookup: true, + protocolChange: true + }, { + input: "[::1][100", + fixedURI: null, + alternateURI: null, + keywordLookup: true, + protocolChange: true + }, { + input: "[::1]]", + keywordLookup: true, + protocolChange: true + }, { + input: "1234", + fixedURI: "http://0.0.4.210/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "host/foo.txt", + fixedURI: "http://host/foo.txt", + alternateURI: "http://www.host.com/foo.txt", + protocolChange: true, + }, { + input: "mozilla", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "test.", + fixedURI: "http://test./", + alternateURI: "http://www.test./", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: ".test", + fixedURI: "http://.test/", + alternateURI: "http://www..test/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "mozilla is amazing", + keywordLookup: true, + protocolChange: true, + }, { + input: "search ?mozilla", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla .com", + keywordLookup: true, + protocolChange: true, + }, { + input: "what if firefox?", + keywordLookup: true, + protocolChange: true, + }, { + input: "london's map", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla ", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: " mozilla ", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "mozilla \\", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla \\ foo.txt", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla \\\r foo.txt", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla\n", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "mozilla \r\n", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "moz\r\nfirefox\nos\r", + fixedURI: "http://mozfirefoxos/", + alternateURI: "http://www.mozfirefoxos.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "moz\r\n firefox\n", + keywordLookup: true, + protocolChange: true, + }, { + input: "", + keywordLookup: true, + protocolChange: true, + }, { + input: "[]", + keywordLookup: true, + protocolChange: true, + }, { + input: "http://whitelisted/", + fixedURI: "http://whitelisted/", + alternateURI: "http://www.whitelisted.com/", + inWhitelist: true, + }, { + input: "café.local", + fixedURI: "http://café.local/", + alternateURI: "http://www.café.local/", + protocolChange: true + }, { + input: "47.6182,-122.830", + fixedURI: "http://47.6182,-122.830/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "-47.6182,-23.51", + fixedURI: "http://-47.6182,-23.51/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "-22.14,23.51-", + fixedURI: "http://-22.14,23.51-/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "32.7", + fixedURI: "http://32.0.0.7/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "5+2", + fixedURI: "http://5+2/", + alternateURI: "http://www.5+2.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "5/2", + fixedURI: "http://0.0.0.5/2", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }, { + input: "moz ?.::%27", + keywordLookup: true, + protocolChange: true + }, { + input: "mozilla.com/?q=search", + fixedURI: "http://mozilla.com/?q=search", + alternateURI: "http://www.mozilla.com/?q=search", + protocolChange: true + }, { + input: "mozilla.com?q=search", + fixedURI: "http://mozilla.com/?q=search", + alternateURI: "http://www.mozilla.com/?q=search", + protocolChange: true + }, { + input: "mozilla.com ?q=search", + keywordLookup: true, + protocolChange: true + }, { + input: "mozilla.com.?q=search", + fixedURI: "http://mozilla.com./?q=search", + protocolChange: true + }, { + input: "mozilla.com'?q=search", + fixedURI: "http://mozilla.com'/?q=search", + alternateURI: "http://www.mozilla.com'/?q=search", + protocolChange: true + }, { + input: "mozilla.com':search", + keywordLookup: true, + protocolChange: true + }, { + input: "[mozilla]", + keywordLookup: true, + protocolChange: true + }, { + input: "':?", + fixedURI: "http://'/?", + alternateURI: "http://www.'.com/?", + keywordLookup: true, + protocolChange: true, + }, { + input: "a?.com", + fixedURI: "http://a/?.com", + alternateURI: "http://www.a.com/?.com", + protocolChange: true, + }, { + input: "?'.com", + fixedURI: "http:///?%27.com", + alternateURI: "http://www..com/?%27.com", + keywordLookup: true, + protocolChange: true, + }, { + input: "' ?.com", + keywordLookup: true, + protocolChange: true + }, { + input: "?mozilla", + fixedURI: "http:///?mozilla", + alternateURI: "http://www..com/?mozilla", + keywordLookup: true, + protocolChange: true, + }, { + input: "??mozilla", + fixedURI: "http:///??mozilla", + alternateURI: "http://www..com/??mozilla", + keywordLookup: true, + protocolChange: true, + }, { + input: "mozilla/", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + protocolChange: true, + }, { + input: "mozilla", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + protocolChange: true, + keywordLookup: true, + affectedByDNSForSingleHosts: true, + }, { + input: "mozilla5/2", + fixedURI: "http://mozilla5/2", + alternateURI: "http://www.mozilla5.com/2", + protocolChange: true, + }, { + input: "mozilla/foo", + fixedURI: "http://mozilla/foo", + alternateURI: "http://www.mozilla.com/foo", + protocolChange: true, + }, { + input: "mozilla\\", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + keywordLookup: true, + protocolChange: true, + affectedByDNSForSingleHosts: true, + }]; + +if (Services.appinfo.OS.toLowerCase().startsWith("win")) { + testcases.push({ + input: "C:\\some\\file.txt", + fixedURI: "file:///C:/some/file.txt", + protocolChange: true, + }); + testcases.push({ + input: "//mozilla", + fixedURI: "http://mozilla/", + alternateURI: "http://www.mozilla.com/", + protocolChange: true, + }); +} else { + testcases.push({ + input: "/some/file.txt", + fixedURI: "file:///some/file.txt", + protocolChange: true, + }); + testcases.push({ + input: "//mozilla", + fixedURI: "file:////mozilla", + protocolChange: true, + }); +} + +function sanitize(input) { + return input.replace(/\r|\n/g, "").trim(); +} + + +var gSingleWordHostLookup = false; +function run_test() { + // Only keywordlookup things should be affected by requiring a DNS lookup for single-word hosts: + do_print("Check only keyword lookup testcases should be affected by requiring DNS for single hosts"); + let affectedTests = testcases.filter(t => !t.keywordLookup && t.affectedByDNSForSingleHosts); + if (affectedTests.length) { + for (let testcase of affectedTests) { + do_print("Affected: " + testcase.input); + } + } + do_check_eq(affectedTests.length, 0); + do_single_test_run(); + gSingleWordHostLookup = true; + do_single_test_run(); +} + +function do_single_test_run() { + Services.prefs.setBoolPref(kForceHostLookup, gSingleWordHostLookup); + + let relevantTests = gSingleWordHostLookup ? testcases.filter(t => t.keywordLookup) : + testcases; + + for (let { input: testInput, + fixedURI: expectedFixedURI, + alternateURI: alternativeURI, + keywordLookup: expectKeywordLookup, + protocolChange: expectProtocolChange, + inWhitelist: inWhitelist, + affectedByDNSForSingleHosts: affectedByDNSForSingleHosts, + } of relevantTests) { + + // Explicitly force these into a boolean + expectKeywordLookup = !!expectKeywordLookup; + expectProtocolChange = !!expectProtocolChange; + inWhitelist = !!inWhitelist; + affectedByDNSForSingleHosts = !!affectedByDNSForSingleHosts; + + expectKeywordLookup = expectKeywordLookup && (!affectedByDNSForSingleHosts || !gSingleWordHostLookup); + + for (let flags of flagInputs) { + let info; + let fixupURIOnly = null; + try { + fixupURIOnly = urifixup.createFixupURI(testInput, flags); + } catch (ex) { + do_print("Caught exception: " + ex); + do_check_eq(expectedFixedURI, null); + } + + try { + info = urifixup.getFixupURIInfo(testInput, flags); + } catch (ex) { + // Both APIs should return an error in the same cases. + do_print("Caught exception: " + ex); + do_check_eq(expectedFixedURI, null); + do_check_eq(fixupURIOnly, null); + continue; + } + + do_print("Checking \"" + testInput + "\" with flags " + flags + + " (host lookup for single words: " + (gSingleWordHostLookup ? "yes" : "no") + ")"); + + // Both APIs should then also be using the same spec. + do_check_eq(!!fixupURIOnly, !!info.preferredURI); + if (fixupURIOnly) + do_check_eq(fixupURIOnly.spec, info.preferredURI.spec); + + let isFileURL = expectedFixedURI && expectedFixedURI.startsWith("file"); + + // Check the fixedURI: + let makeAlternativeURI = flags & urifixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI; + if (makeAlternativeURI && alternativeURI != null) { + do_check_eq(info.fixedURI.spec, alternativeURI); + } else { + do_check_eq(info.fixedURI && info.fixedURI.spec, expectedFixedURI); + } + + // Check booleans on input: + let couldDoKeywordLookup = flags & urifixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP; + do_check_eq(!!info.keywordProviderName, couldDoKeywordLookup && expectKeywordLookup); + do_check_eq(info.fixupChangedProtocol, expectProtocolChange); + do_check_eq(info.fixupCreatedAlternateURI, makeAlternativeURI && alternativeURI != null); + + // Check the preferred URI + if (couldDoKeywordLookup) { + if (expectKeywordLookup) { + if (!inWhitelist) { + let urlparamInput = encodeURIComponent(sanitize(testInput)).replace(/%20/g, "+"); + // If the input starts with `?`, then info.preferredURI.spec will omit it + // In order to test this behaviour, remove `?` only if it is the first character + if (urlparamInput.startsWith("%3F")) { + urlparamInput = urlparamInput.replace("%3F", ""); + } + let searchURL = kSearchEngineURL.replace("{searchTerms}", urlparamInput); + let spec = info.preferredURI.spec.replace(/%27/g, "'"); + do_check_eq(spec, searchURL); + } else { + do_check_eq(info.preferredURI, null); + } + } else { + do_check_eq(info.preferredURI.spec, info.fixedURI.spec); + } + } else { + // In these cases, we should never be doing a keyword lookup and + // the fixed URI should be preferred: + do_check_eq(info.preferredURI.spec, info.fixedURI.spec); + } + do_check_eq(sanitize(testInput), info.originalInput); + } + } +} diff --git a/docshell/test/unit/test_nsDefaultURIFixup_search.js b/docshell/test/unit/test_nsDefaultURIFixup_search.js new file mode 100644 index 000000000..c00b6a85f --- /dev/null +++ b/docshell/test/unit/test_nsDefaultURIFixup_search.js @@ -0,0 +1,117 @@ +var urifixup = Cc["@mozilla.org/docshell/urifixup;1"]. + getService(Ci.nsIURIFixup); +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/AppConstants.jsm"); + +Services.prefs.setBoolPref("keyword.enabled", true); + +const kSearchEngineID = "test_urifixup_search_engine"; +const kSearchEngineURL = "http://www.example.org/?search={searchTerms}"; +Services.search.addEngineWithDetails(kSearchEngineID, "", "", "", "get", + kSearchEngineURL); + +var oldDefaultEngine = Services.search.defaultEngine; +Services.search.defaultEngine = Services.search.getEngineByName(kSearchEngineID); + +var selectedName = Services.search.defaultEngine.name; +do_check_eq(selectedName, kSearchEngineID); + +do_register_cleanup(function() { + if (oldDefaultEngine) { + Services.search.defaultEngine = oldDefaultEngine; + } + let engine = Services.search.getEngineByName(kSearchEngineID); + if (engine) { + Services.search.removeEngine(engine); + } + Services.prefs.clearUserPref("keyword.enabled"); +}); + +var isWin = AppConstants.platform == "win"; + +var data = [ + { + // Valid should not be changed. + wrong: 'https://example.com/this/is/a/test.html', + fixed: 'https://example.com/this/is/a/test.html', + }, + { + // Unrecognized protocols should be changed. + wrong: 'whatever://this/is/a/test.html', + fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent('whatever://this/is/a/test.html')), + }, + + // The following tests check that when a user:password is present in the URL + // `user:` isn't treated as an unknown protocol thus leaking the user and + // password to the search engine. + { + wrong: 'user:pass@example.com/this/is/a/test.html', + fixed: 'http://user:pass@example.com/this/is/a/test.html', + }, + { + wrong: 'user@example.com:8080/this/is/a/test.html', + fixed: 'http://user@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'https:pass@example.com/this/is/a/test.html', + fixed: 'https://pass@example.com/this/is/a/test.html', + }, + { + wrong: 'user:pass@example.com:8080/this/is/a/test.html', + fixed: 'http://user:pass@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'http:user:pass@example.com:8080/this/is/a/test.html', + fixed: 'http://user:pass@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'ttp:user:pass@example.com:8080/this/is/a/test.html', + fixed: 'http://user:pass@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'gobbledygook:user:pass@example.com:8080/this/is/a/test.html', + fixed: 'http://gobbledygook:user%3Apass@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'user:@example.com:8080/this/is/a/test.html', + fixed: 'http://user:@example.com:8080/this/is/a/test.html', + }, + { + wrong: '//user:pass@example.com:8080/this/is/a/test.html', + fixed: (isWin ? "http:" : "file://") + '//user:pass@example.com:8080/this/is/a/test.html', + }, + { + wrong: '://user:pass@example.com:8080/this/is/a/test.html', + fixed: 'http://user:pass@example.com:8080/this/is/a/test.html', + }, + { + wrong: 'whatever://this/is/a@b/test.html', + fixed: kSearchEngineURL.replace("{searchTerms}", encodeURIComponent('whatever://this/is/a@b/test.html')), + }, +]; + +var extProtocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"] + .getService(Ci.nsIExternalProtocolService); + +if (extProtocolSvc && extProtocolSvc.externalProtocolHandlerExists("mailto")) { + data.push({ + wrong: "mailto:foo@bar.com", + fixed: "mailto:foo@bar.com" + }); +} + +function run_test() { + run_next_test(); +} + +var len = data.length; +// Make sure we fix what needs fixing +add_task(function test_fix_unknown_schemes() { + for (let i = 0; i < len; ++i) { + let item = data[i]; + let result = + urifixup.createFixupURI(item.wrong, + urifixup.FIXUP_FLAG_FIX_SCHEME_TYPOS).spec; + do_check_eq(result, item.fixed); + } +}); diff --git a/docshell/test/unit/test_nsIDownloadHistory.js b/docshell/test/unit/test_nsIDownloadHistory.js new file mode 100644 index 000000000..2030f0702 --- /dev/null +++ b/docshell/test/unit/test_nsIDownloadHistory.js @@ -0,0 +1,68 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 NS_DOWNLOADHISTORY_CID = "{2ee83680-2af0-4bcb-bfa0-c9705f6554f1}"; + +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyGetter(this, "Services", function() { + Components.utils.import("resource://gre/modules/Services.jsm"); + return Services; +}); + +function testLinkVistedObserver() +{ + const NS_LINK_VISITED_EVENT_TOPIC = "link-visited"; + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + var testURI = ios.newURI("http://google.com/", null, null); + + var gh = Cc["@mozilla.org/browser/global-history;2"]. + getService(Ci.nsIGlobalHistory2); + do_check_false(gh.isVisited(testURI)); + + var topicReceived = false; + var obs = { + observe: function tlvo_observe(aSubject, aTopic, aData) + { + if (NS_LINK_VISITED_EVENT_TOPIC == aTopic) { + do_check_eq(testURI, aSubject); + topicReceived = true; + } + } + }; + + var os = Cc["@mozilla.org/observer-service;1"]. + getService(Ci.nsIObserverService); + os.addObserver(obs, NS_LINK_VISITED_EVENT_TOPIC, false); + + var dh = Components.classesByID[NS_DOWNLOADHISTORY_CID]. + getService(Ci.nsIDownloadHistory); + dh.addDownload(testURI); + do_check_true(topicReceived); + do_check_true(gh.isVisited(testURI)); +} + +var tests = [testLinkVistedObserver]; + +function run_test() +{ + // Not everyone uses/defines an nsGlobalHistory* service. Especially if + // MOZ_PLACES is not defined. If getService fails, then abort gracefully. + try { + Cc["@mozilla.org/browser/global-history;2"]. + getService(Ci.nsIGlobalHistory2); + } + catch (ex) { + return; + } + + // Needed to properly setup and shutdown the profile. + do_get_profile(); + + for (var i = 0; i < tests.length; i++) + tests[i](); + + cleanup(); +} diff --git a/docshell/test/unit/test_pb_notification.js b/docshell/test/unit/test_pb_notification.js new file mode 100644 index 000000000..82018f585 --- /dev/null +++ b/docshell/test/unit/test_pb_notification.js @@ -0,0 +1,23 @@ +if (typeof Cc === "undefined") + Cc = Components.classes; +if (typeof Ci === "undefined") + Ci = Components.interfaces; + +function destroy_transient_docshell() { + var docshell = Cc["@mozilla.org/docshell;1"].createInstance(Ci.nsIDocShell); + docshell.setOriginAttributes({privateBrowsingId : 1}); + do_test_pending(); + do_timeout(0, Components.utils.forceGC); +} + +function run_test() { + var obs = { + observe: function(aSubject, aTopic, aData) { + do_check_eq(aTopic, "last-pb-context-exited"); + do_test_finished(); + } + }; + var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); + os.addObserver(obs, "last-pb-context-exited", false); + destroy_transient_docshell(); +} diff --git a/docshell/test/unit/test_privacy_transition.js b/docshell/test/unit/test_privacy_transition.js new file mode 100644 index 000000000..829e25c3c --- /dev/null +++ b/docshell/test/unit/test_privacy_transition.js @@ -0,0 +1,23 @@ +var gNotifications = 0; + +var observer = { + QueryInterface: function(iid) { + if (Ci.nsIPrivacyTransitionObserver.equals(iid) || + Ci.nsISupportsWeakReference.equals(iid) || + Ci.nsISupports.equals(iid)) + return this; + throw Cr.NS_ERROR_NO_INTERFACE; + }, + + privateModeChanged: function(enabled) { + gNotifications++; + } +} + +function run_test() { + var docshell = Cc["@mozilla.org/docshell;1"].createInstance(Ci.nsIDocShell); + docshell.addWeakPrivacyTransitionObserver(observer); + docshell.setOriginAttributes({ privateBrowsingId : 1 }); + docshell.setOriginAttributes({ privateBrowsingId : 0 }); + do_check_eq(gNotifications, 2); +} \ No newline at end of file diff --git a/docshell/test/unit/test_setUsePrivateBrowsing.js b/docshell/test/unit/test_setUsePrivateBrowsing.js new file mode 100644 index 000000000..739186895 --- /dev/null +++ b/docshell/test/unit/test_setUsePrivateBrowsing.js @@ -0,0 +1,65 @@ +"use strict"; + +const {utils: Cu} = Components; + +Cu.import("resource://gre/modules/AppConstants.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +add_task(function*() { + let webNav = Services.appShell.createWindowlessBrowser(false); + + let loadContext = webNav.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsILoadContext); + + let docShell = webNav.getInterface(Ci.nsIDocShell); + + equal(loadContext.usePrivateBrowsing, false, "Should start out in non-private mode"); + + loadContext.usePrivateBrowsing = true; + equal(loadContext.usePrivateBrowsing, true, + "Should be able to change to private mode prior to a document load"); + + loadContext.usePrivateBrowsing = false; + equal(loadContext.usePrivateBrowsing, false, + "Should be able to change to non-private mode prior to a document load"); + + let oa = docShell.getOriginAttributes(); + + oa.privateBrowsingId = 1; + docShell.setOriginAttributes(oa); + + equal(loadContext.usePrivateBrowsing, true, + "Should be able to change origin attributes prior to a document load"); + + oa.privateBrowsingId = 0; + docShell.setOriginAttributes(oa); + + equal(loadContext.usePrivateBrowsing, false, + "Should be able to change origin attributes prior to a document load"); + + webNav.loadURI("data:text/html,", webNav.LOAD_FLAGS_NONE, null, null, null); + + // Return to the event loop so the load can begin. + yield new Promise(do_execute_soon); + + // This causes a failed assertion rather than an exception on debug + // builds. + if (!AppConstants.DEBUG) { + Assert.throws(() => { loadContext.usePrivateBrowsing = true; }, + /NS_ERROR_FAILURE/, + "Should not be able to change private browsing state after initial load has started"); + + oa.privateBrowsingId = 1; + Assert.throws(() => { docShell.setOriginAttributes(oa); }, + /NS_ERROR_FAILURE/, + "Should not be able to change origin attributes after initial load has started"); + + equal(loadContext.usePrivateBrowsing, false, + "Should not be able to change private browsing state after initial load has started"); + + loadContext.usePrivateBrowsing = false; + ok(true, "Should be able to set usePrivateBrowsing to its current value even after initial load"); + } + + webNav.close(); +}); diff --git a/docshell/test/unit/xpcshell.ini b/docshell/test/unit/xpcshell.ini new file mode 100644 index 000000000..ce8ec8b63 --- /dev/null +++ b/docshell/test/unit/xpcshell.ini @@ -0,0 +1,17 @@ +[DEFAULT] +head = head_docshell.js +tail = + +[test_bug414201_jfif.js] +[test_bug442584.js] +[test_nsDefaultURIFixup.js] +[test_nsDefaultURIFixup_search.js] +skip-if = os == 'android' +[test_nsDefaultURIFixup_info.js] +skip-if = os == 'android' +[test_nsIDownloadHistory.js] +[test_pb_notification.js] +# Bug 751575: unrelated JS changes cause timeouts on random platforms +skip-if = true +[test_privacy_transition.js] +[test_setUsePrivateBrowsing.js] diff --git a/docshell/test/unit_ipc/test_pb_notification_ipc.js b/docshell/test/unit_ipc/test_pb_notification_ipc.js new file mode 100644 index 000000000..1517a479f --- /dev/null +++ b/docshell/test/unit_ipc/test_pb_notification_ipc.js @@ -0,0 +1,20 @@ +var Cc = Components.classes; +var Ci = Components.interfaces; + +function run_test() { + var notifications = 0; + var obs = { + observe: function(aSubject, aTopic, aData) { + do_check_eq(aTopic, "last-pb-context-exited"); + notifications++; + } + }; + var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); + os.addObserver(obs, "last-pb-context-exited", false); + + run_test_in_child("../unit/test_pb_notification.js", + function() { + do_check_eq(notifications, 1); + do_test_finished(); + }); +} \ No newline at end of file diff --git a/docshell/test/unit_ipc/xpcshell.ini b/docshell/test/unit_ipc/xpcshell.ini new file mode 100644 index 000000000..7a2df27c0 --- /dev/null +++ b/docshell/test/unit_ipc/xpcshell.ini @@ -0,0 +1,8 @@ +[DEFAULT] +head = +tail = +skip-if = toolkit == 'android' + +[test_pb_notification_ipc.js] +# Bug 751575: Perma-fails with: command timed out: 1200 seconds without output +skip-if = true -- cgit v1.2.3